porousMicroTransport
porousMicroTransport copied to clipboard
OpenFOAM solvers for flow and transport in porous media in paper-based microfluidics
porousMicroTransport
porousMicroTransport is a set of additional solvers and related libraries for OpenFOAM developed for the purposes of simulating flow and transport in porous media, with an emphasis on paper-based microfluidics
Installation
Install from source
Requirements
porousMicroTransport requires OpenFOAM, as distributed by OpenCFD (openfoam.com). Compatible OpenFOAM versions are v2112, v2206, v2212, v2306 and v2312.
Versions produced by the OpenFOAM Foundation (openfoam.org) (e.g. OpenFOAM 9, OpenFOAM 10) are not compatible. macOS users may want to consider OpenFOAM.app.
Download
Download the source code of porousMicroTransport, or clone this repository with Git:
git clone https://github.com/gerlero/porousMicroTransport.git
Compile and install
To build and install porousMicroTransport, just invoke the top-level Allwmake
script:
cd porousMicroTransport
./Allwmake -j
If necessary, activate/source the correct OpenFOAM environment before running Allwmake
.
Test
Optionally, you can verify the installation of porousMicroTransport by running the included test suite (requires Python 3.7 or later):
tests/Alltest
Docker image
Alternatively, porousMicroTransport is also available in the form of Docker images. These images are based on the official OpenFOAM Docker images and include porousMicroTransport precompiled and ready to use. Assuming Docker is installed, you can run the latest image of porousMicroTransport in a new container with:
docker run -it microfluidica/porousmicrotransport
Or, if you use OpenFOAM's openfoam-docker
script (which takes care of making the working directory available inside the container):
openfoam-docker -image=microfluidica/porousmicrotransport
A slimmer image variant that does not include source code, development tools or tutorial cases is available as microfluidica/porousmicrotransport:run
.
Docker images can also be used with other compatible containerization software, such as Podman and Singularity/Apptainer.
Solvers
moistureDiffusivityFoam
(Unsaturated) capillarity-driven flow in a porous medium, governed by the moisture diffusivity equation[^Bear]:
$$\frac{\partial\theta}{\partial t} - \nabla\cdot\left[D\nabla\theta\right] = 0$$
where $\theta$ is the moisture content and $D$ is a saturation-dependent diffusivity as defined by an unsaturated flow model.
porousMicroTransportFoam
Transport by steady flow of any number of species in a porous medium, with optional reactions between the species. For each species (concentration $C$), the governing equation is:
$$\frac{\partial R_d \theta C}{\partial t} + \nabla\cdot\left[UC\right] - \nabla\cdot\left[\theta D_{eff}\nabla C\right] = \theta F$$
where $F$ is a reaction term (see below), $R_d$ is defined as:
$$R_d = 1 + \frac{\rho_s\left(1 - \varepsilon_\textrm{tot}\right)K_d}{\theta}$$
and $D_{eff}$ is defined as:
$$D_{eff} = \left(\frac{D_M}{\tau} + \alpha_T|V|\right)I + \left(\alpha_L - \alpha_T\right)\frac{VV}{|V|}$$
with $I$ the identity tensor and $V$ the true velocity of the fluid ($=U/\theta$).
moistureDiffusivityTransportFoam
Capillary flow + reactive transport in a porous medium, coupling the moisture diffusivity equation for flow with the previous transport equation.
Case layout
The layout of porousMicroTransport cases follows many conventions of porousMultiphaseFoam, especially in field names and entries in the transportProperties
dictionary. This allows for easy conversion of cases from porousMultiphaseFoam to porousMicroTransport (and to some extent, vice versa).
Common fields
These variable fields are defined in the time directories:
-
theta
: moisture content (scalar). Optional forporousMicroTransportFoam
-
U
: Darcy velocity (vector). Optional for flow solvers
Common porous medium properties
Defined as scalar fields in constant
or as dictionary entries in transportProperties
:
-
eps
orthetamax
: effective porosity ($\varepsilon$) -
K
: intrinsic permeability. Flow solvers only -
rs
: particle density ($\rho_s$). Transport solvers only -
epsTotal
: total porosity ($\varepsilon_\textrm{tot}$). Transport solvers only -
tau
: diffusive tortuosity ($\tau$). Transport solvers only -
alphaT
: transverse dispersion coefficient ($\alpha_T$). Transport solvers only -
alphaL
: longitudinal dispersion coefficient ($\alpha_L$). Transport solvers only
Phase properties
Flow solvers only.
Set these in a phase.theta
subdictionary in transportProperties
:
-
rho
: density -
mu
: dynamic viscosity
Moisture content options
Flow solvers only.
Defined as scalar fields in constant
or as dictionary entries in transportProperties
:
-
thetamin
: minimum (a.k.a. residual) moisture content -
thetamax
: maximum moisture content (usually equal to the porosity)
Unsaturated flow models
Flow solvers only.
Supported models of unsaturated flow are:
-
BrooksAndCorey
: Brooks and Corey[^BrooksAndCorey] model- In coefficient dictionary
BrooksAndCoreyCoeffs
:pc0
,alpha
,n
,l
(optional)
- In coefficient dictionary
-
VanGenuchten
: Van Genuchten[^VanGenuchten] model- In coefficient dictionary
VanGenuchtenCoeffs
:pc0
,m
orn
,l
(optional)
- In coefficient dictionary
-
LETxs
: LETx + LETs model[^LETxs]- In coefficient dictionary
LETCoeffs
:pc0
,Lw
,Ew
,Tw
,Ls
,Es
,Ts
- In coefficient dictionary
-
LETd
: LETd[^LETd] model- In coefficient dictionary
LETCoeffs
:pc0
,L
,E
,T
- In coefficient dictionary
To choose a model for your simulation, set the unsaturatedFlowModel
entry in transportProperties
. Then set the model-specific parameters in the corresponding coefficient subdictionary.
Special boundary conditions for flow
Flow solvers only.
Besides the standard OpenFOAM boundary conditions (e.g. zeroGradient
, fixedValue
), the solvers support these additional boundary conditions for theta
:
-
darcyGradPressure
: follow the boundary condition set for velocity (same asdarcyGradPressure
in porousMultiphaseFoam). -
exhaustible
: models an inlet reservoir with a fixed volume of fluid that is gradually depleted as fluid flows into the domain. Aremaining
entry is required (volume remaining in the reservoir).
Transported species
Transport solvers only.
A species
list in transportProperties
contains the names of all transported species.
Each species must also define its own scalar concentration field (named the same as the species).
For each species, the following entries can be set in transportProperties
:
-
Dm
: molecular diffusivity ($D_M$) -
Kd
: partitioning coefficient ($K_d$)
Reactions
Transport solvers only.
Reactions are defined in a reactions
subdictionary in transportProperties
. The reactions
dictionary contains a list of subdictionaries, each of which defines a single reaction. A reaction can have an arbitrary name and should contain the following entries:
-
reaction
: reaction equation. E.g."A^2 + B = 2C + D"
, whereA
,B
,C
andD
are names of defined species -
kf
: forward rate constant -
kr
: optional reverse rate constant (for reversible reactions)
Automatic timestep control
To enable automatic timestep adjustment, set adjustTimeStep
to yes
in system/controlDict
. Then, configure it as follows:
-
For flow, set a
tolerance
value inside aPicard
dictionary insystem/fvSolution
-
For transport, add a
maxDeltaC
and/orrelMaxDeltaC
entry insystem/controlDict
Tutorials
Sample cases are available in the tutorials
directory.
Related projects
-
porousMultiphaseFoam[^porousMultiphaseFoam]: toolbox for OpenFOAM for modeling multiphase flow and transport. porousMicroTransport is mostly compatible with porousMultiphaseFoam in terms of case definitions, and can be installed alongside it.
-
electroMicroTransport[^electroMicroTransport]: toolbox for OpenFOAM dedicated to electromigrative separations. It includes support for modeling separations in paper-based media, and can also be installed alongside porousMicroTransport.
[^electroMicroTransport]: Gerlero, G.S., Marquez Damián, S., Kler, P.A.: electroMicroTransport v2107: Open-source toolbox for paper-based electromigrative separations. Comput. Phys. Comm., 269, 108143 (2021)
[^BrooksAndCorey]: Brooks, R., Corey, T.: Hydraulic properties of porous media. Hydrol. Pap. Colo. State Univ., 24, 37 (1964)
[^VanGenuchten]: Van Genuchten, M.Th.: A closed-form equation for predicting the hydraulic conductivity of unsaturated soils. Soil Sci. Soc. Am. J., 44, 892–898 (1980)