How to use the openpnm.Workspace function in openpnm

To help you get started, we’ve selected a few openpnm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PMEAL / OpenPNM / nonNewtonian_01.py View on Github external
import openpnm as op
import numpy as np

# work space and project
ws = op.Workspace()
proj = ws.new_project()

# network
np.random.seed(7)
net = op.network.Cubic(shape=[20, 1, 1], spacing=1e-4, project=proj)

# geometry
geo = op.geometry.StickAndBall(network=net,
                               pores=net.Ps,
                               throats=net.Ts)

# phase
phase = op.phases.Water(network=net)
phase['pore.consistency'] = 0.00089319
phase['pore.flow_index'] = 2
github PMEAL / porespy / porespy / networks / __getnet__.py View on Github external
model=op_gm.throat_endpoints.spherical_pores,
                 pore_diameter='pore.inscribed_diameter',
                 throat_diameter='throat.inscribed_diameter')
    pn.add_model(propname='throat.conduit_lengths',
                 model=op_gm.throat_length.conduit_lengths)
    pn.add_model(propname='pore.area',
                 model=op_gm.pore_area.sphere)
    net['throat.endpoints.head'] = pn['throat.endpoints.head']
    net['throat.endpoints.tail'] = pn['throat.endpoints.tail']
    net['throat.conduit_lengths.pore1'] = pn['throat.conduit_lengths.pore1']
    net['throat.conduit_lengths.pore2'] = pn['throat.conduit_lengths.pore2']
    net['throat.conduit_lengths.throat'] = pn['throat.conduit_lengths.throat']
    net['pore.area'] = pn['pore.area']
    prj = pn.project
    prj.clear()
    wrk = op.Workspace()
    wrk.close_project(prj)

    return net
github PMEAL / OpenPNM / example_PNP.py View on Github external
import openpnm as op
from openpnm.phases import mixtures
import numpy as np
ws = op.Workspace()
proj = ws.new_project()
# ws.settings['loglevel'] = 20


# network, geometry, phase
np.random.seed(0)

net = op.network.Cubic(shape=[8, 8, 1], spacing=9e-4, project=proj)
prs = (net['pore.back'] * net['pore.right'] + net['pore.back'] *
       net['pore.left'] + net['pore.front'] * net['pore.right'] +
       net['pore.front'] * net['pore.left'])
thrts = net['throat.surface']
op.topotools.trim(network=net, pores=net.Ps[prs], throats=net.Ts[thrts])


geo = op.geometry.StickAndBall(network=net, pores=net.Ps, throats=net.Ts)
github PMEAL / OpenPNM / example_transientPNP.py View on Github external
import openpnm as op
from openpnm.phases import mixtures
import numpy as np
ws = op.Workspace()
proj = ws.new_project()
# ws.settings['loglevel'] = 20


# network, geometry, phase
np.random.seed(0)

net = op.network.Cubic(shape=[8, 8, 1], spacing=9e-4, project=proj)
prs = (net['pore.back'] * net['pore.right'] + net['pore.back'] *
       net['pore.left'] + net['pore.front'] * net['pore.right'] +
       net['pore.front'] * net['pore.left'])
thrts = net['throat.surface']
op.topotools.trim(network=net, pores=net.Ps[prs], throats=net.Ts[thrts])


geo = op.geometry.StickAndBall(network=net, pores=net.Ps, throats=net.Ts)
github PMEAL / OpenPNM / example_script_OP.py View on Github external
import openpnm as op
ws = op.Workspace()
proj = ws.new_project()
pn = op.network.Cubic(shape=[10, 10, 10], project=proj, spacing=1e-4)
geom = op.geometry.StickAndBall(network=pn, pores=pn.Ps, throats=pn.Ts)
geom['pore.volume'][pn.pores('left')] = 0
hg = op.phases.Mercury(network=pn)
phys = op.physics.GenericPhysics(network=pn, phase=hg, geometry=geom)
phys.add_model(propname='throat.entry_pressure',
               model=op.models.physics.capillary_pressure.washburn)
phys.add_model(propname='pore.pc_star',
               model=op.models.misc.from_neighbor_throats,
               throat_prop='throat.entry_pressure',
               mode='min')
phys.add_model(propname='pore.late_filling',
               model=op.models.physics.multiphase.late_filling,
               pressure='pore.pressure',
               Pc_star='pore.pc_star',
github PMEAL / OpenPNM / example_bot.py View on Github external
import openpnm as op
ws = op.Workspace()
ws.settings['loglevel'] = 30
proj = ws.new_project()

net, geo, phase = op.materials.BundleOfTubes(shape=50, spacing=0.0001, length=0.001,
                                             psd_params={'distribution': 'weibull',
                                                         'loc': 0.000001,
                                                         'scale': 0.00004,
                                                         'shape': 2.2},
                                             settings={'adjust_psd': 'normalize',
                                                       'seed': 0})
hg = op.phases.Mercury(network=net)
phys = op.physics.Classic(network=net, phase=hg, geometry=geo)
mip = op.algorithms.Porosimetry(network=net, phase=hg)
mip.set_inlets(pores=net.pores('top'))
mip.run()
mip.plot_intrusion_curve()
github PMEAL / OpenPNM / example_script_mixtures.py View on Github external
import openpnm as op
from openpnm.phases import mixtures
ws = op.Workspace()
proj = ws.new_project()

pn = op.network.Cubic(shape=[30, 30, 10], spacing=1e-4, project=proj)
geo = op.geometry.StickAndBall(network=pn, pores=pn.Ps, throats=pn.Ts)

N2 = mixtures.species.gases.N2(network=pn, name='pure_N2')
O2 = mixtures.species.gases.O2(network=pn, name='pure_O2')
air = mixtures.GenericMixture(network=pn, components=[N2, O2],
                              name='air_mixture')
air.set_mole_fraction(N2, 0.79)
air.set_mole_fraction(O2, 0.21)
air.add_model(propname='pore.molar_mass',
              model=op.models.phases.mixtures.mole_weighted_average,
              prop='pore.molecular_weight')
air.add_model(propname='pore.diffusivity.pure_O2',
              model=op.models.phases.mixtures.fuller_diffusivity)
github PMEAL / OpenPNM / example_transient_Fickian_diffusion.py View on Github external
import openpnm as op
import numpy as np

# work space and project
ws = op.Workspace()
ws.settings["loglevel"] = 30
proj = ws.new_project()

# network
np.random.seed(7)
net = op.network.Cubic(shape=[51, 19, 1], spacing=1e-4, project=proj)

# geometry
geo = op.geometry.StickAndBall(network=net, pores=net.Ps, throats=net.Ts)

# phase
phase = op.phases.Water(network=net)

# physics
phys = op.physics.GenericPhysics(network=net, phase=phase, geometry=geo)
phase['pore.diffusivity'] = 2e-09