combustionModels: Default to the "none" model

When the constant/combustionProperties dictionary is missing, the solver
will now default to the "none" model. This is consistent with how
radiation models are selected.
This commit is contained in:
Will Bainbridge
2017-12-12 15:33:56 +00:00
parent 476cbcaac8
commit 4df95ff418
4 changed files with 60 additions and 25 deletions

View File

@ -25,8 +25,7 @@ License
#include "makeCombustionTypes.H"
#include "ChemistryCombustion.H"
#include "ThermoCombustion.H"
#include "CombustionModel.H"
#include "rhoReactionThermo.H"
#include "psiReactionThermo.H"

View File

@ -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<IOdictionary>(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<Switch>("active", true)),

View File

@ -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:

View File

@ -33,22 +33,31 @@ Foam::autoPtr<CombustionModel> 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<IOdictionary>(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));