etc/codeTemplates/dynamicCode: Added fluidReactionThermo dynamic compilation support

for chemFoam, fireFoam, buoyantReactingFoam, reactingFoam, chtMultiRegionFoam,
buoyantReactingParticleFoam, reactingParticleFoam, simpleReactingParticleFoam

If the combination of property models selected in thermophysicalProperties is
not already compiled and present in the standard libraries the thermophysical
property package will be constructed and compiled automatically using the
standard dynamicCode system provided in OpenFOAM.

The thermophysical property package is constructed automatically from the
etc/codeTemplates/dynamicCode files for the corresponding base thermo type,
fluidThermo, fluidReactionThermo etc. If the corresponding codeTemplates files
do not exist the standard thermo lookup error message is generated as before.

As with all other dynamicCode options in OpenFOAM (codeStream,
codedFunctionObject etc.) dynamic compilation of the thermophysical property
package is only enabled if allowSystemOperations is set true.
This commit is contained in:
Henry Weller
2021-04-16 18:42:38 +01:00
parent d4d269e93e
commit 29bbbd6984
7 changed files with 285 additions and 7 deletions

View File

@ -0,0 +1,113 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fluidThermo;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
type
(
hePsiThermo
heRhoThermo
);
baseType
(
hePsiThermo psiReactionThermo
heRhoThermo rhoReactionThermo
);
energy
(
sensibleEnthalpy
absoluteEnthalpy
sensibleInternalEnergy
absoluteInternalEnergy
);
mixture
(
singleComponentMixture
coefficientMultiComponentMixture
valueMultiComponentMixture
coefficientWilkeMultiComponentMixture
);
renameMixture
(
pureMixture singleComponentMixture
multiComponentMixture coefficientMultiComponentMixture
);
transport
(
const
icoTabulated
logPolynomial
polynomial
sutherland
tabulated
WLF
);
thermo
(
eConst
eIcoTabulated
ePolynomial
ePower
eTabulated
hConst
hIcoTabulated
hPolynomial
hPower
hTabulated
janaf
);
equationOfState
(
adiabaticPerfectFluid
Boussinesq
icoPolynomial
icoTabulated
incompressiblePerfectGas
linear
PengRobinsonGas
perfectFluid
perfectGas
rhoConst
rhoTabulated
rPolynomial
);
codeOptions
#{
EXE_INC = \
-I$(LIB_SRC)/transportModels/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
#};
codeLibs
#{
LIB_LIBS = \
-ltransportModels \
-lspecie \
-lfluidThermophysicalModels \
-lfiniteVolume
#};
// ************************************************************************* //

View File

@ -0,0 +1,93 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) YEAR OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "forThermo.H"
#include "makeReactionThermo.H"
#include "specie.H"
#include "thermo.H"
// EoS
#include "${equationOfState}.H"
// Thermo
#include "${thermo}Thermo.H"
#include "${energy}.H"
// Transport
#include "${transport}Transport.H"
// psi/rho
#include "${baseType}.H"
#include "${type}.H"
#include "psiReactionThermo.H"
// Mixture
#include "${mixture}.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
extern "C"
{
// dynamicCode:
// SHA1 = ${SHA1sum}
//
// Unique function name that can be checked if the correct library version
// has been loaded
void ${typeName}_${SHA1sum}(bool load)
{
if (load)
{
// code that can be explicitly executed after loading
}
else
{
// code that can be explicitly executed before unloading
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
forThermo
(
${transport}Transport,
${energy},
${thermo}Thermo,
${equationOfState},
specie,
makeReactionThermo,
${baseType},
${type},
${mixture}
);
}
// ************************************************************************* //

View File

@ -82,7 +82,7 @@ namespace Foam
${thermo}Thermo,
${equationOfState},
specie,
makeThermos,
makeThermo,
${baseType},
${type},
${mixture}

View File

@ -82,7 +82,7 @@ namespace Foam
${thermo}Thermo,
${equationOfState},
specie,
makePsiuReactionThermos,
makePsiuReactionThermo,
${mixture}
);
}