Thermodynamics: Added initial dictionary selection mechanism

This commit is contained in:
Henry 2012-09-24 13:40:26 +01:00
parent 966dd4192b
commit ba77277255
6 changed files with 38 additions and 170 deletions

View File

@ -2,10 +2,7 @@ mixtures/basicMixture/basicMixture.C
mixtures/basicMixture/basicMixtures.C
basicThermo/basicThermo.C
basicThermo/basicThermoNew.C
fluidThermo/fluidThermo.C
fluidThermo/fluidThermoNew.C
psiThermo/psiThermo/psiThermo.C
psiThermo/psiThermo/psiThermoNew.C

View File

@ -29,7 +29,6 @@ Description
SourceFiles
basicThermo.C
basicThermoNew.C
\*---------------------------------------------------------------------------*/
@ -102,9 +101,6 @@ public:
basicThermo(const fvMesh&, const dictionary&);
//- Selector
static autoPtr<basicThermo> New(const fvMesh&);
//- Destructor
virtual ~basicThermo();

View File

@ -1,71 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::basicThermo> Foam::basicThermo::New
(
const fvMesh& mesh
)
{
// get model name, but do not register the dictionary
// otherwise it is registered in the database twice
const word modelType
(
IOdictionary
(
IOobject
(
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).lookup("thermoType")
);
Info<< "Selecting thermodynamics package " << modelType << endl;
fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(modelType);
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn("basicThermo::New(const fvMesh&)")
<< "Unknown basicThermo type " << modelType << nl << nl
<< "Valid basicThermo types are:" << nl
<< fvMeshConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
return autoPtr<basicThermo>(cstrIter()(mesh));
}
// ************************************************************************* //

View File

@ -29,7 +29,6 @@ Description
SourceFiles
fluidThermo.C
fluidThermoNew.C
\*---------------------------------------------------------------------------*/
@ -77,9 +76,6 @@ public:
fluidThermo(const fvMesh&, const dictionary&);
//- Selector
static autoPtr<fluidThermo> New(const fvMesh&);
//- Destructor
virtual ~fluidThermo();

View File

@ -1,71 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fluidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::fluidThermo> Foam::fluidThermo::New
(
const fvMesh& mesh
)
{
// get model name, but do not register the dictionary
// otherwise it is registered in the database twice
const word modelType
(
IOdictionary
(
IOobject
(
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).lookup("thermoType")
);
Info<< "Selecting thermodynamics package " << modelType << endl;
fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(modelType);
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn("fluidThermo::New(const fvMesh&)")
<< "Unknown fluidThermo type " << modelType << nl << nl
<< "Valid fluidThermo types are:" << nl
<< fvMeshConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
return autoPtr<fluidThermo>(cstrIter()(mesh));
}
// ************************************************************************* //

View File

@ -32,33 +32,54 @@ Foam::autoPtr<Foam::psiThermo> Foam::psiThermo::New
const fvMesh& mesh
)
{
// get model name, but do not register the dictionary
// otherwise it is registered in the database twice
const word modelType
IOdictionary thermoDict
(
IOdictionary
IOobject
(
IOobject
(
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).lookup("thermoType")
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
Info<< "Selecting thermodynamics package " << modelType << endl;
word thermoTypeName;
if (thermoDict.isDict("thermoType"))
{
const dictionary& thermoTypeDict(thermoDict.subDict("thermoType"));
word type(thermoTypeDict.lookup("type"));
word mixture(thermoTypeDict.lookup("mixture"));
word transport(thermoTypeDict.lookup("transport"));
word thermo(thermoTypeDict.lookup("thermo"));
word equationOfState(thermoTypeDict.lookup("equationOfState"));
word energy(thermoTypeDict.lookup("energy"));
thermoTypeName =
type + '<'
+ mixture + '<'
+ transport + "<specieThermo<"
+ thermo + '<'
+ equationOfState + ">,"
+ energy + ">>>>";
}
else
{
thermoTypeName = word(thermoDict.lookup("thermoType"));
}
Info<< "Selecting thermodynamics package " << thermoTypeName << endl;
fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(modelType);
fvMeshConstructorTablePtr_->find(thermoTypeName);
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn("psiThermo::New(const fvMesh&)")
<< "Unknown psiThermo type " << modelType << nl << nl
<< "Unknown psiThermo type " << thermoTypeName << nl << nl
<< "Valid psiThermo types are:" << nl
<< fvMeshConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);