Thermodynamics: Rationalization

At the specie level:
    hs = sensible enthalpy
    ha = absolute (what was total) enthalpy
    es = sensibly internal energy
    ea = absolute (what was total) internal energy

At top-level
    Rename total enthalpy h -> ha
    Rename sensible enthalpy hs -> h

Combined h, hs, e and es thermo packages into a single structure.

Thermo packages now provide "he" function which may return either enthalpy or
internal energy, sensible or absolute according to the run-time selected form

alphaEff now returns the effective diffusivity for the particular energy which
the thermodynamics package is selected to solve for.
This commit is contained in:
Henry
2012-05-30 15:19:38 +01:00
parent 70ea2f82d2
commit 63da3e9afc
426 changed files with 4143 additions and 9522 deletions

View File

@ -112,7 +112,7 @@ public:
// Constructors
//- Construct from dictionary and hsCombustionThermo
//- Construct from dictionary and psiReactionThermo
reactionRateFlameArea
(
const dictionary& dict,

View File

@ -48,7 +48,7 @@ Foam::autoPtr<Foam::reactionRateFlameArea> Foam::reactionRateFlameArea::New
{
FatalIOErrorIn
(
"reactionRateFlameArea::New(const hsCombustionThermo&)",
"reactionRateFlameArea::New(const psiReactionThermo&)",
dict
) << "Unknown reactionRateFlameArea type "
<< reactionRateFlameAreaType << endl << endl

View File

@ -81,7 +81,7 @@ public:
// Constructors
//- Construct from dictionary and hsCombustionThermo
//- Construct from dictionary and psiReactionThermo
relaxation
(
const word modelType,

View File

@ -29,7 +29,7 @@ License
Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New
(
const dictionary& combustionProperties,
hsCombustionThermo& thermo,
psiReactionThermo& thermo,
const compressible::turbulenceModel& turbulence,
const surfaceScalarField& phi,
const volScalarField& rho

View File

@ -131,10 +131,10 @@ public:
inline tmp<volScalarField> rho() const;
//- Return const access to rho
inline const hsCombustionThermo& thermo() const;
inline const psiReactionThermo& thermo() const;
//- Return non const access to rho
inline hsCombustionThermo& thermo();
inline psiReactionThermo& thermo();
// I-O

View File

@ -44,13 +44,13 @@ Foam::combustionModels::psiChemistryCombustionModel::rho() const
return pChemistry_->thermo().rho();
}
inline const Foam::hsCombustionThermo&
inline const Foam::psiReactionThermo&
Foam::combustionModels::psiChemistryCombustionModel::thermo() const
{
return pChemistry_->thermo();
}
inline Foam::hsCombustionThermo&
inline Foam::psiReactionThermo&
Foam::combustionModels::psiChemistryCombustionModel::thermo()
{
return pChemistry_->thermo();

View File

@ -46,7 +46,7 @@ Foam::combustionModels::psiCombustionModel::psiCombustionModel
)
:
combustionModel(modelType, mesh),
thermo_(hsCombustionThermo::New(mesh))
thermo_(psiReactionThermo::New(mesh))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -40,7 +40,7 @@ SourceFiles
#include "combustionModel.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "hsCombustionThermo.H"
#include "psiReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -73,7 +73,7 @@ protected:
//- Thermo package
autoPtr<hsCombustionThermo> thermo_;
autoPtr<psiReactionThermo> thermo_;
@ -124,10 +124,10 @@ public:
// Member Functions
//- Return access to the thermo package
inline hsCombustionThermo& thermo();
inline psiReactionThermo& thermo();
//- Return const access to the thermo package
inline const hsCombustionThermo& thermo() const;
inline const psiReactionThermo& thermo() const;
//- Return tmp of rho
virtual tmp<volScalarField> rho() const;

View File

@ -25,13 +25,13 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::hsCombustionThermo&
inline Foam::psiReactionThermo&
Foam::combustionModels::psiCombustionModel::thermo()
{
return thermo_();
}
inline const Foam::hsCombustionThermo&
inline const Foam::psiReactionThermo&
Foam::combustionModels::psiCombustionModel::thermo() const
{
return thermo_();

View File

@ -131,10 +131,10 @@ public:
inline tmp<volScalarField> rho() const;
//- Return const access to rho
inline const hsReactionThermo& thermo() const;
inline const rhoReactionThermo& thermo() const;
//- Return non const access to rho
inline hsReactionThermo& thermo();
inline rhoReactionThermo& thermo();
// I-O

View File

@ -44,13 +44,13 @@ Foam::combustionModels::rhoChemistryCombustionModel::rho() const
return pChemistry_->thermo().rho();
}
inline const Foam::hsReactionThermo&
inline const Foam::rhoReactionThermo&
Foam::combustionModels::rhoChemistryCombustionModel::thermo() const
{
return pChemistry_->thermo();
}
inline Foam::hsReactionThermo&
inline Foam::rhoReactionThermo&
Foam::combustionModels::rhoChemistryCombustionModel::thermo()
{
return pChemistry_->thermo();

View File

@ -46,7 +46,7 @@ Foam::combustionModels::rhoCombustionModel::rhoCombustionModel
)
:
combustionModel(modelType, mesh),
thermo_(hsReactionThermo::New(mesh))
thermo_(rhoReactionThermo::New(mesh))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -40,7 +40,7 @@ SourceFiles
#include "combustionModel.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "hsReactionThermo.H"
#include "rhoReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,7 +72,7 @@ protected:
// Protected data
//- Thermo package
autoPtr<hsReactionThermo> thermo_;
autoPtr<rhoReactionThermo> thermo_;
public:
@ -127,10 +127,10 @@ public:
//- Return access to the thermo package
inline hsReactionThermo& thermo();
inline rhoReactionThermo& thermo();
//- Return const access to the thermo package
inline const hsReactionThermo& thermo() const;
inline const rhoReactionThermo& thermo() const;
//- Return tmp of rho
virtual tmp<volScalarField> rho() const;

View File

@ -25,13 +25,13 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::hsReactionThermo&
inline Foam::rhoReactionThermo&
Foam::combustionModels::rhoCombustionModel::thermo()
{
return thermo_();
}
inline const Foam::hsReactionThermo&
inline const Foam::rhoReactionThermo&
Foam::combustionModels::rhoCombustionModel::thermo() const
{
return thermo_();

View File

@ -124,14 +124,12 @@ calculateHtc()
const volScalarField Nu(a_*pow(Re, b_)*pow(Pr_, c_));
const volScalarField K(turb.alphaEff()*secondaryThermo.Cp());
scalarField htcMapped(htc_.internalField().size(), 0.0);
secondaryToPrimaryInterpPtr_->interpolateInternalField
(
htcMapped,
Nu*K/ds_,
Nu*turb.kappaEff()/ds_,
meshToMesh::MAP,
eqOp<scalar>()
);
@ -184,4 +182,4 @@ bool Foam::variableHeatTransfer::read(const dictionary& dict)
}
// ************************************************************************* //
// ************************************************************************* //

View File

@ -296,8 +296,8 @@ void Foam::ThermoCloud<CloudType>::relaxSources
{
CloudType::relaxSources(cloudOldTime);
this->relax(hsTrans_(), cloudOldTime.hsTrans(), "hs");
this->relax(hsCoeff_(), cloudOldTime.hsCoeff(), "hs");
this->relax(hsTrans_(), cloudOldTime.hsTrans(), "h");
this->relax(hsCoeff_(), cloudOldTime.hsCoeff(), "h");
}
@ -306,8 +306,8 @@ void Foam::ThermoCloud<CloudType>::scaleSources()
{
CloudType::scaleSources();
this->scale(hsTrans_(), "hs");
this->scale(hsCoeff_(), "hs");
this->scale(hsTrans_(), "h");
this->scale(hsCoeff_(), "h");
}

View File

@ -135,7 +135,7 @@ Foam::ThermoCloud<CloudType>::Sh(volScalarField& hs) const
if (this->solution().coupled())
{
if (this->solution().semiImplicit("hs"))
if (this->solution().semiImplicit("h"))
{
const volScalarField Cp(thermo_.thermo().Cp());
const DimensionedField<scalar, volMesh>

View File

@ -396,7 +396,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::H
forAll(Y, i)
{
label gid = props.globalIds()[i];
HMixture += Y[i]*thermo_.carrier().H(gid, T);
HMixture += Y[i]*thermo_.carrier().Hs(gid, T);
}
break;
}

View File

@ -216,7 +216,7 @@ Foam::scalar Foam::LiquidEvaporation<CloudType>::dh
}
case (parent::etEnthalpyDifference):
{
scalar hc = this->owner().composition().carrier().H(idc, T);
scalar hc = this->owner().composition().carrier().Hs(idc, T);
scalar hp = liquids_.properties()[idl].h(p, T);
dh = hc - hp;

View File

@ -171,8 +171,8 @@ void Foam::LiquidEvaporationBoil<CloudType>::calculate
forAll(this->owner().thermo().carrier().Y(), i)
{
scalar Yc = this->owner().thermo().carrier().Y()[i][cellI];
Hc += Yc*this->owner().thermo().carrier().H(i, Tc);
Hsc += Yc*this->owner().thermo().carrier().H(i, Ts);
Hc += Yc*this->owner().thermo().carrier().Hs(i, Tc);
Hsc += Yc*this->owner().thermo().carrier().Hs(i, Ts);
Cpc += Yc*this->owner().thermo().carrier().Cp(i, Ts);
kappac += Yc*this->owner().thermo().carrier().kappa(i, Ts);
}
@ -315,7 +315,7 @@ Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::dh
}
case (parent::etEnthalpyDifference):
{
scalar hc = this->owner().composition().carrier().H(idc, TDash);
scalar hc = this->owner().composition().carrier().Hs(idc, TDash);
scalar hp = liquids_.properties()[idl].h(p, TDash);
dh = hc - hp;

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) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -118,7 +118,7 @@ void Foam::blockMesh::calcMergeInfo()
// the size of the block.
boundBox bb(blockCells[blockPlabel].points(blockFaces, blockPoints));
const scalar mergeSqrDist = SMALL*magSqr(bb.span());
const scalar mergeSqrDist = magSqr(SMALL*bb.span());
// This is an N^2 algorithm

View File

@ -383,7 +383,7 @@ thermoSingleLayer::thermoSingleLayer
(
IOobject
(
"hsf",
"hf",
time().timeName(),
regionMesh(),
IOobject::NO_READ,

View File

@ -4,24 +4,17 @@ mixtures/basicMixture/basicMixtures.C
basicThermo/basicThermo.C
basicThermo/basicThermoNew.C
psiThermo/basicPsiThermo/basicPsiThermo.C
psiThermo/basicPsiThermo/basicPsiThermoNew.C
psiThermo/hPsiThermo/hPsiThermos.C
psiThermo/hsPsiThermo/hsPsiThermos.C
psiThermo/ePsiThermo/ePsiThermos.C
psiThermo/psiThermo/psiThermo.C
psiThermo/psiThermo/psiThermoNew.C
psiThermo/hePsiThermo/hePsiThermos.C
rhoThermo/basicRhoThermo/basicRhoThermo.C
rhoThermo/basicRhoThermo/basicRhoThermoNew.C
rhoThermo/hRhoThermo/hRhoThermos.C
rhoThermo/hsRhoThermo/hsRhoThermos.C
rhoThermo/rhoThermo/rhoThermo.C
rhoThermo/rhoThermo/rhoThermoNew.C
rhoThermo/heRhoThermo/heRhoThermos.C
derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.C
derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C
derivedFvPatchFields/mixedEnthalpy/mixedEnthalpyFvPatchScalarField.C
derivedFvPatchFields/fixedInternalEnergy/fixedInternalEnergyFvPatchScalarField.C
derivedFvPatchFields/gradientInternalEnergy/gradientInternalEnergyFvPatchScalarField.C
derivedFvPatchFields/mixedInternalEnergy/mixedInternalEnergyFvPatchScalarField.C
derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C
derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C
derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C
derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C

View File

@ -27,12 +27,9 @@ License
#include "fvMesh.H"
#include "HashTable.H"
#include "zeroGradientFvPatchFields.H"
#include "fixedEnthalpyFvPatchScalarField.H"
#include "gradientEnthalpyFvPatchScalarField.H"
#include "mixedEnthalpyFvPatchScalarField.H"
#include "fixedInternalEnergyFvPatchScalarField.H"
#include "gradientInternalEnergyFvPatchScalarField.H"
#include "mixedInternalEnergyFvPatchScalarField.H"
#include "fixedEnergyFvPatchScalarField.H"
#include "gradientEnergyFvPatchScalarField.H"
#include "mixedEnergyFvPatchScalarField.H"
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
@ -44,7 +41,7 @@ namespace Foam
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::wordList Foam::basicThermo::hBoundaryTypes()
Foam::wordList Foam::basicThermo::heBoundaryTypes()
{
const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
@ -54,7 +51,7 @@ Foam::wordList Foam::basicThermo::hBoundaryTypes()
{
if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
{
hbt[patchi] = fixedEnthalpyFvPatchScalarField::typeName;
hbt[patchi] = fixedEnergyFvPatchScalarField::typeName;
}
else if
(
@ -62,11 +59,11 @@ Foam::wordList Foam::basicThermo::hBoundaryTypes()
|| isA<fixedGradientFvPatchScalarField>(tbf[patchi])
)
{
hbt[patchi] = gradientEnthalpyFvPatchScalarField::typeName;
hbt[patchi] = gradientEnergyFvPatchScalarField::typeName;
}
else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
{
hbt[patchi] = mixedEnthalpyFvPatchScalarField::typeName;
hbt[patchi] = mixedEnergyFvPatchScalarField::typeName;
}
}
@ -74,75 +71,26 @@ Foam::wordList Foam::basicThermo::hBoundaryTypes()
}
void Foam::basicThermo::hBoundaryCorrection(volScalarField& h)
void Foam::basicThermo::heBoundaryCorrection(volScalarField& h)
{
volScalarField::GeometricBoundaryField& hbf = h.boundaryField();
forAll(hbf, patchi)
{
if (isA<gradientEnthalpyFvPatchScalarField>(hbf[patchi]))
if (isA<gradientEnergyFvPatchScalarField>(hbf[patchi]))
{
refCast<gradientEnthalpyFvPatchScalarField>(hbf[patchi]).gradient()
refCast<gradientEnergyFvPatchScalarField>(hbf[patchi]).gradient()
= hbf[patchi].fvPatchField::snGrad();
}
else if (isA<mixedEnthalpyFvPatchScalarField>(hbf[patchi]))
else if (isA<mixedEnergyFvPatchScalarField>(hbf[patchi]))
{
refCast<mixedEnthalpyFvPatchScalarField>(hbf[patchi]).refGrad()
refCast<mixedEnergyFvPatchScalarField>(hbf[patchi]).refGrad()
= hbf[patchi].fvPatchField::snGrad();
}
}
}
Foam::wordList Foam::basicThermo::eBoundaryTypes()
{
const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
wordList ebt = tbf.types();
forAll(tbf, patchi)
{
if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
{
ebt[patchi] = fixedInternalEnergyFvPatchScalarField::typeName;
}
else if
(
isA<zeroGradientFvPatchScalarField>(tbf[patchi])
|| isA<fixedGradientFvPatchScalarField>(tbf[patchi])
)
{
ebt[patchi] = gradientInternalEnergyFvPatchScalarField::typeName;
}
else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
{
ebt[patchi] = mixedInternalEnergyFvPatchScalarField::typeName;
}
}
return ebt;
}
void Foam::basicThermo::eBoundaryCorrection(volScalarField& e)
{
volScalarField::GeometricBoundaryField& ebf = e.boundaryField();
forAll(ebf, patchi)
{
if (isA<gradientInternalEnergyFvPatchScalarField>(ebf[patchi]))
{
refCast<gradientInternalEnergyFvPatchScalarField>(ebf[patchi])
.gradient() = ebf[patchi].fvPatchField::snGrad();
}
else if (isA<mixedInternalEnergyFvPatchScalarField>(ebf[patchi]))
{
refCast<mixedInternalEnergyFvPatchScalarField>(ebf[patchi])
.refGrad() = ebf[patchi].fvPatchField::snGrad();
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicThermo::basicThermo(const fvMesh& mesh)
@ -255,227 +203,12 @@ const Foam::volScalarField& Foam::basicThermo::psi() const
}
Foam::volScalarField& Foam::basicThermo::h()
{
notImplemented("basicThermo::h()");
return const_cast<volScalarField&>(volScalarField::null());
}
const Foam::volScalarField& Foam::basicThermo::h() const
{
notImplemented("basicThermo::h() const");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::h
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::h"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::h
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::h"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
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::tmp<Foam::volScalarField> Foam::basicThermo::hc() const
{
notImplemented("basicThermo::hc()");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::TH
(
const scalarField& h,
const scalarField& T0, // starting temperature
const labelList& cells
) const
{
notImplemented
(
"basicThermo::TH"
"(const scalarField&, const scalarField&, const labelList&) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::TH
(
const scalarField& h,
const scalarField& T0, // starting temperature
const label patchi
) const
{
notImplemented
(
"basicThermo::TH"
"(const scalarField&, const scalarField&, const label) const"
);
return tmp<scalarField>(NULL);
}
Foam::volScalarField& Foam::basicThermo::e()
{
notImplemented("basicThermo::e()");
return const_cast<volScalarField&>(volScalarField::null());
}
const Foam::volScalarField& Foam::basicThermo::e() const
{
notImplemented("basicThermo::e()");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::e
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::e
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
const Foam::volScalarField& Foam::basicThermo::T() const
{
return T_;
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::Cp
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::Cp"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::volScalarField> Foam::basicThermo::Cp() const
{
notImplemented("basicThermo::Cp() const");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::Cv
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::Cv"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::volScalarField> Foam::basicThermo::Cv() const
{
notImplemented("basicThermo::Cv() const");
return volScalarField::null();
}
const Foam::volScalarField& Foam::basicThermo::mu() const
{
return mu_;

View File

@ -79,24 +79,14 @@ protected:
// Protected Member Functions
// Enthalpy
// Enthalpy/Internal energy
//- Return the enthalpy field boundary types by interrogating the
// temperature field boundary types
wordList hBoundaryTypes();
//- Return the enthalpy/internal energy field boundary types
// by interrogating the temperature field boundary types
wordList heBoundaryTypes();
//- Correct the enthalpy field boundaries
void hBoundaryCorrection(volScalarField& h);
// Internal energy
//- Return the internal energy field boundary types by
// interrogating the temperature field boundary types
wordList eBoundaryTypes();
//- Correct the internal energy field boundaries
void eBoundaryCorrection(volScalarField& e);
//- Correct the enthalpy/internal energy field boundaries
void heBoundaryCorrection(volScalarField& he);
//- Construct as copy (not implemented)
@ -153,87 +143,45 @@ public:
//- Compressibility [s^2/m^2]
virtual const volScalarField& psi() const;
//- Total enthalpy [J/kg]
//- Enthalpy/Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& h();
virtual volScalarField& he() = 0;
//- Total enthalpy [J/kg]
virtual const volScalarField& h() const;
//- Enthalpy/Internal energy [J/kg]
virtual const volScalarField& he() const = 0;
//- Total enthalpy for cell-set [J/kg]
virtual tmp<scalarField> h
//- Enthalpy/Internal energy for cell-set [J/kg]
virtual tmp<scalarField> he
(
const scalarField& T,
const labelList& cells
) const;
) const = 0;
//- Total enthalpy for patch [J/kg]
virtual tmp<scalarField> h
//- Enthalpy/Internal energy for patch [J/kg]
virtual tmp<scalarField> he
(
const scalarField& T,
const label patchi
) const;
//- Sensible enthalpy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& hs();
//- Sensible enthalpy [J/kg]
virtual const volScalarField& hs() const;
//- Sensible enthalpy for cell-set [J/kg]
virtual tmp<scalarField> hs
(
const scalarField& T,
const labelList& cells
) const;
//- Sensible enthalpy for patch [J/kg]
virtual tmp<scalarField> hs
(
const scalarField& T,
const label patchi
) const;
) const = 0;
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
virtual tmp<volScalarField> hc() const = 0;
//- Temperature from enthalpy for cell-set
virtual tmp<scalarField> TH
//- Temperature from enthalpy/internal energy for cell-set
virtual tmp<scalarField> THE
(
const scalarField& h,
const scalarField& T0, // starting temperature
const labelList& cells
) const;
) const = 0;
//- Temperature from enthalpy for patch
virtual tmp<scalarField> TH
//- Temperature from enthalpy/internal energy for patch
virtual tmp<scalarField> THE
(
const scalarField& h,
const scalarField& T0, // starting temperature
const label patchi
) const;
//- Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& e();
//- Internal energy [J/kg]
virtual const volScalarField& e() const;
//- Internal energy for cell-set [J/kg]
virtual tmp<scalarField> e
(
const scalarField& T,
const labelList& cells
) const;
//- Internal energy for patch [J/kg]
virtual tmp<scalarField> e
(
const scalarField& T,
const label patchi
) const;
) const = 0;
// Fields derived from thermodynamic state variables
@ -241,25 +189,55 @@ public:
//- Temperature [K]
virtual const volScalarField& T() const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const = 0;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& T,
const label patchi
) const;
) const = 0;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const = 0;
//- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv
(
const scalarField& T,
const label patchi
) const;
) const = 0;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const;
//- gamma = Cp/Cv []
virtual tmp<volScalarField> gamma() const = 0;
//- gamma = Cp/Cv for patch []
virtual tmp<scalarField> gamma
(
const scalarField& T,
const label patchi
) const = 0;
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual tmp<volScalarField> Cpv() const = 0;
//- Heat capacity at constant pressure/volume for patch [J/kg/K]
virtual tmp<scalarField> Cpv
(
const scalarField& T,
const label patchi
) const = 0;
//- Heat capacity ratio []
virtual tmp<volScalarField> CpByCpv() const = 0;
//- Heat capacity ratio for patch []
virtual tmp<scalarField> CpByCpv
(
const scalarField& T,
const label patchi
) const = 0;
// Access to transport state variables
@ -271,6 +249,44 @@ public:
virtual const volScalarField& alpha() const;
// Fields derived from transport state variables
//- Thermal diffusivity for temperature of mixture [J/m/s/K]
virtual tmp<volScalarField> kappa() const = 0;
//- Thermal diffusivity of mixture for patch [J/m/s/K]
virtual tmp<scalarField> kappa
(
const label patchi
) const = 0;
//- Effective thermal diffusivity of mixture [J/m/s/K]
virtual tmp<volScalarField> kappaEff
(
const volScalarField&
) const = 0;
//- Effective thermal diffusivity of mixture for patch [J/m/s/K]
virtual tmp<scalarField> kappaEff
(
const scalarField& alphat,
const label patchi
) const = 0;
//- Effective thermal diffusivity of mixture [J/m/s/K]
virtual tmp<volScalarField> alphaEff
(
const volScalarField& alphat
) const = 0;
//- Effective thermal diffusivity of mixture for patch [J/m/s/K]
virtual tmp<scalarField> alphaEff
(
const scalarField& alphat,
const label patchi
) const = 0;
//- Read thermophysicalProperties dictionary
virtual bool read();
};

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "fixedInternalEnergyFvPatchScalarField.H"
#include "fixedEnergyFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
@ -31,8 +31,8 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fixedInternalEnergyFvPatchScalarField::
fixedInternalEnergyFvPatchScalarField
Foam::fixedEnergyFvPatchScalarField::
fixedEnergyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
@ -42,10 +42,10 @@ fixedInternalEnergyFvPatchScalarField
{}
Foam::fixedInternalEnergyFvPatchScalarField::
fixedInternalEnergyFvPatchScalarField
Foam::fixedEnergyFvPatchScalarField::
fixedEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField& ptf,
const fixedEnergyFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
@ -55,8 +55,8 @@ fixedInternalEnergyFvPatchScalarField
{}
Foam::fixedInternalEnergyFvPatchScalarField::
fixedInternalEnergyFvPatchScalarField
Foam::fixedEnergyFvPatchScalarField::
fixedEnergyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -67,20 +67,20 @@ fixedInternalEnergyFvPatchScalarField
{}
Foam::fixedInternalEnergyFvPatchScalarField::
fixedInternalEnergyFvPatchScalarField
Foam::fixedEnergyFvPatchScalarField::
fixedEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField& tppsf
const fixedEnergyFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf)
{}
Foam::fixedInternalEnergyFvPatchScalarField::
fixedInternalEnergyFvPatchScalarField
Foam::fixedEnergyFvPatchScalarField::
fixedEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField& tppsf,
const fixedEnergyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
@ -90,7 +90,7 @@ fixedInternalEnergyFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fixedInternalEnergyFvPatchScalarField::updateCoeffs()
void Foam::fixedEnergyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
@ -107,7 +107,7 @@ void Foam::fixedInternalEnergyFvPatchScalarField::updateCoeffs()
fvPatchScalarField& Tw =
const_cast<fvPatchScalarField&>(thermo.T().boundaryField()[patchi]);
Tw.evaluate();
operator==(thermo.e(Tw, patchi));
operator==(thermo.he(Tw, patchi));
fixedValueFvPatchScalarField::updateCoeffs();
}
@ -120,7 +120,7 @@ namespace Foam
makePatchTypeField
(
fvPatchScalarField,
fixedInternalEnergyFvPatchScalarField
fixedEnergyFvPatchScalarField
);
}

View File

@ -22,18 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fixedEnthalpyFvPatchScalarField
Foam::fixedEnergyFvPatchScalarField
Description
A fixed boundary condition for enthalpy
A fixed boundary condition for internal energy
SourceFiles
fixedEnthalpyFvPatchScalarField.C
fixedEnergyFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef fixedEnthalpyFvPatchScalarField_H
#define fixedEnthalpyFvPatchScalarField_H
#ifndef fixedEnergyFvPatchScalarField_H
#define fixedEnergyFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
@ -43,10 +43,10 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedEnthalpyFvPatchScalarField Declaration
Class fixedEnergyFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class fixedEnthalpyFvPatchScalarField
class fixedEnergyFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
@ -54,40 +54,40 @@ class fixedEnthalpyFvPatchScalarField
public:
//- Runtime type information
TypeName("fixedEnthalpy");
TypeName("fixedEnergy");
// Constructors
//- Construct from patch and internal field
fixedEnthalpyFvPatchScalarField
fixedEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
fixedEnthalpyFvPatchScalarField
fixedEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given fixedEnthalpyFvPatchScalarField
//- Construct by mapping given fixedEnergyFvPatchScalarField
// onto a new patch
fixedEnthalpyFvPatchScalarField
fixedEnergyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField&,
const fixedEnergyFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
fixedEnthalpyFvPatchScalarField
fixedEnergyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField&
const fixedEnergyFvPatchScalarField&
);
//- Construct and return a clone
@ -95,14 +95,14 @@ public:
{
return tmp<fvPatchScalarField>
(
new fixedEnthalpyFvPatchScalarField(*this)
new fixedEnergyFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
fixedEnthalpyFvPatchScalarField
fixedEnergyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField&,
const fixedEnergyFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
@ -114,7 +114,7 @@ public:
{
return tmp<fvPatchScalarField>
(
new fixedEnthalpyFvPatchScalarField(*this, iF)
new fixedEnergyFvPatchScalarField(*this, iF)
);
}

View File

@ -1,131 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "fixedEnthalpyFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF)
{}
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
{}
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict)
{}
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf)
{}
Foam::fixedEnthalpyFvPatchScalarField::fixedEnthalpyFvPatchScalarField
(
const fixedEnthalpyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fixedEnthalpyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const basicThermo& thermo = db().lookupObject<basicThermo>
(
"thermophysicalProperties"
);
const label patchi = patch().index();
fvPatchScalarField& Tw =
const_cast<fvPatchScalarField&>(thermo.T().boundaryField()[patchi]);
Tw.evaluate();
if (dimensionedInternalField().name() == "h")
{
operator==(thermo.h(Tw, patchi));
}
else
{
operator==(thermo.hs(Tw, patchi));
}
fixedValueFvPatchScalarField::updateCoeffs();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
fixedEnthalpyFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -1,139 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Class
Foam::fixedInternalEnergyFvPatchScalarField
Description
A fixed boundary condition for internal energy
SourceFiles
fixedInternalEnergyFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef fixedInternalEnergyFvPatchScalarField_H
#define fixedInternalEnergyFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedInternalEnergyFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class fixedInternalEnergyFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
public:
//- Runtime type information
TypeName("fixedInternalEnergy");
// Constructors
//- Construct from patch and internal field
fixedInternalEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
fixedInternalEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given fixedInternalEnergyFvPatchScalarField
// onto a new patch
fixedInternalEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
fixedInternalEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new fixedInternalEnergyFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
fixedInternalEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new fixedInternalEnergyFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "gradientInternalEnergyFvPatchScalarField.H"
#include "gradientEnergyFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
@ -31,8 +31,8 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::gradientInternalEnergyFvPatchScalarField::
gradientInternalEnergyFvPatchScalarField
Foam::gradientEnergyFvPatchScalarField::
gradientEnergyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
@ -42,10 +42,10 @@ gradientInternalEnergyFvPatchScalarField
{}
Foam::gradientInternalEnergyFvPatchScalarField::
gradientInternalEnergyFvPatchScalarField
Foam::gradientEnergyFvPatchScalarField::
gradientEnergyFvPatchScalarField
(
const gradientInternalEnergyFvPatchScalarField& ptf,
const gradientEnergyFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
@ -55,8 +55,8 @@ gradientInternalEnergyFvPatchScalarField
{}
Foam::gradientInternalEnergyFvPatchScalarField::
gradientInternalEnergyFvPatchScalarField
Foam::gradientEnergyFvPatchScalarField::
gradientEnergyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -67,20 +67,20 @@ gradientInternalEnergyFvPatchScalarField
{}
Foam::gradientInternalEnergyFvPatchScalarField::
gradientInternalEnergyFvPatchScalarField
Foam::gradientEnergyFvPatchScalarField::
gradientEnergyFvPatchScalarField
(
const gradientInternalEnergyFvPatchScalarField& tppsf
const gradientEnergyFvPatchScalarField& tppsf
)
:
fixedGradientFvPatchScalarField(tppsf)
{}
Foam::gradientInternalEnergyFvPatchScalarField::
gradientInternalEnergyFvPatchScalarField
Foam::gradientEnergyFvPatchScalarField::
gradientEnergyFvPatchScalarField
(
const gradientInternalEnergyFvPatchScalarField& tppsf,
const gradientEnergyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
@ -90,7 +90,7 @@ gradientInternalEnergyFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::gradientInternalEnergyFvPatchScalarField::updateCoeffs()
void Foam::gradientEnergyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
@ -109,11 +109,11 @@ void Foam::gradientInternalEnergyFvPatchScalarField::updateCoeffs()
Tw.evaluate();
gradient() = thermo.Cv(Tw, patchi)*Tw.snGrad()
gradient() = thermo.Cpv(Tw, patchi)*Tw.snGrad()
+ patch().deltaCoeffs()*
(
thermo.e(Tw, patchi)
- thermo.e(Tw, patch().faceCells())
thermo.he(Tw, patchi)
- thermo.he(Tw, patch().faceCells())
);
fixedGradientFvPatchScalarField::updateCoeffs();
@ -127,7 +127,7 @@ namespace Foam
makePatchTypeField
(
fvPatchScalarField,
gradientInternalEnergyFvPatchScalarField
gradientEnergyFvPatchScalarField
);
}

View File

@ -28,12 +28,12 @@ Description
Gradient boundary condition for internal energy
SourceFiles
gradientInternalEnergyFvPatchScalarField.C
gradientEnergyFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef gradientInternalEnergyFvPatchScalarField_H
#define gradientInternalEnergyFvPatchScalarField_H
#ifndef gradientEnergyFvPatchScalarField_H
#define gradientEnergyFvPatchScalarField_H
#include "fixedGradientFvPatchFields.H"
@ -43,10 +43,10 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class gradientInternalEnergyFvPatchScalarField Declaration
Class gradientEnergyFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class gradientInternalEnergyFvPatchScalarField
class gradientEnergyFvPatchScalarField
:
public fixedGradientFvPatchScalarField
{
@ -54,40 +54,40 @@ class gradientInternalEnergyFvPatchScalarField
public:
//- Runtime type information
TypeName("gradientInternalEnergy");
TypeName("gradientEnergy");
// Constructors
//- Construct from patch and internal field
gradientInternalEnergyFvPatchScalarField
gradientEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
gradientInternalEnergyFvPatchScalarField
gradientEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given gradientInternalEnergyFvPatchScalarField
//- Construct by mapping given gradientEnergyFvPatchScalarField
// onto a new patch
gradientInternalEnergyFvPatchScalarField
gradientEnergyFvPatchScalarField
(
const gradientInternalEnergyFvPatchScalarField&,
const gradientEnergyFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
gradientInternalEnergyFvPatchScalarField
gradientEnergyFvPatchScalarField
(
const gradientInternalEnergyFvPatchScalarField&
const gradientEnergyFvPatchScalarField&
);
//- Construct and return a clone
@ -95,14 +95,14 @@ public:
{
return tmp<fvPatchScalarField>
(
new gradientInternalEnergyFvPatchScalarField(*this)
new gradientEnergyFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
gradientInternalEnergyFvPatchScalarField
gradientEnergyFvPatchScalarField
(
const gradientInternalEnergyFvPatchScalarField&,
const gradientEnergyFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
@ -114,7 +114,7 @@ public:
{
return tmp<fvPatchScalarField>
(
new gradientInternalEnergyFvPatchScalarField(*this, iF)
new gradientEnergyFvPatchScalarField(*this, iF)
);
}

View File

@ -1,142 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "gradientEnthalpyFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(p, iF)
{}
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedGradientFvPatchScalarField(ptf, p, iF, mapper)
{}
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedGradientFvPatchScalarField(p, iF, dict)
{}
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField& tppsf
)
:
fixedGradientFvPatchScalarField(tppsf)
{}
Foam::gradientEnthalpyFvPatchScalarField::gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(tppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::gradientEnthalpyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const basicThermo& thermo = db().lookupObject<basicThermo>
(
"thermophysicalProperties"
);
const label patchi = patch().index();
fvPatchScalarField& Tw =
const_cast<fvPatchScalarField&>(thermo.T().boundaryField()[patchi]);
Tw.evaluate();
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();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
gradientEnthalpyFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -1,139 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Class
Foam::gradientEnthalpyFvPatchScalarField
Description
Gradient boundary condition for enthalpy
SourceFiles
gradientEnthalpyFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef gradientEnthalpyFvPatchScalarField_H
#define gradientEnthalpyFvPatchScalarField_H
#include "fixedGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class gradientEnthalpyFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class gradientEnthalpyFvPatchScalarField
:
public fixedGradientFvPatchScalarField
{
public:
//- Runtime type information
TypeName("gradientEnthalpy");
// Constructors
//- Construct from patch and internal field
gradientEnthalpyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
gradientEnthalpyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given gradientEnthalpyFvPatchScalarField
// onto a new patch
gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new gradientEnthalpyFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
gradientEnthalpyFvPatchScalarField
(
const gradientEnthalpyFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new gradientEnthalpyFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mixedInternalEnergyFvPatchScalarField.H"
#include "mixedEnergyFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
@ -32,8 +32,8 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::mixedInternalEnergyFvPatchScalarField::
mixedInternalEnergyFvPatchScalarField
Foam::mixedEnergyFvPatchScalarField::
mixedEnergyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
@ -47,10 +47,10 @@ mixedInternalEnergyFvPatchScalarField
}
Foam::mixedInternalEnergyFvPatchScalarField::
mixedInternalEnergyFvPatchScalarField
Foam::mixedEnergyFvPatchScalarField::
mixedEnergyFvPatchScalarField
(
const mixedInternalEnergyFvPatchScalarField& ptf,
const mixedEnergyFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
@ -60,8 +60,8 @@ mixedInternalEnergyFvPatchScalarField
{}
Foam::mixedInternalEnergyFvPatchScalarField::
mixedInternalEnergyFvPatchScalarField
Foam::mixedEnergyFvPatchScalarField::
mixedEnergyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -72,20 +72,20 @@ mixedInternalEnergyFvPatchScalarField
{}
Foam::mixedInternalEnergyFvPatchScalarField::
mixedInternalEnergyFvPatchScalarField
Foam::mixedEnergyFvPatchScalarField::
mixedEnergyFvPatchScalarField
(
const mixedInternalEnergyFvPatchScalarField& tppsf
const mixedEnergyFvPatchScalarField& tppsf
)
:
mixedFvPatchScalarField(tppsf)
{}
Foam::mixedInternalEnergyFvPatchScalarField::
mixedInternalEnergyFvPatchScalarField
Foam::mixedEnergyFvPatchScalarField::
mixedEnergyFvPatchScalarField
(
const mixedInternalEnergyFvPatchScalarField& tppsf,
const mixedEnergyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
@ -95,7 +95,7 @@ mixedInternalEnergyFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::mixedInternalEnergyFvPatchScalarField::updateCoeffs()
void Foam::mixedEnergyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
@ -117,13 +117,13 @@ void Foam::mixedInternalEnergyFvPatchScalarField::updateCoeffs()
Tw.evaluate();
valueFraction() = Tw.valueFraction();
refValue() = thermo.e(Tw.refValue(), patchi);
refValue() = thermo.he(Tw.refValue(), patchi);
refGrad() =
thermo.Cv(Tw, patchi)*Tw.refGrad()
thermo.Cpv(Tw, patchi)*Tw.refGrad()
+ patch().deltaCoeffs()*
(
thermo.e(Tw, patchi)
- thermo.e(Tw, patch().faceCells())
thermo.he(Tw, patchi)
- thermo.he(Tw, patch().faceCells())
);
mixedFvPatchScalarField::updateCoeffs();
@ -137,7 +137,7 @@ namespace Foam
makePatchTypeField
(
fvPatchScalarField,
mixedInternalEnergyFvPatchScalarField
mixedEnergyFvPatchScalarField
);
}

View File

@ -22,18 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::mixedEnthalpyFvPatchScalarField
Foam::mixedEnergyFvPatchScalarField
Description
Mixed boundary conditions for enthalpy
Mixed boundary conditions for internal energy
SourceFiles
mixedEnthalpyFvPatchScalarField.C
mixedEnergyFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef mixedEnthalpyFvPatchScalarField_H
#define mixedEnthalpyFvPatchScalarField_H
#ifndef mixedEnergyFvPatchScalarField_H
#define mixedEnergyFvPatchScalarField_H
#include "mixedFvPatchFields.H"
@ -43,10 +43,10 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class mixedEnthalpyFvPatchScalarField Declaration
Class mixedEnergyFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class mixedEnthalpyFvPatchScalarField
class mixedEnergyFvPatchScalarField
:
public mixedFvPatchScalarField
{
@ -54,40 +54,40 @@ class mixedEnthalpyFvPatchScalarField
public:
//- Runtime type information
TypeName("mixedEnthalpy");
TypeName("mixedEnergy");
// Constructors
//- Construct from patch and internal field
mixedEnthalpyFvPatchScalarField
mixedEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
mixedEnthalpyFvPatchScalarField
mixedEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given mixedEnthalpyFvPatchScalarField
//- Construct by mapping given mixedEnergyFvPatchScalarField
// onto a new patch
mixedEnthalpyFvPatchScalarField
mixedEnergyFvPatchScalarField
(
const mixedEnthalpyFvPatchScalarField&,
const mixedEnergyFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
mixedEnthalpyFvPatchScalarField
mixedEnergyFvPatchScalarField
(
const mixedEnthalpyFvPatchScalarField&
const mixedEnergyFvPatchScalarField&
);
//- Construct and return a clone
@ -95,14 +95,14 @@ public:
{
return tmp<fvPatchScalarField>
(
new mixedEnthalpyFvPatchScalarField(*this)
new mixedEnergyFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
mixedEnthalpyFvPatchScalarField
mixedEnergyFvPatchScalarField
(
const mixedEnthalpyFvPatchScalarField&,
const mixedEnergyFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
@ -114,7 +114,7 @@ public:
{
return tmp<fvPatchScalarField>
(
new mixedEnthalpyFvPatchScalarField(*this, iF)
new mixedEnergyFvPatchScalarField(*this, iF)
);
}

View File

@ -1,152 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "mixedEnthalpyFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(p, iF)
{
valueFraction() = 0.0;
refValue() = 0.0;
refGrad() = 0.0;
}
Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
(
const mixedEnthalpyFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper)
{}
Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF, dict)
{}
Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
(
const mixedEnthalpyFvPatchScalarField& tppsf
)
:
mixedFvPatchScalarField(tppsf)
{}
Foam::mixedEnthalpyFvPatchScalarField::mixedEnthalpyFvPatchScalarField
(
const mixedEnthalpyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(tppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::mixedEnthalpyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const basicThermo& thermo = db().lookupObject<basicThermo>
(
"thermophysicalProperties"
);
const label patchi = patch().index();
mixedFvPatchScalarField& Tw = refCast<mixedFvPatchScalarField>
(
const_cast<fvPatchScalarField&>(thermo.T().boundaryField()[patchi])
);
Tw.evaluate();
valueFraction() = Tw.valueFraction();
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();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
mixedEnthalpyFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -1,139 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Class
Foam::mixedInternalEnergyFvPatchScalarField
Description
Mixed boundary conditions for internal energy
SourceFiles
mixedInternalEnergyFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef mixedInternalEnergyFvPatchScalarField_H
#define mixedInternalEnergyFvPatchScalarField_H
#include "mixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class mixedInternalEnergyFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class mixedInternalEnergyFvPatchScalarField
:
public mixedFvPatchScalarField
{
public:
//- Runtime type information
TypeName("mixedInternalEnergy");
// Constructors
//- Construct from patch and internal field
mixedInternalEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
mixedInternalEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given mixedInternalEnergyFvPatchScalarField
// onto a new patch
mixedInternalEnergyFvPatchScalarField
(
const mixedInternalEnergyFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
mixedInternalEnergyFvPatchScalarField
(
const mixedInternalEnergyFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new mixedInternalEnergyFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
mixedInternalEnergyFvPatchScalarField
(
const mixedInternalEnergyFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new mixedInternalEnergyFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,618 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "heThermo.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicThermo, class MixtureType>
Foam::heThermo<BasicThermo, MixtureType>::heThermo(const fvMesh& mesh)
:
BasicThermo(mesh),
MixtureType(*this, mesh),
he_
(
IOobject
(
MixtureType::thermoType::heName(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->heBoundaryTypes()
)
{
scalarField& heCells = he_.internalField();
const scalarField& TCells = this->T_.internalField();
forAll(heCells, celli)
{
heCells[celli] = this->cellMixture(celli).HE(TCells[celli]);
}
forAll(he_.boundaryField(), patchi)
{
he_.boundaryField()[patchi] ==
he(this->T_.boundaryField()[patchi], patchi);
}
this->heBoundaryCorrection(he_);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class BasicThermo, class MixtureType>
Foam::heThermo<BasicThermo, MixtureType>::~heThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::he
(
const scalarField& T,
const labelList& cells
) const
{
tmp<scalarField> the(new scalarField(T.size()));
scalarField& he = the();
forAll(T, celli)
{
he[celli] = this->cellMixture(cells[celli]).HE(T[celli]);
}
return the;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::he
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> the(new scalarField(T.size()));
scalarField& he = the();
forAll(T, facei)
{
he[facei] = this->patchFaceMixture(patchi, facei).HE(T[facei]);
}
return the;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::hc() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> thc
(
new volScalarField
(
IOobject
(
"hc",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
he_.dimensions()
)
);
volScalarField& hcf = thc();
scalarField& hcCells = hcf.internalField();
forAll(hcCells, celli)
{
hcCells[celli] = this->cellMixture(celli).Hc();
}
forAll(hcf.boundaryField(), patchi)
{
scalarField& hcp = hcf.boundaryField()[patchi];
forAll(hcp, facei)
{
hcp[facei] = this->patchFaceMixture(patchi, facei).Hc();
}
}
return thc;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::Cp
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCp(new scalarField(T.size()));
scalarField& cp = tCp();
forAll(T, facei)
{
cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]);
}
return tCp;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::Cp() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCp
(
new volScalarField
(
IOobject
(
"Cp",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cp = tCp();
forAll(this->T_, celli)
{
cp[celli] = this->cellMixture(celli).Cp(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
const fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& pCp = cp.boundaryField()[patchi];
forAll(pT, facei)
{
pCp[facei] = this->patchFaceMixture(patchi, facei).Cp(pT[facei]);
}
}
return tCp;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::heThermo<BasicThermo, MixtureType>::Cv
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCv(new scalarField(T.size()));
scalarField& cv = tCv();
forAll(T, facei)
{
cv[facei] = this->patchFaceMixture(patchi, facei).Cv(T[facei]);
}
return tCv;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::Cv() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCv
(
new volScalarField
(
IOobject
(
"Cv",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cv = tCv();
forAll(this->T_, celli)
{
cv[celli] = this->cellMixture(celli).Cv(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
cv.boundaryField()[patchi] =
Cv(this->T_.boundaryField()[patchi], patchi);
}
return tCv;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::gamma
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tgamma(new scalarField(T.size()));
scalarField& cpv = tgamma();
forAll(T, facei)
{
cpv[facei] = this->patchFaceMixture(patchi, facei).gamma(T[facei]);
}
return tgamma;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::gamma() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tgamma
(
new volScalarField
(
IOobject
(
"gamma",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless
)
);
volScalarField& cpv = tgamma();
forAll(this->T_, celli)
{
cpv[celli] = this->cellMixture(celli).gamma(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
const fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& pgamma = cpv.boundaryField()[patchi];
forAll(pT, facei)
{
pgamma[facei] =
this->patchFaceMixture(patchi, facei).gamma(pT[facei]);
}
}
return tgamma;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::Cpv
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCpv(new scalarField(T.size()));
scalarField& cpv = tCpv();
forAll(T, facei)
{
cpv[facei] = this->patchFaceMixture(patchi, facei).Cpv(T[facei]);
}
return tCpv;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::Cpv() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCpv
(
new volScalarField
(
IOobject
(
"Cpv",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cpv = tCpv();
forAll(this->T_, celli)
{
cpv[celli] = this->cellMixture(celli).Cpv(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
const fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& pCpv = cpv.boundaryField()[patchi];
forAll(pT, facei)
{
pCpv[facei] = this->patchFaceMixture(patchi, facei).Cpv(pT[facei]);
}
}
return tCpv;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::CpByCpv
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCpByCpv(new scalarField(T.size()));
scalarField& cpByCpv = tCpByCpv();
forAll(T, facei)
{
cpByCpv[facei] =
this->patchFaceMixture(patchi, facei).cpBycpv(T[facei]);
}
return tCpByCpv;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::CpByCpv() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCpByCpv
(
new volScalarField
(
IOobject
(
"CpByCpv",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless
)
);
volScalarField& cpByCpv = tCpByCpv();
forAll(this->T_, celli)
{
cpByCpv[celli] = this->cellMixture(celli).cpBycpv(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
const fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& pCpByCpv = cpByCpv.boundaryField()[patchi];
forAll(pT, facei)
{
pCpByCpv[facei] =
this->patchFaceMixture(patchi, facei).cpBycpv(pT[facei]);
}
}
return tCpByCpv;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::THE
(
const scalarField& h,
const scalarField& T0,
const labelList& cells
) const
{
tmp<scalarField> tT(new scalarField(h.size()));
scalarField& T = tT();
forAll(h, celli)
{
T[celli] = this->cellMixture(cells[celli]).THE(h[celli], T0[celli]);
}
return tT;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::THE
(
const scalarField& h,
const scalarField& T0,
const label patchi
) const
{
tmp<scalarField> tT(new scalarField(h.size()));
scalarField& T = tT();
forAll(h, facei)
{
T[facei] = this->patchFaceMixture
(
patchi,
facei
).THE(h[facei], T0[facei]);
}
return tT;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::kappa() const
{
tmp<Foam::volScalarField> kappa(Cp()*this->alpha_);
kappa().rename("kappa");
return kappa;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::kappa
(
const label patchi
) const
{
return
Cp(this->T_.boundaryField()[patchi], patchi)
*this->alpha_.boundaryField()[patchi];
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::kappaEff
(
const volScalarField& alphat
) const
{
tmp<Foam::volScalarField> kappaEff(Cp()*alphaEff(alphat));
kappaEff().rename("kappaEff");
return kappaEff;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::heThermo<BasicThermo, MixtureType>::kappaEff
(
const scalarField& alphat,
const label patchi
) const
{
return
Cp(this->T_.boundaryField()[patchi], patchi)
*alphaEff(alphat, patchi);
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::alphaEff
(
const volScalarField& alphat
) const
{
tmp<Foam::volScalarField> alphaEff(this->CpByCpv()*(this->alpha_ + alphat));
alphaEff().rename("alphaEff");
return alphaEff;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::heThermo<BasicThermo, MixtureType>::alphaEff
(
const scalarField& alphat,
const label patchi
) const
{
return
this->CpByCpv(this->T_.boundaryField()[patchi], patchi)
*(
this->alpha_.boundaryField()[patchi]
+ alphat
);
}
template<class BasicThermo, class MixtureType>
bool Foam::heThermo<BasicThermo, MixtureType>::read()
{
if (BasicThermo::read())
{
MixtureType::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,256 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Class
Foam::heThermo
Description
Enthalpy/Internal energy for a mixture based on compressibility
SourceFiles
heThermo.C
\*---------------------------------------------------------------------------*/
#ifndef heThermo_H
#define heThermo_H
#include "basicMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class heThermo Declaration
\*---------------------------------------------------------------------------*/
template<class BasicThermo, class MixtureType>
class heThermo
:
public BasicThermo,
public MixtureType
{
protected:
// Protected data
//- Energy field
volScalarField he_;
private:
// Private Member Functions
//- Construct as copy (not implemented)
heThermo(const heThermo<BasicThermo, MixtureType>&);
public:
// Constructors
//- Construct from mesh
heThermo(const fvMesh&);
//- Destructor
virtual ~heThermo();
// Member functions
//- Return the compostion of the mixture
virtual typename MixtureType::basicMixtureType&
composition()
{
return *this;
}
//- Return the compostion of the mixture
virtual const typename MixtureType::basicMixtureType&
composition() const
{
return *this;
}
// Access to thermodynamic state variables
//- Enthalpy/Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& he()
{
return he_;
}
//- Enthalpy/Internal energy [J/kg]
virtual const volScalarField& he() const
{
return he_;
}
// Fields derived from thermodynamic state variables
//- Enthalpy/Internal energy for cell-set [J/kg]
virtual tmp<scalarField> he
(
const scalarField& T,
const labelList& cells
) const;
//- Enthalpy/Internal energy for patch [J/kg]
virtual tmp<scalarField> he
(
const scalarField& T,
const label patchi
) const;
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
//- Temperature from enthalpy/internal energy for cell-set
virtual tmp<scalarField> THE
(
const scalarField& he,
const scalarField& T0, // starting temperature
const labelList& cells
) const;
//- Temperature from enthalpy/internal energy for patch
virtual tmp<scalarField> THE
(
const scalarField& he,
const scalarField& T0, // starting temperature
const label patchi
) const;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const;
//- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const;
//- gamma = Cp/Cv []
virtual tmp<volScalarField> gamma() const;
//- gamma = Cp/Cv for patch []
virtual tmp<scalarField> gamma
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure/volume for patch [J/kg/K]
virtual tmp<scalarField> Cpv
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual tmp<volScalarField> Cpv() const;
//- Heat capacity ratio []
virtual tmp<volScalarField> CpByCpv() const;
//- Heat capacity ratio for patch []
virtual tmp<scalarField> CpByCpv
(
const scalarField& T,
const label patchi
) const;
// Fields derived from transport state variables
//- Thermal diffusivity for temperature of mixture [J/m/s/K]
virtual tmp<volScalarField> kappa() const;
//- Thermal diffusivity of mixture for patch [J/m/s/K]
virtual tmp<scalarField> kappa
(
const label patchi
) const;
//- Effective thermal diffusivity of mixture [J/m/s/K]
virtual tmp<volScalarField> kappaEff(const volScalarField&) const;
//- Effective thermal diffusivity of mixture for patch [J/m/s/K]
virtual tmp<scalarField> kappaEff
(
const scalarField& alphat,
const label patchi
) const;
//- Effective thermal diffusivity of mixture [J/m/s/K]
virtual tmp<volScalarField> alphaEff
(
const volScalarField& alphat
) const;
//- Effective thermal diffusivity of mixture for patch [J/m/s/K]
virtual tmp<scalarField> alphaEff
(
const scalarField& alphat,
const label patchi
) const;
//- Read thermophysicalProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "heThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -54,6 +54,10 @@ class basicMixture
public:
//- The base class of the mixture
typedef basicMixture basicMixtureType;
// Runtime type information
TypeName("basicMixture");

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) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,13 +32,15 @@ Description
#include "makeBasicMixture.H"
#include "perfectGas.H"
#include "pressurePerfectGas.H"
#include "incompressible.H"
#include "isobaricPerfectGas.H"
#include "eConstThermo.H"
#include "hConstThermo.H"
#include "janafThermo.H"
#include "sensibleInternalEnergy.H"
#include "sensibleEnthalpy.H"
#include "specieThermo.H"
#include "constTransport.H"
@ -63,6 +65,7 @@ makeBasicMixture
(
pureMixture,
constTransport,
sensibleInternalEnergy,
eConstThermo,
perfectGas
);
@ -71,15 +74,16 @@ makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
eConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
@ -88,6 +92,7 @@ makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
@ -96,6 +101,7 @@ makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
janafThermo,
perfectGas
);
@ -104,6 +110,34 @@ makeBasicMixture
(
pureMixture,
constTransport,
sensibleEnthalpy,
hConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
hConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
janafThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
constTransport,
sensibleEnthalpy,
hConstThermo,
incompressible
);
@ -111,39 +145,46 @@ makeBasicMixture
makeBasicPolyMixture
(
pureMixture,
3
3,
sensibleEnthalpy
);
makeBasicPolyMixture
(
pureMixture,
8
8,
sensibleEnthalpy
);
makeBasicMixture
(
pureMixture,
constTransport,
sensibleEnthalpy,
hConstThermo,
pressurePerfectGas
isobaricPerfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
hConstThermo,
pressurePerfectGas
isobaricPerfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
janafThermo,
pressurePerfectGas
isobaricPerfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -32,20 +32,22 @@ Description
#define makeBasicMixture_H
#include "basicMixture.H"
#include "sensibleEnthalpy.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeBasicMixture(Mixture,Transport,Thermo,EqnOfState) \
#define makeBasicMixture(Mixture,Transport,Type,Thermo,EqnOfState) \
\
typedef Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > \
Mixture##Transport##Thermo##EqnOfState; \
typedef \
Mixture<Transport<specieThermo<Thermo<EqnOfState>, Type> > > \
Mixture##Transport##Type##Thermo##EqnOfState; \
\
defineTemplateTypeNameAndDebugWithName \
(Mixture##Transport##Thermo##EqnOfState, \
#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>", 0)
(Mixture##Transport##Type##Thermo##EqnOfState, \
#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">,"#Type">>>", 0)
#define makeBasicPolyMixture(Mixture,Order) \
#define makeBasicPolyMixture(Mixture,Order,Type) \
\
typedef polynomialTransport \
< \
@ -55,17 +57,18 @@ typedef polynomialTransport \
< \
icoPolynomial<Order>, \
Order \
> \
>, \
Type \
>, \
Order \
> icoPoly##Order##ThermoPhysics; \
> icoPoly##Order##Type##ThermoPhysics; \
\
typedef Mixture<icoPoly##Order##ThermoPhysics> \
Mixture##icoPoly##Order##ThermoPhysics; \
typedef Mixture<icoPoly##Order##Type##ThermoPhysics> \
Mixture##icoPoly##Order##Type##ThermoPhysics; \
\
defineTemplateTypeNameAndDebugWithName \
(Mixture##icoPoly##Order##ThermoPhysics, \
#Mixture"<icoPoly"#Order"ThermoPhysics>", 0)
(Mixture##icoPoly##Order##Type##ThermoPhysics, \
#Mixture"<icoPoly"#Order#Type"ThermoPhysics>", 0)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,72 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
InClass
Foam::basicPsiThermo
Description
Macros for creating 'basic' compresibility-based thermo packages
\*---------------------------------------------------------------------------*/
#ifndef makeBasicPsiThermo_H
#define makeBasicPsiThermo_H
#include "basicPsiThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeBasicPsiThermo(Cthermo,Mixture,Transport,Thermo,EqnOfState) \
\
typedef Cthermo<Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \
Cthermo##Mixture##Transport##Thermo##EqnOfState; \
\
defineTemplateTypeNameAndDebugWithName \
( \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
#Cthermo \
"<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
basicPsiThermo, \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
basicThermo, \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,347 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "ePsiThermo.H"
#include "fvMesh.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::ePsiThermo<MixtureType>::calculate()
{
const scalarField& eCells = e_.internalField();
const scalarField& pCells = this->p_.internalField();
scalarField& TCells = this->T_.internalField();
scalarField& psiCells = this->psi_.internalField();
scalarField& muCells = this->mu_.internalField();
scalarField& alphaCells = this->alpha_.internalField();
forAll(TCells, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);
TCells[celli] = mixture_.TE(eCells[celli], TCells[celli]);
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
muCells[celli] = mixture_.mu(TCells[celli]);
alphaCells[celli] = mixture_.alphae(TCells[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = this->p_.boundaryField()[patchi];
fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi];
fvPatchScalarField& pe = e_.boundaryField()[patchi];
fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi];
if (pT.fixesValue())
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
pe[facei] = mixture_.E(pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphae(pT[facei]);
}
}
else
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
pT[facei] = mixture_.TE(pe[facei], pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphae(pT[facei]);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::ePsiThermo<MixtureType>::ePsiThermo(const fvMesh& mesh)
:
basicPsiThermo(mesh),
MixtureType(*this, mesh),
e_
(
IOobject
(
"e",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->eBoundaryTypes()
)
{
scalarField& eCells = e_.internalField();
const scalarField& TCells = this->T_.internalField();
forAll(eCells, celli)
{
eCells[celli] = this->cellMixture(celli).E(TCells[celli]);
}
forAll(e_.boundaryField(), patchi)
{
e_.boundaryField()[patchi] ==
e(this->T_.boundaryField()[patchi], patchi);
}
this->eBoundaryCorrection(e_);
calculate();
// Switch on saving old time
this->psi_.oldTime();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::ePsiThermo<MixtureType>::~ePsiThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::ePsiThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering ePsiThermo<MixtureType>::correct()" << endl;
}
// force the saving of the old-time values
this->psi_.oldTime();
calculate();
if (debug)
{
Info<< "exiting ePsiThermo<MixtureType>::correct()" << endl;
}
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::ePsiThermo<MixtureType>::e
(
const scalarField& T,
const labelList& cells
) const
{
tmp<scalarField> te(new scalarField(T.size()));
scalarField& h = te();
forAll(T, celli)
{
h[celli] = this->cellMixture(cells[celli]).E(T[celli]);
}
return te;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::ePsiThermo<MixtureType>::e
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> te(new scalarField(T.size()));
scalarField& h = te();
forAll(T, facei)
{
h[facei] = this->patchFaceMixture(patchi, facei).E(T[facei]);
}
return te;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::ePsiThermo<MixtureType>::Cp
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCp(new scalarField(T.size()));
scalarField& cp = tCp();
forAll(T, facei)
{
cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]);
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::ePsiThermo<MixtureType>::Cp() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCp
(
new volScalarField
(
IOobject
(
"Cp",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cp = tCp();
forAll(this->T_, celli)
{
cp[celli] = this->cellMixture(celli).Cp(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
const fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& pCp = cp.boundaryField()[patchi];
forAll(pT, facei)
{
pCp[facei] = this->patchFaceMixture(patchi, facei).Cp(pT[facei]);
}
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::ePsiThermo<MixtureType>::Cv
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCv(new scalarField(T.size()));
scalarField& cv = tCv();
forAll(T, facei)
{
cv[facei] = this->patchFaceMixture(patchi, facei).Cv(T[facei]);
}
return tCv;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::ePsiThermo<MixtureType>::Cv() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCv
(
new volScalarField
(
IOobject
(
"Cv",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cv = tCv();
forAll(this->T_, celli)
{
cv[celli] = this->cellMixture(celli).Cv(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
cv.boundaryField()[patchi] =
Cv(this->T_.boundaryField()[patchi], patchi);
}
return tCv;
}
template<class MixtureType>
bool Foam::ePsiThermo<MixtureType>::read()
{
if (basicPsiThermo::read())
{
MixtureType::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,177 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Class
Foam::ePsiThermo
Description
Internal energy for a mixture based on compressibility
SourceFiles
ePsiThermo.C
\*---------------------------------------------------------------------------*/
#ifndef ePsiThermo_H
#define ePsiThermo_H
#include "basicPsiThermo.H"
#include "basicMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class ePsiThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class ePsiThermo
:
public basicPsiThermo,
public MixtureType
{
// Private data
//- Internal energy field
volScalarField e_;
// Private Member Functions
//- Calculate the thermo variables
void calculate();
//- Construct as copy (not implemented)
ePsiThermo(const ePsiThermo<MixtureType>&);
public:
//- Runtime type information
TypeName("ePsiThermo");
// Constructors
//- Construct from mese
ePsiThermo(const fvMesh&);
//- Destructor
virtual ~ePsiThermo();
// Member functions
//- Return the compostion of the mixture
virtual basicMixture& composition()
{
return *this;
}
//- Return the compostion of the mixture
virtual const basicMixture& composition() const
{
return *this;
}
//- Update properties
virtual void correct();
// Access to thermodynamic state variables
//- Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& e()
{
return e_;
}
//- Internal energy [J/kg]
virtual const volScalarField& e() const
{
return e_;
}
// Fields derived from thermodynamic state variables
//- Internal energy for cell-set [J/kg]
virtual tmp<scalarField> e
(
const scalarField& T,
const labelList& cells
) const;
//- Internal energy for patch [J/kg]
virtual tmp<scalarField> e
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const;
//- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const;
//- Read thermophysicalProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "ePsiThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,99 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "makeBasicPsiThermo.H"
#include "perfectGas.H"
#include "eConstThermo.H"
#include "hConstThermo.H"
#include "janafThermo.H"
#include "specieThermo.H"
#include "constTransport.H"
#include "sutherlandTransport.H"
#include "ePsiThermo.H"
#include "pureMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
makeBasicPsiThermo
(
ePsiThermo,
pureMixture,
constTransport,
eConstThermo,
perfectGas
);
makeBasicPsiThermo
(
ePsiThermo,
pureMixture,
sutherlandTransport,
eConstThermo,
perfectGas
);
makeBasicPsiThermo
(
ePsiThermo,
pureMixture,
constTransport,
hConstThermo,
perfectGas
);
makeBasicPsiThermo
(
ePsiThermo,
pureMixture,
sutherlandTransport,
hConstThermo,
perfectGas
);
makeBasicPsiThermo
(
ePsiThermo,
pureMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,345 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "hPsiThermo.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::hPsiThermo<MixtureType>::calculate()
{
const scalarField& hCells = h_.internalField();
const scalarField& pCells = this->p_.internalField();
scalarField& TCells = this->T_.internalField();
scalarField& psiCells = this->psi_.internalField();
scalarField& muCells = this->mu_.internalField();
scalarField& alphaCells = this->alpha_.internalField();
forAll(TCells, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);
TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]);
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
muCells[celli] = mixture_.mu(TCells[celli]);
alphaCells[celli] = mixture_.alphah(TCells[celli]);
}
forAll(T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = this->p_.boundaryField()[patchi];
fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi];
fvPatchScalarField& ph = h_.boundaryField()[patchi];
fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi];
if (pT.fixesValue())
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
ph[facei] = mixture_.H(pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
else
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
pT[facei] = mixture_.TH(ph[facei], pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hPsiThermo<MixtureType>::hPsiThermo(const fvMesh& mesh)
:
basicPsiThermo(mesh),
MixtureType(*this, mesh),
h_
(
IOobject
(
"h",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->hBoundaryTypes()
)
{
scalarField& hCells = h_.internalField();
const scalarField& TCells = this->T_.internalField();
forAll(hCells, celli)
{
hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
}
forAll(h_.boundaryField(), patchi)
{
h_.boundaryField()[patchi] ==
h(this->T_.boundaryField()[patchi], patchi);
}
hBoundaryCorrection(h_);
calculate();
// Switch on saving old time
this->psi_.oldTime();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hPsiThermo<MixtureType>::~hPsiThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::hPsiThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering hPsiThermo<MixtureType>::correct()" << endl;
}
// force the saving of the old-time values
this->psi_.oldTime();
calculate();
if (debug)
{
Info<< "exiting hPsiThermo<MixtureType>::correct()" << endl;
}
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hPsiThermo<MixtureType>::h
(
const scalarField& T,
const labelList& cells
) const
{
tmp<scalarField> th(new scalarField(T.size()));
scalarField& h = th();
forAll(T, celli)
{
h[celli] = this->cellMixture(cells[celli]).H(T[celli]);
}
return th;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hPsiThermo<MixtureType>::h
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> th(new scalarField(T.size()));
scalarField& h = th();
forAll(T, facei)
{
h[facei] = this->patchFaceMixture(patchi, facei).H(T[facei]);
}
return th;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hPsiThermo<MixtureType>::Cp
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCp(new scalarField(T.size()));
scalarField& cp = tCp();
forAll(T, facei)
{
cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]);
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::hPsiThermo<MixtureType>::Cp() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCp
(
new volScalarField
(
IOobject
(
"Cp",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cp = tCp();
forAll(this->T_, celli)
{
cp[celli] = this->cellMixture(celli).Cp(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
const fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& pCp = cp.boundaryField()[patchi];
forAll(pT, facei)
{
pCp[facei] = this->patchFaceMixture(patchi, facei).Cp(pT[facei]);
}
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hPsiThermo<MixtureType>::Cv
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCv(new scalarField(T.size()));
scalarField& cv = tCv();
forAll(T, facei)
{
cv[facei] = this->patchFaceMixture(patchi, facei).Cv(T[facei]);
}
return tCv;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::hPsiThermo<MixtureType>::Cv() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCv
(
new volScalarField
(
IOobject
(
"Cv",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cv = tCv();
forAll(this->T_, celli)
{
cv[celli] = this->cellMixture(celli).Cv(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
cv.boundaryField()[patchi] =
Cv(this->T_.boundaryField()[patchi], patchi);
}
return tCv;
}
template<class MixtureType>
bool Foam::hPsiThermo<MixtureType>::read()
{
if (basicPsiThermo::read())
{
MixtureType::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,177 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Class
Foam::hPsiThermo
Description
Enthalpy for a mixture based on compressibility
SourceFiles
hPsiThermo.C
\*---------------------------------------------------------------------------*/
#ifndef hPsiThermo_H
#define hPsiThermo_H
#include "basicPsiThermo.H"
#include "basicMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hPsiThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class hPsiThermo
:
public basicPsiThermo,
public MixtureType
{
// Private data
//- Enthalpy field
volScalarField h_;
// Private Member Functions
//- Calculate the thermo variables
void calculate();
//- Construct as copy (not implemented)
hPsiThermo(const hPsiThermo<MixtureType>&);
public:
//- Runtime type information
TypeName("hPsiThermo");
// Constructors
//- Construct from mesh
hPsiThermo(const fvMesh&);
//- Destructor
virtual ~hPsiThermo();
// Member functions
//- Return the compostion of the mixture
virtual basicMixture& composition()
{
return *this;
}
//- Return the compostion of the mixture
virtual const basicMixture& composition() const
{
return *this;
}
//- Update properties
virtual void correct();
// Access to thermodynamic state variables
//- Enthalpy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& h()
{
return h_;
}
//- Enthalpy [J/kg]
virtual const volScalarField& h() const
{
return h_;
}
// Fields derived from thermodynamic state variables
//- Enthalpy for cell-set [J/kg]
virtual tmp<scalarField> h
(
const scalarField& T,
const labelList& cells
) const;
//- Enthalpy for patch [J/kg]
virtual tmp<scalarField> h
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const;
//- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const;
//- Read thermophysicalProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "hPsiThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,79 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "makeBasicPsiThermo.H"
#include "perfectGas.H"
#include "hConstThermo.H"
#include "janafThermo.H"
#include "specieThermo.H"
#include "constTransport.H"
#include "sutherlandTransport.H"
#include "hPsiThermo.H"
#include "pureMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
makeBasicPsiThermo
(
hPsiThermo,
pureMixture,
constTransport,
hConstThermo,
perfectGas
);
makeBasicPsiThermo
(
hPsiThermo,
pureMixture,
sutherlandTransport,
hConstThermo,
perfectGas
);
makeBasicPsiThermo
(
hPsiThermo,
pureMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,139 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "hePsiThermo.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::hePsiThermo<MixtureType>::calculate()
{
const scalarField& hCells = this->he_.internalField();
const scalarField& pCells = this->p_.internalField();
scalarField& TCells = this->T_.internalField();
scalarField& psiCells = this->psi_.internalField();
scalarField& muCells = this->mu_.internalField();
scalarField& alphaCells = this->alpha_.internalField();
forAll(TCells, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);
TCells[celli] = mixture_.THE(hCells[celli], TCells[celli]);
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
muCells[celli] = mixture_.mu(TCells[celli]);
alphaCells[celli] = mixture_.alphah(TCells[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = this->p_.boundaryField()[patchi];
fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi];
fvPatchScalarField& ph = this->he_.boundaryField()[patchi];
fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi];
if (pT.fixesValue())
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
ph[facei] = mixture_.HE(pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
else
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
pT[facei] = mixture_.THE(ph[facei], pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hePsiThermo<MixtureType>::hePsiThermo(const fvMesh& mesh)
:
heThermo<psiThermo, MixtureType>(mesh)
{
calculate();
// Switch on saving old time
this->psi_.oldTime();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hePsiThermo<MixtureType>::~hePsiThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::hePsiThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering hePsiThermo<MixtureType>::correct()" << endl;
}
// force the saving of the old-time values
this->psi_.oldTime();
calculate();
if (debug)
{
Info<< "exiting hePsiThermo<MixtureType>::correct()" << endl;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,100 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Class
Foam::hePsiThermo
Description
Enthalpy for a mixture based on compressibility
SourceFiles
hePsiThermo.C
\*---------------------------------------------------------------------------*/
#ifndef hePsiThermo_H
#define hePsiThermo_H
#include "psiThermo.H"
#include "heThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hePsiThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class hePsiThermo
:
public heThermo<psiThermo, MixtureType>
{
// Private Member Functions
//- Calculate the thermo variables
void calculate();
//- Construct as copy (not implemented)
hePsiThermo(const hePsiThermo<MixtureType>&);
public:
//- Runtime type information
TypeName("hePsiThermo");
// Constructors
//- Construct from mesh
hePsiThermo(const fvMesh&);
//- Destructor
virtual ~hePsiThermo();
// Member functions
//- Update properties
virtual void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "hePsiThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -23,19 +23,21 @@ License
\*---------------------------------------------------------------------------*/
#include "makeBasicRhoThermo.H"
#include "makePsiThermo.H"
#include "perfectGas.H"
#include "pressurePerfectGas.H"
#include "hConstThermo.H"
#include "eConstThermo.H"
#include "janafThermo.H"
#include "sensibleEnthalpy.H"
#include "sensibleInternalEnergy.H"
#include "specieThermo.H"
#include "constTransport.H"
#include "sutherlandTransport.H"
#include "hsRhoThermo.H"
#include "hePsiThermo.H"
#include "pureMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,62 +45,92 @@ License
namespace Foam
{
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * Enthalpy-based * * * * * * * * * * * * * */
makeBasicRhoThermo
makePsiThermo
(
hsRhoThermo,
hePsiThermo,
pureMixture,
constTransport,
sensibleEnthalpy,
hConstThermo,
perfectGas
);
makeBasicRhoThermo
makePsiThermo
(
hsRhoThermo,
hePsiThermo,
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
hConstThermo,
perfectGas
);
makeBasicRhoThermo
makePsiThermo
(
hsRhoThermo,
hePsiThermo,
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
janafThermo,
perfectGas
);
makeBasicRhoThermo
/* * * * * * * * * * * * * * Internal-energy-based * * * * * * * * * * * * * */
makePsiThermo
(
hsRhoThermo,
hePsiThermo,
pureMixture,
constTransport,
hConstThermo,
pressurePerfectGas
sensibleInternalEnergy,
eConstThermo,
perfectGas
);
makeBasicRhoThermo
makePsiThermo
(
hsRhoThermo,
hePsiThermo,
pureMixture,
sutherlandTransport,
hConstThermo,
pressurePerfectGas
sensibleInternalEnergy,
eConstThermo,
perfectGas
);
makeBasicRhoThermo
makePsiThermo
(
hsRhoThermo,
hePsiThermo,
pureMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
makePsiThermo
(
hePsiThermo,
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
makePsiThermo
(
hePsiThermo,
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
janafThermo,
pressurePerfectGas
perfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -1,345 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "hsPsiThermo.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::hsPsiThermo<MixtureType>::calculate()
{
const scalarField& hsCells = hs_.internalField();
const scalarField& pCells = this->p_.internalField();
scalarField& TCells = this->T_.internalField();
scalarField& psiCells = this->psi_.internalField();
scalarField& muCells = this->mu_.internalField();
scalarField& alphaCells = this->alpha_.internalField();
forAll(TCells, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);
TCells[celli] = mixture_.THs(hsCells[celli], TCells[celli]);
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
muCells[celli] = mixture_.mu(TCells[celli]);
alphaCells[celli] = mixture_.alphah(TCells[celli]);
}
forAll(T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = this->p_.boundaryField()[patchi];
fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi];
fvPatchScalarField& phs = hs_.boundaryField()[patchi];
fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi];
if (pT.fixesValue())
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
phs[facei] = mixture_.Hs(pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
else
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
pT[facei] = mixture_.THs(phs[facei], pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hsPsiThermo<MixtureType>::hsPsiThermo(const fvMesh& mesh)
:
basicPsiThermo(mesh),
MixtureType(*this, mesh),
hs_
(
IOobject
(
"hs",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->hBoundaryTypes()
)
{
scalarField& hsCells = hs_.internalField();
const scalarField& TCells = this->T_.internalField();
forAll(hsCells, celli)
{
hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]);
}
forAll(hs_.boundaryField(), patchi)
{
hs_.boundaryField()[patchi] ==
hs(this->T_.boundaryField()[patchi], patchi);
}
hBoundaryCorrection(hs_);
calculate();
// Switch on saving old time
this->psi_.oldTime();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hsPsiThermo<MixtureType>::~hsPsiThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::hsPsiThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering hsPsiThermo<MixtureType>::correct()" << endl;
}
// force the saving of the old-time values
this->psi_.oldTime();
calculate();
if (debug)
{
Info<< "exiting hsPsiThermo<MixtureType>::correct()" << endl;
}
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hsPsiThermo<MixtureType>::hs
(
const scalarField& T,
const labelList& cells
) const
{
tmp<scalarField> ths(new scalarField(T.size()));
scalarField& hs = ths();
forAll(T, celli)
{
hs[celli] = this->cellMixture(cells[celli]).Hs(T[celli]);
}
return ths;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hsPsiThermo<MixtureType>::hs
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> ths(new scalarField(T.size()));
scalarField& hs = ths();
forAll(T, facei)
{
hs[facei] = this->patchFaceMixture(patchi, facei).Hs(T[facei]);
}
return ths;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hsPsiThermo<MixtureType>::Cp
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCp(new scalarField(T.size()));
scalarField& cp = tCp();
forAll(T, facei)
{
cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]);
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::hsPsiThermo<MixtureType>::Cp() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCp
(
new volScalarField
(
IOobject
(
"Cp",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cp = tCp();
forAll(this->T_, celli)
{
cp[celli] = this->cellMixture(celli).Cp(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
const fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& pCp = cp.boundaryField()[patchi];
forAll(pT, facei)
{
pCp[facei] = this->patchFaceMixture(patchi, facei).Cp(pT[facei]);
}
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hsPsiThermo<MixtureType>::Cv
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCv(new scalarField(T.size()));
scalarField& cv = tCv();
forAll(T, facei)
{
cv[facei] = this->patchFaceMixture(patchi, facei).Cv(T[facei]);
}
return tCv;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::hsPsiThermo<MixtureType>::Cv() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCv
(
new volScalarField
(
IOobject
(
"Cv",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cv = tCv();
forAll(this->T_, celli)
{
cv[celli] = this->cellMixture(celli).Cv(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
cv.boundaryField()[patchi] =
Cv(this->T_.boundaryField()[patchi], patchi);
}
return tCv;
}
template<class MixtureType>
bool Foam::hsPsiThermo<MixtureType>::read()
{
if (basicPsiThermo::read())
{
MixtureType::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,177 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Class
Foam::hsPsiThermo
Description
Sensible enthalpy for a mixture based on compressibility
SourceFiles
hsPsiThermo.C
\*---------------------------------------------------------------------------*/
#ifndef hsPsiThermo_H
#define hsPsiThermo_H
#include "basicPsiThermo.H"
#include "basicMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hsPsiThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class hsPsiThermo
:
public basicPsiThermo,
public MixtureType
{
// Private data
//- Sensible enthalpy field [J/kg]
volScalarField hs_;
// Private Member Functions
//- Calculate the thermo variables
void calculate();
//- Construct as copy (not implemented)
hsPsiThermo(const hsPsiThermo<MixtureType>&);
public:
//- Runtime type information
TypeName("hsPsiThermo");
// Constructors
//- Construct from mesh
hsPsiThermo(const fvMesh&);
//- Destructor
virtual ~hsPsiThermo();
// Member functions
//- Return the compostion of the mixture
virtual basicMixture& composition()
{
return *this;
}
//- Return the compostion of the mixture
virtual const basicMixture& composition() const
{
return *this;
}
//- Update properties
virtual void correct();
// Access to thermodynamic state variables
//- Sensible enthalpy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& hs()
{
return hs_;
}
//- Sensible enthalpy [J/kg]
virtual const volScalarField& hs() const
{
return hs_;
}
// Fields derived from thermodynamic state variables
//- 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;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const;
//- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const;
//- Read thermophysicalProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "hsPsiThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,79 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "makeBasicPsiThermo.H"
#include "perfectGas.H"
#include "hConstThermo.H"
#include "janafThermo.H"
#include "specieThermo.H"
#include "constTransport.H"
#include "sutherlandTransport.H"
#include "hsPsiThermo.H"
#include "pureMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
makeBasicPsiThermo
(
hsPsiThermo,
pureMixture,
constTransport,
hConstThermo,
perfectGas
);
makeBasicPsiThermo
(
hsPsiThermo,
pureMixture,
sutherlandTransport,
hConstThermo,
perfectGas
);
makeBasicPsiThermo
(
hsPsiThermo,
pureMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

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
@ -22,70 +22,71 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::hReactionThermo
Foam::psiThermo
Description
Macros for creating 'basic' compresibility-based thermo packages
\*---------------------------------------------------------------------------*/
#ifndef makeReactionThermo_H
#define makeReactionThermo_H
#ifndef makePsiThermo_H
#define makePsiThermo_H
#include "psiThermo.H"
#include "addToRunTimeSelectionTable.H"
#include "basicRhoThermo.H"
#include "sensibleEnthalpy.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeHsReactionThermo(CThermo,MixtureThermo,Mixture,Transport,Thermo,EqnOfState)\
#define makePsiThermo(Cthermo,Mixture,Transport,Type,Thermo,EqnOfState) \
\
typedef MixtureThermo \
<Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState; \
typedef Cthermo \
< \
Mixture \
< \
Transport \
< \
specieThermo \
< \
Thermo \
< \
EqnOfState \
>, \
Type \
> \
> \
> \
> Cthermo##Mixture##Transport##Type##Thermo##EqnOfState; \
\
defineTemplateTypeNameAndDebugWithName \
( \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
#MixtureThermo \
"<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", \
Cthermo##Mixture##Transport##Type##Thermo##EqnOfState, \
#Cthermo \
"<" \
#Mixture \
"<" \
#Transport \
"<specieThermo<" \
#Thermo \
"<" \
#EqnOfState \
">," \
#Type \
">>>>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
basicRhoThermo, \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
psiThermo, \
Cthermo##Mixture##Transport##Type##Thermo##EqnOfState, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
CThermo, \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
)
#define makeHsReactionMixtureThermo(CThermo,MixtureThermo,Mixture,ThermoPhys) \
\
typedef MixtureThermo<Mixture<ThermoPhys> > \
MixtureThermo##Mixture##ThermoPhys; \
\
defineTemplateTypeNameAndDebugWithName \
( \
MixtureThermo##Mixture##ThermoPhys, \
#MixtureThermo"<"#Mixture"<"#ThermoPhys">>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
basicRhoThermo, \
MixtureThermo##Mixture##ThermoPhys, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
CThermo, \
MixtureThermo##Mixture##ThermoPhys, \
basicThermo, \
Cthermo##Mixture##Transport##Type##Thermo##EqnOfState, \
fvMesh \
);

View File

@ -23,20 +23,20 @@ License
\*---------------------------------------------------------------------------*/
#include "basicPsiThermo.H"
#include "psiThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(basicPsiThermo, 0);
defineRunTimeSelectionTable(basicPsiThermo, fvMesh);
defineTypeNameAndDebug(psiThermo, 0);
defineRunTimeSelectionTable(psiThermo, fvMesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicPsiThermo::basicPsiThermo(const fvMesh& mesh)
Foam::psiThermo::psiThermo(const fvMesh& mesh)
:
basicThermo(mesh)
{}
@ -44,7 +44,7 @@ Foam::basicPsiThermo::basicPsiThermo(const fvMesh& mesh)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::basicPsiThermo::~basicPsiThermo()
Foam::psiThermo::~psiThermo()
{}

View File

@ -22,19 +22,19 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicPsiThermo
Foam::psiThermo
Description
Basic thermodynamic properties based on compressibility
SourceFiles
basicPsiThermo.C
basicPsiThermoNew.C
psiThermo.C
psiThermoNew.C
\*---------------------------------------------------------------------------*/
#ifndef basicPsiThermo_H
#define basicPsiThermo_H
#ifndef psiThermo_H
#define psiThermo_H
#include "basicThermo.H"
#include "runTimeSelectionTables.H"
@ -45,10 +45,10 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicPsiThermo Declaration
Class psiThermo Declaration
\*---------------------------------------------------------------------------*/
class basicPsiThermo
class psiThermo
:
public basicThermo
{
@ -58,36 +58,38 @@ protected:
// Protected Member Functions
//- Construct as copy (not implemented)
basicPsiThermo(const basicPsiThermo&);
psiThermo(const psiThermo&);
public:
//- Runtime type information
TypeName("basicPsiThermo");
TypeName("psiThermo");
//- Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
basicPsiThermo,
psiThermo,
fvMesh,
(const fvMesh& mesh),
(mesh)
);
// Constructors
//- Construct from mesh
basicPsiThermo(const fvMesh&);
psiThermo(const fvMesh&);
//- Selector
static autoPtr<basicPsiThermo> New(const fvMesh&);
static autoPtr<psiThermo> New(const fvMesh&);
//- Destructor
virtual ~basicPsiThermo();
virtual ~psiThermo();
// Member functions

View File

@ -23,11 +23,11 @@ License
\*---------------------------------------------------------------------------*/
#include "basicPsiThermo.H"
#include "psiThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::basicPsiThermo> Foam::basicPsiThermo::New
Foam::autoPtr<Foam::psiThermo> Foam::psiThermo::New
(
const fvMesh& mesh
)
@ -57,14 +57,14 @@ Foam::autoPtr<Foam::basicPsiThermo> Foam::basicPsiThermo::New
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn("basicPsiThermo::New(const fvMesh&)")
<< "Unknown basicPsiThermo type " << modelType << nl << nl
<< "Valid basicPsiThermo types are:" << nl
FatalErrorIn("psiThermo::New(const fvMesh&)")
<< "Unknown psiThermo type " << modelType << nl << nl
<< "Valid psiThermo types are:" << nl
<< fvMeshConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
return autoPtr<basicPsiThermo>(cstrIter()(mesh));
return autoPtr<psiThermo>(cstrIter()(mesh));
}

View File

@ -1,388 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "hRhoThermo.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::hRhoThermo<MixtureType>::calculate()
{
const scalarField& hCells = this->h_.internalField();
const scalarField& pCells = this->p_.internalField();
scalarField& TCells = this->T_.internalField();
scalarField& psiCells = this->psi_.internalField();
scalarField& rhoCells = this->rho_.internalField();
scalarField& muCells = this->mu_.internalField();
scalarField& alphaCells = this->alpha_.internalField();
forAll(TCells, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);
TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]);
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
rhoCells[celli] = mixture_.rho(pCells[celli], TCells[celli]);
muCells[celli] = mixture_.mu(TCells[celli]);
alphaCells[celli] = mixture_.alphah(TCells[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = this->p_.boundaryField()[patchi];
fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi];
fvPatchScalarField& prho = this->rho_.boundaryField()[patchi];
fvPatchScalarField& ph = this->h_.boundaryField()[patchi];
fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi];
if (pT.fixesValue())
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
ph[facei] = mixture_.H(pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
prho[facei] = mixture_.rho(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
else
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
pT[facei] = mixture_.TH(ph[facei], pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
prho[facei] = mixture_.rho(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hRhoThermo<MixtureType>::hRhoThermo(const fvMesh& mesh)
:
basicRhoThermo(mesh),
MixtureType(*this, mesh),
h_
(
IOobject
(
"h",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->hBoundaryTypes()
)
{
scalarField& hCells = h_.internalField();
const scalarField& TCells = this->T_.internalField();
forAll(hCells, celli)
{
hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
}
forAll(h_.boundaryField(), patchi)
{
h_.boundaryField()[patchi] ==
h(this->T_.boundaryField()[patchi], patchi);
}
hBoundaryCorrection(h_);
calculate();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hRhoThermo<MixtureType>::~hRhoThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::hRhoThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering hRhoThermo<MixtureType>::correct()" << endl;
}
calculate();
if (debug)
{
Info<< "exiting hRhoThermo<MixtureType>::correct()" << endl;
}
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hRhoThermo<MixtureType>::h
(
const scalarField& T,
const labelList& cells
) const
{
tmp<scalarField> th(new scalarField(T.size()));
scalarField& h = th();
forAll(T, celli)
{
h[celli] = this->cellMixture(cells[celli]).H(T[celli]);
}
return th;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hRhoThermo<MixtureType>::h
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> th(new scalarField(T.size()));
scalarField& h = th();
forAll(T, facei)
{
h[facei] = this->patchFaceMixture(patchi, facei).H(T[facei]);
}
return th;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hRhoThermo<MixtureType>::TH
(
const scalarField& h,
const scalarField& T0,
const labelList& cells
) const
{
tmp<scalarField> tT(new scalarField(h.size()));
scalarField& T = tT();
forAll(h, celli)
{
T[celli] = this->cellMixture(cells[celli]).TH(h[celli], T0[celli]);
}
return tT;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hRhoThermo<MixtureType>::TH
(
const scalarField& h,
const scalarField& T0,
const label patchi
) const
{
tmp<scalarField> tT(new scalarField(h.size()));
scalarField& T = tT();
forAll(h, facei)
{
T[facei] = this->patchFaceMixture
(
patchi,
facei
).TH(h[facei], T0[facei]);
}
return tT;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hRhoThermo<MixtureType>::Cp
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCp(new scalarField(T.size()));
scalarField& cp = tCp();
forAll(T, facei)
{
cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]);
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::hRhoThermo<MixtureType>::Cp() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCp
(
new volScalarField
(
IOobject
(
"Cp",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cp = tCp();
forAll(this->T_, celli)
{
cp[celli] = this->cellMixture(celli).Cp(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
const fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& pCp = cp.boundaryField()[patchi];
forAll(pT, facei)
{
pCp[facei] = this->patchFaceMixture(patchi, facei).Cp(pT[facei]);
}
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hRhoThermo<MixtureType>::Cv
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCv(new scalarField(T.size()));
scalarField& cv = tCv();
forAll(T, facei)
{
cv[facei] = this->patchFaceMixture(patchi, facei).Cv(T[facei]);
}
return tCv;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::hRhoThermo<MixtureType>::Cv() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCv
(
new volScalarField
(
IOobject
(
"Cv",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cv = tCv();
forAll(this->T_, celli)
{
cv[celli] = this->cellMixture(celli).Cv(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
cv.boundaryField()[patchi] =
Cv(this->T_.boundaryField()[patchi], patchi);
}
return tCv;
}
template<class MixtureType>
bool Foam::hRhoThermo<MixtureType>::read()
{
if (basicRhoThermo::read())
{
MixtureType::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,193 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
Class
Foam::hRhoThermo
Description
Enthalpy for a mixture based on density
SourceFiles
hRhoThermo.C
\*---------------------------------------------------------------------------*/
#ifndef hRhoThermo_H
#define hRhoThermo_H
#include "basicRhoThermo.H"
#include "basicMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hRhoThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class hRhoThermo
:
public basicRhoThermo,
public MixtureType
{
// Private data
//- Enthalpy field
volScalarField h_;
// Private Member Functions
//- Calculate the thermo variables
void calculate();
//- Construct as copy (not implemented)
hRhoThermo(const hRhoThermo<MixtureType>&);
public:
//- Runtime type information
TypeName("hRhoThermo");
// Constructors
//- Construct from mesh
hRhoThermo(const fvMesh&);
//- Destructor
virtual ~hRhoThermo();
// Member functions
//- Return the compostion of the combustion mixture
virtual basicMixture& composition()
{
return *this;
}
//- Return the compostion of the combustion mixture
virtual const basicMixture& composition() const
{
return *this;
}
//- Update properties
virtual void correct();
// Access to thermodynamic state variables
//- Enthalpy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& h()
{
return h_;
}
//- Enthalpy [J/kg]
virtual const volScalarField& h() const
{
return h_;
}
// Fields derived from thermodynamic state variables
//- Enthalpy for cell-set [J/kg]
virtual tmp<scalarField> h
(
const scalarField& T,
const labelList& cells
) const;
//- Enthalpy for patch [J/kg]
virtual tmp<scalarField> h
(
const scalarField& T,
const label patchi
) const;
//- Temperature from enthalpy for cell-set
virtual tmp<scalarField> TH
(
const scalarField& h,
const scalarField& T0, // starting temperature
const labelList& cells
) const;
//- Temperature from enthalpy for patch
virtual tmp<scalarField> TH
(
const scalarField& h,
const scalarField& T0, // starting temperature
const label patchi
) const;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const;
//- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const;
//- Read thermophysicalProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "hRhoThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,138 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "heRhoThermo.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::heRhoThermo<MixtureType>::calculate()
{
const scalarField& hCells = this->he().internalField();
const scalarField& pCells = this->p_.internalField();
scalarField& TCells = this->T_.internalField();
scalarField& psiCells = this->psi_.internalField();
scalarField& rhoCells = this->rho_.internalField();
scalarField& muCells = this->mu_.internalField();
scalarField& alphaCells = this->alpha_.internalField();
forAll(TCells, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);
TCells[celli] = mixture_.THE(hCells[celli], TCells[celli]);
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
rhoCells[celli] = mixture_.rho(pCells[celli], TCells[celli]);
muCells[celli] = mixture_.mu(TCells[celli]);
alphaCells[celli] = mixture_.alphah(TCells[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = this->p_.boundaryField()[patchi];
fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi];
fvPatchScalarField& prho = this->rho_.boundaryField()[patchi];
fvPatchScalarField& ph = this->he().boundaryField()[patchi];
fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi];
if (pT.fixesValue())
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
ph[facei] = mixture_.HE(pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
prho[facei] = mixture_.rho(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
else
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
pT[facei] = mixture_.THE(ph[facei], pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
prho[facei] = mixture_.rho(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::heRhoThermo<MixtureType>::heRhoThermo(const fvMesh& mesh)
:
heThermo<rhoThermo, MixtureType>(mesh)
{
calculate();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::heRhoThermo<MixtureType>::~heRhoThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::heRhoThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering heRhoThermo<MixtureType>::correct()" << endl;
}
calculate();
if (debug)
{
Info<< "exiting heRhoThermo<MixtureType>::correct()" << endl;
}
}
// ************************************************************************* //

View File

@ -22,28 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::speciesTransport
Foam::heRhoThermo
Description
Basic species transport type based on the use of a fitting
function for nu.
All other properties are derived from this primitive function.
The nu function must be provided by the derived type,
e.g. SutherlandTransport.
Enthalpy for a mixture based on density
SourceFiles
speciesTransportI.H
speciesTransport.C
heRhoThermo.C
\*---------------------------------------------------------------------------*/
#ifndef speciesTransport_H
#define speciesTransport_H
#ifndef heRhoThermo_H
#define heRhoThermo_H
//#include "speciesThermo.H"
#include "janafThermo.H"
#include "rhoThermo.H"
#include "heThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,52 +44,43 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class speciesTransport Declaration
Class heRhoThermo Declaration
\*---------------------------------------------------------------------------*/
class speciesTransport
template<class MixtureType>
class heRhoThermo
:
public janafThermo
public heThermo<rhoThermo, MixtureType>
{
// Private Member Functions
//- Calculate the thermo variables
void calculate();
//- Construct as copy (not implemented)
heRhoThermo(const heRhoThermo<MixtureType>&);
public:
//- Runtime type information
TypeName("heRhoThermo");
// Constructors
//- Construct from speciesThermo
inline speciesTransport(const janafThermo& sThermo);
//- Construct from Istream
speciesTransport(Istream&);
//- Construct from dictionary
speciesTransport(const dictionary& dict);
//- Construct from mesh
heRhoThermo(const fvMesh&);
// Member Functions
// Dynamic viscosity [kg/ms]
//inline scalar mu(const scalar T) const
// Thermal conductivity [W/mK]
//inline scalar kappa(const scalar T) const;
// Thermal diffusivity for internal energy [kg/ms]
//inline scalar alphae(const scalar T) const;
// Thermal diffusivity for enthalpy [kg/ms]
//inline scalar alphah(const scalar T) const;
// Species diffusivity
//inline scalar D(const scalar T) const;
//- Write to Ostream
void write(Ostream& os) const;
//- Destructor
virtual ~heRhoThermo();
// Ostream Operator
// Member functions
friend Ostream& operator<<(Ostream&, const speciesTransport&);
//- Update properties
virtual void correct();
};
@ -104,9 +88,11 @@ public:
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#include "speciesTransportI.H"
#ifdef NoRepository
# include "heRhoThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,14 +23,16 @@ License
\*---------------------------------------------------------------------------*/
#include "makeBasicRhoThermo.H"
#include "makeRhoThermo.H"
#include "perfectGas.H"
#include "pressurePerfectGas.H"
#include "isobaricPerfectGas.H"
#include "incompressible.H"
#include "hConstThermo.H"
#include "janafThermo.H"
#include "sensibleEnthalpy.H"
#include "sensibleInternalEnergy.H"
#include "specieThermo.H"
#include "constTransport.H"
@ -40,7 +42,7 @@ License
#include "hPolynomialThermo.H"
#include "polynomialTransport.H"
#include "hRhoThermo.H"
#include "heRhoThermo.H"
#include "pureMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,81 +52,90 @@ namespace Foam
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
makeBasicRhoThermo
makeRhoThermo
(
hRhoThermo,
heRhoThermo,
pureMixture,
constTransport,
sensibleEnthalpy,
hConstThermo,
perfectGas
);
makeBasicRhoThermo
makeRhoThermo
(
hRhoThermo,
heRhoThermo,
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
hConstThermo,
perfectGas
);
makeBasicRhoThermo
makeRhoThermo
(
hRhoThermo,
heRhoThermo,
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
janafThermo,
perfectGas
);
makeBasicRhoThermo
makeRhoThermo
(
hRhoThermo,
heRhoThermo,
pureMixture,
constTransport,
sensibleEnthalpy,
hConstThermo,
incompressible
);
makeBasicRhoPolyThermo
makeRhoPolyThermo
(
hRhoThermo,
heRhoThermo,
pureMixture,
3
3,
sensibleEnthalpy
);
makeBasicRhoPolyThermo
makeRhoPolyThermo
(
hRhoThermo,
heRhoThermo,
pureMixture,
8
8,
sensibleEnthalpy
);
makeBasicRhoThermo
makeRhoThermo
(
hRhoThermo,
heRhoThermo,
pureMixture,
constTransport,
sensibleEnthalpy,
hConstThermo,
pressurePerfectGas
isobaricPerfectGas
);
makeBasicRhoThermo
makeRhoThermo
(
hRhoThermo,
heRhoThermo,
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
hConstThermo,
pressurePerfectGas
isobaricPerfectGas
);
makeBasicRhoThermo
makeRhoThermo
(
hRhoThermo,
heRhoThermo,
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
janafThermo,
pressurePerfectGas
isobaricPerfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,344 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "hsRhoThermo.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::hsRhoThermo<MixtureType>::calculate()
{
const scalarField& hsCells = this->hs_.internalField();
const scalarField& pCells = this->p_.internalField();
scalarField& TCells = this->T_.internalField();
scalarField& psiCells = this->psi_.internalField();
scalarField& rhoCells = this->rho_.internalField();
scalarField& muCells = this->mu_.internalField();
scalarField& alphaCells = this->alpha_.internalField();
forAll(TCells, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);
TCells[celli] = mixture_.THs(hsCells[celli], TCells[celli]);
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
rhoCells[celli] = mixture_.rho(pCells[celli], TCells[celli]);
muCells[celli] = mixture_.mu(TCells[celli]);
alphaCells[celli] = mixture_.alphah(TCells[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = this->p_.boundaryField()[patchi];
fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi];
fvPatchScalarField& prho = this->rho_.boundaryField()[patchi];
fvPatchScalarField& phs = this->hs_.boundaryField()[patchi];
fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi];
if (pT.fixesValue())
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
phs[facei] = mixture_.Hs(pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
prho[facei] = mixture_.rho(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
else
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
pT[facei] = mixture_.THs(phs[facei], pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
prho[facei] = mixture_.rho(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alphah(pT[facei]);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hsRhoThermo<MixtureType>::hsRhoThermo(const fvMesh& mesh)
:
basicRhoThermo(mesh),
MixtureType(*this, mesh),
hs_
(
IOobject
(
"hs",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->hBoundaryTypes()
)
{
scalarField& hsCells = hs_.internalField();
const scalarField& TCells = this->T_.internalField();
forAll(hsCells, celli)
{
hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]);
}
forAll(hs_.boundaryField(), patchi)
{
hs_.boundaryField()[patchi] ==
hs(this->T_.boundaryField()[patchi], patchi);
}
hBoundaryCorrection(hs_);
calculate();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hsRhoThermo<MixtureType>::~hsRhoThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::hsRhoThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering hsRhoThermo<MixtureType>::correct()" << endl;
}
calculate();
if (debug)
{
Info<< "exiting hsRhoThermo<MixtureType>::correct()" << endl;
}
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hsRhoThermo<MixtureType>::hs
(
const scalarField& T,
const labelList& cells
) const
{
tmp<scalarField> ths(new scalarField(T.size()));
scalarField& hs = ths();
forAll(T, celli)
{
hs[celli] = this->cellMixture(cells[celli]).Hs(T[celli]);
}
return ths;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hsRhoThermo<MixtureType>::hs
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> ths(new scalarField(T.size()));
scalarField& hs = ths();
forAll(T, facei)
{
hs[facei] = this->patchFaceMixture(patchi, facei).Hs(T[facei]);
}
return ths;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hsRhoThermo<MixtureType>::Cp
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCp(new scalarField(T.size()));
scalarField& cp = tCp();
forAll(T, facei)
{
cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]);
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::hsRhoThermo<MixtureType>::Cp() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCp
(
new volScalarField
(
IOobject
(
"Cp",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cp = tCp();
forAll(this->T_, celli)
{
cp[celli] = this->cellMixture(celli).Cp(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
const fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& pCp = cp.boundaryField()[patchi];
forAll(pT, facei)
{
pCp[facei] = this->patchFaceMixture(patchi, facei).Cp(pT[facei]);
}
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hsRhoThermo<MixtureType>::Cv
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCv(new scalarField(T.size()));
scalarField& cv = tCv();
forAll(T, facei)
{
cv[facei] = this->patchFaceMixture(patchi, facei).Cv(T[facei]);
}
return tCv;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::hsRhoThermo<MixtureType>::Cv() const
{
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCv
(
new volScalarField
(
IOobject
(
"Cv",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cv = tCv();
forAll(this->T_, celli)
{
cv[celli] = this->cellMixture(celli).Cv(this->T_[celli]);
}
forAll(this->T_.boundaryField(), patchi)
{
cv.boundaryField()[patchi] =
Cv(this->T_.boundaryField()[patchi], patchi);
}
return tCv;
}
template<class MixtureType>
bool Foam::hsRhoThermo<MixtureType>::read()
{
if (basicRhoThermo::read())
{
MixtureType::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,177 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Class
Foam::hsRhoThermo
Description
Sensible enthalpy for a mixture based on density
SourceFiles
hsRhoThermo.C
\*---------------------------------------------------------------------------*/
#ifndef hsRhoThermo_H
#define hsRhoThermo_H
#include "basicRhoThermo.H"
#include "basicMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hsRhoThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class hsRhoThermo
:
public basicRhoThermo,
public MixtureType
{
// Private data
//- Sensible enthalpy field [J/kg]
volScalarField hs_;
// Private Member Functions
//- Calculate the thermo variables
void calculate();
//- Construct as copy (not implemented)
hsRhoThermo(const hsRhoThermo<MixtureType>&);
public:
//- Runtime type information
TypeName("hsRhoThermo");
// Constructors
//- Construct from mesh
hsRhoThermo(const fvMesh&);
//- Destructor
virtual ~hsRhoThermo();
// Member functions
//- Return the compostion of the combustion mixture
virtual basicMixture& composition()
{
return *this;
}
//- Return the compostion of the combustion mixture
virtual const basicMixture& composition() const
{
return *this;
}
//- Update properties
virtual void correct();
// Access to thermodynamic state variables
//- Sensible enthalpy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& hs()
{
return hs_;
}
//- Sensible enthalpy [J/kg]
virtual const volScalarField& hs() const
{
return hs_;
}
// Fields derived from thermodynamic state variables
//- Sensible enthalpy for cell-set [J/kg]
virtual tmp<scalarField> hs
(
const scalarField& T,
const labelList& cells
) const;
//- Sensible enthalpy for patch [J/kg]
virtual tmp<scalarField> hs
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const;
//- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const;
//- Read thermophysicalProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "hsRhoThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -22,50 +22,75 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::basicRhoThermo
Foam::rhoThermo
Description
Macros for creating 'basic' density-based thermo packages
\*---------------------------------------------------------------------------*/
#ifndef makeBasicRhoThermo_H
#define makeBasicRhoThermo_H
#ifndef makeRhoThermo_H
#define makeRhoThermo_H
#include "basicRhoThermo.H"
#include "rhoThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeBasicRhoThermo(Cthermo,Mixture,Transport,Thermo,EqnOfState) \
#define makeRhoThermo(Cthermo,Mixture,Transport,Type,Thermo,EqnOfState) \
\
typedef Cthermo<Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \
Cthermo##Mixture##Transport##Thermo##EqnOfState; \
typedef Cthermo \
< \
Mixture \
< \
Transport \
< \
specieThermo \
< \
Thermo \
< \
EqnOfState \
>, \
Type \
> \
> \
> \
> Cthermo##Mixture##Transport##Type##Thermo##EqnOfState; \
\
defineTemplateTypeNameAndDebugWithName \
( \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
Cthermo##Mixture##Transport##Type##Thermo##EqnOfState, \
#Cthermo \
"<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", \
"<" \
#Mixture \
"<" \
#Transport \
"<specieThermo<" \
#Thermo \
"<" \
#EqnOfState \
">," \
#Type \
">>>>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
basicRhoThermo, \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
rhoThermo, \
Cthermo##Mixture##Transport##Type##Thermo##EqnOfState, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
basicThermo, \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
Cthermo##Mixture##Transport##Type##Thermo##EqnOfState, \
fvMesh \
);
#define makeBasicRhoPolyThermo(Cthermo,Mixture,Order) \
#define makeRhoPolyThermo(Cthermo,Mixture,Order,Type) \
\
typedef polynomialTransport \
< \
@ -75,32 +100,33 @@ typedef polynomialTransport \
< \
icoPolynomial<Order>, \
Order \
> \
>, \
Type \
>, \
Order \
> icoPoly##Order##ThermoPhysics; \
> icoPoly##Order##Type##ThermoPhysics; \
\
typedef Cthermo<Mixture<icoPoly##Order##ThermoPhysics> > \
Cthermo##Mixture##icoPoly##Order##ThermoPhysics; \
typedef Cthermo<Mixture<icoPoly##Order##Type##ThermoPhysics> > \
Cthermo##Mixture##icoPoly##Order##Type##ThermoPhysics; \
\
defineTemplateTypeNameAndDebugWithName \
( \
Cthermo##Mixture##icoPoly##Order##ThermoPhysics, \
#Cthermo"<"#Mixture"<icoPoly"#Order"ThermoPhysics>>", \
Cthermo##Mixture##icoPoly##Order##Type##ThermoPhysics, \
#Cthermo"<"#Mixture"<icoPoly"#Order#Type"ThermoPhysics>>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
basicRhoThermo, \
Cthermo##Mixture##icoPoly##Order##ThermoPhysics, \
rhoThermo, \
Cthermo##Mixture##icoPoly##Order##Type##ThermoPhysics, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
basicThermo, \
Cthermo##Mixture##icoPoly##Order##ThermoPhysics, \
Cthermo##Mixture##icoPoly##Order##Type##ThermoPhysics, \
fvMesh \
);

View File

@ -23,20 +23,20 @@ License
\*---------------------------------------------------------------------------*/
#include "basicRhoThermo.H"
#include "rhoThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(basicRhoThermo, 0);
defineRunTimeSelectionTable(basicRhoThermo, fvMesh);
defineTypeNameAndDebug(rhoThermo, 0);
defineRunTimeSelectionTable(rhoThermo, fvMesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicRhoThermo::basicRhoThermo(const fvMesh& mesh)
Foam::rhoThermo::rhoThermo(const fvMesh& mesh)
:
basicThermo(mesh),
rho_
@ -57,19 +57,19 @@ Foam::basicRhoThermo::basicRhoThermo(const fvMesh& mesh)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::basicRhoThermo::~basicRhoThermo()
Foam::rhoThermo::~rhoThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::basicRhoThermo::rho() const
Foam::tmp<Foam::volScalarField> Foam::rhoThermo::rho() const
{
return rho_;
}
Foam::volScalarField& Foam::basicRhoThermo::rho()
Foam::volScalarField& Foam::rhoThermo::rho()
{
return rho_;
}

View File

@ -22,19 +22,19 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicRhoThermo
Foam::rhoThermo
Description
Basic thermodynamic properties based on density
SourceFiles
basicRhoThermo.C
basicRhoThermoNew.C
rhoThermo.C
rhoThermoNew.C
\*---------------------------------------------------------------------------*/
#ifndef basicRhoThermo_H
#define basicRhoThermo_H
#ifndef rhoThermo_H
#define rhoThermo_H
#include "basicThermo.H"
#include "runTimeSelectionTables.H"
@ -45,10 +45,10 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicRhoThermo Declaration
Class rhoThermo Declaration
\*---------------------------------------------------------------------------*/
class basicRhoThermo
class rhoThermo
:
public basicThermo
{
@ -65,20 +65,20 @@ protected:
// Protected Member Functions
//- Construct as copy (not implemented)
basicRhoThermo(const basicRhoThermo&);
rhoThermo(const rhoThermo&);
public:
//- Runtime type information
TypeName("basicRhoThermo");
TypeName("rhoThermo");
//- Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
basicRhoThermo,
rhoThermo,
fvMesh,
(const fvMesh& mesh),
(mesh)
@ -88,15 +88,15 @@ public:
// Constructors
//- Construct from mesh
basicRhoThermo(const fvMesh&);
rhoThermo(const fvMesh&);
//- Selector
static autoPtr<basicRhoThermo> New(const fvMesh&);
static autoPtr<rhoThermo> New(const fvMesh&);
//- Destructor
virtual ~basicRhoThermo();
virtual ~rhoThermo();
// Member functions

View File

@ -23,11 +23,11 @@ License
\*---------------------------------------------------------------------------*/
#include "basicRhoThermo.H"
#include "rhoThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::basicRhoThermo> Foam::basicRhoThermo::New
Foam::autoPtr<Foam::rhoThermo> Foam::rhoThermo::New
(
const fvMesh& mesh
)
@ -57,15 +57,15 @@ Foam::autoPtr<Foam::basicRhoThermo> Foam::basicRhoThermo::New
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn("basicRhoThermo::New(const fvMesh&)")
<< "Unknown basicRhoThermo type "
FatalErrorIn("rhoThermo::New(const fvMesh&)")
<< "Unknown rhoThermo type "
<< modelType << nl << nl
<< "Valid basicRhoThermo types are:" << nl
<< "Valid rhoThermo types are:" << nl
<< fvMeshConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
return autoPtr<basicRhoThermo>(cstrIter()(mesh));
return autoPtr<rhoThermo>(cstrIter()(mesh));
}

View File

@ -361,7 +361,7 @@ void Foam::ODEChemistryModel<CompType, ThermoType>::derivatives
scalar dT = 0.0;
for (label i = 0; i < nSpecie_; i++)
{
const scalar hi = specieThermo_[i].h(T);
const scalar hi = specieThermo_[i].ha(T);
dT += hi*dcdt[i];
}
dT /= rho*cp;
@ -782,7 +782,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
forAll(rho, celli)
{
const scalar rhoi = rho[celli];
const scalar hi = this->thermo().hs()[celli] + hc[celli];
const scalar hi = this->thermo().he()[celli] + hc[celli];
const scalar pi = this->thermo().p()[celli];
scalar Ti = this->thermo().T()[celli];
@ -815,7 +815,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
{
mixture += (c[i]/cTot)*specieThermo_[i];
}
Ti = mixture.TH(hi, Ti);
Ti = mixture.THa(hi, Ti);
timeLeft -= dt;
this->deltaTChem_[celli] = tauC;

View File

@ -44,7 +44,7 @@ Foam::psiChemistryModel::psiChemistryModel
)
:
basicChemistryModel(mesh),
thermo_(hsCombustionThermo::NewType(mesh, thermoTypeName))
thermo_(psiReactionThermo::NewType(mesh, thermoTypeName))
{}

View File

@ -40,7 +40,7 @@ SourceFiles
#include "basicChemistryModel.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "hsCombustionThermo.H"
#include "psiReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,7 +72,7 @@ protected:
// Protected data
//- Thermo package
autoPtr<hsCombustionThermo> thermo_;
autoPtr<psiReactionThermo> thermo_;
public:
@ -113,10 +113,10 @@ public:
// Member Functions
//- Return access to the thermo package
inline hsCombustionThermo& thermo();
inline psiReactionThermo& thermo();
//- Return const access to the thermo package
inline const hsCombustionThermo& thermo() const;
inline const psiReactionThermo& thermo() const;
};

View File

@ -25,13 +25,13 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::hsCombustionThermo& Foam::psiChemistryModel::thermo()
inline Foam::psiReactionThermo& Foam::psiChemistryModel::thermo()
{
return thermo_();
}
inline const Foam::hsCombustionThermo& Foam::psiChemistryModel::thermo() const
inline const Foam::psiReactionThermo& Foam::psiChemistryModel::thermo() const
{
return thermo_();
}

View File

@ -44,7 +44,7 @@ Foam::rhoChemistryModel::rhoChemistryModel
)
:
basicChemistryModel(mesh),
thermo_(hsReactionThermo::NewType(mesh, thermoTypeName))
thermo_(rhoReactionThermo::NewType(mesh, thermoTypeName))
{}

View File

@ -40,7 +40,7 @@ SourceFiles
#include "basicChemistryModel.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "hsReactionThermo.H"
#include "rhoReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,7 +72,7 @@ protected:
// Protected data
//- Thermo package
autoPtr<hsReactionThermo> thermo_;
autoPtr<rhoReactionThermo> thermo_;
public:
@ -113,10 +113,10 @@ public:
// Member Functions
//- Return access to the thermo package
inline hsReactionThermo& thermo();
inline rhoReactionThermo& thermo();
//- Return const access to the thermo package
inline const hsReactionThermo& thermo() const;
inline const rhoReactionThermo& thermo() const;
};

View File

@ -25,13 +25,13 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::hsReactionThermo& Foam::rhoChemistryModel::thermo()
inline Foam::rhoReactionThermo& Foam::rhoChemistryModel::thermo()
{
return thermo_();
}
inline const Foam::hsReactionThermo& Foam::rhoChemistryModel::thermo() const
inline const Foam::rhoReactionThermo& Foam::rhoChemistryModel::thermo() const
{
return thermo_();
}

View File

@ -49,7 +49,7 @@ namespace laminarFlameSpeedModels
Foam::laminarFlameSpeedModels::Gulders::Gulders
(
const dictionary& dict,
const hhuCombustionThermo& ct
const psiuReactionThermo& ct
)
:
laminarFlameSpeed(dict, ct),
@ -206,17 +206,17 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::Gulders::Su0pTphi
Foam::tmp<Foam::volScalarField>
Foam::laminarFlameSpeedModels::Gulders::operator()() const
{
if (hhuCombustionThermo_.composition().contains("ft"))
if (psiuReactionThermo_.composition().contains("ft"))
{
const volScalarField& ft = hhuCombustionThermo_.composition().Y("ft");
const volScalarField& ft = psiuReactionThermo_.composition().Y("ft");
return Su0pTphi
(
hhuCombustionThermo_.p(),
hhuCombustionThermo_.Tu(),
psiuReactionThermo_.p(),
psiuReactionThermo_.Tu(),
dimensionedScalar
(
hhuCombustionThermo_.lookup("stoichiometricAirFuelMassRatio")
psiuReactionThermo_.lookup("stoichiometricAirFuelMassRatio")
)*ft/((1 + SMALL) - ft)
);
}
@ -224,8 +224,8 @@ Foam::laminarFlameSpeedModels::Gulders::operator()() const
{
return Su0pTphi
(
hhuCombustionThermo_.p(),
hhuCombustionThermo_.Tu(),
psiuReactionThermo_.p(),
psiuReactionThermo_.Tu(),
equivalenceRatio_
);
}

View File

@ -106,11 +106,11 @@ public:
// Constructors
//- Construct from dictionary and hhuCombustionThermo
//- Construct from dictionary and psiuReactionThermo
Gulders
(
const dictionary&,
const hhuCombustionThermo&
const psiuReactionThermo&
);

View File

@ -48,7 +48,7 @@ namespace laminarFlameSpeedModels
Foam::laminarFlameSpeedModels::GuldersEGR::GuldersEGR
(
const dictionary& dict,
const hhuCombustionThermo& ct
const psiuReactionThermo& ct
)
:
laminarFlameSpeed(dict, ct),
@ -210,31 +210,31 @@ Foam::laminarFlameSpeedModels::GuldersEGR::operator()() const
{
if
(
hhuCombustionThermo_.composition().contains("ft")
&& hhuCombustionThermo_.composition().contains("egr")
psiuReactionThermo_.composition().contains("ft")
&& psiuReactionThermo_.composition().contains("egr")
)
{
return Su0pTphi
(
hhuCombustionThermo_.p(),
hhuCombustionThermo_.Tu(),
psiuReactionThermo_.p(),
psiuReactionThermo_.Tu(),
dimensionedScalar
(
hhuCombustionThermo_.lookup("stoichiometricAirFuelMassRatio")
psiuReactionThermo_.lookup("stoichiometricAirFuelMassRatio")
)/
(
scalar(1)/hhuCombustionThermo_.composition().Y("ft")
scalar(1)/psiuReactionThermo_.composition().Y("ft")
- scalar(1)
),
hhuCombustionThermo_.composition().Y("egr")
psiuReactionThermo_.composition().Y("egr")
);
}
else
{
return Su0pTphi
(
hhuCombustionThermo_.p(),
hhuCombustionThermo_.Tu(),
psiuReactionThermo_.p(),
psiuReactionThermo_.Tu(),
equivalenceRatio_
);
}

View File

@ -107,11 +107,11 @@ public:
// Constructors
//- Construct from dictionary and hhuCombustionThermo
//- Construct from dictionary and psiuReactionThermo
GuldersEGR
(
const dictionary&,
const hhuCombustionThermo&
const psiuReactionThermo&
);

View File

@ -49,7 +49,7 @@ namespace laminarFlameSpeedModels
Foam::laminarFlameSpeedModels::constant::constant
(
const dictionary& dict,
const hhuCombustionThermo& ct
const psiuReactionThermo& ct
)
:
laminarFlameSpeed(dict, ct),
@ -76,12 +76,12 @@ Foam::laminarFlameSpeedModels::constant::operator()() const
IOobject
(
"Su0",
hhuCombustionThermo_.T().time().timeName(),
hhuCombustionThermo_.T().db(),
psiuReactionThermo_.T().time().timeName(),
psiuReactionThermo_.T().db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
hhuCombustionThermo_.T().mesh(),
psiuReactionThermo_.T().mesh(),
Su_
)
);

View File

@ -75,11 +75,11 @@ public:
// Constructors
//- Construct from dictionary and hhuCombustionThermo
//- Construct from dictionary and psiuReactionThermo
constant
(
const dictionary&,
const hhuCombustionThermo&
const psiuReactionThermo&
);

View File

@ -40,14 +40,14 @@ namespace Foam
Foam::laminarFlameSpeed::laminarFlameSpeed
(
const dictionary& dict,
const hhuCombustionThermo& ct
const psiuReactionThermo& ct
)
:
hhuCombustionThermo_(ct),
psiuReactionThermo_(ct),
fuel_(dict.lookup("fuel")),
equivalenceRatio_(0)
{
if (!hhuCombustionThermo_.composition().contains("ft"))
if (!psiuReactionThermo_.composition().contains("ft"))
{
equivalenceRatio_ =
dimensionedScalar(dict.lookup("equivalenceRatio")).value();

View File

@ -43,7 +43,7 @@ SourceFiles
#ifndef laminarFlameSpeed_H
#define laminarFlameSpeed_H
#include "hhuCombustionThermo.H"
#include "psiuReactionThermo.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
@ -63,7 +63,7 @@ protected:
// Protected data
const hhuCombustionThermo& hhuCombustionThermo_;
const psiuReactionThermo& psiuReactionThermo_;
//- Fuel
word fuel_;
@ -96,7 +96,7 @@ public:
dictionary,
(
const dictionary& dict,
const hhuCombustionThermo& ct
const psiuReactionThermo& ct
),
(dict, ct)
);
@ -104,11 +104,11 @@ public:
// Constructors
//- Construct from dictionary and hhuCombustionThermo
//- Construct from dictionary and psiuReactionThermo
laminarFlameSpeed
(
const dictionary&,
const hhuCombustionThermo&
const psiuReactionThermo&
);
@ -116,7 +116,7 @@ public:
static autoPtr<laminarFlameSpeed> New
(
const hhuCombustionThermo&
const psiuReactionThermo&
);

View File

@ -29,7 +29,7 @@ License
Foam::autoPtr<Foam::laminarFlameSpeed> Foam::laminarFlameSpeed::New
(
const hhuCombustionThermo& ct
const psiuReactionThermo& ct
)
{
// do not register the dictionary
@ -57,7 +57,7 @@ Foam::autoPtr<Foam::laminarFlameSpeed> Foam::laminarFlameSpeed::New
{
FatalIOErrorIn
(
"laminarFlameSpeed::New(const hhuCombustionThermo&)",
"laminarFlameSpeed::New(const psiuReactionThermo&)",
propDict
) << "Unknown laminarFlameSpeed type "
<< corrType << nl << nl

View File

@ -145,33 +145,15 @@ Foam::tmp<Foam::fvScalarMatrix> Foam::radiation::radiationModel::Sh
basicThermo& thermo
) const
{
volScalarField& h = thermo.h();
const volScalarField Cp(thermo.Cp());
volScalarField& he = thermo.he();
const volScalarField Cpv(thermo.Cpv());
const volScalarField T3(pow3(T_));
return
(
Ru()
- fvm::Sp(4.0*Rp()*T3/Cp, h)
- Rp()*T3*(T_ - 4.0*h/Cp)
);
}
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)
- fvm::Sp(4.0*Rp()*T3/Cpv, he)
- Rp()*T3*(T_ - 4.0*he/Cpv)
);
}

View File

@ -176,11 +176,8 @@ public:
//- Source term component (constant)
virtual tmp<DimensionedField<scalar, volMesh> > Ru() const = 0;
//- Enthalpy source term
//- Energy source term
virtual tmp<fvScalarMatrix> Sh(basicThermo& thermo) const;
//- Sensible enthalpy source term
virtual tmp<fvScalarMatrix> Shs(basicThermo& thermo) const;
};

View File

@ -4,25 +4,17 @@ chemistryReaders/chemistryReader/makeChemistryReaders.C
mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C
combustionThermo/hCombustionThermo/hCombustionThermo.C
combustionThermo/hCombustionThermo/hCombustionThermoNew.C
combustionThermo/hCombustionThermo/hCombustionThermos.C
psiReactionThermo/psiReactionThermo/psiReactionThermo.C
psiReactionThermo/psiReactionThermo/psiReactionThermoNew.C
psiReactionThermo/hePsiReactionThermo/hePsiReactionThermos.C
combustionThermo/hsCombustionThermo/hsCombustionThermo.C
combustionThermo/hsCombustionThermo/hsCombustionThermoNew.C
combustionThermo/hsCombustionThermo/hsCombustionThermos.C
psiReactionThermo/psiuReactionThermo/psiuReactionThermo.C
psiReactionThermo/psiuReactionThermo/psiuReactionThermoNew.C
psiReactionThermo/heheuReactionThermo/heheuReactionThermos.C
combustionThermo/hhuCombustionThermo/hhuCombustionThermo.C
combustionThermo/hhuCombustionThermo/hhuCombustionThermoNew.C
combustionThermo/hhuCombustionThermo/hhuCombustionThermos.C
reactionThermo/hReactionThermo/hReactionThermo.C
reactionThermo/hReactionThermo/hReactionThermoNew.C
reactionThermo/hReactionThermo/hReactionThermos.C
reactionThermo/hsReactionThermo/hsReactionThermo.C
reactionThermo/hsReactionThermo/hsReactionThermoNew.C
reactionThermo/hsReactionThermo/hsReactionThermos.C
rhoReactionThermo/rhoReactionThermo/rhoReactionThermo.C
rhoReactionThermo/rhoReactionThermo/rhoReactionThermoNew.C
rhoReactionThermo/heRhoReactionThermo/heRhoReactionThermos.C
derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.C
derivedFvPatchFields/gradientUnburntEnthalpy/gradientUnburntEnthalpyFvPatchScalarField.C

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "makeReactionThermo.H"
#include "makeReaction.H"
#include "thermoPhysicsTypes.H"
#include "chemistryReader.H"

View File

@ -1,66 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "hCombustionThermo.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(hCombustionThermo, 0);
defineRunTimeSelectionTable(hCombustionThermo, fvMesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::hCombustionThermo::hCombustionThermo(const fvMesh& mesh)
:
basicPsiThermo(mesh),
h_
(
IOobject
(
"h",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->hBoundaryTypes()
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::hCombustionThermo::~hCombustionThermo()
{}
// ************************************************************************* //

View File

@ -1,105 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
InClass
Foam::hCombustionThermo
\*---------------------------------------------------------------------------*/
#ifndef makeCombustionThermo_H
#define makeCombustionThermo_H
#include "addToRunTimeSelectionTable.H"
#include "basicPsiThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeCombustionThermo\
( \
CThermo, \
MixtureThermo, \
Mixture, \
Transport, \
Thermo, \
EqnOfState \
) \
\
typedef MixtureThermo \
<Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState; \
\
defineTemplateTypeNameAndDebugWithName \
( \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
#MixtureThermo \
"<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
basicPsiThermo, \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
CThermo, \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
)
#define makeCombustionMixtureThermo(CThermo,MixtureThermo,Mixture,ThermoPhys) \
\
typedef MixtureThermo<Mixture<ThermoPhys> > \
MixtureThermo##Mixture##ThermoPhys; \
\
defineTemplateTypeNameAndDebugWithName \
( \
MixtureThermo##Mixture##ThermoPhys, \
#MixtureThermo"<"#Mixture"<"#ThermoPhys">>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
basicPsiThermo, \
MixtureThermo##Mixture##ThermoPhys, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
CThermo, \
MixtureThermo##Mixture##ThermoPhys, \
fvMesh \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,66 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "hsCombustionThermo.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(hsCombustionThermo, 0);
defineRunTimeSelectionTable(hsCombustionThermo, fvMesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::hsCombustionThermo::hsCombustionThermo(const fvMesh& mesh)
:
basicPsiThermo(mesh),
hs_
(
IOobject
(
"hs",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->hBoundaryTypes()
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::hsCombustionThermo::~hsCombustionThermo()
{}
// ************************************************************************* //

View File

@ -1,143 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Class
Foam::hsCombustionThermo
Description
Sensible enthalpy variant of combustionThermo
SourceFiles
hsCombustionThermo.C
\*---------------------------------------------------------------------------*/
#ifndef hsCombustionThermo_H
#define hsCombustionThermo_H
#include "basicPsiThermo.H"
#include "basicMultiComponentMixture.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hsCombustionThermo Declaration
\*---------------------------------------------------------------------------*/
class hsCombustionThermo
:
public basicPsiThermo
{
protected:
// Protected data
//- Sensible enthalpy field
volScalarField hs_;
public:
//- Runtime type information
TypeName("hsCombustionThermo");
//- Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
hsCombustionThermo,
fvMesh,
(const fvMesh& mesh),
(mesh)
);
// Constructors
//- Construct from dictionary and mesh
hsCombustionThermo(const fvMesh&);
// Selectors
//- Standard selection based on fvMesh
static autoPtr<hsCombustionThermo> New(const fvMesh&);
//- Select and check that package contains 'thermoType'
static autoPtr<hsCombustionThermo> NewType
(
const fvMesh&,
const word& thermoType
);
//- Destructor
virtual ~hsCombustionThermo();
// Member functions
//- Return the composition of the multi-component mixture
virtual basicMultiComponentMixture& composition() = 0;
//- Return the composition of the multi-component mixture
virtual const basicMultiComponentMixture& composition() const = 0;
// Access to thermodynamic state variables
//- Sensible enthalpy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& hs()
{
return hs_;
}
//- Sensible enthalpy [J/kg]
virtual const volScalarField& hs() const
{
return hs_;
}
//- Update properties
virtual void correct() = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,148 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "hsCombustionThermo.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::hsCombustionThermo> Foam::hsCombustionThermo::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("hsCombustionThermo::New(const fvMesh&)")
<< "Unknown hsCombustionThermo type "
<< modelType << nl << nl
<< "Valid hsCombustionThermo types:" << nl
<< fvMeshConstructorTablePtr_->toc() << nl
<< exit(FatalError);
}
return autoPtr<hsCombustionThermo>(cstrIter()(mesh));
}
Foam::autoPtr<Foam::hsCombustionThermo> Foam::hsCombustionThermo::NewType
(
const fvMesh& mesh,
const word& thermoType
)
{
// 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")
);
if (modelType.find(thermoType) == string::npos)
{
wordList allModels = fvMeshConstructorTablePtr_->toc();
DynamicList<word> validModels;
forAll(allModels, i)
{
if (allModels[i].find(thermoType) != string::npos)
{
validModels.append(allModels[i]);
}
}
FatalErrorIn
(
"autoPtr<hsCombustionThermo> hsCombustionThermo::NewType"
"("
"const fvMesh&, "
"const word&"
")"
) << "Inconsistent thermo package selected:" << nl << nl
<< modelType << nl << nl << "Please select a "
<< "thermo package based on " << thermoType
<< ". Valid options include:" << nl << validModels << nl
<< exit(FatalError);
}
Info<< "Selecting thermodynamics package " << modelType << endl;
fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(modelType);
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn
(
"autoPtr<hsCombustionThermo> hsCombustionThermo::NewType"
"("
"const fvMesh&, "
"const word&"
")"
) << "Unknown hsCombustionThermo type "
<< modelType << nl << nl
<< "Valid hsCombustionThermo types are:" << nl
<< fvMeshConstructorTablePtr_->toc() << nl
<< exit(FatalError);
}
return autoPtr<hsCombustionThermo>(cstrIter()(mesh));
}
// ************************************************************************* //

View File

@ -1,179 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "makeHsCombustionThermo.H"
#include "hsCombustionThermo.H"
#include "hsPsiMixtureThermo.H"
#include "perfectGas.H"
#include "hConstThermo.H"
#include "janafThermo.H"
#include "specieThermo.H"
#include "constTransport.H"
#include "sutherlandTransport.H"
#include "dieselMixture.H"
#include "homogeneousMixture.H"
#include "inhomogeneousMixture.H"
#include "veryInhomogeneousMixture.H"
#include "singleStepReactingMixture.H"
#include "reactingMixture.H"
#include "multiComponentMixture.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeHsCombustionThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
homogeneousMixture,
constTransport,
hConstThermo,
perfectGas
);
makeHsCombustionThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
inhomogeneousMixture,
constTransport,
hConstThermo,
perfectGas
);
makeHsCombustionThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
veryInhomogeneousMixture,
constTransport,
hConstThermo,
perfectGas
);
makeHsCombustionThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
homogeneousMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
makeHsCombustionThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
inhomogeneousMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
makeHsCombustionThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
veryInhomogeneousMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
makeHsCombustionThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
dieselMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
// Multi-component thermo
makeHsCombustionMixtureThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
multiComponentMixture,
constGasThermoPhysics
);
makeHsCombustionMixtureThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
multiComponentMixture,
gasThermoPhysics
);
// Multi-component reaction thermo
makeHsCombustionMixtureThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
reactingMixture,
constGasThermoPhysics
);
makeHsCombustionMixtureThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
reactingMixture,
gasThermoPhysics
);
makeHsCombustionMixtureThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
singleStepReactingMixture,
gasThermoPhysics
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,111 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
InClass
Foam::hsCombustionThermo
\*---------------------------------------------------------------------------*/
#ifndef makeHsCombustionThermo_H
#define makeHsCombustionThermo_H
#include "addToRunTimeSelectionTable.H"
#include "basicPsiThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeHsCombustionThermo\
( \
CThermo, \
MixtureThermo, \
Mixture, \
Transport, \
Thermo, \
EqnOfState \
) \
\
typedef MixtureThermo \
<Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState; \
\
defineTemplateTypeNameAndDebugWithName \
( \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
#MixtureThermo \
"<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
basicPsiThermo, \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
CThermo, \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
)
#define makeHsCombustionMixtureThermo\
( \
CThermo, \
MixtureThermo, \
Mixture, \
ThermoPhys \
) \
\
typedef MixtureThermo<Mixture<ThermoPhys> > \
MixtureThermo##Mixture##ThermoPhys; \
\
defineTemplateTypeNameAndDebugWithName \
( \
MixtureThermo##Mixture##ThermoPhys, \
#MixtureThermo"<"#Mixture"<"#ThermoPhys">>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
basicPsiThermo, \
MixtureThermo##Mixture##ThermoPhys, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
CThermo, \
MixtureThermo##Mixture##ThermoPhys, \
fvMesh \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,320 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "hPsiMixtureThermo.H"
#include "fvMesh.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::hPsiMixtureThermo<MixtureType>::calculate()
{
const scalarField& hCells = h_.internalField();
const scalarField& pCells = p_.internalField();
scalarField& TCells = T_.internalField();
scalarField& psiCells = psi_.internalField();
scalarField& muCells = mu_.internalField();
scalarField& alphaCells = alpha_.internalField();
forAll(TCells, celli)
{
const typename MixtureType::thermoType& mixture =
this->cellMixture(celli);
TCells[celli] = mixture.TH(hCells[celli], TCells[celli]);
psiCells[celli] = mixture.psi(pCells[celli], TCells[celli]);
muCells[celli] = mixture.mu(TCells[celli]);
alphaCells[celli] = mixture.alphah(TCells[celli]);
}
forAll(T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = p_.boundaryField()[patchi];
fvPatchScalarField& pT = T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = psi_.boundaryField()[patchi];
fvPatchScalarField& ph = h_.boundaryField()[patchi];
fvPatchScalarField& pmu_ = mu_.boundaryField()[patchi];
fvPatchScalarField& palpha_ = alpha_.boundaryField()[patchi];
if (pT.fixesValue())
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture =
this->patchFaceMixture(patchi, facei);
ph[facei] = mixture.H(pT[facei]);
ppsi[facei] = mixture.psi(pp[facei], pT[facei]);
pmu_[facei] = mixture.mu(pT[facei]);
palpha_[facei] = mixture.alphah(pT[facei]);
}
}
else
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture =
this->patchFaceMixture(patchi, facei);
pT[facei] = mixture.TH(ph[facei], pT[facei]);
ppsi[facei] = mixture.psi(pp[facei], pT[facei]);
pmu_[facei] = mixture.mu(pT[facei]);
palpha_[facei] = mixture.alphah(pT[facei]);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hPsiMixtureThermo<MixtureType>::hPsiMixtureThermo(const fvMesh& mesh)
:
hCombustionThermo(mesh),
MixtureType(*this, mesh)
{
scalarField& hCells = h_.internalField();
const scalarField& TCells = T_.internalField();
forAll(hCells, celli)
{
hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
}
forAll(h_.boundaryField(), patchi)
{
h_.boundaryField()[patchi] == h(T_.boundaryField()[patchi], patchi);
}
hBoundaryCorrection(h_);
calculate();
// Switch on saving old time
psi_.oldTime();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hPsiMixtureThermo<MixtureType>::~hPsiMixtureThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::hPsiMixtureThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering hPsiMixtureThermo<MixtureType>::correct()" << endl;
}
// force the saving of the old-time values
psi_.oldTime();
calculate();
if (debug)
{
Info<< "exiting hPsiMixtureThermo<MixtureType>::correct()" << endl;
}
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::hPsiMixtureThermo<MixtureType>::hc() const
{
const fvMesh& mesh = T_.mesh();
tmp<volScalarField> thc
(
new volScalarField
(
IOobject
(
"hc",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
h_.dimensions()
)
);
volScalarField& hcf = thc();
scalarField& hcCells = hcf.internalField();
forAll(hcCells, celli)
{
hcCells[celli] = this->cellMixture(celli).Hc();
}
forAll(hcf.boundaryField(), patchi)
{
scalarField& hcp = hcf.boundaryField()[patchi];
forAll(hcp, facei)
{
hcp[facei] = this->patchFaceMixture(patchi, facei).Hc();
}
}
return thc;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::hPsiMixtureThermo<MixtureType>::h
(
const scalarField& T,
const labelList& cells
) const
{
tmp<scalarField> th(new scalarField(T.size()));
scalarField& h = th();
forAll(T, celli)
{
h[celli] = this->cellMixture(cells[celli]).H(T[celli]);
}
return th;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::hPsiMixtureThermo<MixtureType>::h
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> th(new scalarField(T.size()));
scalarField& h = th();
forAll(T, facei)
{
h[facei] = this->patchFaceMixture(patchi, facei).H(T[facei]);
}
return th;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::hPsiMixtureThermo<MixtureType>::Cp
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCp(new scalarField(T.size()));
scalarField& cp = tCp();
forAll(T, facei)
{
cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]);
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::hPsiMixtureThermo<MixtureType>::Cp() const
{
const fvMesh& mesh = T_.mesh();
tmp<volScalarField> tCp
(
new volScalarField
(
IOobject
(
"Cp",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cp = tCp();
scalarField& cpCells = cp.internalField();
const scalarField& TCells = T_.internalField();
forAll(TCells, celli)
{
cpCells[celli] = this->cellMixture(celli).Cp(TCells[celli]);
}
forAll(T_.boundaryField(), patchi)
{
cp.boundaryField()[patchi] = Cp(T_.boundaryField()[patchi], patchi);
}
return tCp;
}
template<class MixtureType>
bool Foam::hPsiMixtureThermo<MixtureType>::read()
{
if (hCombustionThermo::read())
{
MixtureType::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,317 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "hsPsiMixtureThermo.H"
#include "fvMesh.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hsPsiMixtureThermo<MixtureType>::hsPsiMixtureThermo(const fvMesh& mesh)
:
hsCombustionThermo(mesh),
MixtureType(*this, mesh)
{
scalarField& hCells = hs_.internalField();
const scalarField& TCells = T_.internalField();
forAll(hCells, celli)
{
hCells[celli] = this->cellMixture(celli).Hs(TCells[celli]);
}
forAll(hs_.boundaryField(), patchi)
{
hs_.boundaryField()[patchi] == hs(T_.boundaryField()[patchi], patchi);
}
hBoundaryCorrection(hs_);
calculate();
psi_.oldTime(); // Switch on saving old time
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hsPsiMixtureThermo<MixtureType>::~hsPsiMixtureThermo()
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::hsPsiMixtureThermo<MixtureType>::calculate()
{
const scalarField& hsCells = hs_.internalField();
const scalarField& pCells = p_.internalField();
scalarField& TCells = T_.internalField();
scalarField& psiCells = psi_.internalField();
scalarField& muCells = mu_.internalField();
scalarField& alphaCells = alpha_.internalField();
forAll(TCells, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);
TCells[celli] = mixture_.THs(hsCells[celli], TCells[celli]);
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
muCells[celli] = mixture_.mu(TCells[celli]);
alphaCells[celli] = mixture_.alphah(TCells[celli]);
}
forAll(T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = p_.boundaryField()[patchi];
fvPatchScalarField& pT = T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = psi_.boundaryField()[patchi];
fvPatchScalarField& phs = hs_.boundaryField()[patchi];
fvPatchScalarField& pmu_ = mu_.boundaryField()[patchi];
fvPatchScalarField& palpha_ = alpha_.boundaryField()[patchi];
if (pT.fixesValue())
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
phs[facei] = mixture_.Hs(pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu_[facei] = mixture_.mu(pT[facei]);
palpha_[facei] = mixture_.alphah(pT[facei]);
}
}
else
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);
pT[facei] = mixture_.THs(phs[facei], pT[facei]);
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu_[facei] = mixture_.mu(pT[facei]);
palpha_[facei] = mixture_.alphah(pT[facei]);
}
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::hsPsiMixtureThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering hMixtureThermo<MixtureType>::correct()" << endl;
}
// force the saving of the old-time values
psi_.oldTime();
calculate();
if (debug)
{
Info<< "exiting hMixtureThermo<MixtureType>::correct()" << endl;
}
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::hsPsiMixtureThermo<MixtureType>::hc() const
{
const fvMesh& mesh = T_.mesh();
tmp<volScalarField> thc
(
new volScalarField
(
IOobject
(
"hc",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
hs_.dimensions()
)
);
volScalarField& hcf = thc();
scalarField& hcCells = hcf.internalField();
forAll(hcCells, celli)
{
hcCells[celli] = this->cellMixture(celli).Hc();
}
forAll(hcf.boundaryField(), patchi)
{
scalarField& hcp = hcf.boundaryField()[patchi];
forAll(hcp, facei)
{
hcp[facei] = this->patchFaceMixture(patchi, facei).Hc();
}
}
return thc;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::hsPsiMixtureThermo<MixtureType>::hs
(
const scalarField& T,
const labelList& cells
) const
{
tmp<scalarField> ths(new scalarField(T.size()));
scalarField& hs = ths();
forAll(T, celli)
{
hs[celli] = this->cellMixture(cells[celli]).Hs(T[celli]);
}
return ths;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::hsPsiMixtureThermo<MixtureType>::hs
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> ths(new scalarField(T.size()));
scalarField& hs = ths();
forAll(T, facei)
{
hs[facei] = this->patchFaceMixture(patchi, facei).Hs(T[facei]);
}
return ths;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::hsPsiMixtureThermo<MixtureType>::Cp
(
const scalarField& T,
const label patchi
) const
{
tmp<scalarField> tCp(new scalarField(T.size()));
scalarField& cp = tCp();
forAll(T, facei)
{
cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]);
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::hsPsiMixtureThermo<MixtureType>::Cp() const
{
const fvMesh& mesh = T_.mesh();
tmp<volScalarField> tCp
(
new volScalarField
(
IOobject
(
"Cp",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
)
);
volScalarField& cp = tCp();
scalarField& cpCells = cp.internalField();
const scalarField& TCells = T_.internalField();
forAll(TCells, celli)
{
cpCells[celli] = this->cellMixture(celli).Cp(TCells[celli]);
}
forAll(T_.boundaryField(), patchi)
{
cp.boundaryField()[patchi] = Cp(T_.boundaryField()[patchi], patchi);
}
return tCp;
}
template<class MixtureType>
bool Foam::hsPsiMixtureThermo<MixtureType>::read()
{
if (hsCombustionThermo::read())
{
MixtureType::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,146 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Class
Foam::hsPsiMixtureThermo
Description
Foam::hsPsiMixtureThermo
SourceFiles
hsPsiMixtureThermo.C
\*---------------------------------------------------------------------------*/
#ifndef hsPsiMixtureThermo_H
#define hsPsiMixtureThermo_H
#include "hsCombustionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hsPsiMixtureThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class hsPsiMixtureThermo
:
public hsCombustionThermo,
public MixtureType
{
// Private Member Functions
void calculate();
//- Construct as copy (not implemented)
hsPsiMixtureThermo(const hsPsiMixtureThermo<MixtureType>&);
public:
//- Runtime type information
TypeName("hsPsiMixtureThermo");
// Constructors
//- Construct from mesh
hsPsiMixtureThermo(const fvMesh&);
//- Destructor
virtual ~hsPsiMixtureThermo();
// Member functions
//- Return the compostion of the multi-component mixture
virtual basicMultiComponentMixture& composition()
{
return *this;
}
//- Return the compostion of the multi-component mixture
virtual const basicMultiComponentMixture& composition() const
{
return *this;
}
//- Update properties
virtual void correct();
// Fields derived from thermodynamic state variables
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
//- Sensible enthalpy for cell-set [J/kg]
virtual tmp<scalarField> hs
(
const scalarField& T,
const labelList& cells
) const;
//- Sensible enthalpy for patch [J/kg]
virtual tmp<scalarField> hs
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const;
//- Read thermophysicalProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "hsPsiMixtureThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More