pmutt.empirical.nasa.Nasa9

class pmutt.empirical.nasa.Nasa9(name, nasas, n_sites=1, **kwargs)

Bases: EmpiricalBase

Stores the NASA9 polynomials for species. Inherits from EmpiricalBase

\(\frac {Cp} {R} = a_{1} T^{-2} + a_{2} T^{-1} + a_{3} + a_{4} T + a_{5} T^{2} + a_{6} T^{3} + a_{7} T^{4}\)

\(\frac {H} {RT} = -a_{1} \frac {T^{-2}} {2} + a_{2} \frac {ln {T}} {T} + a_{3} + a_{4} \frac {T} {2} + a_{5} \frac {T^{2}} {3} + a_{6} \frac {T^{3}} {4} + a_{7} \frac {T^{4}} {5} + a_{8} \frac {1} {T}\)

\(\frac {S} {R} = -a_{1}\frac {T^{-2}} {2} - a_2 \frac {1} {T} + a_{3} \ln {T} + a_{4} T + a_{5} \frac {T^{2}} {2} + a_{6} \frac {T^{3}} {3} + a_{7}\frac {T^{4}} {4} + a_{9}\)

nasas

NASA9 polynomials for each temperature interval

Type:

list of SingleNasa9

T_low

Lower temperature bound (in K). Determined from inputted nasas

Type:

float

T_high

High temperature bound (in K). Determined from inputted nasas

Type:

float

__init__(name, nasas, n_sites=1, **kwargs)

Methods

__init__(name, nasas[, n_sites])

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 NASA polynomials using thermodynamic data

from_dict(json_obj)

Recreate an object from the JSON representation.

from_model(name, model, T_low, T_high[, ...])

Calculates the NASA polynomials using the model passed

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

get_Selements()

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 and T_high using empirical relationship

plot_statmech([T_low, T_high, Cp_units, ...])

Plots the thermodynamic profiles between T_low and T_high using empirical relationship

plot_statmech_and_empirical([T_low, T_high, ...])

Plots the thermodynamic profiles between T_low and T_high using empirical relationship

to_cti()

Writes the object in Cantera's CTI format.

to_dict()

Represents object as dictionary with JSON-accepted datatypes

to_omkm_yaml()

Returns a dictionary compatible with Cantera's YAML format

Attributes

T_high

T_low

nasas

property T_high
property T_low
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, elements=None, T_mid=None, fit_T_mid=True, **kwargs)

Calculates the NASA 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.

  • elements (dict) – Composition of the species. 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,}.

  • T_mid (iterable of float, optional) – Guess for T_mid. If float, only uses that value for T_mid. If list, finds the best fit for each element in the list. If None, a range of T_mid values are screened between the 6th lowest and 6th highest value of T.

Returns:

Nasa – Nasa object with polynomial terms fitted to data.

Return type:

Nasa object

classmethod from_dict(json_obj)

Recreate an object from the JSON representation.

Parameters:

json_obj (dict) – JSON representation

Returns:

Nasa

Return type:

Nasa object

classmethod from_model(name, model, T_low, T_high, elements=None, T_mid=None, n_interval=2, n_T=50, fit_T_mid=True, **kwargs)

Calculates the NASA polynomials using the model passed

Parameters:
  • name (str) – Name of the species

  • model (Model object or class) – Model to generate data. Must contain the methods get_CpoR, get_HoRT and get_SoR

  • T_low (float) – Lower limit temerature in K

  • T_high (float) – Higher limit temperature in K

  • elements (dict) – Composition of the species. 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,}.

  • T_mid ((n_interval,) nd.ndarray) – Temperatures (in K) to use at intervals. See fit_T_mid for behavior.

  • n_interval (int, optional) – Number of NASA9 polynomials to create. Default is 2

  • n_T (int, optional) – Number of temperature values to evaluate between each interval. Larger values result is a better fit but take longer to run. Default is 50.

  • fit_T_mid (bool, optional) – If True, T_mid values initial values and can be changed. If False, T_mid values are not changed

  • kwargs (keyword arguments) – Used to initalize model if a class is passed.

Returns:

Nasa9 – Nasa object with polynomial terms fitted to data.

Return type:

Nasa9 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

  • units (str) – Units as string. See R() for accepted units.

  • 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)

Parameters:
  • units (str) – Units as string. See R() for accepted units.

  • kwargs (keyword arguments) – Parameters needed by get_CvoR

Returns:

Cv – Heat capacity (constant V) in appropriate units

Return type:

float

get_CvoR()

Default method to calculate the dimensionless heat capacity at constant volume.

Returns:

CvoR – Returns 0

Return type:

float

get_F(units, T=298.15, **kwargs)

Calculate the Helmholtz energy

Parameters:
  • units (str) – Units as string. See R() for accepted units but omit the ‘/K’ (e.g. J/mol).

  • T (float, optional) – Temperature in K. Default is 298.15 K

  • kwargs (keyword arguments) – Parameters needed by get_FoRT

Returns:

F – Hemholtz energy in appropriate units

Return type:

float

get_FoRT(**kwargs)

Calculates the dimensionless Helmholtz energy

Parameters:

kwargs (keyword arguments) – Parameters needed by get_UoRT and get_SoR

Returns:

FoRT – Dimensionless Helmholtz energy

Return type:

float

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

  • units (str) – Units as string. See R() for accepted units.

  • 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:

float

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

Parameters:
  • units (str) – Units as string. See R() for accepted units but omit the ‘/K’ (e.g. J/mol).

  • T (float, optional) – Temperature in K. Default is 298.15 K

  • kwargs (keyword arguments) – Parameters needed by get_UoRT

Returns:

U – Internal energy in appropriate units

Return type:

float

get_UoRT()

Default method to calculate the dimensionless internal energy.

Returns:

UoRT – Returns 0

Return type:

float

get_q()

Default method to calculate the partition coefficient.

Returns:

q – Returns 1

Return type:

float

property nasas
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 and T_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:

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 and T_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:

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 and T_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:

to_cti()

Writes the object in Cantera’s CTI format.

Returns:

CTI_str – Object represented as a CTI string.

Return type:

str

to_dict()

Represents object as dictionary with JSON-accepted datatypes

Returns:

obj_dict

Return type:

dict

to_omkm_yaml()

Returns a dictionary compatible with Cantera’s YAML format

Returns:

yaml_dict – Dictionary compatible with Cantera’s YAML format

Return type:

dict