Skip to main content

A framework for conducting pore network modeling simulations of multiphase transport in porous materials

Project description

Please cite as:

Gostick et al. "OpenPNM: a pore network modeling package." Computing in Science & Engineering 18, no. 4 (2016): 60-74. doi:10.1109/MCSE.2016.49

Overview of OpenPNM

OpenPNM is a comprehensive framework for performing pore network simulations of porous materials.

For more details about the package can be found in the on-line documentation

To be notified of new releases click the Watch button on the Github repo page. To show your support for this project click the Star button, as we use this as a proxy for the size of our userbase when applying for funding.

Installation and Requirements

Preferred method

The preferred way of installing OpenPNM is through Anaconda Cloud using:

conda install -c conda-forge openpnm

Alternative method

OpenPNM can also be installed from the Python Package Index using:

pip install openpnm

However, we don't recommend installing using pip since pypardiso, which is a blazing fast direct solver, is not available for Windows users who use Python 3.7+.

For developers

For developers who intend to change the source code or contribute to OpenPNM, the source code can be downloaded from Github and installed by running:

pip install -e 'path/to/downloaded/files'

The advantage to installing from the source code is that you can edit the files and have access to your changes each time you import OpenPNM.

OpenPNM requires the Scipy Stack (Numpy, Scipy, Matplotlib, etc), which is most conveniently obtained by installing the Anaconda Distribution.

Example Usage

The following code block illustrates how to use OpenPNM to perform a mercury intrusion porosimetry simulation:

import openpnm as op
pn =[10, 10, 10], spacing=0.0001)
geo = op.geometry.StickAndBall(network=pn, pores=pn.Ps, throats=pn.Ts)
Hg = op.phases.Mercury(network=pn)
phys = op.physics.Standard(network=pn, phase=Hg, geometry=geo)
mip = op.algorithms.Porosimetry(network=pn)
mip.set_inlets(pores=pn.pores(['left', 'right', 'top', 'bottom']))

The network can be visualized in ParaView giving the following:

The drainage curve can be visualized with mip.plot_intrusion_curve() giving something like this:

A collection of examples is available in the examples folder of this repository: Examples

Asking Questions and Getting Help

Github now has a Discussions function, which works similarly to stack overflow. Please post your question in the Q&A category so devs or users can provide answers, vote on accepted answers, improve on each other's answers, and generally discuss things. Most importantly, all answers are searchable so eventually, once enough questions have been posted and answered, you can find what you're looking for with a simple search.


OpenPNM is developed by the Porous Materials Engineering and Analysis Lab (PMEAL), in the Department of Chemical Engineering at the University of Waterloo in Waterloo, Ontario, Canada.

The lead developer for this project is Prof. Jeff Gostick (

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for openpnm, version 2.7.0
Filename, size File type Python version Upload date Hashes
Filename, size openpnm-2.7.0-py3-none-any.whl (394.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size openpnm-2.7.0.tar.gz (291.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page