diff --git a/src/combustionModels/CombustionModel/CombustionModel/CombustionModels.C b/src/combustionModels/CombustionModel/CombustionModel/CombustionModels.C index 2c8c73a36..90536bd9e 100644 --- a/src/combustionModels/CombustionModel/CombustionModel/CombustionModels.C +++ b/src/combustionModels/CombustionModel/CombustionModel/CombustionModels.C @@ -25,8 +25,7 @@ License #include "makeCombustionTypes.H" -#include "ChemistryCombustion.H" -#include "ThermoCombustion.H" +#include "CombustionModel.H" #include "rhoReactionThermo.H" #include "psiReactionThermo.H" diff --git a/src/combustionModels/combustionModel/combustionModel.C b/src/combustionModels/combustionModel/combustionModel.C index e9a25d053..8f4771bc3 100644 --- a/src/combustionModels/combustionModel/combustionModel.C +++ b/src/combustionModels/combustionModel/combustionModel.C @@ -38,6 +38,36 @@ const Foam::word Foam::combustionModel::combustionPropertiesName ); +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::IOobject Foam::combustionModel::createIOobject +( + basicThermo& thermo, + const word& combustionProperties +) const +{ + IOobject io + ( + thermo.phasePropertyName(combustionProperties), + thermo.db().time().constant(), + thermo.db(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + if (io.typeHeaderOk(true)) + { + io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; + return io; + } + else + { + io.readOpt() = IOobject::NO_READ; + return io; + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::combustionModel::combustionModel @@ -48,17 +78,7 @@ Foam::combustionModel::combustionModel const word& combustionProperties ) : - IOdictionary - ( - IOobject - ( - thermo.phasePropertyName(combustionProperties), - thermo.db().time().constant(), - thermo.db(), - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ), + IOdictionary(createIOobject(thermo, combustionProperties)), mesh_(thermo.p().mesh()), turb_(turb), active_(lookupOrDefault("active", true)), diff --git a/src/combustionModels/combustionModel/combustionModel.H b/src/combustionModels/combustionModel/combustionModel.H index be3e8728d..3334ada8e 100644 --- a/src/combustionModels/combustionModel/combustionModel.H +++ b/src/combustionModels/combustionModel/combustionModel.H @@ -59,6 +59,13 @@ class combustionModel //- Disallow default bitwise assignment void operator=(const combustionModel&); + //- Construct the base IO object + IOobject createIOobject + ( + basicThermo& thermo, + const word& combustionProperties + ) const; + protected: diff --git a/src/combustionModels/combustionModel/combustionModelTemplates.C b/src/combustionModels/combustionModel/combustionModelTemplates.C index 8be92d0d8..a9682776c 100644 --- a/src/combustionModels/combustionModel/combustionModelTemplates.C +++ b/src/combustionModels/combustionModel/combustionModelTemplates.C @@ -33,22 +33,31 @@ Foam::autoPtr Foam::combustionModel::New const word& combustionProperties ) { - word combModelName + IOobject combIO ( - IOdictionary + IOobject ( - IOobject - ( - thermo.phasePropertyName(combustionProperties), - thermo.db().time().constant(), - thermo.db(), - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) - ).lookup("combustionModel") + thermo.phasePropertyName(combustionProperties), + thermo.db().time().constant(), + thermo.db(), + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) ); + word combModelName("none"); + if (combIO.typeHeaderOk(false)) + { + IOdictionary(combIO).lookup("combustionModel") >> combModelName; + } + else + { + Info<< "Combustion model not active: " + << thermo.phasePropertyName(combustionProperties) + << " not found" << endl; + } + Info<< "Selecting combustion model " << combModelName << endl; const wordList cmpts2(basicThermo::splitThermoName(combModelName, 2));