ABLATE Source Documentation  0.12.33
ablate::eos::TChem Class Reference
+ Inheritance diagram for ablate::eos::TChem:

Classes

struct  ThermodynamicMassFractionFunction
 

Public Member Functions

 TChem (std::filesystem::path mechanismFile, std::shared_ptr< ablate::monitors::logs::Log >={}, const std::shared_ptr< ablate::parameters::Parameters > &options={})
 
ThermodynamicFunction GetThermodynamicFunction (ThermodynamicProperty property, const std::vector< domain::Field > &fields) const override
 
ThermodynamicTemperatureFunction GetThermodynamicTemperatureFunction (ThermodynamicProperty property, const std::vector< domain::Field > &fields) const override
 
ThermodynamicMassFractionFunction GetThermodynamicMassFractionFunction (ThermodynamicProperty property, const std::vector< domain::Field > &fields) const
 
ThermodynamicTemperatureMassFractionFunction GetThermodynamicTemperatureMassFractionFunction (ThermodynamicProperty property, const std::vector< domain::Field > &fields) const override
 
EOSFunction GetFieldFunctionFunction (const std::string &field, ThermodynamicProperty property1, ThermodynamicProperty property2, std::vector< std::string > otherProperties) const override
 
std::map< std::string, double > GetElementInformation () const override
 
std::map< std::string, std::map< std::string, int > > GetSpeciesElementalInformation () const override
 
std::map< std::string, double > GetSpeciesMolecularMass () const override
 
std::shared_ptr< SourceCalculatorCreateSourceCalculator (const std::vector< domain::Field > &fields, const ablate::domain::Range &cellRange) override
 
- Public Member Functions inherited from ablate::eos::TChemBase
 TChemBase (const std::string &eosName, std::filesystem::path mechanismFile, const std::shared_ptr< ablate::monitors::logs::Log > &={}, const std::shared_ptr< ablate::parameters::Parameters > &options={})
 
void View (std::ostream &stream) const override
 
tChemLib::KineticModelData & GetKineticModelData ()
 
real_type_1d_view GetEnthalpyOfFormation ()
 
const std::vector< std::string > & GetSpeciesVariables () const override
 
virtual const std::vector< std::string > & GetProgressVariables () const override
 
double GetEnthalpyOfFormation (std::string_view speciesName) const override
 
- Public Member Functions inherited from ablate::eos::ChemistryModel
 ChemistryModel (std::string name)
 
virtual std::vector< std::tuple< ablate::solver::CellSolver::SolutionFieldUpdateFunction, void *, std::vector< std::string > > > GetSolutionFieldUpdates ()
 
- Public Member Functions inherited from ablate::eos::EOS
 EOS (std::string typeIn)
 
virtual std::vector< std::string > GetFieldTags () const
 
virtual std::vector< std::shared_ptr< domain::FieldDescriptor > > GetAdditionalFields () const
 
virtual const std::vector< std::string > & GetFieldFunctionProperties () const
 

Protected Types

using ThermodynamicStaticFunction = PetscErrorCode(*)(const PetscReal conserved[], PetscReal *property, void *ctx)
 
using ThermodynamicTemperatureStaticFunction = PetscErrorCode(*)(const PetscReal conserved[], PetscReal temperature, PetscReal *property, void *ctx)
 
using ThermodynamicStaticMassFractionFunction = PetscErrorCode(*)(const PetscReal conserved[], const PetscReal yi[], PetscReal *property, void *ctx)
 
using ThermodynamicTemperatureStaticMassFractionFunction = PetscErrorCode(*)(const PetscReal conserved[], const PetscReal yi[], PetscReal temperature, PetscReal *property, void *ctx)
 

Protected Member Functions

std::shared_ptr< FunctionContextBuildFunctionContext (ablate::eos::ThermodynamicProperty property, const std::vector< domain::Field > &fields, bool checkDensityYi=true) const
 

Static Protected Member Functions

static void FillWorkingVectorFromDensityMassFractions (double density, double temperature, const double *densityYi, const tChemLib::Impl::StateVector< real_type_1d_view_host > &stateVector)
 
static void FillWorkingVectorFromMassFractions (double density, double temperature, const double *densityYi, const tChemLib::Impl::StateVector< real_type_1d_view_host > &stateVector)
 
Direct Thermodynamic Properties Functions

These functions are used to compute the direct thermodynamic properties (without temperature). They are not called directly but a pointer to them is returned

Parameters
conserved
property
ctx
Returns
static PetscErrorCode DensityFunction (const PetscReal conserved[], PetscReal *property, void *ctx)
 
static PetscErrorCode TemperatureFunction (const PetscReal conserved[], PetscReal *property, void *ctx)
 
static PetscErrorCode PressureFunction (const PetscReal conserved[], PetscReal *property, void *ctx)
 
static PetscErrorCode InternalSensibleEnergyFunction (const PetscReal conserved[], PetscReal *property, void *ctx)
 
static PetscErrorCode SensibleEnthalpyFunction (const PetscReal conserved[], PetscReal *property, void *ctx)
 
static PetscErrorCode SpecificHeatConstantVolumeFunction (const PetscReal conserved[], PetscReal *property, void *ctx)
 
static PetscErrorCode SpecificHeatConstantPressureFunction (const PetscReal conserved[], PetscReal *property, void *ctx)
 
static PetscErrorCode SpeedOfSoundFunction (const PetscReal conserved[], PetscReal *property, void *ctx)
 
static PetscErrorCode SpeciesSensibleEnthalpyFunction (const PetscReal conserved[], PetscReal *property, void *ctx)
 
static PetscErrorCode DensityMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal *property, void *ctx)
 
static PetscErrorCode TemperatureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal *property, void *ctx)
 
static PetscErrorCode PressureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal *property, void *ctx)
 
static PetscErrorCode InternalSensibleEnergyMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal *property, void *ctx)
 
static PetscErrorCode SensibleEnthalpyMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal *property, void *ctx)
 
static PetscErrorCode SpecificHeatConstantVolumeMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal *property, void *ctx)
 
static PetscErrorCode SpecificHeatConstantPressureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal *property, void *ctx)
 
static PetscErrorCode SpeedOfSoundMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal *property, void *ctx)
 
static PetscErrorCode SpeciesSensibleEnthalpyMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal *property, void *ctx)
 
Temperature Based Thermodynamic Properties Functions

These functions are used to compute the thermodynamic properties when temperature is known. They are not called directly but a pointer to them is returned and may be faster than the direct calls.

Parameters
conserved
property
ctx
Returns
static PetscErrorCode DensityTemperatureFunction (const PetscReal conserved[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode TemperatureTemperatureFunction (const PetscReal conserved[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode PressureTemperatureFunction (const PetscReal conserved[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode InternalSensibleEnergyTemperatureFunction (const PetscReal conserved[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode SensibleEnthalpyTemperatureFunction (const PetscReal conserved[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode SpecificHeatConstantVolumeTemperatureFunction (const PetscReal conserved[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode SpecificHeatConstantPressureTemperatureFunction (const PetscReal conserved[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode SpeedOfSoundTemperatureFunction (const PetscReal conserved[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode SpeciesSensibleEnthalpyTemperatureFunction (const PetscReal conserved[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode DensityTemperatureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode TemperatureTemperatureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode PressureTemperatureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode InternalSensibleEnergyTemperatureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode SensibleEnthalpyTemperatureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode SpecificHeatConstantVolumeTemperatureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode SpecificHeatConstantPressureTemperatureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode SpeedOfSoundTemperatureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal T, PetscReal *property, void *ctx)
 
static PetscErrorCode SpeciesSensibleEnthalpyTemperatureMassFractionFunction (const PetscReal conserved[], const PetscReal yi[], PetscReal T, PetscReal *property, void *ctx)
 

Protected Attributes

std::map< ThermodynamicProperty, std::tuple< ThermodynamicStaticFunction, ThermodynamicTemperatureStaticFunction, std::function< ordinal_type(ordinal_type)> > > thermodynamicFunctions
 
std::map< ThermodynamicProperty, std::tuple< ThermodynamicStaticMassFractionFunction, ThermodynamicTemperatureStaticMassFractionFunction, std::function< ordinal_type(ordinal_type)> > > thermodynamicMassFractionFunctions
 
const std::set< ThermodynamicProperty > speciesSizedProperties = {ThermodynamicProperty::SpeciesSensibleEnthalpy}
 
- Protected Attributes inherited from ablate::eos::TChemBase
tChem::SourceCalculator::ChemistryConstraints constraints
 hold a copy of the constrains that can be used for single or batch source calculation
 
const std::filesystem::path mechanismFile
 the mechanismFile may be chemkin or yaml based
 
std::shared_ptr< ablate::monitors::logs::Loglog
 an optional log file for tchem echo redirection
 
tChemLib::KineticModelData kineticsModel
 
std::shared_ptr< tChemLib::KineticModelGasConstData< typename Tines::UseThisDevice< host_exec_space >::type > > kineticsModelDataHost
 
std::shared_ptr< tChemLib::KineticModelGasConstData< typename Tines::UseThisDevice< exec_space >::type > > kineticsModelDataDevice
 
std::vector< std::string > species
 
real_type_1d_view enthalpyReferenceDevice
 
real_type_1d_view_host enthalpyReferenceHost
 
- Protected Attributes inherited from ablate::eos::EOS
const std::string type
 

Additional Inherited Members

- Static Public Attributes inherited from ablate::eos::TChemBase
static const double TREF = 298.15
 
- Static Public Attributes inherited from ablate::eos::EOS
static const std::string YI = "Yi"
 
static const std::string PROGRESS = "Progress"
 
- Static Protected Attributes inherited from ablate::eos::TChemBase
static const std::array< std::string, 2 > validFileExtensions = {".yaml", ".yml"}
 

Member Typedef Documentation

◆ ThermodynamicStaticFunction

using ablate::eos::TChem::ThermodynamicStaticFunction = PetscErrorCode (*)(const PetscReal conserved[], PetscReal* property, void* ctx)
protected

template function to call base tChem function Store a map of functions functions for quick lookup

◆ ThermodynamicStaticMassFractionFunction

using ablate::eos::TChem::ThermodynamicStaticMassFractionFunction = PetscErrorCode (*)(const PetscReal conserved[], const PetscReal yi[], PetscReal* property, void* ctx)
protected

Store a map of functions functions for quick lookup

Constructor & Destructor Documentation

◆ TChem()

ablate::eos::TChem::TChem ( std::filesystem::path  mechanismFile,
std::shared_ptr< ablate::monitors::logs::Log logIn = {},
const std::shared_ptr< ablate::parameters::Parameters > &  options = {} 
)
explicit

The tChem EOS can utilize either a mechanical & thermo file using the Chemkin file format for a modern yaml file.

Parameters
mechFile
optionalThermoFile

Member Function Documentation

◆ BuildFunctionContext()

std::shared_ptr< ablate::eos::TChem::FunctionContext > ablate::eos::TChem::BuildFunctionContext ( ablate::eos::ThermodynamicProperty  property,
const std::vector< domain::Field > &  fields,
bool  checkDensityYi = true 
) const
protected

helper function to build the function context needed regardless of function type

Template Parameters
Function
Type
Parameters
fields
optionalargument to check for yi
Returns

◆ CreateSourceCalculator()

std::shared_ptr< ablate::eos::ChemistryModel::SourceCalculator > ablate::eos::TChem::CreateSourceCalculator ( const std::vector< domain::Field > &  fields,
const ablate::domain::Range cellRange 
)
overridevirtual

Function to create the batch source specific to the provided cell range

Parameters
fields
cellRange
Returns

Implements ablate::eos::ChemistryModel.

◆ FillWorkingVectorFromDensityMassFractions()

void ablate::eos::TChem::FillWorkingVectorFromDensityMassFractions ( double  density,
double  temperature,
const double *  densityYi,
const tChemLib::Impl::StateVector< real_type_1d_view_host > &  stateVector 
)
staticprotected

Fill and Normalize the density species mass fractions

Parameters
numSpec
yi

◆ FillWorkingVectorFromMassFractions()

void ablate::eos::TChem::FillWorkingVectorFromMassFractions ( double  density,
double  temperature,
const double *  densityYi,
const tChemLib::Impl::StateVector< real_type_1d_view_host > &  stateVector 
)
staticprotected

Fill the working vector from yi

Parameters
numSpec
yi

◆ GetElementInformation()

std::map< std::string, double > ablate::eos::TChem::GetElementInformation ( ) const
overridevirtual

Returns all elements tracked in this mechanism and their molecular mass

Returns

Reimplemented from ablate::eos::ChemistryModel.

◆ GetFieldFunctionFunction()

ablate::eos::EOSFunction ablate::eos::TChem::GetFieldFunctionFunction ( const std::string &  field,
ThermodynamicProperty  property1,
ThermodynamicProperty  property2,
std::vector< std::string >  otherProperties 
) const
overridevirtual

Single function to produce fieldFunction function for any two properties, velocity, and species mass fractions. These calls can be slower and should be used for init/output only

Parameters
field
property1
property2

Implements ablate::eos::EOS.

◆ GetSpeciesElementalInformation()

std::map< std::string, std::map< std::string, int > > ablate::eos::TChem::GetSpeciesElementalInformation ( ) const
overridevirtual

no. of atoms of each element in each species

Returns

Reimplemented from ablate::eos::ChemistryModel.

◆ GetSpeciesMolecularMass()

std::map< std::string, double > ablate::eos::TChem::GetSpeciesMolecularMass ( ) const
overridevirtual

the MW of each species

Returns

Reimplemented from ablate::eos::ChemistryModel.

◆ GetThermodynamicFunction()

ablate::eos::ThermodynamicFunction ablate::eos::TChem::GetThermodynamicFunction ( ThermodynamicProperty  property,
const std::vector< domain::Field > &  fields 
) const
overridevirtual

Single function to produce thermodynamic function for any property based upon the available fields

Parameters
property
fields
Returns

Implements ablate::eos::EOS.

◆ GetThermodynamicMassFractionFunction()

ablate::eos::TChem::ThermodynamicMassFractionFunction ablate::eos::TChem::GetThermodynamicMassFractionFunction ( ThermodynamicProperty  property,
const std::vector< domain::Field > &  fields 
) const

Single function to produce thermodynamic function for any property based upon the available fields and yi

Parameters
property
fields
Returns

◆ GetThermodynamicTemperatureFunction()

ablate::eos::ThermodynamicTemperatureFunction ablate::eos::TChem::GetThermodynamicTemperatureFunction ( ThermodynamicProperty  property,
const std::vector< domain::Field > &  fields 
) const
overridevirtual

Single function to produce thermodynamic function for any property based upon the available fields and temperature

Parameters
property
fields
Returns

Implements ablate::eos::EOS.

◆ GetThermodynamicTemperatureMassFractionFunction()

ablate::eos::TChem::ThermodynamicTemperatureMassFractionFunction ablate::eos::TChem::GetThermodynamicTemperatureMassFractionFunction ( ThermodynamicProperty  property,
const std::vector< domain::Field > &  fields 
) const
overridevirtual

Single function to produce thermodynamic function for any property based upon the available fields, temperature and yi

Parameters
property
fields
Returns

Reimplemented from ablate::eos::ChemistryModel.

Member Data Documentation

◆ speciesSizedProperties

const std::set<ThermodynamicProperty> ablate::eos::TChem::speciesSizedProperties = {ThermodynamicProperty::SpeciesSensibleEnthalpy}
protected

Store a list of properties that are sized by species, everything is assumed to be size one

◆ thermodynamicFunctions

std::map<ThermodynamicProperty, std::tuple<ThermodynamicStaticFunction, ThermodynamicTemperatureStaticFunction, std::function<ordinal_type(ordinal_type)> > > ablate::eos::TChem::thermodynamicFunctions
protected
Initial value:
= {
{ThermodynamicProperty::Density, {DensityFunction, DensityTemperatureFunction, [](auto) { return 0; }}},
{ThermodynamicProperty::Pressure,
{PressureFunction, PressureTemperatureFunction, ablate::eos::tChem::Temperature::getWorkSpaceSize}} ,
{ThermodynamicProperty::Temperature, {TemperatureFunction, TemperatureTemperatureFunction, ablate::eos::tChem::Temperature::getWorkSpaceSize}},
{ThermodynamicProperty::InternalSensibleEnergy, {InternalSensibleEnergyFunction, InternalSensibleEnergyTemperatureFunction, ablate::eos::tChem::SensibleInternalEnergy::getWorkSpaceSize}},
{ThermodynamicProperty::SensibleEnthalpy, {SensibleEnthalpyFunction, SensibleEnthalpyTemperatureFunction, ablate::eos::tChem::SensibleEnthalpy::getWorkSpaceSize}},
{ThermodynamicProperty::SpecificHeatConstantVolume, {SpecificHeatConstantVolumeFunction, SpecificHeatConstantVolumeTemperatureFunction, [](auto nSpec) { return nSpec; }}},
{ThermodynamicProperty::SpecificHeatConstantPressure,
{SpecificHeatConstantPressureFunction,
SpecificHeatConstantPressureTemperatureFunction,
ablate::eos::tChem::Temperature::getWorkSpaceSize}} ,
{ThermodynamicProperty::SpeedOfSound, {SpeedOfSoundFunction, SpeedOfSoundTemperatureFunction, ablate::eos::tChem::SpeedOfSound::getWorkSpaceSize}},
{ThermodynamicProperty::SpeciesSensibleEnthalpy,
{SpeciesSensibleEnthalpyFunction,
SpeciesSensibleEnthalpyTemperatureFunction,
ablate::eos::tChem::Temperature::getWorkSpaceSize}}
}

◆ thermodynamicMassFractionFunctions

std::map<ThermodynamicProperty, std::tuple<ThermodynamicStaticMassFractionFunction, ThermodynamicTemperatureStaticMassFractionFunction, std::function<ordinal_type(ordinal_type)> > > ablate::eos::TChem::thermodynamicMassFractionFunctions
protected
Initial value:
= {
{ThermodynamicProperty::Density, {DensityMassFractionFunction, DensityTemperatureMassFractionFunction, [](auto) { return 0; }}},
{ThermodynamicProperty::Pressure,
{PressureMassFractionFunction,
PressureTemperatureMassFractionFunction,
ablate::eos::tChem::Temperature::getWorkSpaceSize}} ,
{ThermodynamicProperty::Temperature, {TemperatureMassFractionFunction, TemperatureTemperatureMassFractionFunction, ablate::eos::tChem::Temperature::getWorkSpaceSize}},
{ThermodynamicProperty::InternalSensibleEnergy,
{InternalSensibleEnergyMassFractionFunction, InternalSensibleEnergyTemperatureMassFractionFunction, ablate::eos::tChem::SensibleInternalEnergy::getWorkSpaceSize}},
{ThermodynamicProperty::SensibleEnthalpy, {SensibleEnthalpyMassFractionFunction, SensibleEnthalpyTemperatureMassFractionFunction, ablate::eos::tChem::SensibleEnthalpy::getWorkSpaceSize}},
{ThermodynamicProperty::SpecificHeatConstantVolume,
{SpecificHeatConstantVolumeMassFractionFunction, SpecificHeatConstantVolumeTemperatureMassFractionFunction, [](auto nSpec) { return nSpec; }}},
{ThermodynamicProperty::SpecificHeatConstantPressure,
{SpecificHeatConstantPressureMassFractionFunction,
SpecificHeatConstantPressureTemperatureMassFractionFunction,
ablate::eos::tChem::Temperature::getWorkSpaceSize}} ,
{ThermodynamicProperty::SpeedOfSound, {SpeedOfSoundMassFractionFunction, SpeedOfSoundTemperatureMassFractionFunction, ablate::eos::tChem::SpeedOfSound::getWorkSpaceSize}},
{ThermodynamicProperty::SpeciesSensibleEnthalpy,
{SpeciesSensibleEnthalpyMassFractionFunction,
SpeciesSensibleEnthalpyTemperatureMassFractionFunction,
ablate::eos::tChem::Temperature::getWorkSpaceSize}}
}

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