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,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
@ -47,7 +47,7 @@ Description
#include "incompressible/RAS/RASModel/RASModel.H"
#include "incompressible/LES/LESModel/LESModel.H"
#include "basicPsiThermo.H"
#include "basicThermo.H"
#include "compressible/RAS/RASModel/RASModel.H"
#include "compressible/LES/LESModel/LESModel.H"
@ -265,7 +265,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
}
else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
{
autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
autoPtr<basicThermo> thermo(basicThermo::New(mesh));
volScalarField rho
(

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
@ -33,9 +33,10 @@ Description
\*---------------------------------------------------------------------------*/
#include "calc.H"
#include "basicPsiThermo.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{
bool writeResults = !args.optionFound("noWrite");
@ -74,9 +75,9 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
)
{
// thermophysical Mach
autoPtr<basicPsiThermo> thermo
autoPtr<basicThermo> thermo
(
basicPsiThermo::New(mesh)
basicThermo::New(mesh)
);
volScalarField Cp(thermo->Cp());

View File

@ -18,9 +18,9 @@
{
volVectorField U(Uheader, mesh);
autoPtr<basicPsiThermo> thermo
autoPtr<basicThermo> thermo
(
basicPsiThermo::New(mesh)
basicThermo::New(mesh)
);
volScalarField Cp = thermo->Cp();

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,7 +39,7 @@ Description
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RAS/RASModel/RASModel.H"
#include "incompressible/LES/LESModel/LESModel.H"
#include "basicPsiThermo.H"
#include "basicThermo.H"
#include "compressible/RAS/RASModel/RASModel.H"
#include "compressible/LES/LESModel/LESModel.H"
@ -204,7 +204,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{
IOdictionary RASProperties(RASPropertiesHeader);
autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
autoPtr<basicThermo> thermo(basicThermo::New(mesh));
volScalarField rho
(
@ -252,7 +252,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{
IOdictionary LESProperties(LESPropertiesHeader);
autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
autoPtr<basicThermo> thermo(basicThermo::New(mesh));
volScalarField rho
(

View File

@ -1,6 +1,6 @@
autoPtr<basicPsiThermo> thermo
autoPtr<basicThermo> thermo
(
basicPsiThermo::New(mesh)
basicThermo::New(mesh)
);
const volScalarField& h = thermo->h();

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
@ -41,10 +41,11 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
#include "createMesh.H"
#include "createNamedMesh.H"
forAll(timeDirs, timeI)
{
@ -69,7 +70,7 @@ int main(int argc, char *argv[])
{
Info<< mesh.boundary()[patchi].name()
<< " "
<< sum
<< gSum
(
mesh.magSf().boundaryField()[patchi]
*patchHeatFlux[patchi]

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
@ -38,7 +38,7 @@ Description
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RAS/RASModel/RASModel.H"
#include "basicPsiThermo.H"
#include "basicThermo.H"
#include "compressible/RAS/RASModel/RASModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -101,11 +101,8 @@ void calcCompressible
#include "compressibleCreatePhi.H"
autoPtr<basicPsiThermo> pThermo
(
basicPsiThermo::New(mesh)
);
basicPsiThermo& thermo = pThermo();
autoPtr<basicThermo> pThermo(basicThermo::New(mesh));
basicThermo& thermo = pThermo();
autoPtr<compressible::RASModel> model
(

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,7 +39,7 @@ Description
#include "incompressible/RAS/RASModel/RASModel.H"
#include "nutkWallFunction/nutkWallFunctionFvPatchScalarField.H"
#include "basicPsiThermo.H"
#include "basicThermo.H"
#include "compressible/RAS/RASModel/RASModel.H"
#include "mutkWallFunction/mutkWallFunctionFvPatchScalarField.H"
@ -130,11 +130,11 @@ void calcCompressibleYPlus
#include "compressibleCreatePhi.H"
autoPtr<basicPsiThermo> pThermo
autoPtr<basicThermo> pThermo
(
basicPsiThermo::New(mesh)
basicThermo::New(mesh)
);
basicPsiThermo& thermo = pThermo();
basicThermo& thermo = pThermo();
autoPtr<compressible::RASModel> RASModel
(

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 \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //