Predicting Formation Factor#

The formation factor is the ratio of the conducitivity of the pure brine to the measured conductivity

\[\begin{split} F = \frac{\sigma_{brine}}{\sigma_{measured}}\\ \end{split}\]

This example shows how to calculate the formation factor from a fickian diffusion simulation on a cubic network. Note that formation factior calculation on an extracted network from Porespy follows similar steps in assigning phase, algorithm and calculating the effective property.

import numpy as np
import openpnm as op
import matplotlib.pyplot as plt

%config InlineBackend.figure_formats = ['svg']
np.random.seed(10)
%matplotlib inline
np.set_printoptions(precision=5)

Create Network#

pn = op.network.Cubic(shape=[15, 15, 15], spacing=1e-6)
pn.add_model_collection(op.models.collections.geometry.spheres_and_cylinders)
pn.regenerate_models()

Create Phase#

Since the formation factor is a property of the porous medium and not the diffusing phase, any phase with known diffusion coefficient can be used as the diffusing phase. In this example, we use water as the phase diffusing through the porous medium.

phase = op.phase.Water(network=pn)
phase['pore.diffusivity'] = 2.299e-9
phase.add_model_collection(op.models.collections.physics.basic)
phase.regenerate_models()

Apply Fickian Diffusion#

To calculate the formation factor in the x direction, a constant concentration boundary condition is applied on the left and right side of the network. Note that a similar procedure can be followed to find the formation factor in y and z directions.

inlet = pn.pores('left')
outlet = pn.pores('right')
Diff = op.algorithms.FickianDiffusion(network=pn, phase=phase)
C_in, C_out = [10, 5]
Diff.set_value_BC(pores=inlet, values=C_in)
Diff.set_value_BC(pores=outlet, values=C_out)
Diff.run();
fick_02 : Newton iterations:   0%|          | 0/100 [00:00<?, ?it/s]
                                                                    

Visualize Results#

The results are visualized using plot_coordinates with the colour corresponding to their concentration.

fig, ax = plt.subplots(figsize=[5, 5])
op.visualization.plot_coordinates(ax=fig,
                                  network=pn,
                                  size_by=pn["pore.diameter"],
                                  color_by=Diff["pore.concentration"], 
                                  markersize=100)
_ = plt.axis('off')
../../_images/6fb017ac15a53f43e63572b3888a4758997227583faa410399d3f79238bd95d7.svg

Calculate Formation Factor#

In porous media research, the effective transport properties of one process can be used as a substitute for another, for example, electron conduction and diffusion are analagous.

\[\begin{split} \frac{D_{eff}}{D_{AB}} = \frac{\sigma_{eff}}{\sigma}\\ \end{split}\]

The formation factor can therefore be calculated from the ratio of the pure diffusion coefficient and the effective diffusion coefficient.

Note that the area and length of the domain can be determined using get_domain_area and get_domain_length respectively. Please pay attention to the warnings that these may underestimate the size of the domain. Adding boundary pores to an extracted network will ensure the correct length is calculated.

# NBVAL_IGNORE_OUTPUT
R = Diff.rate(pores=inlet, mode='group')[0]
A = op.topotools.get_domain_area(pn, inlets=inlet, outlets=outlet);
L = op.topotools.get_domain_length(pn, inlets=inlet, outlets=outlet)
D_eff = R * L / (A) / (C_in - C_out)
F = 1/D_eff
print(f'Formation factor is: {F:.2f}')
------------------------------------------------------------
  - WARNING: Attempting to estimate inlet area...will be low 
  - SOURCE : openpnm.topotools._topotools.get_domain_area 
  - TIME   : 2022-09-21 01:42:24,630    
------------------------------------------------------------
------------------------------------------------------------
  - WARNING: Attempting to estimate domain length...could be
             low if boundary pores were not added 
  - SOURCE : openpnm.topotools._topotools.get_domain_length 
  - TIME   : 2022-09-21 01:42:24,634    
------------------------------------------------------------
Formation factor is: 10089643222.09