How to use the openpnm.phases 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 / tests / unit / models / physics / HydraulicConductance.py View on Github external
def setup_class(self):
        self.net = op.network.Cubic(shape=[5, 5, 5], spacing=1.0)
        self.geo = op.geometry.GenericGeometry(network=self.net,
                                               pores=self.net.Ps,
                                               throats=self.net.Ts)
        self.geo['pore.diameter'] = 1.0
        self.geo['throat.diameter'] = 1.0
        self.geo['throat.length'] = 1.0e-9
        self.air = op.phases.Air(network=self.net)
        self.phys = op.physics.GenericPhysics(network=self.net,
                                              phase=self.air,
                                              geometry=self.geo)
github PMEAL / OpenPNM / test_mp.py View on Github external
coop_fill = False
trapping = False
lpf = False

sp.random.seed(0)
pn = op.network.Cubic(shape=[5, 5, 5], spacing=3e-4, name='pn11')
pn.add_boundary_pores()
proj = pn.project

Ps = pn.pores()
Ts = pn.throats()
geom = op.geometry.StickAndBall(network=pn, pores=Ps, throats=Ts,
                                name='intern')
geom.add_model(propname='throat.normal', model=gm.throat_normal.pore_coords,
               regen_mode='normal')
air = op.phases.Air(network=pn)
water = op.phases.Water(network=pn)
water['throat.viscosity'] = water['pore.viscosity'][0]

mod = op.models.physics.hydraulic_conductance.hagen_poiseuille
phys_air = op.physics.GenericPhysics(network=pn, phase=air,
                                     geometry=geom)
phys_water = op.physics.GenericPhysics(network=pn, phase=water,
                                       geometry=geom)
phys_water.add_model(propname='throat.conductance',
                     model=mod,
                     viscosity='throat.viscosity')

water["pore.contact_angle"] = 110
Swp_star = 0.25  # late pore filling
air["pore.contact_angle"] = 70
air["pore.surface_tension"] = water["pore.surface_tension"]
github PMEAL / OpenPNM / tests / unit / models / physics / GenericSourceTerm.py View on Github external
def setup_class(self):
        self.net = op.network.Cubic(shape=[5, 5, 5])
        Ps = self.net.Ps
        Ts = self.net.Ts
        self.geo = op.geometry.GenericGeometry(network=self.net, pores=Ps,
                                               throats=Ts)
        self.phase = op.phases.GenericPhase(network=self.net)
        self.phys = op.physics.GenericPhysics(network=self.net,
                                              phase=self.phase,
                                              geometry=self.geo)
        self.phys['throat.diffusive_conductance'] = 5e-8
        self.phase['pore.mole_fraction'] = 0.0
        self.BC_pores = np.arange(20, 30)
        self.source_pores = np.arange(55, 85)
github PMEAL / OpenPNM / example_transient_Fickian_diffusion.py View on Github external
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
phase['throat.diffusivity'] = 2e-09

mod = op.models.physics.diffusive_conductance.ordinary_diffusion
phys.add_model(propname='throat.diffusive_conductance',
               model=mod, regen_mode='normal')

# algorithms: Fickian diffusion
fd = op.algorithms.TransientFickianDiffusion(network=net, phase=phase)
fd.set_value_BC(pores=net.pores('front'), values=0.5)
fd.set_value_BC(pores=net.pores('back'), values=0.1)
fd.setup(t_final=100, t_output=10, t_step=0.5)
fd.run()
github PMEAL / OpenPNM / scripts / example_Knudsen.py View on Github external
import openpnm as op
import numpy as np
import matplotlib.pyplot as plt


# Get Deff w/o including Knudsen effect
spacing = 1.0
net = op.network.Cubic(shape=[10, 10, 10], spacing=spacing)
geom = op.geometry.StickAndBall(network=net)
air = op.phases.Air(network=net)
phys = op.physics.Standard(network=net, geometry=geom, phase=air)
odiff = op.models.physics.diffusive_conductance.ordinary_diffusion
phys.add_model(propname="throat.diffusive_conductance", model=odiff)
fd = op.algorithms.FickianDiffusion(network=net, phase=air)
fd.set_value_BC(pores=net.pores("left"), values=1.0)
fd.set_value_BC(pores=net.pores("right"), values=0.0)
fd.run()
L = (net.shape * net.spacing)[1]
A = (net.shape * net.spacing)[[0, 2]].prod()
Mdot = fd.rate(pores=net.pores("left")).squeeze()
Deff0 =  Mdot * L / A

# Get Deff w/ including Knudsen effect
mdiff = op.models.physics.diffusive_conductance.mixed_diffusion
phys.add_model(propname="throat.diffusive_conductance", model=mdiff)
spacings = np.linspace(1e-9, 1e-4, 20)
github PMEAL / OpenPNM / scripts / example_mass_partitioning.py View on Github external
import openpnm as op
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(10)

# Define network and geometry
net = op.network.Cubic(shape=[10, 1, 1])
geom = op.geometry.StickAndBall(network=net)

# Define constituent phases
air = op.phases.Air(network=net, name="air")
water = op.phases.Water(network=net, name="water")
water["pore.diffusivity"] = air["pore.diffusivity"] * 0.2

# Define MultiPhase object
mphase = op.phases.MultiPhase(network=net, phases=[air, water])
mphase._set_automatic_throat_occupancy()
mphase.set_occupancy(phase=air, pores=[0, 1, 2, 3, 4])
mphase.set_occupancy(phase=water, pores=[5, 6, 7, 8, 9])
const = op.models.misc.constant
mphase.set_binary_partition_coef(propname="throat.partition_coef",
                                 phases=[water, air], model=const, value=0.5)

# Define physics object
phys = op.physics.Standard(network=net, phase=mphase, geometry=geom)
mdiff = op.models.physics.diffusive_conductance.multiphase_diffusion
phys.add_model(propname="throat.diffusive_conductance", model=mdiff)

# Define algorithm: Fickian diffusion
fd = op.algorithms.FickianDiffusion(network=net, phase=mphase)
fd.set_value_BC(pores=0, values=1.0)
fd.set_value_BC(pores=9, values=0.1)
github PMEAL / OpenPNM / nonNewtonian_01.py View on Github external
# 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

# physics
phys = op.physics.GenericPhysics(network=net,
                                 phase=phase,
                                 geometry=geo)

mod1 = op.models.physics.hydraulic_conductance.hagen_poiseuille
phys.add_model(propname='throat.hydraulic_conductance',
               model=mod1, regen_mode='normal')

# algorithms: Newtonian Stokes flow
sf = op.algorithms.StokesFlow(network=net, phase=phase)
sf.set_value_BC(pores=net.pores('front'), values=1)
sf.set_value_BC(pores=net.pores('back'), values=2)
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.py View on Github external
import openpnm as op
ws = op.Workspace()
proj = ws.new_project()

pn = op.network.Cubic(shape=[10, 10, 10], spacing=1e-4, project=proj)
geo = op.geometry.StickAndBall(network=pn, pores=pn.Ps, throats=pn.Ts)
air = op.phases.Air(network=pn, name='air')
water = op.phases.Water(network=pn, name='h2o')
hg = op.phases.Mercury(network=pn, name='hg')
phys_air = op.physics.Standard(network=pn, phase=air, geometry=geo)
phys_water = op.physics.Standard(network=pn, phase=water, geometry=geo)
phys_hg = op.physics.Standard(network=pn, phase=hg, geometry=geo)

mip = op.algorithms.Porosimetry(network=pn)
mip.setup(phase=hg)
mip.set_inlets(pores=pn.pores(['top', 'bottom']))
mip.run()
hg.update(mip.results(Pc=70000))
# mip.plot_intrusion_curve()

perm = op.algorithms.StokesFlow(network=pn)
perm.setup(phase=water)
perm.set_value_BC(pores=pn.pores('right'), values=0)