Thermo: Add support for instantiating more than one thermo package in an application

This commit is contained in:
Henry 2012-12-04 15:03:45 +00:00
parent fe3feaf9e5
commit e3e62b9ef8
8 changed files with 123 additions and 22 deletions

View File

@ -112,7 +112,7 @@ Foam::basicThermo::basicThermo
(
IOobject
(
phasePropertyName("alpha"),
phasePropertyName("thermo:alpha"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -167,7 +167,7 @@ Foam::basicThermo::basicThermo
(
IOobject
(
phasePropertyName("alpha"),
phasePropertyName("thermo:alpha"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -237,7 +237,7 @@ const Foam::basicThermo& Foam::basicThermo::lookupThermo
void Foam::basicThermo::validate
(
const word& app,
const string& app,
const word& a
) const
{
@ -252,7 +252,7 @@ void Foam::basicThermo::validate
void Foam::basicThermo::validate
(
const word& app,
const string& app,
const word& a,
const word& b
) const
@ -275,7 +275,7 @@ void Foam::basicThermo::validate
void Foam::basicThermo::validate
(
const word& app,
const string& app,
const word& a,
const word& b,
const word& c
@ -301,7 +301,7 @@ void Foam::basicThermo::validate
void Foam::basicThermo::validate
(
const word& app,
const string& app,
const word& a,
const word& b,
const word& c,

View File

@ -185,7 +185,7 @@ public:
// with energy forms supported by the application
void validate
(
const word& app,
const string& app,
const word&
) const;
@ -193,7 +193,7 @@ public:
// with energy forms supported by the application
void validate
(
const word& app,
const string& app,
const word&,
const word&
) const;
@ -202,7 +202,7 @@ public:
// with energy forms supported by the application
void validate
(
const word& app,
const string& app,
const word&,
const word&,
const word&
@ -212,7 +212,7 @@ public:
// with energy forms supported by the application
void validate
(
const word& app,
const string& app,
const word&,
const word&,
const word&,
@ -263,6 +263,14 @@ public:
//- Enthalpy/Internal energy [J/kg]
virtual const volScalarField& he() const = 0;
//- Enthalpy/Internal energy
// for given pressure and temperature [J/kg]
virtual tmp<volScalarField> he
(
const volScalarField& p,
const volScalarField& T
) const = 0;
//- Enthalpy/Internal energy for cell-set [J/kg]
virtual tmp<scalarField> he
(

View File

@ -174,7 +174,10 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo
(
IOobject
(
BasicThermo::phasePropertyName(MixtureType::thermoType::heName()),
BasicThermo::phasePropertyName
(
MixtureType::thermoType::heName()
),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -205,7 +208,10 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo
(
IOobject
(
BasicThermo::phasePropertyName(MixtureType::thermoType::heName()),
BasicThermo::phasePropertyName
(
MixtureType::thermoType::heName()
),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -230,6 +236,60 @@ Foam::heThermo<BasicThermo, MixtureType>::~heThermo()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::he
(
const volScalarField& p,
const volScalarField& T
) const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> the
(
new volScalarField
(
IOobject
(
"he",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
he_.dimensions()
)
);
volScalarField& he = the();
scalarField& heCells = he.internalField();
const scalarField& pCells = p.internalField();
const scalarField& TCells = T.internalField();
forAll(heCells, celli)
{
heCells[celli] =
this->cellMixture(celli).HE(pCells[celli], TCells[celli]);
}
forAll(he.boundaryField(), patchi)
{
scalarField& hep = he.boundaryField()[patchi];
const scalarField& pp = p.boundaryField()[patchi];
const scalarField& Tp = T.boundaryField()[patchi];
forAll(hep, facei)
{
hep[facei] =
this->patchFaceMixture(patchi, facei).HE(pp[facei], Tp[facei]);
}
}
return the;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::he
(

View File

@ -161,6 +161,14 @@ public:
// Fields derived from thermodynamic state variables
//- Enthalpy/Internal energy
// for given pressure and temperature [J/kg]
virtual tmp<volScalarField> he
(
const volScalarField& p,
const volScalarField& T
) const;
//- Enthalpy/Internal energy for cell-set [J/kg]
virtual tmp<scalarField> he
(

View File

@ -44,7 +44,7 @@ Foam::psiThermo::psiThermo(const fvMesh& mesh, const word& phaseName)
(
IOobject
(
phasePropertyName("psi"),
phasePropertyName("thermo:psi"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -58,7 +58,7 @@ Foam::psiThermo::psiThermo(const fvMesh& mesh, const word& phaseName)
(
IOobject
(
phasePropertyName("mu"),
phasePropertyName("thermo:mu"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,

View File

@ -43,7 +43,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName)
(
IOobject
(
phasePropertyName("rhoThermo"),
phasePropertyName("thermo:rho"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -57,7 +57,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName)
(
IOobject
(
phasePropertyName("psi"),
phasePropertyName("thermo:psi"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -71,7 +71,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName)
(
IOobject
(
phasePropertyName("mu"),
phasePropertyName("thermo:mu"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -95,7 +95,7 @@ Foam::rhoThermo::rhoThermo
(
IOobject
(
phasePropertyName("rhoThermo"),
phasePropertyName("thermo:rho"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -109,7 +109,7 @@ Foam::rhoThermo::rhoThermo
(
IOobject
(
phasePropertyName("psi"),
phasePropertyName("thermo:psi"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -123,7 +123,7 @@ Foam::rhoThermo::rhoThermo
(
IOobject
(
phasePropertyName("mu"),
phasePropertyName("thermo:mu"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,

View File

@ -30,6 +30,7 @@ License
#include "perfectGas.H"
#include "incompressiblePerfectGas.H"
#include "rhoConst.H"
#include "perfectFluid.H"
#include "hConstThermo.H"
#include "janafThermo.H"
#include "sensibleEnthalpy.H"
@ -101,6 +102,18 @@ makeThermo
specie
);
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
constTransport,
sensibleEnthalpy,
hConstThermo,
perfectFluid,
specie
);
makeThermo
(
rhoThermo,
@ -200,6 +213,18 @@ makeThermo
specie
);
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
perfectFluid,
specie
);
makeThermo
(
rhoThermo,

View File

@ -50,7 +50,7 @@ Foam::solidThermo::solidThermo
(
IOobject
(
"rhoThermo",
phasePropertyName("thermo:rho"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -74,7 +74,7 @@ Foam::solidThermo::solidThermo
(
IOobject
(
"rhoThermo",
phasePropertyName("thermo:rho"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,