How to use the openpnm.geometry.GenericGeometry 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 / 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 / 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 / integration / test_multiple_geoms.py View on Github external
import openpnm as op

pn = op.network.Cubic(shape=[10, 10, 40], spacing=1)

# Generate Ps as boolean mask
Ps = pn['pore.coords'][:, 2] <= 20
Ts = pn.find_neighbor_throats(pores=Ps, mode='intersection', flatten=True)
geom1 = op.geometry.GenericGeometry(network=pn, pores=Ps, throats=Ts)

# Convert Ps to indices
Ps = pn.toindices(pn['pore.coords'][:, 2] > 20)
Ts = pn.find_neighbor_throats(pores=Ps, mode='union')
geom2 = op.geometry.GenericGeometry(network=pn, pores=Ps, throats=Ts)

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

phys1 = op.physics.GenericPhysics(network=pn, phase=water, geometry=geom1)
phys1.add_model(propname='pore.test',
                model=op.models.geometry.pore_misc.constant,
                value=1.0)
phys1.regenerate_models()

phys2 = op.physics.GenericPhysics(network=pn, phase=water, geometry=geom2)
# Copy models from phys1 to phys2 directly
phys2.models = phys1.models
# Ensure the models dicts are equal
assert phys1.models == phys2.models
# But they are actually distinct objects
assert phys1.models is not phys2.models
github PMEAL / OpenPNM / openpnm / io / IO.py View on Github external
```'pore.coords'``` and ```throat.conns```), and places them on a
        GenericGeometry object.  Any labels on the Network are left intact.

        Parameters
        ----------
        network : OpenPNM Network Object
            The Network that possesses the geometrical values

        Returns
        -------
        geometry : OpenPNM Geometry Object
            The new GenericGeometry object that was created to contain the
            geometrical pore and throat properties.

        """
        geom = op.geometry.GenericGeometry(network=network,
                                           pores=network.Ps,
                                           throats=network.Ts)
        for item in network.props():
            if item not in ['pore.coords', 'throat.conns']:
                geom.update({item: network.pop(item)})
        return geom
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()


print('Calculating thermal conductivity directly')
github PMEAL / OpenPNM / openpnm / utils / Project.py View on Github external
def _new_object(self, objtype, name=None):
        r"""
        """
        if objtype.startswith('net'):
            obj = openpnm.network.GenericNetwork(project=self, name=name)
        elif objtype.startswith('geo'):
            obj = openpnm.geometry.GenericGeometry(project=self, name=name,
                                                   pores=[], throats=[])
        elif objtype.startswith('pha'):
            obj = openpnm.phases.GenericPhase(project=self, name=name)
        elif objtype.startswith('phy'):
            obj = openpnm.physics.GenericPhysics(project=self, name=name)
        elif objtype.startswith('alg'):
            obj = openpnm.algorithm.GenericAlgorithm(project=self, name=name)
        else:
            obj = openpnm.core.Base(project=self, name=name)
        return obj
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,
                       pore_prop='pore.diameter', mode='min')
        geom.add_model(propname='throat.volume',
                       model=gm.throat_volume.cylinder)
github PMEAL / OpenPNM / openpnm / utils / Project.py View on Github external
def _new_object(self, objtype, name=None):
        r"""
        """
        if objtype.startswith('net'):
            obj = openpnm.network.GenericNetwork(project=self, name=name)
        elif objtype.startswith('geo'):
            obj = openpnm.geometry.GenericGeometry(project=self, name=name,
                                                   pores=[], throats=[])
        elif objtype.startswith('pha'):
            obj = openpnm.phases.GenericPhase(project=self, name=name)
        elif objtype.startswith('phy'):
            obj = openpnm.physics.GenericPhysics(project=self, name=name)
        elif objtype.startswith('alg'):
            obj = openpnm.algorithm.GenericAlgorithm(project=self, name=name)
        else:
            obj = openpnm.core.Base(project=self, name=name)
        return obj