ENH: basicThermo: have runtime selection table

This commit is contained in:
mattijs
2012-01-25 17:45:18 +00:00
parent 26f463487f
commit 1c3ce0518d
14 changed files with 144 additions and 38 deletions

View File

@ -2,6 +2,7 @@ mixtures/basicMixture/basicMixture.C
mixtures/basicMixture/basicMixtures.C
basicThermo/basicThermo.C
basicThermo/basicThermoNew.C
psiThermo/basicPsiThermo/basicPsiThermo.C
psiThermo/basicPsiThermo/basicPsiThermoNew.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,6 +39,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(basicThermo, 0);
defineRunTimeSelectionTable(basicThermo, fvMesh);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,7 +29,7 @@ Description
SourceFiles
basicThermo.C
newBasicThermo.C
basicThermoNew.C
\*---------------------------------------------------------------------------*/
@ -109,12 +109,25 @@ public:
TypeName("basicThermo");
//- Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
basicThermo,
fvMesh,
(const fvMesh& mesh),
(mesh)
);
// Constructors
//- Construct from mesh
basicThermo(const fvMesh&);
//- Selector
static autoPtr<basicThermo> New(const fvMesh&);
//- Destructor
virtual ~basicThermo();

View File

@ -0,0 +1,71 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,7 +55,14 @@ addToRunTimeSelectionTable \
basicPsiThermo, \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
)
); \
\
addToRunTimeSelectionTable \
( \
basicThermo, \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,7 +55,14 @@ addToRunTimeSelectionTable \
basicRhoThermo, \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
)
); \
\
addToRunTimeSelectionTable \
( \
basicThermo, \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
);
#define makeBasicRhoPolyThermo(Cthermo,Mixture,Order) \
@ -88,7 +95,14 @@ addToRunTimeSelectionTable \
basicRhoThermo, \
Cthermo##Mixture##icoPoly##Order##ThermoPhysics, \
fvMesh \
)
); \
\
addToRunTimeSelectionTable \
( \
basicThermo, \
Cthermo##Mixture##icoPoly##Order##ThermoPhysics, \
fvMesh \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //