Predicting Formation Factor#

The formation factor is the ratio of the conductivity 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 factor 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

%matplotlib inline

Create Network#

pn =[15, 15, 15], spacing=1e-6)

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

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);

Visualize Results#

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

fig, ax = plt.subplots(figsize=[5, 5])
_ = plt.axis('off')

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 analogous.

\[\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.

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}')
[20:21:24] WARNING  Attempting to estimate inlet area...will be low                    
           WARNING  Attempting to estimate domain length...could be low if boundary pores were
                    not added                                                                                      
Formation factor is: 10089643222.09