mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
simplifying i-o for chemistry models + thermo
This commit is contained in:
@ -113,7 +113,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
rho = thermo->rho();
|
rho = thermo.rho();
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|
||||||
|
|||||||
@ -33,10 +33,12 @@ License
|
|||||||
template<class CompType, class ThermoType>
|
template<class CompType, class ThermoType>
|
||||||
Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
|
Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
|
||||||
(
|
(
|
||||||
const fvMesh& mesh
|
const fvMesh& mesh,
|
||||||
|
const word& compTypeName,
|
||||||
|
const word& thermoTypeName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
CompType(mesh),
|
CompType(mesh, thermoTypeName),
|
||||||
|
|
||||||
ODE(),
|
ODE(),
|
||||||
|
|
||||||
@ -46,7 +48,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
|
|||||||
(
|
(
|
||||||
dynamic_cast<const reactingMixture<ThermoType>&>(this->thermo())
|
dynamic_cast<const reactingMixture<ThermoType>&>(this->thermo())
|
||||||
),
|
),
|
||||||
specieThermo_
|
specieThermo_
|
||||||
(
|
(
|
||||||
dynamic_cast<const reactingMixture<ThermoType>&>
|
dynamic_cast<const reactingMixture<ThermoType>&>
|
||||||
(this->thermo()).speciesData()
|
(this->thermo()).speciesData()
|
||||||
@ -55,7 +57,15 @@ Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
|
|||||||
nSpecie_(Y_.size()),
|
nSpecie_(Y_.size()),
|
||||||
nReaction_(reactions_.size()),
|
nReaction_(reactions_.size()),
|
||||||
|
|
||||||
solver_(chemistrySolver<CompType, ThermoType>::New(*this)),
|
solver_
|
||||||
|
(
|
||||||
|
chemistrySolver<CompType, ThermoType>::New
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
compTypeName,
|
||||||
|
thermoTypeName
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
RR_(nSpecie_)
|
RR_(nSpecie_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -110,7 +110,12 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
ODEChemistryModel(const fvMesh& mesh);
|
ODEChemistryModel
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const word& compTypeName,
|
||||||
|
const word& thermoTypeName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -57,9 +57,7 @@ Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh)
|
|||||||
mesh.nCells(),
|
mesh.nCells(),
|
||||||
readScalar(lookup("initialChemicalTimeStep"))
|
readScalar(lookup("initialChemicalTimeStep"))
|
||||||
)
|
)
|
||||||
{
|
{}
|
||||||
Info<< "basicChemistryModel(const fvMesh&)" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -34,6 +34,8 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
word psiChemistryModelType;
|
word psiChemistryModelType;
|
||||||
|
word thermoTypeName;
|
||||||
|
word userSel;
|
||||||
|
|
||||||
// Enclose the creation of the chemistrtyProperties to ensure it is
|
// Enclose the creation of the chemistrtyProperties to ensure it is
|
||||||
// deleted before the chemistrtyProperties is created otherwise the
|
// deleted before the chemistrtyProperties is created otherwise the
|
||||||
@ -51,25 +53,41 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
chemistryPropertiesDict.lookup("psiChemistryModel") >>
|
chemistryPropertiesDict.lookup("psiChemistryModel") >> userSel;
|
||||||
psiChemistryModelType;
|
|
||||||
|
// 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 =
|
fvMeshConstructorTable::iterator cstrIter =
|
||||||
fvMeshConstructorTablePtr_->find(psiChemistryModelType);
|
fvMeshConstructorTablePtr_->find(psiChemistryModelType);
|
||||||
|
|
||||||
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
||||||
{
|
{
|
||||||
|
wordList models = fvMeshConstructorTablePtr_->toc();
|
||||||
|
forAll(models, i)
|
||||||
|
{
|
||||||
|
models[i] = models[i].replace(typeName + ',', "");
|
||||||
|
}
|
||||||
|
|
||||||
FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
|
FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
|
||||||
<< "Unknown psiChemistryModel type " << psiChemistryModelType
|
<< "Unknown psiChemistryModel type " << userSel
|
||||||
<< nl << nl << "Valid psiChemistryModel types are:" << nl
|
<< nl << nl << "Valid psiChemistryModel types are:" << nl
|
||||||
<< fvMeshConstructorTablePtr_->toc() << nl
|
<< models << nl << exit(FatalError);
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<psiChemistryModel>(cstrIter()(mesh));
|
return autoPtr<psiChemistryModel>
|
||||||
|
(cstrIter()(mesh, typeName, thermoTypeName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -38,10 +38,14 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::psiChemistryModel::psiChemistryModel(const fvMesh& mesh)
|
Foam::psiChemistryModel::psiChemistryModel
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const word& thermoTypeName
|
||||||
|
)
|
||||||
:
|
:
|
||||||
basicChemistryModel(mesh),
|
basicChemistryModel(mesh),
|
||||||
thermo_(hCombustionThermo::New(mesh))
|
thermo_(hCombustionThermo::NewType(mesh, thermoTypeName))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -89,16 +89,18 @@ public:
|
|||||||
psiChemistryModel,
|
psiChemistryModel,
|
||||||
fvMesh,
|
fvMesh,
|
||||||
(
|
(
|
||||||
const fvMesh& mesh
|
const fvMesh& mesh,
|
||||||
|
const word& compTypeName,
|
||||||
|
const word& thermoTypeName
|
||||||
),
|
),
|
||||||
(mesh)
|
(mesh, compTypeName, thermoTypeName)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh
|
//- Construct from mesh
|
||||||
psiChemistryModel(const fvMesh& mesh);
|
psiChemistryModel(const fvMesh& mesh, const word& thermoTypeName);
|
||||||
|
|
||||||
|
|
||||||
//- Selector
|
//- Selector
|
||||||
|
|||||||
@ -34,6 +34,8 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
word rhoChemistryModelType;
|
word rhoChemistryModelType;
|
||||||
|
word thermoTypeName;
|
||||||
|
word userSel;
|
||||||
|
|
||||||
// Enclose the creation of the chemistrtyProperties to ensure it is
|
// Enclose the creation of the chemistrtyProperties to ensure it is
|
||||||
// deleted before the chemistrtyProperties is created otherwise the
|
// deleted before the chemistrtyProperties is created otherwise the
|
||||||
@ -51,25 +53,41 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
chemistryPropertiesDict.lookup("rhoChemistryModel") >>
|
chemistryPropertiesDict.lookup("rhoChemistryModelType") >> userSel;
|
||||||
rhoChemistryModelType;
|
|
||||||
|
// 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 =
|
fvMeshConstructorTable::iterator cstrIter =
|
||||||
fvMeshConstructorTablePtr_->find(rhoChemistryModelType);
|
fvMeshConstructorTablePtr_->find(rhoChemistryModelType);
|
||||||
|
|
||||||
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
||||||
{
|
{
|
||||||
|
wordList models = fvMeshConstructorTablePtr_->toc();
|
||||||
|
forAll(models, i)
|
||||||
|
{
|
||||||
|
models[i] = models[i].replace(typeName + ',', "");
|
||||||
|
}
|
||||||
|
|
||||||
FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
|
FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
|
||||||
<< "Unknown rhoChemistryModel type " << rhoChemistryModelType
|
<< "Unknown rhoChemistryModel type " << userSel
|
||||||
<< nl << nl << "Valid rhoChemistryModel types are:" << nl
|
<< nl << nl << "Valid rhoChemistryModel types are:" << nl
|
||||||
<< fvMeshConstructorTablePtr_->toc() << nl
|
<< models << nl << exit(FatalError);
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<rhoChemistryModel>(cstrIter()(mesh));
|
return autoPtr<rhoChemistryModel>
|
||||||
|
(cstrIter()(mesh, typeName, thermoTypeName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -38,10 +38,14 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::rhoChemistryModel::rhoChemistryModel(const fvMesh& mesh)
|
Foam::rhoChemistryModel::rhoChemistryModel
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const word& thermoTypeName
|
||||||
|
)
|
||||||
:
|
:
|
||||||
basicChemistryModel(mesh),
|
basicChemistryModel(mesh),
|
||||||
thermo_(hReactionThermo::New(mesh))
|
thermo_(hReactionThermo::NewType(mesh, thermoTypeName))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -89,16 +89,18 @@ public:
|
|||||||
rhoChemistryModel,
|
rhoChemistryModel,
|
||||||
fvMesh,
|
fvMesh,
|
||||||
(
|
(
|
||||||
const fvMesh& mesh
|
const fvMesh& mesh,
|
||||||
|
const word& compTypeName,
|
||||||
|
const word& thermoTypeName
|
||||||
),
|
),
|
||||||
(mesh)
|
(mesh, compTypeName, thermoTypeName)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh
|
//- Construct from mesh
|
||||||
rhoChemistryModel(const fvMesh& mesh);
|
rhoChemistryModel(const fvMesh& mesh, const word& thermoTypeName);
|
||||||
|
|
||||||
|
|
||||||
//- Selector
|
//- Selector
|
||||||
|
|||||||
@ -33,11 +33,12 @@ License
|
|||||||
template<class CompType, class ThermoType>
|
template<class CompType, class ThermoType>
|
||||||
Foam::EulerImplicit<CompType, ThermoType>::EulerImplicit
|
Foam::EulerImplicit<CompType, ThermoType>::EulerImplicit
|
||||||
(
|
(
|
||||||
ODEChemistryModel<CompType, ThermoType>& model
|
ODEChemistryModel<CompType, ThermoType>& model,
|
||||||
|
const word& modelName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
chemistrySolver<CompType, ThermoType>(model),
|
chemistrySolver<CompType, ThermoType>(model, modelName),
|
||||||
coeffsDict_(model.subDict(typeName + "Coeffs")),
|
coeffsDict_(model.subDict(modelName + "Coeffs")),
|
||||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||||
equil_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
equil_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -75,7 +75,11 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
EulerImplicit(ODEChemistryModel<CompType, ThermoType>& chemistry);
|
EulerImplicit
|
||||||
|
(
|
||||||
|
ODEChemistryModel<CompType, ThermoType>& model,
|
||||||
|
const word& modelName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -34,10 +34,12 @@ namespace Foam
|
|||||||
template<class CompType, class ThermoType>
|
template<class CompType, class ThermoType>
|
||||||
Foam::chemistrySolver<CompType, ThermoType>::chemistrySolver
|
Foam::chemistrySolver<CompType, ThermoType>::chemistrySolver
|
||||||
(
|
(
|
||||||
ODEChemistryModel<CompType, ThermoType>& model
|
ODEChemistryModel<CompType, ThermoType>& model,
|
||||||
|
const word& modelName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
model_(model)
|
model_(model),
|
||||||
|
name_(modelName)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -65,6 +65,9 @@ protected:
|
|||||||
//- Reference to the chemistry model
|
//- Reference to the chemistry model
|
||||||
ODEChemistryModel<CompType, ThermoType>& model_;
|
ODEChemistryModel<CompType, ThermoType>& model_;
|
||||||
|
|
||||||
|
//- Name of the chemistry solver
|
||||||
|
const word name_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -79,22 +82,29 @@ public:
|
|||||||
chemistrySolver,
|
chemistrySolver,
|
||||||
dictionary,
|
dictionary,
|
||||||
(
|
(
|
||||||
ODEChemistryModel<CompType, ThermoType>& model
|
ODEChemistryModel<CompType, ThermoType>& model,
|
||||||
|
const word& modelName
|
||||||
),
|
),
|
||||||
(model)
|
(model, modelName)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
chemistrySolver(ODEChemistryModel<CompType, ThermoType>& model);
|
chemistrySolver
|
||||||
|
(
|
||||||
|
ODEChemistryModel<CompType, ThermoType>& model,
|
||||||
|
const word& modelName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Selector
|
//- Selector
|
||||||
static autoPtr<chemistrySolver> New
|
static autoPtr<chemistrySolver> New
|
||||||
(
|
(
|
||||||
ODEChemistryModel<CompType, ThermoType>& model
|
ODEChemistryModel<CompType, ThermoType>& model,
|
||||||
|
const word& compTypeName,
|
||||||
|
const word& thermoTypeName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,27 +32,48 @@ template<class CompType, class ThermoType>
|
|||||||
Foam::autoPtr<Foam::chemistrySolver<CompType, ThermoType> >
|
Foam::autoPtr<Foam::chemistrySolver<CompType, ThermoType> >
|
||||||
Foam::chemistrySolver<CompType, ThermoType>::New
|
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 =
|
typename dictionaryConstructorTable::iterator cstrIter =
|
||||||
dictionaryConstructorTablePtr_->find(chemistrySolverType);
|
dictionaryConstructorTablePtr_->find(chemistrySolverType);
|
||||||
|
|
||||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
{
|
{
|
||||||
|
wordList models = dictionaryConstructorTablePtr_->toc();
|
||||||
|
forAll(models, i)
|
||||||
|
{
|
||||||
|
models[i] = models[i].replace
|
||||||
|
(
|
||||||
|
'<' + compTypeName + ',' + thermoTypeName + '>',
|
||||||
|
""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"chemistrySolver::New(const dictionary&, const ODEChemistryModel&)"
|
"chemistrySolver::New"
|
||||||
) << "Unknown chemistrySolver type " << chemistrySolverType
|
"("
|
||||||
<< nl << nl
|
"const ODEChemistryModel&, "
|
||||||
<< "Valid chemistrySolver types are:" << nl
|
"const word&, "
|
||||||
<< dictionaryConstructorTablePtr_->toc() << nl
|
"const word&"
|
||||||
<< exit(FatalError);
|
")"
|
||||||
|
) << "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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,11 +32,12 @@ License
|
|||||||
template<class CompType, class ThermoType>
|
template<class CompType, class ThermoType>
|
||||||
Foam::ode<CompType, ThermoType>::ode
|
Foam::ode<CompType, ThermoType>::ode
|
||||||
(
|
(
|
||||||
ODEChemistryModel<CompType, ThermoType>& model
|
ODEChemistryModel<CompType, ThermoType>& model,
|
||||||
|
const word& modelName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
chemistrySolver<CompType, ThermoType>(model),
|
chemistrySolver<CompType, ThermoType>(model, modelName),
|
||||||
coeffsDict_(model.subDict(typeName + "Coeffs")),
|
coeffsDict_(model.subDict(modelName + "Coeffs")),
|
||||||
solverName_(coeffsDict_.lookup("ODESolver")),
|
solverName_(coeffsDict_.lookup("ODESolver")),
|
||||||
odeSolver_(ODESolver::New(solverName_, model)),
|
odeSolver_(ODESolver::New(solverName_, model)),
|
||||||
eps_(readScalar(coeffsDict_.lookup("eps"))),
|
eps_(readScalar(coeffsDict_.lookup("eps"))),
|
||||||
|
|||||||
@ -78,7 +78,11 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
ode(ODEChemistryModel<CompType, ThermoType>& model);
|
ode
|
||||||
|
(
|
||||||
|
ODEChemistryModel<CompType, ThermoType>& model,
|
||||||
|
const word& modelName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -32,11 +32,12 @@ License
|
|||||||
template<class CompType, class ThermoType>
|
template<class CompType, class ThermoType>
|
||||||
Foam::sequential<CompType, ThermoType>::sequential
|
Foam::sequential<CompType, ThermoType>::sequential
|
||||||
(
|
(
|
||||||
ODEChemistryModel<CompType, ThermoType>& model
|
ODEChemistryModel<CompType, ThermoType>& model,
|
||||||
|
const word& modelName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
chemistrySolver<CompType, ThermoType>(model),
|
chemistrySolver<CompType, ThermoType>(model, modelName),
|
||||||
coeffsDict_(model.subDict(typeName + "Coeffs")),
|
coeffsDict_(model.subDict(modelName + "Coeffs")),
|
||||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||||
equil_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
equil_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -78,7 +78,11 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
sequential(ODEChemistryModel<CompType, ThermoType>& model);
|
sequential
|
||||||
|
(
|
||||||
|
ODEChemistryModel<CompType, ThermoType>& model,
|
||||||
|
const word& modelName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -86,8 +86,17 @@ public:
|
|||||||
hCombustionThermo(const fvMesh&);
|
hCombustionThermo(const fvMesh&);
|
||||||
|
|
||||||
|
|
||||||
//- Selector
|
// Selectors
|
||||||
static autoPtr<hCombustionThermo> New(const fvMesh&);
|
|
||||||
|
//- 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
|
//- Destructor
|
||||||
|
|||||||
@ -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));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -86,8 +86,17 @@ public:
|
|||||||
hReactionThermo(const fvMesh&);
|
hReactionThermo(const fvMesh&);
|
||||||
|
|
||||||
|
|
||||||
//- Selector
|
// Selectors
|
||||||
static autoPtr<hReactionThermo> New(const fvMesh&);
|
|
||||||
|
//- 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
|
//- Destructor
|
||||||
|
|||||||
@ -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));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -15,11 +15,13 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
psiChemistryModel ODEChemistryModel<gasThermoPhysics>;
|
||||||
|
|
||||||
chemistry on;
|
chemistry on;
|
||||||
|
|
||||||
turbulentReaction on;
|
turbulentReaction on;
|
||||||
|
|
||||||
chemistrySolver ODE;
|
chemistrySolver ode;
|
||||||
|
|
||||||
initialChemicalTimeStep 1e-07;
|
initialChemicalTimeStep 1e-07;
|
||||||
|
|
||||||
@ -34,7 +36,7 @@ EulerImplicitCoeffs
|
|||||||
equilibriumRateLimiter off;
|
equilibriumRateLimiter off;
|
||||||
}
|
}
|
||||||
|
|
||||||
ODECoeffs
|
odeCoeffs
|
||||||
{
|
{
|
||||||
ODESolver SIBS;
|
ODESolver SIBS;
|
||||||
eps 0.05;
|
eps 0.05;
|
||||||
|
|||||||
@ -15,7 +15,7 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
thermoType hMixtureThermo<reactingMixture>;
|
thermoType hPsiMixtureThermo<reactingMixture<gasThermoPhysics>>;
|
||||||
|
|
||||||
chemistryReader foamChemistryReader;
|
chemistryReader foamChemistryReader;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user