mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
solidChemistryModel: Updated runtime selection mechanism
This commit is contained in:
@ -45,7 +45,8 @@ namespace Foam
|
|||||||
defineTemplateTypeNameAndDebugWithName \
|
defineTemplateTypeNameAndDebugWithName \
|
||||||
( \
|
( \
|
||||||
SS##Comp##SThermo##GThermo, \
|
SS##Comp##SThermo##GThermo, \
|
||||||
#SS"<"#Comp","#SThermo","#GThermo">", \
|
(#SS"<"#Comp"," + SThermo::typeName() + "," + GThermo::typeName() + \
|
||||||
|
">").c_str(), \
|
||||||
0 \
|
0 \
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("solidChemistryModel");
|
TypeName("solid");
|
||||||
|
|
||||||
|
|
||||||
//- Declare run-time constructor selection tables
|
//- Declare run-time constructor selection tables
|
||||||
|
|||||||
@ -32,7 +32,7 @@ Foam::autoPtr<Foam::solidChemistryModel> Foam::solidChemistryModel::New
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOdictionary chemistryPropertiesDict
|
IOdictionary chemistryDict
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
@ -45,63 +45,119 @@ Foam::autoPtr<Foam::solidChemistryModel> Foam::solidChemistryModel::New
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const word userModel(chemistryPropertiesDict.lookup("solidChemistryModel"));
|
const dictionary& chemistryTypeDict
|
||||||
|
(
|
||||||
|
chemistryDict.subDict("chemistryType")
|
||||||
|
);
|
||||||
|
|
||||||
const word ODEModelName(chemistryPropertiesDict.lookup("chemistrySolver"));
|
Info<< "Selecting chemistry type " << chemistryTypeDict << endl;
|
||||||
const word gasThermoName(chemistryPropertiesDict.lookup("gasThermoModel"));
|
|
||||||
|
|
||||||
// construct chemistry model type name by inserting first template argument
|
const int nCmpt = 12;
|
||||||
const label tempOpen = userModel.find('<');
|
const char* cmptNames[nCmpt] =
|
||||||
const label tempClose = userModel.find('>');
|
|
||||||
|
|
||||||
const word className = userModel(0, tempOpen);
|
|
||||||
const word thermoTypeName =
|
|
||||||
userModel(tempOpen + 1, tempClose - tempOpen - 1);
|
|
||||||
|
|
||||||
const word modelType =
|
|
||||||
ODEModelName + '<' + className
|
|
||||||
+ '<' + typeName + ',' + thermoTypeName + ',' + gasThermoName + ">>";
|
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
{
|
||||||
Info<< "Selecting solidChemistryModel " << modelType << endl;
|
"chemistrySolver",
|
||||||
}
|
"chemistryThermo",
|
||||||
else
|
"transport",
|
||||||
{
|
"thermo",
|
||||||
Info<< "Selecting solidChemistryModel " << userModel + gasThermoName
|
"equationOfState",
|
||||||
<< endl;
|
"specie",
|
||||||
}
|
"energy",
|
||||||
|
"transport",
|
||||||
|
"thermo",
|
||||||
|
"equationOfState",
|
||||||
|
"specie",
|
||||||
|
"energy"
|
||||||
|
};
|
||||||
|
|
||||||
|
IOdictionary thermoDict
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"thermophysicalProperties",
|
||||||
|
mesh.time().constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const dictionary& solidThermoTypeDict(thermoDict.subDict("thermoType"));
|
||||||
|
word solidThermoTypeName
|
||||||
|
(
|
||||||
|
word(solidThermoTypeDict.lookup("transport")) + '<'
|
||||||
|
+ word(solidThermoTypeDict.lookup("thermo")) + '<'
|
||||||
|
+ word(solidThermoTypeDict.lookup("equationOfState")) + '<'
|
||||||
|
+ word(solidThermoTypeDict.lookup("specie")) + ">>,"
|
||||||
|
+ word(solidThermoTypeDict.lookup("energy")) + ">"
|
||||||
|
);
|
||||||
|
|
||||||
|
const dictionary& gasThermoTypeDict(chemistryDict.subDict("gasThermoType"));
|
||||||
|
word gasThermoTypeName
|
||||||
|
(
|
||||||
|
word(gasThermoTypeDict.lookup("transport")) + '<'
|
||||||
|
+ word(gasThermoTypeDict.lookup("thermo")) + '<'
|
||||||
|
+ word(gasThermoTypeDict.lookup("equationOfState")) + '<'
|
||||||
|
+ word(gasThermoTypeDict.lookup("specie")) + ">>,"
|
||||||
|
+ word(gasThermoTypeDict.lookup("energy")) + ">"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Construct the name of the chemistry type from the components
|
||||||
|
word chemistryTypeName
|
||||||
|
(
|
||||||
|
word(chemistryTypeDict.lookup("chemistrySolver")) + '<'
|
||||||
|
+ word(chemistryTypeDict.lookup("chemistryThermo")) + ','
|
||||||
|
+ solidThermoTypeName + ',' + gasThermoTypeName + ">"
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "chemistryTypeName " << chemistryTypeName << endl;
|
||||||
|
|
||||||
fvMeshConstructorTable::iterator cstrIter =
|
fvMeshConstructorTable::iterator cstrIter =
|
||||||
fvMeshConstructorTablePtr_->find(modelType);
|
fvMeshConstructorTablePtr_->find(chemistryTypeName);
|
||||||
|
|
||||||
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
||||||
{
|
{
|
||||||
if (debug)
|
FatalErrorIn(typeName + "::New(const mesh&)")
|
||||||
{
|
<< "Unknown " << typeName << " type " << nl
|
||||||
FatalErrorIn("solidChemistryModel::New(const mesh&)")
|
<< "chemistryType" << chemistryTypeDict << nl << nl
|
||||||
<< "Unknown solidChemistryModel type "
|
<< "Valid " << typeName << " types are:"
|
||||||
<< modelType << nl << nl
|
<< nl << nl;
|
||||||
<< "Valid solidChemistryModel types are:" << nl
|
|
||||||
<< fvMeshConstructorTablePtr_->sortedToc() << nl
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
|
||||||
forAll(models, i)
|
|
||||||
{
|
|
||||||
models[i] = models[i].replace(typeName + ',', "");
|
|
||||||
}
|
|
||||||
|
|
||||||
FatalErrorIn("solidChemistryModel::New(const mesh&)")
|
// Get the list of all the suitable chemistry packages available
|
||||||
<< "Unknown solidChemistryModel type "
|
wordList validChemistryTypeNames
|
||||||
<< userModel << nl << nl
|
(
|
||||||
<< "Valid solidChemistryModel types are:" << nl
|
fvMeshConstructorTablePtr_->sortedToc()
|
||||||
<< models << nl
|
);
|
||||||
<< exit(FatalError);
|
Info<< validChemistryTypeNames << endl;
|
||||||
|
|
||||||
|
// Build a table of the thermo packages constituent parts
|
||||||
|
// Note: row-0 contains the names of constituent parts
|
||||||
|
List<wordList> validChemistryTypeNameCmpts
|
||||||
|
(
|
||||||
|
validChemistryTypeNames.size() + 1
|
||||||
|
);
|
||||||
|
|
||||||
|
validChemistryTypeNameCmpts[0].setSize(nCmpt);
|
||||||
|
forAll(validChemistryTypeNameCmpts[0], j)
|
||||||
|
{
|
||||||
|
validChemistryTypeNameCmpts[0][j] = cmptNames[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Split the thermo package names into their constituent parts
|
||||||
|
forAll(validChemistryTypeNames, i)
|
||||||
|
{
|
||||||
|
validChemistryTypeNameCmpts[i+1] = basicThermo::splitThermoName
|
||||||
|
(
|
||||||
|
validChemistryTypeNames[i],
|
||||||
|
nCmpt
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print the table of available packages
|
||||||
|
// in terms of their constituent parts
|
||||||
|
printTable(validChemistryTypeNameCmpts, FatalError);
|
||||||
|
|
||||||
|
FatalError<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<solidChemistryModel>(cstrIter()(mesh));
|
return autoPtr<solidChemistryModel>(cstrIter()(mesh));
|
||||||
|
|||||||
@ -39,22 +39,23 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#define makeSolidChemistrySolverType(SS, ODEChem, Comp, SThermo, GThermo) \
|
#define makeSolidChemistrySolverType(SS, Comp, SThermo, GThermo) \
|
||||||
\
|
\
|
||||||
typedef SS<ODEChem<Comp, SThermo, GThermo> > \
|
typedef SS<ODESolidChemistryModel<Comp, SThermo, GThermo> > \
|
||||||
SS##ODEChem##Comp##SThermo##GThermo; \
|
SS##Comp##SThermo##GThermo; \
|
||||||
\
|
\
|
||||||
defineTemplateTypeNameAndDebugWithName \
|
defineTemplateTypeNameAndDebugWithName \
|
||||||
( \
|
( \
|
||||||
SS##ODEChem##Comp##SThermo##GThermo, \
|
SS##Comp##SThermo##GThermo, \
|
||||||
#SS"<"#ODEChem"<"#Comp","#SThermo","#GThermo">>", \
|
(#SS"<" + word(Comp::typeName_()) \
|
||||||
|
+ "," + SThermo::typeName() + "," + GThermo::typeName() + ">").c_str(), \
|
||||||
0 \
|
0 \
|
||||||
); \
|
); \
|
||||||
\
|
\
|
||||||
addToRunTimeSelectionTable \
|
addToRunTimeSelectionTable \
|
||||||
( \
|
( \
|
||||||
Comp, \
|
Comp, \
|
||||||
SS##ODEChem##Comp##SThermo##GThermo, \
|
SS##Comp##SThermo##GThermo, \
|
||||||
fvMesh \
|
fvMesh \
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,6 @@ namespace Foam
|
|||||||
makeSolidChemistrySolverType
|
makeSolidChemistrySolverType
|
||||||
(
|
(
|
||||||
ode,
|
ode,
|
||||||
ODESolidChemistryModel,
|
|
||||||
solidChemistryModel,
|
solidChemistryModel,
|
||||||
hConstSolidThermoPhysics,
|
hConstSolidThermoPhysics,
|
||||||
gasThermoPhysics
|
gasThermoPhysics
|
||||||
@ -48,7 +47,6 @@ namespace Foam
|
|||||||
makeSolidChemistrySolverType
|
makeSolidChemistrySolverType
|
||||||
(
|
(
|
||||||
ode,
|
ode,
|
||||||
ODESolidChemistryModel,
|
|
||||||
solidChemistryModel,
|
solidChemistryModel,
|
||||||
hExponentialSolidThermoPhysics,
|
hExponentialSolidThermoPhysics,
|
||||||
gasThermoPhysics
|
gasThermoPhysics
|
||||||
|
|||||||
@ -15,13 +15,22 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
solidChemistryModel ODESolidChemistryModel<hConstSolidThermoPhysics>;
|
chemistryType
|
||||||
|
{
|
||||||
gasThermoModel gasThermoPhysics;
|
chemistrySolver ode;
|
||||||
|
chemistryThermo solid;
|
||||||
|
}
|
||||||
|
|
||||||
chemistry on;
|
chemistry on;
|
||||||
|
|
||||||
chemistrySolver ode;
|
gasThermoType
|
||||||
|
{
|
||||||
|
transport sutherland;
|
||||||
|
thermo janaf;
|
||||||
|
equationOfState perfectGas;
|
||||||
|
specie specie;
|
||||||
|
energy sensibleEnthalpy;
|
||||||
|
}
|
||||||
|
|
||||||
initialChemicalTimeStep 1e-07;
|
initialChemicalTimeStep 1e-07;
|
||||||
|
|
||||||
@ -36,14 +45,6 @@ species
|
|||||||
gas
|
gas
|
||||||
);
|
);
|
||||||
|
|
||||||
reactions
|
|
||||||
(
|
|
||||||
irreversibleSolidArrheniusReaction
|
|
||||||
v = gas + char
|
|
||||||
(7.83e10 15274.57 400 4.86)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
gas
|
gas
|
||||||
{
|
{
|
||||||
specie
|
specie
|
||||||
@ -66,4 +67,13 @@ gas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
reactions
|
||||||
|
(
|
||||||
|
irreversibleSolidArrheniusReaction
|
||||||
|
v = gas + char
|
||||||
|
(7.83e10 15274.57 400 4.86)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
|
||||||
| ========= | |
|
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
|
||||||
| \\ / O peration | Version: dev |
|
|
||||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
|
||||||
| \\/ M anipulation | |
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
FoamFile
|
|
||||||
{
|
|
||||||
version 2.0;
|
|
||||||
format ascii;
|
|
||||||
class regIOobject;
|
|
||||||
location "constant/polyMesh";
|
|
||||||
object cellZones;
|
|
||||||
}
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
0
|
|
||||||
()
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
|
||||||
| ========= | |
|
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
|
||||||
| \\ / O peration | Version: dev |
|
|
||||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
|
||||||
| \\/ M anipulation | |
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
FoamFile
|
|
||||||
{
|
|
||||||
version 2.0;
|
|
||||||
format ascii;
|
|
||||||
class regIOobject;
|
|
||||||
location "constant/polyMesh";
|
|
||||||
object faceZones;
|
|
||||||
}
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
0
|
|
||||||
()
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
|
||||||
| ========= | |
|
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
|
||||||
| \\ / O peration | Version: dev |
|
|
||||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
|
||||||
| \\/ M anipulation | |
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
FoamFile
|
|
||||||
{
|
|
||||||
version 2.0;
|
|
||||||
format ascii;
|
|
||||||
class regIOobject;
|
|
||||||
location "constant/polyMesh";
|
|
||||||
object pointZones;
|
|
||||||
}
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
0
|
|
||||||
()
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -74,4 +74,5 @@ charCoeffs
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user