diff --git a/etc/codeTemplates/dynamicCode/basicChemistryModelTemplate.C b/etc/codeTemplates/dynamicCode/basicChemistryModelTemplate.C index a311a895cf..0f54f792a0 100644 --- a/etc/codeTemplates/dynamicCode/basicChemistryModelTemplate.C +++ b/etc/codeTemplates/dynamicCode/basicChemistryModelTemplate.C @@ -91,12 +91,10 @@ namespace Foam #if ${method}CppTest == chemistryModelCppTest #include "makeChemistryReductionMethod.H" -#include "makeChemistryTabulationMethod.H" namespace Foam { defineChemistryReductionMethod(nullArg, ThermoPhysics); - defineChemistryTabulationMethod(nullArg, ThermoPhysics); } #include "noChemistryReduction.H" @@ -116,14 +114,6 @@ namespace Foam makeChemistryReductionMethod(PFA, ThermoPhysics); } -#include "noChemistryTabulation.H" -#include "ISAT.H" -namespace Foam -{ - makeChemistryTabulationMethod(none, ThermoPhysics); - makeChemistryTabulationMethod(ISAT, ThermoPhysics); -} - #endif diff --git a/src/thermophysicalModels/chemistryModel/Make/files b/src/thermophysicalModels/chemistryModel/Make/files index 45137142ec..ac09a38c64 100644 --- a/src/thermophysicalModels/chemistryModel/Make/files +++ b/src/thermophysicalModels/chemistryModel/Make/files @@ -6,6 +6,8 @@ chemistrySolver/noChemistrySolver/noChemistrySolvers.C chemistrySolver/EulerImplicit/EulerImplicitChemistrySolvers.C chemistrySolver/ode/odeChemistrySolvers.C +odeChemistryModel/odeChemistryModel.C + chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethods.C chemistryModel/reduction/noChemistryReduction/noChemistryReductionMethods.C chemistryModel/reduction/DAC/DACChemistryReductionMethods.C @@ -14,9 +16,13 @@ chemistryModel/reduction/DRGEP/DRGEPChemistryReductionMethods.C chemistryModel/reduction/EFA/EFAChemistryReductionMethods.C chemistryModel/reduction/PFA/PFAChemistryReductionMethods.C -chemistryModel/tabulation/chemistryTabulationMethod/chemistryTabulationMethods.C -chemistryModel/tabulation/noChemistryTabulation/noChemistryTabulationMethods.C -chemistryModel/tabulation/ISAT/ISATChemistryTabulationMethods.C +chemistryModel/tabulation/chemistryTabulationMethod/chemistryTabulationMethod.C +chemistryModel/tabulation/chemistryTabulationMethod/chemistryTabulationMethodNew.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 diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.C index e9ff0b4c4e..0efa7b685e 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.C @@ -36,8 +36,7 @@ Foam::chemistryModel::chemistryModel const fluidReactionThermo& thermo ) : - basicChemistryModel(thermo), - ODESystem(), + odeChemistryModel(thermo), log_(this->lookupOrDefault("log", false)), loadBalancing_(this->lookupOrDefault("loadBalancing", false)), jacobianType_ @@ -46,18 +45,14 @@ Foam::chemistryModel::chemistryModel ? jacobianTypeNames_.read(this->lookup("jacobian")) : jacobianType::fast ), - Yvf_(this->thermo().composition().Y()), mixture_(refCast>(this->thermo())), specieThermos_(mixture_.specieThermos()), reactions_(mixture_.species(), specieThermos_, this->mesh(), *this), - nSpecie_(Yvf_.size()), RR_(nSpecie_), Y_(nSpecie_), c_(nSpecie_), YTpWork_(scalarField(nSpecie_ + 2)), YTpYTpWork_(scalarSquareMatrix(nSpecie_ + 2)), - cTos_(nSpecie_, -1), - sToc_(nSpecie_), mechRedPtr_ ( chemistryReductionMethod::New @@ -67,15 +62,7 @@ Foam::chemistryModel::chemistryModel ) ), mechRed_(*mechRedPtr_), - mechRedActive_(mechRed_.active()), - tabulationPtr_ - ( - chemistryTabulationMethod::New - ( - *this, - *this - ) - ), + tabulationPtr_(chemistryTabulationMethod::New(*this, *this)), tabulation_(*tabulationPtr_) { // Create the fields for the chemistry sources @@ -105,7 +92,7 @@ Foam::chemistryModel::chemistryModel // When the mechanism reduction method is used, the 'active' flag for every // species should be initialised (by default 'active' is true) - if (mechRedActive_) + if (reduction_) { const basicSpecieMixture& composition = this->thermo().composition(); @@ -153,7 +140,7 @@ void Foam::chemistryModel::derivatives scalarField& dYTpdt ) const { - if (mechRedActive_) + if (reduction_) { forAll(sToc_, i) { @@ -198,7 +185,7 @@ void Foam::chemistryModel::derivatives c_, li, dYTpdt, - mechRedActive_, + reduction_, cTos_, 0 ); @@ -246,7 +233,7 @@ void Foam::chemistryModel::jacobian scalarSquareMatrix& J ) const { - if (mechRedActive_) + if (reduction_) { forAll(sToc_, i) { @@ -334,7 +321,7 @@ void Foam::chemistryModel::jacobian li, dYTpdt, ddNdtByVdcTp, - mechRedActive_, + reduction_, cTos_, 0, nSpecie_, @@ -688,7 +675,7 @@ void Foam::chemistryModel::calculate() c_, celli, dNdtByV, - mechRedActive_, + reduction_, cTos_, 0 ); @@ -796,7 +783,7 @@ Foam::scalar Foam::chemistryModel::solve // (it will either expand the current data or add a new stored point). else { - if (mechRedActive_) + if (reduction_) { // Compute concentrations for (label i=0; i::solve while (timeLeft > small) { scalar dt = timeLeft; - if (mechRedActive_) + if (reduction_) { // Solve the reduced set of ODE solve @@ -880,7 +867,7 @@ Foam::scalar Foam::chemistryModel::solve // When operations are done and if mechanism reduction is active, // the number of species (which also affects nEqns) is set back // to the total number of species (stored in the mechRed object) - if (mechRedActive_) + if (reduction_) { setNSpecie(mechRed_.nSpecie()); } @@ -911,7 +898,7 @@ Foam::scalar Foam::chemistryModel::solve mechRed_.update(); tabulation_.update(); - if (mechRedActive_ && Pstream::parRun()) + if (reduction_ && Pstream::parRun()) { List active(composition.active()); Pstream::listCombineGather(active, orEqOp()); diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H index d18c1ef10c..7652560190 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H @@ -66,7 +66,7 @@ SourceFiles #ifndef chemistryModel_H #define chemistryModel_H -#include "basicChemistryModel.H" +#include "odeChemistryModel.H" #include "ReactionList.H" #include "ODESystem.H" #include "volFields.H" @@ -74,7 +74,6 @@ SourceFiles #include "chemistryReductionMethod.H" #include "chemistryTabulationMethod.H" #include "DynamicField.H" -#include "OFstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -88,8 +87,7 @@ namespace Foam template class chemistryModel : - public basicChemistryModel, - public ODESystem + public odeChemistryModel { // Private classes @@ -136,9 +134,6 @@ class chemistryModel //- Type of the Jacobian to be calculated const jacobianType jacobianType_; - //- Reference to the field of specie mass fractions - const PtrList& Yvf_; - //- Reference to the multi component mixture const multiComponentMixture& mixture_; @@ -148,9 +143,6 @@ class chemistryModel //- Reactions const ReactionList reactions_; - //- Number of species - label nSpecie_; - //- List of reaction rate per specie [kg/m^3/s] PtrList RR_; @@ -172,27 +164,17 @@ class chemistryModel //- Specie-temperature-pressure workspace matrices mutable FixedList YTpYTpWork_; - //- Temporary map from complete to simplified concentration fields - // c -> sc - List