pmutt.empirical.shomate.Shomate
- class pmutt.empirical.shomate.Shomate(name, T_low, T_high, a, units='J/mol/K', n_sites=None, **kwargs)
Bases:
EmpiricalBase
Stores the information for an individual Shomate specie Inherits from
EmpiricalBase
The thermodynamic properties are calculated using the following form:
\(\frac{c_P}{R}=\frac{1}{R}\bigg(A+Bt+Ct^2+Dt^3+\frac{E}{t^2} \bigg)\)
\(\frac{H}{RT}=\frac{1}{RT}\bigg(At+B\frac{t^2}{2}+C\frac{t^3}{3} +D\frac{t^4}{4}-\frac{E}{t}+F\bigg)\)
\(\frac{S}{R}=\frac{1}{R}\bigg(A\ln(t)+Bt+C\frac{t^2}{2}+D \frac{t^3}{3}-\frac{E}{2t^2}+G\bigg)\)
where \(t=\frac{T}{1000}\) in K
- a
Shomate polynomial to use between T_low and T_high
- Type:
(8,) numpy.ndarray
- units
Units used to fit the Shomate polynomial. Units should be supported by
R
(e.g. J/mol/K, cal/mol/K, eV/K). Default is J/mol/K.- Type:
str, optional
- __init__(name, T_low, T_high, a, units='J/mol/K', n_sites=None, **kwargs)
Methods
__init__
(name, T_low, T_high, a[, units, ...])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_data
(name, T, CpoR, T_ref, HoRT_ref, ...)Calculates the Shomate polynomials using thermodynamic data
from_dict
(json_obj)Recreate an object from the JSON representation.
from_model
(model[, name, T_low, T_high, ...])Calculates the NASA polynomials using the model passed
from_statmech
(name, statmech_model, T_low, ...)Calculates the Shomate polynomial using statistical mechanic models.
get_Cp
(T, units[, raise_error, raise_warning])Calculate the heat capacity
get_CpoR
(T[, raise_error, raise_warning])Calculate the dimensionless heat capacity
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
(T, units[, raise_error, ...])Calculate the Gibbs energy
get_GoRT
(T[, raise_error, raise_warning, ...])Calculate the dimensionless Gibbs free energy
get_H
(T, units[, raise_error, raise_warning])Calculate the enthalpy
get_HoRT
(T[, raise_error, raise_warning])Calculate the dimensionless enthalpy
get_S
(T, units[, raise_error, ...])Calculate the entropy
Calculate the dimensionless entropy of the elements in the molecule
get_SoR
(T[, raise_error, raise_warning, ...])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_cti
()Writes the object in Cantera's CTI format.
to_dict
()Represents object as dictionary with JSON-accepted datatypes
Returns a dictionary compatible with Cantera's YAML format
Attributes
- 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_data(name, T, CpoR, T_ref, HoRT_ref, SoR_ref, units='J/mol/K', **kwargs)
Calculates the Shomate polynomials using thermodynamic data
- Parameters:
name (str) – Name of the species
T ((N,) numpy.ndarray) – Temperatures in K used for fitting CpoR.
CpoR ((N,) numpy.ndarray) – Dimensionless heat capacity corresponding to T.
T_ref (float) – Reference temperature in K used fitting empirical coefficients.
HoRT_ref (float) – Dimensionless reference enthalpy that corresponds to T_ref.
SoR_ref (float) – Dimensionless entropy that corresponds to T_ref.
units (str, optional) – Units used to fit the Shomate polynomial. Units should be supported by
R
(e.g. J/mol/K, cal/mol/K, eV/K). Default is J/mol/K.
- Returns:
shomate – Shomate object with polynomial terms fitted to data.
- Return type:
Shomate object
- classmethod from_dict(json_obj)
Recreate an object from the JSON representation.
- Parameters:
json_obj (dict) – JSON representation
- Returns:
shomate
- Return type:
Shomate object
- classmethod from_model(model, name=None, T_low=None, T_high=None, elements=None, n_T=50, units='J/mol/K', **kwargs)
Calculates the NASA polynomials using the model passed
- Parameters:
model (Model object or class) – Model to generate data. Must contain the methods get_CpoR, get_HoRT and get_SoR
name (str, optional) – Name of the species. If not passed, model.name will be used.
T_low (float, optional) – Lower limit temerature in K. If not passed, model.T_low will be used.
T_high (float, optional) – Higher limit temperature in K. If not passed, model.T_high will be used.
elements (dict, optional) – Composition of the species. If not passed, model.elements will be used. 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,}.
n_T (int, optional) – Number of data points between T_low and T_high for fitting heat capacity. Default is 50.
units (str, optional) – Units used to fit the Shomate polynomial. Units should be supported by
R
(e.g. J/mol/K, cal/mol/K, eV/K). Default is J/mol/K.kwargs (keyword arguments) – Used to initalize model if a class is passed.
- Returns:
Shomate – Shomate object with polynomial terms fitted to data.
- Return type:
Shomate object
- classmethod from_statmech(name, statmech_model, T_low, T_high, references=None, elements=None, **kwargs)
Calculates the Shomate polynomial using statistical mechanic models. Deprecated as of Version 1.2.13. Please use
from_model
instead.- Parameters:
name (str) – Name of the species
statmech_model (pmutt.statmech.StatMech object or class) – Statistical Mechanics model to generate data
T_low (float) – Lower limit temerature in K
T_high (float) – Higher limit temperature in K
references (pmutt.empirical.references.References object) – Reference to adjust enthalpy
**kwargs (keyword arguments) – Used to initalize
statmech_model
orEmpiricalBase
attributes to be stored.
- Returns:
shomate – Shomate object with polynomial terms fitted to data.
- Return type:
Shomate object
- get_Cp(T, units, raise_error=True, raise_warning=True, **kwargs)
Calculate the heat capacity
- Parameters:
T (float or (N,) numpy.ndarray) – Temperature(s) in K
raise_error (bool, optional) – If True, raises an error if any of the modes do not have the quantity of interest. Default is True
raise_warning (bool, optional) – Only relevant if raise_error is False. Raises a warning if any of the modes do not have the quantity of interest. Default is True
kwargs (key-word arguments) – Arguments to calculate mixture model properties, if any
- Returns:
Cp – Heat capacity
- Return type:
float or (N,) numpy.ndarray
- get_CpoR(T, raise_error=True, raise_warning=True, **kwargs)
Calculate the dimensionless heat capacity
- Parameters:
T (float or (N,) numpy.ndarray) – Temperature(s) in K
raise_error (bool, optional) – If True, raises an error if any of the modes do not have the quantity of interest. Default is True
raise_warning (bool, optional) – Only relevant if raise_error is False. Raises a warning if any of the modes do not have the quantity of interest. Default is True
kwargs (key-word arguments) – Arguments to calculate mixture model properties, if any
- Returns:
CpoR – Dimensionless heat capacity
- Return type:
float or (N,) numpy.ndarray
- 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(T, units, raise_error=True, raise_warning=True, S_elements=None, **kwargs)
Calculate the Gibbs energy
- Parameters:
T (float or (N,) numpy.ndarray) – Temperature(s) in K
units (str) – Units as string. See
R()
for accepted units but omit the ‘/K’ (e.g. J/mol).raise_error (bool, optional) – If True, raises an error if any of the modes do not have the quantity of interest. Default is True
raise_warning (bool, optional) – Only relevant if raise_error is False. Raises a warning if any of the modes do not have the quantity of interest. Default is True
S_elements (bool, optional) – Includes the entropy of the elements to compute an entropy of formation. Defauly is None
kwargs (key-word arguments) – Arguments to calculate mixture model properties, if any
- Returns:
G – Gibbs energy
- Return type:
float or (N,) numpy.ndarray
- get_GoRT(T, raise_error=True, raise_warning=True, S_elements=None, **kwargs)
Calculate the dimensionless Gibbs free energy
- Parameters:
T (float or (N,) numpy.ndarray) – Temperature(s) in K
raise_error (bool, optional) – If True, raises an error if any of the modes do not have the quantity of interest. Default is True
raise_warning (bool, optional) – Only relevant if raise_error is False. Raises a warning if any of the modes do not have the quantity of interest. Default is True
S_elements (bool, optional) – Includes the entropy of the elements to compute an entropy of formation. Defauly is None
kwargs (key-word arguments) – Arguments to calculate mixture model properties, if any
- Returns:
GoRT – Dimensionless Gibbs free energy
- Return type:
float or (N,) numpy.ndarray
- get_H(T, units, raise_error=True, raise_warning=True, **kwargs)
Calculate the enthalpy
- Parameters:
T (float or (N,) numpy.ndarray) – Temperature(s) in K
units (str) – Units as string. See
R()
for accepted units but omit the ‘/K’ (e.g. J/mol).raise_error (bool, optional) – If True, raises an error if any of the modes do not have the quantity of interest. Default is True
raise_warning (bool, optional) – Only relevant if raise_error is False. Raises a warning if any of the modes do not have the quantity of interest. Default is True
kwargs (key-word arguments) – Arguments to calculate mixture model properties, if any
- Returns:
H – Enthalpy
- Return type:
float or (N,) numpy.ndarray
- get_HoRT(T, raise_error=True, raise_warning=True, **kwargs)
Calculate the dimensionless enthalpy
- Parameters:
T (float or (N,) numpy.ndarray) – Temperature(s) in K
raise_error (bool, optional) – If True, raises an error if any of the modes do not have the quantity of interest. Default is True
raise_warning (bool, optional) – Only relevant if raise_error is False. Raises a warning if any of the modes do not have the quantity of interest. Default is True
kwargs (key-word arguments) – Arguments to calculate mixture model properties, if any
- Returns:
HoRT – Dimensionless enthalpy
- Return type:
float or (N,) numpy.ndarray
- get_S(T, units, raise_error=True, raise_warning=True, S_elements=None, **kwargs)
Calculate the entropy
- Parameters:
T (float or (N,) numpy.ndarray) – Temperature(s) in K
raise_error (bool, optional) – If True, raises an error if any of the modes do not have the quantity of interest. Default is True
raise_warning (bool, optional) – Only relevant if raise_error is False. Raises a warning if any of the modes do not have the quantity of interest. Default is True
S_elements (bool, optional) – Includes the entropy of the elements to compute an entropy of formation. Defauly is None
kwargs (key-word arguments) – Arguments to calculate mixture model properties, if any
- Returns:
S – Entropy
- Return type:
float or (N,) numpy.ndarray
- get_Selements()
Calculate the dimensionless entropy of the elements in the molecule
- Parameters:
None –
- Returns:
SoR – Entropy
- Return type:
- get_SoR(T, raise_error=True, raise_warning=True, S_elements=None, **kwargs)
Calculate the dimensionless entropy
- Parameters:
T (float or (N,) numpy.ndarray) – Temperature(s) in K
raise_error (bool, optional) – If True, raises an error if any of the modes do not have the quantity of interest. Default is True
raise_warning (bool, optional) – Only relevant if raise_error is False. Raises a warning if any of the modes do not have the quantity of interest. Default is True
S_elements (bool, optional) – Includes the entropy of the elements to compute an entropy of formation. Defauly is None
kwargs (key-word arguments) – Arguments to calculate mixture model properties, if any
- Returns:
SoR – Dimensionless entropy
- Return type:
float or (N,) numpy.ndarray
- 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
- to_cti()
Writes the object in Cantera’s CTI format.
- Returns:
CTI_str – Object represented as a CTI string.
- Return type:
- to_dict()
Represents object as dictionary with JSON-accepted datatypes
- Returns:
obj_dict
- Return type:
- to_omkm_yaml()
Returns a dictionary compatible with Cantera’s YAML format
- Returns:
yaml_dict – Dictionary compatible with Cantera’s YAML format
- Return type:
- property units