chemistryTabulationMethods: Untemplated to simply the code and reduce compilation time
With the changes to chemistryModel to evaluate and integrate reaction rates mass-fraction based rather than mole-fraction based ISAT is now independent of the thermodynamics and with some restructuring of chemistryModel and the addition of the non-templated base-class odeChemistryModel is has been possible to un-template chemistryTabulationMethods and ISAT in particular. This simplifies the ISAT code and hence maintenance as well as reducing the compilation time of chemistryModel on the various thermo packages.
This commit is contained in:
@ -91,12 +91,10 @@ namespace Foam
|
|||||||
#if ${method}CppTest == chemistryModelCppTest
|
#if ${method}CppTest == chemistryModelCppTest
|
||||||
|
|
||||||
#include "makeChemistryReductionMethod.H"
|
#include "makeChemistryReductionMethod.H"
|
||||||
#include "makeChemistryTabulationMethod.H"
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineChemistryReductionMethod(nullArg, ThermoPhysics);
|
defineChemistryReductionMethod(nullArg, ThermoPhysics);
|
||||||
defineChemistryTabulationMethod(nullArg, ThermoPhysics);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "noChemistryReduction.H"
|
#include "noChemistryReduction.H"
|
||||||
@ -116,14 +114,6 @@ namespace Foam
|
|||||||
makeChemistryReductionMethod(PFA, ThermoPhysics);
|
makeChemistryReductionMethod(PFA, ThermoPhysics);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "noChemistryTabulation.H"
|
|
||||||
#include "ISAT.H"
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
makeChemistryTabulationMethod(none, ThermoPhysics);
|
|
||||||
makeChemistryTabulationMethod(ISAT, ThermoPhysics);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,8 @@ chemistrySolver/noChemistrySolver/noChemistrySolvers.C
|
|||||||
chemistrySolver/EulerImplicit/EulerImplicitChemistrySolvers.C
|
chemistrySolver/EulerImplicit/EulerImplicitChemistrySolvers.C
|
||||||
chemistrySolver/ode/odeChemistrySolvers.C
|
chemistrySolver/ode/odeChemistrySolvers.C
|
||||||
|
|
||||||
|
odeChemistryModel/odeChemistryModel.C
|
||||||
|
|
||||||
chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethods.C
|
chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethods.C
|
||||||
chemistryModel/reduction/noChemistryReduction/noChemistryReductionMethods.C
|
chemistryModel/reduction/noChemistryReduction/noChemistryReductionMethods.C
|
||||||
chemistryModel/reduction/DAC/DACChemistryReductionMethods.C
|
chemistryModel/reduction/DAC/DACChemistryReductionMethods.C
|
||||||
@ -14,9 +16,13 @@ chemistryModel/reduction/DRGEP/DRGEPChemistryReductionMethods.C
|
|||||||
chemistryModel/reduction/EFA/EFAChemistryReductionMethods.C
|
chemistryModel/reduction/EFA/EFAChemistryReductionMethods.C
|
||||||
chemistryModel/reduction/PFA/PFAChemistryReductionMethods.C
|
chemistryModel/reduction/PFA/PFAChemistryReductionMethods.C
|
||||||
|
|
||||||
chemistryModel/tabulation/chemistryTabulationMethod/chemistryTabulationMethods.C
|
chemistryModel/tabulation/chemistryTabulationMethod/chemistryTabulationMethod.C
|
||||||
chemistryModel/tabulation/noChemistryTabulation/noChemistryTabulationMethods.C
|
chemistryModel/tabulation/chemistryTabulationMethod/chemistryTabulationMethodNew.C
|
||||||
chemistryModel/tabulation/ISAT/ISATChemistryTabulationMethods.C
|
chemistryModel/tabulation/noChemistryTabulation/noChemistryTabulation.C
|
||||||
|
chemistryModel/tabulation/ISAT/ISAT.C
|
||||||
|
chemistryModel/tabulation/ISAT/chemPointISAT/chemPointISAT.C
|
||||||
|
chemistryModel/tabulation/ISAT/binaryNode/binaryNode.C
|
||||||
|
chemistryModel/tabulation/ISAT/binaryTree/binaryTree.C
|
||||||
|
|
||||||
reactions/makeReactions.C
|
reactions/makeReactions.C
|
||||||
|
|
||||||
|
|||||||
@ -36,8 +36,7 @@ Foam::chemistryModel<ThermoType>::chemistryModel
|
|||||||
const fluidReactionThermo& thermo
|
const fluidReactionThermo& thermo
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
basicChemistryModel(thermo),
|
odeChemistryModel(thermo),
|
||||||
ODESystem(),
|
|
||||||
log_(this->lookupOrDefault("log", false)),
|
log_(this->lookupOrDefault("log", false)),
|
||||||
loadBalancing_(this->lookupOrDefault("loadBalancing", false)),
|
loadBalancing_(this->lookupOrDefault("loadBalancing", false)),
|
||||||
jacobianType_
|
jacobianType_
|
||||||
@ -46,18 +45,14 @@ Foam::chemistryModel<ThermoType>::chemistryModel
|
|||||||
? jacobianTypeNames_.read(this->lookup("jacobian"))
|
? jacobianTypeNames_.read(this->lookup("jacobian"))
|
||||||
: jacobianType::fast
|
: jacobianType::fast
|
||||||
),
|
),
|
||||||
Yvf_(this->thermo().composition().Y()),
|
|
||||||
mixture_(refCast<const multiComponentMixture<ThermoType>>(this->thermo())),
|
mixture_(refCast<const multiComponentMixture<ThermoType>>(this->thermo())),
|
||||||
specieThermos_(mixture_.specieThermos()),
|
specieThermos_(mixture_.specieThermos()),
|
||||||
reactions_(mixture_.species(), specieThermos_, this->mesh(), *this),
|
reactions_(mixture_.species(), specieThermos_, this->mesh(), *this),
|
||||||
nSpecie_(Yvf_.size()),
|
|
||||||
RR_(nSpecie_),
|
RR_(nSpecie_),
|
||||||
Y_(nSpecie_),
|
Y_(nSpecie_),
|
||||||
c_(nSpecie_),
|
c_(nSpecie_),
|
||||||
YTpWork_(scalarField(nSpecie_ + 2)),
|
YTpWork_(scalarField(nSpecie_ + 2)),
|
||||||
YTpYTpWork_(scalarSquareMatrix(nSpecie_ + 2)),
|
YTpYTpWork_(scalarSquareMatrix(nSpecie_ + 2)),
|
||||||
cTos_(nSpecie_, -1),
|
|
||||||
sToc_(nSpecie_),
|
|
||||||
mechRedPtr_
|
mechRedPtr_
|
||||||
(
|
(
|
||||||
chemistryReductionMethod<ThermoType>::New
|
chemistryReductionMethod<ThermoType>::New
|
||||||
@ -67,15 +62,7 @@ Foam::chemistryModel<ThermoType>::chemistryModel
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
mechRed_(*mechRedPtr_),
|
mechRed_(*mechRedPtr_),
|
||||||
mechRedActive_(mechRed_.active()),
|
tabulationPtr_(chemistryTabulationMethod::New(*this, *this)),
|
||||||
tabulationPtr_
|
|
||||||
(
|
|
||||||
chemistryTabulationMethod<ThermoType>::New
|
|
||||||
(
|
|
||||||
*this,
|
|
||||||
*this
|
|
||||||
)
|
|
||||||
),
|
|
||||||
tabulation_(*tabulationPtr_)
|
tabulation_(*tabulationPtr_)
|
||||||
{
|
{
|
||||||
// Create the fields for the chemistry sources
|
// Create the fields for the chemistry sources
|
||||||
@ -105,7 +92,7 @@ Foam::chemistryModel<ThermoType>::chemistryModel
|
|||||||
|
|
||||||
// When the mechanism reduction method is used, the 'active' flag for every
|
// When the mechanism reduction method is used, the 'active' flag for every
|
||||||
// species should be initialised (by default 'active' is true)
|
// species should be initialised (by default 'active' is true)
|
||||||
if (mechRedActive_)
|
if (reduction_)
|
||||||
{
|
{
|
||||||
const basicSpecieMixture& composition = this->thermo().composition();
|
const basicSpecieMixture& composition = this->thermo().composition();
|
||||||
|
|
||||||
@ -153,7 +140,7 @@ void Foam::chemistryModel<ThermoType>::derivatives
|
|||||||
scalarField& dYTpdt
|
scalarField& dYTpdt
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (mechRedActive_)
|
if (reduction_)
|
||||||
{
|
{
|
||||||
forAll(sToc_, i)
|
forAll(sToc_, i)
|
||||||
{
|
{
|
||||||
@ -198,7 +185,7 @@ void Foam::chemistryModel<ThermoType>::derivatives
|
|||||||
c_,
|
c_,
|
||||||
li,
|
li,
|
||||||
dYTpdt,
|
dYTpdt,
|
||||||
mechRedActive_,
|
reduction_,
|
||||||
cTos_,
|
cTos_,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
@ -246,7 +233,7 @@ void Foam::chemistryModel<ThermoType>::jacobian
|
|||||||
scalarSquareMatrix& J
|
scalarSquareMatrix& J
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (mechRedActive_)
|
if (reduction_)
|
||||||
{
|
{
|
||||||
forAll(sToc_, i)
|
forAll(sToc_, i)
|
||||||
{
|
{
|
||||||
@ -334,7 +321,7 @@ void Foam::chemistryModel<ThermoType>::jacobian
|
|||||||
li,
|
li,
|
||||||
dYTpdt,
|
dYTpdt,
|
||||||
ddNdtByVdcTp,
|
ddNdtByVdcTp,
|
||||||
mechRedActive_,
|
reduction_,
|
||||||
cTos_,
|
cTos_,
|
||||||
0,
|
0,
|
||||||
nSpecie_,
|
nSpecie_,
|
||||||
@ -688,7 +675,7 @@ void Foam::chemistryModel<ThermoType>::calculate()
|
|||||||
c_,
|
c_,
|
||||||
celli,
|
celli,
|
||||||
dNdtByV,
|
dNdtByV,
|
||||||
mechRedActive_,
|
reduction_,
|
||||||
cTos_,
|
cTos_,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
@ -796,7 +783,7 @@ Foam::scalar Foam::chemistryModel<ThermoType>::solve
|
|||||||
// (it will either expand the current data or add a new stored point).
|
// (it will either expand the current data or add a new stored point).
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mechRedActive_)
|
if (reduction_)
|
||||||
{
|
{
|
||||||
// Compute concentrations
|
// Compute concentrations
|
||||||
for (label i=0; i<nSpecie_; i++)
|
for (label i=0; i<nSpecie_; i++)
|
||||||
@ -825,7 +812,7 @@ Foam::scalar Foam::chemistryModel<ThermoType>::solve
|
|||||||
while (timeLeft > small)
|
while (timeLeft > small)
|
||||||
{
|
{
|
||||||
scalar dt = timeLeft;
|
scalar dt = timeLeft;
|
||||||
if (mechRedActive_)
|
if (reduction_)
|
||||||
{
|
{
|
||||||
// Solve the reduced set of ODE
|
// Solve the reduced set of ODE
|
||||||
solve
|
solve
|
||||||
@ -880,7 +867,7 @@ Foam::scalar Foam::chemistryModel<ThermoType>::solve
|
|||||||
// When operations are done and if mechanism reduction is active,
|
// When operations are done and if mechanism reduction is active,
|
||||||
// the number of species (which also affects nEqns) is set back
|
// the number of species (which also affects nEqns) is set back
|
||||||
// to the total number of species (stored in the mechRed object)
|
// to the total number of species (stored in the mechRed object)
|
||||||
if (mechRedActive_)
|
if (reduction_)
|
||||||
{
|
{
|
||||||
setNSpecie(mechRed_.nSpecie());
|
setNSpecie(mechRed_.nSpecie());
|
||||||
}
|
}
|
||||||
@ -911,7 +898,7 @@ Foam::scalar Foam::chemistryModel<ThermoType>::solve
|
|||||||
mechRed_.update();
|
mechRed_.update();
|
||||||
tabulation_.update();
|
tabulation_.update();
|
||||||
|
|
||||||
if (mechRedActive_ && Pstream::parRun())
|
if (reduction_ && Pstream::parRun())
|
||||||
{
|
{
|
||||||
List<bool> active(composition.active());
|
List<bool> active(composition.active());
|
||||||
Pstream::listCombineGather(active, orEqOp<bool>());
|
Pstream::listCombineGather(active, orEqOp<bool>());
|
||||||
|
|||||||
@ -66,7 +66,7 @@ SourceFiles
|
|||||||
#ifndef chemistryModel_H
|
#ifndef chemistryModel_H
|
||||||
#define chemistryModel_H
|
#define chemistryModel_H
|
||||||
|
|
||||||
#include "basicChemistryModel.H"
|
#include "odeChemistryModel.H"
|
||||||
#include "ReactionList.H"
|
#include "ReactionList.H"
|
||||||
#include "ODESystem.H"
|
#include "ODESystem.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
@ -74,7 +74,6 @@ SourceFiles
|
|||||||
#include "chemistryReductionMethod.H"
|
#include "chemistryReductionMethod.H"
|
||||||
#include "chemistryTabulationMethod.H"
|
#include "chemistryTabulationMethod.H"
|
||||||
#include "DynamicField.H"
|
#include "DynamicField.H"
|
||||||
#include "OFstream.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -88,8 +87,7 @@ namespace Foam
|
|||||||
template<class ThermoType>
|
template<class ThermoType>
|
||||||
class chemistryModel
|
class chemistryModel
|
||||||
:
|
:
|
||||||
public basicChemistryModel,
|
public odeChemistryModel
|
||||||
public ODESystem
|
|
||||||
{
|
{
|
||||||
// Private classes
|
// Private classes
|
||||||
|
|
||||||
@ -136,9 +134,6 @@ class chemistryModel
|
|||||||
//- Type of the Jacobian to be calculated
|
//- Type of the Jacobian to be calculated
|
||||||
const jacobianType jacobianType_;
|
const jacobianType jacobianType_;
|
||||||
|
|
||||||
//- Reference to the field of specie mass fractions
|
|
||||||
const PtrList<volScalarField>& Yvf_;
|
|
||||||
|
|
||||||
//- Reference to the multi component mixture
|
//- Reference to the multi component mixture
|
||||||
const multiComponentMixture<ThermoType>& mixture_;
|
const multiComponentMixture<ThermoType>& mixture_;
|
||||||
|
|
||||||
@ -148,9 +143,6 @@ class chemistryModel
|
|||||||
//- Reactions
|
//- Reactions
|
||||||
const ReactionList<ThermoType> reactions_;
|
const ReactionList<ThermoType> reactions_;
|
||||||
|
|
||||||
//- Number of species
|
|
||||||
label nSpecie_;
|
|
||||||
|
|
||||||
//- List of reaction rate per specie [kg/m^3/s]
|
//- List of reaction rate per specie [kg/m^3/s]
|
||||||
PtrList<volScalarField::Internal> RR_;
|
PtrList<volScalarField::Internal> RR_;
|
||||||
|
|
||||||
@ -172,27 +164,17 @@ class chemistryModel
|
|||||||
//- Specie-temperature-pressure workspace matrices
|
//- Specie-temperature-pressure workspace matrices
|
||||||
mutable FixedList<scalarSquareMatrix, 2> YTpYTpWork_;
|
mutable FixedList<scalarSquareMatrix, 2> YTpYTpWork_;
|
||||||
|
|
||||||
//- Temporary map from complete to simplified concentration fields
|
|
||||||
// c -> sc
|
|
||||||
List<label> cTos_;
|
|
||||||
|
|
||||||
//- Temporary map from simplified to complete concentration fields
|
|
||||||
// sc -> c
|
|
||||||
DynamicList<label> sToc_;
|
|
||||||
|
|
||||||
//- Mechanism reduction method
|
//- Mechanism reduction method
|
||||||
autoPtr<chemistryReductionMethod<ThermoType>> mechRedPtr_;
|
autoPtr<chemistryReductionMethod<ThermoType>> mechRedPtr_;
|
||||||
|
|
||||||
//- Mechanism reduction method reference
|
//- Mechanism reduction method reference
|
||||||
chemistryReductionMethod<ThermoType>& mechRed_;
|
chemistryReductionMethod<ThermoType>& mechRed_;
|
||||||
|
|
||||||
bool mechRedActive_;
|
|
||||||
|
|
||||||
//- Tabulation method
|
//- Tabulation method
|
||||||
autoPtr<chemistryTabulationMethod<ThermoType>> tabulationPtr_;
|
autoPtr<chemistryTabulationMethod> tabulationPtr_;
|
||||||
|
|
||||||
//- Tabulation method reference
|
//- Tabulation method reference
|
||||||
chemistryTabulationMethod<ThermoType>& tabulation_;
|
chemistryTabulationMethod& tabulation_;
|
||||||
|
|
||||||
//- Log file for average time spent solving the chemistry
|
//- Log file for average time spent solving the chemistry
|
||||||
autoPtr<OFstream> cpuSolveFile_;
|
autoPtr<OFstream> cpuSolveFile_;
|
||||||
@ -232,9 +214,6 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Create and return a TDAC log file of the given name
|
|
||||||
inline autoPtr<OFstream> logFile(const word& name) const;
|
|
||||||
|
|
||||||
//- Return reference to the mixture
|
//- Return reference to the mixture
|
||||||
inline const multiComponentMixture<ThermoType>& mixture() const;
|
inline const multiComponentMixture<ThermoType>& mixture() const;
|
||||||
|
|
||||||
@ -244,9 +223,6 @@ public:
|
|||||||
//- Thermodynamic data of the species
|
//- Thermodynamic data of the species
|
||||||
inline const PtrList<ThermoType>& specieThermos() const;
|
inline const PtrList<ThermoType>& specieThermos() const;
|
||||||
|
|
||||||
//- The number of species
|
|
||||||
virtual inline label nSpecie() const;
|
|
||||||
|
|
||||||
//- The number of reactions
|
//- The number of reactions
|
||||||
virtual inline label nReaction() const;
|
virtual inline label nReaction() const;
|
||||||
|
|
||||||
@ -293,9 +269,6 @@ public:
|
|||||||
|
|
||||||
// ODE functions (overriding abstract functions in ODE.H)
|
// ODE functions (overriding abstract functions in ODE.H)
|
||||||
|
|
||||||
//- Number of ODE's to solve
|
|
||||||
inline virtual label nEqns() const;
|
|
||||||
|
|
||||||
virtual void derivatives
|
virtual void derivatives
|
||||||
(
|
(
|
||||||
const scalar t,
|
const scalar t,
|
||||||
@ -324,32 +297,14 @@ public:
|
|||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
|
|
||||||
//- Return a reference to the list of mass fraction fields
|
|
||||||
inline const PtrList<volScalarField>& Y() const;
|
|
||||||
|
|
||||||
|
|
||||||
// Mechanism reduction access functions
|
// Mechanism reduction access functions
|
||||||
|
|
||||||
//- Return true if mechanism reduction is active
|
|
||||||
inline bool reduction() const;
|
|
||||||
|
|
||||||
//- Allow the reduction method to reset the number of species
|
|
||||||
inline void setNSpecie(const label newNs);
|
|
||||||
|
|
||||||
//- Return true if specie i is active
|
//- Return true if specie i is active
|
||||||
inline bool active(const label i) const;
|
inline bool active(const label i) const;
|
||||||
|
|
||||||
//- Set specie i active
|
//- Set specie i active
|
||||||
inline void setActive(const label i);
|
inline void setActive(const label i);
|
||||||
|
|
||||||
//- Return the index in the complete set of species
|
|
||||||
// corresponding to the index si in the simplified set of species
|
|
||||||
inline label sToc(const label si) const;
|
|
||||||
|
|
||||||
//- Return the index in the simplified set of species
|
|
||||||
// corresponding to the index si in the complete set of species
|
|
||||||
inline label cTos(const label ci) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
|
|||||||
@ -23,32 +23,8 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "OSspecific.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
inline Foam::autoPtr<Foam::OFstream>
|
|
||||||
Foam::chemistryModel<ThermoType>::logFile(const word& name) const
|
|
||||||
{
|
|
||||||
mkDir(this->mesh().time().path()/"TDAC"/this->group());
|
|
||||||
return autoPtr<OFstream>
|
|
||||||
(
|
|
||||||
new OFstream
|
|
||||||
(
|
|
||||||
this->mesh().time().path()/"TDAC"/this->group()/name
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
inline Foam::label Foam::chemistryModel<ThermoType>::nEqns() const
|
|
||||||
{
|
|
||||||
// nEqns = number of species + temperature + pressure
|
|
||||||
return nSpecie_ + 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
template<class ThermoType>
|
||||||
inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>&
|
inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>&
|
||||||
Foam::chemistryModel<ThermoType>::RR()
|
Foam::chemistryModel<ThermoType>::RR()
|
||||||
@ -81,13 +57,6 @@ Foam::chemistryModel<ThermoType>::specieThermos() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
inline Foam::label Foam::chemistryModel<ThermoType>::nSpecie() const
|
|
||||||
{
|
|
||||||
return nSpecie_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
template<class ThermoType>
|
||||||
inline Foam::label Foam::chemistryModel<ThermoType>::nReaction() const
|
inline Foam::label Foam::chemistryModel<ThermoType>::nReaction() const
|
||||||
{
|
{
|
||||||
@ -102,6 +71,7 @@ Foam::chemistryModel<ThermoType>::RR(const label i) const
|
|||||||
return RR_[i];
|
return RR_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
template<class ThermoType>
|
||||||
Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
|
Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
|
||||||
Foam::chemistryModel<ThermoType>::RR(const label i)
|
Foam::chemistryModel<ThermoType>::RR(const label i)
|
||||||
@ -110,21 +80,6 @@ Foam::chemistryModel<ThermoType>::RR(const label i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
inline const Foam::PtrList<Foam::volScalarField>&
|
|
||||||
Foam::chemistryModel<ThermoType>::Y() const
|
|
||||||
{
|
|
||||||
return this->Yvf_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
inline bool Foam::chemistryModel<ThermoType>::reduction() const
|
|
||||||
{
|
|
||||||
return mechRedActive_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
template<class ThermoType>
|
||||||
inline void Foam::chemistryModel<ThermoType>::setActive(const label i)
|
inline void Foam::chemistryModel<ThermoType>::setActive(const label i)
|
||||||
{
|
{
|
||||||
@ -139,45 +94,4 @@ inline bool Foam::chemistryModel<ThermoType>::active(const label i) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
inline void Foam::chemistryModel<ThermoType>::setNSpecie(const label newNs)
|
|
||||||
{
|
|
||||||
this->nSpecie_ = newNs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
inline Foam::label Foam::chemistryModel<ThermoType>::sToc
|
|
||||||
(
|
|
||||||
const label si
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (mechRedActive_)
|
|
||||||
{
|
|
||||||
return sToc_[si];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return si;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
inline Foam::label Foam::chemistryModel<ThermoType>::cTos
|
|
||||||
(
|
|
||||||
const label ci
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (mechRedActive_)
|
|
||||||
{
|
|
||||||
return cTos_[ci];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ci;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -86,10 +86,14 @@ Foam::chemistryReductionMethod<ThermoType>::New
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<chemistryReductionMethod<ThermoType>>
|
autoPtr<chemistryReductionMethod<ThermoType>> crmPtr
|
||||||
(
|
(
|
||||||
cstrIter()(dict, chemistry)
|
cstrIter()(dict, chemistry)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
chemistry.reduction_ = crmPtr->active();
|
||||||
|
|
||||||
|
return crmPtr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -24,18 +24,32 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "ISAT.H"
|
#include "ISAT.H"
|
||||||
|
#include "odeChemistryModel.H"
|
||||||
#include "LUscalarMatrix.H"
|
#include "LUscalarMatrix.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
|
||||||
|
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace chemistryTabulationMethods
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(ISAT, 0);
|
||||||
|
addToRunTimeSelectionTable(chemistryTabulationMethod, ISAT, dictionary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemistryTabulationMethods::ISAT::ISAT
|
||||||
Foam::chemistryTabulationMethods::ISAT<ThermoType>::ISAT
|
|
||||||
(
|
(
|
||||||
const dictionary& chemistryProperties,
|
const dictionary& chemistryProperties,
|
||||||
const chemistryModel<ThermoType>& chemistry
|
const odeChemistryModel& chemistry
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
chemistryTabulationMethod<ThermoType>
|
chemistryTabulationMethod
|
||||||
(
|
(
|
||||||
chemistryProperties,
|
chemistryProperties,
|
||||||
chemistry
|
chemistry
|
||||||
@ -135,24 +149,22 @@ Foam::chemistryTabulationMethods::ISAT<ThermoType>::ISAT
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemistryTabulationMethods::ISAT::~ISAT()
|
||||||
Foam::chemistryTabulationMethods::ISAT<ThermoType>::~ISAT()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::chemistryTabulationMethods::ISAT::addToMRU
|
||||||
void Foam::chemistryTabulationMethods::ISAT<ThermoType>::addToMRU
|
|
||||||
(
|
(
|
||||||
chemPointISAT<ThermoType>* phi0
|
chemPointISAT* phi0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (maxMRUSize_ > 0 && MRURetrieve_)
|
if (maxMRUSize_ > 0 && MRURetrieve_)
|
||||||
{
|
{
|
||||||
// First search if the chemPoint is already in the list
|
// First search if the chemPoint is already in the list
|
||||||
bool isInList = false;
|
bool isInList = false;
|
||||||
typename SLList <chemPointISAT<ThermoType>*>::iterator iter =
|
typename SLList <chemPointISAT*>::iterator iter =
|
||||||
MRUList_.begin();
|
MRUList_.begin();
|
||||||
for ( ; iter != MRUList_.end(); ++iter)
|
for ( ; iter != MRUList_.end(); ++iter)
|
||||||
{
|
{
|
||||||
@ -190,10 +202,9 @@ void Foam::chemistryTabulationMethods::ISAT<ThermoType>::addToMRU
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::chemistryTabulationMethods::ISAT::calcNewC
|
||||||
void Foam::chemistryTabulationMethods::ISAT<ThermoType>::calcNewC
|
|
||||||
(
|
(
|
||||||
chemPointISAT<ThermoType>* phi0,
|
chemPointISAT* phi0,
|
||||||
const scalarField& phiq,
|
const scalarField& phiq,
|
||||||
scalarField& Rphiq
|
scalarField& Rphiq
|
||||||
)
|
)
|
||||||
@ -258,10 +269,9 @@ void Foam::chemistryTabulationMethods::ISAT<ThermoType>::calcNewC
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
bool Foam::chemistryTabulationMethods::ISAT::grow
|
||||||
bool Foam::chemistryTabulationMethods::ISAT<ThermoType>::grow
|
|
||||||
(
|
(
|
||||||
chemPointISAT<ThermoType>* phi0,
|
chemPointISAT* phi0,
|
||||||
const scalarField& phiq,
|
const scalarField& phiq,
|
||||||
const scalarField& Rphiq
|
const scalarField& Rphiq
|
||||||
)
|
)
|
||||||
@ -296,18 +306,16 @@ bool Foam::chemistryTabulationMethods::ISAT<ThermoType>::grow
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
bool Foam::chemistryTabulationMethods::ISAT::cleanAndBalance()
|
||||||
bool
|
|
||||||
Foam::chemistryTabulationMethods::ISAT<ThermoType>::cleanAndBalance()
|
|
||||||
{
|
{
|
||||||
bool treeModified(false);
|
bool treeModified(false);
|
||||||
|
|
||||||
// Check all chemPoints to see if we need to delete some of the chemPoints
|
// Check all chemPoints to see if we need to delete some of the chemPoints
|
||||||
// according to the elapsed time and number of growths
|
// according to the elapsed time and number of growths
|
||||||
chemPointISAT<ThermoType>* x = chemisTree_.treeMin();
|
chemPointISAT* x = chemisTree_.treeMin();
|
||||||
while(x != nullptr)
|
while(x != nullptr)
|
||||||
{
|
{
|
||||||
chemPointISAT<ThermoType>* xtmp = chemisTree_.treeSuccessor(x);
|
chemPointISAT* xtmp = chemisTree_.treeSuccessor(x);
|
||||||
|
|
||||||
const scalar elapsedTimeSteps = timeSteps() - x->timeTag();
|
const scalar elapsedTimeSteps = timeSteps() - x->timeTag();
|
||||||
|
|
||||||
@ -341,8 +349,7 @@ Foam::chemistryTabulationMethods::ISAT<ThermoType>::cleanAndBalance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::chemistryTabulationMethods::ISAT::computeA
|
||||||
void Foam::chemistryTabulationMethods::ISAT<ThermoType>::computeA
|
|
||||||
(
|
(
|
||||||
scalarSquareMatrix& A,
|
scalarSquareMatrix& A,
|
||||||
const scalarField& Rphiq,
|
const scalarField& Rphiq,
|
||||||
@ -400,8 +407,7 @@ void Foam::chemistryTabulationMethods::ISAT<ThermoType>::computeA
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
bool Foam::chemistryTabulationMethods::ISAT::retrieve
|
||||||
bool Foam::chemistryTabulationMethods::ISAT<ThermoType>::retrieve
|
|
||||||
(
|
(
|
||||||
const Foam::scalarField& phiq,
|
const Foam::scalarField& phiq,
|
||||||
scalarField& Rphiq
|
scalarField& Rphiq
|
||||||
@ -413,7 +419,7 @@ bool Foam::chemistryTabulationMethods::ISAT<ThermoType>::retrieve
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool retrieved(false);
|
bool retrieved(false);
|
||||||
chemPointISAT<ThermoType>* phi0;
|
chemPointISAT* phi0;
|
||||||
|
|
||||||
// If the tree is not empty
|
// If the tree is not empty
|
||||||
if (chemisTree_.size())
|
if (chemisTree_.size())
|
||||||
@ -437,7 +443,7 @@ bool Foam::chemistryTabulationMethods::ISAT<ThermoType>::retrieve
|
|||||||
{
|
{
|
||||||
typename SLList
|
typename SLList
|
||||||
<
|
<
|
||||||
chemPointISAT<ThermoType>*
|
chemPointISAT*
|
||||||
>::iterator iter = MRUList_.begin();
|
>::iterator iter = MRUList_.begin();
|
||||||
|
|
||||||
for ( ; iter != MRUList_.end(); ++iter)
|
for ( ; iter != MRUList_.end(); ++iter)
|
||||||
@ -485,8 +491,7 @@ bool Foam::chemistryTabulationMethods::ISAT<ThermoType>::retrieve
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::label Foam::chemistryTabulationMethods::ISAT::add
|
||||||
Foam::label Foam::chemistryTabulationMethods::ISAT<ThermoType>::add
|
|
||||||
(
|
(
|
||||||
const scalarField& phiq,
|
const scalarField& phiq,
|
||||||
const scalarField& Rphiq,
|
const scalarField& Rphiq,
|
||||||
@ -534,20 +539,20 @@ Foam::label Foam::chemistryTabulationMethods::ISAT<ThermoType>::add
|
|||||||
// It can be partially rebuild with the MRU list if this is used.
|
// It can be partially rebuild with the MRU list if this is used.
|
||||||
if (!cleanAndBalance())
|
if (!cleanAndBalance())
|
||||||
{
|
{
|
||||||
DynamicList<chemPointISAT<ThermoType>*> tempList;
|
DynamicList<chemPointISAT*> tempList;
|
||||||
if (maxMRUSize_>0)
|
if (maxMRUSize_>0)
|
||||||
{
|
{
|
||||||
// Create a copy of each chemPointISAT of the MRUList_ before
|
// Create a copy of each chemPointISAT of the MRUList_ before
|
||||||
// they are deleted
|
// they are deleted
|
||||||
typename SLList
|
typename SLList
|
||||||
<
|
<
|
||||||
chemPointISAT<ThermoType>*
|
chemPointISAT*
|
||||||
>::iterator iter = MRUList_.begin();
|
>::iterator iter = MRUList_.begin();
|
||||||
for ( ; iter != MRUList_.end(); ++iter)
|
for ( ; iter != MRUList_.end(); ++iter)
|
||||||
{
|
{
|
||||||
tempList.append
|
tempList.append
|
||||||
(
|
(
|
||||||
new chemPointISAT<ThermoType>(*iter())
|
new chemPointISAT(*iter())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -558,7 +563,7 @@ Foam::label Foam::chemistryTabulationMethods::ISAT<ThermoType>::add
|
|||||||
|
|
||||||
// Construct the tree without giving a reference to attach to it
|
// Construct the tree without giving a reference to attach to it
|
||||||
// since the structure has been completely discarded
|
// since the structure has been completely discarded
|
||||||
chemPointISAT<ThermoType>* nulPhi = 0;
|
chemPointISAT* nulPhi = 0;
|
||||||
forAll(tempList, i)
|
forAll(tempList, i)
|
||||||
{
|
{
|
||||||
chemisTree().insertNewLeaf
|
chemisTree().insertNewLeaf
|
||||||
@ -614,8 +619,7 @@ Foam::label Foam::chemistryTabulationMethods::ISAT<ThermoType>::add
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::chemistryTabulationMethods::ISAT::writePerformance()
|
||||||
void Foam::chemistryTabulationMethods::ISAT<ThermoType>::writePerformance()
|
|
||||||
{
|
{
|
||||||
if (log_)
|
if (log_)
|
||||||
{
|
{
|
||||||
@ -653,8 +657,7 @@ void Foam::chemistryTabulationMethods::ISAT<ThermoType>::writePerformance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::chemistryTabulationMethods::ISAT::reset()
|
||||||
void Foam::chemistryTabulationMethods::ISAT<ThermoType>::reset()
|
|
||||||
{
|
{
|
||||||
// Increment counter of time-step
|
// Increment counter of time-step
|
||||||
timeSteps_++;
|
timeSteps_++;
|
||||||
@ -666,8 +669,7 @@ void Foam::chemistryTabulationMethods::ISAT<ThermoType>::reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
bool Foam::chemistryTabulationMethods::ISAT::update()
|
||||||
bool Foam::chemistryTabulationMethods::ISAT<ThermoType>::update()
|
|
||||||
{
|
{
|
||||||
bool updated = cleanAndBalance();
|
bool updated = cleanAndBalance();
|
||||||
writePerformance();
|
writePerformance();
|
||||||
|
|||||||
@ -41,7 +41,11 @@ Description
|
|||||||
#ifndef ISAT_H
|
#ifndef ISAT_H
|
||||||
#define ISAT_H
|
#define ISAT_H
|
||||||
|
|
||||||
|
#include "chemistryTabulationMethod.H"
|
||||||
#include "binaryTree.H"
|
#include "binaryTree.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "cpuTime.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -54,16 +58,15 @@ namespace chemistryTabulationMethods
|
|||||||
Class ISAT Declaration
|
Class ISAT Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
class ISAT
|
class ISAT
|
||||||
:
|
:
|
||||||
public chemistryTabulationMethod<ThermoType>
|
public chemistryTabulationMethod
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
const dictionary coeffsDict_;
|
const dictionary coeffsDict_;
|
||||||
|
|
||||||
const chemistryModel<ThermoType>& chemistry_;
|
const odeChemistryModel& chemistry_;
|
||||||
|
|
||||||
//- Switch to select performance logging
|
//- Switch to select performance logging
|
||||||
Switch log_;
|
Switch log_;
|
||||||
@ -72,7 +75,7 @@ class ISAT
|
|||||||
const bool reduction_;
|
const bool reduction_;
|
||||||
|
|
||||||
//- List of the stored 'points' organised in a binary tree
|
//- List of the stored 'points' organised in a binary tree
|
||||||
binaryTree<ThermoType> chemisTree_;
|
binaryTree chemisTree_;
|
||||||
|
|
||||||
//- List of scale factors for species, temperature and pressure
|
//- List of scale factors for species, temperature and pressure
|
||||||
scalarField scaleFactor_;
|
scalarField scaleFactor_;
|
||||||
@ -101,13 +104,13 @@ class ISAT
|
|||||||
Switch MRURetrieve_;
|
Switch MRURetrieve_;
|
||||||
|
|
||||||
//- Most Recently Used (MRU) list of chemPoint
|
//- Most Recently Used (MRU) list of chemPoint
|
||||||
SLList<chemPointISAT<ThermoType>*> MRUList_;
|
SLList<chemPointISAT*> MRUList_;
|
||||||
|
|
||||||
//- Maximum size of the MRU list
|
//- Maximum size of the MRU list
|
||||||
label maxMRUSize_;
|
label maxMRUSize_;
|
||||||
|
|
||||||
//- Store a pointer to the last chemPointISAT found
|
//- Store a pointer to the last chemPointISAT found
|
||||||
chemPointISAT<ThermoType>* lastSearch_;
|
chemPointISAT* lastSearch_;
|
||||||
|
|
||||||
//- Switch to allow growth (on by default)
|
//- Switch to allow growth (on by default)
|
||||||
Switch growPoints_;
|
Switch growPoints_;
|
||||||
@ -150,7 +153,7 @@ class ISAT
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Add a chemPoint to the MRU list
|
//- Add a chemPoint to the MRU list
|
||||||
void addToMRU(chemPointISAT<ThermoType>* phi0);
|
void addToMRU(chemPointISAT* phi0);
|
||||||
|
|
||||||
//- Compute and return the mapping of the composition phiq
|
//- Compute and return the mapping of the composition phiq
|
||||||
// Input : phi0 the nearest chemPoint used in the linear interpolation
|
// Input : phi0 the nearest chemPoint used in the linear interpolation
|
||||||
@ -161,7 +164,7 @@ class ISAT
|
|||||||
// Rphiq = Rphi0 + A * (phiq-phi0)
|
// Rphiq = Rphi0 + A * (phiq-phi0)
|
||||||
void calcNewC
|
void calcNewC
|
||||||
(
|
(
|
||||||
chemPointISAT<ThermoType>* phi0,
|
chemPointISAT* phi0,
|
||||||
const scalarField& phiq,
|
const scalarField& phiq,
|
||||||
scalarField& Rphiq
|
scalarField& Rphiq
|
||||||
);
|
);
|
||||||
@ -175,7 +178,7 @@ class ISAT
|
|||||||
// Output: true if phiq is in the EOA, false if not
|
// Output: true if phiq is in the EOA, false if not
|
||||||
bool grow
|
bool grow
|
||||||
(
|
(
|
||||||
chemPointISAT<ThermoType>* phi0,
|
chemPointISAT* phi0,
|
||||||
const scalarField& phiq,
|
const scalarField& phiq,
|
||||||
const scalarField& Rphiq
|
const scalarField& Rphiq
|
||||||
);
|
);
|
||||||
@ -216,7 +219,7 @@ public:
|
|||||||
ISAT
|
ISAT
|
||||||
(
|
(
|
||||||
const dictionary& chemistryProperties,
|
const dictionary& chemistryProperties,
|
||||||
const chemistryModel<ThermoType>& chemistry
|
const odeChemistryModel& chemistry
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construction
|
//- Disallow default bitwise copy construction
|
||||||
@ -241,12 +244,12 @@ public:
|
|||||||
return reduction_;
|
return reduction_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const chemistryModel<ThermoType>& chemistry()
|
const odeChemistryModel& chemistry()
|
||||||
{
|
{
|
||||||
return chemistry_;
|
return chemistry_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline binaryTree<ThermoType>& chemisTree()
|
inline binaryTree& chemisTree()
|
||||||
{
|
{
|
||||||
return chemisTree_;
|
return chemisTree_;
|
||||||
}
|
}
|
||||||
@ -298,12 +301,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "ISAT.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -24,11 +24,11 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "binaryNode.H"
|
#include "binaryNode.H"
|
||||||
|
#include "ISAT.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::binaryNode::binaryNode()
|
||||||
Foam::binaryNode<ThermoType>::binaryNode()
|
|
||||||
:
|
:
|
||||||
leafLeft_(nullptr),
|
leafLeft_(nullptr),
|
||||||
leafRight_(nullptr),
|
leafRight_(nullptr),
|
||||||
@ -38,12 +38,11 @@ Foam::binaryNode<ThermoType>::binaryNode()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::binaryNode::binaryNode
|
||||||
Foam::binaryNode<ThermoType>::binaryNode
|
|
||||||
(
|
(
|
||||||
chemPointISAT<ThermoType>* elementLeft,
|
chemPointISAT* elementLeft,
|
||||||
chemPointISAT<ThermoType>* elementRight,
|
chemPointISAT* elementRight,
|
||||||
binaryNode<ThermoType>* parent
|
binaryNode* parent
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
leafLeft_(elementLeft),
|
leafLeft_(elementLeft),
|
||||||
@ -60,11 +59,10 @@ Foam::binaryNode<ThermoType>::binaryNode
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::binaryNode::calcV
|
||||||
void Foam::binaryNode<ThermoType>::calcV
|
|
||||||
(
|
(
|
||||||
chemPointISAT<ThermoType>*& elementLeft,
|
chemPointISAT*& elementLeft,
|
||||||
chemPointISAT<ThermoType>*& elementRight,
|
chemPointISAT*& elementRight,
|
||||||
scalarField& v
|
scalarField& v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -140,11 +138,10 @@ void Foam::binaryNode<ThermoType>::calcV
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::scalar Foam::binaryNode::calcA
|
||||||
Foam::scalar Foam::binaryNode<ThermoType>::calcA
|
|
||||||
(
|
(
|
||||||
chemPointISAT<ThermoType>* elementLeft,
|
chemPointISAT* elementLeft,
|
||||||
chemPointISAT<ThermoType>* elementRight
|
chemPointISAT* elementRight
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
scalarField phih((elementLeft->phi() + elementRight->phi())/2);
|
scalarField phih((elementLeft->phi() + elementRight->phi())/2);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -46,26 +46,25 @@ namespace Foam
|
|||||||
Class binaryNode Declaration
|
Class binaryNode Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
class binaryNode
|
class binaryNode
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Element on the left
|
//- Element on the left
|
||||||
chemPointISAT<ThermoType>* leafLeft_;
|
chemPointISAT* leafLeft_;
|
||||||
|
|
||||||
//- Element on the right
|
//- Element on the right
|
||||||
chemPointISAT<ThermoType>* leafRight_;
|
chemPointISAT* leafRight_;
|
||||||
|
|
||||||
//- Node which follows on the left
|
//- Node which follows on the left
|
||||||
binaryNode<ThermoType>* nodeLeft_;
|
binaryNode* nodeLeft_;
|
||||||
|
|
||||||
//- Node which follows on the right
|
//- Node which follows on the right
|
||||||
binaryNode<ThermoType>* nodeRight_;
|
binaryNode* nodeRight_;
|
||||||
|
|
||||||
//- Parent node
|
//- Parent node
|
||||||
binaryNode<ThermoType>* parent_;
|
binaryNode* parent_;
|
||||||
|
|
||||||
scalarField v_;
|
scalarField v_;
|
||||||
|
|
||||||
@ -102,8 +101,8 @@ public:
|
|||||||
// Returnq: void (v is stored in the empty scalarField)
|
// Returnq: void (v is stored in the empty scalarField)
|
||||||
void calcV
|
void calcV
|
||||||
(
|
(
|
||||||
chemPointISAT<ThermoType>*& elementLeft,
|
chemPointISAT*& elementLeft,
|
||||||
chemPointISAT<ThermoType>*& elementRight,
|
chemPointISAT*& elementRight,
|
||||||
scalarField& v
|
scalarField& v
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -115,8 +114,8 @@ public:
|
|||||||
// part (where phi0 is).
|
// part (where phi0 is).
|
||||||
scalar calcA
|
scalar calcA
|
||||||
(
|
(
|
||||||
chemPointISAT<ThermoType>* elementLeft,
|
chemPointISAT* elementLeft,
|
||||||
chemPointISAT<ThermoType>* elementRight
|
chemPointISAT* elementRight
|
||||||
);
|
);
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -127,9 +126,9 @@ public:
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
binaryNode
|
binaryNode
|
||||||
(
|
(
|
||||||
chemPointISAT<ThermoType>* elementLeft,
|
chemPointISAT* elementLeft,
|
||||||
chemPointISAT<ThermoType>* elementRight,
|
chemPointISAT* elementRight,
|
||||||
binaryNode<ThermoType>* parent
|
binaryNode* parent
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -137,27 +136,27 @@ public:
|
|||||||
|
|
||||||
//- Access
|
//- Access
|
||||||
|
|
||||||
inline chemPointISAT<ThermoType>*& leafLeft()
|
inline chemPointISAT*& leafLeft()
|
||||||
{
|
{
|
||||||
return leafLeft_;
|
return leafLeft_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline chemPointISAT<ThermoType>*& leafRight()
|
inline chemPointISAT*& leafRight()
|
||||||
{
|
{
|
||||||
return leafRight_;
|
return leafRight_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline binaryNode<ThermoType>*& nodeLeft()
|
inline binaryNode*& nodeLeft()
|
||||||
{
|
{
|
||||||
return nodeLeft_;
|
return nodeLeft_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline binaryNode<ThermoType>*& nodeRight()
|
inline binaryNode*& nodeRight()
|
||||||
{
|
{
|
||||||
return nodeRight_;
|
return nodeRight_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline binaryNode<ThermoType>*& parent()
|
inline binaryNode*& parent()
|
||||||
{
|
{
|
||||||
return parent_;
|
return parent_;
|
||||||
}
|
}
|
||||||
@ -192,12 +191,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "binaryNode.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -25,11 +25,11 @@ License
|
|||||||
|
|
||||||
#include "binaryTree.H"
|
#include "binaryTree.H"
|
||||||
#include "SortableList.H"
|
#include "SortableList.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::binaryTree::insertNode(chP*& phi0, bn*& newNode)
|
||||||
void Foam::binaryTree<ThermoType>::insertNode(chP*& phi0, bn*& newNode)
|
|
||||||
{
|
{
|
||||||
if (phi0 == phi0->node()->leafRight())// phi0 is on the right
|
if (phi0 == phi0->node()->leafRight())// phi0 is on the right
|
||||||
{
|
{
|
||||||
@ -52,8 +52,7 @@ void Foam::binaryTree<ThermoType>::insertNode(chP*& phi0, bn*& newNode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
bool Foam::binaryTree::inSubTree
|
||||||
bool Foam::binaryTree<ThermoType>::inSubTree
|
|
||||||
(
|
(
|
||||||
const scalarField& phiq,
|
const scalarField& phiq,
|
||||||
bn* y,
|
bn* y,
|
||||||
@ -157,8 +156,7 @@ bool Foam::binaryTree<ThermoType>::inSubTree
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::binaryTree::deleteSubTree(bn* subTreeRoot)
|
||||||
void Foam::binaryTree<ThermoType>::deleteSubTree(bn* subTreeRoot)
|
|
||||||
{
|
{
|
||||||
if (subTreeRoot != nullptr)
|
if (subTreeRoot != nullptr)
|
||||||
{
|
{
|
||||||
@ -171,8 +169,7 @@ void Foam::binaryTree<ThermoType>::deleteSubTree(bn* subTreeRoot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::binaryTree::transplant(bn* u, bn* v)
|
||||||
void Foam::binaryTree<ThermoType>::transplant(bn* u, bn* v)
|
|
||||||
{
|
{
|
||||||
if (v != nullptr)
|
if (v != nullptr)
|
||||||
{
|
{
|
||||||
@ -208,9 +205,7 @@ void Foam::binaryTree<ThermoType>::transplant(bn* u, bn* v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemPointISAT* Foam::binaryTree::chemPSibling(bn* y)
|
||||||
Foam::chemPointISAT<ThermoType>*
|
|
||||||
Foam::binaryTree<ThermoType>::chemPSibling(bn* y)
|
|
||||||
{
|
{
|
||||||
if (y->parent() != nullptr)
|
if (y->parent() != nullptr)
|
||||||
{
|
{
|
||||||
@ -237,9 +232,7 @@ Foam::binaryTree<ThermoType>::chemPSibling(bn* y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemPointISAT* Foam::binaryTree::chemPSibling(chP* x)
|
||||||
Foam::chemPointISAT<ThermoType>*
|
|
||||||
Foam::binaryTree<ThermoType>::chemPSibling(chP* x)
|
|
||||||
{
|
{
|
||||||
if (size_>1)
|
if (size_>1)
|
||||||
{
|
{
|
||||||
@ -267,8 +260,7 @@ Foam::binaryTree<ThermoType>::chemPSibling(chP* x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::binaryNode* Foam::binaryTree::nodeSibling(bn* y)
|
||||||
Foam::binaryNode<ThermoType>* Foam::binaryTree<ThermoType>::nodeSibling(bn* y)
|
|
||||||
{
|
{
|
||||||
if (y->parent()!=nullptr)
|
if (y->parent()!=nullptr)
|
||||||
{
|
{
|
||||||
@ -293,8 +285,7 @@ Foam::binaryNode<ThermoType>* Foam::binaryTree<ThermoType>::nodeSibling(bn* y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::binaryNode* Foam::binaryTree::nodeSibling(chP* x)
|
||||||
Foam::binaryNode<ThermoType>* Foam::binaryTree<ThermoType>::nodeSibling(chP* x)
|
|
||||||
{
|
{
|
||||||
if (size_>1)
|
if (size_>1)
|
||||||
{
|
{
|
||||||
@ -320,8 +311,7 @@ Foam::binaryNode<ThermoType>* Foam::binaryTree<ThermoType>::nodeSibling(chP* x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::binaryTree::deleteAllNode(bn* subTreeRoot)
|
||||||
void Foam::binaryTree<ThermoType>::deleteAllNode(bn* subTreeRoot)
|
|
||||||
{
|
{
|
||||||
if (subTreeRoot != nullptr)
|
if (subTreeRoot != nullptr)
|
||||||
{
|
{
|
||||||
@ -334,10 +324,9 @@ void Foam::binaryTree<ThermoType>::deleteAllNode(bn* subTreeRoot)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::binaryTree::binaryTree
|
||||||
Foam::binaryTree<ThermoType>::binaryTree
|
|
||||||
(
|
(
|
||||||
chemistryTabulationMethods::ISAT<ThermoType>& table,
|
chemistryTabulationMethods::ISAT& table,
|
||||||
dictionary coeffsDict
|
dictionary coeffsDict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -352,8 +341,7 @@ Foam::binaryTree<ThermoType>::binaryTree
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::label Foam::binaryTree::depth(bn* subTreeRoot)
|
||||||
Foam::label Foam::binaryTree<ThermoType>::depth(bn* subTreeRoot)
|
|
||||||
{
|
{
|
||||||
// when we reach the leaf, we return 0
|
// when we reach the leaf, we return 0
|
||||||
if (subTreeRoot == nullptr)
|
if (subTreeRoot == nullptr)
|
||||||
@ -373,8 +361,7 @@ Foam::label Foam::binaryTree<ThermoType>::depth(bn* subTreeRoot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::binaryTree::insertNewLeaf
|
||||||
void Foam::binaryTree<ThermoType>::insertNewLeaf
|
|
||||||
(
|
(
|
||||||
const scalarField& phiq,
|
const scalarField& phiq,
|
||||||
const scalarField& Rphiq,
|
const scalarField& Rphiq,
|
||||||
@ -459,8 +446,7 @@ void Foam::binaryTree<ThermoType>::insertNewLeaf
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::binaryTree::binaryTreeSearch
|
||||||
void Foam::binaryTree<ThermoType>::binaryTreeSearch
|
|
||||||
(
|
(
|
||||||
const scalarField& phiq,
|
const scalarField& phiq,
|
||||||
bn* node,
|
bn* node,
|
||||||
@ -513,8 +499,7 @@ void Foam::binaryTree<ThermoType>::binaryTreeSearch
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
bool Foam::binaryTree::secondaryBTSearch
|
||||||
bool Foam::binaryTree<ThermoType>::secondaryBTSearch
|
|
||||||
(
|
(
|
||||||
const scalarField& phiq,
|
const scalarField& phiq,
|
||||||
chP*& x
|
chP*& x
|
||||||
@ -571,8 +556,7 @@ bool Foam::binaryTree<ThermoType>::secondaryBTSearch
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::binaryTree::deleteLeaf(chP*& phi0)
|
||||||
void Foam::binaryTree<ThermoType>::deleteLeaf(chP*& phi0)
|
|
||||||
{
|
{
|
||||||
if (size_ == 1) // only one point is stored
|
if (size_ == 1) // only one point is stored
|
||||||
{
|
{
|
||||||
@ -634,8 +618,7 @@ void Foam::binaryTree<ThermoType>::deleteLeaf(chP*& phi0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::binaryTree::balance()
|
||||||
void Foam::binaryTree<ThermoType>::balance()
|
|
||||||
{
|
{
|
||||||
//1) walk through the entire tree by starting with the tree's most left
|
//1) walk through the entire tree by starting with the tree's most left
|
||||||
// chemPoint
|
// chemPoint
|
||||||
@ -727,9 +710,7 @@ void Foam::binaryTree<ThermoType>::balance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemPointISAT* Foam::binaryTree::treeMin(bn* subTreeRoot)
|
||||||
Foam::chemPointISAT<ThermoType>*
|
|
||||||
Foam::binaryTree<ThermoType>::treeMin(bn* subTreeRoot)
|
|
||||||
{
|
{
|
||||||
if (subTreeRoot!=nullptr)
|
if (subTreeRoot!=nullptr)
|
||||||
{
|
{
|
||||||
@ -746,9 +727,7 @@ Foam::binaryTree<ThermoType>::treeMin(bn* subTreeRoot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemPointISAT* Foam::binaryTree::treeSuccessor(chP* x)
|
||||||
Foam::chemPointISAT<ThermoType>*
|
|
||||||
Foam::binaryTree<ThermoType>::treeSuccessor(chP* x)
|
|
||||||
{
|
{
|
||||||
if (size_>1)
|
if (size_>1)
|
||||||
{
|
{
|
||||||
@ -799,8 +778,7 @@ Foam::binaryTree<ThermoType>::treeSuccessor(chP* x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::binaryTree::clear()
|
||||||
void Foam::binaryTree<ThermoType>::clear()
|
|
||||||
{
|
{
|
||||||
// Recursively delete the element in the subTree
|
// Recursively delete the element in the subTree
|
||||||
deleteSubTree();
|
deleteSubTree();
|
||||||
@ -813,15 +791,13 @@ void Foam::binaryTree<ThermoType>::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
bool Foam::binaryTree::isFull()
|
||||||
bool Foam::binaryTree<ThermoType>::isFull()
|
|
||||||
{
|
{
|
||||||
return size_ >= maxNLeafs_;
|
return size_ >= maxNLeafs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::binaryTree::resetNumRetrieve()
|
||||||
void Foam::binaryTree<ThermoType>::resetNumRetrieve()
|
|
||||||
{
|
{
|
||||||
// Has to go along each chP of the tree
|
// Has to go along each chP of the tree
|
||||||
if (size_ > 0)
|
if (size_ > 0)
|
||||||
|
|||||||
@ -55,15 +55,14 @@ namespace Foam
|
|||||||
Class binaryTree Declaration
|
Class binaryTree Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
class binaryTree
|
class binaryTree
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Public Typedefs
|
// Public Typedefs
|
||||||
|
|
||||||
typedef binaryNode<ThermoType> bn;
|
typedef binaryNode bn;
|
||||||
typedef chemPointISAT<ThermoType> chP;
|
typedef chemPointISAT chP;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -71,7 +70,7 @@ private:
|
|||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to the ISAT table
|
//- Reference to the ISAT table
|
||||||
chemistryTabulationMethods::ISAT<ThermoType>& table_;
|
chemistryTabulationMethods::ISAT& table_;
|
||||||
|
|
||||||
//- Root node of the binary tree
|
//- Root node of the binary tree
|
||||||
bn *root_;
|
bn *root_;
|
||||||
@ -105,7 +104,7 @@ private:
|
|||||||
chP* x
|
chP* x
|
||||||
);
|
);
|
||||||
|
|
||||||
void deleteSubTree(binaryNode<ThermoType>* subTreeRoot);
|
void deleteSubTree(binaryNode* subTreeRoot);
|
||||||
|
|
||||||
inline void deleteSubTree()
|
inline void deleteSubTree()
|
||||||
{
|
{
|
||||||
@ -135,7 +134,7 @@ public:
|
|||||||
//- Construct from dictionary and chemistryOnLineLibrary
|
//- Construct from dictionary and chemistryOnLineLibrary
|
||||||
binaryTree
|
binaryTree
|
||||||
(
|
(
|
||||||
chemistryTabulationMethods::ISAT<ThermoType>& table,
|
chemistryTabulationMethods::ISAT& table,
|
||||||
dictionary coeffsDict
|
dictionary coeffsDict
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -251,12 +250,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "binaryTree.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -24,19 +24,19 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "chemPointISAT.H"
|
#include "chemPointISAT.H"
|
||||||
|
#include "ISAT.H"
|
||||||
|
#include "odeChemistryModel.H"
|
||||||
#include "SVD.H"
|
#include "SVD.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Defined as static to be able to dynamically change it during simulations
|
// Defined as static to be able to dynamically change it during simulations
|
||||||
// (all chemPoints refer to the same object)
|
// (all chemPoints refer to the same object)
|
||||||
template<class ThermoType>
|
Foam::scalar Foam::chemPointISAT::tolerance_;
|
||||||
Foam::scalar Foam::chemPointISAT<ThermoType>::tolerance_;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::chemPointISAT::qrDecompose
|
||||||
void Foam::chemPointISAT<ThermoType>::qrDecompose
|
|
||||||
(
|
(
|
||||||
const label nCols,
|
const label nCols,
|
||||||
scalarSquareMatrix& R
|
scalarSquareMatrix& R
|
||||||
@ -102,8 +102,7 @@ void Foam::chemPointISAT<ThermoType>::qrDecompose
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::chemPointISAT::qrUpdate
|
||||||
void Foam::chemPointISAT<ThermoType>::qrUpdate
|
|
||||||
(
|
(
|
||||||
scalarSquareMatrix& R,
|
scalarSquareMatrix& R,
|
||||||
const label n,
|
const label n,
|
||||||
@ -156,8 +155,7 @@ void Foam::chemPointISAT<ThermoType>::qrUpdate
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::chemPointISAT::rotate
|
||||||
void Foam::chemPointISAT<ThermoType>::rotate
|
|
||||||
(
|
(
|
||||||
scalarSquareMatrix& R,
|
scalarSquareMatrix& R,
|
||||||
const label i,
|
const label i,
|
||||||
@ -196,10 +194,9 @@ void Foam::chemPointISAT<ThermoType>::rotate
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemPointISAT::chemPointISAT
|
||||||
Foam::chemPointISAT<ThermoType>::chemPointISAT
|
|
||||||
(
|
(
|
||||||
chemistryTabulationMethods::ISAT<ThermoType>& table,
|
chemistryTabulationMethods::ISAT& table,
|
||||||
const scalarField& phi,
|
const scalarField& phi,
|
||||||
const scalarField& Rphi,
|
const scalarField& Rphi,
|
||||||
const scalarSquareMatrix& A,
|
const scalarSquareMatrix& A,
|
||||||
@ -208,7 +205,7 @@ Foam::chemPointISAT<ThermoType>::chemPointISAT
|
|||||||
const label completeSpaceSize,
|
const label completeSpaceSize,
|
||||||
const label nActive,
|
const label nActive,
|
||||||
const dictionary& coeffsDict,
|
const dictionary& coeffsDict,
|
||||||
binaryNode<ThermoType>* node
|
binaryNode* node
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
table_(table),
|
table_(table),
|
||||||
@ -299,10 +296,9 @@ Foam::chemPointISAT<ThermoType>::chemPointISAT
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemPointISAT::chemPointISAT
|
||||||
Foam::chemPointISAT<ThermoType>::chemPointISAT
|
|
||||||
(
|
(
|
||||||
Foam::chemPointISAT<ThermoType>& p
|
Foam::chemPointISAT& p
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
table_(p.table_),
|
table_(p.table_),
|
||||||
@ -334,8 +330,7 @@ Foam::chemPointISAT<ThermoType>::chemPointISAT
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
bool Foam::chemPointISAT::inEOA(const scalarField& phiq)
|
||||||
bool Foam::chemPointISAT<ThermoType>::inEOA(const scalarField& phiq)
|
|
||||||
{
|
{
|
||||||
const scalarField dphi(phiq - phi());
|
const scalarField dphi(phiq - phi());
|
||||||
|
|
||||||
@ -474,8 +469,7 @@ bool Foam::chemPointISAT<ThermoType>::inEOA(const scalarField& phiq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
bool Foam::chemPointISAT::checkSolution
|
||||||
bool Foam::chemPointISAT<ThermoType>::checkSolution
|
|
||||||
(
|
(
|
||||||
const scalarField& phiq,
|
const scalarField& phiq,
|
||||||
const scalarField& Rphiq
|
const scalarField& Rphiq
|
||||||
@ -540,8 +534,7 @@ bool Foam::chemPointISAT<ThermoType>::checkSolution
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
bool Foam::chemPointISAT::grow(const scalarField& phiq)
|
||||||
bool Foam::chemPointISAT<ThermoType>::grow(const scalarField& phiq)
|
|
||||||
{
|
{
|
||||||
const scalarField dphi(phiq - phi());
|
const scalarField dphi(phiq - phi());
|
||||||
const label initNActiveSpecies(nActive_);
|
const label initNActiveSpecies(nActive_);
|
||||||
@ -717,29 +710,25 @@ bool Foam::chemPointISAT<ThermoType>::grow(const scalarField& phiq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::chemPointISAT::increaseNumRetrieve()
|
||||||
void Foam::chemPointISAT<ThermoType>::increaseNumRetrieve()
|
|
||||||
{
|
{
|
||||||
this->numRetrieve_++;
|
this->numRetrieve_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::chemPointISAT::resetNumRetrieve()
|
||||||
void Foam::chemPointISAT<ThermoType>::resetNumRetrieve()
|
|
||||||
{
|
{
|
||||||
this->numRetrieve_ = 0;
|
this->numRetrieve_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
void Foam::chemPointISAT::increaseNLifeTime()
|
||||||
void Foam::chemPointISAT<ThermoType>::increaseNLifeTime()
|
|
||||||
{
|
{
|
||||||
this->nLifeTime_++;
|
this->nLifeTime_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::label Foam::chemPointISAT::simplifiedToCompleteIndex
|
||||||
Foam::label Foam::chemPointISAT<ThermoType>::simplifiedToCompleteIndex
|
|
||||||
(
|
(
|
||||||
const label i
|
const label i
|
||||||
)
|
)
|
||||||
|
|||||||
@ -122,6 +122,10 @@ Description
|
|||||||
#ifndef chemPointISAT_H
|
#ifndef chemPointISAT_H
|
||||||
#define chemPointISAT_H
|
#define chemPointISAT_H
|
||||||
|
|
||||||
|
#include "scalarField.H"
|
||||||
|
#include "LUscalarMatrix.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -129,15 +133,10 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
class binaryNode;
|
class binaryNode;
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
class chemistryModel;
|
|
||||||
|
|
||||||
namespace chemistryTabulationMethods
|
namespace chemistryTabulationMethods
|
||||||
{
|
{
|
||||||
template<class ThermoType>
|
|
||||||
class ISAT;
|
class ISAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,13 +145,12 @@ namespace chemistryTabulationMethods
|
|||||||
Class chemPointISAT Declaration
|
Class chemPointISAT Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
class chemPointISAT
|
class chemPointISAT
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to the ISAT table
|
//- Reference to the ISAT table
|
||||||
chemistryTabulationMethods::ISAT<ThermoType>& table_;
|
chemistryTabulationMethods::ISAT& table_;
|
||||||
|
|
||||||
//- Vector storing the composition, temperature and pressure
|
//- Vector storing the composition, temperature and pressure
|
||||||
// and deltaT if a variable time step is set on
|
// and deltaT if a variable time step is set on
|
||||||
@ -172,7 +170,7 @@ class chemPointISAT
|
|||||||
scalarField scaleFactor_;
|
scalarField scaleFactor_;
|
||||||
|
|
||||||
//- Reference to the node in the binary tree holding this chemPoint
|
//- Reference to the node in the binary tree holding this chemPoint
|
||||||
binaryNode<ThermoType>* node_;
|
binaryNode* node_;
|
||||||
|
|
||||||
//- The size of the composition space (size of the vector phi)
|
//- The size of the composition space (size of the vector phi)
|
||||||
label completeSpaceSize_;
|
label completeSpaceSize_;
|
||||||
@ -251,7 +249,7 @@ public:
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
chemPointISAT
|
chemPointISAT
|
||||||
(
|
(
|
||||||
chemistryTabulationMethods::ISAT<ThermoType>& table,
|
chemistryTabulationMethods::ISAT& table,
|
||||||
const scalarField& phi,
|
const scalarField& phi,
|
||||||
const scalarField& Rphi,
|
const scalarField& Rphi,
|
||||||
const scalarSquareMatrix& A,
|
const scalarSquareMatrix& A,
|
||||||
@ -260,24 +258,24 @@ public:
|
|||||||
const label completeSpaceSize,
|
const label completeSpaceSize,
|
||||||
const label nActive,
|
const label nActive,
|
||||||
const dictionary& coeffsDict,
|
const dictionary& coeffsDict,
|
||||||
binaryNode<ThermoType>* node = nullptr
|
binaryNode* node = nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from another chemPoint and reference to a binary node
|
//- Construct from another chemPoint and reference to a binary node
|
||||||
chemPointISAT
|
chemPointISAT
|
||||||
(
|
(
|
||||||
const chemPointISAT<ThermoType>& p,
|
const chemPointISAT& p,
|
||||||
binaryNode<ThermoType>* node
|
binaryNode* node
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from another chemPoint
|
//- Construct from another chemPoint
|
||||||
chemPointISAT(chemPointISAT<ThermoType>& p);
|
chemPointISAT(chemPointISAT& p);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Access to the ISAT table
|
//- Access to the ISAT table
|
||||||
inline const chemistryTabulationMethods::ISAT<ThermoType>& table() const
|
inline const chemistryTabulationMethods::ISAT& table() const
|
||||||
{
|
{
|
||||||
return table_;
|
return table_;
|
||||||
}
|
}
|
||||||
@ -317,7 +315,7 @@ public:
|
|||||||
tolerance_ = newTol;
|
tolerance_ = newTol;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline binaryNode<ThermoType>*& node()
|
inline binaryNode*& node()
|
||||||
{
|
{
|
||||||
return node_;
|
return node_;
|
||||||
}
|
}
|
||||||
@ -448,12 +446,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "chemPointISAT.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,23 +24,30 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "chemistryTabulationMethod.H"
|
#include "chemistryTabulationMethod.H"
|
||||||
#include "chemistryModel.H"
|
#include "odeChemistryModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(chemistryTabulationMethod, 0);
|
||||||
|
defineRunTimeSelectionTable(chemistryTabulationMethod, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemistryTabulationMethod::chemistryTabulationMethod
|
||||||
Foam::chemistryTabulationMethod<ThermoType>::chemistryTabulationMethod
|
|
||||||
(
|
(
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const chemistryModel<ThermoType>& chemistry
|
const odeChemistryModel& chemistry
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemistryTabulationMethod::~chemistryTabulationMethod()
|
||||||
Foam::chemistryTabulationMethod<ThermoType>::~chemistryTabulationMethod()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -46,14 +46,12 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
class odeChemistryModel;
|
||||||
class chemistryModel;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class chemistryTabulationMethod Declaration
|
Class chemistryTabulationMethod Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
class chemistryTabulationMethod
|
class chemistryTabulationMethod
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -70,7 +68,7 @@ public:
|
|||||||
dictionary,
|
dictionary,
|
||||||
(
|
(
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const chemistryModel<ThermoType>& chemistry
|
const odeChemistryModel& chemistry
|
||||||
),
|
),
|
||||||
(dict, chemistry)
|
(dict, chemistry)
|
||||||
);
|
);
|
||||||
@ -82,7 +80,7 @@ public:
|
|||||||
chemistryTabulationMethod
|
chemistryTabulationMethod
|
||||||
(
|
(
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const chemistryModel<ThermoType>& chemistry
|
const odeChemistryModel& chemistry
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +89,7 @@ public:
|
|||||||
static autoPtr<chemistryTabulationMethod> New
|
static autoPtr<chemistryTabulationMethod> New
|
||||||
(
|
(
|
||||||
const IOdictionary& dict,
|
const IOdictionary& dict,
|
||||||
const chemistryModel<ThermoType>& chemistry
|
const odeChemistryModel& chemistry
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -142,13 +140,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "chemistryTabulationMethod.C"
|
|
||||||
#include "chemistryTabulationMethodNew.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -29,12 +29,11 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::autoPtr<Foam::chemistryTabulationMethod>
|
||||||
Foam::autoPtr<Foam::chemistryTabulationMethod<ThermoType>>
|
Foam::chemistryTabulationMethod::New
|
||||||
Foam::chemistryTabulationMethod<ThermoType>::New
|
|
||||||
(
|
(
|
||||||
const IOdictionary& dict,
|
const IOdictionary& dict,
|
||||||
const chemistryModel<ThermoType>& chemistry
|
const odeChemistryModel& chemistry
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (dict.found("tabulation"))
|
if (dict.found("tabulation"))
|
||||||
@ -45,57 +44,28 @@ Foam::chemistryTabulationMethod<ThermoType>::New
|
|||||||
|
|
||||||
Info<< "Selecting chemistry tabulation method " << methodName << endl;
|
Info<< "Selecting chemistry tabulation method " << methodName << endl;
|
||||||
|
|
||||||
const word methodTypeName =
|
|
||||||
methodName + '<' + ThermoType::typeName() + '>';
|
|
||||||
|
|
||||||
typename dictionaryConstructorTable::iterator cstrIter =
|
typename dictionaryConstructorTable::iterator cstrIter =
|
||||||
dictionaryConstructorTablePtr_->find(methodTypeName);
|
dictionaryConstructorTablePtr_->find(methodName);
|
||||||
|
|
||||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Unknown " << typeName_() << " type " << methodName << endl
|
<< "Unknown " << typeName_() << " type " << methodName << endl
|
||||||
<< endl;
|
<< "Valid " << typeName_() << " types are:"
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc() << endl
|
||||||
const wordList names(dictionaryConstructorTablePtr_->sortedToc());
|
|
||||||
|
|
||||||
wordList thisCmpts;
|
|
||||||
thisCmpts.append(word::null);
|
|
||||||
thisCmpts.append
|
|
||||||
(
|
|
||||||
basicThermo::splitThermoName(ThermoType::typeName(), 5)
|
|
||||||
);
|
|
||||||
|
|
||||||
wordList validNames;
|
|
||||||
forAll(names, i)
|
|
||||||
{
|
|
||||||
const wordList cmpts(basicThermo::splitThermoName(names[i], 6));
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
SubList<word>(cmpts, 5, 1) == SubList<word>(thisCmpts, 5, 1)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
validNames.append(cmpts[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Valid " << typeName_()
|
|
||||||
<< " types are:" << validNames << endl
|
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<chemistryTabulationMethod<ThermoType>>
|
return autoPtr<chemistryTabulationMethod>
|
||||||
(
|
(
|
||||||
cstrIter()(dict, chemistry)
|
cstrIter()(dict, chemistry)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return autoPtr<chemistryTabulationMethod<ThermoType>>
|
return autoPtr<chemistryTabulationMethod>
|
||||||
(
|
(
|
||||||
new chemistryTabulationMethods::none<ThermoType>(dict, chemistry)
|
new chemistryTabulationMethods::none(dict, chemistry)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,41 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration | Website: https://openfoam.org
|
|
||||||
\\ / A nd | Copyright (C) 2020-2021 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 "chemistryTabulationMethod.H"
|
|
||||||
|
|
||||||
#include "forGases.H"
|
|
||||||
#include "forLiquids.H"
|
|
||||||
#include "makeChemistryTabulationMethod.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
forCoeffGases(defineChemistryTabulationMethod, nullArg);
|
|
||||||
forCoeffLiquids(defineChemistryTabulationMethod, nullArg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,84 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration | Website: https://openfoam.org
|
|
||||||
\\ / A nd | Copyright (C) 2011-2021 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/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef makeChemistryTabulationMethod_H
|
|
||||||
#define makeChemistryTabulationMethod_H
|
|
||||||
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#define defineChemistryTabulationMethod(nullArg, ThermoPhysics) \
|
|
||||||
\
|
|
||||||
typedef chemistryTabulationMethod<ThermoPhysics> \
|
|
||||||
chemistryTabulationMethod##ThermoPhysics; \
|
|
||||||
\
|
|
||||||
defineTemplateTypeNameAndDebugWithName \
|
|
||||||
( \
|
|
||||||
chemistryTabulationMethod##ThermoPhysics, \
|
|
||||||
( \
|
|
||||||
word(chemistryTabulationMethod##ThermoPhysics::typeName_()) \
|
|
||||||
+ "<" + ThermoPhysics::typeName() + ">" \
|
|
||||||
).c_str(), \
|
|
||||||
0 \
|
|
||||||
); \
|
|
||||||
\
|
|
||||||
defineTemplateRunTimeSelectionTable \
|
|
||||||
( \
|
|
||||||
chemistryTabulationMethod##ThermoPhysics, \
|
|
||||||
dictionary \
|
|
||||||
)
|
|
||||||
|
|
||||||
#define makeChemistryTabulationMethod(Method, ThermoPhysics) \
|
|
||||||
\
|
|
||||||
typedef chemistryTabulationMethod<ThermoPhysics> \
|
|
||||||
chemistryTabulationMethod##ThermoPhysics; \
|
|
||||||
\
|
|
||||||
typedef chemistryTabulationMethods::Method<ThermoPhysics> \
|
|
||||||
chemistryTabulationMethod##Method##ThermoPhysics; \
|
|
||||||
\
|
|
||||||
defineTemplateTypeNameAndDebugWithName \
|
|
||||||
( \
|
|
||||||
chemistryTabulationMethod##Method##ThermoPhysics, \
|
|
||||||
( \
|
|
||||||
word(chemistryTabulationMethod##Method##ThermoPhysics::typeName_())\
|
|
||||||
+ "<" + ThermoPhysics::typeName() + ">" \
|
|
||||||
).c_str(), \
|
|
||||||
0 \
|
|
||||||
); \
|
|
||||||
\
|
|
||||||
addToRunTimeSelectionTable \
|
|
||||||
( \
|
|
||||||
chemistryTabulationMethod##ThermoPhysics, \
|
|
||||||
chemistryTabulationMethod##Method##ThermoPhysics, \
|
|
||||||
dictionary \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,17 +24,30 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "noChemistryTabulation.H"
|
#include "noChemistryTabulation.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
|
||||||
|
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace chemistryTabulationMethods
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(none, 0);
|
||||||
|
addToRunTimeSelectionTable(chemistryTabulationMethod, none, dictionary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemistryTabulationMethods::none::none
|
||||||
Foam::chemistryTabulationMethods::none<ThermoType>::none
|
|
||||||
(
|
(
|
||||||
const dictionary& chemistryProperties,
|
const dictionary& chemistryProperties,
|
||||||
const chemistryModel<ThermoType>& chemistry
|
const odeChemistryModel& chemistry
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
chemistryTabulationMethod<ThermoType>
|
chemistryTabulationMethod
|
||||||
(
|
(
|
||||||
chemistryProperties,
|
chemistryProperties,
|
||||||
chemistry
|
chemistry
|
||||||
@ -44,8 +57,7 @@ Foam::chemistryTabulationMethods::none<ThermoType>::none
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ThermoType>
|
Foam::chemistryTabulationMethods::none::~none()
|
||||||
Foam::chemistryTabulationMethods::none<ThermoType>::~none()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -49,10 +49,9 @@ namespace chemistryTabulationMethods
|
|||||||
Class none Declaration
|
Class none Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class ThermoType>
|
|
||||||
class none
|
class none
|
||||||
:
|
:
|
||||||
public chemistryTabulationMethod<ThermoType>
|
public chemistryTabulationMethod
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -65,7 +64,7 @@ public:
|
|||||||
none
|
none
|
||||||
(
|
(
|
||||||
const dictionary& chemistryProperties,
|
const dictionary& chemistryProperties,
|
||||||
const chemistryModel<ThermoType>& chemistry
|
const odeChemistryModel& chemistry
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construction
|
//- Disallow default bitwise copy construction
|
||||||
@ -128,12 +127,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "noChemistryTabulation.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,43 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration | Website: https://openfoam.org
|
|
||||||
\\ / A nd | Copyright (C) 2020-2021 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 "chemistryTabulationMethod.H"
|
|
||||||
|
|
||||||
#include "noChemistryTabulation.H"
|
|
||||||
|
|
||||||
#include "forGases.H"
|
|
||||||
#include "forLiquids.H"
|
|
||||||
#include "makeChemistryTabulationMethod.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
forCoeffGases(makeChemistryTabulationMethod, none);
|
|
||||||
forCoeffLiquids(makeChemistryTabulationMethod, none);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,21 +23,43 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "chemistryTabulationMethod.H"
|
#include "odeChemistryModel.H"
|
||||||
|
|
||||||
#include "ISAT.H"
|
|
||||||
|
|
||||||
#include "forGases.H"
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
#include "forLiquids.H"
|
|
||||||
#include "makeChemistryTabulationMethod.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
forCoeffGases(makeChemistryTabulationMethod, ISAT);
|
defineTypeNameAndDebug(odeChemistryModel, 0);
|
||||||
forCoeffLiquids(makeChemistryTabulationMethod, ISAT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::odeChemistryModel::odeChemistryModel
|
||||||
|
(
|
||||||
|
const fluidReactionThermo& thermo
|
||||||
|
)
|
||||||
|
:
|
||||||
|
basicChemistryModel(thermo),
|
||||||
|
ODESystem(),
|
||||||
|
Yvf_(this->thermo().composition().Y()),
|
||||||
|
nSpecie_(Yvf_.size()),
|
||||||
|
reduction_(false),
|
||||||
|
cTos_(nSpecie_, -1),
|
||||||
|
sToc_(nSpecie_)
|
||||||
|
{
|
||||||
|
Info<< "odeChemistryModel: Number of species = " << nSpecie_ << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::odeChemistryModel::~odeChemistryModel()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,158 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2022 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/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::odeChemistryModel
|
||||||
|
|
||||||
|
Description
|
||||||
|
Extends base chemistry model adding an ODESystem and the reduction maps
|
||||||
|
needed for tabulation.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
odeChemistryModelI.H
|
||||||
|
odeChemistryModel.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef odeChemistryModel_H
|
||||||
|
#define odeChemistryModel_H
|
||||||
|
|
||||||
|
#include "basicChemistryModel.H"
|
||||||
|
#include "ODESystem.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
template<class ThermoType>
|
||||||
|
class chemistryModel;
|
||||||
|
|
||||||
|
template<class ThermoType>
|
||||||
|
class chemistryReductionMethod;
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class odeChemistryModel Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class odeChemistryModel
|
||||||
|
:
|
||||||
|
public basicChemistryModel,
|
||||||
|
public ODESystem
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to the field of specie mass fractions
|
||||||
|
const PtrList<volScalarField>& Yvf_;
|
||||||
|
|
||||||
|
//- Number of species
|
||||||
|
label nSpecie_;
|
||||||
|
|
||||||
|
//- Is chemistry reduction active
|
||||||
|
bool reduction_;
|
||||||
|
|
||||||
|
//- Temporary map from complete to simplified concentration fields
|
||||||
|
// c -> sc
|
||||||
|
List<label> cTos_;
|
||||||
|
|
||||||
|
//- Temporary map from simplified to complete concentration fields
|
||||||
|
// sc -> c
|
||||||
|
DynamicList<label> sToc_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
template<class ThermoType>
|
||||||
|
friend class chemistryModel;
|
||||||
|
|
||||||
|
template<class ThermoType>
|
||||||
|
friend class chemistryReductionMethod;
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("odeChemistryModel");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from thermo
|
||||||
|
odeChemistryModel(const fluidReactionThermo& thermo);
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construction
|
||||||
|
odeChemistryModel(const odeChemistryModel&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~odeChemistryModel();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Create and return a TDAC log file of the given name
|
||||||
|
inline autoPtr<OFstream> logFile(const word& name) const;
|
||||||
|
|
||||||
|
//- The number of species
|
||||||
|
inline virtual label nSpecie() const;
|
||||||
|
|
||||||
|
//- Allow the reduction method to reset the number of species
|
||||||
|
inline void setNSpecie(const label newNs);
|
||||||
|
|
||||||
|
//- Number of ODE's to solve
|
||||||
|
inline virtual label nEqns() const;
|
||||||
|
|
||||||
|
//- Return a reference to the list of mass fraction fields
|
||||||
|
inline const PtrList<volScalarField>& Y() const;
|
||||||
|
|
||||||
|
//- Return true if mechanism reduction is active
|
||||||
|
inline bool reduction() const;
|
||||||
|
|
||||||
|
//- Return the index in the complete set of species
|
||||||
|
// corresponding to the index si in the simplified set of species
|
||||||
|
inline label sToc(const label si) const;
|
||||||
|
|
||||||
|
//- Return the index in the simplified set of species
|
||||||
|
// corresponding to the index si in the complete set of species
|
||||||
|
inline label cTos(const label ci) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const odeChemistryModel&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "odeChemistryModelI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,108 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2022 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 "OSspecific.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::autoPtr<Foam::OFstream>
|
||||||
|
Foam::odeChemistryModel::logFile(const word& name) const
|
||||||
|
{
|
||||||
|
mkDir(this->mesh().time().path()/"TDAC"/this->group());
|
||||||
|
return autoPtr<OFstream>
|
||||||
|
(
|
||||||
|
new OFstream
|
||||||
|
(
|
||||||
|
this->mesh().time().path()/"TDAC"/this->group()/name
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::odeChemistryModel::nSpecie() const
|
||||||
|
{
|
||||||
|
return nSpecie_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::odeChemistryModel::setNSpecie(const label newNs)
|
||||||
|
{
|
||||||
|
nSpecie_ = newNs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::odeChemistryModel::nEqns() const
|
||||||
|
{
|
||||||
|
// nEqns = number of species + temperature + pressure
|
||||||
|
return nSpecie_ + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::PtrList<Foam::volScalarField>&
|
||||||
|
Foam::odeChemistryModel::Y() const
|
||||||
|
{
|
||||||
|
return Yvf_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::odeChemistryModel::reduction() const
|
||||||
|
{
|
||||||
|
return reduction_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::odeChemistryModel::sToc
|
||||||
|
(
|
||||||
|
const label si
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (reduction_)
|
||||||
|
{
|
||||||
|
return sToc_[si];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return si;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::odeChemistryModel::cTos
|
||||||
|
(
|
||||||
|
const label ci
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (reduction_)
|
||||||
|
{
|
||||||
|
return cTos_[ci];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ci;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user