diff --git a/applications/solvers/combustion/coalChemistryFoam/coalChemistryFoam.C b/applications/solvers/combustion/coalChemistryFoam/coalChemistryFoam.C index 9c40b73b5dcfe5473dd7de4876fb926ca607d6a6..9abc94a829723b9e1db1d27fe30fd34569e9a5b3 100644 --- a/applications/solvers/combustion/coalChemistryFoam/coalChemistryFoam.C +++ b/applications/solvers/combustion/coalChemistryFoam/coalChemistryFoam.C @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) turbulence->correct(); - rho = thermo->rho(); + rho = thermo.rho(); runTime.write(); diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C index 727bbb442f154d0f9a7d2d19d664f661471e8c4c..2904b3122556a5463b7fc5ac52a39e880edaba78 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C @@ -33,10 +33,12 @@ License template<class CompType, class ThermoType> Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel ( - const fvMesh& mesh + const fvMesh& mesh, + const word& compTypeName, + const word& thermoTypeName ) : - CompType(mesh), + CompType(mesh, thermoTypeName), ODE(), @@ -46,7 +48,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel ( dynamic_cast<const reactingMixture<ThermoType>&>(this->thermo()) ), - specieThermo_ + specieThermo_ ( dynamic_cast<const reactingMixture<ThermoType>&> (this->thermo()).speciesData() @@ -55,7 +57,15 @@ Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel nSpecie_(Y_.size()), nReaction_(reactions_.size()), - solver_(chemistrySolver<CompType, ThermoType>::New(*this)), + solver_ + ( + chemistrySolver<CompType, ThermoType>::New + ( + *this, + compTypeName, + thermoTypeName + ) + ), RR_(nSpecie_) { diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H index cd234007445c3f58388f4f57d33c5ac5558db179..ac8c10e086fcb6a8eebbc8ad39701c28c6438477 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H @@ -110,7 +110,12 @@ public: // Constructors //- Construct from components - ODEChemistryModel(const fvMesh& mesh); + ODEChemistryModel + ( + const fvMesh& mesh, + const word& compTypeName, + const word& thermoTypeName + ); //- Destructor diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C index 99f60ccf9b24646c44b3cbb186483db37e23e7c8..e7bd4f1e35970f5f92b88dffcd9e85ba9dd046ec 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C @@ -57,9 +57,7 @@ Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh) mesh.nCells(), readScalar(lookup("initialChemicalTimeStep")) ) -{ - Info<< "basicChemistryModel(const fvMesh&)" << endl; -} +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/newPsiChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/newPsiChemistryModel.C index 39ff8ed1fc3641dc7822a0f94a81db56774126f7..5195801f251c57cdb9799ebde50d5d982ed41a7e 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/newPsiChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/newPsiChemistryModel.C @@ -34,6 +34,8 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New ) { word psiChemistryModelType; + word thermoTypeName; + word userSel; // Enclose the creation of the chemistrtyProperties to ensure it is // deleted before the chemistrtyProperties is created otherwise the @@ -51,25 +53,41 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New ) ); - chemistryPropertiesDict.lookup("psiChemistryModel") >> - psiChemistryModelType; + chemistryPropertiesDict.lookup("psiChemistryModel") >> userSel; + + // construct chemistry model type name by inserting first template + // argument + label tempOpen = userSel.find('<'); + label tempClose = userSel.find('>'); + + word className = userSel(0, tempOpen); + thermoTypeName = userSel(tempOpen + 1, tempClose - tempOpen - 1); + + psiChemistryModelType = + className + '<' + typeName + ',' + thermoTypeName + '>'; } - Info<< "Selecting psiChemistryModel " << psiChemistryModelType << endl; + Info<< "Selecting psiChemistryModel " << userSel << endl; fvMeshConstructorTable::iterator cstrIter = fvMeshConstructorTablePtr_->find(psiChemistryModelType); if (cstrIter == fvMeshConstructorTablePtr_->end()) { + wordList models = fvMeshConstructorTablePtr_->toc(); + forAll(models, i) + { + models[i] = models[i].replace(typeName + ',', ""); + } + FatalErrorIn("psiChemistryModelBase::New(const mesh&)") - << "Unknown psiChemistryModel type " << psiChemistryModelType + << "Unknown psiChemistryModel type " << userSel << nl << nl << "Valid psiChemistryModel types are:" << nl - << fvMeshConstructorTablePtr_->toc() << nl - << exit(FatalError); + << models << nl << exit(FatalError); } - return autoPtr<psiChemistryModel>(cstrIter()(mesh)); + return autoPtr<psiChemistryModel> + (cstrIter()(mesh, typeName, thermoTypeName)); } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.C index 4354b7ecbcbed1fd73fc3aac2cb96091960d6cd5..7381d12a1df87d1a9aebe58a622c990173eb98ef 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.C @@ -38,10 +38,14 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::psiChemistryModel::psiChemistryModel(const fvMesh& mesh) +Foam::psiChemistryModel::psiChemistryModel +( + const fvMesh& mesh, + const word& thermoTypeName +) : basicChemistryModel(mesh), - thermo_(hCombustionThermo::New(mesh)) + thermo_(hCombustionThermo::NewType(mesh, thermoTypeName)) {} diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.H index c1a16d7ca7d04a8e3c7bf9445200fc0fc7af5cf2..4cf7af58ec89920d63395302ee0d84feb72df17c 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModel.H @@ -89,16 +89,18 @@ public: psiChemistryModel, fvMesh, ( - const fvMesh& mesh + const fvMesh& mesh, + const word& compTypeName, + const word& thermoTypeName ), - (mesh) + (mesh, compTypeName, thermoTypeName) ); // Constructors //- Construct from mesh - psiChemistryModel(const fvMesh& mesh); + psiChemistryModel(const fvMesh& mesh, const word& thermoTypeName); //- Selector diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/newRhoChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/newRhoChemistryModel.C index fd87c3539f2c01331b37756f92ae82f7915736a1..938b84122176fa00c76751abf5c3e3fe2193ee72 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/newRhoChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/newRhoChemistryModel.C @@ -34,6 +34,8 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New ) { word rhoChemistryModelType; + word thermoTypeName; + word userSel; // Enclose the creation of the chemistrtyProperties to ensure it is // deleted before the chemistrtyProperties is created otherwise the @@ -51,25 +53,41 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New ) ); - chemistryPropertiesDict.lookup("rhoChemistryModel") >> - rhoChemistryModelType; + chemistryPropertiesDict.lookup("rhoChemistryModelType") >> userSel; + + // construct chemistry model type name by inserting first template + // argument + label tempOpen = userSel.find('<'); + label tempClose = userSel.find('>'); + + word className = userSel(0, tempOpen); + thermoTypeName = userSel(tempOpen + 1, tempClose - tempOpen - 1); + + rhoChemistryModelType = + className + '<' + typeName + ',' + thermoTypeName + '>'; } - Info<< "Selecting rhoChemistryModel " << rhoChemistryModelType << endl; + Info<< "Selecting rhoChemistryModel " << userSel << endl; fvMeshConstructorTable::iterator cstrIter = fvMeshConstructorTablePtr_->find(rhoChemistryModelType); if (cstrIter == fvMeshConstructorTablePtr_->end()) { + wordList models = fvMeshConstructorTablePtr_->toc(); + forAll(models, i) + { + models[i] = models[i].replace(typeName + ',', ""); + } + FatalErrorIn("rhoChemistryModelBase::New(const mesh&)") - << "Unknown rhoChemistryModel type " << rhoChemistryModelType + << "Unknown rhoChemistryModel type " << userSel << nl << nl << "Valid rhoChemistryModel types are:" << nl - << fvMeshConstructorTablePtr_->toc() << nl - << exit(FatalError); + << models << nl << exit(FatalError); } - return autoPtr<rhoChemistryModel>(cstrIter()(mesh)); + return autoPtr<rhoChemistryModel> + (cstrIter()(mesh, typeName, thermoTypeName)); } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.C index 46a6827b4bf55159f473dc709270a519a2ba4ae3..73a3f00e9cf8c4fc81e5532264566a9b5c0eadc5 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.C @@ -38,10 +38,14 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::rhoChemistryModel::rhoChemistryModel(const fvMesh& mesh) +Foam::rhoChemistryModel::rhoChemistryModel +( + const fvMesh& mesh, + const word& thermoTypeName +) : basicChemistryModel(mesh), - thermo_(hReactionThermo::New(mesh)) + thermo_(hReactionThermo::NewType(mesh, thermoTypeName)) {} diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.H index 2e164f8bc28eef69a538ac20236fe1db0db9b9fd..43df6e0406ee2ed27d0de94b832bd399864648d5 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModel.H @@ -89,16 +89,18 @@ public: rhoChemistryModel, fvMesh, ( - const fvMesh& mesh + const fvMesh& mesh, + const word& compTypeName, + const word& thermoTypeName ), - (mesh) + (mesh, compTypeName, thermoTypeName) ); // Constructors //- Construct from mesh - rhoChemistryModel(const fvMesh& mesh); + rhoChemistryModel(const fvMesh& mesh, const word& thermoTypeName); //- Selector diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.C index 1290f23438237db91df6b3ca0a0bd5b15028fb8f..95cfc763881b4ae68bb1e1db21e0402501299a55 100644 --- a/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.C +++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.C @@ -33,11 +33,12 @@ License template<class CompType, class ThermoType> Foam::EulerImplicit<CompType, ThermoType>::EulerImplicit ( - ODEChemistryModel<CompType, ThermoType>& model + ODEChemistryModel<CompType, ThermoType>& model, + const word& modelName ) : - chemistrySolver<CompType, ThermoType>(model), - coeffsDict_(model.subDict(typeName + "Coeffs")), + chemistrySolver<CompType, ThermoType>(model, modelName), + coeffsDict_(model.subDict(modelName + "Coeffs")), cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))), equil_(coeffsDict_.lookup("equilibriumRateLimiter")) {} diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.H b/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.H index 414fb85b42dafa3de2d1370926b7d2acb9d5ee4f..521a06e2768ddd4e10bb97ac3eac62271f3fe140 100644 --- a/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.H +++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.H @@ -75,7 +75,11 @@ public: // Constructors //- Construct from components - EulerImplicit(ODEChemistryModel<CompType, ThermoType>& chemistry); + EulerImplicit + ( + ODEChemistryModel<CompType, ThermoType>& model, + const word& modelName + ); //- Destructor diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.C index c0a24a1019312eb8d7960da7cd148385aeeb75bb..129bcabb00e470caeeb4837d379095459109f191 100644 --- a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.C +++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.C @@ -34,10 +34,12 @@ namespace Foam template<class CompType, class ThermoType> Foam::chemistrySolver<CompType, ThermoType>::chemistrySolver ( - ODEChemistryModel<CompType, ThermoType>& model + ODEChemistryModel<CompType, ThermoType>& model, + const word& modelName ) : - model_(model) + model_(model), + name_(modelName) {} diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.H b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.H index ff133123c7485cc7609fcc6cf968b6902bef5685..0a21a2755c2b2f79f25bc9fc7545d1ff0e64d3f6 100644 --- a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.H +++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.H @@ -65,6 +65,9 @@ protected: //- Reference to the chemistry model ODEChemistryModel<CompType, ThermoType>& model_; + //- Name of the chemistry solver + const word name_; + public: @@ -79,22 +82,29 @@ public: chemistrySolver, dictionary, ( - ODEChemistryModel<CompType, ThermoType>& model + ODEChemistryModel<CompType, ThermoType>& model, + const word& modelName ), - (model) + (model, modelName) ); // Constructors //- Construct from components - chemistrySolver(ODEChemistryModel<CompType, ThermoType>& model); + chemistrySolver + ( + ODEChemistryModel<CompType, ThermoType>& model, + const word& modelName + ); //- Selector static autoPtr<chemistrySolver> New ( - ODEChemistryModel<CompType, ThermoType>& model + ODEChemistryModel<CompType, ThermoType>& model, + const word& compTypeName, + const word& thermoTypeName ); diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/newChemistrySolver.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/newChemistrySolver.C index 43273dba2b4c270c3a94939823c066b34a9b63b9..b0baa00fbe9068c1c61e487296a66fe88871c45c 100644 --- a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/newChemistrySolver.C +++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/newChemistrySolver.C @@ -32,27 +32,48 @@ template<class CompType, class ThermoType> Foam::autoPtr<Foam::chemistrySolver<CompType, ThermoType> > Foam::chemistrySolver<CompType, ThermoType>::New ( - ODEChemistryModel<CompType, ThermoType>& model + ODEChemistryModel<CompType, ThermoType>& model, + const word& compTypeName, + const word& thermoTypeName ) { - word chemistrySolverType(model.CompType::lookup("chemistrySolver")); + word modelName(model.lookup("chemistrySolver")); + + word chemistrySolverType = + modelName + '<' + compTypeName + ',' + thermoTypeName + '>'; + + Info<< "Selecting chemistrySolver " << modelName << endl; typename dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(chemistrySolverType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { + wordList models = dictionaryConstructorTablePtr_->toc(); + forAll(models, i) + { + models[i] = models[i].replace + ( + '<' + compTypeName + ',' + thermoTypeName + '>', + "" + ); + } + FatalErrorIn ( - "chemistrySolver::New(const dictionary&, const ODEChemistryModel&)" - ) << "Unknown chemistrySolver type " << chemistrySolverType - << nl << nl - << "Valid chemistrySolver types are:" << nl - << dictionaryConstructorTablePtr_->toc() << nl - << exit(FatalError); + "chemistrySolver::New" + "(" + "const ODEChemistryModel&, " + "const word&, " + "const word&" + ")" + ) << "Unknown chemistrySolver type " << modelName + << nl << nl << "Valid chemistrySolver types are:" << nl + << models << nl << exit(FatalError); } - return autoPtr<chemistrySolver<CompType, ThermoType> >(cstrIter()(model)); + return autoPtr<chemistrySolver<CompType, ThermoType> > + (cstrIter()(model, modelName)); } diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/ode/ode.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/ode/ode.C index 803c5884619597035eb7c3a47056855699708e7d..7a4bde923f7610abde7a598c8d1d97d09e114a39 100644 --- a/src/thermophysicalModels/chemistryModel/chemistrySolver/ode/ode.C +++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/ode/ode.C @@ -32,11 +32,12 @@ License template<class CompType, class ThermoType> Foam::ode<CompType, ThermoType>::ode ( - ODEChemistryModel<CompType, ThermoType>& model + ODEChemistryModel<CompType, ThermoType>& model, + const word& modelName ) : - chemistrySolver<CompType, ThermoType>(model), - coeffsDict_(model.subDict(typeName + "Coeffs")), + chemistrySolver<CompType, ThermoType>(model, modelName), + coeffsDict_(model.subDict(modelName + "Coeffs")), solverName_(coeffsDict_.lookup("ODESolver")), odeSolver_(ODESolver::New(solverName_, model)), eps_(readScalar(coeffsDict_.lookup("eps"))), diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/ode/ode.H b/src/thermophysicalModels/chemistryModel/chemistrySolver/ode/ode.H index 8318b0bc3df60dc2d8b13aeff4ac98d24c4b3367..faac5ca2ad2826a51967d4b7c2dfe18077c14183 100644 --- a/src/thermophysicalModels/chemistryModel/chemistrySolver/ode/ode.H +++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/ode/ode.H @@ -78,7 +78,11 @@ public: // Constructors //- Construct from components - ode(ODEChemistryModel<CompType, ThermoType>& model); + ode + ( + ODEChemistryModel<CompType, ThermoType>& model, + const word& modelName + ); //- Destructor diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/sequential/sequential.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/sequential/sequential.C index aee8a25bf2d14ff963bcab1833c7f42d1725aa63..d929c5aea2e12a3d426441418db6319ffead318c 100644 --- a/src/thermophysicalModels/chemistryModel/chemistrySolver/sequential/sequential.C +++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/sequential/sequential.C @@ -32,11 +32,12 @@ License template<class CompType, class ThermoType> Foam::sequential<CompType, ThermoType>::sequential ( - ODEChemistryModel<CompType, ThermoType>& model + ODEChemistryModel<CompType, ThermoType>& model, + const word& modelName ) : - chemistrySolver<CompType, ThermoType>(model), - coeffsDict_(model.subDict(typeName + "Coeffs")), + chemistrySolver<CompType, ThermoType>(model, modelName), + coeffsDict_(model.subDict(modelName + "Coeffs")), cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))), equil_(coeffsDict_.lookup("equilibriumRateLimiter")) {} diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/sequential/sequential.H b/src/thermophysicalModels/chemistryModel/chemistrySolver/sequential/sequential.H index 276d7d5341c2ca321832bb0f942678794a446263..c72692a40faaf68e29885d714a99cc2657952bbc 100644 --- a/src/thermophysicalModels/chemistryModel/chemistrySolver/sequential/sequential.H +++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/sequential/sequential.H @@ -78,7 +78,11 @@ public: //- Construct from components - sequential(ODEChemistryModel<CompType, ThermoType>& model); + sequential + ( + ODEChemistryModel<CompType, ThermoType>& model, + const word& modelName + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.H b/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.H index fc4f20dfae39466672ded5f377e7f465886b5a35..b4b66b55bdb3dcefc0ad5143773cb400e03d2f78 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.H +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.H @@ -86,8 +86,17 @@ public: hCombustionThermo(const fvMesh&); - //- Selector - static autoPtr<hCombustionThermo> New(const fvMesh&); + // Selectors + + //- Standard selection based on fvMesh + static autoPtr<hCombustionThermo> New(const fvMesh&); + + //- Select and check that package contains 'thermoType' + static autoPtr<hCombustionThermo> NewType + ( + const fvMesh&, + const word& thermoType + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/newhCombustionThermo.C b/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/newhCombustionThermo.C index cb223d0c42e76198776c7a119aa350390d993ca2..175c7d4756bb432ad09067c01b481d56f72ae100 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/newhCombustionThermo.C +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/newhCombustionThermo.C @@ -75,4 +75,66 @@ Foam::autoPtr<Foam::hCombustionThermo> Foam::hCombustionThermo::New } +Foam::autoPtr<Foam::hCombustionThermo> Foam::hCombustionThermo::NewType +( + const fvMesh& mesh, + const word& thermoType +) +{ + word hCombustionThermoTypeName; + + // Enclose the creation of the thermophysicalProperties to ensure it is + // deleted before the turbulenceModel is created otherwise the dictionary + // is entered in the database twice + { + IOdictionary thermoDict + ( + IOobject + ( + "thermophysicalProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + thermoDict.lookup("thermoType") >> hCombustionThermoTypeName; + + if (hCombustionThermoTypeName.find(thermoType) == string::npos) + { + FatalErrorIn + ( + "autoPtr<hCombustionThermo> hCombustionThermo::NewType" + "(" + "const fvMesh&, " + "const word&" + ")" + ) << "Inconsistent thermo package selected:" << nl << nl + << hCombustionThermoTypeName << nl << nl << "Please select a " + << "thermo package based on " << thermoType << nl << nl + << exit(FatalError); + } + } + + Info<< "Selecting thermodynamics package " << hCombustionThermoTypeName + << endl; + + fvMeshConstructorTable::iterator cstrIter = + fvMeshConstructorTablePtr_->find(hCombustionThermoTypeName); + + if (cstrIter == fvMeshConstructorTablePtr_->end()) + { + FatalErrorIn("hCombustionThermo::New(const fvMesh&)") + << "Unknown hCombustionThermo type " + << hCombustionThermoTypeName << nl << nl + << "Valid hCombustionThermo types are:" << nl + << fvMeshConstructorTablePtr_->toc() << nl + << exit(FatalError); + } + + return autoPtr<hCombustionThermo>(cstrIter()(mesh)); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/hReactionThermo.H b/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/hReactionThermo.H index 82d653048bad98694b642413c9190dea8df42b22..3d5c37614c3c16e3ec5fd7786bc667da322bb900 100644 --- a/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/hReactionThermo.H +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/hReactionThermo.H @@ -86,8 +86,17 @@ public: hReactionThermo(const fvMesh&); - //- Selector - static autoPtr<hReactionThermo> New(const fvMesh&); + // Selectors + + //- Standard selection based on fvMesh + static autoPtr<hReactionThermo> New(const fvMesh&); + + //- Select and check that package contains 'thermoType' + static autoPtr<hReactionThermo> NewType + ( + const fvMesh&, + const word& thermoType + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/newhReactionThermo.C b/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/newhReactionThermo.C index 104c66f613222b0b67f6a73353611263b6ce314e..ceeba8922558b19de31d2c65191e3702d5019c35 100644 --- a/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/newhReactionThermo.C +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/hReactionThermo/newhReactionThermo.C @@ -75,4 +75,66 @@ Foam::autoPtr<Foam::hReactionThermo> Foam::hReactionThermo::New } +Foam::autoPtr<Foam::hReactionThermo> Foam::hReactionThermo::NewType +( + const fvMesh& mesh, + const word& thermoType +) +{ + word hReactionThermoTypeName; + + // Enclose the creation of the thermophysicalProperties to ensure it is + // deleted before the turbulenceModel is created otherwise the dictionary + // is entered in the database twice + { + IOdictionary thermoDict + ( + IOobject + ( + "thermophysicalProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + thermoDict.lookup("thermoType") >> hReactionThermoTypeName; + + if (hReactionThermoTypeName.find(thermoType) == string::npos) + { + FatalErrorIn + ( + "autoPtr<hReactionThermo> hReactionThermo::NewType" + "(" + "const fvMesh&, " + "const word&" + ")" + ) << "Inconsistent thermo package selected:" << nl << nl + << hReactionThermoTypeName << nl << nl << "Please select a " + << "thermo package based on " << thermoType << nl << nl + << exit(FatalError); + } + } + + Info<< "Selecting thermodynamics package " << hReactionThermoTypeName + << endl; + + fvMeshConstructorTable::iterator cstrIter = + fvMeshConstructorTablePtr_->find(hReactionThermoTypeName); + + if (cstrIter == fvMeshConstructorTablePtr_->end()) + { + FatalErrorIn("hReactionThermo::New(const fvMesh&)") + << "Unknown hReactionThermo type " + << hReactionThermoTypeName << nl << nl + << "Valid hReactionThermo types are:" << nl + << fvMeshConstructorTablePtr_->toc() << nl + << exit(FatalError); + } + + return autoPtr<hReactionThermo>(cstrIter()(mesh)); +} + + // ************************************************************************* // diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/chemistryProperties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/chemistryProperties index a13dc664a59cac61c012ec36d0c56ee450d07929..20d9d19a8f591c9157114fc71e6410459b39dc4a 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/chemistryProperties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/chemistryProperties @@ -15,11 +15,13 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +psiChemistryModel ODEChemistryModel<gasThermoPhysics>; + chemistry on; turbulentReaction on; -chemistrySolver ODE; +chemistrySolver ode; initialChemicalTimeStep 1e-07; @@ -34,7 +36,7 @@ EulerImplicitCoeffs equilibriumRateLimiter off; } -ODECoeffs +odeCoeffs { ODESolver SIBS; eps 0.05; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/thermophysicalProperties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/thermophysicalProperties index 4936c35ab1a0392631456c8a0dcee3d6b7883db2..e5c06a7e043b893bddb9f7131f5e087ae3fac0b6 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/thermophysicalProperties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/thermophysicalProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType hMixtureThermo<reactingMixture>; +thermoType hPsiMixtureThermo<reactingMixture<gasThermoPhysics>>; chemistryReader foamChemistryReader;