pmutt.empirical.nasa.Nasa

class pmutt.empirical.nasa.Nasa(name, T_low, T_mid, T_high, a_low, a_high, cat_site=None, n_sites=None, **kwargs)

Bases: EmpiricalBase

Stores the NASA polynomial coefficients for species. Inherits from EmpiricalBase

The thermodynamic properties are calculated using the following form:

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

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

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

T_low

Lower temperature bound (in K)

Type:

float

T_mid

Middle temperature bound (in K)

Type:

float

T_high

High temperature bound (in K)

Type:

float

a_low

NASA polynomial to use between T_low and T_mid

Type:

(7,) numpy.ndarray

a_high

NASA polynomial to use between T_mid and T_high

Type:

(7,) numpy.ndarray

cat_site

Catalyst site for adsorption. Used only for Chemkin input/output. Default is None

Type:

CatSite object, optional

n_sites

Number of catalyst sites occupied by species. If cat_site is not assigned, then n_sites is None. If cat_site is specified, the default is 1

Type:

int, optional

__init__(name, T_low, T_mid, T_high, a_low, a_high, cat_site=None, n_sites=None, **kwargs)

Methods

__init__(name, T_low, T_mid, T_high, a_low, ...)

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(model[, name, T_low, T_high, ...])

Calculates the NASA polynomials using the model passed

from_statmech(name, statmech_model, T_low, ...)

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

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_a(T)

Returns the correct polynomial range based on T_low, T_mid and T_high

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

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, **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 (float or 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(model, name=None, T_low=None, T_high=None, T_mid=None, elements=None, n_T=50, **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.

  • T_mid (float or 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.

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

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

Returns:

Nasa – Nasa object with polynomial terms fitted to data.

Return type:

Nasa object

classmethod from_statmech(name, statmech_model, T_low, T_high, T_mid=None, references=None, elements=None, **kwargs)

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

  • T_mid (float or 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.

  • references (pmutt.empirical.references.References object) – Reference to adjust enthalpy

  • 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,}.

  • kwargs (keyword arguments) – Used to initalize statmech_model or EmpiricalBase attributes to be stored.

Returns:

Nasa – Nasa object with polynomial terms fitted to data.

Return type:

Nasa 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_a(T)

Returns the correct polynomial range based on T_low, T_mid and T_high

Parameters:

T (float) – Temperature in K

Returns:

a – NASA polynomial coefficients

Return type:

(7,) numpy.ndarray

get_q()

Default method to calculate the partition coefficient.

Returns:

q – Returns 1

Return type:

float

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