ArticlePDF Available

Abstract and Figures

Pore network modeling is a widely used technique for simulating multiphase transport in porous materials, but there are very few software options available. This work outlines the OpenPNM package that was jointly developed by several porous media research groups to help address this gap. OpenPNM is written in Python using NumPy and SciPy for most mathematical operations, thus combining Python's ease of use with the performance necessary to perform large simulations. The package assists the user with managing and interacting with all the topological, geometrical, and thermophysical data. It also includes a suite of commonly used algorithms for simulating percolation and performing transport calculations on pore networks. Most importantly, it was designed to be highly flexible to suit any application and be easily customized to include user-specified pore-scale physics models. The framework is fast, powerful, and concise. An illustrative example is included that determines the effective diffusivity through a partially water-saturated porous material with just 29 lines of code.
Content may be subject to copyright.
Section title
Editors: Konrad Hinsen, hinsen@cnrs- | Konstantin Läufer,
Software engineering track
60 Comput ing in Science & E ngineering 1521-9615/16/$33.0 0 © 2016 IEEE Copublished by the IEEE C S and the AIP July/August 2016
OpenPNM: A Pore Network
Modeling Package
Jeff Gostick and Mahmoudreza Aghighi | McGill University
James Hinebaugh | University of Toronto
Tom Tranter | University of Leeds
Michael A. Hoeh | Forschungszentrum Jülich
Harold Day and Brennan Spellacy | McGill University
Mostafa H. Sharqawy | University of Toronto and University of Guelph
Aimy Bazylak | University of Toronto
Alan Burns | University of Leeds
Werner Lehnert | Forschungszentrum Jülich and RWTH Aachen
Andreas Putz | Automotive Fuel Cell Cooperation
Pore network modeling (PNM) is a well-established
and long-standing approach for simulating transport
in porous materials.1–3 PNMs represent an alterna-
tive to the more widely used continuum modeling
in which a porous material is treated as a volume-averaged
continuum without resolving microscale features. Continu-
um models are mathematically rigorous, but they have some
practical limitations. First, each phenomenon being modeled
requires experimentally measured constitutive relationships
that describe the media’s macroscopic transport properties,
such as the permeability coecient or eective diusivity.
ese can be challenging to measure, especially for multi-
phase ow conditions. Second, treating the porous medium
as a volume-averaged continuum means that discrete pore-
Editors: Jeffrey Carver,, and Damian Rouson,
www.comput 61
scale phenomena and events aren’t resolved, so only
the average amount of a uid phase in each compu-
tational node is known. Moreover, the distribution
of phases within the continuum isn’t often well pre-
dicted by such models, which rely on simple exten-
sions to Darcy’s law for multiphase ow, rather than
more rigorous formulations.4 Finally, it sometimes
isn’t appropriate to invoke the volume-averaged ap-
proximation, particularly in thin materials such as
membranes and electrodes.5
PNMs solve these issues but sacrice some
mathematical rigor. Instead of solving nth-order par-
tial dierential equations (PDEs), the pore space is
treated as a network of “pipes.” Transport inside the
network is modeled using nite dierence schemes
to solve 1D analytical solutions of the relevant trans-
port equations. Despite this simplication, PNMs
successfully and eciently predict numerous aspects
of multiphase transport.6 e sizes and connectiv-
ity of the pores and throats are chosen to match the
known physical structure, meaning that the inter-
play between the structure and ow characteristics
is included. Structural properties of the porous ma-
terial can be readily obtained from various imaging
techniques7,8 or computer-generated structures.9–11
In the most basic case, pore and throat sizes are ad-
justed arbitrarily to allow the model to reproduce
known experimental properties.12 PNMs are natu-
rally geared toward percolation calculations,13 so
they simulate realistic uid invasion processes with
computational ease.14 is allows for truly pore-
scale descriptions of the uid distribution within
the media, which has major impacts on almost all
other transport processes. By simply setting pores
and throats lled with one phase as closed to other
phases, PNMs can predict constitutive relationships
for experimentally inaccessible multiphase param-
eters.15– 17 Extensive reviews of pore network mod-
eling and comparisons between the approaches are
available in the literature.18– 21
is article provides an overview of the
OpenPNM package for pore network simulations.
Currently, the only commercially viable software
product is PoreXpert, a program arising from a
research group at Plymouth University (formerly
known as Pore-Cor22), and groups sometimes pub-
lish overviews of their in-house code.23 To the best
of our knowledge, no other projects are under way
to produce an open source PNM framework, in
stark contrast to the eld of computational uid
dynamics, where a multitude of powerful commer-
cial and open source options24,25 exist. Generally,
researchers in the PNM community develop their
own code to be used internally by their research
group. is requires considerable resources and
investment, and existing code might not be opti-
mized for speed, modularity, extensibility, or main-
tainability; it’s almost never well documented for
future users. ese problems are all too common,
which were key motivators behind OpenPNM’s
development. e aim is to provide the porous
media community with a general, powerful, and
exible framework for tackling all manner of PNM
problems from the same code base. It is hoped this
will enable the sharing of code between research-
ers, provide a common baseline for comparing
models, and allow us all to build on the work of
others, thereby dramatically increasing the pace of
research and discovery.
OpenPNM was designed with three overall ob-
jectives in mind: accessibility to a wide audience,
generality to as many applications as possible, and
extensibility to simulate any type of physical process.
e rst and foremost principle is to ensure that the
code is accessible, in both the conceptual and physi-
cal sense. OpenPNM was coded in Python, which
is a powerful, easy-to-use, and free object-oriented
programming (OOP) language that’s increasingly
used in engineering calculations.26,27 Great eort
was expended creating detailed documentation,
and the OpenPNM website ( has a
continuously growing list of tutorials and examples.
e code is hosted publicly and is completely open
source and free. It’s registered with the Python pack-
age index (PyPI) so it can be installed with a simple
pip install openpnm
command. OpenPNM re-
quires no compilation of source code during instal-
lation (it’s written entirely in Python, which is an
interpreted scripting language). OpenPNM main-
tains good computational performance by relying
heavily on NumPy28 and SciPy ( to
perform numerical operations, both of which em-
ploy precompiled C code for speed. Another critical
aspect of accessibility is to ensure that the code is
well tested. At the time of this writing, 85 percent
of the 7,000 lines of code in the package are tested
regularly via an extensive suite of unit and integra-
tion tests. e second overall principle is generality,
so the package is fully agnostic to network topology,
shape, and dimension, allowing traditional cubic
lattices and fully random networks to be treated
identically. is is accomplished using approaches
borrowed from graph theory such as adjacency and
incidence matrices to store network topology and ar-
chitecture. OpenPNM includes a large suite of tools
for working with network topology, such as nd-
Software engineering track
62 July/August 2016
ing pores connected to given pores, and for label-
ing pores and throats for quick access later. Finally,
the package is designed to be easily customized by
researchers wishing to apply their own pore-scale
models, for example to calculate pore-wall surface
areas in some special way. Many common pore-scale
models are included with the package, but extensi-
bility and customization were a primary consider-
ation. Adding custom models is straightforward and
requires only basic function denitions that con-
tain blocks of procedural-style code, along with an
understanding of how OpenPNM stores data.
is article doesn’t provide exhaustive details
about each method or function; the code itself is
heavily documented in that regard, so the interested
reader is directed there for more details. We highly
recommend the use of an integrated development
environment (IDE) that supports autocomplete
and provides an object inspection pane to render
context-aware help les for each method (such as
Spyder). Some familiarity with Python and a basic
knowledge of OOP would also be helpful, such as
knowing denitions of a method and class.
Data Storage
OpenPNM stores all data, such as pore diameters, in
,28 which have become the de facto
standard numerical array data type in Python. ey
support slicing, fancy indexing, broadcasting, vec-
torization, and all the typically expected array opera-
tions. is approach was chosen over a more object-
oriented option such as that used by NetworkX29
because these operations are very fast when vector-
ized. OpenPNM also relies heavily on SciPy, which
is designed to work specically on NumPy arrays.
Pore and Throat Properties
One of OpenPNM’s main design considerations
was to accommodate all networks of arbitrary di-
mensionality, connectivity, shape, and so on. To ac-
complish this, OpenPNM stores all pore and throat
data in the most generic way possible: as lists (arrays)
of either NP or NT length, corresponding to the
number of pores and throats in the network, respec-
tively. is means that each pore (or throat) has an
index, and all properties for that pore (or throat) are
stored in the array element corresponding to that in-
dex. us, the diameter for pore 15 is stored in the
’ array in element 15, and the length
of throat 32 is stored in the ‘
’ array at
element 32. All of the property arrays are stored in a
dictionary, which is similar to a structured variable
in other programming languages. is
allows each property array to be accessed by its name
or key, with a syntax such as
, where
is the name of
the dictionary object.
Several rules have been imposed to control
data integrity. First, all names must begin with ei-
, which serves to identify the
type of information stored in the array. Second, for
the sake of consistency, only arrays of length NP or
NT are allowed in the dictionary. Any scalar values
written to the dictionaries are cast into full-length
vectors, eectively applying the scalar value to all
network locations. is simplies subsequent nu-
merical steps because all arrays are of equal and
known length. e drawback of this approach is that
storing data isn’t as memory-ecient as possible, but
this isn’t as important on modern computers, which
typically have several Gbytes of R AM. In addition,
there’s no limitation on the size of other dimensions,
meaning that NP × 3 or NT × 2 arrays are allowed,
such as the ‘
’ array, which stores each
pore ’s
coordinates in an NP × 3 list.
ere are also no limitations on the data type
that can be stored, but OpenPNM does distin-
guish between Boolean arrays and all other ar-
ray types. e Boolean arrays are treated as la-
bels, while all other arrays are assumed to contain
numerical data describing pore or throat proper-
ties. Labels enable easy retrieval of a list of im-
portant pores (or throats), such as all pores on
the top face of the network. Several labels are
added to the
object during the genera-
tion steps, but users can apply their own labels
as needed. For instance, you might perform a
complex ltering to nd all pores within a cer-
tain distance of some location that also pos-
sess a volume within some range. To avoid re-
peating this query, simply apply a label to the
pores. Labels are applied by adding a new array
to the dictionary with the label name, contain-
values for the pore (or throat) loca-
tions where the label applies. us, the array
is set to
for every pore at the
top of the
object and
Network Topology
e only topology denitions required by OpenPNM
are that each throat connects exactly two pores, no
more and no less, and that throats are nondirectional,
meaning that transport in either direction is equal.
Other general but nonessential rules are that pores
can have an arbitrary number of throats (even zero, al-
though pores with zero throats lead to singular matrices
www.comput 63
and other problems and thus should be avoided) and
two pores should be connected by no more than one
throat, unless there’s some real physical reason for this,
since unintentional duplicate connections impact the
rate of species exchange between pores.
One of the challenges when storing networks
in list-based arrays is tracking the topology of the
pore and throat connections. An important prop-
erty of a throat is which pores are found on either
end, so that
connectivity can be stored
as a list of throat properties equivalently to oth-
er physical throat properties in an NT × 2 list of
[pore I, pore J]
pairs. is storage scheme hap-
pens to dene an adjacency matrix in the sparse
storage scheme known as IJV (or COO in the
scipy.sparse module), a commonly used means of
representing topology in graph theory. is is an
NP × NP array with nonzero values, V, at locations
(I, J) indicating that pores I and J are connected. It’s
symmetrical since the throats are bidirectional and
highly sparse because a given pore only connects with
a small subset of nearby pores in the network. Figure 1
shows a simple
topology along with its
corresponding adjacency matrix and its IJV (or COO)
representation. Also shown is the incidence matrix for
the same topology. Adjacency and incidence matrices
are theoretically equivalent means of representing to-
pology; both can be represented in IJV format, but
each has dierent practical advantages.
objects include numerous
methods for querying the topology, such as nd-
ing pores connected to a given throat (
) or nding the throats neighboring
certain pores (
). Each of
these queries is performed by inspecting the adja-
cency or incidence matrices. For instance, to nd
all pores that are direct neighbors to pore 5 requires
nding which columns on row 5 of the adjacency
matrix contain nonzeros. Alternatively, to nd all
throats that are directly connected to pore 5, it’s
easier to nd all nonzero entries on row 5 of the in-
cidence matrix. Both of these operations are most
eciently performed on sparse matrices stored in
the list-of-lists (LIL) format, so OpenPNM stores
copies of both in a private location for use in the
event of such queries.
Figure 1. Schematic of random network architecture with pore (node) and throat (bond) numbers labeled. Also shown are the adjacency
matrix (bottom left) and incidence matrix (bottom middle) representation of this network and the IJV sparse representation of the
adjacency matrix (bottom right).
Software engineering track
64 July/August 2016
OpenPNM has ve main objects:
, and
. Each of these
inherits from the
class, plus has some additional
methods or functionality added for its specic role.
The Core Objects
objects in OpenPNM contain data and
are used to perform calculations. Each
is a subclassed version of Python’s dict or diction-
ary, with several additional methods added that are
specic to handling OpenPNM’s data. e main
role of the
class is to manage the data stored
in the dictionary. is means storing and tracking
label and property arrays, implementing the data
integrity rules mentioned above, returning lists of
pores and throats based on some combination of
labels, and so forth.
Netw ork. A
object represents a fully self-
contained topological entity, meaning that when
two separate
objects are created, they
don’t interact with each other. If two separate
need to exchange information, then they
must be stitched together to form a single
using the provided topology manipulation tools.
At minimum, a
needs pore coordinates
and the throat connections to dene its topology.
class has a number of ad-
ditional methods added for performing topological
queries, such as nding the pores directly connect-
ed to a given pore (
), nding
the throats that connect given pairs of pores (
), and many others.
class itself isn’t responsible
for creating network topologies. For this, there are
several subclasses of the
class, such as
, which creates the standard lattice with speci-
ed connectivity patterns (6, 8, 26, and so on), and
which uses a Delaunay tessellation to con-
nect random points in space. In addition to generating
topologies, it’s also possible to import networks from
external sources, and several formats are supported.
objects track and manage the
physical properties and dimensions of pores and
throats. OpenPNM was designed to allow net-
works to include multiple regions with diering
properties for modeling multilayered, stratied,
or generally heterogeneous media. In these cases,
objects can be created and as-
signed to dierent subsets of pores and throats. e
dierence between separate
objects lies
in the unique set of pore-scale models that were ap-
plied to calculate the geometrical properties.
Several subclassed versions of
are included in the package for convenience,
including the standard
, as well
, which is combined with the
class to model brous materials.3 0,31 Most
frequently, however, users dene their own custom
classes, which consist of an assortment of
pore-scale models with suitable parameters.
objects manage the thermophysical
properties of the solids, liquids, and gases that exist in
. Because uids can move around during
the course of a simulation, via invasion percolation for
instance, a
object is dened everywhere in the
, and the actual presence of a phase in a given
location is tracked using an occupancy list, a number
between 0 and 1 that indicates fractional lling.
Because thermophysical properties are gener-
ally dependent on each other (viscosity is a func-
tion of temperature), consideration was made to re-
generate property values as conditions change. For
example, if the temperature of a
all temperature-dependent properties can be recal-
culated by calling the regenerate method of the
OpenPNM includes predened
classes for
, and
. Creating new
uids requires only dening a new subclass of
and assigning the suitable models,
either from the
models library or custom
written models, with the appropriate parameters.
Physics. e combination of pore-scale geometry
and thermophysical properties are what dictate the
actual transport parameters in the pore network.
For instance, uid viscosity and throat diameter
are both required to calculate the hydraulic con-
ductance according to the Hagen-Poiseuille model.
When a
object is created, it must be told
objects it applies to.
is allows the models attached to a
ject to nd the necessary thermophysical and geo-
metrical properties.
e only subclass included with the pack-
age is
, which contains an assortment of
commonly used pore-scale physics models such as
the Hagen-Poiseuille model for hydraulic conduc-
tance and the Washburn equation for capillary en-
try pressure. Creating custom pore-scale
models is one of the key ways PNMs dierentiate
themselves, so creating and adding custom models
www.comput 65
was designed to be as exible as possible. A custom
class can be created by choosing or coding
the necessary pore-scale models, then assigning
them to a
objects also derive from the
class, and they too store their own data,
which is typically the result of some algorithm or
calculation. Algorithms have numerous additional
methods beyond those supplied by
, and these
methods can be quite complex, depending on the
e results of any calculation are stored on the
object to prevent overwriting or inter-
fering with data on other objects. For instance,
when a diusion calculation determines the con-
centration of a species in each pore, the resulting
array is stored under ‘
’ on the
, even though mole fraction is techni-
cally a
property. is stored data can be used
in subsequent calculations, but it must be explicitly
transferred to the new
Object Relationships
A given simulation consists of only one
ject and one or more each of
, and
objects. It’s useful to think about these vari-
ous objects in terms of layers that stack together for a
typical simulation. e
contains all the pores
and throats for a particular simulation and forms the
base layer. One of the main features of OpenPNM is
the ability to model heterogeneous materials, for in-
stance, where dierent pore size distributions are to
be applied to dierent regions. is is accomplished
by dening multiple
objects that each apply
to a separate group of pores (or throats) as shown in
Figure 2. Spatial overlap of
objects is forbid-
den because it creates a conict over which
object should calculate and store information for
those locations. Next, a layer of two
objects is
added to the stack to allow multiphase simulations.
span all pores and throats but are immiscible
and so are represented side by side. In fact, multiple
Phases can exist in a given pore simultaneously. en,
a layer of four
objects are added between the
Figure 2. Schematic representation of
object relationships. (a) Overlap in the vertical direction indicates that objects are associated with the
same pores (or throats), while overlap in the horizontal direction indicates with which
each object is associated.
by definition don’t
overlap with each other but span all pores and throats,
objects span all
but only a limited set of pores and throats, and
objects exist at the intersection of
objects. (b) The objects form a conceptual stack with each object representing a layer,
creating the physical interpretation of overlaps shown in (a). (c) The layers that are physically near each other in the stack can exchange data (read-
only) which offers a convenient way to retrieve a complete list of data that may be dispersed across several objects (Geometry 1 and Geometry 2).
Spatial overlapSpatial overlap
Phase overlap Phase overlap
Pore i
Pore j
Pore k
Pore m
Pore n
Pore p
Throat i
Throat j
Throat m
Throat p
Pore i
Pore j
Pore k
Pore m
Pore n
Pore p
Throat i
Throat j
Throat m
Throat p
Pore i
Pore j
Pore k
Pore m
Pore n
Pore p
Throat i
Throat j
Throat m
Throat p
Pore i
Pore j
Pore k
Pore m
Pore n
Pore p
Throat i
Throat j
Throat m
Throat p
Physics 2 Physics 4
Physics 1 Physics 3
Geometry 1
Geometry 2
(a) (c)
Spatial overlap
Physics 2 Physics 4
Geometry 1
Geometry 2
et y
Phase overlap
Physics 1 Physics 3
Phase 1 Phase 2
Phase 1 Phase 2
hm 1
hm 1
Software engineering track
66 July/August 2016
objects combine
geometrical information about pores (or throats) with
the properties of the uids in that pore (or throat).
objects require information from one
and one
object, and therefore exist
at each intersection of
as shown in Figure 2b. Put another way, a
object only applies to one phase because the thermo-
physical properties of the
are dierent and
change the behavior of pore-scale
. Moreover,
a dierent
is required for each
since dierent geometrical properties may result in
dierent pore-scale behavior.
Once a simulation has been set up as shown in
Figure 2b, it’s ready for calculations. An arbitrary
number of
objects can be created and add-
ed as layers to the stack, with each
up the information it requires from other objects in
the simulation and producing results, such as chang-
ing the occupancy of the phases in various pores due
to percolation, or calculating mass fractions.
One drawback of having multiple
objects for dierent regions of the
is that a single list containing all property values for
the entire network isn’t readily available. OpenPNM
addresses this issue by allowing
objects (which by denition encompass all pores and
throats) to retrieve and combine data from the
objects, respectively. e data
exchange between the various layers is indicated by
the arrows in Figure 2c, conveying that associated
objects are able to read data from each other. Writ-
ing data between layers isn’t allowed.
Pore-Scale Models
Pore-scale models are the most important aspect
of OpenPNM as they elevate the basic topological
graph to the level of a pore network model by giv-
ing physical meaning to the pores and throats. Mod-
els are also the main way that users can customize
OpenPNM to suit their particular scientic endeav-
ors. Before delving into the code’s relevant machin-
ery, it’s better to rst discuss the meaning of models.
e main dierence between PNMs and con-
tinuum models is how they treat the transport
properties between two physical locations in the do-
main. For a specic example, consider viscous ow.
In continuum modeling, the ow rate or pressure
drop between two neighboring locations is dictated
by the medium’s permeability coecient, which
is typically measured in the lab on a sample of
representative material. In a PNM, the two neigh-
boring locations are treated as actual pores and con-
nected by a throat. e ow rate between these two
pores is treated as ow through a pipe, which can
be described by any number of analytical solutions
depending on the geometry assigned to the pipe.32
One typical approach is to use the Hagen-Poiseuille
equation for single phase ow in a cylindrical tube:
where Pi and Pj are the pressures in pores i and j, Lij
and Rij are the length and radius of the throat (pipe)
connecting pores i and j, and μ is the uid viscos-
ity. Figure 3 shows the dimensions and geometry of
this pore-throat-pore conduit. If pressure loss in each
half-pore is neglected for simplicity, then the total
ow rate given by Equation 1 can be generalized as
Q = gij(PiPj), (2)
where gij is the conduit’s hydraulic conductance.
erefore, a hydraulic conductance model
would return values of g given throat radii R and
length L from the
object and viscosity μ
from the
object. Using the vectorization capa-
bilities of NumPy, this can be done in a few lines:
def hydraulic_conductance(geometry, physics):
mu = physics.interpolate_
L = geometry[throat.length]
R = geometry[throat.radius]
g = 3.14159*(R**4(/(8*mu*L)
return g
A few key points are illustrated here. First, viscosity
is a
property, yet it’s accessed via physics. is
utilizes the data exchange rules outlined earlier. Sec-
Figure 3. Schematic diagram showing the definitions and
dimension of a typical pore-throat-pore conduit.
www.comput 67
ond, like most
properties, viscosity is dened in
pores so it must be interpolated to nd throat values.
ird, the array g is NT long because it’s the result of
element-wise operations between ‘
’ and
. Finally, the pore and throat properties
used weren’t passed in as hardcoded numerical values;
instead, the objects containing the values were passed,
and the values were retrieved “on demand.” is means
that if the viscosity is changed on the
object, then
rerunning the above code will automatically utilize the
updated values without any eort on the user’s part.
is is the mechanism by which changing conditions
are transmitted to all other dependent properties.
e above code snippet is a simple but represen-
tative example of a pore-scale model. It’s expected
that users will devise their own such models of ar-
bitrary complexity. To utilize any custom-made
pore-scale models, a user only needs to create a le
in the working directory (such as
populate it with his or her own function denitions,
and import the le by entering
import my_models
is will provide access to all models in the le with
Assigning Models to Core Objects
To ensure that physical properties can be recalculated
as needed, it’s necessary to save the pore-scale model
and all parameters in memory. To accomplish this,
object has an attribute (that is,
) that actually contains a nested dictionary
called the
as shown in Figure 4.
has an
method that performs the
service of associating the model with the
e arguments required by the
method are the
name of the pore or throat property (
) where
the values generated by the model are to be stored
), a handle to the
model to be used (
), and any parameters required by the specic
model. e
method stores all the received param-
eters in the
using the given
a key. Also shown in Figure 4 is the
object, which houses each model’s specic arguments.
A few nuances must be considered when dealing
with models. First, models are stored in
under a specied
; by default, the values pro-
duced when the model is run will be stored in the par-
object dictionary under the same
Second, the numerical values produced by a model
remain in the
object dictionary as constant
values until
is called to rerun each model.
Numerous key algorithms are included with
OpenPNM, including various percolation algorithms
(Drainage and InvasionPercolation), and several linear
transport models such as FickianDiusion, Stokes-
Flow, OhmicConduction, and FourierConduction.
Each algorithm is slightly dierent, but in general,
are instantiated by passing in a
object and some additional arguments.
objects have a
method that allows specifying
Figure 4. Schematic diagram showing how pore-scale models are associated with
objects. When the regenerate method of the
is called, it calls the
method of each
in the order in which they’re stored. The values returned from the
model are placed into the
object’s dictionary under the same property name as that of the stored model.
Core object
ModelsDict object
method i
method ii
attribute i
attribute ii
‘pore.prop i’
‘pore.prop ii’
‘throat.prop i’
‘throat.prop ii’
Methods and attributes
Dictionary data
attribute i
Methods and attributes
‘pore.prop ii’
‘throat.prop i’
‘throat.prop ii
Dictionary data
ModelWrapper object
method iii
method ii
attribute i
attribute ii
Methods and attributes
‘argument i’
‘argument ii
‘argument iii’
Dictionary data
‘pore.prop i’
Software engineering track
68 July/August 2016
various parameters required by the algorithm. e
calculation is executed by calling the
Finally, the results are stored on the
but can be transferred to other
objects (usually a
) for use in further calculations.
Percolation and Invasion
Performing multiphase transport calculations in the
pore network is a central role of PNMs. Realistic pore-
scale uid congurations are simulated using percola-
tion theory to determine how an invading phase will
displace a defending phase. OpenPNM contains sev-
eral algorithms for performing such calculations.
Drainage. In a porosimetry experiment,33 the vol-
ume of a non-wetting uid injected into a specimen
is tracked at discrete pressure steps. e process is
referred to as drainage and is mathematically simu-
lated as an access-limited bond percolation prob-
lem. Access limitations are important because the
invading phase can only invade throats that are ac-
cessible from the sample surface and subsequently
those connected directly to the reservoir of the in-
vading phase. Simulating porosimetry experiments
is an essential part of PNMs because the results can
be compared to experimental data to verify that
correct pore and throat size distributions have been
used when combined with other information such
as the permeability and porosity of the material.
To conduct this simulation in OpenPNM,
throats must rst be assigned capillary entry pres-
sures, indicating the pressure that must be applied
to the invading phase for it to enter that throat. Re-
lating throat invasion pressure to geometric throat
properties is almost universally done with the Wash-
burn equation, but other, more suitable options
are available.34 e Drainage algorithm uses the
method included in the
module of scipy.sparse to perform a standard
graph theory clustering operation over the
Invasion percolation. Invasion percolation diers from
drainage in subtle but important ways. In drainage,
all accessible throats with entry pressures lower than
a certain value are simultaneously invaded (along
with their neighboring pores). Invasion percolation
applies a similar logic on the scale of single throats
by invading only the single most easily invaded ac-
cessible throat and its neighboring pore on each step.
In physical terms, this is equivalent to a quasi-static,
rate-controlled injection experiment.35
During an invasion percolation simulation,
when a pore is invaded, new throats become ac-
cessible and join the invasion front. e algorithm
must choose the throat with the lowest entry pres-
sure for the next invasion, requiring a continually
maintained, dynamically changing, and sorted
list of throat entry pressures.36 A standard graph
theory algorithm for this process isn’t available in
SciPy, so a basic algorithm was implemented in
OpenPNM using Python’s built-in
which is based on priority queues using a heap data
structure. In simple terms, this means that a list
of initially accessible throats is sorted into a heap,
which has the property that the smallest value is al-
ways found in element 0. is allows instant access
to the next throat that should be invaded. e pore
attached to this throat is then invaded, and all of
its throats are added to the heap, and the procedure
is repeated until all pores and throats are invaded.
Resistor Network Calculations
One of the main uses of pore network models is
to simulate transport phenomena through the pore
space, usually in the presence of a second phase. A
typical example is the diusion of a gaseous species
through a pore space that’s partially lled with a
liquid. To model a domain of any useful size, it’s
dicult to model such a scenario by discretizing
the pore space as a nite-element mesh. First, it
would take many nodes to model even a few pores.
Second, the placement of liquid is a complex task,
requiring the solution of high-order PDEs37 or a
Lattice-Boltzmann approach,38 both of which are
highly computationally intensive. An alternative
to these methods is the Full Morphology approach
based on image analysis,39 which can analyze a 2D
or 3D pixel image of a porous material and place
phases using structuring elements. However, the
user is still reliant on other methods to solve the
equations of uid ow and also limited to much
smaller domains.
Pore network modeling starts by recognizing
that, in many applications, an approximate model
of a suitably large domain is more useful than a
highly rigorous model of a limited number of pores.
With this in mind, each throat represents a resistor
in the network through which the species of inter-
est must travel to reach the neighboring pore. e
resistance to diusion or ow oered by a throat
constriction is a function of its geometry, as well
as the uid properties such as viscosity or diusion
coecient. In PNMs, this resistance is described
by an appropriate pore-scale physics model, such
as the Hagen-Poiseuille model given in Equation 1.
is and other pore-scale physics models are cast in
www.comput 69
terms of a resistance by analogy with Ohm’s law. In
the case of Equation 1, pressure (P) is the driving
force, μR4/8L represents the conductance to ow
due to the geometrical properties of the throat, μ
provides the resistance to ow caused by the ow-
ing uid’s viscosity, and Q is the volumetric ow of
uid analogous to current in Ohm’s law. is can
be recast as
ij ij
where gij is the conductance between pores i and
j, and X is the unknown to be solved for. At steady
state and in the absence of any source or sink terms,
the net material ow through pore i is zero, hence
where pore i has n neighbors. Applying this equa-
tion to each pore in the network results in a system
of linear equations in X that can be readily solved
by any matrix inversion algorithm subject to given
boundary conditions. Importantly, the conduc-
tance gij can be set to very small values for pores
blocked by another phase, making it trivial to in-
corporate the impact of multiple phases on trans-
port processes.
Performing transport calculations in OpenPNM
begins with instantiating an
object, then
specifying the necessary boundary conditions us-
ing the
method of
. e
method is then
called to handle the processes of building the coef-
cient matrix, applying specied boundary condi-
tions, and calling the matrix inversion routine. e
main requirement from the user is to ensure that the
conductance values for each throat are calculated
correctly, meaning that the appropriate models for
geometrical sizes, thermophysical properties, and
pore-scale physics have been applied.
Application and Demonstration
e intense development of OpenPNM over the
past few years has resulted in a concise and power-
ful framework that can perform signicant compu-
tations in minimal lines of code. is nal section
will describe the steps required to calculate the ef-
fective diusivity of a porous material as a function
of liquid water saturation, a typical application of
PNMs.16 e full script is given in the sidebar.
e rst step is to create a
object, in
this case with 3,125 pores on a cubic grid with a
spacing of 100 μm between them:
pn = OpenPNM.Network.Cubic(shape=[25, 25,
5], spacing=0.0001)
Next, a
object must be instantiated:
geo = OpenPNM.Geometry.
In this step, the
object is associated
with the
) and assigned to all the pores
and throats. e
class has no
predened pore-scale models, so these must be add-
ed. e script in the sidebar illustrates how to add
geometrical properties such as
models to the
object, as
well as direct assignment of calculated values such
. Some subclasses included with
OpenPNM have predened pore-scale geometry
models; these can be used as templates for users to
create one for their own specic materials.
are added using the predened
subclasses for
air = OpenPNM.Phases.Air(network=pn)
water = OpenPNM.Phases.Water(network=pn)
Only the
object with which these
objects are to be associated is required as an
is simulation will require rst invading
liquid water into the network, then diusing gas
through dry void space. e
will each
require their own
phys_air = OpenPNM.Physics.
phys_water = OpenPNM.Physics.
objects require the
, a
and a
object as arguments. Both the
objects above operate on the same pores and
throats (dened by the
object), but each apply
to a dierent
. Both of the above objects are
instances of the
class, which has
no pore-scale models. e sidebar illustrates how
to add
‘throat. capillary_pressur
e’ to the water
Software engineering track
70 July/August 2016
Sample Script
The following script shows how to set up a
, define a
by adding the necessary models, create two
objects, define the necessary
objects, and finally perform sequential simulations using two
import OpenPNM
import scipy as sp
import OpenPNM.Geometry.models as gm
import OpenPNM.Physics.models as pm
pn = OpenPNM.Network.Cubic(shape=[10, 10, 10], spacing=0.0001)
geom = OpenPNM.Geometry.GenericGeometry(network=pn,
geom[‘pore.seed’] = sp.rand(geom.num_pores())
geom[‘pore.area’] = 3.14159/4*geom[‘pore.diameter’]**2
geom[‘pore.volume’] = 4/3*3.14159*(geom[‘pore.diameter’]/2)**3
geom[‘throat.area’] = 3.14159/4*geom[‘throat.diameter’]**2
geom[‘throat.volume’] = 3.14159/4*geom[‘throat.diameter’]**2* geom[‘throat.length’]
air = OpenPNM.Phases.Air(network=pn)
water = OpenPNM.Phases.Water(network=pn)
water[‘pore.contact_angle’] = 110.0
water[‘pore.surface_tension’] = 0.072
phys_air = OpenPNM.Physics.GenericPhysics(network=pn,
phys_water = OpenPNM.Physics.GenericPhysics(network=pn,
OP = OpenPNM.Algorithms.OrdinaryPercolation(network=pn,
phys_air[‘throat.conductance’] = phys_air[‘throat.diffusive_conductance’]*(OP[‘throat.inv_Pc’] > 8000)
FD = OpenPNM.Algorithms.FickianDiffusion(network=pn,
www.comput 71
phase and
the gas phase.
Finally, two
objects are required
to perform the water invasion and gas diffusion
simulations. For water invasion, drainage will
be used:
D = OpenPNM.Algorithms.Drainage(network=pn)
method will perform the simula-
tion and place arrays called
’s dictionary. ese arrays
contain the pressure at which each pore and throat
was invaded, thus requiring a simple Boolean com-
parison to nd all locations invaded at some ap-
plied pressure (for example, 8,000 Pa).
Finally, gas diusion is calculated using the provided
FD = OpenPNM.Algorithms.
FickianDiffusion(network=pn, phase=air)
on which this
operates is
required as an argument, as this gives the algorithm
access to the diusive conductance values stored
. Mole fraction boundary conditions
are set on the top and bottom of the
bcvalue=0.5, pores=pn.pores(‘top’))
bcvalue=0.1, pores=pn.pores(‘bottom’))
e transport calculation is executed by calling
Figure 5 shows the resulting
, water con-
guration (blue pores), and mass fraction distribution
(colored pores). Each specic transport phenomena
subclass has a method for calculating the eective
value of its transport property for the entire
for FickianDiusion, this is
, which in this case is approximately half the
bulk value and 10 percent less than the dry
pen PNM aims to provide users with an easy-
to-use, computationally ecient and fully
customizable framework for performing PNM cal-
culations of all sorts. We oer this package to the
porous media community in the hope that it will
become a standard tool in the eld, allowing re-
searchers to share code, build on each other’s work,
and compare results directly.
OpenPNM was made possible by the support of the
Automotive Fuel Cell Cooperation and the Natural
Science and Engineering Research Council of Can-
ada (NSERC) through the Collaborative Research &
Development and the Discovery Grant programs. Fi-
nancial support from the NSERC Canada Research
Chairs Program, NSERC Collaborative Research and
Figure 5. 3D rendering of a pore network showing water invading in from bottom (blue) and gas diffusion from top to bottom (yellow to
red). The sizes of the spheres are proportional to their diameter. Throats are drawn as thin lines to enhance visualization.
Software engineering track
72 July/August 2016
Training Experience Program (CREATE) in Distrib-
uted Generation for Remote Communities (DGRC),
Canadian Foundation for Innovation (CFI), and
Ontario Ministry of Research and Innovation Early
Researcher Award are also gratefully acknowledged.
European collaborators acknowledge the support and
funding of the Engineering and Physical Sciences Re-
search Council (EPSRC).
1. I. Chatzis and F.A.L. Dullien, “e Modeling of
Mercury Porosimetry and the Relative Permeability
of Mercury in Sandstones Using Percolation
e or y,” Int’l J. Chemical Eng., vol. 25, no. 1, 1985.
2. R.G. Larson, L.E. Scriven, and H.T. Davis, “Percolation
eory of Two Phase Flow in Porous Media,” Chemical
Eng. Science, vol. 36, no. 1, 1981, pp. 57–73.
3. M.M. Dias and A.C. Payatakes, “Network Models
for Two-Phase Flow in Porous Media Part 1.
Immiscible Microdisplacement of Non-Wetting
Fluids ,” J. Fluid Mechanics, vol. 164, no. 3, 1986,
pp. 305–336.
4. C.T. Miller et al., “Multiphase Flow and Transport
Modeling in Heterogeneous Porous Media:
Challenges and Approaches,” Advances in Water
Resources, vol. 21, no. 2, 1998, pp. 77–120.
5. P.A. García-Salaberri et al., “Eective Diusivity
in Partially-Saturated Carbon-Fiber Gas Diusion
Layers: Eect of Local Saturation and Application
to Macroscopic Continuum Models,” J. Power
Sources, vol. 296, no. 11, 2015, pp. 440–453.
6. M.J. Blunt et al., “Pore-Scale Imaging and
Modelling,” Advances in Water Resources, vol. 51,
no. 1, 2013, pp. 197–216.
7. H. Dong and M.J. Blunt, “Pore-Network
Extraction from Micro-Computerized-Tomography
Images,” Physical Rev. E, vol. 80, no. 3, 2009,
article no. 036307.
8. D. Silin et al., “Microtomography and Pore-Scale
Modeling of Two-Phase Fluid Distribution,”
Transport in Porous Media, vol. 86, no. 2,
2010, pp. 495–515.
9. J. Hinebaugh, Z. Fishman, and A. Bazylak,
“Unstructured Pore Network Modeling
with Heterogeneous PEMFC GDL Porosity
Distributions,” J. Electrochemical Soc., vol. 157, no.
11, 2010, pp. B1651–B1657.
10. S.L. Bryant, D.W. Mellor, and C.A. Cade,
“Physically Representative Network Models of
Transport in Porous Media,” AIChE J., vol. 39, no.
3, 1993, pp. 387–396.
11. R. iedmann et al., “Random Geometric Graphs
for Modelling the Pore Space of Fibre-Based
Materials,” J. Materials Science, vol. 46, no. 24,
2011, pp. 7745–7759.
12. M.A. Ioannidis and I. Chatzis, “Network
Modelling of Pore Structure and Transport
Properties of Porous Media,” Chemical Eng.
Science, vol. 48, no. 5, 1993, pp. 951–972.
13. A.G. Hunt, “Basic Transport Properties in Natural
Porous Media: Continuum Percolation eory
and Fractal Model,” Complexity, vol. 10, no. 3,
2005, pp. 22–37.
14. M. Rebai and M. Prat, “Scale Eect and Two-
Phase Flow in a in Hydrophobic Porous Layer:
Application to Water Transport in Gas Diusion
Layers of Proton Exchange Membrane Fuel Cells,” J.
Power Sources, vol. 192, no. 2, 2009, pp. 534–543.
15. M.J. Blunt et al., “Detailed Physics, Predictive
Capabilities and Macroscopic Consequences
for Pore-Network Models of Multiphase Flow,”
Advances in Water Resources, vol. 25, nos. 8–12,
2002, pp. 1069–1089.
16. J. Gostick et al., “Pore Network Modeling
of Fibrous Gas Diusion Layers for Polymer
Electrolyte Membrane Fuel Cells,” J. Power Sources,
vol. 173, no. 1, 2007, pp. 277–290.
17. P.C. Reeves and M.A. Celia, “A Functional
Relationship Between Capillary Pressure,
Saturation, and Interfacial Area as Revealed by
a Pore-Scale Network Model,” Water Resources
Research, vol. 32, no. 8, 1996, pp. 2345–2358.
18. M. Sahimi, “Flow Phenomena in Rocks: From
Continuum Models to Fractals, Percolation, Cellular
Automata, and Simulated Annealing,” Rev. Modern
Physics, vol. 65, no. 4, 1993, pp. 1393–1534.
19. M.J. Blunt, “Flow in Porous Media —Pore-
Network Models and Multiphase Flow,Current
Opinion in Colloid & Interface Science, vol. 6, no. 3,
2001, pp. 197–207.
20. V. Joekar-Niasar and S.M. Hassanizadeh, “Analysis
of Fundamentals of Two-Phase Flow in Porous
Media Using Dynamic Pore-Network Models: A
Re view,” Critical Reviews in Environmental Science
& Te ch., vol. 42, no. 18, 2012, pp. 1895–1976.
21. M. Prat, “Recent Advances in Pore-Scale Models
for Drying of Porous Media,” Chemical Eng. J., vol.
86, nos. 1–2, 2002, pp. 153–164.
22. A. Johnson et al., “An Improved Simulation of
Void Structure, Water Retention and Hydraulic
Conductivity in Soil with the Pore-Cor
ree-Dimensional Network,” European J. Soil
Science, vol. 54, no. 3, 2003, pp. 477–490.
23. A. Raoof et al., “PoreFlow: A Complex Pore-
Network Model for Simulation of Reactive
Transport in Variably Saturated Porous Media,”
www.comput 73
Computers & Geosciences, vol. 61, 2013, pp.
160 –174.
24. M. Secanell et al., “OpenFCST: An Open-Source
Mathematical Modelling Software for Polymer
Electrolyte Fuel Cells,” EC S Tra ns., vol. 64, no. 3,
2014, pp. 655680.
25. R. Cimrman, “SfePy: Write Your Own FE
Application,” ArXiv14046391 Cs, Apr. 2014;
26. T.E. Oliphant, “Python for Scientic Computing,”
Computing in Science & Eng., vol. 9, no. 3, 2007,
pp. 10–20.
27. K.J. Millman and M. Aivazis, “Python for
Scientists and Engineers,” Computing in Science &
Eng., vol. 13, no. 2, 2011, pp. 9–12.
28. S. van der Walt, S.C. Colbert, and G. Varoquaux,
“e NumPy Array: A Structure for Ecient
Numerical Computation,” Computing in Science &
Eng., vol. 13, no. 2, 2011, pp. 22–30.
29. A.A. Hagberg, D.A. Schult, and P.J. Swart,
“Exploring Net work Structure, Dynamics, and
Function Using NetworkX,” Proc. 7th Python in
Science Conf., 2008, pp. 11–15.
30. J.T. Gostick, “Random Pore Network Modeling of
Fibrous PEMFC Gas Diusion Media Using Voronoi
and Delaunay Tessellations,” J. Electrochemical Soc.,
vol. 160, no. 8, 2013, pp. F731–F743.
31. K.E. ompson, “Pore-Scale Modeling of Fluid
Transport in Disordered Fibrous Materials,” AIChE
J., vol. 48, no. 7, 2002, pp. 1369–1389.
32. V. Joekar-Niasar et al., “Network Model
Investigation of Interfacial Area, Capillary Pressure
and Saturation Relationships in Granular Porous
Medi a,” Water Resources Research, vol. 46, no. 6,
2010, p. W06526.
33. H. Giesche, “Mercury Porosimetry: A General
(Practical) Overview,” Particle & Particle Systems
Characterization, vol. 23, no. 1, 2006, pp. 9–19.
34. W.B. Lindquist, “e Geometry of Primary
Drainag e,” J. Colloid Interface Science, vol. 296, no.
2, 2006, pp. 655–668.
35. V. Sygouni, C.D. Tsakiroglou, and A.C. Payatakes,
“Capillary Pressure Spectrometry: Toward a New
Method for the Measurement of the Fractional
Wettability of Porous Media,” Physics of Fluids, vol.
18, no. 5, 2006, p. 053302.
36. A.P. Sheppard et al., “Invasion Percolation: New
Algorithms and Universality Classes,” J. Physics A,
vol. 32, no. 49, 1999, p. L521.
37. A.Q. Raeini, M.J. Blunt, and B. Bijeljic, “Modelling
Two-Phase Flow in Porous Media at the Pore Scale
Using the Volume-of-Fluid Method,” J. Computational
Physics, vol. 231, no. 17, 2012, pp. 5653–5668.
38. C. Pan, M. Hilpert, and C.T. Miller, “Lattice-
Boltzmann Simulation of Two-Phase Flow in
Porous Media,” Water Resources Research, vol. 40,
no. 1, 2004, p. W01501.
39. M. Hilpert and C.T. Miller, “Pore-Morphology-
Based Simulation of Drainage in Totally Wetting
Porous Media,” Advances in Water Resources, vol.
24, nos. 3– 4, 2001, pp. 243–255.
Jeff Gostick, corresponding author, is an assistant pro-
fessor in chemical engineering at McGill University. He
received a PhD in chemical engineering from the Uni-
versity of Waterloo. Gostick is licensed as P.Eng., and
he’s a member of the American Institute of Chemical
Engineers, the Canadian Society of Chemical Engi-
neers, Interpore, and the Electrochemical Society. Con-
tact him at
Mahmoudreza Aghighi is a PhD candidate working
on pore network modeling at McGill University. His
research focuses on modeling transport phenomena in
porous media, multiphase ows, and scientic comput-
ing. Aghighi received an M.Sc. in chemical engineering
from Sharif University of Technology, Tehran. Contact
him at
James Hinebaugh is a postdoctoral associate at the
University of Toronto. He specializes in creating pore-
scale simulation environments from high-resolution
computed tomography images and is a co-founder of
the OpenPNM project. Hinebaugh received a PhD in
mechanical engineering from the University of Toronto.
Contact him at
Tom Tranter is a PhD candidate working on modeling
and measuring multiphase ow in polymer electrolyte
fuel cells at the University of Leeds. His research in-
terests include renewable energy, solar energy, and
renewable heating. Contact him at t.g.tranter@gmail.
Michael Hoeh is a PhD candidate working on water
electrolyzers at the Institute of Energy and Climate Re-
search at Forschungszentrum Jülich. He was the rst re-
cruited member of OpenPNM from outside the initial
founding group. His research interests include renew-
able energy, energy storage and energy systems. Contact
him at
Harold Day is a graduate of McGill University in me-
chanical engineering, where he also received an M.Eng.
in chemical engineering. Contact him at haroldday@
Software engineering track
74 July/Augu st 2016
Brennan Spellacy is a graduate of at McGill University in
chemical engineering. Contact him at brennanspellacy@
Mostafa H. Sharqawy is an assistant professor of me-
chanical engineering at the University of Guelph. His
research centers on design, performance evaluation, and
improvement of sustainable energy and water systems.
Sharqawy is a licensed P.Eng in Ontario and a member
of American Society of Mechanical Engineering and
International Desalination Association. Contact him at
Aimy Baz ylak is an associate professor in the Depart-
ment of Mechanical and Industrial Engineering at the
University of Toronto. Her research focuses on transport
in porous media with an emphasis on visualization via
radiography and tomography. Bazylak received a PhD in
mechanical engineering from the University of Victoria.
She is a licensed P.Eng and holder of a Canada Research
Chair in ermouidics for Clean Energy. Contact her
Alan Burns is an associate professor in the School of
Chemical and Process Engineering at the University of
Leeds and a senior developer of the commercial CFD
code Ansys CFX. His research interests are in numerical
algorithms, mathematical models, and applications of
multiphase ows. Burns received a PhD in mathemati-
cal physics from the University of Durham. Contact
him at
Werner Lehnert is a professor in the Faculty of Me-
chanical Engineering at RWTH Aachen University in
Germany and heads the high-temperature polymer-elec-
trolyte fuel cells group at the Jülich Institute of Energy
and Climate Research. Lehnert received a PhD in physi-
cal chemistry from the University of Düsseldorf. Con-
tact him at
Andreas Putz is a senior research scientist and heads
the modeling and simulation group at Automotive Fuel
Cell Cooperation. His research focuses on the numerical
simulation of transport, electrochemical, and degrada-
tion processes of the membrane electrode assembly for
automotive fuel cell applications. Putz received a PhD in
applied mathematics from the University of British Co-
lumbia. Contact him at
Selected articles and columns from IEEE Computer
Society publications are also available for free at
... OpenPNM, an open-source framework for pore network simulations [51], to generate cubic 157 networks with a random distribution of pore sizes and fixed pore positions. The hydraulic and 158 electrochemical performances of the generated cubic network structures were simulated by a 159 model that solves for coupled electrochemical kinetics, mass transport, and momentum 160 transport, validated and described in detail in our previous work [27]. ...
Full-text available
The microstructure of porous electrodes determines multiple performance-defining properties, such as the available reactive surface area, mass transfer rates, and hydraulic resistance. Thus, optimizing the electrode architecture is a powerful approach to enhance the performance and cost-competitiveness of electrochemical technologies. To expand our current arsenal of electrode materials, we need to build predictive frameworks that can screen a large geometrical design space while being physically representative. Here, we present a novel approach for the optimization of porous electrode microstructures from the bottom-up that couples a genetic algorithm with a previously validated electrochemical pore network model. In this first demonstration, we focus on optimizing redox flow battery electrodes. The genetic algorithm manipulates the pore and throat size distributions of an artificially generated microstructure with fixed pore positions by selecting the best-performing networks, based on the hydraulic and electrochemical performance computed by the model. For the studied VO2+/VO2+ electrolyte, we find an increase in the fitness of 75% compared to the initial configuration by minimizing the pumping power and maximizing the electrochemical power of the system. The algorithm generates structures with improved fluid distribution through the formation of a bimodal pore size distribution containing preferential longitudinal flow pathways, resulting in a decrease of 73% for the required pumping power. Furthermore, the optimization yielded an 47% increase in surface area resulting in an electrochemical performance improvement of 42%. Our results show the potential of using genetic algorithms combined with pore network models to optimize porous electrode microstructures for a wide range of electrolyte composition and operation conditions.
... For each experiment, the evolution of the sample porosity φ(t ) along time is deduced from the measu- The 3D images obtained from X-ray tomography calculations are used to extract the pore network of the samples with the open-source software OpenPNM that is described below (Gostick et al., 2016). ...
Full-text available
Les roches carbonatées constituent une part très importante des roches présentes à la surface de la Terre. Les réservoirs qui y sont associés représentent des ressources indispensables aux sociétés humaines, quelles soient directes (eau, gaz, hydrocarbures) ou indirectes (géothermie, stockage du CO2).La forte réactivité des roches carbonatées est responsable de la karstification, processus de réaction dû au déséquilibre thermodynamique entre la roche et l'eau qui circule dans le réservoir. Il en découle la formation d'aquifères karstiques, caractérisés par de fortes hétérogénéités structurales accompagnées d'un comportement hydrologique complexe. Ceci en fait un système vulnérable, mais aussi très productif.Afin de mieux gérer ces réservoirs et la ressource en eau qu'ils contiennent, une meilleure compréhension de la formation et de la localisation des conduits karstiques est nécessaire.Pour cela, des expériences en laboratoire peuvent être réalisées afin de reproduire le phénomène de karstification à petite échelle. Des échantillons de roche provenant de trois types de roches carbonatées sont extraits de blocs de roche homogènes dans le but d'être dissous. Les roches étudiées sont une craie, un calcaire crinoïdal et une dolomie, et les échantillons représentent des VER.Avant les expériences, les échantillons sont caractérisés par des méthodes de laboratoire et d'imagerie, pour connaître leurs propriétés structurales, élastiques, mécaniques, minérales et hydrodynamiques.Ils sont ensuite soumis à une injection de fluide acide dans un dispositif expérimental développé au cours de la thèse. Pour les échantillons de craie, deux fluides avec des concentrations en acide différentes sont utilisés, contrairement au calcaire crinoïdal et à la dolomie, où un seul acide est utilisé. Différents débits, associés à différentes conditions de Péclet, sont appliqués aux échantillons. Pendant les dissolutions, les données hydrodynamiques et hydrochimiques sont enregistrées en continu.Après les expériences, les mêmes mesures qu'avant les expériences sont réalisées.La caractérisation des échantillons a permis de montrer que la microstructure contrôle les propriétés d'une roche, et que les relations établies entre les propriétés pétrophysiques à l'échelle de l'échantillon se retrouvent à grande échelle.Pour toutes les roches, l'injection de fluide acide dans les échantillons est à l'origine d'une dissolution de la roche, induisant la formation de conduits préférentiels, associée à une augmentation de la perméabilité et de la porosité. De plus, les régimes de dissolution observés sont directement corrélés à la concentration de l'acide injecté et à son débit, mais aussi aux propriétés structurales initiales de la roche.Pour les expériences menées sur la craie, qui est une roche très hétérogène de par sa forte proportion de micropores, les hétérogénéités sont responsables des figures de dissolution obtenues, notamment de la formation de chenaux quand les conditions expérimentales suggèrent une dissolution uniforme.Pour ce qui est des expériences impliquant les trois types de roches, la roche contenant de la dolomite présente un taux de dissolution plus faible que les roches n'en contenant pas, ce qui est dû à la cinétique de réaction plus faible de la dolomite comparée à la calcite. Avec son importante microporosité, la craie est la roche qui présente le plus haut taux de dissolution. De plus, les conduits créés dans la dolomie sont nettement plus localisés et linéaires que les conduits dans les autres roches. Pour une même quantité d'acide injectée, la minéralogie de la roche, associée à sa structure, est donc principalement responsable des figures de dissolution dans une roche.
... Banerjee et al. [140] compared the rheological properties of four types of commercial carbon felt electrodes. They obtained the microstructure of the electrode based on X-Ray CT images, algorithmized this spatial information using a pore networking modeling approach, and designed the pore network model with Open PNM [141][142][143]. The four electrodes they selected represented the design parameters of the VRFB electrode. ...
Energy storage systems that serve as reservoirs for the power management of existing power grids and renewable power generation facilities have become increasingly important. Vanadium redox flow battery (VRFB) technology provides a balanced solution for large-capacity energy storage within power management strategies. More than 30 years have passed since the discovery of vanadium among redox couples for water-based flow cells. A major challenge in VRFB applications is the optimization of mass transfer effects in micro-scale porous electrodes characterized by close interactions between flow and electrochemical reactions. This paper reviews current research on mass transfer phenomena in the porous electrodes of flow cells using redox couples. Instead of comparing the details of experiments or numerical models, we focused on the following keywords to characterize mass transfer: modifications (thermal or catalytic) to porous electrodes; a flow channel located outside or inside the electrode; architecture of the porous electrode; and nanofluidic electrolytes, or slurry electrodes, with nanoparticle dispersion. This review paper introduces the flow characteristics of electrodes as diffusion and convection-dependent mass transfer phenomena to provide insights into the development of porous electrodes for studies on the experimental aspects or numerical simulations of flow cells.
... When employing the "absolute permeability experiment simulation" tool a value of 10 -6 has been found to be the most effective tolerance value for the convergence of the simulation solution (Thomson et al. 2019), allowing for comparable measurements to be made between studies. A variety of tools exist to perform this type of simulation and measurement (Bultreys et al. 2015;Gostick et al. 2016;Payton et al. 2021), of which many are based on a similar approach. Permeability may also be determined through digital image analysis using pore network models (PNMs) more rapidly but typically with an acceptable but lower accuracy (Varloteaux et al. 2013). ...
Full-text available
The growing importance of subsurface carbon storage for tackling carbon emissions requires an accurate characterisation of potential reservoirs to understand their capabilities. In this context, the use of legacy data originally acquired in the last fifty years for scientific projects and petroleum exploration and production activities would represent a suitable cost-effective solution and help to maximise the value of this extended national asset. Core material represents the only direct observation of subsurface deposits and must be preserved from the current disposal process related to the decommissioning of hydrocarbon fields. In this contribution, a suite of samples from core material stored at national (i.e., British Geological Survey) and local (i.e., Department of Earth Sciences, Royal Holloway, University of London) core repositories, previously characterised at the micro scale using X-ray micro-computed tomographic (μCT) imaging are discussed. Using this technique it has been possible to investigate how pore and grain geometries control crucial features of a suitable reservoir such as porosity and permeability. The aim of this contribution is to describe the methodology behind digital image analysis (DIA) following μCT imaging applied to core material. We show how DIA can be used to provide significant measures of reservoir suitability when making initial assessments of storage reservoirs, without the need for expensive and time-consuming analyses.
This data article describes the connected pore cluster data from segmented nano-images of rocks related to a geothermal system. The collected samples include two (2) vesicle-amygdaloidal basalt (host rock) and four (4) horizons collected from a siliceous sinter mound (rock precipitated from hot waters). All the samples have undergone computed tomography scanning using a SkyScan 2211 multiscale X-ray nano-CT system (Bruker®), and the slices were analyzed using the Digital Rock Physics (DRP) approach. Pore volume and fluid permeability in the three directions were calculated with scripts of Python (v.3.9) and the visualizations of the 3D models were run with Paraview (v.5.10) software. The petrophysical properties, diagrams, and figures were produced by stacking the 2D projections (8-bit grayscale *.png images format) from the scanning. Raw data (images) were deposited in a repository, which has granted a persistent identifier (Mendeley Data: This article provides a study case to handle the data that test the interconnectivity and ability to transport fluids and/or exogenous matter carried during high-flow events in rocks outcropping at the surface level of a geothermal system.
Worldwide attention has been paid to effective protection strategies against the COVID-19 pandemic. Filtering masks are generally kept for a certain period of shelf-life before being used, and frequently, they are used repeatedly with recurrent storages. This study investigates the effect of storage temperature and humidity on the structural characteristics and charges of an electret filter, associating with the filtration performance in terms of efficiency and pressure drop based on a practical use-storage scenario. For the repeated use conditions with recurrent storage, humid storage conditions significantly deteriorated the filtration efficiency as hygroscopic particles quickly wetted the surface and masked the surface charges. The high temperature rapidly deteriorated the filter charges and caused a lowered electrostatic filtration efficiency. In a heated condition, the web became fluffier, yet it did not directly affect the pressure drop or mechanical filtration efficiency. The approach of this study is progressive in that rigorous analysis was performed on examining the particle morphology and internal structure of filter media with varied storage conditions to link with the filtration performance and the effective lifetime. This study intends to provide a scientific reference guiding a desirable storage condition and replacement cycle of filtering masks considering the actual use habits and storage environment.
Full-text available
In many practical geochemical systems that are at the center of providing indispensable energy, resources and service to our society, (bio)geochemical reactions are coupled with other physical processes, such as multiphase flow, fracturing and deformation. Predictive understanding of these processes in hosting and evolving porous media is the key to design reliable and sustainable practices. In this article, we provide a brief review of recent developments and applications of reactive transport modeling to study geochemically driven processes and alteration in porous media. We also provide a perspective on opportunities and challenges for continuously developing and expanding the role of this valuable methodology to advance fundamental understanding and transferable knowledge of various dynamic geochemical systems.
Fission gas release (FGR) is one of the most complex multi-scale phenomena affecting safety performance of nuclear fuel. To improve mechanistic understandings of FGR phenomenon, especially the third stage of gas venting process through connected grain boundaries in a fuel pellet, explicit grain boundary network (GBN) percolation modelling of FGR was carried out in combination with the traditional 2-stage Booth model. Besides the fluctuating and reduction features of FGR accompanied with percolating process, the percolation front and its fractal feature were investigated in-depth in the study. The results predicted existence of an enrichment region of gas contents around the medium radius of the pellet, which coincide with previous published experimental data, and may be directly related with the augmentation of FGR as well as formation of micro-grains at medium region of pellet under high burn-up conditions. Therefore, possible explanations for these phenomena have been proposed from the aspect of percolation process. Moreover, in analogy with the percolation front or hull, we defined “FGR front” as the external perimeter of vented clusters in the GBN. Fractal features as well as its position and width of the front were investigated quantitatively based on scaling laws using gradient percolation theory, the incipient point of gas releasing can be predicted directly using scaling laws related with the conductance probability of grain edges. Results and methodologies in this study may have practical significance for not only understanding mechanisms of FGR but also safety promotion of nuclear fuel pellet pertaining to containment of fission products (FPs).
The variation of the three-dimensional (3D) structure of the membrane electrode of a fuel cell during proton exchange cycling involves the corrosion/compaction of the carbon support. The increasing degradation of the carbon structure continuously reduces the electrocatalytic performance of proton exchange membrane fuel cells (PEM-FCs). This phenomenon can be explained by performing 3D tomographic analysis at the nanoscale. However, conventional tomographic approaches which present limited experimental feasibility, cannot perform such evaluation and have not provided sufficient structural information with statistical significance thus far. Therefore, a reliable methodology is required for the 3D geometrical evaluation of the carbon structure. Here, we propose a segmented tomographic approach which employs pore network analysis that enables the visualization of the geometrical parameters corresponding to the porous carbon structure at a high resolution. This approach can be utilized to evaluate the 3D structural degradation of the porous carbon structure after cycling in terms of local surface area, pore size distribution, and their 3D networking. These geometrical parameters of the carbon body were demonstrated to be substantially reduced owing to the cycling-induced degradation. This information enables a deeper understanding of the degradation phenomenon of carbon supports and can contribute to the development of stable PEM-FC electrodes.
Sedimentary rocks display complex spatial distribution of both pore space and solid components, impacting the directional dependence of physical phenomena such as electrical conduction, fluid flow, heat transfer, and molecular diffusion. The complexity of the pore space is often quantified by the concept of tortuosity, which measures the sinuosity of the connecting paths in the pore space. Tortuosity is an important quantity in formation evaluation as it impacts petrophysical properties such as permeability and formation factor. However, the existence of various techniques can lead to nonuniqueness in assessment of tortuosity. Furthermore, spatial variation of the solid components of the rocks occurring at the core-scale domain reflected in the connectivity and distribution of the minerals is typically not quantified. The objectives of this paper are (a) to quantify tortuosity and tortuosity anisotropy of porous media through estimation of electrical, diffusional, hydraulic, and geometrical tortuosity at the pore scale and core scale and (b) to compare electrical, diffusional, hydraulic, and geometrical tortuosity. We estimate tortuosity in the pore space of microcomputed tomography (micro-CT) scan images and in the most connected and abundant solid phase of whole-core CT scan images. We conduct numerical simulations of electric potential distribution, diffusion, and fluid flow and velocity distribution to estimate electrical, diffusional, and hydraulic tortuosity, respectively. To calculate geometrical tortuosity, we use the segmented pore space from micro-CT scan images to extract a pore network model and compute the shortest path of all opposing pores of the samples. Finally, tortuosity values obtained with each technique are used to assess the anisotropy of the samples. We applied the documented workflow to core- and pore-scale images. The CT scan images in the core-scale domain belong to a siliciclastic formation. Micro-CT scan images in the pore-scale domain were obtained from Berea Sandstone, Austin Chalk, and Estaillades limestone formations. We observed differences in estimates of direction-dependent electrical, diffusional, hydraulic, and geometrical tortuosity for both types of images. The highest numerical differences were observed when comparing streamline electrical and hydraulic tortuosity with diffusional tortuosity. The observed differences were significant in anisotropic samples. Differences in tortuosity estimates can impact the outcomes of rock physics models for which tortuosity is an input. The documented comparison provides insight in the selection of techniques for tortuosity estimation. Use of core-scale image data provides semicontinuous estimates of tortuosity and tortuosity anisotropy, which are typically not attainable using pore-scale images. Additionally, the semicontinuous tortuosity anisotropy estimates from whole-core CT scan images provide a tool for selection of best locations to take core plugs.
Full-text available
OpenFCST (open-source fuel cell simulation toolbox) is an opensource, finite element method based, multi-dimensional mathematical modeling software for polymer electrolyte fuel cells. The aim of the software is to develop a platform for collaborative development of fuel cell mathematical models. The philosophy, structure and main components of openFCST are presented. OpenFCST currently includes physical models for gas, electron, ion, ionomerbound water and heat transport. It also contains effective transport media relations to estimate transport properties for gas diffusion layers, micro-porous layers and catalyst layers as well as several kinetic models for the fuel cell electrochemical reactions. OpenFCST has been structured as a toolbox such that it is easier for new users to integrate new physical models with existing framework. OpenFCST is used to analyze the impact of different kinetic models on a multidimensional cathode model and to study the main differences between a macro-homogeneous and several agglomerate models. Finally, openFCST is used to develop a three-dimensional model of a patterned catalyst layer. Results show that multi-step kinetic models improve fuel cell performance predictions, macro-homogeneous and ionomer-filled agglomerate models show similar performance for 100 nm radii agglomerates up to current densities of 2 A/cm2, and water-filled agglomerate models require negative surface charges to exist at the pore walls in order to provide results in-line with experimental data. Finally, a patterned catalyst layer with micro-pores is shown to improve electrode performance.
Full-text available
Macroscopic continuum models are an essential tool to understand the complex transport phenomena that take place in gas diffusion layers (GDLs) used in polymer electrolyte fuel cells (PEFCs). Previous work has shown that macroscopic models require effective properties obtained under uniform saturation conditions to get a consistent physical formulation. This issue, mostly unappreciated in the open literature, is addressed in detail in this work. To this end, lattice Boltzmann simulations were performed on tomographic images of dry and water-invaded carbon-paper GDL subsamples with nearly uniform porosity and saturation. The computed effective diffusivity shows an anisotropic dependence on local porosity similar to that reported for morphologically analogous GDLs. In contrast, the dependence on local saturation is rather isotropic, following a nearly quadratic power law. The capability of the local correlations to recover the layer-scale properties obtained from inhomogeneous GDLs is checked by global averaging. Good agreement is found between the upscaled results and the diffusivity data of the GDL from which the present subdomains were taken, as well as other global data presented in the literature. A higher blockage effect of local saturation is however expected for the under-the-rib region in operating PEFCs.
Full-text available
A pore network model of the gas diffusion layer of PEMFCs is presented. Unlike previous attempts based on cubic lattices, this model has a random 3D architecture based on Delaunay tessellations to represent the pore space and Voronoi tessellations to represent the fiber structure. Very few input parameters are required to generate the model. Fiber diameter is specified, the number of pores per unit volume is adjusted to achieve a desired porosity, and the network is scaled to impart some in-plane vs. through-plane anisotropy. The resulting network possesses physical properties (such as pore and throat size) and transport properties (such as effective diffusivity tensor) that are in excellent agreement with available values. Capillary pressure curve simulations were compared with mercury and water injection data. Good agreement with the former was attained if the equivalent throat diameter was used in the calculation of entry pressures. Comparisons to water injection data were very poor unless the converging-diverging geometry of the throat was considered, in which case very close agreement was achieved. A relatively simple analytical equation was used to account for the throat geometry and its use is strongly recommended over the traditionally used equation for cylindrical capillary tubes.
Full-text available
SfePy (Simple Finite Elements in Python) is a framework for solving various kinds of problems (mechanics, physics, biology, ...) described by partial differential equations in two or three space dimensions by the finite element method. The paper illustrates its use in an interactive environment or as a framework for building custom finite-element based solvers.
Full-text available
Pore-scale imaging and modelling - digital core analysis - is becoming a routine service in the oil and gas industry, and has potential applications in contaminant transport and carbon dioxide storage. This paper briefly describes the underlying technology, namely imaging of the pore space of rocks from the nanometre scale upwards, coupled with a suite of different numerical techniques for simulating single and multiphase flow and transport through these images. Three example applications are then described, illustrating the range of scientific problems that can be tackled: dispersion in different rock samples that predicts the anomalous transport behaviour characteristic of highly heterogeneous carbonates; imaging of super-critical carbon dioxide in sandstone to demonstrate the possibility of capillary trapping in geological carbon storage; and the computation of relative permeability for mixed-wet carbonates and implications for oilfield waterflood recovery. The paper concludes by discussing limitations and challenges, including finding representative samples, imaging and simulating flow and transport in pore spaces over many orders of magnitude in size, the determination of wettability, and upscaling to the field scale. We conclude that pore-scale modelling is likely to become more widely applied in the oil industry including assessment of unconventional oil and gas resources. It has the potential to transform our understanding of multiphase flow processes, facilitating more efficient oil and gas recovery, effective contaminant removal and safe carbon dioxide storage.
We develop and analyze a novel, quasi-static, pore-scale approach for modeling drainage in a porous medium system. The approach uses: (1) a synthetic, non-overlapping packing of a set of spheres, (2) a discrete representation of the sphere packing, and (3) concepts from pore morphology and local pore-scale physics to simulate the drainage process. The grain-size distribution and porosity of two well-characterized porous media were used as input into the drainage simulator, and the simulated results showed good agreement with experimental observations. We further comment on the use of this simulator for determining the size of a representative elementary volume needed to characterize the drainage process.
The constitutive relationships required for the parameterization of multiphase flow and transport problems are of critical importance to hydrologic modeling. Recently, a hypothesis has been developed that predicts a functional relationship between capillary pressure, saturation, and interfacial area. A network model was developed to test this hypothesis. Microscale physical processes were simulated and volume averaging was used to derive the macroscopic measures of saturation and fluid-fluid interfacial area per volume of porous media. Results indicate that a smooth, though complex, functional relationship exists at the continuum scale. These results have direct relevance to constitutive theory and the modeling of nonaqueous phase liquid dissolution processes.
We present a stable numerical scheme for modelling multiphase flow in porous media, where the characteristic size of the flow domain is of the order of microns to millimetres. The numerical method is developed for efficient modelling of multiphase flow in porous media with complex interface motion and irregular solid boundaries. The Navier–Stokes equations are discretised using a finite volume approach, while the volume-of-fluid method is used to capture the location of interfaces. Capillary forces are computed using a semi-sharp surface force model, in which the transition area for capillary pressure is effectively limited to one grid block. This new formulation along with two new filtering methods, developed for correcting capillary forces, permits simulations at very low capillary numbers and avoids non-physical velocities. Capillary forces are implemented using a semi-implicit formulation, which allows larger time step sizes at low capillary numbers. We verify the accuracy and stability of the numerical method on several test cases, which indicate the potential of the method to predict multiphase flow processes.
In this paper, theoretical and experimental approaches to flow, hydrodynamic dispersion, and miscible and immiscible displacement processes in reservoir rocks are reviewed and discussed. Both macroscopically homogeneous and heterogeneous rocks are considered. The latter are characterized by large-scale spatial variations and correlations in their effective properties and include rocks that may be characterized by several distinct degrees of porosity, a well-known example of which is a fractured rock with two degrees of porosity-those of the pores and of the fractures. First, the diagenetic processes that give rise to the present reservoir rocks are discussed and a few geometrical models of such processes are described. Then, measurement and characterization of important properties, such as pore-size distribution, pore-space topology, and pore surface roughness, and morphological properties of fracture networks are discussed. It is shown that fractal and percolation concepts play important roles in the characterization of rocks, from the smallest length scale at the pore level to the largest length scales at the fracture and fault scales. Next, various structural models of homogeneous and heterogeneous rock are discussed, and theoretical and computer simulation approaches to flow, dispersion, and displacement in such systems are reviewed. Two different modeling approaches to these phenomena are compared. The first approach is based on the classical equations of transport supplemented with constitutive equations describing the transport and other important coefficients and parameters. These are called the continuum models. The second approach is based on network models of pore space and fractured rocks; it models the phenomena at the smallest scale, a pore or fracture, and then employs large-scale simulation and modern concepts of the statistical physics of disordered systems, such as scaling and universality, to obtain the macroscopic properties of the system. The fundamental roles of the interconnectivity of the rock and its wetting properties in dispersion and two-phase flows, and those of microscopic and macroscopic heterogeneities in miscible displacements are emphasized. Two important conceptual advances for modeling fractured rocks and studying flow phenomena in porous media are also discussed. The first, based on cellular automata, can in principle be used for computing macroscopic properties of flow phenomena in any porous medium, regardless of the complexity of its structure. The second, simulated annealing, borrowed from optimization processes and the statistical mechanics of spin glasses, is used for finding the optimum structure of a fractured reservoir that honors a limited amount of experimental data.