How to use the openpnm.models.misc 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 / openpnm / models / geometry / throat_size.py View on Github external
weibull.__doc__ = _misc.weibull.__doc__


def normal(target, scale, loc, seeds='throat.seed'):
    return _misc.normal(target=target, scale=scale, loc=loc, seeds=seeds)


normal.__doc__ = _misc.normal.__doc__


def generic_distribution(target, func, seeds='throat.seed'):
    return _misc.generic_distribution(target=target, func=func, seeds=seeds)


generic_distribution.__doc__ = _misc.generic_distribution.__doc__


def random(target, seed=None, num_range=[0, 1]):
    return _misc.random(target=target, element='throat', seed=seed,
                        num_range=num_range)


random.__doc__ = _misc.random.__doc__


def from_neighbor_pores(target, pore_prop='pore.diameter', mode='min'):
    return _misc.from_neighbor_pores(target=target, pore_prop=pore_prop,
                                     mode=mode)


from_neighbor_pores.__doc__ = _misc.from_neighbor_pores.__doc__
github PMEAL / OpenPNM / openpnm / geometry / StickAndBall.py View on Github external
def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.add_model(propname='pore.seed',
                       model=mods.misc.random,
                       element='pore',
                       num_range=[0.2, 0.7],
                       seed=None)

        self.add_model(propname='pore.max_size',
                       model=mods.geometry.pore_size.largest_sphere,
                       iters=10)

        self.add_model(propname='pore.diameter',
                       model=mods.misc.product,
                       prop1='pore.max_size',
                       prop2='pore.seed')

        self.add_model(propname='pore.area',
                       model=mods.geometry.pore_area.sphere,
                       pore_diameter='pore.diameter')
github PMEAL / OpenPNM / example_transientAD.py View on Github external
# 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)
pore_d = op.models.misc.constant
throat_d = op.models.misc.constant
geo.add_model(propname='pore.diameter', model=pore_d, value=1.5e-4)
geo.add_model(propname='throat.diameter', model=throat_d, value=1e-4)
geo.regenerate_models()

water = op.phases.Water(network=net)


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

flow = op.models.physics.hydraulic_conductance.hagen_poiseuille
phys.add_model(propname='throat.hydraulic_conductance',
               pore_viscosity='pore.viscosity',
               throat_viscosity='throat.viscosity',
               model=flow, regen_mode='normal')
github PMEAL / OpenPNM / example_transientPNP.py View on Github external
# 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)
pore_d = op.models.misc.constant
throat_d = op.models.misc.constant
geo.add_model(propname='pore.diameter', model=pore_d, value=1.5e-4)
geo.add_model(propname='throat.diameter', model=throat_d, value=1e-4)
geo.regenerate_models()

sw = mixtures.SalineWater(network=net)
# Retrieve handles to each species for use below
Cl, Na, H2O = sw.components.values()

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

flow = op.models.physics.hydraulic_conductance.hagen_poiseuille
phys.add_model(propname='throat.hydraulic_conductance',
               pore_viscosity='pore.viscosity',
               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')
phys['throat.pc_star'] = phys['throat.entry_pressure']
phys.add_model(propname='throat.late_filling',
               model=op.models.physics.multiphase.late_filling,
               pressure='throat.pressure',
               Pc_star='throat.pc_star',
               eta=1, Swp_star=0.2,
               regen_mode='deferred')
github PMEAL / OpenPNM / openpnm / phases / Air.py View on Github external
def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self['pore.molecular_weight'] = 0.02896
        self['pore.critical_pressure'] = 3.786E6
        self['pore.critical_temperature'] = 132.5
        self['pore.critical_volume'] = 0.002917
        self['pore.contact_angle'] = 110.0
        self.add_model(propname='pore.molar_density',
                       model=mods.phases.molar_density.ideal_gas)
        self.add_model(propname='pore.diffusivity',
                       model=mods.phases.diffusivity.fuller,
                       MA=0.032, MB=0.028,
                       vA=16.6, vB=17.9)
        self.add_model(propname='pore.thermal_conductivity',
                       model=mods.misc.polynomial,
                       prop='pore.temperature',
                       a=[0.00422791, 0.0000789606, -1.56383E-08])
        self.add_model(propname='pore.viscosity',
                       model=mods.misc.polynomial,
                       prop='pore.temperature',
                       a=[0.00000182082, 6.51815E-08, -3.48553E-11,
                          1.11409E-14])
github PMEAL / OpenPNM / openpnm / models / geometry / throat_size.py View on Github external
def random(target, seed=None, num_range=[0, 1]):
    return _misc.random(target=target, element='throat', seed=seed,
                        num_range=num_range)


random.__doc__ = _misc.random.__doc__


def from_neighbor_pores(target, pore_prop='pore.diameter', mode='min'):
    return _misc.from_neighbor_pores(target=target, pore_prop=pore_prop,
                                     mode=mode)


from_neighbor_pores.__doc__ = _misc.from_neighbor_pores.__doc__


def equivalent_diameter(target, throat_area='throat.area',
                        throat_shape='circle'):
    r"""
    Calculates the diameter of a cirlce or edge-length of a sqaure with same
    area as the throat.

    Parameters
    ----------
    target : OpenPNM Object
        The object which this model is associated with. This controls the
        length of the calculated array, and also provides access to other
        necessary properties.

    thorat_area : string
github PMEAL / OpenPNM / example_transientPNP.py View on Github external
# 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)
pore_d = op.models.misc.constant
throat_d = op.models.misc.constant
geo.add_model(propname='pore.diameter', model=pore_d, value=1.5e-4)
geo.add_model(propname='throat.diameter', model=throat_d, value=1e-4)
geo.regenerate_models()

sw = mixtures.SalineWater(network=net)
# Retrieve handles to each species for use below
Cl, Na, H2O = sw.components.values()

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

flow = op.models.physics.hydraulic_conductance.hagen_poiseuille
phys.add_model(propname='throat.hydraulic_conductance',
               pore_viscosity='pore.viscosity',
               throat_viscosity='throat.viscosity',
               model=flow, regen_mode='normal')
github PMEAL / OpenPNM / openpnm / models / geometry / pore_seed.py View on Github external
.. autofunction:: openpnm.models.geometry.pore_seed.random
.. autofunction:: openpnm.models.geometry.pore_seed.spatially_correlated

"""

import scipy as _sp
from openpnm.models import misc as _misc
from openpnm.utils import logging as _logging
_logger = _logging.getLogger(__name__)


def random(target, seed=None, num_range=[0, 1]):
    return _misc.random(target, element='pore', seed=seed, num_range=num_range)


random.__doc__ = _misc.random.__doc__


def spatially_correlated(target, weights=None, strel=None):
    r"""
    Generates pore seeds that are spatailly correlated with their neighbors.

    Parameters
    ----------
    target : OpenPNM Object
        The object which this model is associated with. This controls the
        length of the calculated array, and also provides access to other
        necessary properties.

    weights : list of ints, optional
        The [Nx,Ny,Nz] distances (in number of pores) in each direction that
        should be correlated.
github PMEAL / OpenPNM / openpnm / models / geometry / pore_size.py View on Github external
def random(target, seed=None, num_range=[0, 1]):
    return _misc.random(target=target, element='pore', seed=seed,
                        num_range=num_range)