thermophysicalModels: Centralised instantiation macros

All models that require templating on the thermodynamic model, including
the thermodynamic models themselves, are now instantiated using a
centralised set of variadic macros. Seven macros exist to instantiate
models for different classes of thermodynamics model. These are:

   forGases:          All model combinations valid for gases

   forCommonGases:    The most commonly used gas models

   forAbsoluteGases:  A limited selection of gas models with absolute
                      forms of energy, for use with Xi-combustion models

   forLiquids:        All model combinations valid for liquids

   forCommonLiquids:  The most commonly used liquid models

   forPolynomials:    Model combinations with properties fitted to
                      polynomials

   forSolids:         All model combinations valid for solids

All the *ThermoPhysics typedefs have been removed, as this system was
fundamentally not extensible. The enormous lists of thermodynamic
instantiations that existed for reaction thermos, chemistry models,
tabulation methods, etc..., were extremely difficult to read and reason
about what combinations are valid under what circumstances. This change
centralises those decisions, makes them concise and readable, and makes
them consistent across the entire codebase.

Soot model selection has now been brought up to date in line with
chemistry, combustion, and others. The angle-bracketed part of the name
is no longer necessary; this information is determined directly from the
existing thermo model. So, now to select a mixture-fraction soot model,
the entry is simply:

    sootModel   mixtureFraction;

Rather than:

    sootModel   mixtureFraction<rhoReactionThermo,gasHThermoPhysics>;

The only place in which *ThermoPhysics typedefs are still required in
the selection name is in the thermalBaffle1D boundary condition. Here
there is no thermo model from which to determine a name. This eventually
needs resolving either by adding a selection mechanism similar to that
of the thermo packages themselves, or by removing this boundary
condition in favour of the (non-1D) thermal baffle boundary condition
and region model.
This commit is contained in:
Will Bainbridge
2020-04-30 09:42:18 +01:00
parent 73a594cbce
commit fe89082f73
83 changed files with 2016 additions and 4335 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -315,8 +315,8 @@ List<specieElement> currentSpecieComposition(5);
scalar currentLowT = 0;
scalar currentHighT = 0;
scalar currentCommonT = 0;
gasHThermoPhysics::coeffArray highCpCoeffs(scalarList(7));
gasHThermoPhysics::coeffArray lowCpCoeffs(scalarList(7));
chemkinReader::thermoPhysics::coeffArray highCpCoeffs(scalarList(7));
chemkinReader::thermoPhysics::coeffArray lowCpCoeffs(scalarList(7));
specieCoeffs currentSpecieCoeff;
@ -633,7 +633,7 @@ bool finishReaction = false;
<readThermoLineLabel4>{thermoLineLabel4} {
HashPtrTable<gasHThermoPhysics>::iterator specieThermoIter
HashPtrTable<chemkinReader::thermoPhysics>::iterator specieThermoIter
(
speciesThermo_.find(currentSpecieName)
);
@ -646,7 +646,7 @@ bool finishReaction = false;
speciesThermo_.insert
(
currentSpecieName,
new gasHThermoPhysics
new chemkinReader::thermoPhysics
(
janafThermo<perfectGas<specie>>
(
@ -671,15 +671,15 @@ bool finishReaction = false;
}
<readThermoSpecieName>{end} {
Reaction<gasHThermoPhysics>::TlowDefault = max
Reaction<chemkinReader::thermoPhysics>::TlowDefault = max
(
Reaction<gasHThermoPhysics>::TlowDefault,
Reaction<chemkinReader::thermoPhysics>::TlowDefault,
currentLowT
);
Reaction<gasHThermoPhysics>::ThighDefault = min
Reaction<chemkinReader::thermoPhysics>::ThighDefault = min
(
Reaction<gasHThermoPhysics>::ThighDefault,
Reaction<chemkinReader::thermoPhysics>::ThighDefault,
currentHighT
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -172,9 +172,9 @@ void Foam::chemkinReader::addReactionType
{
reactions_.append
(
new IrreversibleReaction<gasHThermoPhysics, ReactionRateType>
new IrreversibleReaction<thermoPhysics, ReactionRateType>
(
ReactionProxy<gasHThermoPhysics>
ReactionProxy<thermoPhysics>
(
speciesTable_,
lhs.shrink(),
@ -191,9 +191,9 @@ void Foam::chemkinReader::addReactionType
{
reactions_.append
(
new ReversibleReaction<gasHThermoPhysics, ReactionRateType>
new ReversibleReaction<thermoPhysics, ReactionRateType>
(
ReactionProxy<gasHThermoPhysics>
ReactionProxy<thermoPhysics>
(
speciesTable_,
lhs.shrink(),
@ -480,11 +480,11 @@ void Foam::chemkinReader::addReaction
(
new NonEquilibriumReversibleReaction
<
gasHThermoPhysics,
thermoPhysics,
ArrheniusReactionRate
>
(
ReactionProxy<gasHThermoPhysics>
ReactionProxy<thermoPhysics>
(
speciesTable_,
lhs.shrink(),
@ -535,11 +535,11 @@ void Foam::chemkinReader::addReaction
(
new NonEquilibriumReversibleReaction
<
gasHThermoPhysics,
thermoPhysics,
thirdBodyArrheniusReactionRate
>
(
ReactionProxy<gasHThermoPhysics>
ReactionProxy<thermoPhysics>
(
speciesTable_,
lhs.shrink(),
@ -640,11 +640,11 @@ void Foam::chemkinReader::addReaction
(
new NonEquilibriumReversibleReaction
<
gasHThermoPhysics,
thermoPhysics,
LandauTellerReactionRate
>
(
ReactionProxy<gasHThermoPhysics>
ReactionProxy<thermoPhysics>
(
speciesTable_,
lhs.shrink(),
@ -776,8 +776,8 @@ void Foam::chemkinReader::read
const fileName& transportFileName
)
{
Reaction<gasHThermoPhysics>::TlowDefault = 0;
Reaction<gasHThermoPhysics>::ThighDefault = great;
Reaction<thermoPhysics>::TlowDefault = 0;
Reaction<thermoPhysics>::ThighDefault = great;
transportDict_.read(IFstream(transportFileName)());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,7 +46,13 @@ SourceFiles
#include "speciesTable.H"
#include "specieElement.H"
#include "atomicWeights.H"
#include "reactionTypes.H"
#include "specie.H"
#include "perfectGas.H"
#include "janafThermo.H"
#include "sensibleEnthalpy.H"
#include "sutherlandTransport.H"
#include "thermo.H"
#include <FlexLexer.h>
@ -55,6 +61,8 @@ SourceFiles
namespace Foam
{
typedef HashTable<List<specieElement>> speciesCompositionTable;
/*---------------------------------------------------------------------------*\
@ -77,6 +85,21 @@ public:
gas
};
// Public typedefs
typedef
sutherlandTransport
<
species::thermo
<
janafThermo
<
perfectGas<specie>
>,
sensibleEnthalpy
>
> thermoPhysics;
private:
@ -173,13 +196,13 @@ private:
HashTable<phase> speciePhase_;
//- Table of the thermodynamic data given in the CHEMKIN file
HashPtrTable<gasHThermoPhysics> speciesThermo_;
HashPtrTable<thermoPhysics> speciesThermo_;
//- Table of species composition
speciesCompositionTable speciesComposition_;
//- List of the reactions
ReactionList<gasHThermoPhysics> reactions_;
ReactionList<thermoPhysics> reactions_;
//- Transport properties dictionary
dictionary transportDict_;
@ -351,13 +374,13 @@ public:
}
//- Table of the thermodynamic data given in the CHEMKIN file
const HashPtrTable<gasHThermoPhysics>& speciesThermo() const
const HashPtrTable<thermoPhysics>& speciesThermo() const
{
return speciesThermo_;
}
//- List of the reactions
const ReactionList<gasHThermoPhysics>& reactions() const
const ReactionList<thermoPhysics>& reactions() const
{
return reactions_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -65,7 +65,8 @@ int main(int argc, char *argv[])
speciesTable species;
chemkinReader cr(species, args[1], args[3], args[2], newFormat);
const HashPtrTable<gasHThermoPhysics>& speciesThermo = cr.speciesThermo();
const HashPtrTable<chemkinReader::thermoPhysics>& speciesThermo =
cr.speciesThermo();
dictionary thermoDict;
thermoDict.add("species", cr.species());
@ -82,7 +83,12 @@ int main(int argc, char *argv[])
// pending complete integration into the thermodynamics structure
// Add elements
forAllConstIter(HashPtrTable<gasHThermoPhysics>, speciesThermo, iter)
forAllConstIter
(
HashPtrTable<chemkinReader::thermoPhysics>,
speciesThermo,
iter
)
{
const word specieName(iter.key());