pmutt.empirical.EmpiricalBase
- class pmutt.empirical.EmpiricalBase(name=None, phase=None, elements=None, model=None, misc_models=None, smiles=None, notes=None, add_gas_P_adj=True, **kwargs)
Bases:
_ModelBase
The empirical parent class. Holds properties of a species, the statistical-mechanical thermodynamic model.
- elements
Composition of the species. Default is None. Keys of dictionary are elements, values are stoichiometric values in a formula unit. e.g. CH3OH can be represented as: {‘C’: 1, ‘H’: 4, ‘O’: 1,}.
- Type:
dict, optional
- model
Object which was used to fit the empirical polynomial. Default is None. Object should have the following methods:
get_CpoR
,get_HoRT
,get_SoR
,get_GoRT
.- Type:
model object, optional
- misc_models
Extra models to add extra functionality. Commonly used models would be
pmutt.mixture
models- Type:
list of pmutt model objects, optional
- notes
Any additional details you would like to include such as computational set up. Default is None
- Type:
str, optional
- add_gas_P_adj
If True, gas species (i.e. phase`=’gas’ or `phase`=’g’) will automatically be assigned :class:`~pmutt.empirical.GasPressureAdj. Default is True.
- Type:
bool, optional
- __init__(name=None, phase=None, elements=None, model=None, misc_models=None, smiles=None, notes=None, add_gas_P_adj=True, **kwargs)
Methods
__init__
([name, phase, elements, model, ...])compare_CpoR
([T])Compares the dimensionless heat capacity of the statistical model and the empirical model
compare_GoRT
([T])Compares the dimensionless Gibbs energy of the statistical model and the empirical model
compare_HoRT
([T])Compares the dimensionless enthalpy of the statistical model and the empirical model
compare_SoR
([T])Compares the dimensionless entropy of the statistical model and the empirical model
from_dict
(json_obj)Recreate an object from the JSON representation.
get_Cp
(units, **kwargs)Calculate the heat capacity (constant P)
get_CpoR
()Default method to calculate the dimensionless heat capacity at constant pressure.
get_Cv
(units, **kwargs)Calculate the heat capacity (constant V)
get_CvoR
()Default method to calculate the dimensionless heat capacity at constant volume.
get_F
(units[, T])Calculate the Helmholtz energy
get_FoRT
(**kwargs)Calculates the dimensionless Helmholtz energy
get_G
(units[, T])Calculate the Gibbs energy
get_GoRT
(**kwargs)Calculates the dimensionless Gibbs free energy
get_H
(units[, T])Calculate the enthalpy
get_HoRT
()Default method to calculate the dimensionless enthalpy.
get_S
(units, **kwargs)Calculate the entropy
get_SoR
()Default method to calculate the dimensionless entropy.
get_U
(units[, T])Calculate the internal energy
get_UoRT
()Default method to calculate the dimensionless internal energy.
get_q
()Default method to calculate the partition coefficient.
plot_empirical
([T_low, T_high, Cp_units, ...])Plots the thermodynamic profiles between
T_low
andT_high
using empirical relationshipplot_statmech
([T_low, T_high, Cp_units, ...])Plots the thermodynamic profiles between
T_low
andT_high
using empirical relationshipplot_statmech_and_empirical
([T_low, T_high, ...])Plots the thermodynamic profiles between
T_low
andT_high
using empirical relationshipto_dict
()Represents object as dictionary with JSON-accepted datatypes
- compare_CpoR(T=None)
Compares the dimensionless heat capacity of the statistical model and the empirical model
- Parameters:
T ((N,) numpy.ndarray or float, optional) – Temperatures (in K) to calculate CpoR. If None, generates a list of temperatures between self.T_low and self.T_high
- Returns:
T ((N,) numpy.ndarray or float) – Temperatures in K
CpoR_model ((N,) numpy.ndarray or float) – Dimensionless heat capacity of original model
CpoR_empirical (((N,) numpy.ndarray or float) – Dimensionless heat capacity of empirical model
- compare_GoRT(T=None)
Compares the dimensionless Gibbs energy of the statistical model and the empirical model
- Parameters:
T ((N,) numpy.ndarray or float, optional) – Temperatures (in K) to calculate CpoR. If None, generates a list of temperatures between self.T_low and self.T_high
- Returns:
T ((N,) numpy.ndarray or float) – Temperatures in K
CpoR_model ((N,) numpy.ndarray or float) – Dimensionless heat capacity of original model
CpoR_empirical ((N,) numpy.ndarray or float) – Dimensionless heat capacity of empirical model
- compare_HoRT(T=None)
Compares the dimensionless enthalpy of the statistical model and the empirical model
- Parameters:
T ((N,) numpy.ndarray or float, optional) – Temperatures (in K) to calculate CpoR. If None, generates a list of temperatures between self.T_low and self.T_high
- Returns:
T ((N,) numpy.ndarray or float) – Temperatures in K
CpoR_model ((N,) numpy.ndarray or float) – Dimensionless heat capacity of original model
CpoR_empirical (((N,) numpy.ndarray or float) – Dimensionless heat capacity of empirical model
- compare_SoR(T=None)
Compares the dimensionless entropy of the statistical model and the empirical model
- Parameters:
T ((N,) numpy.ndarray or float, optional) – Temperatures (in K) to calculate CpoR. If None, generates a list of temperatures between self.T_low and self.T_high
- Returns:
T ((N,) numpy.ndarray or float) – Temperatures in K
CpoR_model ((N,) numpy.ndarray or float) – Dimensionless heat capacity of original model
CpoR_empirical (((N,) numpy.ndarray or float) – Dimensionless heat capacity of empirical model
- classmethod from_dict(json_obj)
Recreate an object from the JSON representation.
- Parameters:
json_obj (dict) – JSON representation
- Returns:
EmpiricalBase
- Return type:
EmpiricalBase object
- get_Cp(units, **kwargs)
Calculate the heat capacity (constant P)
- get_CpoR()
Default method to calculate the dimensionless heat capacity at constant pressure.
- Returns:
CpoR – Returns 0
- Return type:
- get_Cv(units, **kwargs)
Calculate the heat capacity (constant V)
- get_CvoR()
Default method to calculate the dimensionless heat capacity at constant volume.
- Returns:
CvoR – Returns 0
- Return type:
- get_F(units, T=298.15, **kwargs)
Calculate the Helmholtz energy
- get_FoRT(**kwargs)
Calculates the dimensionless Helmholtz energy
- Parameters:
kwargs (keyword arguments) – Parameters needed by
get_UoRT
andget_SoR
- Returns:
FoRT – Dimensionless Helmholtz energy
- Return type:
- get_G(units, T=298.15, **kwargs)
Calculate the Gibbs energy
- get_GoRT(**kwargs)
Calculates the dimensionless Gibbs free energy
- Parameters:
kwargs (keyword arguments) – Parameters needed by
get_HoRT
andget_SoR
- Returns:
GoRT – Dimensionless Gibbs free energy
- Return type:
- get_H(units, T=298.15, **kwargs)
Calculate the enthalpy
- get_HoRT()
Default method to calculate the dimensionless enthalpy.
- Returns:
HoRT – Returns 0
- Return type:
- get_S(units, **kwargs)
Calculate the entropy
- get_SoR()
Default method to calculate the dimensionless entropy.
- Returns:
SoR – Returns 0
- Return type:
- get_U(units, T=298.15, **kwargs)
Calculate the internal energy
- get_UoRT()
Default method to calculate the dimensionless internal energy.
- Returns:
UoRT – Returns 0
- Return type:
- get_q()
Default method to calculate the partition coefficient.
- Returns:
q – Returns 1
- Return type:
- plot_empirical(T_low=None, T_high=None, Cp_units=None, H_units=None, S_units=None, G_units=None)
Plots the thermodynamic profiles between
T_low
andT_high
using empirical relationship- Parameters:
T_low (float) – Lower temperature in K. If not specified,
T_low
attribute used.T_high (float) – Upper temperature in K. If not specified,
T_high
attribute used.Cp_units (str) – Units to plot heat capacity. See
R()
for accepted units. If not specified, dimensionless units used.H_units (str) – Units to plot enthalpy. See
R()
for accepted units but omit the ‘/K’ (e.g. J/mol). If not specified, dimensionless units used.S_units (str) – Units to plot entropy. See
R()
for accepted units. If not specified, dimensionless units used.G_units (str) – Units to plot Gibbs free energy. See
R()
for accepted units but omit the ‘/K’ (e.g. J/mol). If not specified, dimensionless units used.
- Returns:
figure (matplotlib.figure.Figure) – Figure
axes (tuple of matplotlib.axes.Axes.axis) – Axes of the plots. 0. Cp 1. H 2. S 3. G
- plot_statmech(T_low=None, T_high=None, Cp_units=None, H_units=None, S_units=None, G_units=None, use_references=True)
Plots the thermodynamic profiles between
T_low
andT_high
using empirical relationship- Parameters:
T_low (float) – Lower temperature in K. If not specified,
T_low
attribute usedT_high (float) – Upper temperature in K. If not specified,
T_high
attribute usedCp_units (str) – Units to plot heat capacity. See
R()
for accepted units. If not specified, dimensionless units used.H_units (str) – Units to plot enthalpy. See
R()
for accepted units but omit the ‘/K’ (e.g. J/mol). If not specified, dimensionless units used.S_units (str) – Units to plot entropy. See
R()
for accepted units. If not specified, dimensionless units used.G_units (str) – Units to plot Gibbs free energy. See
R()
for accepted units but omit the ‘/K’ (e.g. J/mol). If not specified, dimensionless units used.
- Returns:
figure (matplotlib.figure.Figure) – Figure
axes (tuple of matplotlib.axes.Axes.axis) – Axes of the plots. 0. Cp 1. H 2. S 3. G
- plot_statmech_and_empirical(T_low=None, T_high=None, Cp_units=None, H_units=None, S_units=None, G_units=None, use_references=True)
Plots the thermodynamic profiles between
T_low
andT_high
using empirical relationship- Parameters:
T_low (float) – Lower temperature in K. If not specified,
T_low
attribute usedT_high (float) – Upper temperature in K. If not specified,
T_high
attribute usedCp_units (str) – Units to plot heat capacity. See
R()
for accepted units. If not specified, dimensionless units used.H_units (str) – Units to plot enthalpy. See
R()
for accepted units but omit the ‘/K’ (e.g. J/mol). If not specified, dimensionless units used.S_units (str) – Units to plot entropy. See
R()
for accepted units. If not specified, dimensionless units used.G_units (str) – Units to plot Gibbs free energy. See
R()
for accepted units but omit the ‘/K’ (e.g. J/mol). If not specified, dimensionless units used.
- Returns:
figure (matplotlib.figure.Figure) – Figure
axes (tuple of matplotlib.axes.Axes.axis) – Axes of the plots. 0. Cp 1. H 2. S 3. G