Commit d09ddb1a authored by henry's avatar henry
Browse files

Thermodynamics: Added support for thermodynamics packages based on sensible enthalpy.

parent 0bae7feb
......@@ -143,7 +143,6 @@ void Foam::basicThermo::eBoundaryCorrection(volScalarField& e)
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicThermo::basicThermo(const fvMesh& mesh)
......@@ -300,6 +299,50 @@ Foam::tmp<Foam::scalarField> Foam::basicThermo::h
}
Foam::volScalarField& Foam::basicThermo::hs()
{
notImplemented("basicThermo::hs()");
return const_cast<volScalarField&>(volScalarField::null());
}
const Foam::volScalarField& Foam::basicThermo::hs() const
{
notImplemented("basicThermo::hs() const");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::hs
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::hs"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::hs
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::hs"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
Foam::volScalarField& Foam::basicThermo::e()
{
notImplemented("basicThermo::e()");
......
......@@ -141,7 +141,7 @@ public:
//- Compressibility [s^2/m^2]
virtual const volScalarField& psi() const;
//- Enthalpy [J/kg]
//- Total enthalpy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& h();
......@@ -162,6 +162,27 @@ public:
const label patchi
) const;
//- Sensible enthalpy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& hs();
//- Enthalpy [J/kg]
virtual const volScalarField& hs() const;
//- Enthalpy for cell-set [J/kg]
virtual tmp<scalarField> hs
(
const scalarField& T,
const labelList& cells
) const;
//- Enthalpy for patch [J/kg]
virtual tmp<scalarField> hs
(
const scalarField& T,
const label patchi
) const;
//- Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& e();
......
......@@ -30,14 +30,9 @@ License
#include "volFields.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
......@@ -47,7 +42,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
{}
fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField& ptf,
const fvPatch& p,
......@@ -59,7 +54,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
{}
fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
......@@ -70,7 +65,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
{}
fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField& tppsf
)
......@@ -79,7 +74,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
{}
fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
......@@ -91,7 +86,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void fixedEnthalpyFvPatchScalarField::updateCoeffs()
void Foam::fixedEnthalpyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
......@@ -109,7 +104,14 @@ void fixedEnthalpyFvPatchScalarField::updateCoeffs()
const_cast<fvPatchScalarField&>(thermo.T().boundaryField()[patchi]);
Tw.evaluate();
operator==(thermo.h(Tw, patchi));
if (dimensionedInternalField().name() == "h")
{
operator==(thermo.h(Tw, patchi));
}
else
{
operator==(thermo.hs(Tw, patchi));
}
fixedValueFvPatchScalarField::updateCoeffs();
}
......@@ -117,10 +119,14 @@ void fixedEnthalpyFvPatchScalarField::updateCoeffs()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, fixedEnthalpyFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
fixedEnthalpyFvPatchScalarField
);
}
} // End namespace Foam
// ************************************************************************* //
......@@ -44,7 +44,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedEnthalpyFvPatchScalarField Declaration
Class fixedEnthalpyFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class fixedEnthalpyFvPatchScalarField
......
......@@ -30,14 +30,9 @@ License
#include "volFields.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
......@@ -47,7 +42,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
{}
gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField& ptf,
const fvPatch& p,
......@@ -59,7 +54,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
{}
gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
......@@ -70,7 +65,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
{}
gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField& tppsf
)
......@@ -79,7 +74,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
{}
gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
......@@ -91,7 +86,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void gradientEnthalpyFvPatchScalarField::updateCoeffs()
void Foam::gradientEnthalpyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
......@@ -110,12 +105,24 @@ void gradientEnthalpyFvPatchScalarField::updateCoeffs()
Tw.evaluate();
gradient() = thermo.Cp(Tw, patchi)*Tw.snGrad()
+ patch().deltaCoeffs()*
if (dimensionedInternalField().name() == "h")
{
gradient() = thermo.Cp(Tw, patchi)*Tw.snGrad()
+ patch().deltaCoeffs()*
(
thermo.h(Tw, patchi)
- thermo.h(Tw, patch().faceCells())
);
}
else
{
gradient() = thermo.Cp(Tw, patchi)*Tw.snGrad()
+ patch().deltaCoeffs()*
(
thermo.hs(Tw, patchi)
- thermo.hs(Tw, patch().faceCells())
);
}
fixedGradientFvPatchScalarField::updateCoeffs();
}
......@@ -123,10 +130,14 @@ void gradientEnthalpyFvPatchScalarField::updateCoeffs()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, gradientEnthalpyFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
gradientEnthalpyFvPatchScalarField
);
}
} // End namespace Foam
// ************************************************************************* //
......@@ -30,14 +30,9 @@ License
#include "volFields.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
......@@ -51,7 +46,7 @@ mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
}
mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
(
const mixedEnthalpyFvPatchScalarField& ptf,
const fvPatch& p,
......@@ -63,7 +58,7 @@ mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
{}
mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
......@@ -74,7 +69,7 @@ mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
{}
mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
(
const mixedEnthalpyFvPatchScalarField& tppsf
)
......@@ -83,7 +78,7 @@ mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
{}
mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
(
const mixedEnthalpyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
......@@ -95,7 +90,7 @@ mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void mixedEnthalpyFvPatchScalarField::updateCoeffs()
void Foam::mixedEnthalpyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
......@@ -117,13 +112,27 @@ void mixedEnthalpyFvPatchScalarField::updateCoeffs()
Tw.evaluate();
valueFraction() = Tw.valueFraction();
refValue() = thermo.h(Tw.refValue(), patchi);
refGrad() = thermo.Cp(Tw, patchi)*Tw.refGrad()
+ patch().deltaCoeffs()*
(
if (dimensionedInternalField().name() == "h")
{
refValue() = thermo.h(Tw.refValue(), patchi);
refGrad() = thermo.Cp(Tw, patchi)*Tw.refGrad()
+ patch().deltaCoeffs()*
(
thermo.h(Tw, patchi)
- thermo.h(Tw, patch().faceCells())
);
);
}
else
{
refValue() = thermo.hs(Tw.refValue(), patchi);
refGrad() = thermo.Cp(Tw, patchi)*Tw.refGrad()
+ patch().deltaCoeffs()*
(
thermo.hs(Tw, patchi)
- thermo.hs(Tw, patch().faceCells())
);
}
mixedFvPatchScalarField::updateCoeffs();
}
......@@ -131,10 +140,14 @@ void mixedEnthalpyFvPatchScalarField::updateCoeffs()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, mixedEnthalpyFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
mixedEnthalpyFvPatchScalarField
);
}
} // End namespace Foam
// ************************************************************************* //
......@@ -156,4 +156,22 @@ Foam::tmp<Foam::fvScalarMatrix> Foam::radiation::radiationModel::Sh
}
Foam::tmp<Foam::fvScalarMatrix> Foam::radiation::radiationModel::Shs
(
basicThermo& thermo
) const
{
volScalarField& hs = thermo.hs();
const volScalarField cp = thermo.Cp();
const volScalarField T3 = pow3(T_);
return
(
Ru()
- fvm::Sp(4.0*Rp()*T3/cp, hs)
- Rp()*T3*(T_ - 4.0*hs/cp)
);
}
// ************************************************************************* //
......@@ -163,7 +163,7 @@ public:
virtual void calculate() = 0;
//- Read radiationProperties dictionary
virtual bool read();
virtual bool read() = 0;
// Access
......@@ -176,6 +176,9 @@ public:
//- Enthalpy source term
virtual tmp<fvScalarMatrix> Sh(basicThermo& thermo) const;
//- Sensible enthalpy source term
virtual tmp<fvScalarMatrix> Shs(basicThermo& thermo) const;
};
......@@ -189,4 +192,3 @@ public:
#endif
// ************************************************************************* //
......@@ -128,9 +128,6 @@ public:
}
//- Sensible enthalpy [J/kg]
virtual tmp<volScalarField> hs() const = 0;
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const = 0;
......
......@@ -155,53 +155,6 @@ void Foam::hPsiMixtureThermo<MixtureType>::correct()
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::hPsiMixtureThermo<MixtureType>::hs() const
{
const fvMesh& mesh = T_.mesh();
tmp<volScalarField> ths
(
new volScalarField
(
IOobject
(
"hs",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
h_.dimensions()
)
);
volScalarField& hsf = ths();
scalarField& hsCells = hsf.internalField();
const scalarField& TCells = T_.internalField();
forAll(TCells, celli)
{
hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]);
}
forAll(T_.boundaryField(), patchi)
{
scalarField& hsp = hsf.boundaryField()[patchi];
const scalarField& Tp = T_.boundaryField()[patchi];
forAll(Tp, facei)
{
hsp[facei] = this->patchFaceMixture(patchi, facei).Hs(Tp[facei]);
}
}
return ths;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::hPsiMixtureThermo<MixtureType>::hc() const
......
......@@ -94,9 +94,6 @@ public:
//- Update properties
virtual void correct();
//- Sensible enthalpy [J/kg]
virtual tmp<volScalarField> hs() const;
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
......
......@@ -174,54 +174,6 @@ void Foam::hhuMixtureThermo<MixtureType>::correct()
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::hhuMixtureThermo<MixtureType>::hs() const
{
const fvMesh& mesh = T_.mesh();
tmp<volScalarField> ths
(
new volScalarField
(
IOobject
(
"hs",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
h_.dimensions()
)
);
volScalarField& hsf = ths();
scalarField& hsCells = hsf.internalField();
const scalarField& TCells = T_.internalField();
forAll(TCells, celli)
{
hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]);
}
forAll(T_.boundaryField(), patchi)
{
scalarField& hsp = hsf.boundaryField()[patchi];
const scalarField& Tp = T_.boundaryField()[patchi];
forAll(Tp, facei)
{
hsp[facei] = this->patchFaceMixture(patchi, facei).Hs(Tp[facei]);
}