code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def liquid_pure_bb(
phase,
T='pore.temperature',
Tc='param.critical_temperature',
Tb='param.boiling_temperature',
Pc='param.critical_pressure',
):
r"""
Computes the surface tension of a pure liquid in its own vapor using the
correlation in [1]
Parameters
----------
%(phase)s... |
Computes the surface tension of a pure liquid in its own vapor using the
correlation in [1]
Parameters
----------
%(phase)s
%(T)s
%(Tc)s
%(Tb)s
%(Pc)s
Returns
-------
value : ndarray
A numpy ndarray containing surface tension values scaled to the
temper... | liquid_pure_bb | python | PMEAL/OpenPNM | openpnm/models/phase/surface_tension/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/surface_tension/_funcs.py | MIT |
def liquid_mixture_wsd(
phase,
sigmas='pore.surface_tension.*',
rhos='pore.density.*',
MWs='param.molecular_weight.*',
):
r"""
Computes the surface tension of a liqiud mixture with its own vapor using
the correlation in [1]
Parameters
----------
%(phase)s
%(rhos)s
%(MWs)... |
Computes the surface tension of a liqiud mixture with its own vapor using
the correlation in [1]
Parameters
----------
%(phase)s
%(rhos)s
%(MWs)s
%(sigmas)s
Returns
-------
sigma : ndarray
A numpy ndarray containing surface tension values
References
------... | liquid_mixture_wsd | python | PMEAL/OpenPNM | openpnm/models/phase/surface_tension/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/surface_tension/_funcs.py | MIT |
def water_correlation(
phase,
T="pore.temperature",
salinity="pore.salinity",
):
r"""
Calculates thermal conductivity of pure water or seawater at atmospheric
pressure using the correlation given [1].
Values at temperature higher the normal boiling temperature are calculated
at the satu... |
Calculates thermal conductivity of pure water or seawater at atmospheric
pressure using the correlation given [1].
Values at temperature higher the normal boiling temperature are calculated
at the saturation pressure.
Parameters
----------
%(phase)s
%(T)s
%(salinity)s
Returns... | water_correlation | python | PMEAL/OpenPNM | openpnm/models/phase/thermal_conductivity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/thermal_conductivity/_funcs.py | MIT |
def gas_pure_gismr(
phase,
T='pore.temperature',
MW='param.molecular_weight',
Tb='param.boiling_temperature',
Pc='param.critical_pressure',
omega='param.acentric_factor',
):
r"""
Calculate the thermal conductivty of a pure gas using the correlation in
[1]
Parameters
--------... |
Calculate the thermal conductivty of a pure gas using the correlation in
[1]
Parameters
----------
%(phase)s
%(T)s
%(MW)s
%(Tb)s
%(Pc)s
%(omega)s
Returns
-------
References
----------
[1] gharagheizi method: doi:10.1002/aic.13938
| gas_pure_gismr | python | PMEAL/OpenPNM | openpnm/models/phase/thermal_conductivity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/thermal_conductivity/_funcs.py | MIT |
def liquid_pure_gismr(
phase,
T='pore.temperature',
MW='param.molecular_weight',
Tb='param.boiling_temperature',
Pc='param.critical_pressure',
omega='param.acentric_factor',
):
r"""
Calculates the thermal conductivity of a pure liquid using the correlation
in [1]
Parameters
... |
Calculates the thermal conductivity of a pure liquid using the correlation
in [1]
Parameters
----------
%(phase)s
%(T)s
%(MW)s
%(Tb)s
%(Pc)s
%(omega)s
Returns
-------
References
----------
[1] gharagheizi method: doi:10.1002/aic.13938
| liquid_pure_gismr | python | PMEAL/OpenPNM | openpnm/models/phase/thermal_conductivity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/thermal_conductivity/_funcs.py | MIT |
def liquid_pure_sr(
phase,
T="pore.temperature",
Tc='param.critical_temperature',
MW='param.molecular_weight',
Tb='param.boiling_temperature',
):
r"""
Calculates the thermal conductivity of a pure liquid using the correlation
in [1]
Parameters
----------
%(phase)s
%(T)s
... |
Calculates the thermal conductivity of a pure liquid using the correlation
in [1]
Parameters
----------
%(phase)s
%(T)s
%(Tc)s
%(MW)s
%(Tb)s
Returns
-------
value : ndarray
A numpy ndarray containing thermal conductivity values in [W/m.K]
References
--... | liquid_pure_sr | python | PMEAL/OpenPNM | openpnm/models/phase/thermal_conductivity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/thermal_conductivity/_funcs.py | MIT |
def liquid_mixture_DIPPR9I(
phase,
rhos='pore.density.*',
ks='pore.thermal_conductivity.*',
MWs='param.molecular_weight.*',
):
r"""
Calculates the thermal conductivity of a liquid mixture using the
correlation in [1]
Parameters
----------
%(phase)s
%(rhos)s
%(ks)s
%(... |
Calculates the thermal conductivity of a liquid mixture using the
correlation in [1]
Parameters
----------
%(phase)s
%(rhos)s
%(ks)s
%(MWs)s
Returns
-------
References
----------
[1] DIPPR9I
| liquid_mixture_DIPPR9I | python | PMEAL/OpenPNM | openpnm/models/phase/thermal_conductivity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/thermal_conductivity/_funcs.py | MIT |
def liquid_mixture_DIPPR9H(
phase,
ks='pore.thermal_conductivity.*',
MWs='param.molecular_weight.*',
):
r"""
Calculates the thermal conductivity of a liquid mixture using the
correlation in [1]
Parameters
----------
%(phase)s
%(ks)s
%(MWs)s
Returns
-------
Refe... |
Calculates the thermal conductivity of a liquid mixture using the
correlation in [1]
Parameters
----------
%(phase)s
%(ks)s
%(MWs)s
Returns
-------
References
----------
[1] DIPPR9H
| liquid_mixture_DIPPR9H | python | PMEAL/OpenPNM | openpnm/models/phase/thermal_conductivity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/thermal_conductivity/_funcs.py | MIT |
def gas_mixture_whz(
phase,
T='pore.temperature',
ks='pore.thermal_conductivity.*',
MWs='param.molecular_weight.*',
):
r"""
Calculates the viscosity of a gas mixture using the correlation in [1]
Parameters
----------
%(phase)s
%(T)s
%(ks)s
%(MWs)s
Returns
------... |
Calculates the viscosity of a gas mixture using the correlation in [1]
Parameters
----------
%(phase)s
%(T)s
%(ks)s
%(MWs)s
Returns
-------
References
----------
[1] Wassiljew, Herning & Zipperer
| gas_mixture_whz | python | PMEAL/OpenPNM | openpnm/models/phase/thermal_conductivity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/thermal_conductivity/_funcs.py | MIT |
def water_correlation(phase, T='pore.temperature', salinity='pore.salinity'):
r"""
Calculates vapor pressure of pure water or seawater given by [1] based on
Raoult's law. The pure water vapor pressure is given by [2]
Parameters
----------
%(phase)s
%(T)s
%(salinity)s
Returns
--... |
Calculates vapor pressure of pure water or seawater given by [1] based on
Raoult's law. The pure water vapor pressure is given by [2]
Parameters
----------
%(phase)s
%(T)s
%(salinity)s
Returns
-------
Notes
-----
T must be in K, and S in g of salt per kg of phase, o... | water_correlation | python | PMEAL/OpenPNM | openpnm/models/phase/vapor_pressure/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/vapor_pressure/_funcs.py | MIT |
def liquid_pure_lk(
phase,
T='pore.temperature',
Tc='param.critical_temperature',
Pc='param.critical_pressure',
omega='param.acentric_factor',
):
r"""
Calculate the vapor pressure of a pure liquid using the correlation in [1]
Parameters
----------
%(phase)s
%(T)s
%(Tc)s
... |
Calculate the vapor pressure of a pure liquid using the correlation in [1]
Parameters
----------
%(phase)s
%(T)s
%(Tc)s
%(Pc)s
%(omega)s
Returns
-------
References
----------
[1] Lee and Kesler
| liquid_pure_lk | python | PMEAL/OpenPNM | openpnm/models/phase/vapor_pressure/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/vapor_pressure/_funcs.py | MIT |
def liquid_pure_antoine(
phase,
T='pore.temperature',
):
r"""
Calculates the vapor pressure of a pure liquid using Antoine's equation
Parameters
----------
%(phase)s
%(T)s
%(Tc)s
Returns
-------
References
----------
[1] RPP
Notes
-----
Coefficient... |
Calculates the vapor pressure of a pure liquid using Antoine's equation
Parameters
----------
%(phase)s
%(T)s
%(Tc)s
Returns
-------
References
----------
[1] RPP
Notes
-----
Coefficients are looked up from the ``chemicals`` package. If values for
"extend... | liquid_pure_antoine | python | PMEAL/OpenPNM | openpnm/models/phase/vapor_pressure/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/vapor_pressure/_funcs.py | MIT |
def water_correlation(
phase,
T='pore.temperature',
salinity='pore.salinity'
):
r"""
Calculates viscosity of pure water or seawater at atmospheric pressure.
This correlation uses Eq. (22) given by Sharqawy et. al [1]. Values at
temperature higher than the normal boiling temperature are calc... |
Calculates viscosity of pure water or seawater at atmospheric pressure.
This correlation uses Eq. (22) given by Sharqawy et. al [1]. Values at
temperature higher than the normal boiling temperature are calculated
at the saturation pressure.
Parameters
----------
%(phase)s
%(T)s
%(... | water_correlation | python | PMEAL/OpenPNM | openpnm/models/phase/viscosity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/viscosity/_funcs.py | MIT |
def air_correlation(
phase,
T='pore.temperature',
n_V='pore.molar_density',
):
r"""
Calculates the viscosity of air at given conditions
This model uses the correlation from [1].
Parameters
----------
%(phase)s
%(T)s
%(n_V)s
Returns
-------
References
-----... |
Calculates the viscosity of air at given conditions
This model uses the correlation from [1].
Parameters
----------
%(phase)s
%(T)s
%(n_V)s
Returns
-------
References
----------
[1] I forget
| air_correlation | python | PMEAL/OpenPNM | openpnm/models/phase/viscosity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/viscosity/_funcs.py | MIT |
def gas_pure_st(
phase,
T='pore.temperature',
Tc='param.critical_temperature',
Pc='param.critical_pressure',
MW='param.molecular_weight',
):
r"""
Calculates the viscosity of a pure gas using the correlation in [1]
Parameters
----------
%(phase)s
%(T)s
%(Tc)s
%(Pc)s
... |
Calculates the viscosity of a pure gas using the correlation in [1]
Parameters
----------
%(phase)s
%(T)s
%(Tc)s
%(Pc)s
%(MW)s
Returns
-------
References
----------
[1] Stiel and Thodos
| gas_pure_st | python | PMEAL/OpenPNM | openpnm/models/phase/viscosity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/viscosity/_funcs.py | MIT |
def gas_pure_gesmr(
phase,
T='pore.temperature',
Tc='param.critical_temperature',
Pc='param.critical_pressure',
MW='param.molecular_weight',
):
r"""
Calculates the viscosity of a pure gas using the correlation [1]
Parameters
----------
%(phase)s
%(T)s
%(Tc)s
%(Pc)s
... |
Calculates the viscosity of a pure gas using the correlation [1]
Parameters
----------
%(phase)s
%(T)s
%(Tc)s
%(Pc)s
%(MW)s
Returns
-------
References
----------
[1] Gharagheizi et al
| gas_pure_gesmr | python | PMEAL/OpenPNM | openpnm/models/phase/viscosity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/viscosity/_funcs.py | MIT |
def gas_mixture_hz(
phase,
mus='pore.viscosity.*',
MWs='param.molecular_weight.*',
):
r"""
Computes the viscosity of a gas mixture using the correlation in [1]
Parameters
----------
%(phase)s
%(mus)s
%(MWs)s
Returns
-------
mu : ndarray
An ndarray of Np leng... |
Computes the viscosity of a gas mixture using the correlation in [1]
Parameters
----------
%(phase)s
%(mus)s
%(MWs)s
Returns
-------
mu : ndarray
An ndarray of Np length containing the viscosity of the mixture in
each pore
References
----------
[1] Her... | gas_mixture_hz | python | PMEAL/OpenPNM | openpnm/models/phase/viscosity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/viscosity/_funcs.py | MIT |
def liquid_pure_ls(
phase,
T='pore.temperature',
MW='param.molecular_weight',
Tc='param.critical_temperature',
Pc='param.critical_pressure',
omega='param.acentric_factor',
):
r"""
Computes the viscosity of a pure liquid using the correlation in [1]
Parameters
----------
%(ph... |
Computes the viscosity of a pure liquid using the correlation in [1]
Parameters
----------
%(phase)s
%(T)s
%(MW)s
%(Tc)s
%(Pc)s
%(omega)s
Returns
-------
mu : ndarray
An ndarray of Np length containing the viscosity of the mixture in
each pore
Refe... | liquid_pure_ls | python | PMEAL/OpenPNM | openpnm/models/phase/viscosity/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/phase/viscosity/_funcs.py | MIT |
def _poisson_conductance(phase,
pore_conductivity=None,
throat_conductivity=None,
size_factors=None):
r"""
Calculates the conductance of the conduits in the network, where a
conduit is (1/2 pore - full throat - 1/2 pore). See the not... |
Calculates the conductance of the conduits in the network, where a
conduit is (1/2 pore - full throat - 1/2 pore). See the notes section.
Parameters
----------
phase : OpenPNM Phase
The object which this model is associated with. This controls the
length of the calculated array, an... | _poisson_conductance | python | PMEAL/OpenPNM | openpnm/models/physics/_utils.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/_utils.py | MIT |
def _get_key_props(phase=None,
diameter="throat.diameter",
surface_tension="throat.surface_tension",
contact_angle="throat.contact_angle"):
"""
Returns desired properties in the correct format! See Notes.
Notes
-----
Many of the methods are g... |
Returns desired properties in the correct format! See Notes.
Notes
-----
Many of the methods are generic to pores and throats. Some information may
be stored on either the pore or throat and needs to be interpolated.
This is a helper method to return the properties in the correct format.
... | _get_key_props | python | PMEAL/OpenPNM | openpnm/models/physics/_utils.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/_utils.py | MIT |
def ad_dif(
phase,
pore_pressure='pore.pressure',
throat_hydraulic_conductance='throat.hydraulic_conductance',
throat_diffusive_conductance='throat.diffusive_conductance',
s_scheme='powerlaw'
):
r"""
Calculates the advective-diffusive conductance of conduits in network.
Parameters
-... |
Calculates the advective-diffusive conductance of conduits in network.
Parameters
----------
%(phase)s
pore_pressure : str
%(dict_blurb)s pore pressure
throat_hydraulic_conductance : str
%(dict_blurb)s hydraulic conductance
throat_diffusive_conductance : str
%(dict_... | ad_dif | python | PMEAL/OpenPNM | openpnm/models/physics/ad_dif_conductance/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/ad_dif_conductance/_funcs.py | MIT |
def washburn(phase,
surface_tension="throat.surface_tension",
contact_angle="throat.contact_angle",
diameter="throat.diameter"):
r"""
Computes the capillary entry pressure assuming the throat in a
cylindrical tube.
Parameters
----------
%(phase)s
surfa... |
Computes the capillary entry pressure assuming the throat in a
cylindrical tube.
Parameters
----------
%(phase)s
surface_tension : str
%(dict_blurb)s surface tension. If a pore property is given, it is
interpolated to a throat list.
contact_angle : str
%(dict_blurb)... | washburn | python | PMEAL/OpenPNM | openpnm/models/physics/capillary_pressure/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/capillary_pressure/_funcs.py | MIT |
def purcell(phase,
r_toroid,
surface_tension="throat.surface_tension",
contact_angle="throat.contact_angle",
diameter="throat.diameter"):
r"""
Computes the throat capillary entry pressure assuming the throat is a
toroid.
Parameters
----------
%(ph... |
Computes the throat capillary entry pressure assuming the throat is a
toroid.
Parameters
----------
%(phase)s
r_toroid : float or array_like
The radius of the toroid surrounding the pore
surface_tension : str
%(dict_blurb)s surface tension.
contact_angle : str
%... | purcell | python | PMEAL/OpenPNM | openpnm/models/physics/capillary_pressure/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/capillary_pressure/_funcs.py | MIT |
def generic_diffusive(phase,
pore_diffusivity="pore.diffusivity",
throat_diffusivity="throat.diffusivity",
size_factors="throat.diffusive_size_factors"):
r"""
Calculates the diffusive conductance of conduits in network.
Parameters
------... |
Calculates the diffusive conductance of conduits in network.
Parameters
----------
%(phase)s
pore_diffusivity : str
%(dict_blurb)s pore diffusivity
throat_diffusivity : str
%(dict_blurb)s throat diffusivity
size_factors : str
%(dict_blurb)s conduit diffusive size fa... | generic_diffusive | python | PMEAL/OpenPNM | openpnm/models/physics/diffusive_conductance/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/diffusive_conductance/_funcs.py | MIT |
def ordinary_diffusion(phase,
pore_diffusivity="pore.diffusivity",
throat_diffusivity="throat.diffusivity",
size_factors="throat.diffusive_size_factors"):
r"""
Calculates the diffusive conductance of conduits in network.
Parameters
--... |
Calculates the diffusive conductance of conduits in network.
Parameters
----------
%(phase)s
pore_diffusivity : str
%(dict_blurb)s pore diffusivity
throat_diffusivity : str
%(dict_blurb)s throat diffusivity
size_factors: str
%(dict_blurb)s conduit diffusive size fac... | ordinary_diffusion | python | PMEAL/OpenPNM | openpnm/models/physics/diffusive_conductance/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/diffusive_conductance/_funcs.py | MIT |
def mixed_diffusion(phase,
pore_diameter="pore.diameter",
throat_diameter="throat.diameter",
pore_diffusivity="pore.diffusivity",
throat_diffusivity="throat.diffusivity",
pore_temperature="pore.temperature",
... |
Calculates the diffusive conductance of conduits in network with
Knudsen correction.
Parameters
----------
%(phase)s
pore_diameter : str
%(dict_blurb)s pore diameter
throat_diameter : str
%(dict_blurb)s throat diameter
pore_diffusivity : str
%(dict_blurb)s pore ... | mixed_diffusion | python | PMEAL/OpenPNM | openpnm/models/physics/diffusive_conductance/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/diffusive_conductance/_funcs.py | MIT |
def taylor_aris_diffusion(phase,
pore_area="pore.area",
throat_area="throat.cross_sectional_area",
pore_diffusivity="pore.diffusivity",
throat_diffusivity="throat.diffusivity",
pore_pressure... |
Calculates the diffusive conductance of conduits in network
considering the Taylor-Aris effect (effect of flow on diffusion).
Parameters
----------
%(phase)s
pore_area : str
%(dict_blurb)s pore cross-sectional area
throat_area : str
%(dict_blurb)s throat cross-sectional are... | taylor_aris_diffusion | python | PMEAL/OpenPNM | openpnm/models/physics/diffusive_conductance/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/diffusive_conductance/_funcs.py | MIT |
def generic_electrical(
phase,
pore_conductivity='pore.electrical_conductivity',
throat_conductivity='throat.electrical_conductivity',
size_factors='throat.diffusive_size_factors'
):
r"""
Calculate the electrical conductance of conduits in network, where a
conduit is ( 1/2 pore - full throat... |
Calculate the electrical conductance of conduits in network, where a
conduit is ( 1/2 pore - full throat - 1/2 pore ). See the notes section.
Parameters
----------
%(phase)s
pore_conductivity : str
%(dict_blurb)s pore electrical conductivity
throat_conductivity : str
%(dict... | generic_electrical | python | PMEAL/OpenPNM | openpnm/models/physics/electrical_conductance/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/electrical_conductance/_funcs.py | MIT |
def generic_hydraulic(
phase,
pore_viscosity='pore.viscosity',
throat_viscosity='throat.viscosity',
size_factors='throat.hydraulic_size_factors'
):
r"""
Calculates the hydraulic conductance of conduits in network.
Parameters
----------
%(phase)s
pore_viscosity : str
%(di... |
Calculates the hydraulic conductance of conduits in network.
Parameters
----------
%(phase)s
pore_viscosity : str
%(dict_blurb)s pore viscosity
throat_viscosity : str
%(dict_blurb)s throat viscosity
size_factors : str
%(dict_blurb)s conduit hydraulic size factors
... | generic_hydraulic | python | PMEAL/OpenPNM | openpnm/models/physics/hydraulic_conductance/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/hydraulic_conductance/_funcs.py | MIT |
def general_toroidal(
phase,
profile_equation='elliptical',
mode='max',
target_Pc=None,
num_points=1000,
throat_scale_a='throat.scale_a',
throat_scale_b='throat.scale_b',
throat_diameter='throat.diameter',
touch_length='throat.touch_length',
surface_tension='throat.surface_tensio... |
The general model for meniscus properties inside a toroidal throat
Parameters
----------
%(phase)s
profile_equation : str
Options are 'elliptical' (default), 'sinusoidal'.
mode : str
Determines what information to send back. Options are:
======== ==================... | general_toroidal | python | PMEAL/OpenPNM | openpnm/models/physics/meniscus/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/meniscus/_funcs.py | MIT |
def sinusoidal(
phase,
mode='max',
target_Pc=None,
num_points=1e3,
r_toroid=5e-6,
throat_diameter='throat.diameter',
pore_diameter='pore.diameter',
touch_length='throat.touch_length',
surface_tension='throat.surface_tension',
contact_angle='throat.contact_angle'
):
r"""
W... |
Wrapper for the toroidal model to implement a sinusoidal profile.
The quarter-wavelength is equal to toroidal radius r_toroid.
The amplitude is equal to the toroidal radius multiplied by the ratio
of the throat radius and average connecting pore radius.
Notes
-----
The capillary pressure ... | sinusoidal | python | PMEAL/OpenPNM | openpnm/models/physics/meniscus/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/meniscus/_funcs.py | MIT |
def purcell(
phase,
mode='max',
target_Pc=None,
num_points=1e3,
r_toroid=5e-6,
throat_diameter='throat.diameter',
touch_length='throat.touch_length',
surface_tension='throat.surface_tension',
contact_angle='throat.contact_angle'
):
r"""
Wrapper for the general toroidal model ... |
Wrapper for the general toroidal model to implement the Purcell
equation for a torus with cylindrical profile and toroidal radius
r_toroid.
Notes
-----
This approach accounts for the converging-diverging nature of many
throat types. Advancing the meniscus beyond the apex of the toroid
... | purcell | python | PMEAL/OpenPNM | openpnm/models/physics/meniscus/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/meniscus/_funcs.py | MIT |
def late_filling(phase, pressure='pore.pressure',
Pc_star='pore.pc_star',
Swp_star=0.2, eta=3):
r"""
Calculates the fraction of a pore or throat filled with invading fluid
based on the capillary pressure in the invading phase. The invading phase
volume is calculated fro... |
Calculates the fraction of a pore or throat filled with invading fluid
based on the capillary pressure in the invading phase. The invading phase
volume is calculated from:
.. math::
S_{nwp} = 1 - S_{wp}^{*} (P^{*}/P_{c})^{\eta}
Parameters
----------
pressure : str
... | late_filling | python | PMEAL/OpenPNM | openpnm/models/physics/multiphase/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/multiphase/_funcs.py | MIT |
def standard_kinetics(phase, X, prefactor, exponent):
r"""
Calculates the rate, as well as slope and intercept of the following
function at the given value of ``X``:
.. math::
r = A X^b
Parameters
----------
%(phase)s
X : str
%(dict_blurb)s quantity of interest
... |
Calculates the rate, as well as slope and intercept of the following
function at the given value of ``X``:
.. math::
r = A X^b
Parameters
----------
%(phase)s
X : str
%(dict_blurb)s quantity of interest
prefactor : str
%(dict_blurb)s the prefactor to be... | standard_kinetics | python | PMEAL/OpenPNM | openpnm/models/physics/source_terms/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/source_terms/_funcs.py | MIT |
def linear(phase, X, A1=0.0, A2=0.0):
r"""
Calculates the rate, as well as slope and intercept of the following
function at the given value of ``X``:
.. math::
r = A_{1} X + A_{2}
Parameters
----------
%(phase)s
X : str
The dictionary key on the phase object con... |
Calculates the rate, as well as slope and intercept of the following
function at the given value of ``X``:
.. math::
r = A_{1} X + A_{2}
Parameters
----------
%(phase)s
X : str
The dictionary key on the phase object containing the the quantity
of interest
... | linear | python | PMEAL/OpenPNM | openpnm/models/physics/source_terms/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/source_terms/_funcs.py | MIT |
def power_law(phase, X, A1=0.0, A2=0.0, A3=0.0):
r"""
Calculates the rate, as well as slope and intercept of the following
function at the given value of *X*:
.. math::
r = A_{1} x^{A_{2}} + A_{3}
Parameters
----------
%(phase)s
X : str
The dictionary key on the... |
Calculates the rate, as well as slope and intercept of the following
function at the given value of *X*:
.. math::
r = A_{1} x^{A_{2}} + A_{3}
Parameters
----------
%(phase)s
X : str
The dictionary key on the phase object containing the the quantity
of inte... | power_law | python | PMEAL/OpenPNM | openpnm/models/physics/source_terms/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/source_terms/_funcs.py | MIT |
def exponential(phase, X, A1=0.0, A2=1.0, A3=1.0, A4=1.0, A5=0.0, A6=0.0):
r"""
Calculates the rate, as well as slope and intercept of the following
function at the given value of `X`:
.. math::
r = A_{1} A_{2}^{( A_{3} x^{ A_{4} } + A_{5})} + A_{6}
Parameters
----------
%... |
Calculates the rate, as well as slope and intercept of the following
function at the given value of `X`:
.. math::
r = A_{1} A_{2}^{( A_{3} x^{ A_{4} } + A_{5})} + A_{6}
Parameters
----------
%(phase)s
X : str
The dictionary key on the phase object containing the ... | exponential | python | PMEAL/OpenPNM | openpnm/models/physics/source_terms/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/source_terms/_funcs.py | MIT |
def natural_exponential(phase, X, A1=0.0, A2=0.0, A3=0.0, A4=0.0, A5=0.0):
r"""
Calculates the rate, as well as slope and intercept of the following
function at the given value of `X`:
.. math::
r = A_{1} exp( A_{2} x^{ A_{3} } + A_{4} )+ A_{5}
Parameters
----------
%(phas... |
Calculates the rate, as well as slope and intercept of the following
function at the given value of `X`:
.. math::
r = A_{1} exp( A_{2} x^{ A_{3} } + A_{4} )+ A_{5}
Parameters
----------
%(phase)s
X : str
The dictionary key on the phase object containing the the q... | natural_exponential | python | PMEAL/OpenPNM | openpnm/models/physics/source_terms/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/source_terms/_funcs.py | MIT |
def logarithm(phase, X, A1=0.0, A2=10.0, A3=1.0, A4=1.0, A5=0.0, A6=0.0):
r"""
Calculates the rate, as well as slope and intercept of the following
function at the given value of `X`:
.. math::
r = A_{1} Log_{ A_{2} }( A_{3} x^{ A_{4} }+ A_{5})+ A_{6}
Parameters
----------
... |
Calculates the rate, as well as slope and intercept of the following
function at the given value of `X`:
.. math::
r = A_{1} Log_{ A_{2} }( A_{3} x^{ A_{4} }+ A_{5})+ A_{6}
Parameters
----------
%(phase)s
X : str
The dictionary key on the phase object containing t... | logarithm | python | PMEAL/OpenPNM | openpnm/models/physics/source_terms/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/source_terms/_funcs.py | MIT |
def natural_logarithm(phase, X, A1=0.0, A2=1.0, A3=1.0, A4=0.0, A5=0.0):
r"""
Calculates the rate, as well as slope and intercept of the following
function at the given value of `X`:
.. math::
r = A_{1} Ln( A_{2} x^{ A_{3} }+ A_{4})+ A_{5}
Parameters
----------
%(phase)s
... |
Calculates the rate, as well as slope and intercept of the following
function at the given value of `X`:
.. math::
r = A_{1} Ln( A_{2} x^{ A_{3} }+ A_{4})+ A_{5}
Parameters
----------
%(phase)s
X : str
The dictionary key on the phase object containing the the qua... | natural_logarithm | python | PMEAL/OpenPNM | openpnm/models/physics/source_terms/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/source_terms/_funcs.py | MIT |
def _build_func(eq, **args):
r"""
Take a symbolic equation and return the lambdified version plus the
linearization of form S1 * x + S2
"""
from sympy import lambdify
eq_prime = eq.diff(args['x'])
s1 = eq_prime
s2 = eq - eq_prime*args['x']
EQ = lambdify(args.values(), expr=eq, module... |
Take a symbolic equation and return the lambdified version plus the
linearization of form S1 * x + S2
| _build_func | python | PMEAL/OpenPNM | openpnm/models/physics/source_terms/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/source_terms/_funcs.py | MIT |
def general_symbolic(phase, eqn, x, **kwargs):
r"""
A general function to interpret a sympy equation and evaluate the linear
components of the source term.
Parameters
----------
%(phase)s
eqn : str
The str representation of the equation to use. This will be
passed to sympy'... |
A general function to interpret a sympy equation and evaluate the linear
components of the source term.
Parameters
----------
%(phase)s
eqn : str
The str representation of the equation to use. This will be
passed to sympy's ``sympify`` function to make a *live* sympy object.
... | general_symbolic | python | PMEAL/OpenPNM | openpnm/models/physics/source_terms/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/source_terms/_funcs.py | MIT |
def butler_volmer_conc(
phase, X, n, i0_ref, c_ref, beta,
gamma=1,
temperature="pore.temperature",
reaction_area="pore.reaction_area",
solid_voltage="pore.solid_voltage",
electrolyte_voltage="pore.electrolyte_voltage",
open_circuit_voltage="pore.open_circuit_voltage",
):
r"""
Calcula... |
Calculates the rate, slope and intercept of the Butler-Volmer kinetic
model based on **concentration** to be used in mass transfer
algorithms.
Parameters
----------
%(phase)s
X : str
The dictionary key of the quantity of interest (i.e. main variable
to be solved; in this ca... | butler_volmer_conc | python | PMEAL/OpenPNM | openpnm/models/physics/source_terms/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/source_terms/_funcs.py | MIT |
def butler_volmer_voltage(
phase, X, n, i0_ref, c_ref, beta,
gamma=1,
temperature="pore.temperature",
reaction_area="pore.reaction_area",
solid_voltage="pore.solid_voltage",
open_circuit_voltage="pore.open_circuit_voltage",
electrolyte_concentration="pore.electrolyte_concentration",
):
r... |
Calculates the rate, slope and intercept of the Butler-Volmer kinetic model
based on **voltage** to be used in electron conduction algorithms.
Parameters
----------
%(phase)s
X : str
The dictionary key of the quantity of interest (i.e. main variable
to be solved; in this case, ... | butler_volmer_voltage | python | PMEAL/OpenPNM | openpnm/models/physics/source_terms/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/source_terms/_funcs.py | MIT |
def generic_thermal(phase,
pore_conductivity='pore.thermal_conductivity',
throat_conductivity='throat.thermal_conductivity',
size_factors='throat.diffusive_size_factors'):
r"""
Calculate the thermal conductance of conduits in network.
Parameters
... |
Calculate the thermal conductance of conduits in network.
Parameters
----------
%(phase)s
pore_conductivity : str
%(dict_blurb)s thermal conductivity
throat_conductivity : str
%(dict_blurb)s throat thermal conductivity
size_factors : str
%(dict_blurb)s conduit diffu... | generic_thermal | python | PMEAL/OpenPNM | openpnm/models/physics/thermal_conductance/_funcs.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/models/physics/thermal_conductance/_funcs.py | MIT |
def add_boundary_pores(self, labels, spacing):
r"""
Add boundary pores to the specified faces of the network
Pores are offset from the faces by 1/2 of the given ``spacing``,
such that they lie directly on the boundaries.
Parameters
----------
labels : str or lis... |
Add boundary pores to the specified faces of the network
Pores are offset from the faces by 1/2 of the given ``spacing``,
such that they lie directly on the boundaries.
Parameters
----------
labels : str or list[str]
The labels indicating the pores defining... | add_boundary_pores | python | PMEAL/OpenPNM | openpnm/network/_bcc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_bcc.py | MIT |
def add_boundary_pores(self, labels=["top", "bottom", "front",
"back", "left", "right"],
spacing=None):
r"""
Add pores to the faces of the network for use as boundary pores.
Pores are offset from the faces by 1/2 a lattice spac... |
Add pores to the faces of the network for use as boundary pores.
Pores are offset from the faces by 1/2 a lattice spacing such that
they lie directly on the boundaries.
Parameters
----------
labels : str or list[str]
The labels indicating the pores defining... | add_boundary_pores | python | PMEAL/OpenPNM | openpnm/network/_cubic.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_cubic.py | MIT |
def find_throat_facets(self, throats=None):
r"""
Finds the indicies of the Voronoi nodes that define the facet or
ridge between the Delaunay nodes connected by the given throat.
Parameters
----------
throats : array_like
The throats whose facets are sought. ... |
Finds the indicies of the Voronoi nodes that define the facet or
ridge between the Delaunay nodes connected by the given throat.
Parameters
----------
throats : array_like
The throats whose facets are sought. The given throats should be
from the 'delaun... | find_throat_facets | python | PMEAL/OpenPNM | openpnm/network/_delaunay_voronoi_dual.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_delaunay_voronoi_dual.py | MIT |
def find_pore_hulls(self, pores=None):
r"""
Finds the indices of the Voronoi nodes that define the convex hull
around the given Delaunay nodes.
Parameters
----------
pores : array_like
The pores whose convex hull are sought. The given pores should be
... |
Finds the indices of the Voronoi nodes that define the convex hull
around the given Delaunay nodes.
Parameters
----------
pores : array_like
The pores whose convex hull are sought. The given pores should be
from the 'delaunay' network. If no pores are ... | find_pore_hulls | python | PMEAL/OpenPNM | openpnm/network/_delaunay_voronoi_dual.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_delaunay_voronoi_dual.py | MIT |
def get_adjacency_matrix(self, fmt='coo'):
r"""
Adjacency matrix in the specified sparse format, with throat IDs
indicating the non-zero values.
Parameters
----------
fmt : str, default is 'coo'
The sparse storage format to return. Options are:
... |
Adjacency matrix in the specified sparse format, with throat IDs
indicating the non-zero values.
Parameters
----------
fmt : str, default is 'coo'
The sparse storage format to return. Options are:
**'coo'** : This is the native format of OpenPNM's da... | get_adjacency_matrix | python | PMEAL/OpenPNM | openpnm/network/_network.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_network.py | MIT |
def get_incidence_matrix(self, fmt='coo'):
r"""
Incidence matrix in the specified sparse format, with pore IDs
indicating the non-zero values.
Parameters
----------
fmt : str, default is 'coo'
The sparse storage format to return. Options are:
... |
Incidence matrix in the specified sparse format, with pore IDs
indicating the non-zero values.
Parameters
----------
fmt : str, default is 'coo'
The sparse storage format to return. Options are:
**'coo'** : This is the native format of OpenPNM's data... | get_incidence_matrix | python | PMEAL/OpenPNM | openpnm/network/_network.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_network.py | MIT |
def find_connected_pores(self, throats=[], flatten=False, mode='or'):
r"""
Return a list of pores connected to the given list of throats
Parameters
----------
throats : array_like
List of throats numbers
flatten : bool, optional
If ``True`` (defau... |
Return a list of pores connected to the given list of throats
Parameters
----------
throats : array_like
List of throats numbers
flatten : bool, optional
If ``True`` (default) a 1D array of unique pore numbers is
returned. If ``False`` each l... | find_connected_pores | python | PMEAL/OpenPNM | openpnm/network/_network.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_network.py | MIT |
def find_connecting_throat(self, P1, P2):
r"""
Return the throat index connecting pairs of pores.
Parameters
----------
P1 : array_like
The indices of the pores whose throats are sought. These can
be vectors of indices, but must be the same length
... |
Return the throat index connecting pairs of pores.
Parameters
----------
P1 : array_like
The indices of the pores whose throats are sought. These can
be vectors of indices, but must be the same length
P2 : array_like
The indices of the pores ... | find_connecting_throat | python | PMEAL/OpenPNM | openpnm/network/_network.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_network.py | MIT |
def find_neighbor_pores(self, pores, mode='or', flatten=True,
include_input=False, asmask=False):
r"""
Returns a list of pores that are direct neighbors to the given pore(s)
Parameters
----------
pores : array_like
Indices of the pores who... |
Returns a list of pores that are direct neighbors to the given pore(s)
Parameters
----------
pores : array_like
Indices of the pores whose neighbors are sought
flatten : bool
If ``True`` (default) the returned result is a compressed
array of ... | find_neighbor_pores | python | PMEAL/OpenPNM | openpnm/network/_network.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_network.py | MIT |
def find_neighbor_throats(self, pores, mode='or', flatten=True,
asmask=False):
r"""
Returns a list of throats neighboring the given pore(s)
Parameters
----------
pores : array_like
Indices of pores whose neighbors are sought
flat... |
Returns a list of throats neighboring the given pore(s)
Parameters
----------
pores : array_like
Indices of pores whose neighbors are sought
flatten : bool, optional
If ``True`` (default) a 1D array of unique throat indices is
returned. If ``... | find_neighbor_throats | python | PMEAL/OpenPNM | openpnm/network/_network.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_network.py | MIT |
def num_neighbors(self, pores, mode='or', flatten=False):
r"""
Returns the number of neigbhoring pores for each given input pore
Parameters
----------
pores : array_like
Pores whose neighbors are to be counted
flatten : bool, optional
If ``False``... |
Returns the number of neigbhoring pores for each given input pore
Parameters
----------
pores : array_like
Pores whose neighbors are to be counted
flatten : bool, optional
If ``False`` (default) the number of pores neighboring each
input pore... | num_neighbors | python | PMEAL/OpenPNM | openpnm/network/_network.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_network.py | MIT |
def find_nearby_pores(self, pores, r, flatten=False, include_input=False):
r"""
Find all pores within a given radial distance of the input pore(s)
regardless of whether or not they are toplogically connected.
Parameters
----------
pores : array_like
The list ... |
Find all pores within a given radial distance of the input pore(s)
regardless of whether or not they are toplogically connected.
Parameters
----------
pores : array_like
The list of pores for whom nearby neighbors are to be found
r : scalar
The m... | find_nearby_pores | python | PMEAL/OpenPNM | openpnm/network/_network.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/network/_network.py | MIT |
def get_comp_vals(self, propname):
r"""
Get a dictionary of the requested values from each component in the
mixture
Parameters
----------
propname : str
The property to fetch, such as ``'pore.viscosity'``.
Returns
-------
vals : dict
... |
Get a dictionary of the requested values from each component in the
mixture
Parameters
----------
propname : str
The property to fetch, such as ``'pore.viscosity'``.
Returns
-------
vals : dict
A dictionary with each component na... | get_comp_vals | python | PMEAL/OpenPNM | openpnm/phase/_mixture.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/phase/_mixture.py | MIT |
def get_mix_vals(self, propname, mode='linear', power=1):
r"""
Get the mole fraction weighted value of a given property for the mixture
Parameters
----------
propname : str
The property to fetch, such as ``'pore.viscosity'``.
mode : str
The type o... |
Get the mole fraction weighted value of a given property for the mixture
Parameters
----------
propname : str
The property to fetch, such as ``'pore.viscosity'``.
mode : str
The type of weighting to use. Options are:
============== =========... | get_mix_vals | python | PMEAL/OpenPNM | openpnm/phase/_mixture.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/phase/_mixture.py | MIT |
def remove_comp(self, component):
r"""
Helper method to remove a component from the mixture
Parameters
----------
component : Species object or str name
The `Species` to remove from the mixture. Can either be a handle to
the object, or the object's `name`... |
Helper method to remove a component from the mixture
Parameters
----------
component : Species object or str name
The `Species` to remove from the mixture. Can either be a handle to
the object, or the object's `name`.
Notes
-----
This me... | remove_comp | python | PMEAL/OpenPNM | openpnm/phase/_mixture.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/phase/_mixture.py | MIT |
def check_mixture_health(self):
r"""
Checks the state of health of the mixture
Calculates the mole fraction of all species in each pore and returns
an list of where values are too low or too high,
Returns
-------
health : dict
A HealthDict object con... |
Checks the state of health of the mixture
Calculates the mole fraction of all species in each pore and returns
an list of where values are too low or too high,
Returns
-------
health : dict
A HealthDict object containing lists of locations where the mole
... | check_mixture_health | python | PMEAL/OpenPNM | openpnm/phase/_mixture.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/phase/_mixture.py | MIT |
def x(self, compname=None, x=None):
r"""
Helper method for getting and setting mole fractions of a component
Parameters
----------
compname : str, optional
The name of the component, i.e. ``obj.name``. If ``x`` is not
provided this will *return* the mole... |
Helper method for getting and setting mole fractions of a component
Parameters
----------
compname : str, optional
The name of the component, i.e. ``obj.name``. If ``x`` is not
provided this will *return* the mole fraction of the requested
component... | x | python | PMEAL/OpenPNM | openpnm/phase/_mixture.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/phase/_mixture.py | MIT |
def y(self, compname=None, y=None):
r"""
Helper method for getting and setting mole fractions of a component
Parameters
----------
compname : str, optional
The name of the component i.e. ``obj.name``. If ``y`` is not
provided this will *return* the mole ... |
Helper method for getting and setting mole fractions of a component
Parameters
----------
compname : str, optional
The name of the component i.e. ``obj.name``. If ``y`` is not
provided this will *return* the mole fraction of the requested
component.... | y | python | PMEAL/OpenPNM | openpnm/phase/_mixture.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/phase/_mixture.py | MIT |
def _get_rtol(self, A, b, x0):
r"""
Returns the relative tolerance ``rtol`` that corresponds to the
the given tolerance ``tol``.
Notes
-----
``rtol`` is defined based on the following formula:
``rtol = residual(@x_final) / residual(@x0)``
"""
... |
Returns the relative tolerance ``rtol`` that corresponds to the
the given tolerance ``tol``.
Notes
-----
``rtol`` is defined based on the following formula:
``rtol = residual(@x_final) / residual(@x0)``
| _get_rtol | python | PMEAL/OpenPNM | openpnm/solvers/_base.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/solvers/_base.py | MIT |
def solve(self, A, b, **kwargs):
"""Solves the given linear system of equations Ax=b."""
from pypardiso import spsolve
if not isinstance(A, (csr_matrix, csc_matrix)):
A = A.tocsr()
return (spsolve(A, b), 0) | Solves the given linear system of equations Ax=b. | solve | python | PMEAL/OpenPNM | openpnm/solvers/_pardiso.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/solvers/_pardiso.py | MIT |
def _create_solver(self):
r"""
This method creates the petsc sparse linear solver.
"""
# https://petsc.org/release/docs/manualpages/KSP/KSPType.html
iterative = [
'richardson', 'chebyshev', 'cg', 'groppcg', 'pipecg', 'pipecgrr',
'cgne', 'nash', 'stcg', 'gl... |
This method creates the petsc sparse linear solver.
| _create_solver | python | PMEAL/OpenPNM | openpnm/solvers/_petsc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/solvers/_petsc.py | MIT |
def _set_tolerances(self, atol=None, rtol=None, maxiter=None):
r"""
Set absolute and relative tolerances, and maximum number of iterations.
"""
atol = self.atol if atol is None else atol
rtol = self.rtol if rtol is None else rtol
maxiter = self.maxiter if maxiter is None ... |
Set absolute and relative tolerances, and maximum number of iterations.
| _set_tolerances | python | PMEAL/OpenPNM | openpnm/solvers/_petsc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/solvers/_petsc.py | MIT |
def _assemble_A(self):
r"""
This method creates the petsc sparse coefficients matrix from the
OpenPNM scipy one. The method also equally decomposes the matrix at
certain rows into different blocks (each block contains all the
columns) and distributes them over the pre-assigned co... |
This method creates the petsc sparse coefficients matrix from the
OpenPNM scipy one. The method also equally decomposes the matrix at
certain rows into different blocks (each block contains all the
columns) and distributes them over the pre-assigned cores for parallel
computing.... | _assemble_A | python | PMEAL/OpenPNM | openpnm/solvers/_petsc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/solvers/_petsc.py | MIT |
def _assemble_b_and_x(self):
r"""
Initialize the solution vector (self.petsc_x), which is a dense
matrix (1D vector) and defines the rhs vector (self.petsc_b) from
the existing data.
"""
# Get vector(s) compatible with the matrix (same parallel layout)
# passing s... |
Initialize the solution vector (self.petsc_x), which is a dense
matrix (1D vector) and defines the rhs vector (self.petsc_b) from
the existing data.
| _assemble_b_and_x | python | PMEAL/OpenPNM | openpnm/solvers/_petsc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/solvers/_petsc.py | MIT |
def solve(self, A, b, x0=None, solver_type='cg', precondioner='jacobi',
maxiter=None, atol=None, rtol=None):
r"""
Solves and returns the solution to the linear system, Ax = b.
This method converts the solution vector from a PETSc.Vec
instance to a numpy array, and finally ... |
Solves and returns the solution to the linear system, Ax = b.
This method converts the solution vector from a PETSc.Vec
instance to a numpy array, and finally destroys all the PETSc
objects to free memory.
Parameters
----------
A : csr_matrix
Coeffi... | solve | python | PMEAL/OpenPNM | openpnm/solvers/_petsc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/solvers/_petsc.py | MIT |
def find_isolated_clusters(network, mask, inlets):
r"""
Identifies pores and throats that are invaded but not connected to the inlets
Parameters
----------
network : dict
The OpenPNM Network
mask : ndarray
A boolean mask of either Nt or Np length with ``True`` values
ind... |
Identifies pores and throats that are invaded but not connected to the inlets
Parameters
----------
network : dict
The OpenPNM Network
mask : ndarray
A boolean mask of either Nt or Np length with ``True`` values
indicating invaded bonds or sites. If this array is Nt-long th... | find_isolated_clusters | python | PMEAL/OpenPNM | openpnm/topotools/_perctools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_perctools.py | MIT |
def find_clusters(network, mask=[]):
r"""
Identify connected clusters of pores and throats in the network.
Either site and bond percolation can be considered, see description of
``mask`` argument for details.
Parameters
----------
network : Network
The network
mask : array_like... |
Identify connected clusters of pores and throats in the network.
Either site and bond percolation can be considered, see description of
``mask`` argument for details.
Parameters
----------
network : Network
The network
mask : array_like, boolean
A list of open bonds or sit... | find_clusters | python | PMEAL/OpenPNM | openpnm/topotools/_perctools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_perctools.py | MIT |
def trim(network, pores=[], throats=[]):
"""
Remove pores or throats from the network
Parameters
----------
network : Network
The Network from which pores or throats should be removed
pores (or throats) : array_like
The indices of the of the pores or throats to be removed from t... |
Remove pores or throats from the network
Parameters
----------
network : Network
The Network from which pores or throats should be removed
pores (or throats) : array_like
The indices of the of the pores or throats to be removed from the
network.
| trim | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def extend(network, coords=[], conns=[], labels=[], **kwargs):
r"""
Add pores or throats to the network from a list of coords or conns.
Parameters
----------
network : Network
The network to which pores or throats should be added
coords : array_like
The coordinates of the pores ... |
Add pores or throats to the network from a list of coords or conns.
Parameters
----------
network : Network
The network to which pores or throats should be added
coords : array_like
The coordinates of the pores to add. These will be appended to the
'pore.coords' array so s... | extend | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def label_faces(network, tol=0.0, label='surface'):
r"""
Finds pores on the surface of the network and labels them according to
whether they are on the *top*, *bottom*, etc.
This function assumes the network is cubic in shape
Parameters
----------
network : Network
The network to a... |
Finds pores on the surface of the network and labels them according to
whether they are on the *top*, *bottom*, etc.
This function assumes the network is cubic in shape
Parameters
----------
network : Network
The network to apply the labels
tol : scalar
The tolerance for d... | label_faces | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def find_surface_pores(network, markers=None, label='surface'):
r"""
Find the pores on the surface of the domain by performing a Delaunay
triangulation between the network pores and some external ``markers``. All
pores connected to these external marker points are considered surface
pores.
Para... |
Find the pores on the surface of the domain by performing a Delaunay
triangulation between the network pores and some external ``markers``. All
pores connected to these external marker points are considered surface
pores.
Parameters
----------
network: Network
The network for which... | find_surface_pores | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def clone_pores(network, pores, labels=['clone'], mode='parents'):
r"""
Clones the specified pores and adds them to the network
Parameters
----------
network : Network
The Network object to which the new pores are to be added
pores : array_like
List of pores to clone
labels ... |
Clones the specified pores and adds them to the network
Parameters
----------
network : Network
The Network object to which the new pores are to be added
pores : array_like
List of pores to clone
labels : str, or list[str]
The labels to apply to the clones, default is '... | clone_pores | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def merge_networks(network, donor=[]):
r"""
Combine multiple networks into one without making any topological
connections
Parameters
----------
network : Network
The network to which all the other networks should be added.
donor : Network or list of Objects
The network objec... |
Combine multiple networks into one without making any topological
connections
Parameters
----------
network : Network
The network to which all the other networks should be added.
donor : Network or list of Objects
The network object(s) to add to the given network
See Also
... | merge_networks | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def stitch_pores(network, pores1, pores2, mode='gabriel'):
r"""
Stitches together pores in a network with disconnected clusters
Parameters
----------
network : OpenPNM Network
The network to operate upon
pores1 and pores2: array_like
The pore indices of the disconnected clusters... |
Stitches together pores in a network with disconnected clusters
Parameters
----------
network : OpenPNM Network
The network to operate upon
pores1 and pores2: array_like
The pore indices of the disconnected clusters to be joined
mode : str
Dictates which tesselation met... | stitch_pores | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def connect_pores(network, pores1, pores2, labels=['new_conns']):
r"""
Returns the possible connections between two groups of pores
Parameters
----------
network : Network
The network to which the pores should be added
pores1 : array_like
The first group of pores on the network
... |
Returns the possible connections between two groups of pores
Parameters
----------
network : Network
The network to which the pores should be added
pores1 : array_like
The first group of pores on the network
pores2 : array_like
The second group of pores on the network
... | connect_pores | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def merge_pores(network, pores, labels=['merged'], include_neighbors=True):
r"""
Combines a selection of pores into a new single pore located at the
centroid of the selected pores (and optionally their neighbors)
and connected to all of their neighbors.
Parameters
----------
network : Netwo... |
Combines a selection of pores into a new single pore located at the
centroid of the selected pores (and optionally their neighbors)
and connected to all of their neighbors.
Parameters
----------
network : Network
pores : array_like
The list of pores which are to be combined into a ... | merge_pores | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def hull_centroid(points):
r"""
Computes centroid of the convex hull enclosing the given coordinates.
Parameters
----------
points : Np by 3 ndarray
Coordinates (xyz)
Returns
-------
centroid : array
A 3 by 1 Numpy array containing coordinates of the centroid.
"""
... |
Computes centroid of the convex hull enclosing the given coordinates.
Parameters
----------
points : Np by 3 ndarray
Coordinates (xyz)
Returns
-------
centroid : array
A 3 by 1 Numpy array containing coordinates of the centroid.
| hull_centroid | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def add_boundary_pores(network, pores, offset=None, move_to=None,
apply_label='boundary'):
r"""
This method uses ``clone_pores`` to clone the input pores, then shifts
them the specified amount and direction, then applies the given label.
Parameters
----------
pores : arra... |
This method uses ``clone_pores`` to clone the input pores, then shifts
them the specified amount and direction, then applies the given label.
Parameters
----------
pores : array_like
List of pores to offset. If no pores are specified, then it
assumes that all surface pores are to ... | add_boundary_pores | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def iscoplanar(coords):
r"""
Determines if given pores are coplanar with each other
Parameters
----------
coords : array_like
List of pore coords to check for coplanarity. At least 3 pores are
required.
Returns
-------
results : bool
A boolean value of whether ... |
Determines if given pores are coplanar with each other
Parameters
----------
coords : array_like
List of pore coords to check for coplanarity. At least 3 pores are
required.
Returns
-------
results : bool
A boolean value of whether given points are coplanar (``Tru... | iscoplanar | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def is_fully_connected(network, pores_BC=None):
r"""
Checks whether network is fully connected, i.e. not clustered.
Parameters
----------
network : Network
The network whose connectivity to check.
pores_BC : array_like (optional)
The pore indices of boundary conditions (inlets/o... |
Checks whether network is fully connected, i.e. not clustered.
Parameters
----------
network : Network
The network whose connectivity to check.
pores_BC : array_like (optional)
The pore indices of boundary conditions (inlets/outlets).
Returns
-------
bool
If ``... | is_fully_connected | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def get_domain_area(network, inlets=None, outlets=None):
r"""
Determine the cross sectional area relative to the inlets/outlets.
Parameters
----------
network : Network
The network object containing the pore coordinates
inlets : array_like
The pore indices of the inlets.
out... |
Determine the cross sectional area relative to the inlets/outlets.
Parameters
----------
network : Network
The network object containing the pore coordinates
inlets : array_like
The pore indices of the inlets.
outlets : array_Like
The pore indices of the outlets.
R... | get_domain_area | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def get_domain_length(network, inlets=None, outlets=None):
r"""
Determine the domain length relative to the inlets/outlets.
Parameters
----------
network : Network
The network object containing the pore coordinates
inlets : array_like
The pore indices of the inlets.
outlets ... |
Determine the domain length relative to the inlets/outlets.
Parameters
----------
network : Network
The network object containing the pore coordinates
inlets : array_like
The pore indices of the inlets.
outlets : array_Like
The pore indices of the outlets.
Returns
... | get_domain_length | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def reduce_coordination(network, z):
r"""
Deletes throats on network to match specified average coordination number
Parameters
----------
target : Network
The network whose throats are to be trimmed
z : scalar
The desired average coordination number. It is not possible to speci... |
Deletes throats on network to match specified average coordination number
Parameters
----------
target : Network
The network whose throats are to be trimmed
z : scalar
The desired average coordination number. It is not possible to specify
the distribution of the coordinati... | reduce_coordination | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def add_reservoir_pore(cls, network, pores, offset=0.1):
r"""
Adds a single pore connected to all ``pores`` to act as a reservoir
This function is mostly needed to make network compatible with the
Statoil file format, which requires reservoir pores on the inlet and
outlet faces.
Parameters
... |
Adds a single pore connected to all ``pores`` to act as a reservoir
This function is mostly needed to make network compatible with the
Statoil file format, which requires reservoir pores on the inlet and
outlet faces.
Parameters
----------
network : Network
The network to which th... | add_reservoir_pore | python | PMEAL/OpenPNM | openpnm/topotools/_topotools.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/topotools/_topotools.py | MIT |
def check_data_health(obj):
r"""
Checks the health of pore and throat data arrays.
Parameters
----------
obj : Base
A handle of the object to be checked
Returns
-------
health : dict
Returns a HealthDict object which is a basic dictionary with an
added ``health`... |
Checks the health of pore and throat data arrays.
Parameters
----------
obj : Base
A handle of the object to be checked
Returns
-------
health : dict
Returns a HealthDict object which is a basic dictionary with an
added ``health`` attribute that is ``True`` is all ... | check_data_health | python | PMEAL/OpenPNM | openpnm/utils/_health.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/utils/_health.py | MIT |
def check_network_health(network):
r"""
This method checks the topological health of the network
The following aspects are checked for:
(1) Isolated pores
(2) Disconnected clusters of pores
(3) Duplicate throats
(4) Headless throats
(5) Bidirectional throats
Re... |
This method checks the topological health of the network
The following aspects are checked for:
(1) Isolated pores
(2) Disconnected clusters of pores
(3) Duplicate throats
(4) Headless throats
(5) Bidirectional throats
Returns
-------
health : dict
... | check_network_health | python | PMEAL/OpenPNM | openpnm/utils/_health.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/utils/_health.py | MIT |
def flat_list(input_list):
r"""
Given a list of nested lists of arbitrary depth, returns a single
level or 'flat' list.
"""
def _flatten(l):
for el in l:
if isinstance(el, Iterable) and not isinstance(el, (str, bytes)):
yield from _flatten(el)
else:
... |
Given a list of nested lists of arbitrary depth, returns a single
level or 'flat' list.
| flat_list | python | PMEAL/OpenPNM | openpnm/utils/_misc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/utils/_misc.py | MIT |
def sanitize_dict(input_dict):
r"""
Given a nested dictionary, ensures that all nested dicts are normal
Python dicts. This is necessary for pickling, or just converting
an 'auto-vivifying' dict to something that acts normal.
"""
plain_dict = dict()
for key in input_dict.keys():
valu... |
Given a nested dictionary, ensures that all nested dicts are normal
Python dicts. This is necessary for pickling, or just converting
an 'auto-vivifying' dict to something that acts normal.
| sanitize_dict | python | PMEAL/OpenPNM | openpnm/utils/_misc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/utils/_misc.py | MIT |
def methods_to_table(obj):
r"""
Converts a methods on an object to a ReST compatible table
Parameters
----------
obj : Base
Any object that has a methods
params : bool
Indicates whether or not to include a list of parameter
values in the table. Set to False for just a li... |
Converts a methods on an object to a ReST compatible table
Parameters
----------
obj : Base
Any object that has a methods
params : bool
Indicates whether or not to include a list of parameter
values in the table. Set to False for just a list of models, and
True for ... | methods_to_table | python | PMEAL/OpenPNM | openpnm/utils/_misc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/utils/_misc.py | MIT |
def models_to_table(obj, params=True):
r"""
Converts a all the models on an object to a ReST compatible table
Parameters
----------
obj : Base
Any object that has a ``models`` attribute
params : bool
Indicates whether or not to include a list of parameter
values in the t... |
Converts a all the models on an object to a ReST compatible table
Parameters
----------
obj : Base
Any object that has a ``models`` attribute
params : bool
Indicates whether or not to include a list of parameter
values in the table. Set to False for just a list of models, a... | models_to_table | python | PMEAL/OpenPNM | openpnm/utils/_misc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/utils/_misc.py | MIT |
def ignore_warnings(warning=RuntimeWarning):
r"""
Decorator for catching warnings. Useful in pore-scale models where
nans are inevitable, and numpy gets annoying by throwing lots of
RuntimeWarnings.
Parameters
----------
warning : Warning
Python warning type that you want to tempora... |
Decorator for catching warnings. Useful in pore-scale models where
nans are inevitable, and numpy gets annoying by throwing lots of
RuntimeWarnings.
Parameters
----------
warning : Warning
Python warning type that you want to temporarily ignore
Examples
--------
>>> from o... | ignore_warnings | python | PMEAL/OpenPNM | openpnm/utils/_misc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/utils/_misc.py | MIT |
def is_symmetric(a, rtol=1e-10):
r"""
Is ``a`` a symmetric matrix?
Parameters
----------
a : ndarray or sparse matrix
Object to check for being a symmetric matrix.
rtol : float
Relative tolerance with respect to the smallest entry in ``a``
that is used to determine if ``... |
Is ``a`` a symmetric matrix?
Parameters
----------
a : ndarray or sparse matrix
Object to check for being a symmetric matrix.
rtol : float
Relative tolerance with respect to the smallest entry in ``a``
that is used to determine if ``a`` is symmetric.
Returns
------... | is_symmetric | python | PMEAL/OpenPNM | openpnm/utils/_misc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/utils/_misc.py | MIT |
def get_mixture_model_args(
phase,
composition='xs',
args={
'mus': 'pore.viscosity',
'MWs': 'param.molecular_weight',
}
):
r"""
This is used in tests to run models generically
"""
from openpnm.models.phase.misc import mole_to_mass_fraction
vals = {}
if composition... |
This is used in tests to run models generically
| get_mixture_model_args | python | PMEAL/OpenPNM | openpnm/utils/_misc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/utils/_misc.py | MIT |
def dict_to_struct(d):
r"""
Converts a dictionary of numpy arrays to a numpy struct
Parameters
----------
d : dict
A dictionary wtih numpy arrays in each key. The arrays must be all
the same size.
Returns
-------
s : numpy struct
A numpy struct with the fields o... |
Converts a dictionary of numpy arrays to a numpy struct
Parameters
----------
d : dict
A dictionary wtih numpy arrays in each key. The arrays must be all
the same size.
Returns
-------
s : numpy struct
A numpy struct with the fields or names take from the dictionar... | dict_to_struct | python | PMEAL/OpenPNM | openpnm/utils/_misc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/utils/_misc.py | MIT |
def struct_to_dict(s):
r"""
Converts a numpy struct array into a dictionary using the struct labels as
keys
Parameters
----------
s : numpy struct
The struct array
Returns
-------
d : dict
A dictionary with the struct labels or fields as the keys
"""
d = {}
... |
Converts a numpy struct array into a dictionary using the struct labels as
keys
Parameters
----------
s : numpy struct
The struct array
Returns
-------
d : dict
A dictionary with the struct labels or fields as the keys
| struct_to_dict | python | PMEAL/OpenPNM | openpnm/utils/_misc.py | https://github.com/PMEAL/OpenPNM/blob/master/openpnm/utils/_misc.py | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.