mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated chemistry solvers
This commit is contained in:
@ -848,11 +848,13 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
|
||||
notImplemented
|
||||
(
|
||||
"ODEChemistryModel::solve"
|
||||
"scalarField&, "
|
||||
"const scalar, "
|
||||
"const scalar, "
|
||||
"const scalar, "
|
||||
"const scalar"
|
||||
"("
|
||||
"scalarField&, "
|
||||
"const scalar, "
|
||||
"const scalar, "
|
||||
"const scalar, "
|
||||
"const scalar"
|
||||
")"
|
||||
);
|
||||
|
||||
return (0);
|
||||
|
||||
@ -48,13 +48,6 @@ namespace Foam
|
||||
SS##Comp##Thermo, \
|
||||
#SS"<"#Comp","#Thermo">", \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Comp, \
|
||||
SS##Comp##Thermo, \
|
||||
fvMesh \
|
||||
);
|
||||
|
||||
|
||||
@ -67,13 +60,6 @@ namespace Foam
|
||||
SS##Comp##SThermo##GThermo, \
|
||||
#SS"<"#Comp","#SThermo","#GThermo">", \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Comp, \
|
||||
SS##Comp##SThermo##GThermo, \
|
||||
fvMesh \
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,24 +32,40 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
// get model name, but do not register the dictionary
|
||||
// otherwise it is registered in the database twice
|
||||
const word userModel
|
||||
IOdictionary chemistryPropertiesDict
|
||||
(
|
||||
IOdictionary
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("psiChemistryModel")
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
const word solver(chemistryPropertiesDict.lookup("chemistrySolver"));
|
||||
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
wordHashSet validModels;
|
||||
forAll(models, i)
|
||||
{
|
||||
label delim = models[i].find('<');
|
||||
validModels.insert(models[i](0, delim));
|
||||
}
|
||||
|
||||
wordHashSet::iterator solverIter = validModels.find(solver);
|
||||
if (solverIter == validModels.end())
|
||||
{
|
||||
FatalErrorIn("psiChemistryModel::New(const fvMesh&)")
|
||||
<< "Valid chemistrySolver types are:" << validModels
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
const word userModel(chemistryPropertiesDict.lookup("psiChemistryModel"));
|
||||
|
||||
// construct chemistry model type name by inserting first template argument
|
||||
const label tempOpen = userModel.find('<');
|
||||
const label tempClose = userModel.find('>');
|
||||
@ -59,7 +75,7 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
userModel(tempOpen + 1, tempClose - tempOpen - 1);
|
||||
|
||||
const word modelType =
|
||||
className + '<' + typeName + ',' + thermoTypeName + '>';
|
||||
solver + '<' + className + '<' + typeName + ',' + thermoTypeName + ">>";
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -77,7 +93,7 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
|
||||
FatalErrorIn("psiChemistryModel::New(const mesh&)")
|
||||
<< "Unknown psiChemistryModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid psiChemistryModel types are:" << nl
|
||||
@ -86,16 +102,22 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
}
|
||||
else
|
||||
{
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
forAll(models, i)
|
||||
wordList allModels(fvMeshConstructorTablePtr_->sortedToc());
|
||||
wordHashSet models;
|
||||
forAll(allModels, i)
|
||||
{
|
||||
models[i] = models[i].replace(typeName + ',', "");
|
||||
const label tempOpen = allModels[i].find('<');
|
||||
const label tempClose = allModels[i].rfind('>');
|
||||
word modelName =
|
||||
allModels[i](tempOpen + 1, tempClose - tempOpen - 1);
|
||||
modelName = modelName.replace(typeName + ',', "");
|
||||
models.insert(modelName);
|
||||
}
|
||||
|
||||
FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
|
||||
FatalErrorIn("psiChemistryModel::New(const mesh&)")
|
||||
<< "Unknown psiChemistryModel type " << userModel
|
||||
<< nl << nl << "Valid psiChemistryModel types are:" << nl
|
||||
<< models << nl << exit(FatalError);
|
||||
<< nl << nl << "Valid psiChemistryModel types are:"
|
||||
<< models << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,24 +32,40 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
// get model name, but do not register the dictionary
|
||||
// otherwise it is registered in the database twice
|
||||
const word userModel
|
||||
IOdictionary chemistryPropertiesDict
|
||||
(
|
||||
IOdictionary
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("rhoChemistryModel")
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
const word solver(chemistryPropertiesDict.lookup("chemistrySolver"));
|
||||
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
wordHashSet validModels;
|
||||
forAll(models, i)
|
||||
{
|
||||
label delim = models[i].find('<');
|
||||
validModels.insert(models[i](0, delim));
|
||||
}
|
||||
|
||||
wordHashSet::iterator solverIter = validModels.find(solver);
|
||||
if (solverIter == validModels.end())
|
||||
{
|
||||
FatalErrorIn("rhoChemistryModel::New(const fvMesh&)")
|
||||
<< "Valid chemistrySolver types are:" << validModels
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
const word userModel(chemistryPropertiesDict.lookup("rhoChemistryModel"));
|
||||
|
||||
// construct chemistry model type name by inserting first template argument
|
||||
const label tempOpen = userModel.find('<');
|
||||
const label tempClose = userModel.find('>');
|
||||
@ -59,7 +75,7 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
userModel(tempOpen + 1, tempClose - tempOpen - 1);
|
||||
|
||||
const word modelType =
|
||||
className + '<' + typeName + ',' + thermoTypeName + '>';
|
||||
solver + '<' + className + '<' + typeName + ',' + thermoTypeName + ">>";
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -77,7 +93,7 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
|
||||
FatalErrorIn("rhoChemistryModel::New(const mesh&)")
|
||||
<< "Unknown rhoChemistryModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid rhoChemistryModel types are:" << nl
|
||||
@ -86,18 +102,22 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
}
|
||||
else
|
||||
{
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
forAll(models, i)
|
||||
wordList allModels(fvMeshConstructorTablePtr_->sortedToc());
|
||||
wordHashSet models;
|
||||
forAll(allModels, i)
|
||||
{
|
||||
models[i] = models[i].replace(typeName + ',', "");
|
||||
const label tempOpen = allModels[i].find('<');
|
||||
const label tempClose = allModels[i].rfind('>');
|
||||
word modelName =
|
||||
allModels[i](tempOpen + 1, tempClose - tempOpen - 1);
|
||||
modelName = modelName.replace(typeName + ',', "");
|
||||
models.insert(modelName);
|
||||
}
|
||||
|
||||
FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
|
||||
<< "Unknown rhoChemistryModel type "
|
||||
<< userModel << nl << nl
|
||||
<< "Valid rhoChemistryModel types are:" << nl
|
||||
<< models << nl
|
||||
<< exit(FatalError);
|
||||
FatalErrorIn("rhoChemistryModel::New(const mesh&)")
|
||||
<< "Unknown rhoChemistryModel type " << userModel
|
||||
<< nl << nl << "Valid rhoChemistryModel types are:"
|
||||
<< models << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ Foam::EulerImplicit<ODEChemistryType>::EulerImplicit
|
||||
)
|
||||
:
|
||||
chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType),
|
||||
coeffsDict_(this->subDict(ODEModelName + "Coeffs")),
|
||||
coeffsDict_(this->subDict("EulerImplicitCoeffs")),
|
||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||
eqRateLimiter_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
{}
|
||||
|
||||
@ -37,8 +37,8 @@ Foam::ode<ODEChemistryType>::ode
|
||||
)
|
||||
:
|
||||
chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType),
|
||||
coeffsDict_(this->subDict(ODEModelName + "Coeffs")),
|
||||
solverName_(coeffsDict_.lookup("ODESolver")),
|
||||
coeffsDict_(this->subDict("odeCoeffs")),
|
||||
solverName_(coeffsDict_.lookup("solver")),
|
||||
odeSolver_(ODESolver::New(solverName_, *this)),
|
||||
eps_(readScalar(coeffsDict_.lookup("eps")))
|
||||
{}
|
||||
|
||||
@ -37,7 +37,7 @@ Foam::sequential<ODEChemistryType>::sequential
|
||||
)
|
||||
:
|
||||
chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType),
|
||||
coeffsDict_(this->subDict(ODEModelName + "Coeffs")),
|
||||
coeffsDict_(this->subDict("sequentialCoeffs")),
|
||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||
eqRateLimiter_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
{}
|
||||
|
||||
Reference in New Issue
Block a user