Skip to content

Commit

Permalink
Thermodynamics: Added support for thermodynamics packages based on se…
Browse files Browse the repository at this point in the history
…nsible enthalpy.
  • Loading branch information
henry authored and henry committed Feb 10, 2010
1 parent bcdad2b commit 91f67a1
Show file tree
Hide file tree
Showing 18 changed files with 186 additions and 217 deletions.
45 changes: 44 additions & 1 deletion src/thermophysicalModels/basic/basicThermo/basicThermo.C
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ void Foam::basicThermo::eBoundaryCorrection(volScalarField& e)
}
}


// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::basicThermo::basicThermo(const fvMesh& mesh)
Expand Down Expand Up @@ -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()");
Expand Down
23 changes: 22 additions & 1 deletion src/thermophysicalModels/basic/basicThermo/basicThermo.H
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -47,7 +42,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
{}


fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField& ptf,
const fvPatch& p,
Expand All @@ -59,7 +54,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
{}


fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
Expand All @@ -70,7 +65,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
{}


fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField& tppsf
)
Expand All @@ -79,7 +74,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
{}


fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
Expand All @@ -91,7 +86,7 @@ fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField

// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

void fixedEnthalpyFvPatchScalarField::updateCoeffs()
void Foam::fixedEnthalpyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
Expand All @@ -109,18 +104,29 @@ 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();
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

makePatchTypeField(fvPatchScalarField, fixedEnthalpyFvPatchScalarField);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
fixedEnthalpyFvPatchScalarField
);
}

} // End namespace Foam

// ************************************************************************* //
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace Foam
{

/*---------------------------------------------------------------------------*\
Class fixedEnthalpyFvPatchScalarField Declaration
Class fixedEnthalpyFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/

class fixedEnthalpyFvPatchScalarField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -47,7 +42,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
{}


gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField& ptf,
const fvPatch& p,
Expand All @@ -59,7 +54,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
{}


gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
Expand All @@ -70,7 +65,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
{}


gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField& tppsf
)
Expand All @@ -79,7 +74,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
{}


gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
Expand All @@ -91,7 +86,7 @@ gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField

// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

void gradientEnthalpyFvPatchScalarField::updateCoeffs()
void Foam::gradientEnthalpyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
Expand All @@ -110,23 +105,39 @@ 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();
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

makePatchTypeField(fvPatchScalarField, gradientEnthalpyFvPatchScalarField);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
gradientEnthalpyFvPatchScalarField
);
}

} // End namespace Foam

// ************************************************************************* //

0 comments on commit 91f67a1

Please sign in to comment.