Pyrrhenius API

Pyrrhenius.database

class pyrrhenius.database.Database(csv_file='../database/publication_database.csv')[source]

The Database class is designed to manage and manipulate a master database of electric conductivity data.

Examples

>>> database = Database()
>>> phase_list = database.get_phases()
>>> # pick the phase  you want to use
>>> model_id_list = database.get_model_list_for_phase('olivine')
>>> # look at the model_id's you could use
>>> ecmodel = database.get_model(model_id_list[0])
Attributes:
isotropic_namestr

A class-level attribute that assigns the name suffix for isotropic models.

databasepd.DataFrame

A pandas DataFrame that holds the loaded and processed database entries.

Methods

__init__(csv=DEFAULT_DATABASE_PATH)

Initializes the Database object by loading data from a CSV file.

create_isotropic_models()

Creates isotropic models from the existing database entries and registers them.

register_new_model(ecmodel)

Registers a new model or a list of models into the database.

get_model_names()

Returns a list of unique model entry IDs in the database.

get_model_properties(entry_id)

Returns the properties of a model given its entry ID.

get_model(entry_id)

Returns the model object for a given entry ID.

get_phases()

Returns a list of unique phase types in the database.

get_model_list_for_phase(phase)

Returns a list of model entry IDs for a given phase type.

create_isotropic_models()[source]

Creates isotropic models from the existing database entries and registers them.

This method identifies groups of models that are identical except for their orientation, and creates isotropic mixtures from these groups. It then registers these new isotropic models.

get_model(entry_id)[source]

Returns the electric conductivity model object for a given entry ID.

Parameters:
entry_idstr

The entry ID of the model.

Returns:
ec_modelmodel.ModelInterface

The electric conductivity model object.

get_model_list_for_phase(phase)[source]

Returns a list of model entry IDs for a given phase type.

Parameters:
phasestr

The phase type.

Returns:
list[str]

A list of model entry IDs for the given phase type.

get_model_names()[source]

Returns a list of unique model entry IDs in the database.

Returns:
list[str]

A list of unique model entry IDs.

get_model_properties(entry_id)[source]

Returns the properties of a model given its entry ID.

Parameters:
entry_idstr

The entry ID of the model.

Returns:
propertiespd.Series

A pandas Series containing the properties of the model.

get_phases()[source]

Returns a list of unique phase types in the database.

Returns:
list[str]

A list of unique phase types.

register_new_model(ecmodel: ModelInterface)[source]

Registers a new model or a list of models into the database.

Parameters:
ecmodelmodel.ModelInterface or list

The model or list of models to be registered.

pyrrhenius.database.calc_average_pressure(row)[source]

Calculate the Average Pressure of a model entry

Parameters:
rowpd.Series

pandas series describing a model

Returns:
modified_row

a modified row with a new pressure_average_gpa key-value pair.

Pyrrhenius.mechanisms

class pyrrhenius.mechanisms.ArrheniusFugacity(preexp: StochasticConstant, exponent: StochasticConstant, enthalpy: StochasticConstant)[source]

A class that represents a oxygen-fugacity dependent arrhenius preexponential constant

\[\sigma = a exp(\frac{-\Delta H}{kT}) fO_2^c\]

Inherits from the ArrheniusSimple class.

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns True since the ArrheniusFugacity model uses oxygen fugacity.

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy(**kwargs)

Get the value of the enthalpy.

get_preexp(**kwargs)

Get the value of the pre-exponential factor.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

property uses_fo2

Returns True since the ArrheniusFugacity model uses oxygen fugacity.

Returns:
bool: True.
class pyrrhenius.mechanisms.ArrheniusPreexpParam(preexp1: StochasticConstant, preexp2: StochasticConstant, enthalpy: StochasticConstant, volume: StochasticConstant)[source]

represents the following mechanism parameterization:

\[\sigma = A0(1 - B\cdot P) exp( \frac{-\Delta H +P\cdot V}{k_b T})\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy([P])

Calculates the enthalpy for the ArrheniusPreexpParam mechanism

get_preexp([P])

Calculates the preexponential constant for the ArrheniusPreexpParam mechanism

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_enthalpy(P=None, **kwargs)[source]

Calculates the enthalpy for the ArrheniusPreexpParam mechanism

Parameters:
Pfloat or np.ndarray

the pressure value

**kwargsdict

additional keyword arguments

Returns:
float or np.ndarray

the enthalpy

get_preexp(P=None, **kwargs)[source]

Calculates the preexponential constant for the ArrheniusPreexpParam mechanism

Parameters:
Pfloat or np.ndarray

the pressure value

**kwargsdict

additional keyword arguments

Returns:
float or np.ndarray

the preexponential constant

property uses_pressure

Returns whether the mechanism uses pressure or not

Returns:
bool

True if the mechanism uses pressure, False otherwise

class pyrrhenius.mechanisms.ArrheniusPressure(preexp: StochasticConstant, enthalpy: StochasticConstant, volume: StochasticConstant)[source]

represents the following mechanism parameterization:

\[\sigma = a exp(\frac{-\Delta H + P\cdot V}{k_b T})\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy(*args[, P])

Calculates the enthalpy for the ArrheniusPressure mechanism

get_preexp(**kwargs)

Get the value of the pre-exponential factor.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_enthalpy(*args, P=None, **kwargs)[source]

Calculates the enthalpy for the ArrheniusPressure mechanism

Parameters:
Pfloat or np.ndarray

the pressure value

**kwargsdict

additional keyword arguments

Returns:
float or np.ndarray

the enthalpy

property uses_pressure

Returns whether the mechanism uses pressure or not

Returns:
bool

True if the mechanism uses pressure, False otherwise

class pyrrhenius.mechanisms.ArrheniusSimple(preexp: StochasticConstant, enthalpy: StochasticConstant)[source]

Represents a basic Arrhenius mechanism

Mathematically, it is represented by

\[\sigma = a \cdot exp(-\frac{\Delta H } {k_b T})\]

calculation of the preexponential constant and enthalpy is separated so that child classes can implement more sophisticated parameterizations

Parameters:
preexpStochasticConstant

the pre-exponential factor

enthalpyStochasticConstant

Activation enthalpy in units of eV.

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

get_preexp(**kwargs)

Get the value of the pre-exponential factor.

get_enthalpy(*args, **kwargs)

Get the value of the enthalpy.

get_conductivity(T=None, **kwargs)

Get the conductivity.

get_enthalpy(**kwargs)[source]

Get the value of the enthalpy.

Parameters:
kwargsdict

Optional keyword arguments.

Returns:
float

The value of the enthalpy in units of eV.

get_preexp(**kwargs)[source]

Get the value of the pre-exponential factor.

Parameters:
kwargsdict

Optional keyword arguments.

Returns:
float

The value of the pre-exponential factor.

class pyrrhenius.mechanisms.ArrheniusfO2(preexp: StochasticConstant, enthalpy: StochasticConstant, const: StochasticConstant)[source]

an arrhenius equation with an additional term for oxygen fugacity

\[\sigma = exp(log_{10}(a) - \frac{b}{kT} + c*log(fO2))\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

property uses_fo2

Returns whether the mechanism uses fo2 or not

Returns:
bool

True if the mechanism uses fo2, False otherwise

class pyrrhenius.mechanisms.ArrheniusfO22(preexp: StochasticConstant, const: StochasticConstant, enthalpy: StochasticConstant)[source]

represents the following mechanism parameterization:

\[\sigma = log_{10}(a + \frac{b}{T} + c*log_{10}(fO_2))\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

property uses_fo2

Returns whether the mechanism uses fo2 or not

Returns:
bool

True if the mechanism uses fo2, False otherwise

class pyrrhenius.mechanisms.BrinePTDependent(a: ~pyrrhenius.mechanisms.StochasticConstant, b: ~pyrrhenius.mechanisms.StochasticConstant, c: ~pyrrhenius.mechanisms.StochasticConstant, d: ~pyrrhenius.mechanisms.StochasticConstant, e: ~pyrrhenius.mechanisms.StochasticConstant, f: ~pyrrhenius.mechanisms.StochasticConstant, g: ~pyrrhenius.mechanisms.StochasticConstant, h: ~pyrrhenius.mechanisms.StochasticConstant, water: ~pyfluids.fluids.fluid.Fluid = <pyfluids.fluids.fluid.Fluid object>)[source]

Represents a brine conductivity model that depends on pressure, temperature, and salinity.

\[ \begin{align}\begin{aligned}log(\sigma) = a + \frac{b}{T} + c log(NaCl) + d log(\rho) + log(A_0(P,T))\\A_0 = e + f*\rho + \frac{g}{T} + \frac{h}{T^2}\end{aligned}\end{align} \]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_density_field([P, T])

Calculates the density field for the brine using the water object

get_lambda(rho[, T])

Calculates the lambda term for the BrinePTDependent mechanism

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_density_field(P=None, T=None, **kwargs)[source]

Calculates the density field for the brine using the water object

Parameters:
Pfloat or np.ndarray

the pressure in Pa

Tfloat or np.ndarray

the temperature in Kelvin

**kwargsdict

additional keyword arguments

Returns:
float or np.ndarray

the density of the brine in kg/m^3

get_lambda(rho, T=None, **kwargs)[source]

Calculates the lambda term for the BrinePTDependent mechanism

Parameters:
rhofloat or np.ndarray

the density of the brine in kg/m^3

Tfloat or np.ndarray

the temperature in Kelvin

Returns:
float or np.ndarray

the lambda term

property uses_nacl

Returns whether the mechanism uses NaCl concentration or not

Returns:
bool

True if the mechanism uses NaCl, False otherwise

property uses_pressure

Returns whether the mechanism uses pressure or not

Returns:
bool

True if the mechanism uses pressure, False otherwise

class pyrrhenius.mechanisms.IronPreexpEnthalpyArrhenius(preexp: StochasticConstant, enthalpy: StochasticConstant, const1: StochasticConstant, volume: StochasticConstant, const2: StochasticConstant)[source]

represents the following mechanism parameterization:

\[\sigma = a\cdot X_{fe} * exp( -\frac{b + c\cdot X_{fe}^1/3 + P( d + e\cdot X_{fe})}{k_b T})\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy([Xfe, P])

Calculates the enthalpy for the IronPreexpEnthalpyArrhenius mechanism

get_preexp([Xfe])

Calculates the preexponential constant for the IronPreexpEnthalpyArrhenius mechanism

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_enthalpy(Xfe=None, P=None, **kwargs)[source]

Calculates the enthalpy for the IronPreexpEnthalpyArrhenius mechanism

Parameters:
Xfefloat or np.ndarray

the iron value

Pfloat or np.ndarray

the pressure value

**kwargsdict

additional keyword arguments

Returns:
float or np.ndarray

the enthalpy

get_preexp(Xfe=None, **kwargs)[source]

Calculates the preexponential constant for the IronPreexpEnthalpyArrhenius mechanism

Parameters:
Xfefloat or np.ndarray

the iron value

**kwargsdict

additional keyword arguments

Returns:
float or np.ndarray

the preexponential constant

property uses_iron

Returns whether the mechanism uses iron or not

Returns:
bool

True if the mechanism uses iron, False otherwise

property uses_pressure

Returns whether the mechanism uses pressure or not

Returns:
bool

True if the mechanism uses pressure, False otherwise

class pyrrhenius.mechanisms.IronWaterArrhenius1(preexp: StochasticConstant, const: StochasticConstant, enthalpy1: StochasticConstant, enthalpy2: StochasticConstant)[source]

represents the following mechanism parameterization:

\[\sigma = a (C_w)^b exp( \frac{-c}{k_b T}) exp(X_{fe} \frac{d}{k_b T})\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy(**kwargs)

Get the value of the enthalpy.

get_preexp([Xfe, Cw, T])

Calculates the preexponential constant for the IronWaterArrhenius1 mechanism

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_preexp(Xfe=None, Cw=None, T=None, **kwargs)[source]

Calculates the preexponential constant for the IronWaterArrhenius1 mechanism

Parameters:
Xfefloat or np.ndarray

the iron value

Cwfloat or np.ndarray

the water value

Tfloat or np.ndarray

the temperature value

**kwargsdict

additional keyword arguments

Returns:
float or np.ndarray

the preexponential constant

property uses_iron

Returns whether the mechanism uses iron or not

Returns:
bool

True if the mechanism uses iron, False otherwise

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.IronWaterArrhenius2(preexp: StochasticConstant, const1: StochasticConstant, const2: StochasticConstant, const3: StochasticConstant, enthalpy1: StochasticConstant, const4: StochasticConstant, const5: StochasticConstant, const6: StochasticConstant, const7: StochasticConstant)[source]

represents the following mechanism parameterization:

\[\sigma = a (X_{fe}+b) ^c C_w^d exp( -\frac{e+ f\cdot (X_{fe}+b)+ g\cdot C_w^h}{k_b T})\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy([Cw, Xfe])

Calculates the enthalpy for the IronWaterArrhenius2 mechanism

get_preexp([Xfe, Cw])

Calculates the preexponential constant for the IronWaterArrhenius2 mechanism

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_enthalpy(Cw=None, Xfe=None, **kwargs)[source]

Calculates the enthalpy for the IronWaterArrhenius2 mechanism

Parameters:
Cwfloat or np.ndarray

the water value

Xfefloat or np.ndarray

the iron value

**kwargsdict

additional keyword arguments

Returns:
float or np.ndarray

the enthalpy

get_preexp(Xfe=None, Cw=None, **kwargs)[source]

Calculates the preexponential constant for the IronWaterArrhenius2 mechanism

Parameters:
Xfefloat or np.ndarray

the iron value

Cwfloat or np.ndarray

the water value

**kwargsdict

additional keyword arguments

Returns:
float or np.ndarray

the preexponential constant

property uses_iron

Returns whether the mechanism uses iron or not

Returns:
bool

True if the mechanism uses iron, False otherwise

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.LinkedArrhenius(const1: StochasticConstant, const2: StochasticConstant, const3: StochasticConstant, const4: StochasticConstant, const5: StochasticConstant)[source]

Abstract Variation of the ArrheniusSimple class which is primarily used for linear volatile-dependent activation and preexponential factors. See Sifre et al. 2014 for an example.

Mathematically, it is represented by

\[E_a = a \cdot exp( b \cdot volatile) + c\]
\[\sigma_0 = exp(E_a \cdot d + e)\]
\[\sigma = \sigma_0 \cdot exp(\frac{E_a}{rT})\]
Parameters:
const1StochasticConstant

Constant parameter 1.

const2StochasticConstant

Constant parameter 2.

const3StochasticConstant

Constant parameter 3.

const4StochasticConstant

Constant parameter 4.

const5StochasticConstant

Constant parameter 5.

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

_get_enthalpy(volatile, **kwargs)

Calculate the value of the enthalpy.

get_preexp(**kwargs)

Get the value of the pre-exponential factor.

get_conductivity(T=None, **kwargs)

Get the conductivity.

get_enthalpy(**kwargs)[source]

Calculates enthalpy.

Parameters:
kwargsdict

Optional keyword arguments.

Returns:
float

The value of the enthalpy.

get_preexp(**kwargs)[source]

calculates the preexponential value

Parameters:
volatilefloat or np.ndarray

the volatile value needed for computation of the model

kwargsdict

Optional keyword arguments.

Returns:
float

The value of the pre-exponential factor.

classmethod n_args()[source]

Returns the number of parameters needed to define the class instance.

Returns:
int

The number of positional parameters needed.

class pyrrhenius.mechanisms.LinkedArrheniusCO2(*args)[source]

Variation of the LinkedArrhenius class that is specifically used for CO2-dependent conductivity

Mathematically, it is represented by:

\[E_a = a \cdot exp( b \cdot CO_2) + c\]
\[\sigma_0 = exp(E_a \cdot d + e)\]
\[\sigma = \sigma \cdot exp(\frac{E_a}{rT})\]
Parameters:
*argsStochasticConstant

Variable number of positional arguments that are StochasticConstant instances.

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

get_enthalpy(Cw=None, **kwargs)

calculates the enthalpy value based on water contents.

property uses_co2

Returns whether the mechanism uses co2 or not

Returns:
bool

True if the mechanism uses co2, False otherwise

class pyrrhenius.mechanisms.LinkedArrheniusWet(*args)[source]

Variation of the LinkedArrhenius class that is specifically used for water-dependent conductivity

Specification of water is done because water units may vary between authors.

Mathematically, it is represented by:

\[E_a = a \cdot exp( b \cdot C_w) + c\]
\[\sigma_0 = exp(E_a \cdot d + e)\]
\[\sigma = \sigma \cdot exp(\frac{E_a}{rT})\]
Parameters:
*argsStochasticConstant

Variable number of positional arguments that are StochasticConstant instances.

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns True if water is used in the calculations.

Methods

get_enthalpy(Cw=None, **kwargs)

calculates the enthalpy value based on water contents.

property uses_water

Returns True if water is used in the calculations.

Returns:
bool

True if water is used, False otherwise.

class pyrrhenius.mechanisms.Mechanism(**kwargs)[source]

Base Abstract class for all electrical conductivity MultiMechanism

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

convert_co2(co2)[source]

Convert co2 value to the specified units

Parameters:
co2float

The co2 value to be converted

Returns:
float

The converted co2 value

Raises:
NotImplementedError

If the specified conversion units are not implemented

convert_pressure(P)[source]

Convert pressure value to eV units

Parameters:
Pfloat

The pressure value to be converted in GPa

Returns:
float

The converted pressure value in eV

convert_water(Cw)[source]

Convert water value to the equation specific units

Parameters:
cwfloat

The water value to be converted

Returns:
float

The converted water value

Raises:
NotImplementedError

If the specified conversion units are not implemented

get_conductivity(check_assertions=True, **kwargs)[source]

Calculate the conductivity of the mechanism.

Listed here are the available parameters. However, most child classes may only need two or three parameters. See documentation for more details.

Parameters:
check_assertionsbool, optional

whether to check input keywords for existence. Defaults to True

Tfloat or np.ndarray , optional

The temperature value (default is None)

Pfloat or np.ndarray , optional

The pressure value in GPa (default is None)

co2float or np.ndarray , optional

The CO2 value (default is None)

Cwfloat or np.ndarray , optional

The water value (default is None)

naclfloat or np.ndarray , optional

The NaCl concentration in wt% (default is None)

sio2float or np.ndarray , optional

The SiO2 concentration in wt% (default is None)

na2ofloat or np.ndarray , optional

The na2o fraction (default is None)

logfo2float or np.ndarray , optional

The log oxygen fugacity value (default is None)

Xfefloat or np.ndarray , optional

The iron fraction value (default is None)

samplebool, optional

whether to draw a random sample from the constant values using published or inferred uncertainties. default is False

**kwargsdict

Additional keyword arguments

Returns:
np.ndarray or float

The calculated conductivity

Raises:
AssertionError

error is raised if one or more keywords are not provided which are required by the mechanism

classmethod n_args()[source]

Returns the number of parameters needed to define the class instance.

Returns:
int

The number of positional parameters needed.

parameter_assertion(T=None, P=None, co2=None, Cw=None, nacl=None, sio2=None, logfo2=None, Xfe=None, **kwargs)[source]

convenience method for asserting passed kwargs are provided if needed by the method

Parameters:
Tfloat or np.ndarray , optional

The temperature value (default is None)

Pfloat or np.ndarray , optional

The pressure value in GPa (default is None)

co2float or np.ndarray , optional

The CO2 value (default is None)

Cwfloat or np.ndarray , optional

The water value (default is None)

naclfloat or np.ndarray , optional

The NaCl concentration in wt% (default is None)

sio2float or np.ndarray , optional

The SiO2 concentration in wt% (default is None)

logfo2float or np.ndarray , optional

The log oxygen fugacity value (default is None)

Xfefloat or np.ndarray , optional

The oxygen fraction value (default is None)

**kwargsdict

Additional keyword arguments

Raises:
AssertionError

error is raised if one or more keywords are not provided which are required by the mechanism

set_water_units(units)[source]

Set the units for water

Parameters:
unitsstr

The units the model uses for water. Should be either wtpct or ppm

property uses_co2

Returns whether the mechanism uses co2 or not

Returns:
bool

True if the mechanism uses co2, False otherwise

property uses_fo2

Returns whether the mechanism uses fo2 or not

Returns:
bool

True if the mechanism uses fo2, False otherwise

property uses_iron

Returns whether the mechanism uses iron or not

Returns:
bool

True if the mechanism uses iron, False otherwise

property uses_na2o

Returns whether the mechanism uses na2o concentration or not

Returns:
bool

True if the mechanism uses NaCl, False otherwise

property uses_nacl

Returns whether the mechanism uses NaCl concentration or not

Returns:
bool

True if the mechanism uses NaCl, False otherwise

property uses_pressure

Returns whether the mechanism uses pressure or not

Returns:
bool

True if the mechanism uses pressure, False otherwise

property uses_sio2

Returns whether the mechanism uses NaCl concentration or not

Returns:
bool

True if the mechanism uses NaCl, False otherwise

property uses_temperature

Returns whether the mechanism uses temperature or not

Returns:
bool

True if the mechanism uses temperature, False otherwise

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.MultiMechanism(mechanism_list: List[Mechanism])[source]

A combination of two or more mechanisms

class is used when the overall electric conductivity is a linear combination of multiple mechanisms

By itself it represents no explicit parameterization.

Parameters:
mechanism_listList[Mechanism]

a list of mechanisms

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses Na2O concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses sio2 concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(*args, **kwargs)

Sets the units for water.

set_water_units(*args, **kwargs)[source]

Sets the units for water.

property uses_co2

Returns whether the mechanism uses co2 or not

Returns:
bool

True if the mechanism uses co2, False otherwise

property uses_fo2

Returns whether the mechanism uses fo2 or not

Returns:
bool

True if the mechanism uses fo2, False otherwise

property uses_iron

Returns whether the mechanism uses iron or not

Returns:
bool

True if the mechanism uses iron, False otherwise

property uses_na2o

Returns whether the mechanism uses Na2O concentration or not

Returns:
bool

True if the mechanism uses Na2O, False otherwise

property uses_nacl

Returns whether the mechanism uses NaCl concentration or not

Returns:
bool

True if the mechanism uses NaCl, False otherwise

property uses_pressure

Returns whether the mechanism uses pressure or not

Returns:
bool

True if the mechanism uses pressure, False otherwise

property uses_sio2

Returns whether the mechanism uses sio2 concentration or not

Returns:
bool

True if the mechanism uses sio2, False otherwise

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.NerstEinstein1(const1: StochasticConstant, enthalpy: StochasticConstant)[source]

represents the Nernst Einstein Law.

\[\sigma = a C_h \frac{exp(\frac{ b}{k_b T})}{k_b T}\]

Also used as the base class for all nernst-einstein-like mechanisms.

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

prep_preexponential_constant([T, Cw])

provides the preexponential constant for the Nernst Einstein Law

set_water_units(units)

Set the units for water

prep_preexponential_constant(T=None, Cw=None, **kwargs)[source]

provides the preexponential constant for the Nernst Einstein Law

Parameters:
T: float or np.ndarray

the temperature value, by default None

Cwfloat or np.ndarray, optional

the water value , by default None

Returns:
constfloat or np.ndarray

the preexponential constant

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.NerstEinstein2(const1: StochasticConstant, const2: StochasticConstant, enthalpy: StochasticConstant)[source]

represents the Nernst Einstein Law with a different exponent for the water term

\[\sigma = a C_w \cdot b \cdot q^2 \frac{exp(-\frac{h}{k_b T})}{k_b T}\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

prep_preexponential_constant([T, Cw])

provides the preexponential constant for the Nernst Einstein Law

set_water_units(units)

Set the units for water

prep_preexponential_constant(T=None, Cw=None, **kwargs)[source]

provides the preexponential constant for the Nernst Einstein Law

Parameters:
T: float or np.ndarray

the temperature value, by default None

Cwfloat or np.ndarray, optional

the water value , by default None

Returns:
constfloat or np.ndarray

the preexponential constant

class pyrrhenius.mechanisms.NerstEinstein3(const1: StochasticConstant, const2: StochasticConstant, const3: StochasticConstant, enthalpy: StochasticConstant)[source]

Nernst Einstein Law with a different exponent for the water term and a different exponent for the temperature term

\[\sigma = a b C_w^{1+c} \frac{exp( \frac{d}{k_b T})}{k_b T}\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

prep_preexponential_constant([T, Cw])

provides the preexponential constant for the Nernst Einstein Law

set_water_units(units)

Set the units for water

prep_preexponential_constant(T=None, Cw=None, **kwargs)[source]

provides the preexponential constant for the Nernst Einstein Law

Parameters:
T: float or np.ndarray

the temperature value, by default None

Cwfloat or np.ndarray, optional

the water value , by default None

Returns:
constfloat or np.ndarray

the preexponential constant

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.SEO3Term(preexp1: StochasticConstant, enth1: StochasticConstant, preexp2: StochasticConstant, enth2: StochasticConstant, exp: StochasticConstant, preexp3: StochasticConstant, enth3: StochasticConstant)[source]

Uses a combination of ArrheniusSimple and ArrheniusFugacity models to represent a polaron hopping term for the SEO3 model of olivine

\[\sigma = e [a \cdot exp(\frac{b}{k_b T}) + c \cdot exp(\frac{d}{k_b T})(fO_2)^e]\cdot f\cdot exp(\frac{g}{k_b T})\]

Inherits from the Mechanism class.

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

classmethod n_args()[source]

Returns the number of parameters needed to define the class instance.

Returns:
int

The number of positional parameters needed.

property uses_fo2

Returns whether the mechanism uses fo2 or not

Returns:
bool

True if the mechanism uses fo2, False otherwise

class pyrrhenius.mechanisms.SIGMELTSGaillaird(const1: StochasticConstant, const2: StochasticConstant, const3: StochasticConstant, const4: StochasticConstant, const5: StochasticConstant)[source]

A class for calculating Water, P, and T depedent magma conductivity. The basics of the class were taken by web scraping the SIGMELTS portal: https://calcul-isto.cnrs-orleans.fr/apps/sigmelts/

Which has a corresponding publication @doi: 10.1016/j.cageo.2011.01.002

The parameterization is based on a natural-log space regression of the form:

\[\Delta H^` = a \cdot ln(water) + b + c \cdot P\]
\[\sigma_0 = d \cdot ln(C_w) + e\]
\[\sigma = \sigma_0 \cdot exp(\frac{-\Delta H^`}{k_b T})\]

Where Cw is in wt%, P is in GPa, and T is in Kelvin.

no reported error on constants was available. I modify this class to have a reported error of 0.4 log units. Additionally, there are three forms of the constants, piecewise implemented across different silica activities.

To make it compatible with Pyrrhenious, four transforms are needed:

  1. conversion of MPa into GPa

  2. conversion of the enthaly term to use kb instead of r.

  3. conversion of ppm Water inputs to wt% water

  4. conversion of these factors into simple conductivity.

Parameters:
const1StochasticConstant

sigma_0 offset

const2StochasticConstant

water fit constant

const3StochasticConstant

standard state enthalpy

const4StochasticConstant

water fit constant

const5StochasticConstant

activation volume

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy([Cw, P])

Get the value of the enthalpy.

get_preexp([Cw])

Get the value of the preexponential factor.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_enthalpy(Cw=None, P=None, **kwargs)[source]

Get the value of the enthalpy.

Parameters:
Cw:

water concentration, converted to wt%

P

pressure in GPa

Returns:
float or np.ndarray

The value of the enthalpy in units of eV

get_preexp(Cw=None, **kwargs)[source]

Get the value of the preexponential factor.

Parameters:
Cw:

water concentration, converted to wt%

Returns:
float

The value of the enthalpy in units of eV.

property uses_pressure

Returns whether the mechanism uses pressure or not

Returns:
bool

True if the mechanism uses pressure, False otherwise

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.SIGMELTSPommier(const1: StochasticConstant, const2: StochasticConstant, const3: StochasticConstant, const4: StochasticConstant, const5: StochasticConstant, const6: StochasticConstant, const7: StochasticConstant, const8: StochasticConstant, const9: StochasticConstant, const10: StochasticConstant, const11: StochasticConstant, const12: StochasticConstant, const13: StochasticConstant, const14: StochasticConstant, const15: StochasticConstant, const16: StochasticConstant, const17: StochasticConstant)[source]

A class for calculating SiO2, Na2O, Water, P, and T depedent magma conductivity. The basics of the class were taken by web scraping the SIGMELTS portal: https://calcul-isto.cnrs-orleans.fr/apps/sigmelts/

Which has a corresponding publication @doi: 10.1016/j.cageo.2011.01.002

The parameterization is based on a natural-log space regression of the form:

\[\Delta H^` = a + \frac{b}{c \cdot Na_2O + d} - e \cdot Na_2O + f \cdot P + g \cdot C_w^2\]
\[ln(\sigma_0) = h + i \cdot SiO_2 + j \cdot T + k \cdot P + l \cdot ln(C_w) + m \cdot Na_2O + n \cdot C_w + o \cdot \frac{\Delta H}{rT}\]
\[\sigma = \sigma_0 \cdot exp(\frac{-\Delta H^`}{k_b T})\]

Where SiO2, Na2O, and Cw are in wt%, P is in MPa, and T is in Kelvin.

no reported error on constants was available. I modify this class to have a reported error of 0.4 log units. Additionally, there are three forms of the constants, piecewise implemented across different silica activities.

To make it compatible with Pyrrhenious, four transforms are needed:

  1. conversion of MPa into GPa

  2. conversion of the enthaly term o * delta H / rT into o * delta H / kT

  3. conversion of ppm Water inputs to wt% water

  4. conversion of these factors into simple conductivity.

Parameters:
const1StochasticConstant

standard state enthalpy

const2StochasticConstant

term1 enthalpy na2o

const3StochasticConstant

term2 enthalpy na2o

const4StochasticConstant

term3 enthalpy na2o

const5StochasticConstant

term4 enthalpy na2o

const6StochasticConstant

activation volume

const7StochasticConstant

squared water constant

const8StochasticConstant

base conductivity

const9StochasticConstant

silica activity

const10StochasticConstant

temperature species availability modifier

const11StochasticConstant

pressure species availability modifier

const12StochasticConstant

log water factor

const13StochasticConstant

na2O activity

const14StochasticConstant

linear water activity

const15StochasticConstant

static enthalpy modifier

const16upper silica bound
const17lower silica bound
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy([na2o, Cw, P])

Get the value of the enthalpy.

get_preexp([sio2, Cw, na2o, P, T])

Get the value of the preexponential factor.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_enthalpy(na2o=None, Cw=None, P=None, **kwargs)[source]

Get the value of the enthalpy.

Parameters:
na2o

na2o equivalent concentration in wt%

Cw:

water concentration, converted to wt%

P

pressure in GPa

Returns:
float or np.ndarray

The value of the enthalpy in units of eV

get_preexp(sio2=None, Cw=None, na2o=None, P=None, T=None, **kwargs)[source]

Get the value of the preexponential factor.

Parameters:
sio2

silica equivalent concentration in wt%

na2o

na2o equivalent concentration in wt%

Cw:

water concentration, converted to wt%

P

pressure in GPa

T

temperature in K

Returns:
float

The value of the enthalpy in units of eV.

property uses_na2o

Returns whether the mechanism uses na2o concentration or not

Returns:
bool

True if the mechanism uses NaCl, False otherwise

property uses_pressure

Returns whether the mechanism uses pressure or not

Returns:
bool

True if the mechanism uses pressure, False otherwise

property uses_sio2

Returns whether the mechanism uses NaCl concentration or not

Returns:
bool

True if the mechanism uses NaCl, False otherwise

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.SingleValue(value)[source]

Electrical conductivity model which represents single values independent of P,T,fO2, or volatiles

Mathematically, it is an unparamterized constant value.

\[\sigma = c\]
Parameters:
valueStochasticConstant

The value represented as a StochasticConstant

Returns:
float

the conductivity value in s/m

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

class pyrrhenius.mechanisms.StochasticConstant(mean: float, stdev: float, type: str, log: bool = False, isnan: bool = False)[source]

Class for storing Equation Constants. Can be used to generate a random constant value based on provided uncertainties

Mathematically, it is a constant value.

\[c = c_{mean} + N(0,c_{stdev})\]

if bool=True is sent, the constant is calculated as:

\[c = 10^{c_{mean} + N(0,c_{stdev})}\]

Methods

get_value(self, sample=False, **kwargs)

Calculates a constant value based on the provided uncertainties Parameters: sample : bool, optional Determines if the value should be sampled randomly based on the mean and standard deviation, default is False **kwargs : additional keyword arguments, optional Additional parameters that can be used in the calculation of the constant, not used in the current implementation Returns: float The calculated constant value

__repr__(self)

Returns a string representation of the StochasticConstant object Returns: str A string representation of the object

get_value(sample=False, **kwargs)[source]

Calculates a constant value based on the provided uncertainties

Parameters:
samplebool, optional

Determines if the value should be sampled randomly based on the mean and standard deviation, default is False

**kwargsadditional keyword arguments, optional

Additional parameters that can be used in the calculation of the constant, not used in the current implementation

Returns:
float

The calculated constant value

class pyrrhenius.mechanisms.VogelFulcherTammanWet(preexp: StochasticConstant, enthalpy: StochasticConstant, const1: StochasticConstant, const2: StochasticConstant, const3: StochasticConstant)[source]

A class that represents a Vogel-Fulcher-Tamman equation for wet substances.

\[\sigma = a \cdot exp( \frac{b - c C_w^d}{k_b\cdot(T-T_0)})\]

Inherits from the ArrheniusSimple class.

Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns True, indicating that water is used in the equation.

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy([Cw, T])

Calculates and returns the enthalpy of the equation involving water.

get_preexp(**kwargs)

Get the value of the pre-exponential factor.

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_enthalpy(Cw=None, T=None, **kwargs)[source]

Calculates and returns the enthalpy of the equation involving water.

Parameters:

Cwfloat, optional

The amount of water involved in the equation. If not provided, the default value is None.

Tfloat, optional

The temperature at which the enthalpy is calculated. If not provided, the default value is None.

**kwargsdict

Additional keyword arguments to be passed to the parent class method.

Returns:

float

The enthalpy of the equation in eV

property uses_water

Returns True, indicating that water is used in the equation.

class pyrrhenius.mechanisms.WaterExpArrhenius1(preexp: StochasticConstant, const1: StochasticConstant, enthalpy: StochasticConstant)[source]

Represents an equation with the following parameterization:

\[\sigma = a C_w^b exp(\frac{-\Delta H}{k_b T})\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy(**kwargs)

Get the value of the enthalpy.

get_preexp([Cw])

Calculates the preexp constant for the WaterExpArrhenius1 mechanism

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_preexp(Cw=None, **kwargs)[source]

Calculates the preexp constant for the WaterExpArrhenius1 mechanism

Parameters:
Cwfloat or np.ndarray

the water concentration in mol/m^3

Returns:
float or np.ndarray

the preexp constant

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.WaterExpArrhenius2(preexp: StochasticConstant, enthalpy: StochasticConstant, const1: StochasticConstant, const2: StochasticConstant)[source]

Represents an equation with the following parameterization:

\[\sigma = a C_w exp(\frac{-(b + c C_w^d)}{k_b T})\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy([Cw])

Calculates the enthalpy for the WaterExpArrhenius2 mechanism

get_preexp([Cw])

Calculates the preexp constant for the WaterExpArrhenius2 mechanism

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_enthalpy(Cw=None, **kwargs)[source]

Calculates the enthalpy for the WaterExpArrhenius2 mechanism

Parameters:
Cwfloat or np.ndarray

the water concentration in mol/m^3

Returns:
float or np.ndarray

the enthalpy

get_preexp(Cw=None, **kwargs)[source]

Calculates the preexp constant for the WaterExpArrhenius2 mechanism

Parameters:
Cwfloat or np.ndarray

the water concentration in mol/m^3

Returns:
float or np.ndarray

the preexp constant

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.WaterExpArrhenius3(preexp: StochasticConstant, waterexp_preepx: StochasticConstant, enthalpy: StochasticConstant, waterenth_const: StochasticConstant, waterenth_exp: StochasticConstant, volume: StochasticConstant)[source]

Represents an equation with the following parameterization:

\[\sigma = a C_w^b exp( -\frac{c + d C_w^e + P \cdot V}{k_b T})\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy([Cw])

Calculates the enthalpy for the WaterExpArrhenius3 mechanism

get_preexp([Cw])

Calculates the preexp constant for the WaterExpArrhenius3 mechanism

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_enthalpy(Cw=None, **kwargs)[source]

Calculates the enthalpy for the WaterExpArrhenius3 mechanism

Parameters:
Cwfloat or np.ndarray

the water concentration in mol/m^3

Returns:
float or np.ndarray

the enthalpy

get_preexp(Cw=None, **kwargs)[source]

Calculates the preexp constant for the WaterExpArrhenius3 mechanism

Parameters:
Cwfloat or np.ndarray

the water concentration in mol/m^3

Returns:
float or np.ndarray

the preexp constant

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.WaterExpArrheniusInvT(preexp: StochasticConstant, const1: StochasticConstant, enthalpy: StochasticConstant, volume: StochasticConstant)[source]

Represents an equation with the following parameterization:

\[\sigma = a C_w^b \frac{exp(-\frac{\Delta H + P \cdot V}{k_b T})}{T}\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy(*args[, P])

Calculates the enthalpy for the ArrheniusPressure mechanism

get_preexp([Cw])

Calculates the preexp constant for the WaterExpArrheniusPressure mechanism

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

property uses_pressure

Returns whether the mechanism uses pressure or not

Returns:
bool

True if the mechanism uses pressure, False otherwise

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

class pyrrhenius.mechanisms.WaterExpArrheniusPressure(preexp: StochasticConstant, const1: StochasticConstant, enthalpy: StochasticConstant, volume: StochasticConstant)[source]

Represents an equation with the following parameterization:

\[\sigma = a C_w^b exp(-\frac{\Delta H + P \cdot V}{k_b T})\]
Attributes:
uses_co2

Returns whether the mechanism uses co2 or not

uses_fo2

Returns whether the mechanism uses fo2 or not

uses_iron

Returns whether the mechanism uses iron or not

uses_na2o

Returns whether the mechanism uses na2o concentration or not

uses_nacl

Returns whether the mechanism uses NaCl concentration or not

uses_pressure

Returns whether the mechanism uses pressure or not

uses_sio2

Returns whether the mechanism uses NaCl concentration or not

uses_temperature

Returns whether the mechanism uses temperature or not

uses_water

Returns whether the mechanism uses water or not

Methods

convert_co2(co2)

Convert co2 value to the specified units

convert_pressure(P)

Convert pressure value to eV units

convert_water(Cw)

Convert water value to the equation specific units

get_conductivity([check_assertions])

Calculate the conductivity of the mechanism.

get_enthalpy(*args[, P])

Calculates the enthalpy for the ArrheniusPressure mechanism

get_preexp([Cw])

Calculates the preexp constant for the WaterExpArrheniusPressure mechanism

n_args()

Returns the number of parameters needed to define the class instance.

parameter_assertion([T, P, co2, Cw, nacl, ...])

convenience method for asserting passed kwargs are provided if needed by the method

set_water_units(units)

Set the units for water

get_preexp(Cw=None, **kwargs)[source]

Calculates the preexp constant for the WaterExpArrheniusPressure mechanism

Parameters:
Cwfloat or np.ndarray

the water concentration in mol/m^3

Returns:
float or np.ndarray

the preexp constant

property uses_pressure

Returns whether the mechanism uses pressure or not

Returns:
bool

True if the mechanism uses pressure, False otherwise

property uses_water

Returns whether the mechanism uses water or not

Returns:
bool

True if the mechanism uses water, False otherwise

pyrrhenius.mechanisms.create_constants_from_row(row)[source]

creates a list of StochasticConstants from a row in the database

Parameters:
rowpd.Series

a row in the database

Returns:
list of StochasticConstants

a list of StochasticConstants

pyrrhenius.mechanisms.create_mechanism_from_row(row) Mechanism[source]

creates a mechanism from a row in the database

Parameters:
rowpd.Series

a row in the database

Returns:
mechanismMechanism

a mechanism

pyrrhenius.mechanisms.get_const_rows(row)[source]

creates a list of the row keys that are not StochasticConstants

Parameters:
rowpd.Series

a row in the database

Returns:
list of str

a list of the row keys that are not StochasticConstants

Pyrrhenius.model

class pyrrhenius.model.CachedModel(model)[source]

A model that caches the conductivity of the encapsulated model

Useful when calculating the conductivity of a model takes a nontrivial amount of compute.

Parameters:
modelModelInterface

a Pyrrhenius model

Examples

>>> model = database.get_model('model_id')
>>> cached_model = CachedModel(model)
>>> T = np.linspace(1000,2000,10)
>>> P = np.linspace(1,2,10)
>>> conductivity = cached_model.get_conductivity(T=T,P=P)
>>> assert np.array_equal(conductivity, model.get_conductivity(T=T,P=P,Cw=Cw))
Attributes:
get_id

gets the model id

uses_co2

Checks if the model uses CO2 as a parameter.

uses_fo2

Checks if the model uses fo2 as a parameter.

uses_iron

Checks if the model uses iron as a parameter.

uses_na2o

Checks if the model uses Na2O as a parameter.

uses_nacl

Checks if the model uses NaCl as a parameter.

uses_pressure

Checks if the model uses pressure as a parameter.

uses_sio2

Checks if the model uses SiO2 as a parameter.

uses_water

Checks if the model uses water as a parameter.

Methods

generate_representative_conditions([use_qfm])

generates a dictionary of conditions relevant to the experiment

get_conductivity([ignore_cache])

returns the cached conductivity of the encapsulated model with Cw set to 0.

get_row()

returns a pd.Series representation of the model

print_required_parameters()

Prints the keywords required to use get_conductivity()

reset_cache()

resets the cache

set_cache(**kwargs)

sets the cache

get_conductivity(ignore_cache=False, **kwargs)[source]

returns the cached conductivity of the encapsulated model with Cw set to 0.

Not all parameters are required by all models. To see which parameters are required by the encapsulated model, use the model .print_required_parameters()

Parameters:
ignore_cachebool, optional

If True, the cache is ignored and the conductivity is recalculated.

crystal_directionstr or float, optional

The crystallographic direction to query for specific conductivity. Only active if the encapsulated model is an IsotropicMixture. If a float is provided, it is used to calculate an anisotropic factor between 0 and 1.

averagingstr, optional

The method to average conductivity. Default is ‘geometric’. Only active if the encapsulated model is an IsotropicMixture. Options include: - ‘geometric’: Geometric mean of the available crystallographic directions. - ‘max_aniso’: Maximum anisotropic factor (conductivity in the most conductive direction). - ‘min_aniso’: Minimum anisotropic factor (conductivity in the least conductive direction).

Tfloat or np.ndarray , optional

The temperature value (default is None)

Pfloat or np.ndarray , optional

The pressure value in GPa (default is None)

co2float or np.ndarray , optional

The CO2 value (default is None)

Cwfloat or np.ndarray , optional

The water value (default is None)

naclfloat or np.ndarray , optional

The NaCl concentration in wt% (default is None)

sio2float or np.ndarray , optional

The SiO2 concentration in wt% (default is None)

na2ofloat or np.ndarray , optional

The na2o fraction (default is None)

logfo2float or np.ndarray , optional

The log oxygen fugacity value (default is None)

Xfefloat or np.ndarray , optional

The iron fraction value (default is None)

**kwargsdict

Additional keyword arguments

Returns:
np.ndarray or float

The calculated conductivity

Raises

AssertionError

error is raised if one or more keywords are not provided which are required by the mechanism

property get_id

gets the model id

Returns:
str

the model id

reset_cache()[source]

resets the cache

set_cache(**kwargs)[source]

sets the cache

class pyrrhenius.model.CompositeModel(models, metadata)[source]

A composite model that combines multiple models into a single model.

Composite models are created by adding two models together, and they inherit all the properties of the models they are composed of. These models are also meant to be made from adding the models together, rather than explicitly instantiating the class.

Parameters:
modelslist of ModelInterface

The models to be combined.

metadataPublicationMetadata

The metadata for the composite model.

Examples

>>> model1 = database.get_model('model_id1')
>>> model2 = database.get_model('model_id2')
>>> composite_model = model1 + model2
Attributes:
get_id

returns the id of the composite model

uses_co2

Checks if the model uses CO2 as a parameter.

uses_fo2

Checks if the model uses fo2 as a parameter.

uses_iron

Checks if the model uses iron as a parameter.

uses_na2o

Checks if the model uses Na2O as a parameter.

uses_nacl

Checks if the model uses NaCl as a parameter.

uses_pressure

Checks if the model uses pressure as a parameter.

uses_sio2

Checks if the model uses SiO2 as a parameter.

uses_water

Checks if the model uses water as a parameter.

Methods

generate_representative_conditions([use_qfm])

generates a dictionary of conditions relevant to the experiment

get_conductivity([crystal_direction])

returns the conductivity of the composite model

get_row()

returns a pd.Series representation of the model

print_required_parameters()

Prints the keywords required to use get_conductivity()

get_conductivity(crystal_direction=None, **kwargs)[source]

returns the conductivity of the composite model

Not all parameters are required by all models. To see which parameters are required by the encapsulated model, use the model .print_required_parameters()

Parameters:
crystal_directionstr or float, optional

The crystallographic direction to query for specific conductivity. If a float is provided, it is used to calculate an anisotropic factor between 0 and 1.

averagingstr, optional

The method to average conductivity. Default is ‘geometric’. Options include: - ‘geometric’: Geometric mean of the available crystallographic directions. - ‘max_aniso’: Maximum anisotropic factor (conductivity in the most conductive direction). - ‘min_aniso’: Minimum anisotropic factor (conductivity in the least conductive direction).

Tfloat or np.ndarray , optional

The temperature value (default is None)

Pfloat or np.ndarray , optional

The pressure value in GPa (default is None)

co2float or np.ndarray , optional

The CO2 value (default is None)

Cwfloat or np.ndarray , optional

The water value (default is None)

naclfloat or np.ndarray , optional

The NaCl concentration in wt% (default is None)

sio2float or np.ndarray , optional

The SiO2 concentration in wt% (default is None)

na2ofloat or np.ndarray , optional

The na2o fraction (default is None)

logfo2float or np.ndarray , optional

The log oxygen fugacity value (default is None)

Xfefloat or np.ndarray , optional

The iron fraction value (default is None)

**kwargsdict

Additional keyword arguments

Returns:
np.ndarray or float

The calculated conductivity

Raises

AssertionError

error is raised if one or more keywords are not provided which are required by the mechanism

property get_id

returns the id of the composite model

Returns:
str

the id of the composite model

property uses_co2

Checks if the model uses CO2 as a parameter.

Returns:
bool

True if the model uses CO2, False otherwise.

property uses_fo2

Checks if the model uses fo2 as a parameter.

Returns:
bool

True if the model uses fo2, False otherwise.

property uses_iron

Checks if the model uses iron as a parameter.

Returns:
bool

True if the model uses iron, False otherwise.

property uses_na2o

Checks if the model uses Na2O as a parameter.

Returns:
bool

True if the model uses Na2O, False otherwise.

property uses_nacl

Checks if the model uses NaCl as a parameter.

Returns:
bool

True if the model uses NaCl, False otherwise.

property uses_pressure

Checks if the model uses pressure as a parameter.

Returns:
bool

True if the model uses pressure, False otherwise.

property uses_sio2

Checks if the model uses SiO2 as a parameter.

Returns:
bool

True if the model uses SiO2, False otherwise.

property uses_water

Checks if the model uses water as a parameter.

Returns:
bool

True if the model uses water, False otherwise.

class pyrrhenius.model.DryModel(model)[source]

A dry model that removes water from the encapsulated model

Parameters:
modelModelInterface

The model to encapsulate.

Examples

>>> wet_model = database.get_model('model_id')
>>> dry_model = DryModel(wet_model)
>>> T = np.linspace(1000,2000,10)
>>> P = np.linspace(1,2,10)
>>> Cw = np.linspace(1,2,10)
>>> wet_model_conductivity = wet_model.get_conductivity(T=T,P=P,Cw=Cw)
>>> dry_model_conductivity = dry_model.get_conductivity(T=T,P=P,Cw=Cw)
>>> assert not np.array_equal(dry_model_conductivity, wet_model_conductivity)
Attributes:
get_id

gets the model id

uses_co2

Checks if the model uses CO2 as a parameter.

uses_fo2

Checks if the model uses fo2 as a parameter.

uses_iron

Checks if the model uses iron as a parameter.

uses_na2o

Checks if the model uses Na2O as a parameter.

uses_nacl

Checks if the model uses NaCl as a parameter.

uses_pressure

Checks if the model uses pressure as a parameter.

uses_sio2

Checks if the model uses SiO2 as a parameter.

uses_water

Checks if the model uses water as a parameter.

Methods

generate_representative_conditions([use_qfm])

generates a dictionary of conditions relevant to the experiment

get_conductivity(**kwargs)

returns the conductivity of the encapsulated model with Cw set to 0.

get_row()

returns a pd.Series representation of the model

print_required_parameters()

Prints the keywords required to use get_conductivity()

get_conductivity(**kwargs)[source]

returns the conductivity of the encapsulated model with Cw set to 0.

Not all parameters are required by all models. To see which parameters are required by the encapsulated model, use the model .print_required_parameters()

Parameters:
crystal_directionstr or float, optional

The crystallographic direction to query for specific conductivity. If a float is provided, it is used to calculate an anisotropic factor between 0 and 1.

averagingstr, optional

The method to average conductivity. Default is ‘geometric’. Options include: - ‘geometric’: Geometric mean of the available crystallographic directions. - ‘max_aniso’: Maximum anisotropic factor (conductivity in the most conductive direction). - ‘min_aniso’: Minimum anisotropic factor (conductivity in the least conductive direction).

Tfloat or np.ndarray , optional

The temperature value (default is None)

Pfloat or np.ndarray , optional

The pressure value in GPa (default is None)

co2float or np.ndarray , optional

The CO2 value (default is None)

naclfloat or np.ndarray , optional

The NaCl concentration in wt% (default is None)

sio2float or np.ndarray , optional

The SiO2 concentration in wt% (default is None)

na2ofloat or np.ndarray , optional

The na2o fraction (default is None)

logfo2float or np.ndarray , optional

The log oxygen fugacity value (default is None)

Xfefloat or np.ndarray , optional

The iron fraction value (default is None)

**kwargsdict

Additional keyword arguments

Returns:
np.ndarray or float

The calculated conductivity

Raises

AssertionError

error is raised if one or more keywords are not provided which are required by the mechanism

property get_id

gets the model id

Returns:
str

the model id

class pyrrhenius.model.IsotropicMixture(models)[source]

A model that encapsulates several anisotropic models corresponding to a single phase.

this is useful for flexible exploration of isotropic and anisotorpic models

Parameters:
modelslist of ModelInterface

The models to be averaged.

Examples

>>> import pyrrhenius.database as db
>>> database = db.Database()
>>> database.create_isotropic_models()
>>> isotropic_model = database.get_model('IsotropicMixture:model_id')
>>> T = np.linspace(1000,2000,10)
>>> P = np.linspace(1,2,10)
>>> Cw = np.linspace(1,2,10)
>>> isotropic_model_conductivity = isotropic_model.get_conductivity(T=T,P=P,Cw=Cw)
>>> assert not np.array_equal(isotropic_model_conductivity, model.get_conductivity(T=T,P=P,Cw=Cw))
Attributes:
get_id

gets the model id

uses_co2

Checks if the model uses CO2 as a parameter.

uses_fo2

Checks if the model uses fo2 as a parameter.

uses_iron

Checks if the model uses iron as a parameter.

uses_na2o

Checks if the model uses Na2O as a parameter.

uses_nacl

Checks if the model uses NaCl as a parameter.

uses_pressure

Checks if the model uses pressure as a parameter.

uses_sio2

Checks if the model uses SiO2 as a parameter.

uses_water

Checks if the model uses water as a parameter.

Methods

generate_representative_conditions([use_qfm])

generates a dictionary of conditions relevant to the experiment

get_conductivity([crystal_direction, averaging])

returns the conductivity of the isotropic model

get_row()

returns a pd.Series representation of the model

print_required_parameters()

Prints the keywords required to use get_conductivity()

get_conductivity(crystal_direction=None, averaging='geometric', **kwargs)[source]

returns the conductivity of the isotropic model

Not all parameters are required by all models. To see which parameters are required by the encapsulated model, use the model .print_required_parameters()

Parameters:
crystal_directionstr or float, optional

The crystallographic direction to query for specific conductivity. If a float is provided, it is used to calculate an anisotropic factor between 0 and 1.

averagingstr, optional

The method to average conductivity. Default is ‘geometric’. Options include: - ‘geometric’: Geometric mean of the available crystallographic directions. - ‘max_aniso’: Maximum anisotropic factor (conductivity in the most conductive direction). - ‘min_aniso’: Minimum anisotropic factor (conductivity in the least conductive direction).

Tfloat or np.ndarray , optional

The temperature value (default is None)

Pfloat or np.ndarray , optional

The pressure value in GPa (default is None)

co2float or np.ndarray , optional

The CO2 value (default is None)

Cwfloat or np.ndarray , optional

The water value (default is None)

naclfloat or np.ndarray , optional

The NaCl concentration in wt% (default is None)

sio2float or np.ndarray , optional

The SiO2 concentration in wt% (default is None)

na2ofloat or np.ndarray , optional

The na2o fraction (default is None)

logfo2float or np.ndarray , optional

The log oxygen fugacity value (default is None)

Xfefloat or np.ndarray , optional

The iron fraction value (default is None)

**kwargsdict

Additional keyword arguments

Returns:
np.ndarray or float

The calculated conductivity

Raises

AssertionError

error is raised if one or more keywords are not provided which are required by the mechanism

property uses_co2

Checks if the model uses CO2 as a parameter.

Returns:
bool

True if the model uses CO2, False otherwise.

property uses_fo2

Checks if the model uses fo2 as a parameter.

Returns:
bool

True if the model uses fo2, False otherwise.

property uses_iron

Checks if the model uses iron as a parameter.

Returns:
bool

True if the model uses iron, False otherwise.

property uses_na2o

Checks if the model uses Na2O as a parameter.

Returns:
bool

True if the model uses Na2O, False otherwise.

property uses_nacl

Checks if the model uses NaCl as a parameter.

Returns:
bool

True if the model uses NaCl, False otherwise.

property uses_pressure

Checks if the model uses pressure as a parameter.

Returns:
bool

True if the model uses pressure, False otherwise.

property uses_sio2

Checks if the model uses SiO2 as a parameter.

Returns:
bool

True if the model uses SiO2, False otherwise.

property uses_water

Checks if the model uses water as a parameter.

Returns:
bool

True if the model uses water, False otherwise.

class pyrrhenius.model.Model(mechanism: Mechanism, id_row: Series | PublicationMetadata)[source]

Base Model class used to hold both metadata and mechanisms

Parameters:
mechanismmech.Mechanism

The mechanism associated with the model.

id_rowpd.Series or PublicationMetadata

The metadata or identifier row for the model.

Attributes:
mechanismmech.Mechanism

The mechanism associated with the model.

metadataPublicationMetadata

Metadata associated with the model.

Methods

get_crystal_direction()

Returns the crystal direction from the metadata.

Examples

——–

>>> model = database.get_model(‘model_id’)

>>> T = np.linspace(1000,2000,10)

>>> P = np.linspace(1,2,10)

>>> conductivity = model.get_conductivity(T=T,P=P)

get_crystal_direction()[source]

returns the crystal direction for this model

Returns:
str

a 4 character representation of the crystal direction [xxx], ex: [011]

class pyrrhenius.model.ModelInterface(id_row: Series | PublicationMetadata)[source]

A base interface class for all models in the Pyrrhenius framework.

Parameters:
id_rowpd.Series or PublicationMetadata

Metadata associated with the model. This can either be a pandas Series or a PublicationMetadata object.

Attributes:
metadataPublicationMetadata

Metadata associated with the model.

mechanismmech.Mechanism

The mechanism used in the model.

Methods

uses_water

Checks if the model uses water as a parameter.

uses_nacl

Checks if the model uses NaCl as a parameter.

uses_iron

Checks if the model uses iron as a parameter.

uses_na2o

Checks if the model uses Na2O as a parameter.

uses_sio2

Checks if the model uses SiO2 as a parameter.

uses_co2

Checks if the model uses CO2 as a parameter.

uses_pressure

Checks if the model uses pressure as a parameter.

uses_fo2

Checks if the model uses fo2 as a parameter.

get_conductivity(**kwargs)

Calculates the conductivity based on the model’s mechanism and provided parameters.

print_required_parameters()

Calculates the conductivity based on the model’s mechanism and provided parameters.

generate_representative_conditions(use_qfm=True)[source]

generates a dictionary of conditions relevant to the experiment

Parameters:
use_qfmbool, optional

use the quartz-fayallite-magnetite buffer to calculate fo2 conditions. Currently will not work any other way

Returns:
dict

dictionary consisting of keys matching the model inputs and values consisting of either 1. a range of corresponding conditions or 2. a single average condition. 1 is returned if the min and max values are different. 2. otherwise

get_conductivity(**kwargs)[source]

Calculates the conductivity based on the model’s mechanism and provided parameters.

Parameters:
**kwargsdict

Additional parameters for the conductivity calculation. See the documentation on mech.Mechanism for a full list of possible keywords

Returns:
float or np.ndarray

The calculated conductivity in S/m

property get_id

gets the model id

Returns:
str

the model id

get_row()[source]

returns a pd.Series representation of the model

Returns:
pd.Series

a pd.Series representation of the model

print_required_parameters()[source]

Prints the keywords required to use get_conductivity()

property uses_co2

Checks if the model uses CO2 as a parameter.

Returns:
bool

True if the model uses CO2, False otherwise.

property uses_fo2

Checks if the model uses fo2 as a parameter.

Returns:
bool

True if the model uses fo2, False otherwise.

property uses_iron

Checks if the model uses iron as a parameter.

Returns:
bool

True if the model uses iron, False otherwise.

property uses_na2o

Checks if the model uses Na2O as a parameter.

Returns:
bool

True if the model uses Na2O, False otherwise.

property uses_nacl

Checks if the model uses NaCl as a parameter.

Returns:
bool

True if the model uses NaCl, False otherwise.

property uses_pressure

Checks if the model uses pressure as a parameter.

Returns:
bool

True if the model uses pressure, False otherwise.

property uses_sio2

Checks if the model uses SiO2 as a parameter.

Returns:
bool

True if the model uses SiO2, False otherwise.

property uses_water

Checks if the model uses water as a parameter.

Returns:
bool

True if the model uses water, False otherwise.

class pyrrhenius.model.PublicationMetadata(title: str, author: str, year: str, doi: str, phase_type: str, description: str, sample_type: str, equation_form: str, publication_id: str, entry_id: str, complete_or_partial_fit: str, composite_or_single: str, pressure_average: float, pressure_min: float, pressure_max: float, temp_min: float, temp_max: float, nacl_min: float, nacl_max: float, nacl_average: float, na2o_min: float, na2o_max: float, na2o_average: float, sio2_min: float, sio2_max: float, sio2_average: float, co2_min: float, co2_max: float, co2_average: float, water_min: float, water_max: float, water_average: float, water_calibration: str, water_units: str, iron_min: float, iron_max: float, iron_average: float, iron_units: str, crystal_direction: str)[source]

A Metadata class holding experimental information on a pyrrhenius model

Parameters:
titlestr

The title of the publication.

authorstr

The author(s) of the publication.

yearstr

The year the publication was published.

doistr

The DOI (Digital Object Identifier) of the publication.

phase_typestr

The type of phase the model applies to.

descriptionstr

A description of the publication or model.

sample_typestr

The type of sample used in the experiments.

equation_formstr

The form of the equation used in the model.

publication_idstr

A unique identifier for the publication.

entry_idstr

A unique identifier for the specific model entry.

complete_or_partial_fitstr

Indicates if the model is a complete or partial fit to the data.

composite_or_singlestr

Indicates if the model is a composite of multiple models or a single model.

pressure_averagefloat

The average pressure condition of the experiments. Units unspecified.

pressure_minfloat

The minimum pressure condition of the experiments. Units unspecified.

pressure_maxfloat

The maximum pressure condition of the experiments. Units unspecified.

temp_minfloat

The minimum temperature condition of the experiments in Kelvin.

temp_maxfloat

The maximum temperature condition of the experiments in Kelvin.

nacl_minfloat

The minimum NaCl concentration of the experiments. Units unspecified.

nacl_maxfloat

The maximum NaCl concentration of the experiments. Units unspecified.

nacl_averagefloat

The average NaCl concentration of the experiments. Units unspecified.

na2o_minfloat

The minimum Na2O concentration of the experiments. Units unspecified.

na2o_maxfloat

The maximum Na2O concentration of the experiments. Units unspecified.

na2o_averagefloat

The average Na2O concentration of the experiments. Units unspecified.

sio2_minfloat

The minimum SiO2 concentration of the experiments. Units unspecified.

sio2_maxfloat

The maximum SiO2 concentration of the experiments. Units unspecified.

sio2_averagefloat

The average SiO2 concentration of the experiments. Units unspecified.

co2_minfloat

The minimum CO2 concentration of the experiments. Units unspecified.

co2_maxfloat

The maximum CO2 concentration of the experiments. Units unspecified.

co2_averagefloat

The average CO2 concentration of the experiments. Units unspecified.

water_minfloat

The minimum water concentration of the experiments. Units given by water_units.

water_maxfloat

The maximum water concentration of the experiments. Units given by water_units.

water_averagefloat

The average water concentration of the experiments. Units given by water_units.

water_calibrationstr

Information on how the water concentration was calibrated or determined.

water_unitsstr

The units of the water concentration.

iron_minfloat

The minimum iron concentration of the experiments. Units given by iron_units.

iron_maxfloat

The maximum iron concentration of the experiments. Units given by iron_units.

iron_averagefloat

The average iron concentration of the experiments. Units given by iron_units.

iron_unitsstr

The units of the iron concentration.

crystal_directionstr

The crystal direction or orientation of the sample.

Raises:
NotImplementedError

if the water unit conversion suggested is not supported.

Methods

single_condition(parameter)

Checks if the minimum and maximum values for a given parameter are the same.

convert2ppm(water_average, water_units)

Converts the water_average to ppm based on the water_units.

get_water_average_ppm()

Returns the water_average converted to ppm using the water_units.

recalc_average_fields()

Recalculates the average fields from the min and max fields.

from_kwargs(**kwargs)

Creates a PublicationMetadata instance from the provided keyword arguments.

convert2ppm(water_average, water_units)[source]

Converts the water_average to ppm based on the water_units.

used to normalize water concentrations across different experiments

Parameters:
water_averagefloat

The water concentration to convert.

water_unitsstr

The units of the water concentration.

Returns:
float

The water concentration in ppm.

classmethod from_kwargs(**kwargs)[source]

Creates a PublicationMetadata instance from the provided keyword arguments.

classmethod get_additive_field_strings()[source]

Returns the prefixes of the additive fields.

classmethod get_float_field_prefixes()[source]

Returns the prefixes of the float fields.

classmethod get_static_field_strings()[source]

Returns the prefixes of the static fields.

classmethod get_units_and_calibrations()[source]

Returns the prefixes of the units and calibrations.

get_water_average_ppm()[source]

Converts the water_average to ppm based on the water_units.

used to normalize water concentrations across different experiments

Parameters:
water_averagefloat

The water concentration to convert.

recalc_average_fields()[source]

Recalculates the average fields from the min and max fields.

single_condition(parameter: str)[source]

Checks if the minimum and maximum values for a given parameter are the same.

Parameters:
parameterstr

The parameter to check. Should be one of the following: ‘pressure’, ‘water’, ‘nacl’, ‘co2’, ‘na2o’, ‘sio2’, ‘iron’

Returns:
bool

True if the minimum and maximum values are the same, False otherwise.

class pyrrhenius.model.WaterCorrection(model, correction_factor=1.0)[source]

Applies a Correction factor to Cw to any encapsulated model

This class is used to apply a correction factor to Cw to any encapsulated model, for example to noramlize the response of a model for appropriate comparison to another model developed using a different water calibration.

Parameters:
modelModelInterface

a Pyrrhenius model

correction_factorfloat, optional

the correction factor for water. Defaults to 1.0

Examples

>>> model = database.get_model('model_id')
>>> corrected_model = WaterCorrection(model,2.0)
>>> T = np.linspace(1000,2000,10)
>>> P = np.linspace(1,2,10)
>>> Cw = np.linspace(1,2,10)
>>> uncorrected_model_conductivity = model.get_conductivity(T=T,P=P,Cw=Cw)
>>> corrected_model_conductivity = corrected_model.get_conductivity(T=T,P=P,Cw=Cw)
>>> assert not np.array_equal(corrected_model_conductivity, uncorrected_model_conductivity)
Attributes:
get_id

gets the model id

uses_co2

Checks if the model uses CO2 as a parameter.

uses_fo2

Checks if the model uses fo2 as a parameter.

uses_iron

Checks if the model uses iron as a parameter.

uses_na2o

Checks if the model uses Na2O as a parameter.

uses_nacl

Checks if the model uses NaCl as a parameter.

uses_pressure

Checks if the model uses pressure as a parameter.

uses_sio2

Checks if the model uses SiO2 as a parameter.

uses_water

Checks if the model uses water as a parameter.

Methods

generate_representative_conditions([use_qfm])

generates a dictionary of conditions relevant to the experiment

get_conductivity(**kwargs)

returns the conductivity of the encapsulated model

get_row()

returns a pd.Series representation of the model

print_required_parameters()

Prints the keywords required to use get_conductivity()

get_conductivity(**kwargs)[source]

returns the conductivity of the encapsulated model

Not all parameters are required by all models. To see which parameters are required by the encapsulated model, use the model .print_required_parameters()

Parameters:
crystal_directionstr or float, optional

The crystallographic direction to query for specific conductivity. If a float is provided, it is used to calculate an anisotropic factor between 0 and 1.

averagingstr, optional

The method to average conductivity. Default is ‘geometric’. Options include: - ‘geometric’: Geometric mean of the available crystallographic directions. - ‘max_aniso’: Maximum anisotropic factor (conductivity in the most conductive direction). - ‘min_aniso’: Minimum anisotropic factor (conductivity in the least conductive direction).

Tfloat or np.ndarray , optional

The temperature value (default is None)

Pfloat or np.ndarray , optional

The pressure value in GPa (default is None)

co2float or np.ndarray , optional

The CO2 value (default is None)

Cwfloat or np.ndarray , optional

The water value (default is None)

naclfloat or np.ndarray , optional

The NaCl concentration in wt% (default is None)

sio2float or np.ndarray , optional

The SiO2 concentration in wt% (default is None)

na2ofloat or np.ndarray , optional

The na2o fraction (default is None)

logfo2float or np.ndarray , optional

The log oxygen fugacity value (default is None)

Xfefloat or np.ndarray , optional

The iron fraction value (default is None)

**kwargsdict

Additional keyword arguments

Returns:
np.ndarray or float

The calculated conductivity

Raises

AssertionError

error is raised if one or more keywords are not provided which are required by the mechanism

property get_id

gets the model id

Returns:
str

the model id

class pyrrhenius.model.WaterPTCorrection(model, correction_factor_call)[source]

Applies a Correction factor to Cw to any encapsulated model

Parameters:
modelModelInterface

a Pyrrhenius model

correction_factor_callfunction

a function that takes in P and T and returns a correction factor for Cw

Examples

>>> def correction_factor_call(P,T):
>>>     return 1.0
>>> corrected_model = WaterPTCorrection(uncorrected_model,correction_factor_call)
Attributes:
get_id

gets the model id

uses_co2

Checks if the model uses CO2 as a parameter.

uses_fo2

Checks if the model uses fo2 as a parameter.

uses_iron

Checks if the model uses iron as a parameter.

uses_na2o

Checks if the model uses Na2O as a parameter.

uses_nacl

Checks if the model uses NaCl as a parameter.

uses_pressure

Checks if the model uses pressure as a parameter.

uses_sio2

Checks if the model uses SiO2 as a parameter.

uses_water

Checks if the model uses water as a parameter.

Methods

generate_representative_conditions([use_qfm])

generates a dictionary of conditions relevant to the experiment

get_conductivity(**kwargs)

returns the cached conductivity of the encapsulated model with Cw set to 0.

get_facade_model_id()

returns the id of the encapsulated model

get_row()

returns a pd.Series representation of the model

print_required_parameters()

Prints the keywords required to use get_conductivity()

get_conductivity(**kwargs)[source]

returns the cached conductivity of the encapsulated model with Cw set to 0.

Not all parameters are required by all models. To see which parameters are required by the encapsulated model, use the model .print_required_parameters()

Parameters:
ignore_cachebool, optional

If True, the cache is ignored and the conductivity is recalculated.

crystal_directionstr or float, optional

The crystallographic direction to query for specific conductivity. Only active if the encapsulated model is an IsotropicMixture. If a float is provided, it is used to calculate an anisotropic factor between 0 and 1.

averagingstr, optional

The method to average conductivity. Default is ‘geometric’. Only active if the encapsulated model is an IsotropicMixture. Options include: - ‘geometric’: Geometric mean of the available crystallographic directions. - ‘max_aniso’: Maximum anisotropic factor (conductivity in the most conductive direction). - ‘min_aniso’: Minimum anisotropic factor (conductivity in the least conductive direction).

Tfloat or np.ndarray , optional

The temperature value (default is None)

Pfloat or np.ndarray , optional

The pressure value in GPa (default is None)

co2float or np.ndarray , optional

The CO2 value (default is None)

Cwfloat or np.ndarray , optional

The water value (default is None)

naclfloat or np.ndarray , optional

The NaCl concentration in wt% (default is None)

sio2float or np.ndarray , optional

The SiO2 concentration in wt% (default is None)

na2ofloat or np.ndarray , optional

The na2o fraction (default is None)

logfo2float or np.ndarray , optional

The log oxygen fugacity value (default is None)

Xfefloat or np.ndarray , optional

The iron fraction value (default is None)

**kwargsdict

Additional keyword arguments

Returns:
np.ndarray or float

The calculated conductivity

Raises

AssertionError

error is raised if one or more keywords are not provided which are required by the mechanism

get_facade_model_id()[source]

returns the id of the encapsulated model

Returns:
str

the id of the encapsulated model

property get_id

gets the model id

Returns:
str

the model id

pyrrhenius.model.create_model_from_row(row: Series | DataFrame)[source]

generates a Model object from a pandas series row

Parameters:
rowpd.Seriesorpd.DataFrame

a pandas row representing model parameters

Returns:
Model

a Pyrrhenius model

Pyrrhenius.mixing

class pyrrhenius.mixing.AbstractMixingModel(phases: List[ModelInterface])[source]

Abstract class for all mixing models

Methods

prep_phase_fractions(fractions)

Prepares the phase fractions for the mixture

get_conductivity

prep_phase_fractions(fractions)[source]

Prepares the phase fractions for the mixture

Parameters:
phase_fractionsUnion[np.ndarray,float, List[float]]

the volume fractions of the conductive phase

Returns:
np.ndarray

the volume fractions of each phase

Raises:
AssertionError

if the phase fractions do not sum to 1

class pyrrhenius.mixing.ArchiesLaw(phases, c=1, n=1)[source]

Represents the conductivity of a mixture using Archie’s law

The parameterization looks like:

\[\sigma_{total} = C\cdot \phi^n \cdot \sigma_c\]

where \(\sigma_c\) is the conductivity of a conductive phase in a resistive medium, such that

\[\sigma_c >> \sigma_r\]

Methods

get_conductivity(fraction, **kwargs)

Calculates the conductivity of the mixture

prep_phase_fractions(fractions)

Prepares the phase fractions for the mixture

get_conductivity(fraction, **kwargs)[source]

Calculates the conductivity of the mixture

Parameters:
fractionfloat or np.ndarray

the porosity of the mixture

kwargsdict

the keyword arguments to pass to the conductivity function

Returns:
float or np.ndarray

the conductivity of the mixture

class pyrrhenius.mixing.ArchiesLawGlover(phases, m=1.9)[source]

a reparameterization of archies law to reduce the number of unknown coefficients first described by Glover et al., (2000)

the parameterization looks like:

\[\sigma_{total} = \sigma_r \cdot (1 - \phi)^p + \sigma_c \cdot \phi^m\]

where

\[p = \frac{log(1 - \phi^m)}{log(1 - \phi)}\]

suggested values for m are:

  • m: 1.9 for brine in peridotite: (Huang et al., 2021)

  • m: 1.05 for silicic melts (Gaillard et al., 2005)

  • m: 1.2 to match basalt within peridotite (Yoshino et al., 2010)

Methods

get_conductivity(fractions, **kwargs)

Calculates the conductivity of the mixture

prep_phase_fractions(fractions)

Prepares the phase fractions for the mixture

get_conductivity(fractions, **kwargs)[source]

Calculates the conductivity of the mixture

Parameters:
fractionsfloat or np.ndarray

the volume fractions of the mixture

kwargsdict

the keyword arguments to pass to the conductivity function

Returns:
float or np.ndarray

the conductivity of the mixture

class pyrrhenius.mixing.ArithmeticAverage(phases)[source]

Represents the arithmetic average of the conductivities of the phases

The arithmetic average is defined as:

\[\sigma_{total} = \sum f_i \cdot \sigma_i\]

Methods

get_conductivity(fractions, **kwargs)

Calculates the conductivity of the mixture

prep_phase_fractions(fractions)

Prepares the phase fractions for the mixture

get_conductivity(fractions, **kwargs)[source]

Calculates the conductivity of the mixture

Parameters:
kwargsdict

the keyword arguments to pass to the conductivity function

Returns:
float or np.ndarray

the conductivity of the mixture

class pyrrhenius.mixing.BruggemanSolver(models, polarizations, phase_fractions, **kwargs)[source]

Bruggeman solver for the effective medium theory

The Bruggeman symmetrical equation is the most widely used EMT equation. It is sometimes known as the Bruggemane Landauer equation. The system is considered to be an aggregate of unconnected units.

The bulk conductivity of the system is parameterized as:

\[\sum_i f_i \frac{\sigma_i - \sigma_{bulk}}{\sigma_i + (P_i^{-1} - 1) \cdot \sigma_{bulk}} = 0\]

Where \(\sigma_i\) is the conductivity of the i-th phase, \(f_i\) is the volume fraction of the i-th phase, and \(P_i\) is the polarization factor of the i-th phase. For a homogeneous medium filled with spherical inclusions, \(P_i\) is equal to 1/3. \(P_i\) goes to zero as inclusions approach rod-like forms.

The variant implemented here assumes any amount of phase fractions may be passed, and thus, \(\sigma_{bulk}\) must be numerically solved. For this purpose, a vectorized variant of the binary search algorithm is employed.

IMPORTANT:

  1. The Bruggeman solver is not guaranteed to converge for all combinations of models and phase fractions. If it does not converge, check the absolute values of the conductive phases.

  2. Additionally, the solver is meant to be used with the EffectiveMediumTheoryMixture class. You may use this class out of the box, but use of the EffectiveMediumTheoryMixture class is recommended.

Methods

__call__(bulk)

Evaluates the residual of the Bruggeman equation given an estimated bulk conductivity.

class pyrrhenius.mixing.CubeModel(phases, variant='waff74-1')[source]

Represents the conductivity of a lattice of cubes separated by thin sheets. Also known as the thin film model.

Three variants are implemented:

Three variants are implemented:

  1. “waff74-1”: From equation 34 in “Theoretical considerations of the electrical conductivity in a partially molten mantle and implications for geothermometry”, Waff et al., (1974)

\[\sigma_{total} = (1 -(1-\phi)^(2/3) ) \cdot \sigma_c\]
  1. “waff74-2”: From equation 33 in “Theoretical considerations of the electrical conductivity in a partially molten mantle and implications for geothermometry”, Waff et al., (1974)

\[\sigma_{total} = \sigma_c \cdot \sigma_r \cdot \frac{ (1 - \phi)^{2/3} }{ \sigma_c \cdot (1 - \phi)^{1/3} + \sigma_r \cdot (1 - (1-\phi)^{1/3}) }\]
  1. “P00”: From equation 1 in “The influence of partial melting on the electrical behavior of crustal rocks: laboratory examinations, model calculations and geological interpretations”, Partzsch et al., (2000)

\[\sigma_{total} = \frac{1}{ (1 - \phi) / \sigma_r + \phi / \sigma_c }\]

Where \(\sigma_r\) is the conductivity of the assumed resistive matrix and \(\sigma_c\) is the conductivity of the smaller fraction conductive phase.

Methods

get_conductivity(fractions, **kwargs)

Calculates the conductivity of the mixture

prep_phase_fractions(fractions)

Prepares the phase fractions for the mixture

get_conductivity(fractions, **kwargs)[source]

Calculates the conductivity of the mixture

Parameters:
fractionsfloat or np.ndarray

the volume fractions of the conductive phase

kwargsdict

the keyword arguments to pass to the conductivity function

Returns:
float or np.ndarray

the conductivity of the mixture

class pyrrhenius.mixing.EffectiveMediumTheoryMixture(phases=None, type='Bruggeman')[source]

Mixing model based on the effective medium theory

The effective medium theory is a method to predict the macroscopic conductivity of a mixture of materials. It is based on the assumption that the mixture is a random distribution of the individual phases.

Methods

get_conductivity([phase_fractions, ...])

Calculates the conductivity of the mixture

prep_phase_fractions(fractions)

Prepares the phase fractions for the mixture

set_polarization_factors(polarization_factors)

Sets the polarization factors for the phases

get_conductivity(phase_fractions=None, polarization_factors=None, **kwargs)[source]

Calculates the conductivity of the mixture

Parameters:
phase_fractionslist

the fractions of the phases

polarization_factorslist

the polarization factors of the phases. Defaults to 1/3 for all phases. For reference, 1/3 is the polarization factor for a sphere and 0 is the polarization factor for a rod.

kwargsdict

the keyword arguments to pass to the conductivity function for the mixture

Returns:
float or np.ndarray

the conductivity of the mixture

set_polarization_factors(polarization_factors)[source]

Sets the polarization factors for the phases

Parameters:
phase_listlist

the list of phases

polarization_factorslist

the polarization factors of the phases

Returns:
list

the polarization factors of the phases

Raises
AssertionError

if the polarization factors are not between 0 and 1/3

class pyrrhenius.mixing.GeomAverage(phases: List[ModelInterface])[source]

Represents the geometric average of the conductivities of the phases

The geometric average is defined as:

\[\sigma_{total} = \prod \sigma_i^{f_i}\]

Methods

get_conductivity([fractions])

Calculates the conductivity of the mixture

prep_phase_fractions(fractions)

Prepares the phase fractions for the mixture

get_conductivity(fractions=None, **kwargs)[source]

Calculates the conductivity of the mixture

Parameters:
fractionsdict

the volume fractions of each phase

kwargsdict

the keyword arguments to pass to the conductivity function

class pyrrhenius.mixing.HashinStrickmanBound(phases: List[ModelInterface])[source]

Represents the Hashin-Shtrikman bound for the conductivity of a mixture

The Hashin-Shtrikman bound simulates the conductivity of spheres embedded in a matrix.

\[\begin{split}\sigma_{total} = \frac{1}{\\sum \frac{f_i}{\sigma_i +2*\sigma_{min/max}}} - 2*\sigma_{min/max}\end{split}\]

Methods

get_conductivity(fractions[, type])

Calculates the conductivity of the mixture

prep_phase_fractions(fractions)

Prepares the phase fractions for the mixture

get_conductivity(fractions: ndarray | float | List[float], type='max', **kwargs)[source]

Calculates the conductivity of the mixture

Parameters:
fractionsUnion[np.ndarray,float, List[float]]

the volume fractions of the conductive phase

typestr

the type of the Hashin-Shtrikman bound to use. Options are ‘max’ or ‘min’.

kwargsdict

the keyword arguments to pass to the conductivity function

Returns:
float or np.ndarray

the conductivity of the mixture

class pyrrhenius.mixing.ParallelModel(phases: List[ModelInterface])[source]

Represents the conductivity of two phases connected in parallel. The parameterization looks like:

\[\sigma_{total} = \sum f_i\sigma_i\]

Methods

get_conductivity(fractions, **kwargs)

Calculates the conductivity of the mixture

prep_phase_fractions(fractions)

Prepares the phase fractions for the mixture

get_conductivity(fractions, **kwargs)[source]

Calculates the conductivity of the mixture

Parameters:
fractionsUnion[np.ndarray,float, List[float]]

the volume fractions of the conductive phase

kwargsdict

the keyword arguments to pass to the conductivity function

Returns:
float or np.ndarray

the conductivity of the mixture

class pyrrhenius.mixing.SeriesModel(phases)[source]

Represents the conductivity of several phases connected in series. The parameterization looks like:

\[1/\sigma_{total} = \sum f_i / \sigma_i\]

Methods

get_conductivity(fractions, **kwargs)

Calculates the conductivity of the mixture

prep_phase_fractions(fractions)

Prepares the phase fractions for the mixture

get_conductivity(fractions, **kwargs)[source]

Calculates the conductivity of the mixture

Parameters:
fractionsfloat or np.ndarray

the porosity of the mixture/ the volume fraction of the inclusion

kwargsdict

the keyword arguments to pass to the conductivity function

class pyrrhenius.mixing.TubesModel(phases: ModelInterface)[source]

Represents the conductivity of a tube-like lattice embedded in a matrix

The parameterization looks like:

\[\sigma_{total} = \sigma_r \cdot (1 - \phi) + \sigma_c \cdot \phi\]

Methods

get_conductivity(fractions, **kwargs)

Calculates the conductivity of the mixture

prep_phase_fractions(fractions)

Prepares the phase fractions for the mixture

get_conductivity(fractions, **kwargs)[source]

Calculates the conductivity of the mixture

Parameters:
fractionsfloat or np.ndarray

the phase fractions of the mixture

kwargsdict

the keyword arguments to pass to the conductivity function

Pyrrhenius.utils

Binary search algorithm used to

Parameters:
experimentfunction

the conductivity model

target_valuesnp.ndarray

the target values of the conductivity model

boundstuple

the bounds of the conductivity model

kwargsdict

the keyword arguments to pass to the conductivity model

tolerancefloat

the tolerance of the conductivity model

relativebool

if True, the tolerance is relative

debugbool

if True, the debug information is printed

max_iterationsint

the maximum number of iterations

Returns:
np.ndarray

the root of the conductivity model

pyrrhenius.utils.calc_IW(T, P)[source]

Calculate the Iron-Wustite buffer based on Pressure and Temperature

Adapted from the plotting scripts of Iacovino, Kayla. (2022). Calculate fO2 Buffer (1.5). Zenodo. https://doi.org/10.5281/zenodo.7387196

Parameters:
Tfloat or np.ndarray

Temperature in Kelvin

Pfloat or np.ndarray

Pressure in bars

Returns:
float or np.ndarray

The calculated IW buffer value in log10(fo2) units

pyrrhenius.utils.calc_QFM(T, P)[source]

Calculate the Quartz-Fayallite-Magnetite buffer across Pressure and Temperature Conditons

Adapted from the plotting scripts of Iacovino, Kayla. (2022). Calculate fO2 Buffer (1.5). Zenodo. https://doi.org/10.5281/zenodo.7387196

Parameters:
Tfloat or np.ndarray

Temperature in Kelvin

Pfloat or np.ndarray

Pressure in bars

Returns:
float or np.ndarray

The calculated QFM buffer value in log10(fo2) units

pyrrhenius.utils.create_starting_variable(starting_value=0, P=None, T=None, logfo2=None, Xfe=None, Cw=None, co2=None, nacl=None, na2o=None, sio2=None, **kwargs)[source]

Generates a float or np.ndarray of a shape consistent with the provided keyword arguments

Currently checks keywords for P, T, logfo2, Xfe, Cw, co2, nacl, na2o, and sio2

Parameters:
starting_valuefloat, optional

The variable value for conductivity casting, defaults to 0.

**kwargsdict

Additional parameters used to calculate conductivity

Returns:
float or np.ndarray

The determined dummy conductivity variable used to cast the get_conductivity result into the proper shape.

pyrrhenius.utils.format_ax_arrhenian_space(ax, xlim=[5, 20], ylim=[0.0001, 1], linear_x_units='K', inverse_x_units='K', yunits='$\\sigma$ (S/m)', xscale=10000.0, linear_major_ticks=None, linear_minor_ticks=None, inverse_ticks=None)[source]

Format an axis for an Arrhenius plot with a top linear scale and a bottom inverse temperature scale. The y axis is shared with an assumed logarithmic scale.

For use with a matplotlib axis.

Parameters:
axmatplotlib.axes.Axes

The matplotlib Axes object to format.

xlimlist of float, optional

The limits for the inverse temperature x-axis in 1e4/T (K) [t_min, t_max]. Default is [5, 20].

ylimlist of float, optional

The limits for the y-axis. Default is [1e-4, 1].

linear_x_unitsstr, optional

The units for the linear temperature scale. Default is ‘K’.

inverse_x_unitsstr, optional

The units for the inverse temperature scale. Default is ‘K’.

yunitsstr, optional

The units for the y-axis. Default is r’$sigma$’.

xscalefloat, optional

The scaling factor for the inverse temperature axis. Default is 1e4.

linear_major_ticksarray-like, optional

Major tick positions for the linear temperature axis. Default is None, which auto-generates ticks.

linear_minor_ticksarray-like, optional

Minor tick positions for the linear temperature axis. Default is None, which auto-generates ticks.

inverse_ticksarray-like, optional

Tick positions for the inverse temperature axis. Default is None, which auto-generates ticks.

Returns:
ax2

a matplotlib.axes object sharing the same y value