Repository: PMEAL/OpenPNM
Pull request #1197 (2019-01-11 15:37:07)

Taylor-Aris model with test
Taylor-Aris model for advection-diffusion problems with a unit test.


Patch:
diff --git a/openpnm/models/physics/diffusive_conductance.py b/openpnm/models/physics/diffusive_conductance.py
index a05bf58de..a89efef9d 100644
--- a/openpnm/models/physics/diffusive_conductance.py
+++ b/openpnm/models/physics/diffusive_conductance.py
@@ -66,3 +66,28 @@ def ordinary_diffusion(target,
                                throat_diffusivity=throat_diffusivity,
                                conduit_lengths=conduit_lengths,
                                conduit_shape_factors=conduit_shape_factors)
+
+
+def taylor_aris_diffusion(
+        target,
+        pore_area='pore.area',
+        throat_area='throat.area',
+        pore_diffusivity='pore.diffusivity',
+        pore_pressure='pore.pressure',
+        throat_hydraulic_conductance='throat.hydraulic_conductance',
+        throat_diffusivity='throat.diffusivity',
+        conduit_lengths='throat.conduit_lengths',
+        conduit_shape_factors='throat.poisson_shape_factors'):
+    r"""
+    """
+    return generic_conductance(
+        target=target,
+        transport_type='taylor_aris_diffusion',
+        pore_area=pore_area,
+        throat_area=throat_area,
+        pore_diffusivity=pore_diffusivity,
+        throat_diffusivity=throat_diffusivity,
+        conduit_lengths=conduit_lengths,
+        conduit_shape_factors=conduit_shape_factors,
+        pore_pressure=pore_pressure,
+        throat_hydraulic_conductance=throat_hydraulic_conductance)
diff --git a/openpnm/models/physics/misc.py b/openpnm/models/physics/misc.py
index 6bf615f04..3d9fd494d 100644
--- a/openpnm/models/physics/misc.py
+++ b/openpnm/models/physics/misc.py
@@ -4,7 +4,7 @@ import scipy as _sp
 
 def generic_conductance(target, transport_type, pore_diffusivity,
                         throat_diffusivity, pore_area, throat_area,
-                        conduit_lengths, conduit_shape_factors):
+                        conduit_lengths, conduit_shape_factors, **kwargs):
     r"""
     Calculate the generic conductance (could be mass, thermal, electrical,
     or hydraylic) of conduits in the network, where a conduit is
@@ -99,8 +99,30 @@ def generic_conductance(target, transport_type, pore_diffusivity,
         g1[m1] = (D1*A1)[m1] / L1[m1]
         g2[m2] = (D2*A2)[m2] / L2[m2]
         gt[mt] = (Dt*At)[mt] / Lt[mt]
+    elif transport_type == 'taylor_aris_diffusion':
+        for k, v in kwargs.items():
+            if k == 'pore_pressure':
+                pore_pressure = v
+            elif k == 'throat_hydraulic_conductance':
+                throat_hydraulic_conductance = v
+        P = phase[pore_pressure]
+        gh = phase[throat_hydraulic_conductance]
+        Qt = -gh*_sp.diff(P[cn], axis=1).squeeze()
+
+        u1 = Qt[m1]/A1[m1]
+        u2 = Qt[m2]/A2[m2]
+        ut = Qt[mt]/At[mt]
+
+        Pe1 = u1 * ((4*A1[m1]/_sp.pi)**0.5) / D1[m1]
+        Pe2 = u2 * ((4*A2[m2]/_sp.pi)**0.5) / D2[m2]
+        Pet = ut * ((4*At[mt]/_sp.pi)**0.5) / Dt[mt]
+
+        g1[m1] = D1[m1]*(1+(Pe1**2)/192)*A1[m1] / L1[m1]
+        g2[m2] = D2[m2]*(1+(Pe2**2)/192)*A2[m2] / L2[m2]
+        gt[mt] = Dt[mt]*(1+(Pet**2)/192)*At[mt] / Lt[mt]
     else:
         raise Exception('Unknown keyword for "transport_type", can only be' +
-                        ' "flow" or "diffusion"')
+                        ' "flow", "diffusion", "taylor_aris_diffusion"' +
+                        ' or "ionic"')
     # Apply shape factors and calculate the final conductance
     return (1/gt/SFt + 1/g1/SF1 + 1/g2/SF2)**(-1)


Test patch:
diff --git a/tests/unit/models/physics/DiffusiveConductanceTest.py b/tests/unit/models/physics/DiffusiveConductanceTest.py
index 59392f129..2ad42b693 100644
--- a/tests/unit/models/physics/DiffusiveConductanceTest.py
+++ b/tests/unit/models/physics/DiffusiveConductanceTest.py
@@ -1,5 +1,7 @@
 import openpnm as op
+import scipy as sp
 from numpy.testing import assert_approx_equal
+from numpy.testing import assert_allclose
 
 
 class DiffusiveConductanceTest:
@@ -21,12 +23,30 @@ class DiffusiveConductanceTest:
         self.geo['throat.conduit_lengths.throat'] = 0.6
         self.geo['throat.conduit_lengths.pore2'] = 0.25
         mod = op.models.physics.diffusive_conductance.ordinary_diffusion
-        self.phys.add_model(propname='throat.diffusive_conductance',
+        self.phys.add_model(propname='throat.o_diffusive_conductance',
                             model=mod)
         self.phys.regenerate_models()
-        actual = self.phys['throat.diffusive_conductance'].mean()
+        actual = self.phys['throat.o_diffusive_conductance'].mean()
         assert_approx_equal(actual, desired=1.0)
 
+    def test_taylor_aris_diffusion(self):
+        self.geo['throat.conduit_lengths.pore1'] = 0.15
+        self.geo['throat.conduit_lengths.throat'] = 0.6
+        self.geo['throat.conduit_lengths.pore2'] = 0.25
+        self.phase['pore.pressure'] = sp.linspace(0, 20, self.net.Np)
+        self.phase['throat.hydraulic_conductance'] = 1
+        mod = op.models.physics.diffusive_conductance.taylor_aris_diffusion
+        self.phys.add_model(propname='throat.ta_diffusive_conductance',
+                            model=mod)
+        self.phys.regenerate_models()
+        actual = sp.array([
+            self.phys['throat.ta_diffusive_conductance'].mean(),
+            self.phys['throat.ta_diffusive_conductance'].max(),
+            self.phys['throat.ta_diffusive_conductance'].min()])
+        desired = sp.array([1.03744, 1.10782, 1.00017])
+        actual = sp.around(actual, decimals=5)
+        assert_allclose(actual, desired)
+
 
 if __name__ == '__main__':