Skip to main content

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

Project description

https://badge.fury.io/py/openpnm.svg https://travis-ci.org/PMEAL/OpenPNM.svg?branch=master https://img.shields.io/codecov/c/github/PMEAL/OpenPNM.svg?style=flat Join the chat at https://gitter.im/PMEAL/OpenPNM

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

Installation

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:

python setup.py

Example Usage

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:

http://i.imgur.com/GbUNy0bm.png

The drainage curve can be visualized with MIP.plot_drainage_curve() giving something like this:

http://i.imgur.com/ZxuCictm.png

A collection of examples has been started as a new Github repository: OpenPNM-Examples.

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page