Phases Module#
- class thermoengine.phases.base_phase.Phase(abbrev: str, phs_calc: PhaseCalculator, XTOL=1e-12)#
Abstract parent class defining generic phase properties.
The user must use a subclass, like PurePhase or SolutionPhase, which implements the Phase interface.
- Parameters:
- phase_classnmstr
Official class name for phase (implemented in src code). String has the form classname if source is objc, else:
if !calib [‘cy’, ‘phase name’, ‘module name’, ‘’]
if calib [‘cy’, ‘phase name’, ‘module name’, ‘calib’, ‘’]
- abbrevstr
Official abbreviation of phase (regardless of implementation).
- calibbool, default True
Indicates whether sample phase should be calibration ready.
- sourcestr
Code source for phase implementation. Default is ‘objc’ (code in objective-C that is part of the original code base). Alternative is ‘coder’ (code generated by the coder module).
- coder_modulestr
Name of the coder module that contains the phase classes. See documentation for model.Database for additional information and examples.
- Attributes:
abbrevOfficial unique abbreviation for phase
calibIndicates whether phase calibration is enabled
- class_name
endmember_idsID number of each endmember in phase
endmember_namesName of each endmember
endmember_numNumber of endmembers in phase
formulaArray of formulas for each endmember of phase
identifierIdentifier of phase
- module
MOLWTSArray of molecular weights of oxides
OXIDESArray of oxide names
param_namesArray of parameter names
param_propsDictionary of phase model parameters
phase_nameName of phase
phase_objInstance of the phase object
phase_typePhase type
propsDictionary of phase properties
- source
Methods
activity(T, P[, mol, V, deriv, deriv_param, ...])Calculate activity (or derivatives) for phase.
bulk_mod(T, P[, mol, V, const, deriv, ...])Calculate bulk modulus (or derivatives) for phase.
check_missing_components([mol])Check whether a composition contains missing components.
chem_potential(T, P[, mol, V, deriv, ...])Calculate chemical potential (or derivatives) for phase.
compressibility(T, P[, mol, V, const, ...])Calculate compressibility (or derivatives) for phase.
density(T, P[, mol, V, deriv, deriv_param, ...])Calculate density (or derivatives) for phase.
Unset Gibbs energy of the reference state.
Set Gibbs energy of the reference state.
enthalpy(T, P[, mol, V, deriv, deriv_param, ...])Calculate enthalpy (or derivatives) for phase.
entropy(T, P[, mol, V, deriv, deriv_param, ...])Calculate entropy (or derivatives) for phase.
fugacity(T, P[, mol, V, deriv, deriv_param, ...])Calculate activity (or derivatives) for phase.
gamma(T, P[, mol, V, deriv, deriv_param, ...])Calculate grüneisen parameter (or derivatives) for phase.
get_param_values([param_names, all_params])Get current values for listed parameters.
get_phase_amount_from_elements(elements[, kind])Convert list of elements to quantity of phase.
gibbs_energy(T, P[, mol, V, deriv, ...])Calculate Gibbs energy (or derivatives) for phase.
heat_capacity(T, P[, mol, V, const, deriv, ...])Calculate heat capacity (or derivatives) for phase.
helmholtz_energy(T, P[, mol, V, deriv, ...])Calculate helmholtz energy (or derivatives) for phase.
internal_energy(T, P[, mol, V, deriv, ...])Calculate internal energy (or derivatives) for phase.
param_units([param_names, all_params])Get units for listed parameters.
set_param_values([param_names, param_values])Set new values for listed parameters.
set_ref_state([Tr, Pr, Trl])Set reference state P/T conditions.
thermal_exp(T, P[, mol, V, deriv, ...])Calculate heat capacity (or derivatives) for phase.
validate()volume(T, P[, mol, V, deriv, deriv_param, ...])Calculate volume (or derivatives) for phase.
affinity_and_comp
affinity_and_comp_legacy
Notes
This code is highly dependent on implementation and is likely to change dramatically with changes in the underlying code that calculates phase properties.
The pure water phase, “H2O”, is very complex and thus not available for calibration. The water phase will force its calib flag to False, regardless of input value.
- property MOLWTS#
Array of molecular weights of oxides
- Returns:
- Numpy array of molecular weights, (nparray)
- property OXIDES#
Array of oxide names
- Returns:
- Array of oxide names, [str,…]
- property abbrev: str#
Official unique abbreviation for phase
- Returns:
- Abbreviation (str)
- activity(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=True, endmember=None, const=None, species=None)#
Calculate activity (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- endmemberNone or int scalar or int array
If None, retrieve an array of chemical potentials; else chemical potential for endmber index or index set in array
- Returns:
- valuearray-like
Activity (or derivatives in deriv units).
- bulk_mod(T, P, mol=None, V=None, const='T', deriv=None, deriv_param=None, mol_deriv_qty=True, endmember=None, species=None)#
Calculate bulk modulus (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- const[‘T’, ‘S’], optional
Defines constant path for derivative (yielding K_T vs K_S)
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- Returns:
- valuearray-like
Bulk modulus in bars (or derivatives in deriv units).
- property calculator#
Python module attribute for coder generated functions
- Returns:
- module
Module attribute returned from importlib.import_module, else None if source is ‘objc’
- property calib#
Indicates whether phase calibration is enabled
- Returns:
- valuebool
True or False, for whether calibration is enabled
- check_missing_components(mol: ndarray[Any, dtype[float64]] | None = None) ndarray[Any, dtype[bool_]]#
Check whether a composition contains missing components.
- Parameters:
- molNDArray, default: None
The mol composition of the phase
- Returns:
- NDArray[bool]
Whether each component is missing or not (True = missing)
- chem_potential(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=True, endmember=None, species=False, const=None)#
Calculate chemical potential (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- endmemberNone or int scalar or int array
If None, retrieve an array of chemical potentials, else chemical potential for endmember index or index set in array
- speciesboolean
If False, returned value is for components of the solution. If True, returned value is for species in the solution.
- Returns:
- valuearray-like
Chemical potential in J (or derivative in deriv units).
- compressibility(T, P, mol=None, V=None, const='T', deriv=None, deriv_param=None, mol_deriv_qty=True, endmember=None, species=None)#
Calculate compressibility (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- const[‘T’, ‘S’], optional
Defines constant path for derivative (yielding Beta_T vs Beta_S)
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- Returns:
- valuearray-like
Bulk modulus in 1/bars (or derivatives in deriv units).
- density(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=None, endmember=None, const=None, species=None)#
Calculate density (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- Returns:
- valuearray-like
Density in g*bar/J (or derivative in deriv units).
- disable_gibbs_energy_reference_state()#
Unset Gibbs energy of the reference state.
Notes
Call method on any phase class, and it automatically applies to all.
- enable_gibbs_energy_reference_state()#
Set Gibbs energy of the reference state.
Notes
Call method on any phase class, and it automatically applies to all.
- property endmember_elem_comp#
Endmember elemental composition (compact)
- Returns:
- Dataframe (or matrix) with elemental composition (cols)
- for each endmember (rows). Only includes elements that are part of the
- solution phase.
- property endmember_element_comps: ndarray[Any, dtype[int64]]#
Array of element comps for each endmember of phase
- Returns:
- Element comps for phase endmembers (Array[float])
- property endmember_formulas: ndarray[Any, dtype[str_]]#
Array of formulas for each endmember of phase
- Returns:
- Formulas of phase endmembers (Array[str])
- property endmember_ids#
ID number of each endmember in phase
- Returns:
- Array of ids, [int,…]
- property endmember_mol_oxide_comps: ndarray[Any, dtype[float64]]#
Array of mol oxides for each endmember of phase
- Returns:
- Number of moles of oxides for phase endmembers (Array[float])
- property endmember_molwts: ndarray[Any, dtype[float64]]#
Array of mol-weights for each endmember of phase
- Returns:
- Mol-wts for phase endmembers (Array[float])
- property endmember_names: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]#
Name of each endmember
- Returns:
- List of endmember names for this solution phase, [str,…]
- property endmember_num: int#
Number of endmembers in phase
- Returns:
- Number of endmembers in phase (int)
- property endmember_number_of_atoms: ndarray[Any, dtype[int64]]#
Array of number of atoms for each endmember of phase
- Returns:
- Number of atoms for phase endmembers (Array[float])
- enthalpy(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=None, endmember=None, const=None, species=None)#
Calculate enthalpy (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin
- Parray-like
Pressure in bars
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- Returns:
- valuearray-like
Enthalpy in J (or derivative in deriv units).
- entropy(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=None, endmember=None, const=None, species=None)#
Calculate entropy (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- Returns:
- valuearray-like
Entropy in J/K (or derivative in deriv units).
- property exchange_equil#
Exchange equilibrium object responsible for calculating metastable equilibrium properties of the phase
- Returns:
- Exchange Equilibrium object
- property formula: ndarray[Any, dtype[str_]]#
Array of formulas for each endmember of phase
NOTE: To be deprecated
- Returns:
- Formulas of phase endmembers (Array[str])
- fugacity(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=True, endmember=None, const=None, species=None)#
Calculate activity (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- Returns:
- valuearray-like
Fugacity in bars (or derivatives in deriv units).
- gamma(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=True, endmember=None, const=None, species=None)#
Calculate grüneisen parameter (or derivatives) for phase.
NOT IMPLEMENTED
- get_param_values(param_names=[], all_params=False)#
Get current values for listed parameters.
- Parameters:
- param_namesstr array
List of parameter names
- all_paramsbool, default False
If true, returns units for all parameters
- Returns:
- valuesdouble array
List of values for selected parameters
- get_phase_amount_from_elements(elements, kind='mass')#
Convert list of elements to quantity of phase.
- Parameters:
- elementsdouble array
Number of each element
- kind{‘mass’,’moles’}
Determines how phase amount is determined (mass vs. moles)
- Returns:
- amountdouble
Amount of phase (expressed according to kind)
- gibbs_energy(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=None, endmember=None, const=None, species=None)#
Calculate Gibbs energy (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin
- Parray-like
Pressure in bars
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases)
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (Default is zero for all params.)
- deriv_paramarray of strs
Parameter names that identify returned derivatives (Default is None.)
- Returns:
- valuearray-like
Gibbs energy in J (or derivative in deriv units)
- heat_capacity(T, P, mol=None, V=None, const='P', deriv=None, deriv_param=None, mol_deriv_qty=True, endmember=None, species=None)#
Calculate heat capacity (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- const[‘P’, ‘V’], optional
Defines constant path for derivative (yielding C_P vs C_V)
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- Returns:
- valuearray-like
Thermal expansion in J/K (or derivatives in deriv units).
- helmholtz_energy(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=None, endmember=None, const=None, species=None)#
Calculate helmholtz energy (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- Returns:
- valuearray-like
Helmholtz energy in J (or derivative in deriv units).
- property identifier#
Identifier of phase
- Returns:
- Identifier of phase (str)
- internal_energy(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=None, endmember=None, const=None, species=None)#
Calculate internal energy (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- Returns:
- valuearray-like
Internal energy in J (or derivative in deriv units).
- property oxide_space: ndarray[Any, dtype[bool_]]#
Array of bools indicating if phase can contain each oxide
- Returns:
- Whether each oxide is in the phase or not
- property param_names#
Array of parameter names
- Returns:
- Array of names for each parameter of the phase model, [str,…]
- property param_props#
Dictionary of phase model parameters
This dictionary defines parameter properties for the phase, using these keys:
supports_calibboolFlag indicating whether phase allows calibration
param_numintNumber of parameters
param_namesstr arrayName of each parameter
param_unitsstr arrayUnits for each parameter
param0double arrayInitial parameter values
- Returns:
- Dictionary of phase model parametersdict
A dictionary of phase model parameters
- param_units(param_names=[], all_params=False)#
Get units for listed parameters.
- Parameters:
- param_namesstr array
List of parameter names
- all_paramsbool, default False
If true, returns units for all parameters
- Returns:
- unitsdouble array
List of units for selected parameters
- property phase_name: str#
Name of phase
- Returns:
- Name of phase (str)
- property phase_obj#
Instance of the phase object
- Returns:
- Object instance
- property phase_type#
Phase type
- Returns:
- Phase type (str)
Permissible values are ‘pure’ or ‘solution’.
- property props#
Dictionary of phase properties
The dictionary defines phase properties with these keys:
abbrevstrOfficial unique phase abbreviation
namestrName of phase (implementation dependent)
class_namestrOfficial class name for phase (implemented in src code)
formulastrFormula of phase
natomintNumber of atoms in formula unit
molwtdoubleMolecular weight of phase (in g/mol-formula-unit)
elemental_entropydoubleEstimated entropy from elemental formula (from Robie et al. 1979)
element_symbolsstr arraySymbol array string
element_compint arrayPhase formula in terms of number of each element
- Returns:
- A Python dictionarydict
A dictionary of phase properties
Notes
Need to update these dictionary values to be vectors for solution phases
- set_param_values(param_names=[], param_values=[])#
Set new values for listed parameters.
- Parameters:
- param_namesstr array
List of parameter names
- param_valuesdouble array
List of parameter values
- set_ref_state(Tr=298.15, Pr=1.0, Trl=298.15)#
Set reference state P/T conditions.
- Parameters:
- Trdouble, default 298.15
Reference temperature in Kelvin
- Prdouble, default 1.0
Reference pressure in bars
- Trldouble, default 298.15
Reference temperature for lambda heat capacity correction in Kelvin
- property species_elem_comp#
Species elemental composition (compact)
- Returns:
- Dataframe (or matrix) with elemental composition (cols)
- for each species(rows). Only includes elements that are part of the
- solution phase.
- property species_element_comps: ndarray[Any, dtype[float64]]#
Array of element comps for each species in phase
- Returns:
- Element comps for phase species (Array[float])
- property species_names: ndarray[Any, dtype[str_]]#
Names of the species in phase
- Returns:
- Names of species in phase (Array[str])
- property species_num: int#
Number of species in phase
- Returns:
- Number of species in phase (int)
- property species_stoic#
Species Stoichiometry
- Returns:
- Dataframe (or matrix) with molar endmember stoichiometry (cols)
- for each species (rows). Expresses species in terms of independent
- endmembers.
- property species_stoic_T#
Species Stoichiometry Transpose
- Returns:
- Dataframe (or matrix) with molar endmember stoichiometry (rows)
- for each species (cols). Expresses species in terms of independent
- endmembers.
- thermal_exp(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=True, endmember=None, const=None, species=None)#
Calculate heat capacity (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- Returns:
- valuearray-like
Thermal expansion in 1/K (or derivatives in deriv units).
- volume(T, P, mol=None, V=None, deriv=None, deriv_param=None, mol_deriv_qty=None, endmember=None, const=None, species=None)#
Calculate volume (or derivatives) for phase.
- Parameters:
- Tarray-like
Temperature in Kelvin.
- Parray-like
Pressure in bars.
- molarray-like, optional
Composition in terms of mols of endmembers (unneeded for pure phases).
- Varray-like, optional (default None)
Volume in J/bar. Overrides pressure if not None.
- derivdict of ints
Derivative order for each parameter (default is zero for all params).
- Returns:
- valuearray-like
Volume in J/bar (or derivative in deriv units).
- class thermoengine.phases.pure_phase.PurePhase(abbrev, phs_calc: PhaseCalculator, XTOL=1e-12)#
Pure stoichiometric phases.
Implements the Phase interface.
- Parameters:
- phase_classnmstr
Official class name for phase (implemented in src code)
- abbrevstr
Official abbreviation of phase (regardless of implementation)
- calibbool, default True
Indicates whether sample phase should be calibration ready
- Attributes:
Berman_formulaRepresentation of formula using Berman format
Methods
activity(T, P[, mol, V, deriv, deriv_param, ...])Calculate activity (or derivatives) for phase.
bulk_mod(T, P[, mol, V, const, deriv, ...])Calculate bulk modulus (or derivatives) for phase.
check_missing_components([mol])Check whether a composition contains missing components.
chem_potential(T, P[, mol, V, deriv, ...])Calculate chemical potential (or derivatives) for phase.
compressibility(T, P[, mol, V, const, ...])Calculate compressibility (or derivatives) for phase.
density(T, P[, mol, V, deriv, deriv_param, ...])Calculate density (or derivatives) for phase.
disable_gibbs_energy_reference_state()Unset Gibbs energy of the reference state.
enable_gibbs_energy_reference_state()Set Gibbs energy of the reference state.
enthalpy(T, P[, mol, V, deriv, deriv_param, ...])Calculate enthalpy (or derivatives) for phase.
entropy(T, P[, mol, V, deriv, deriv_param, ...])Calculate entropy (or derivatives) for phase.
fugacity(T, P[, mol, V, deriv, deriv_param, ...])Calculate activity (or derivatives) for phase.
gamma(T, P[, mol, V, deriv, deriv_param, ...])Calculate grüneisen parameter (or derivatives) for phase.
get_param_values([param_names, all_params])Get current values for listed parameters.
get_phase_amount_from_elements(elements[, kind])Convert list of elements to quantity of phase.
gibbs_energy(T, P[, mol, V, deriv, ...])Calculate Gibbs energy (or derivatives) for phase.
heat_capacity(T, P[, mol, V, const, deriv, ...])Calculate heat capacity (or derivatives) for phase.
helmholtz_energy(T, P[, mol, V, deriv, ...])Calculate helmholtz energy (or derivatives) for phase.
internal_energy(T, P[, mol, V, deriv, ...])Calculate internal energy (or derivatives) for phase.
param_units([param_names, all_params])Get units for listed parameters.
set_param_values([param_names, param_values])Set new values for listed parameters.
set_ref_state([Tr, Pr, Trl])Set reference state P/T conditions.
thermal_exp(T, P[, mol, V, deriv, ...])Calculate heat capacity (or derivatives) for phase.
validate()volume(T, P[, mol, V, deriv, deriv_param, ...])Calculate volume (or derivatives) for phase.
affinity_and_comp
affinity_and_comp_legacy
not_coded
Notes
This code is highly dependent on implementation and is likely to change dramatically with changes in the underlying code that calculates phase properties.
The pure water phase, “H2O”, is very complex and thus not available for calibration. The water phase will force its calib flag to False, regardless of input value.
In addition to the attributes listed, this class inherits the Phase class attributes.
- property Berman_formula#
Representation of formula using Berman format
- Returns:
- Chemical formula of phase (str)
- class thermoengine.phases.solution_phase.SolutionPhase(abbrev, phs_calc, XTOL=1e-12)#
Solid solution phases.
Implements the Phase interface.
- Parameters:
- phase_classnmstr
Official class name for phase (implemented in src code).
- abbrevstr
Official abbreviation of phase (regardless of implementation).
- calibbool, default True
Indicates whether sample phase should be calibration ready.
- Attributes:
- Attributes for this class are inherited from the Phase class.
Methods
activity(T, P[, mol, V, deriv, deriv_param, ...])Calculate activity (or derivatives) for phase.
bulk_mod(T, P[, mol, V, const, deriv, ...])Calculate bulk modulus (or derivatives) for phase.
calc_endmember_comp(mol_oxide_comp[, ...])Get fraction of each endmember given the composition.
check_missing_components([mol])Check whether a composition contains missing components.
chem_potential(T, P[, mol, V, deriv, ...])Calculate chemical potential (or derivatives) for phase.
compressibility(T, P[, mol, V, const, ...])Calculate compressibility (or derivatives) for phase.
compute_formula(T, P, mol_comp)Converts an input array of moles of endmember components to the chemical formula of the phase
convert_elements(mol_elm[, output])Converts an array of mole numbers of elements (in the standard order) to the specified output quantity
convert_endmember_comp(mol_comp[, output])Converts an input array of moles of endmember components to the specified quantity
convert_species_to_comp(mol_species[, method])Converts an input array of moles of species to moles of endmember components
covert_endmember_comp(mol_comp[, output])density(T, P[, mol, V, deriv, deriv_param, ...])Calculate density (or derivatives) for phase.
disable_gibbs_energy_reference_state()Unset Gibbs energy of the reference state.
enable_gibbs_energy_reference_state()Set Gibbs energy of the reference state.
enthalpy(T, P[, mol, V, deriv, deriv_param, ...])Calculate enthalpy (or derivatives) for phase.
entropy(T, P[, mol, V, deriv, deriv_param, ...])Calculate entropy (or derivatives) for phase.
fugacity(T, P[, mol, V, deriv, deriv_param, ...])Calculate activity (or derivatives) for phase.
gamma(T, P[, mol, V, deriv, deriv_param, ...])Calculate grüneisen parameter (or derivatives) for phase.
get_endmember_ind(mol_oxide_comp[, ...])Get index of endmember that best matches composition.
get_param_values([param_names, all_params])Get current values for listed parameters.
get_phase_amount_from_elements(elements[, kind])Convert list of elements to quantity of phase.
gibbs_energy(T, P[, mol, V, deriv, ...])Calculate Gibbs energy (or derivatives) for phase.
heat_capacity(T, P[, mol, V, const, deriv, ...])Calculate heat capacity (or derivatives) for phase.
helmholtz_energy(T, P[, mol, V, deriv, ...])Calculate helmholtz energy (or derivatives) for phase.
internal_energy(T, P[, mol, V, deriv, ...])Calculate internal energy (or derivatives) for phase.
param_units([param_names, all_params])Get units for listed parameters.
set_param_values([param_names, param_values])Set new values for listed parameters.
set_ref_state([Tr, Pr, Trl])Set reference state P/T conditions.
test_endmember_comp(mol_comp)Tests validity of endmember component moles array
thermal_exp(T, P[, mol, V, deriv, ...])Calculate heat capacity (or derivatives) for phase.
validate()volume(T, P[, mol, V, deriv, deriv_param, ...])Calculate volume (or derivatives) for phase.
affinity_and_comp
affinity_and_comp_legacy
not_coded
Notes
This code is highly dependent on implementation and is likely to change dramatically with changes in the underlying code that calculates phase properties.
The pure water phase, “H2O”, is very complex and thus not available for calibration. The water phase will force its calib flag to False, regardless of input value.
- calc_endmember_comp(mol_oxide_comp, method='least_squares', output_residual=False, normalize=False, decimals=10)#
Get fraction of each endmember given the composition.
- Parameters:
- mol_oxide_compdouble array
Amounts of each oxide in standard order (defined in OXIDES)
- decimalsint, default 10
Number of decimals to round result to
- methodstr, default ‘least_squares’
Method used to convert oxide composition (in moles) to moles of endmembers ‘intrinsic’ is alternate method, hardcoded by the solution implementation
- Returns:
- endmember_compdouble array
Best-fit molar composition in terms of endmembers
- mol_oxide_comp_residualdouble array
Residual molar oxide composition
Notes
Eventually, we may want the ability to calculate endmember comp. using a variety of methods for inputing composition:
- kind[‘wt_oxide’, ‘mol_oxide’, ‘element’]
Identifies how composition is defined.
- compute_formula(T, P, mol_comp)#
Converts an input array of moles of endmember components to the chemical formula of the phase
- Parameters:
- Tdouble
Temperature in Kelvins
- Pdouble
Pressure in bars
- mol_compdouble array
Mole numbers of each component in the solution
- Returns:
- formulastr
A string with the formula of the phase
- convert_elements(mol_elm, output='moles_end')#
Converts an array of mole numbers of elements (in the standard order) to the specified output quantity
- Parameters:
- mole_elmdouble array
Mole numbers of elements in the standard order
- outputstr, default = ‘moles_end’
- Output quantity:
‘moles_end’ - double array of moles of endmembers
‘total_moles’ - double, sum of moles of endmembers
‘total_grams’ - double, sum of grams of solution
- Returns:
- resultdouble or double array
The computed quantity as double or double array
- convert_endmember_comp(mol_comp, output='total_moles')#
Converts an input array of moles of endmember components to the specified quantity
- Parameters:
- mol_compdouble array
Mole numbers of each component in the solution
- outputstr, default = ‘total_moles’
- Output quantity:
‘total_moles’ - double
‘moles_elements’ - double array (standard order and length)
‘mole_fraction’ - double array (same order and length as input)
‘moles_species’ - pandas series or array w/ accepted order
- Returns:
- resultdouble or double array/pandas series
The computed quantity as double or double array (or series)
- convert_species_to_comp(mol_species, method='linear')#
Converts an input array of moles of species to moles of endmember components
- Parameters:
- mol_speciesdouble array
Mole numbers of each species in the solution
- method{‘linear’, ‘source’}
Default is ‘linear’, using basic dot-product. Otherwise, optimized methods can be used from source code by selecting ‘source’.
- Returns:
- resultdouble array
Moles of endmember components
- covert_endmember_comp(mol_comp, output='total_moles')#
Deprecated since version 1.0: This will be removed in 2.0. This legacy function name has a typo. Use convert_endmember_comp instead.
- get_endmember_ind(mol_oxide_comp, get_endmember_comp=False, TOL=1e-06)#
Get index of endmember that best matches composition.
- Parameters:
- mol_oxide_compdouble array
Amounts of each oxide in standard order (defined in OXIDES)
- TOLdouble, default 1e-6
Allowed tolerance for mismatch to defined composition
- get_endmember_compbool, default False
If true, also return endmember composition array.
- Returns:
- endmember_indint
Index of best-fit endmember
- endmember_compdouble array, optional
Composition array in terms of endmembers.
Return if get_endmember_comp==True
- test_endmember_comp(mol_comp)#
Tests validity of endmember component moles array
- Parameters:
- mol_compdouble array
Mole numbers of each component in the solution
- Returns:
- flagboolean
True is composition is valid, otherwise False.