MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
FvSysEqnDetChem< nDim >::SpeciesProperties Struct Reference

Struct for storing all relevant species information, which is read from a given mechanism file. More...

#include <fvcartesiansyseqndetchem.h>

Collaboration diagram for FvSysEqnDetChem< nDim >::SpeciesProperties:
[legend]

Public Member Functions

 SpeciesProperties (const MInt noSpecies, const FvSysEqnDetChem< nDim > &sysEqn)
 Construct a new FvSysEqnDetChem<nDim>::SpeciesProperties::SpeciesProperties object. More...
 
 ~SpeciesProperties ()
 Destroy the FvSysEqnDetChem<nDim>::SpeciesProperties::SpeciesProperties object. More...
 

Public Attributes

const MString majorSpecies = "N2"
 
MInt majorSpeciesIndex
 
const MFloat referenceTemp = 298.0
 
std::map< std::string, MIntspeciesMap
 
std::vector< MStringspeciesName
 
MFloatmolarMass = nullptr
 
MFloatfMolarMass = nullptr
 
MFloatspecificGasConstant = nullptr
 
MFloatfSpecificGasConstant = nullptr
 
MFloatstandardHeatFormation = nullptr
 

Protected Member Functions

void getSpeciesProperties (const MInt noSpecies, const FvSysEqnDetChem< nDim > &sysEqn)
 Gets important species information and stores it in the member variables of the species struct. More...
 

Detailed Description

template<MInt nDim>
struct FvSysEqnDetChem< nDim >::SpeciesProperties
Template Parameters
nDimNumber of dimensions

Definition at line 274 of file fvcartesiansyseqndetchem.h.

Constructor & Destructor Documentation

◆ SpeciesProperties()

template<MInt nDim>
FvSysEqnDetChem< nDim >::SpeciesProperties::SpeciesProperties ( const MInt  noSpecies,
const FvSysEqnDetChem< nDim > &  sysEqn 
)
Template Parameters
nDim
Parameters
noSpecies
sysEqn

Definition at line 141 of file fvcartesiansyseqndetchem.cpp.

141 {
142 mAlloc(molarMass, noSpecies, "FvSysEqnDetChem::SpeciesProperties::molarMass", AT_);
143 mAlloc(fMolarMass, noSpecies, "FvSysEqnDetChem::SpeciesProperties::fMolarMass", AT_);
144 mAlloc(specificGasConstant, noSpecies, "FvSysEqnDetChem::SpeciesProperties::specificGasConstant", AT_);
145 mAlloc(fSpecificGasConstant, noSpecies, "FvSysEqnDetChem::SpeciesProperties::fSpecificGasConstant", AT_);
146 mAlloc(standardHeatFormation, noSpecies, "FvSysEqnDetChem::SpeciesProperties::standardHeatFormation", AT_);
147
148 this->getSpeciesProperties(noSpecies, sysEqn);
149}
void mAlloc(T *&a, const MLong N, const MString &objectName, MString function)
allocates memory for one-dimensional array 'a' of size N
Definition: alloc.h:173
void getSpeciesProperties(const MInt noSpecies, const FvSysEqnDetChem< nDim > &sysEqn)
Gets important species information and stores it in the member variables of the species struct.

◆ ~SpeciesProperties()

template<MInt nDim>
FvSysEqnDetChem< nDim >::SpeciesProperties::~SpeciesProperties
Template Parameters
nDim

Definition at line 157 of file fvcartesiansyseqndetchem.cpp.

157 {
163}
MBool mDeallocate(T *&a)
deallocates the memory previously allocated for element 'a'
Definition: alloc.h:544

Member Function Documentation

◆ getSpeciesProperties()

template<MInt nDim>
void FvSysEqnDetChem< nDim >::SpeciesProperties::getSpeciesProperties ( const MInt  noSpecies,
const FvSysEqnDetChem< nDim > &  sysEqn 
)
protected
Template Parameters
nDimNumber of dimensions
Parameters
noSpeciesNumber of species
sysEqnEquation system

Definition at line 173 of file fvcartesiansyseqndetchem.cpp.

174 {
175 std::shared_ptr<Cantera::Solution> sol(
176 newSolution(sysEqn.m_reactionMechanism, sysEqn.m_phaseName, sysEqn.m_transportModel));
177 std::shared_ptr<Cantera::ThermoPhase> gas(sol->thermo());
178
179 const MInt numberMechanismSpecies = gas->nSpecies();
180
181 if(numberMechanismSpecies != noSpecies) {
182 std::cerr << "noSpecies in mechanism file: " << numberMechanismSpecies
183 << ". noSpecies in simulation properties file: " << noSpecies << std::endl;
184 mTerm(1, AT_,
185 "Number of species included in the mechanism file does not correspond to the number of species defined "
186 "in the properties-file. Terminating.");
187 }
188
189 gas->getMolecularWeights(molarMass); // SI: [kJ/kmol]]
190 speciesName = gas->speciesNames();
191
192 for(MUint s = 0; s < sysEqn.PV->m_noSpecies; s++) {
193 standardHeatFormation[s] = gas->Hf298SS(s); // SI: [J/kmol]]
194 molarMass[s] /= 1000.0; // SI: [kg/mol]
195 fMolarMass[s] = F1 / molarMass[s]; // SI: [mol/kg]
196 standardHeatFormation[s] /= 1000.0; // SI : [J/mol]
197 standardHeatFormation[s] = standardHeatFormation[s] * fMolarMass[s]; // SI : [J/kg]
200 }
201
202 auto stringIterator = std::find(speciesName.begin(), speciesName.end(), majorSpecies);
203 if(stringIterator == speciesName.end()) {
204 mTerm(1, AT_, "Given major species name was not found in the species name vector. Terminating.");
205 } else {
206 majorSpeciesIndex = std::distance(speciesName.begin(), stringIterator);
207 }
208
209 // Map an index position with each species name
210 for(MInt s = 0; s < noSpecies; s++) {
211 speciesMap.insert(std::pair<std::string, MInt>(speciesName[s], s));
212 }
213
214#ifndef NDEBUG
215 std::cout << "Detailed chemistry species properties." << std::endl;
216 for(MInt s = 0; s < numberMechanismSpecies; s++) {
217 std::cout << speciesName[s] << ". Molar mass: " << molarMass[s] << ". Heat formation: " << standardHeatFormation[s]
218 << ". Specific gas constant: " << specificGasConstant[s] << std::endl;
219 }
220#endif
221}
PrimitiveVariables * PV
void mTerm(const MInt errorCode, const MString &location, const MString &message)
Definition: functions.cpp:29
int32_t MInt
Definition: maiatypes.h:62
uint32_t MUint
Definition: maiatypes.h:63
std::map< std::string, MInt > speciesMap

Member Data Documentation

◆ fMolarMass

template<MInt nDim>
MFloat * FvSysEqnDetChem< nDim >::SpeciesProperties::fMolarMass = nullptr

Definition at line 284 of file fvcartesiansyseqndetchem.h.

◆ fSpecificGasConstant

template<MInt nDim>
MFloat * FvSysEqnDetChem< nDim >::SpeciesProperties::fSpecificGasConstant = nullptr

Definition at line 286 of file fvcartesiansyseqndetchem.h.

◆ majorSpecies

template<MInt nDim>
const MString FvSysEqnDetChem< nDim >::SpeciesProperties::majorSpecies = "N2"

Definition at line 275 of file fvcartesiansyseqndetchem.h.

◆ majorSpeciesIndex

template<MInt nDim>
MInt FvSysEqnDetChem< nDim >::SpeciesProperties::majorSpeciesIndex

Definition at line 276 of file fvcartesiansyseqndetchem.h.

◆ molarMass

template<MInt nDim>
MFloat * FvSysEqnDetChem< nDim >::SpeciesProperties::molarMass = nullptr

Definition at line 283 of file fvcartesiansyseqndetchem.h.

◆ referenceTemp

template<MInt nDim>
const MFloat FvSysEqnDetChem< nDim >::SpeciesProperties::referenceTemp = 298.0

Definition at line 278 of file fvcartesiansyseqndetchem.h.

◆ speciesMap

template<MInt nDim>
std::map< std::string, MInt > FvSysEqnDetChem< nDim >::SpeciesProperties::speciesMap

Definition at line 280 of file fvcartesiansyseqndetchem.h.

◆ speciesName

template<MInt nDim>
std::vector< MString > FvSysEqnDetChem< nDim >::SpeciesProperties::speciesName

Definition at line 282 of file fvcartesiansyseqndetchem.h.

◆ specificGasConstant

template<MInt nDim>
MFloat * FvSysEqnDetChem< nDim >::SpeciesProperties::specificGasConstant = nullptr

Definition at line 285 of file fvcartesiansyseqndetchem.h.

◆ standardHeatFormation

template<MInt nDim>
MFloat * FvSysEqnDetChem< nDim >::SpeciesProperties::standardHeatFormation = nullptr

Definition at line 287 of file fvcartesiansyseqndetchem.h.


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