How to use the openpnm.network.Cubic 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 / 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 / docs / pyplots / getting_started_mip_curve.py View on Github external
import numpy as np
import openpnm as op
pn = op.network.Cubic(shape=[10, 10, 10], spacing=0.0001)
Ps = pn.pores('all')
Ts = pn.throats('all')
geo = op.geometry.StickAndBall(network=pn, pores=Ps, throats=Ts)
hg = op.phases.Mercury(network=pn)
h2o = op.phases.Water(network=pn)
phys1 = op.physics.GenericPhysics(network=pn, phase=hg, geometry=geo)
phys2 = op.physics.GenericPhysics(network=pn, phase=h2o, geometry=geo)
model = op.models.physics.capillary_pressure.washburn
hg.add_model(propname='throat.entry_pressure',
             model=model,
             contact_angle='pore.contact_angle',
             surface_tension='pore.surface_tension')
model = op.models.physics.hydraulic_conductance.hagen_poiseuille
h2o.add_model(propname='throat.hydraulic_conductance',
              model=model,
              throat_viscosity='throat.viscosity',
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',
               eta=1, Swp_star=0.4,
               regen_mode='deferred')
github PMEAL / OpenPNM / scripts / example_multiphase_diffusion.py View on Github external
to be coated w/ a catalyst, and are therefore reactive.

    The diffusing species diffuses through air, which is followed by mass
    partitioning at the two air-water interfaces, then continues diffusing
    through the water, and finally reacting at the two reacting plates at the
    top and the bottom of the network.

"""
import openpnm as op
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(10)


# Define network, geometry and constituent phases
net = op.network.Cubic(shape=[100, 100, 1])
geom = op.geometry.StickAndBall(network=net)
air = op.phases.Air(network=net, name="air")
water = op.phases.Water(network=net, name="water")
water["pore.diffusivity"] = air["pore.diffusivity"] * 0.05

# Define the regions to be occupied by the two phases (air and water)
x, y, z = net["pore.coords"].T
ps_water = net.Ps[(y >= 75) + (y <= 25)]
ps_air = np.setdiff1d(net.Ps, ps_water)
ts_water = net.find_neighbor_throats(pores=ps_water, mode="xnor")
ts_air = net.find_neighbor_throats(pores=ps_air, mode="xnor")
ts_interface = net.find_neighbor_throats(pores=ps_water, mode="xor")

# Define multiphase and set phase occupancy
mphase = op.phases.MultiPhase(network=net, phases=[air, water], name="mphase")
mphase._set_automatic_throat_occupancy()
github PMEAL / OpenPNM / openpnm / materials / BereaCubic.py View on Github external
def __init__(self, shape, name=None, **kwargs):
        super().__init__(name=name)

        net = Cubic(shape=shape, spacing=1e-4, connectivity=26,
                    project=self, **kwargs)

        geom = GenericGeometry(network=net, pores=net.Ps, throats=net.Ts)

        geom.add_model(propname='pore.seed',
                       model=gm.pore_seed.spatially_correlated,
                       weights=[1, 1, 1])
        geom.add_model(propname='pore.diameter',
                       model=gm.pore_size.weibull,
                       shape=2.2, scale=2e-5, loc=1e-6)
        geom.add_model(propname='pore.volume',
                       model=gm.pore_volume.sphere)
        geom.add_model(propname='throat.length',
                       model=gm.throat_length.piecewise)
        geom.add_model(propname='throat.diameter',
                       model=gm.throat_size.from_neighbor_pores,
github PMEAL / OpenPNM / example_cantera.py View on Github external
import openpnm as op
import cantera as ct
from openpnm.utils.misc import tic, toc
ws = op.core.Workspace()

net = op.network.Cubic(shape=[10, 10, 10], spacing=1e-6, name='test_net')
proj = net.project
geom = op.geometry.GenericGeometry(network=net, pores=net.Ps, throats=net.Ts)

air = op.phases.Air(network=net)
phys_air = op.physics.GenericPhysics(network=net, phase=air, geometry=geom)

cantera = op.models.phase.thermal_conductivity.cantera

print('Calculating thermal conductivity with Cantera')
tic()
air.add_model(propname='pore.thermal_conductivity',
              model=cantera,
              cantera_phase_obj=ct.Solution('air.xml'))
air.regenerate_models(propnames='pore.thermal_conductivity')
toc()