BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
belfem::gastables::RefGas Class Reference

A single chemical species with its caloric and transport properties. More...

#include <cl_GT_RefGas.hpp>

Collaboration diagram for belfem::gastables::RefGas:
[legend]

Public Member Functions

 RefGas (const string &aLabel)
 ~RefGas ()
 RefGas (const RefGas &)=delete
RefGasoperator= (const RefGas &)=delete
const stringlabel () const
real component_multiplicity (const string &aLabel) const
 return the composition if the element exists
const realM () const
 molar mass in kg/Mol
real reference_formation_enthalpy () const
 reference formation enthalpy
bool is_liquid () const
void set_mode (const RefGasMode &aMode)
 Switch between evaluating the CEA polynomials directly and evaluating the splines sampled off them.
GasDatadata ()
 expose data object
const GasDatadata () const
 expose data object ( const version )
Splineheat_spline ()
 expose heat spline
const Splineheat_spline () const
 expose heat spline ( const version )
Splineviscosity_spline ()
 expose viscosity spline
const Splineviscosity_spline () const
 expose viscosity spline ( const version )
Splineconductivity_spline ()
 expose conductivity spline
const Splineconductivity_spline () const
 expose conductivity spline ( const version )
Caloric properties

Upper case is molar, lower case is mass specific: Cp is J/(mol K) and cp is J/(kg K), H is J/mol and h is J/kg.

The two differ by the molar mass and nothing else. Temperature is in K.

The enthalpy scale is set by the factory, not by the source record: it discards the record's integration constant and shifts every interval so that

H( 298.15 K ) = dHf( 298.15 K ) + [ H( 298.15 K ) - H( 0 K ) ]

with the formation enthalpy and the sensible term both taken from thermo.inp. Equivalently, H( 0 K ) is the formation enthalpy at 298.15 K. That is a hybrid of the two usual conventions - CEA places the formation enthalpy at 298.15 K, a 0 K scale places it at 0 K - and it is deliberate.

No consumer in the tree can see the difference. The combustion solver re-references to the CEA convention itself, subtracting h( 298.15 ) and adding the formation enthalpy back ( cl_CN_Scheme.cpp in the nonfree tree ), and the flow routines only ever evaluate enthalpy differences, where the constant cancels. It would matter only if an absolute enthalpy were compared against an outside table.

Entropy is absolute, anchored on the standard state entropy of the record.

Which representation answers these calls depends on the mode - the polynomials themselves in POLY, the sampled splines in SPLINE. The factory leaves every gas in SPLINE.

real Cp (const real T) const
real H (const real T) const
real S (const real T) const
real dSdT (const real T) const
real dCpdT (const real T) const
real d2CpdT2 (const real T) const
real cp (const real T) const
real h (const real T) const
real h_ref () const
real H_ref () const
real s (const real T) const
real dcpdT (const real T) const
real d2cpdT2 (const real T) const
Transport properties

Dynamic viscosity in Pa s and thermal conductivity in W/(m K), both SI - the tabulated CEA coefficients are micropoise and microwatt per centimetre kelvin and are converted on the way out.

Temperature is in K.

These describe the dilute gas. Pressure dependence is not part of this class; the gasmodels layer adds it.

A species with no transport record returns zero rather than raising, except where the factory was able to synthesize viscosity and conductivity from the critical point.

real mu (const real T) const
real dmudT (const real T) const
real d2mudT2 (const real T) const
real lambda (const real T) const
real dlambdadT (const real T) const
real d2lambdadT2 (const real T) const
Data availability

Which of the source tables actually had a record for this species.

Callers use these to decide whether a property is worth asking for - the accessors of a missing set return zero rather than raising, so a silent zero is otherwise indistinguishable from a real one.

bool has_thermo () const
bool has_conductivity () const
bool has_viscosity () const
bool has_components () const
bool is_noble () const

Protected Member Functions

void finalize ()
 to be called by RefGasFactory once all polynomials have been read
void create_splines (const Vector< real > &T, SpMatrix &aHelpMatrix)
void add_component (const string &aLabel, const real aValue)
 to be called by InputThermo
void set_molar_mass (const real aMolarMass)
 set the molar mass
void set_reference_formation_enthalpy (const real aDeltaHf)
 set the formation enthalpy in J/mol
void set_reference_enthalpy (const real aHref)
 set the reference enthalpy H(298.15 K) - H(0 K) in J/mol, as read from the thermo.inp record
void set_liquid_flag ()
void set_component_flag ()
void unset_liquid_flag ()
void add_heat_poly (HeatPoly *aHeatPoly)
void add_transport_poly (TransportPoly *aTransportPoly)
void delete_heat_polys ()
void delete_transport_polys ()
void create_glue_polys_heat (const uint &aNumberOfOriginalPolynomials)
void create_cryo_poly_heat ()
void create_hot_poly_heat (const uint &aNumberOfOriginalPolynomials)
void fix_reference_points (const uint &aStart, const uint &aEnd)
const HeatPolyfind_heat_poly (const real T) const
const TransportPolyfind_viscosity_poly (const real T) const
const TransportPolyfind_conductivity_poly (const real T) const
void finalize_transport ()
void create_cryo_poly_transport (Cell< TransportPoly * > &aPolys)
void create_glue_polys_transport (Cell< TransportPoly * > &aPolys, const uint &aNumberOfOriginalPolynomials)
void create_hot_poly_transport (Cell< TransportPoly * > &aPolys, const uint &aNumberOfOriginalPolynomials)
void finalize_thermo ()
real zero (const real T) const
real poly_Cp (const real T) const
real poly_dCpdT (const real T) const
real poly_d2CpdT2 (const real T) const
real poly_H (const real T) const
real poly_S (const real T) const
real poly_dSdT (const real T) const
real poly_Mu (const real T) const
real poly_dMudT (const real T) const
real poly_d2MudT2 (const real T) const
real poly_Lambda (const real T) const
real poly_dLambdadT (const real T) const
real poly_d2LambdadT2 (const real T) const
real spline_Cp (const real T) const
real spline_dCpdT (const real T) const
real spline_H (const real T) const
real spline_S (const real T) const
real spline_dSdT (const real T) const
real spline_Mu (const real T) const
real spline_dMudT (const real T) const
real spline_d2MudT2 (const real T) const
real spline_Lambda (const real T) const
real spline_dLambdadT (const real T) const
real spline_d2LambdadT2 (const real T) const
void fix_switches ()

Protected Attributes

const bool mAmNoble
GasData mData
const stringmLabel
Cell< HeatPoly * > mHeatPolys
Cell< TransportPoly * > mViscosityPolys
Cell< TransportPoly * > mConductivityPolys
bool mHaveThermo = false
bool mHaveViscosity = false
bool mHaveConductivity = false
bool mLiquidFlag = false
bool mFinalizedFlag = false
bool mHaveComponents = false
Spline mHeatSpline
Spline mViscositySpline
Spline mConductivitySpline
real(RefGas::*) mFunctionCp (const real T) const
real(RefGas::*) mFunctiondCpdT (const real T) const
real(RefGas::*) mFunctiond2CpdT2 (const real T) const
real(RefGas::*) mFunctionH (const real T) const
real(RefGas::*) mFunctionS (const real T) const
real(RefGas::*) mFunctiondSdT (const real T) const
real(RefGas::*) mFunctionMu (const real T) const
real(RefGas::*) mFunctiondMudT (const real T) const
real(RefGas::*) mFunctiond2MudT2 (const real T) const
real(RefGas::*) mFunctionLambda (const real T) const
real(RefGas::*) mFunctiondLambdadT (const real T) const
real(RefGas::*) mFunctiond2LambdadT2 (const real T) const
friend InputThermo
friend InputTransport
friend RefGasFactory

Detailed Description

A single chemical species with its caloric and transport properties.

The caloric side is the NASA-9 formulation of CEA ( NASA RP-1311 ): a set of temperature intervals, each carrying a seven coefficient polynomial for cp/R plus two integration constants for H and S. Transport uses the CEA correlation ln( eta ) = A ln T + B/T + C/T^2 + D over its own intervals. Both are read from the shipped tables by RefGasFactory, which also synthesizes the intervals the tables do not cover: glue polynomials across interval junctions, a cryogenic extrapolation below the lowest interval, and viscosity and thermal conductivity from the Lucas and Chung correlations for species with critical data but no transport record.

Everything is molar unless the accessor is lower case: H() is J/mol and h() is J/kg, the same convention as Cp()/cp(). Temperatures are in K throughout.

The object owns its polynomials and deletes them; mData is held by value. Construction is through RefGasFactory, not directly, because a usable object needs the data files.

See also
Gas Tables Usage Guide

Constructor & Destructor Documentation

◆ RefGas() [1/2]

belfem::gastables::RefGas::RefGas ( const string & aLabel)

◆ ~RefGas()

belfem::gastables::RefGas::~RefGas ( )

◆ RefGas() [2/2]

belfem::gastables::RefGas::RefGas ( const RefGas & )
delete

Member Function Documentation

◆ add_component()

void belfem::gastables::RefGas::add_component ( const string & aLabel,
const real aValue )
protected

to be called by InputThermo

◆ add_heat_poly()

void belfem::gastables::RefGas::add_heat_poly ( HeatPoly * aHeatPoly)
protected

◆ add_transport_poly()

void belfem::gastables::RefGas::add_transport_poly ( TransportPoly * aTransportPoly)
protected

◆ component_multiplicity()

real belfem::gastables::RefGas::component_multiplicity ( const string & aLabel) const
inline

return the composition if the element exists

◆ conductivity_spline() [1/2]

Spline * belfem::gastables::RefGas::conductivity_spline ( )
inline

expose conductivity spline

◆ conductivity_spline() [2/2]

const Spline * belfem::gastables::RefGas::conductivity_spline ( ) const
inline

expose conductivity spline ( const version )

◆ Cp()

real belfem::gastables::RefGas::Cp ( const real T) const

◆ cp()

real belfem::gastables::RefGas::cp ( const real T) const

◆ create_cryo_poly_heat()

void belfem::gastables::RefGas::create_cryo_poly_heat ( )
protected

◆ create_cryo_poly_transport()

void belfem::gastables::RefGas::create_cryo_poly_transport ( Cell< TransportPoly * > & aPolys)
protected

◆ create_glue_polys_heat()

void belfem::gastables::RefGas::create_glue_polys_heat ( const uint & aNumberOfOriginalPolynomials)
protected

◆ create_glue_polys_transport()

void belfem::gastables::RefGas::create_glue_polys_transport ( Cell< TransportPoly * > & aPolys,
const uint & aNumberOfOriginalPolynomials )
protected

◆ create_hot_poly_heat()

void belfem::gastables::RefGas::create_hot_poly_heat ( const uint & aNumberOfOriginalPolynomials)
protected

◆ create_hot_poly_transport()

void belfem::gastables::RefGas::create_hot_poly_transport ( Cell< TransportPoly * > & aPolys,
const uint & aNumberOfOriginalPolynomials )
protected

◆ create_splines()

void belfem::gastables::RefGas::create_splines ( const Vector< real > & T,
SpMatrix & aHelpMatrix )
protected

◆ d2CpdT2()

real belfem::gastables::RefGas::d2CpdT2 ( const real T) const

◆ d2cpdT2()

real belfem::gastables::RefGas::d2cpdT2 ( const real T) const

◆ d2lambdadT2()

real belfem::gastables::RefGas::d2lambdadT2 ( const real T) const

◆ d2mudT2()

real belfem::gastables::RefGas::d2mudT2 ( const real T) const

◆ data() [1/2]

GasData * belfem::gastables::RefGas::data ( )
inline

expose data object

◆ data() [2/2]

const GasData * belfem::gastables::RefGas::data ( ) const
inline

expose data object ( const version )

◆ dCpdT()

real belfem::gastables::RefGas::dCpdT ( const real T) const

◆ dcpdT()

real belfem::gastables::RefGas::dcpdT ( const real T) const

◆ delete_heat_polys()

void belfem::gastables::RefGas::delete_heat_polys ( )
protected

◆ delete_transport_polys()

void belfem::gastables::RefGas::delete_transport_polys ( )
protected

◆ dlambdadT()

real belfem::gastables::RefGas::dlambdadT ( const real T) const

◆ dmudT()

real belfem::gastables::RefGas::dmudT ( const real T) const

◆ dSdT()

real belfem::gastables::RefGas::dSdT ( const real T) const

◆ finalize()

void belfem::gastables::RefGas::finalize ( )
protected

to be called by RefGasFactory once all polynomials have been read

◆ finalize_thermo()

void belfem::gastables::RefGas::finalize_thermo ( )
protected

◆ finalize_transport()

void belfem::gastables::RefGas::finalize_transport ( )
protected

◆ find_conductivity_poly()

const TransportPoly * belfem::gastables::RefGas::find_conductivity_poly ( const real T) const
protected

◆ find_heat_poly()

const HeatPoly * belfem::gastables::RefGas::find_heat_poly ( const real T) const
protected

◆ find_viscosity_poly()

const TransportPoly * belfem::gastables::RefGas::find_viscosity_poly ( const real T) const
protected

◆ fix_reference_points()

void belfem::gastables::RefGas::fix_reference_points ( const uint & aStart,
const uint & aEnd )
protected

◆ fix_switches()

void belfem::gastables::RefGas::fix_switches ( )
protected

◆ H()

real belfem::gastables::RefGas::H ( const real T) const

◆ h()

real belfem::gastables::RefGas::h ( const real T) const

◆ H_ref()

real belfem::gastables::RefGas::H_ref ( ) const

◆ h_ref()

real belfem::gastables::RefGas::h_ref ( ) const

◆ has_components()

bool belfem::gastables::RefGas::has_components ( ) const
inline

◆ has_conductivity()

bool belfem::gastables::RefGas::has_conductivity ( ) const
inline

◆ has_thermo()

bool belfem::gastables::RefGas::has_thermo ( ) const
inline

◆ has_viscosity()

bool belfem::gastables::RefGas::has_viscosity ( ) const
inline

◆ heat_spline() [1/2]

Spline * belfem::gastables::RefGas::heat_spline ( )
inline

expose heat spline

◆ heat_spline() [2/2]

const Spline * belfem::gastables::RefGas::heat_spline ( ) const
inline

expose heat spline ( const version )

◆ is_liquid()

bool belfem::gastables::RefGas::is_liquid ( ) const
inline

◆ is_noble()

bool belfem::gastables::RefGas::is_noble ( ) const
inline

◆ label()

const string & belfem::gastables::RefGas::label ( ) const
inline

◆ lambda()

real belfem::gastables::RefGas::lambda ( const real T) const

◆ M()

const real & belfem::gastables::RefGas::M ( ) const
inline

molar mass in kg/Mol

◆ mu()

real belfem::gastables::RefGas::mu ( const real T) const

◆ operator=()

RefGas & belfem::gastables::RefGas::operator= ( const RefGas & )
delete

◆ poly_Cp()

real belfem::gastables::RefGas::poly_Cp ( const real T) const
protected

◆ poly_d2CpdT2()

real belfem::gastables::RefGas::poly_d2CpdT2 ( const real T) const
protected

◆ poly_d2LambdadT2()

real belfem::gastables::RefGas::poly_d2LambdadT2 ( const real T) const
protected

◆ poly_d2MudT2()

real belfem::gastables::RefGas::poly_d2MudT2 ( const real T) const
protected

◆ poly_dCpdT()

real belfem::gastables::RefGas::poly_dCpdT ( const real T) const
protected

◆ poly_dLambdadT()

real belfem::gastables::RefGas::poly_dLambdadT ( const real T) const
protected

◆ poly_dMudT()

real belfem::gastables::RefGas::poly_dMudT ( const real T) const
protected

◆ poly_dSdT()

real belfem::gastables::RefGas::poly_dSdT ( const real T) const
protected

◆ poly_H()

real belfem::gastables::RefGas::poly_H ( const real T) const
protected

◆ poly_Lambda()

real belfem::gastables::RefGas::poly_Lambda ( const real T) const
protected

◆ poly_Mu()

real belfem::gastables::RefGas::poly_Mu ( const real T) const
protected

◆ poly_S()

real belfem::gastables::RefGas::poly_S ( const real T) const
protected

◆ reference_formation_enthalpy()

real belfem::gastables::RefGas::reference_formation_enthalpy ( ) const
inline

reference formation enthalpy

◆ S()

real belfem::gastables::RefGas::S ( const real T) const

◆ s()

real belfem::gastables::RefGas::s ( const real T) const

◆ set_component_flag()

void belfem::gastables::RefGas::set_component_flag ( )
protected

◆ set_liquid_flag()

void belfem::gastables::RefGas::set_liquid_flag ( )
protected

◆ set_mode()

void belfem::gastables::RefGas::set_mode ( const RefGasMode & aMode)

Switch between evaluating the CEA polynomials directly and evaluating the splines sampled off them.

The splines are faster because they avoid the interval search, at interpolation accuracy; the factory leaves every gas in SPLINE.

Only rebinds function pointers - both modes describe the same ideal gas, so this is not a change of physics.

◆ set_molar_mass()

void belfem::gastables::RefGas::set_molar_mass ( const real aMolarMass)
protected

set the molar mass

Parameters
[in]aMolarMassin kg/Mol, not g/Mol!

◆ set_reference_enthalpy()

void belfem::gastables::RefGas::set_reference_enthalpy ( const real aHref)
protected

set the reference enthalpy H(298.15 K) - H(0 K) in J/mol, as read from the thermo.inp record

◆ set_reference_formation_enthalpy()

void belfem::gastables::RefGas::set_reference_formation_enthalpy ( const real aDeltaHf)
protected

set the formation enthalpy in J/mol

◆ spline_Cp()

real belfem::gastables::RefGas::spline_Cp ( const real T) const
protected

◆ spline_d2LambdadT2()

real belfem::gastables::RefGas::spline_d2LambdadT2 ( const real T) const
protected

◆ spline_d2MudT2()

real belfem::gastables::RefGas::spline_d2MudT2 ( const real T) const
protected

◆ spline_dCpdT()

real belfem::gastables::RefGas::spline_dCpdT ( const real T) const
protected

◆ spline_dLambdadT()

real belfem::gastables::RefGas::spline_dLambdadT ( const real T) const
protected

◆ spline_dMudT()

real belfem::gastables::RefGas::spline_dMudT ( const real T) const
protected

◆ spline_dSdT()

real belfem::gastables::RefGas::spline_dSdT ( const real T) const
protected

◆ spline_H()

real belfem::gastables::RefGas::spline_H ( const real T) const
protected

◆ spline_Lambda()

real belfem::gastables::RefGas::spline_Lambda ( const real T) const
protected

◆ spline_Mu()

real belfem::gastables::RefGas::spline_Mu ( const real T) const
protected

◆ spline_S()

real belfem::gastables::RefGas::spline_S ( const real T) const
protected

◆ unset_liquid_flag()

void belfem::gastables::RefGas::unset_liquid_flag ( )
protected

◆ viscosity_spline() [1/2]

Spline * belfem::gastables::RefGas::viscosity_spline ( )
inline

expose viscosity spline

◆ viscosity_spline() [2/2]

const Spline * belfem::gastables::RefGas::viscosity_spline ( ) const
inline

expose viscosity spline ( const version )

◆ zero()

real belfem::gastables::RefGas::zero ( const real T) const
protected

Member Data Documentation

◆ InputThermo

friend belfem::gastables::RefGas::InputThermo
protected

◆ InputTransport

friend belfem::gastables::RefGas::InputTransport
protected

◆ mAmNoble

const bool belfem::gastables::RefGas::mAmNoble
protected

◆ mConductivityPolys

Cell< TransportPoly * > belfem::gastables::RefGas::mConductivityPolys
protected

◆ mConductivitySpline

Spline belfem::gastables::RefGas::mConductivitySpline
protected

◆ mData

GasData belfem::gastables::RefGas::mData
protected

◆ mFinalizedFlag

bool belfem::gastables::RefGas::mFinalizedFlag = false
protected

◆ mFunctionCp

real(RefGas::*) belfem::gastables::RefGas::mFunctionCp(const real T) const
protected

◆ mFunctiond2CpdT2

real(RefGas::*) belfem::gastables::RefGas::mFunctiond2CpdT2(const real T) const
protected

◆ mFunctiond2LambdadT2

real(RefGas::*) belfem::gastables::RefGas::mFunctiond2LambdadT2(const real T) const
protected

◆ mFunctiond2MudT2

real(RefGas::*) belfem::gastables::RefGas::mFunctiond2MudT2(const real T) const
protected

◆ mFunctiondCpdT

real(RefGas::*) belfem::gastables::RefGas::mFunctiondCpdT(const real T) const
protected

◆ mFunctiondLambdadT

real(RefGas::*) belfem::gastables::RefGas::mFunctiondLambdadT(const real T) const
protected

◆ mFunctiondMudT

real(RefGas::*) belfem::gastables::RefGas::mFunctiondMudT(const real T) const
protected

◆ mFunctiondSdT

real(RefGas::*) belfem::gastables::RefGas::mFunctiondSdT(const real T) const
protected

◆ mFunctionH

real(RefGas::*) belfem::gastables::RefGas::mFunctionH(const real T) const
protected

◆ mFunctionLambda

real(RefGas::*) belfem::gastables::RefGas::mFunctionLambda(const real T) const
protected

◆ mFunctionMu

real(RefGas::*) belfem::gastables::RefGas::mFunctionMu(const real T) const
protected

◆ mFunctionS

real(RefGas::*) belfem::gastables::RefGas::mFunctionS(const real T) const
protected

◆ mHaveComponents

bool belfem::gastables::RefGas::mHaveComponents = false
protected

◆ mHaveConductivity

bool belfem::gastables::RefGas::mHaveConductivity = false
protected

◆ mHaveThermo

bool belfem::gastables::RefGas::mHaveThermo = false
protected

◆ mHaveViscosity

bool belfem::gastables::RefGas::mHaveViscosity = false
protected

◆ mHeatPolys

Cell< HeatPoly * > belfem::gastables::RefGas::mHeatPolys
protected

◆ mHeatSpline

Spline belfem::gastables::RefGas::mHeatSpline
protected

◆ mLabel

const string& belfem::gastables::RefGas::mLabel
protected

◆ mLiquidFlag

bool belfem::gastables::RefGas::mLiquidFlag = false
protected

◆ mViscosityPolys

Cell< TransportPoly * > belfem::gastables::RefGas::mViscosityPolys
protected

◆ mViscositySpline

Spline belfem::gastables::RefGas::mViscositySpline
protected

◆ RefGasFactory

friend belfem::gastables::RefGas::RefGasFactory
protected

The documentation for this class was generated from the following files: