mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Thermo: Add support for instantiating more than one thermo package in an application
This commit is contained in:
@ -112,7 +112,7 @@ Foam::basicThermo::basicThermo
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
phasePropertyName("alpha"),
|
phasePropertyName("thermo:alpha"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -167,7 +167,7 @@ Foam::basicThermo::basicThermo
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
phasePropertyName("alpha"),
|
phasePropertyName("thermo:alpha"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -237,7 +237,7 @@ const Foam::basicThermo& Foam::basicThermo::lookupThermo
|
|||||||
|
|
||||||
void Foam::basicThermo::validate
|
void Foam::basicThermo::validate
|
||||||
(
|
(
|
||||||
const word& app,
|
const string& app,
|
||||||
const word& a
|
const word& a
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
@ -252,7 +252,7 @@ void Foam::basicThermo::validate
|
|||||||
|
|
||||||
void Foam::basicThermo::validate
|
void Foam::basicThermo::validate
|
||||||
(
|
(
|
||||||
const word& app,
|
const string& app,
|
||||||
const word& a,
|
const word& a,
|
||||||
const word& b
|
const word& b
|
||||||
) const
|
) const
|
||||||
@ -275,7 +275,7 @@ void Foam::basicThermo::validate
|
|||||||
|
|
||||||
void Foam::basicThermo::validate
|
void Foam::basicThermo::validate
|
||||||
(
|
(
|
||||||
const word& app,
|
const string& app,
|
||||||
const word& a,
|
const word& a,
|
||||||
const word& b,
|
const word& b,
|
||||||
const word& c
|
const word& c
|
||||||
@ -301,7 +301,7 @@ void Foam::basicThermo::validate
|
|||||||
|
|
||||||
void Foam::basicThermo::validate
|
void Foam::basicThermo::validate
|
||||||
(
|
(
|
||||||
const word& app,
|
const string& app,
|
||||||
const word& a,
|
const word& a,
|
||||||
const word& b,
|
const word& b,
|
||||||
const word& c,
|
const word& c,
|
||||||
|
|||||||
@ -185,7 +185,7 @@ public:
|
|||||||
// with energy forms supported by the application
|
// with energy forms supported by the application
|
||||||
void validate
|
void validate
|
||||||
(
|
(
|
||||||
const word& app,
|
const string& app,
|
||||||
const word&
|
const word&
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ public:
|
|||||||
// with energy forms supported by the application
|
// with energy forms supported by the application
|
||||||
void validate
|
void validate
|
||||||
(
|
(
|
||||||
const word& app,
|
const string& app,
|
||||||
const word&,
|
const word&,
|
||||||
const word&
|
const word&
|
||||||
) const;
|
) const;
|
||||||
@ -202,7 +202,7 @@ public:
|
|||||||
// with energy forms supported by the application
|
// with energy forms supported by the application
|
||||||
void validate
|
void validate
|
||||||
(
|
(
|
||||||
const word& app,
|
const string& app,
|
||||||
const word&,
|
const word&,
|
||||||
const word&,
|
const word&,
|
||||||
const word&
|
const word&
|
||||||
@ -212,7 +212,7 @@ public:
|
|||||||
// with energy forms supported by the application
|
// with energy forms supported by the application
|
||||||
void validate
|
void validate
|
||||||
(
|
(
|
||||||
const word& app,
|
const string& app,
|
||||||
const word&,
|
const word&,
|
||||||
const word&,
|
const word&,
|
||||||
const word&,
|
const word&,
|
||||||
@ -263,6 +263,14 @@ public:
|
|||||||
//- Enthalpy/Internal energy [J/kg]
|
//- Enthalpy/Internal energy [J/kg]
|
||||||
virtual const volScalarField& he() const = 0;
|
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]
|
//- Enthalpy/Internal energy for cell-set [J/kg]
|
||||||
virtual tmp<scalarField> he
|
virtual tmp<scalarField> he
|
||||||
(
|
(
|
||||||
|
|||||||
@ -174,7 +174,10 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
BasicThermo::phasePropertyName(MixtureType::thermoType::heName()),
|
BasicThermo::phasePropertyName
|
||||||
|
(
|
||||||
|
MixtureType::thermoType::heName()
|
||||||
|
),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -205,7 +208,10 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
BasicThermo::phasePropertyName(MixtureType::thermoType::heName()),
|
BasicThermo::phasePropertyName
|
||||||
|
(
|
||||||
|
MixtureType::thermoType::heName()
|
||||||
|
),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -230,6 +236,60 @@ Foam::heThermo<BasicThermo, MixtureType>::~heThermo()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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>
|
template<class BasicThermo, class MixtureType>
|
||||||
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::he
|
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::he
|
||||||
(
|
(
|
||||||
|
|||||||
@ -161,6 +161,14 @@ public:
|
|||||||
|
|
||||||
// Fields derived from thermodynamic state variables
|
// 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]
|
//- Enthalpy/Internal energy for cell-set [J/kg]
|
||||||
virtual tmp<scalarField> he
|
virtual tmp<scalarField> he
|
||||||
(
|
(
|
||||||
|
|||||||
@ -44,7 +44,7 @@ Foam::psiThermo::psiThermo(const fvMesh& mesh, const word& phaseName)
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
phasePropertyName("psi"),
|
phasePropertyName("thermo:psi"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -58,7 +58,7 @@ Foam::psiThermo::psiThermo(const fvMesh& mesh, const word& phaseName)
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
phasePropertyName("mu"),
|
phasePropertyName("thermo:mu"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
|
|||||||
@ -43,7 +43,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName)
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
phasePropertyName("rhoThermo"),
|
phasePropertyName("thermo:rho"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -57,7 +57,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName)
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
phasePropertyName("psi"),
|
phasePropertyName("thermo:psi"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -71,7 +71,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName)
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
phasePropertyName("mu"),
|
phasePropertyName("thermo:mu"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -95,7 +95,7 @@ Foam::rhoThermo::rhoThermo
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
phasePropertyName("rhoThermo"),
|
phasePropertyName("thermo:rho"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -109,7 +109,7 @@ Foam::rhoThermo::rhoThermo
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
phasePropertyName("psi"),
|
phasePropertyName("thermo:psi"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -123,7 +123,7 @@ Foam::rhoThermo::rhoThermo
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
phasePropertyName("mu"),
|
phasePropertyName("thermo:mu"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
|
|||||||
@ -30,6 +30,7 @@ License
|
|||||||
#include "perfectGas.H"
|
#include "perfectGas.H"
|
||||||
#include "incompressiblePerfectGas.H"
|
#include "incompressiblePerfectGas.H"
|
||||||
#include "rhoConst.H"
|
#include "rhoConst.H"
|
||||||
|
#include "perfectFluid.H"
|
||||||
#include "hConstThermo.H"
|
#include "hConstThermo.H"
|
||||||
#include "janafThermo.H"
|
#include "janafThermo.H"
|
||||||
#include "sensibleEnthalpy.H"
|
#include "sensibleEnthalpy.H"
|
||||||
@ -101,6 +102,18 @@ makeThermo
|
|||||||
specie
|
specie
|
||||||
);
|
);
|
||||||
|
|
||||||
|
makeThermo
|
||||||
|
(
|
||||||
|
rhoThermo,
|
||||||
|
heRhoThermo,
|
||||||
|
pureMixture,
|
||||||
|
constTransport,
|
||||||
|
sensibleEnthalpy,
|
||||||
|
hConstThermo,
|
||||||
|
perfectFluid,
|
||||||
|
specie
|
||||||
|
);
|
||||||
|
|
||||||
makeThermo
|
makeThermo
|
||||||
(
|
(
|
||||||
rhoThermo,
|
rhoThermo,
|
||||||
@ -200,6 +213,18 @@ makeThermo
|
|||||||
specie
|
specie
|
||||||
);
|
);
|
||||||
|
|
||||||
|
makeThermo
|
||||||
|
(
|
||||||
|
rhoThermo,
|
||||||
|
heRhoThermo,
|
||||||
|
pureMixture,
|
||||||
|
constTransport,
|
||||||
|
sensibleInternalEnergy,
|
||||||
|
hConstThermo,
|
||||||
|
perfectFluid,
|
||||||
|
specie
|
||||||
|
);
|
||||||
|
|
||||||
makeThermo
|
makeThermo
|
||||||
(
|
(
|
||||||
rhoThermo,
|
rhoThermo,
|
||||||
|
|||||||
@ -50,7 +50,7 @@ Foam::solidThermo::solidThermo
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"rhoThermo",
|
phasePropertyName("thermo:rho"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -74,7 +74,7 @@ Foam::solidThermo::solidThermo
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"rhoThermo",
|
phasePropertyName("thermo:rho"),
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
|
|||||||
Reference in New Issue
Block a user