A framework for conducting pore network modeling simulations of multiphase transport in porous materials.
Overview of OpenPNM
OpenPNM is an open source project aiming to provide porous media researchers with a ready-made framework for performing a wide range of pore network simulations. The main features and capabilities of OpenPNM are:
- Defines a universal means of representing any network topology based on a sparse representation of the adjacency matrix
- Provides a set of tools for querying, inspecting, and manipulating topology
- Including finding neighboring pores, labeling specific locations, adding or removing pores and throats, joining networks, subdividing and merging pores to create multiscale models, and much more
- Includes network generators for creating cubic or random networks with arbitrary connectivity
- Stores pore and throat property data in vectorized format
- Allows for fast calculations even on large networks
- Supports the familiar and advanced array access features such as direct indexing, slicing, Boolean masking, etc.
- A sophisticated mechanism for calculating the pore-scale properties that define the geometrical (i.e. pore radius), thermophysical (i.e. viscosity), and physics (i.e. hydraulic conductance) properties of the simulation
- The interdependence of some properties on other properties is naturally included so values can be regenerated when changes occur (i.e. viscosity can be updated when temperature changed)
- This mechanism was designed to allow users to easily create new customized pore-scale models suitable for their specific domain
- A wide assortment of pore-scale transport parameter, pore size calculations, and thermophysical property models are included
- A suite of algorithms for performing network simulations such as invasion percolation, capillary drainage, mass diffusion, permeability and so on.
- Supports saving, loading, importing and exporting data in numerous formats
- Allows importing networks generated or extracted by other code, as well as exporting data for post-processing and visualization
- Saving and loading of simulations allows for batch processing of simulations to be analyzed at a later point
OpenPNM can be install from the Python Package index using:
pip install openpnm
Or the source code can be downloaded from Github and installed by running:
The following code block illustrates how to use OpenPNM to perform a mercury intrusion porosimetry simulation in just 10 lines:
>>> import OpenPNM as op >>> pn = op.Network.Cubic(shape=[10, 10, 10], spacing=0.0001) >>> geo = op.Geometry.Stick_and_Ball(network=pn, pores=pn.Ps, ... throats=pn.Ts) >>> Hg = op.Phases.Mercury(network=pn) >>> Air = op.Phases.Air(network=pn) >>> phys = op.Physics.Standard(network=pn, phase=Hg, pores=pn.Ps, ... throats=pn.Ts) >>> MIP = op.Algorithms.Drainage(network=pn) >>> MIP.setup(invading_phase=Hg, defending_phase=Air) >>> MIP.set_inlets(pores=pn.pores(['top', 'bottom'])) >>> MIP.run()
The network can be visualized in Paraview giving the following:
The drainage curve can be visualized with MIP.plot_drainage_curve() giving something like this:
A collection of examples has been started as a new Github repository: OpenPNM-Examples.