Model Module#
The Model module of ThermoEngine implements a Python interface with the Phase objective-C classes as well as the infrastructure for pure phase thermodynamic calibration. The module contains methods that allow for loading and selection of built-in thermodynamic databases.
- class thermoengine.model.SysComp(comp, H2O='input', CO2='none', units='wt', basis='formula', components=None, stoic=None)#
Lightweight composition object
- Parameters:
- comparray or dataframe of compositions (1D or 2D)
Array or table defining compositions. If labeled datafame is provided, then column headers are used as components by default. Otherwise, the components must be defined in the optional components parameter.
- H2O{‘input’,’none’,value(s)}, optional
- Optional override for H2O content.
‘input’ - (default) comp table value used if present
‘none’ - H2O is ignored as a component
value(s) - H2O value is overriden using float or float array
- CO2{‘input’,’none’,value(s)}, optional
- Optional override for CO2 content.
‘input’ - comp table value used if present
‘none’ - (default) CO2 is ignored as a component
value(s) - CO2 value is overriden using float or float array
- units{‘wt’,’mol’}, optional
Define input units for comp array
- basis{‘formula’, ‘atomic’}, optional
Define input basis for molar comp
- components{‘oxides’, ‘major_oxides’, implicit column headers, explicit str array}, optional
- Define names of input component endmembers. Standard oxides are assumed by default unless the comp table include headers.
‘oxides’ - standard petrology oxide order (see SysComp.STD_OXIDES)
‘major_oxides’ - Major geological oxides (see SysComp.MAJOR_OXIDES)
implicit col headers - Comp data table includes column headers, they will be used
- explicit str array - Defines order for complete set of components.
If comp data array lacks column headers, they are provided here.
Otherwise, this defines the full set of components, while comp array may include only subset.
- stoicdicts, optional
Nested dicts defining the elemental stoichiometry of each endmember.
Optional input required only for custom components. Input unneeded for standard oxides.
- Example input:
- stoic = {
‘MgSiO3’: {‘Mg’:1, ‘Si’:1, ‘O’:3},
‘Mg2SiO4’: {‘Mg’:2, ‘Si’:1, ‘O’:4},
‘Fe2SiO4’: {‘Fe’:2, ‘Si’:1, ‘O’:4},
}
- Attributes:
- elem_names
- elem_nums
- elem_wts
- elems
- endmember_natom
- endmember_stoic
- endmember_wts
- endmembers
Methods
mol_comp([components, basis, normalize])Molar composition
wt_comp([components, normalize])Composition by weight
- mol_comp(components='oxides', basis='formula', normalize=False)#
Molar composition
- Parameters:
- components{‘oxides’,’endmems’,’elems’}, optional
Define components for expression of composition
- basis{‘formula’, ‘atomic’}, optional
Define molar comp basis for oxides or endmems
- normalizeboolean, optional
Normalize output, default is False.
- Returns:
- mol_comppandas DataFrame
Data table of mols of each component
- wt_comp(components='oxides', normalize=False)#
Composition by weight
- Parameters:
- components{‘oxides’,’endmems’,’elems’}, optional
Define components for expression of composition
- normalizeboolean, optional
Normalize output, default is False.
- Returns:
- wt_comppandas DataFrame
Data table of wt for each component