mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Added sensible enthalpy (hs, Hs) and chemical enthalpy (hc, Hc) to the thermodynamics package.
Absolute enthalpy h = hs + hc.
This commit is contained in:
@ -2,14 +2,21 @@ basicMixture = mixtures/basicMixture
|
||||
basicThermo = basicThermo
|
||||
|
||||
$(basicMixture)/basicMixture.C
|
||||
$(basicMixture)/basicMixtures.C
|
||||
$(basicThermo)/basicThermo.C
|
||||
$(basicThermo)/newBasicThermo.C
|
||||
$(basicThermo)/basicThermos.C
|
||||
|
||||
hThermo/hThermos.C
|
||||
eThermo/eThermos.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/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libbasicThermophysicalModels
|
||||
|
||||
@ -31,6 +31,9 @@ License
|
||||
#include "fixedEnthalpyFvPatchScalarField.H"
|
||||
#include "gradientEnthalpyFvPatchScalarField.H"
|
||||
#include "mixedEnthalpyFvPatchScalarField.H"
|
||||
#include "fixedInternalEnergyFvPatchScalarField.H"
|
||||
#include "gradientInternalEnergyFvPatchScalarField.H"
|
||||
#include "mixedInternalEnergyFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -74,9 +77,9 @@ wordList basicThermo::hBoundaryTypes()
|
||||
return hbt;
|
||||
}
|
||||
|
||||
void basicThermo::hBoundaryCorrection(volScalarField& h_)
|
||||
void basicThermo::hBoundaryCorrection(volScalarField& h)
|
||||
{
|
||||
volScalarField::GeometricBoundaryField& hbf = h_.boundaryField();
|
||||
volScalarField::GeometricBoundaryField& hbf = h.boundaryField();
|
||||
|
||||
forAll(hbf, patchi)
|
||||
{
|
||||
@ -93,6 +96,53 @@ void basicThermo::hBoundaryCorrection(volScalarField& h_)
|
||||
}
|
||||
}
|
||||
|
||||
wordList 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 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 * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -74,6 +74,9 @@ protected:
|
||||
wordList hBoundaryTypes();
|
||||
void hBoundaryCorrection(volScalarField& h);
|
||||
|
||||
wordList eBoundaryTypes();
|
||||
void eBoundaryCorrection(volScalarField& e);
|
||||
|
||||
//- Construct as copy (not implemented)
|
||||
basicThermo(const basicThermo&);
|
||||
|
||||
@ -107,9 +110,8 @@ public:
|
||||
static autoPtr<basicThermo> New(const fvMesh&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~basicThermo();
|
||||
//- Destructor
|
||||
virtual ~basicThermo();
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -122,13 +124,13 @@ public:
|
||||
|
||||
//- Pressure [Pa]
|
||||
// Non-const access allowed for transport equations
|
||||
volScalarField& p()
|
||||
virtual volScalarField& p()
|
||||
{
|
||||
return p_;
|
||||
}
|
||||
|
||||
//- Pressure [Pa]
|
||||
const volScalarField& p() const
|
||||
virtual const volScalarField& p() const
|
||||
{
|
||||
return p_;
|
||||
}
|
||||
@ -193,23 +195,52 @@ public:
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
//- Internal energy for cell-set [J/kg]
|
||||
virtual tmp<scalarField> e
|
||||
(
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"basicThermo::e"
|
||||
"(const scalarField& T, const labelList& cells) const"
|
||||
);
|
||||
return tmp<scalarField>(NULL);
|
||||
}
|
||||
|
||||
//-Internal energy for patch [J/kg]
|
||||
virtual tmp<scalarField> e
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"basicThermo::e"
|
||||
"(const scalarField& T, const label patchi) const"
|
||||
);
|
||||
return tmp<scalarField>(NULL);
|
||||
}
|
||||
|
||||
// Fields derived from thermodynamic state variables
|
||||
|
||||
//- Temperature [K]
|
||||
const volScalarField& T() const
|
||||
virtual const volScalarField& T() const
|
||||
{
|
||||
return T_;
|
||||
}
|
||||
|
||||
//- Density [kg/m^3]
|
||||
tmp<volScalarField> rho() const
|
||||
virtual tmp<volScalarField> rho() const
|
||||
{
|
||||
return p_*psi();
|
||||
}
|
||||
|
||||
//- Compressibility [s^2/m^2]
|
||||
const volScalarField& psi() const
|
||||
virtual const volScalarField& psi() const
|
||||
{
|
||||
return psi_;
|
||||
}
|
||||
@ -236,6 +267,21 @@ public:
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
//- Heat capacity at constant volume for patch [J/kg/K]
|
||||
virtual tmp<scalarField> Cv
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"basicThermo::Cv"
|
||||
"(const scalarField& T, const label patchi) const"
|
||||
);
|
||||
return tmp<scalarField>(NULL);
|
||||
}
|
||||
|
||||
//- Heat capacity at constant volume [J/kg/K]
|
||||
virtual tmp<volScalarField> Cv() const
|
||||
{
|
||||
@ -247,13 +293,13 @@ public:
|
||||
// Access to transport state variables
|
||||
|
||||
//- Dynamic viscosity of mixture [kg/ms]
|
||||
const volScalarField& mu() const
|
||||
virtual const volScalarField& mu() const
|
||||
{
|
||||
return mu_;
|
||||
}
|
||||
|
||||
//- Thermal diffusivity for enthalpy of mixture [kg/ms]
|
||||
const volScalarField& alpha() const
|
||||
virtual const volScalarField& alpha() const
|
||||
{
|
||||
return alpha_;
|
||||
}
|
||||
|
||||
@ -38,13 +38,6 @@ Description
|
||||
|
||||
#define makeBasicThermo(Cthermo,Mixture,Transport,Thermo,EqnOfState) \
|
||||
\
|
||||
typedef Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > \
|
||||
Mixture##Transport##Thermo##EqnOfState; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
(Mixture##Transport##Thermo##EqnOfState, \
|
||||
#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>", 0) \
|
||||
\
|
||||
typedef Cthermo<Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \
|
||||
Cthermo##Mixture##Transport##Thermo##EqnOfState; \
|
||||
\
|
||||
@ -60,7 +53,6 @@ addToRunTimeSelectionTable \
|
||||
fvMesh \
|
||||
)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
@ -205,7 +205,6 @@ Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::h
|
||||
return th;
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::Cp
|
||||
(
|
||||
@ -224,7 +223,6 @@ Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::Cp
|
||||
return tCp;
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cp() const
|
||||
{
|
||||
@ -243,7 +241,8 @@ Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cp() const
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionSet(0, 2, -2, -1, 0)
|
||||
dimensionSet(0, 2, -2, -1, 0),
|
||||
T_.boundaryField().types()
|
||||
)
|
||||
);
|
||||
|
||||
@ -256,13 +255,38 @@ Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cp() const
|
||||
|
||||
forAll(T_.boundaryField(), patchi)
|
||||
{
|
||||
cp.boundaryField()[patchi] = Cp(T_.boundaryField()[patchi], patchi);
|
||||
const fvPatchScalarField& pT = 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::hThermo<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::hThermo<MixtureType>::Cv() const
|
||||
{
|
||||
@ -281,8 +305,7 @@ Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cv() const
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionSet(0, 2, -2, -1, 0),
|
||||
T_.boundaryField().types()
|
||||
dimensionSet(0, 2, -2, -1, 0)
|
||||
)
|
||||
);
|
||||
|
||||
@ -295,19 +318,12 @@ Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cv() const
|
||||
|
||||
forAll(T_.boundaryField(), patchi)
|
||||
{
|
||||
const fvPatchScalarField& pT = T_.boundaryField()[patchi];
|
||||
fvPatchScalarField& pCv = cv.boundaryField()[patchi];
|
||||
|
||||
forAll(pT, facei)
|
||||
{
|
||||
pCv[facei] = this->patchFaceMixture(patchi, facei).Cv(pT[facei]);
|
||||
}
|
||||
cv.boundaryField()[patchi] = Cv(T_.boundaryField()[patchi], patchi);
|
||||
}
|
||||
|
||||
return tCv;
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
bool Foam::hThermo<MixtureType>::read()
|
||||
{
|
||||
|
||||
@ -79,40 +79,39 @@ public:
|
||||
hThermo(const fvMesh&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~hThermo();
|
||||
//- Destructor
|
||||
virtual ~hThermo();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the compostion of the combustion mixture
|
||||
basicMixture& composition()
|
||||
virtual basicMixture& composition()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- Return the compostion of the combustion mixture
|
||||
const basicMixture& composition() const
|
||||
virtual const basicMixture& composition() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- Update properties
|
||||
void correct();
|
||||
virtual void correct();
|
||||
|
||||
|
||||
// Access to thermodynamic state variables
|
||||
|
||||
//- Enthalpy [J/kg]
|
||||
// Non-const access allowed for transport equations
|
||||
volScalarField& h()
|
||||
virtual volScalarField& h()
|
||||
{
|
||||
return h_;
|
||||
}
|
||||
|
||||
//- Enthalpy [J/kg]
|
||||
const volScalarField& h() const
|
||||
virtual const volScalarField& h() const
|
||||
{
|
||||
return h_;
|
||||
}
|
||||
@ -121,31 +120,42 @@ public:
|
||||
// Fields derived from thermodynamic state variables
|
||||
|
||||
//- Enthalpy for cell-set [J/kg]
|
||||
tmp<scalarField> h
|
||||
virtual tmp<scalarField> h
|
||||
(
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
) const;
|
||||
|
||||
//- Enthalpy for patch [J/kg]
|
||||
tmp<scalarField> h
|
||||
virtual tmp<scalarField> h
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity at constant pressure for patch [J/kg/K]
|
||||
tmp<scalarField> Cp(const scalarField& T, const label patchi) const;
|
||||
virtual tmp<scalarField> Cp
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity at constant pressure [J/kg/K]
|
||||
tmp<volScalarField> Cp() const;
|
||||
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]
|
||||
tmp<volScalarField> Cv() const;
|
||||
virtual tmp<volScalarField> Cv() const;
|
||||
|
||||
|
||||
//- Read thermophysicalProperties dictionary
|
||||
bool read();
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -92,9 +92,8 @@ public:
|
||||
static autoPtr<hCombustionThermo> New(const fvMesh&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~hCombustionThermo();
|
||||
//- Destructor
|
||||
virtual ~hCombustionThermo();
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -110,18 +109,24 @@ public:
|
||||
|
||||
//- Enthalpy [J/kg]
|
||||
// Non-const access allowed for transport equations
|
||||
volScalarField& h()
|
||||
virtual volScalarField& h()
|
||||
{
|
||||
return h_;
|
||||
}
|
||||
|
||||
//- Enthalpy [J/kg]
|
||||
const volScalarField& h() const
|
||||
virtual const volScalarField& h() const
|
||||
{
|
||||
return h_;
|
||||
}
|
||||
|
||||
|
||||
//- Sensible enthalpy [J/kg]
|
||||
virtual tmp<volScalarField> hs() const = 0;
|
||||
|
||||
//- Chemical enthalpy [J/kg]
|
||||
virtual tmp<volScalarField> hc() const = 0;
|
||||
|
||||
//- Update properties
|
||||
virtual void correct() = 0;
|
||||
};
|
||||
|
||||
@ -96,9 +96,8 @@ public:
|
||||
static autoPtr<hhuCombustionThermo> New(const fvMesh&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~hhuCombustionThermo();
|
||||
//- Destructor
|
||||
virtual ~hhuCombustionThermo();
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -111,13 +110,13 @@ public:
|
||||
|
||||
//- Unburnt gas enthalpy [J/kg]
|
||||
// Non-const access allowed for transport equations
|
||||
volScalarField& hu()
|
||||
virtual volScalarField& hu()
|
||||
{
|
||||
return hu_;
|
||||
}
|
||||
|
||||
//- Unburnt gas enthalpy [J/kg]
|
||||
const volScalarField& hu() const
|
||||
virtual const volScalarField& hu() const
|
||||
{
|
||||
return hu_;
|
||||
}
|
||||
@ -140,7 +139,7 @@ public:
|
||||
) const = 0;
|
||||
|
||||
//- Unburnt gas temperature [K]
|
||||
const volScalarField& Tu() const
|
||||
virtual const volScalarField& Tu() const
|
||||
{
|
||||
return Tu_;
|
||||
}
|
||||
|
||||
@ -134,7 +134,120 @@ void Foam::hMixtureThermo<MixtureType>::calculate()
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::scalarField> Foam::hMixtureThermo<MixtureType>::h
|
||||
void Foam::hMixtureThermo<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::hMixtureThermo<MixtureType>::hs() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
tmp<volScalarField> ths
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"hs",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
h_.dimensions()
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& hsf = ths();
|
||||
scalarField& hsCells = hsf.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
|
||||
forAll(TCells, celli)
|
||||
{
|
||||
hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(T_.boundaryField(), patchi)
|
||||
{
|
||||
scalarField& hsp = hsf.boundaryField()[patchi];
|
||||
const scalarField& Tp = T_.boundaryField()[patchi];
|
||||
|
||||
forAll(Tp, facei)
|
||||
{
|
||||
hsp[facei] = this->patchFaceMixture(patchi, facei).Hs(Tp[facei]);
|
||||
}
|
||||
}
|
||||
|
||||
return ths;
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hMixtureThermo<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::hMixtureThermo<MixtureType>::h
|
||||
(
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
@ -153,7 +266,8 @@ Foam::tmp<Foam::scalarField> Foam::hMixtureThermo<MixtureType>::h
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::scalarField> Foam::hMixtureThermo<MixtureType>::h
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::hMixtureThermo<MixtureType>::h
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
@ -172,7 +286,8 @@ Foam::tmp<Foam::scalarField> Foam::hMixtureThermo<MixtureType>::h
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::scalarField> Foam::hMixtureThermo<MixtureType>::Cp
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::hMixtureThermo<MixtureType>::Cp
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
@ -192,7 +307,8 @@ Foam::tmp<Foam::scalarField> Foam::hMixtureThermo<MixtureType>::Cp
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField> Foam::hMixtureThermo<MixtureType>::Cp() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hMixtureThermo<MixtureType>::Cp() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
@ -215,9 +331,12 @@ Foam::tmp<Foam::volScalarField> Foam::hMixtureThermo<MixtureType>::Cp() const
|
||||
|
||||
volScalarField& cp = tCp();
|
||||
|
||||
forAll(T_, celli)
|
||||
scalarField& cpCells = cp.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
|
||||
forAll(TCells, celli)
|
||||
{
|
||||
cp[celli] = this->cellMixture(celli).Cp(T_[celli]);
|
||||
cpCells[celli] = this->cellMixture(celli).Cp(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(T_.boundaryField(), patchi)
|
||||
@ -229,26 +348,6 @@ Foam::tmp<Foam::volScalarField> Foam::hMixtureThermo<MixtureType>::Cp() const
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
void Foam::hMixtureThermo<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>
|
||||
bool Foam::hMixtureThermo<MixtureType>::read()
|
||||
{
|
||||
|
||||
@ -73,21 +73,20 @@ public:
|
||||
hMixtureThermo(const fvMesh&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~hMixtureThermo();
|
||||
//- Destructor
|
||||
virtual ~hMixtureThermo();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the compostion of the combustion mixture
|
||||
combustionMixture& composition()
|
||||
virtual combustionMixture& composition()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- Return the compostion of the combustion mixture
|
||||
const combustionMixture& composition() const
|
||||
virtual const combustionMixture& composition() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
@ -95,28 +94,37 @@ public:
|
||||
//- Update properties
|
||||
virtual void correct();
|
||||
|
||||
//- Sensible enthalpy [J/kg]
|
||||
virtual tmp<volScalarField> hs() const;
|
||||
|
||||
//- Chemical enthalpy [J/kg]
|
||||
virtual tmp<volScalarField> hc() const;
|
||||
|
||||
// Fields derived from thermodynamic state variables
|
||||
|
||||
//- Enthalpy for cell-set [J/kg]
|
||||
tmp<scalarField> h
|
||||
virtual tmp<scalarField> h
|
||||
(
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
) const;
|
||||
|
||||
//- Enthalpy for patch [J/kg]
|
||||
tmp<scalarField> h
|
||||
virtual tmp<scalarField> h
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity at constant pressure for patch [J/kg/K]
|
||||
tmp<scalarField> Cp(const scalarField& T, const label patchi) const;
|
||||
virtual tmp<scalarField> Cp
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity at constant pressure [J/kg/K]
|
||||
tmp<volScalarField> Cp() const;
|
||||
virtual tmp<volScalarField> Cp() const;
|
||||
|
||||
|
||||
//- Read thermophysicalProperties dictionary
|
||||
|
||||
@ -173,6 +173,100 @@ void Foam::hhuMixtureThermo<MixtureType>::correct()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hhuMixtureThermo<MixtureType>::hs() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
tmp<volScalarField> ths
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"hs",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
h_.dimensions()
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& hsf = ths();
|
||||
|
||||
scalarField& hsCells = hsf.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
|
||||
forAll(TCells, celli)
|
||||
{
|
||||
hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(T_.boundaryField(), patchi)
|
||||
{
|
||||
scalarField& hsp = hsf.boundaryField()[patchi];
|
||||
const scalarField& Tp = T_.boundaryField()[patchi];
|
||||
|
||||
forAll(Tp, facei)
|
||||
{
|
||||
hsp[facei] = this->patchFaceMixture(patchi, facei).Hs(Tp[facei]);
|
||||
}
|
||||
}
|
||||
|
||||
return ths;
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hhuMixtureThermo<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::hhuMixtureThermo<MixtureType>::h
|
||||
(
|
||||
@ -232,7 +326,8 @@ Foam::tmp<Foam::scalarField> Foam::hhuMixtureThermo<MixtureType>::Cp
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::Cp() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hhuMixtureThermo<MixtureType>::Cp() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
@ -254,10 +349,12 @@ Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::Cp() const
|
||||
);
|
||||
|
||||
volScalarField& cp = tCp();
|
||||
scalarField& cpCells = cp.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
|
||||
forAll(T_, celli)
|
||||
forAll(TCells, celli)
|
||||
{
|
||||
cp[celli] = this->cellMixture(celli).Cp(T_[celli]);
|
||||
cpCells[celli] = this->cellMixture(celli).Cp(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(T_.boundaryField(), patchi)
|
||||
@ -269,9 +366,9 @@ Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::Cp() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::scalarField> Foam::hhuMixtureThermo<MixtureType>::hu
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::hhuMixtureThermo<MixtureType>::hu
|
||||
(
|
||||
const scalarField& Tu,
|
||||
const labelList& cells
|
||||
@ -290,7 +387,8 @@ Foam::tmp<Foam::scalarField> Foam::hhuMixtureThermo<MixtureType>::hu
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::scalarField> Foam::hhuMixtureThermo<MixtureType>::hu
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::hhuMixtureThermo<MixtureType>::hu
|
||||
(
|
||||
const scalarField& Tu,
|
||||
const label patchi
|
||||
@ -309,7 +407,8 @@ Foam::tmp<Foam::scalarField> Foam::hhuMixtureThermo<MixtureType>::hu
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::Tb() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hhuMixtureThermo<MixtureType>::Tb() const
|
||||
{
|
||||
tmp<volScalarField> tTb
|
||||
(
|
||||
@ -328,10 +427,14 @@ Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::Tb() const
|
||||
);
|
||||
|
||||
volScalarField& Tb_ = tTb();
|
||||
scalarField& TbCells = Tb_.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
const scalarField& hCells = h_.internalField();
|
||||
|
||||
forAll(Tb_, celli)
|
||||
forAll(TbCells, celli)
|
||||
{
|
||||
Tb_[celli] = this->cellProducts(celli).TH(h_[celli], T_[celli]);
|
||||
TbCells[celli] =
|
||||
this->cellProducts(celli).TH(hCells[celli], TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(Tb_.boundaryField(), patchi)
|
||||
@ -344,7 +447,8 @@ Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::Tb() const
|
||||
forAll(pTb, facei)
|
||||
{
|
||||
pTb[facei] =
|
||||
this->patchFaceProducts(patchi, facei).TH(ph[facei], pT[facei]);
|
||||
this->patchFaceProducts(patchi, facei)
|
||||
.TH(ph[facei], pT[facei]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,10 +478,14 @@ Foam::hhuMixtureThermo<MixtureType>::psiu() const
|
||||
);
|
||||
|
||||
volScalarField& psiu = tpsiu();
|
||||
scalarField& psiuCells = psiu.internalField();
|
||||
const scalarField& TuCells = Tu_.internalField();
|
||||
const scalarField& pCells = p_.internalField();
|
||||
|
||||
forAll(psiu, celli)
|
||||
forAll(psiuCells, celli)
|
||||
{
|
||||
psiu[celli] = this->cellReactants(celli).psi(p_[celli], Tu_[celli]);
|
||||
psiuCells[celli] =
|
||||
this->cellReactants(celli).psi(pCells[celli], TuCells[celli]);
|
||||
}
|
||||
|
||||
forAll(psiu.boundaryField(), patchi)
|
||||
@ -421,12 +529,15 @@ Foam::hhuMixtureThermo<MixtureType>::psib() const
|
||||
);
|
||||
|
||||
volScalarField& psib = tpsib();
|
||||
|
||||
scalarField& psibCells = psib.internalField();
|
||||
volScalarField Tb_ = Tb();
|
||||
const scalarField& TbCells = Tb_.internalField();
|
||||
const scalarField& pCells = p_.internalField();
|
||||
|
||||
forAll(psib, celli)
|
||||
forAll(psibCells, celli)
|
||||
{
|
||||
psib[celli] = this->cellReactants(celli).psi(p_[celli], Tb_[celli]);
|
||||
psibCells[celli] =
|
||||
this->cellReactants(celli).psi(pCells[celli], TbCells[celli]);
|
||||
}
|
||||
|
||||
forAll(psib.boundaryField(), patchi)
|
||||
@ -449,7 +560,8 @@ Foam::hhuMixtureThermo<MixtureType>::psib() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::muu() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hhuMixtureThermo<MixtureType>::muu() const
|
||||
{
|
||||
tmp<volScalarField> tmuu
|
||||
(
|
||||
@ -469,10 +581,12 @@ Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::muu() const
|
||||
);
|
||||
|
||||
volScalarField& muu_ = tmuu();
|
||||
scalarField& muuCells = muu_.internalField();
|
||||
const scalarField& TuCells = Tu_.internalField();
|
||||
|
||||
forAll(muu_, celli)
|
||||
forAll(muuCells, celli)
|
||||
{
|
||||
muu_[celli] = this->cellReactants(celli).mu(Tu_[celli]);
|
||||
muuCells[celli] = this->cellReactants(celli).mu(TuCells[celli]);
|
||||
}
|
||||
|
||||
forAll(muu_.boundaryField(), patchi)
|
||||
@ -492,7 +606,8 @@ Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::muu() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::mub() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hhuMixtureThermo<MixtureType>::mub() const
|
||||
{
|
||||
tmp<volScalarField> tmub
|
||||
(
|
||||
@ -512,11 +627,13 @@ Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::mub() const
|
||||
);
|
||||
|
||||
volScalarField& mub_ = tmub();
|
||||
scalarField& mubCells = mub_.internalField();
|
||||
volScalarField Tb_ = Tb();
|
||||
const scalarField& TbCells = Tb_.internalField();
|
||||
|
||||
forAll(mub_, celli)
|
||||
forAll(mubCells, celli)
|
||||
{
|
||||
mub_[celli] = this->cellProducts(celli).mu(Tb_[celli]);
|
||||
mubCells[celli] = this->cellProducts(celli).mu(TbCells[celli]);
|
||||
}
|
||||
|
||||
forAll(mub_.boundaryField(), patchi)
|
||||
@ -526,7 +643,8 @@ Foam::tmp<Foam::volScalarField> Foam::hhuMixtureThermo<MixtureType>::mub() const
|
||||
|
||||
forAll(pMub, facei)
|
||||
{
|
||||
pMub[facei] = this->patchFaceProducts(patchi, facei).mu(pTb[facei]);
|
||||
pMub[facei] =
|
||||
this->patchFaceProducts(patchi, facei).mu(pTb[facei]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -73,21 +73,20 @@ public:
|
||||
hhuMixtureThermo(const fvMesh&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~hhuMixtureThermo();
|
||||
//- Destructor
|
||||
virtual ~hhuMixtureThermo();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the compostion of the combustion mixture
|
||||
combustionMixture& composition()
|
||||
virtual combustionMixture& composition()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- Return the compostion of the combustion mixture
|
||||
const combustionMixture& composition() const
|
||||
virtual const combustionMixture& composition() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
@ -95,38 +94,48 @@ public:
|
||||
//- Update properties
|
||||
virtual void correct();
|
||||
|
||||
//- Sensible enthalpy [J/kg]
|
||||
virtual tmp<volScalarField> hs() const;
|
||||
|
||||
//- Chemical enthalpy [J/kg]
|
||||
virtual tmp<volScalarField> hc() const;
|
||||
|
||||
|
||||
// Fields derived from thermodynamic state variables
|
||||
|
||||
//- Enthalpy for cell-set [J/kg]
|
||||
tmp<scalarField> h
|
||||
virtual tmp<scalarField> h
|
||||
(
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
) const;
|
||||
|
||||
//- Enthalpy for patch [J/kg]
|
||||
tmp<scalarField> h
|
||||
virtual tmp<scalarField> h
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity at constant pressure for patch [J/kg/K]
|
||||
tmp<scalarField> Cp(const scalarField& T, const label patchi) const;
|
||||
virtual tmp<scalarField> Cp
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity at constant pressure [J/kg/K]
|
||||
tmp<volScalarField> Cp() const;
|
||||
virtual tmp<volScalarField> Cp() const;
|
||||
|
||||
//- Unburnt gas enthalpy for cell-set [J/kg]
|
||||
tmp<scalarField> hu
|
||||
virtual tmp<scalarField> hu
|
||||
(
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
) const;
|
||||
|
||||
//- Unburnt gas enthalpy for patch [J/kg]
|
||||
tmp<scalarField> hu
|
||||
virtual tmp<scalarField> hu
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
@ -134,22 +143,22 @@ public:
|
||||
|
||||
|
||||
//- Burnt gas temperature [K]
|
||||
tmp<volScalarField> Tb() const;
|
||||
virtual tmp<volScalarField> Tb() const;
|
||||
|
||||
//- Unburnt gas compressibility [s^2/m^2]
|
||||
tmp<volScalarField> psiu() const;
|
||||
virtual tmp<volScalarField> psiu() const;
|
||||
|
||||
//- Burnt gas compressibility [s^2/m^2]
|
||||
tmp<volScalarField> psib() const;
|
||||
virtual tmp<volScalarField> psib() const;
|
||||
|
||||
|
||||
// Access to transport variables
|
||||
|
||||
//- Dynamic viscosity of unburnt gas [kg/ms]
|
||||
tmp<volScalarField> muu() const;
|
||||
virtual tmp<volScalarField> muu() const;
|
||||
|
||||
//- Dynamic viscosity of burnt gas [kg/ms]
|
||||
tmp<volScalarField> mub() const;
|
||||
virtual tmp<volScalarField> mub() const;
|
||||
|
||||
|
||||
//- Read thermophysicalProperties dictionary
|
||||
|
||||
@ -22,35 +22,27 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
Base class of the thermophysical property types.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "specie.H"
|
||||
#include "IOstreams.H"
|
||||
#include "dimensionedConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/* * * * * * * * * * * * * public constants * * * * * * * * * * * * */
|
||||
|
||||
//- Universal gas constant (default in [J/(kmol K)])
|
||||
const scalar specie::RR = dimensionedConstant("R", 8314.51);
|
||||
const Foam::scalar Foam::specie::RR = dimensionedConstant("R", 8314.51);
|
||||
|
||||
//- Standard pressure (default in [Pa])
|
||||
const scalar specie::Pstd = dimensionedConstant("Pstd", 1.0e5);
|
||||
const Foam::scalar Foam::specie::Pstd = dimensionedConstant("Pstd", 1.0e5);
|
||||
|
||||
//- Standard temperature (default in [K])
|
||||
const scalar specie::Tstd = dimensionedConstant("Tstd", 298.15);
|
||||
const Foam::scalar Foam::specie::Tstd = dimensionedConstant("Tstd", 298.15);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
specie::specie(Istream& is)
|
||||
Foam::specie::specie(Istream& is)
|
||||
:
|
||||
name_(is),
|
||||
nMoles_(readScalar(is)),
|
||||
@ -62,7 +54,7 @@ specie::specie(Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
Ostream& operator<<(Ostream& os, const specie& st)
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const specie& st)
|
||||
{
|
||||
os << st.name_ << tab
|
||||
<< st.nMoles_ << tab
|
||||
@ -73,8 +65,4 @@ Ostream& operator<<(Ostream& os, const specie& st)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -22,27 +22,18 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
Constant properties thermodynamics package derived from the basic
|
||||
thermo package data type specieThermo.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "eConstThermo.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
eConstThermo::eConstThermo(Istream& is)
|
||||
Foam::eConstThermo::eConstThermo(Istream& is)
|
||||
:
|
||||
specieThermo(is),
|
||||
CV(readScalar(is)),
|
||||
Hf(readScalar(is))
|
||||
Cv_(readScalar(is)),
|
||||
Hf_(readScalar(is))
|
||||
{
|
||||
is.check("eConstThermo::eConstThermo(Istream& is)");
|
||||
}
|
||||
@ -50,17 +41,13 @@ eConstThermo::eConstThermo(Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
Ostream& operator<<(Ostream& os, const eConstThermo& ct)
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const eConstThermo& ct)
|
||||
{
|
||||
os << (const specieThermo&)ct << tab << ct.CV << tab << ct.Hf;
|
||||
os << (const specieThermo&)ct << tab << ct.Cv_ << tab << ct.Hf_;
|
||||
|
||||
os.check("Ostream& operator<<(Ostream& os, const eConstThermo& ct)");
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -95,13 +95,13 @@ class eConstThermo
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar CV;
|
||||
scalar Hf;
|
||||
scalar Cv_;
|
||||
scalar Hf_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- construct from components
|
||||
//- Construct from components
|
||||
inline eConstThermo
|
||||
(
|
||||
const specieThermo& st,
|
||||
@ -109,6 +109,7 @@ class eConstThermo
|
||||
const scalar hf
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
@ -136,6 +137,12 @@ public:
|
||||
//- Enthalpy [J/kmol]
|
||||
inline scalar h(const scalar T) const;
|
||||
|
||||
//- Sensible Enthalpy [J/kmol]
|
||||
inline scalar hs(const scalar T) const;
|
||||
|
||||
//- Chemical enthalpy [J/kmol]
|
||||
inline scalar hc() const;
|
||||
|
||||
//- Entropy [J/(kmol K)]
|
||||
inline scalar s(const scalar T) const;
|
||||
|
||||
|
||||
@ -34,8 +34,8 @@ inline Foam::eConstThermo::eConstThermo
|
||||
)
|
||||
:
|
||||
specieThermo(st),
|
||||
CV(cv),
|
||||
Hf(hf)
|
||||
Cv_(cv),
|
||||
Hf_(hf)
|
||||
{}
|
||||
|
||||
|
||||
@ -48,8 +48,8 @@ inline Foam::eConstThermo::eConstThermo
|
||||
)
|
||||
:
|
||||
specieThermo(name, ct),
|
||||
CV(ct.CV),
|
||||
Hf(ct.Hf)
|
||||
Cv_(ct.Cv_),
|
||||
Hf_(ct.Hf_)
|
||||
{}
|
||||
|
||||
|
||||
@ -79,13 +79,26 @@ Foam::eConstThermo<equationOfState>::New(Istream& is)
|
||||
|
||||
inline Foam::scalar Foam::eConstThermo::cp(const scalar) const
|
||||
{
|
||||
return CV*W() + RR;
|
||||
return Cv_*W() + RR;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::eConstThermo::h(const scalar T) const
|
||||
{
|
||||
return cp(T)*T + Hf*W();
|
||||
return cp(T)*T + Hf_*W();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::eConstThermo::hs(const scalar T) const
|
||||
{
|
||||
return cp(T)*T;
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::eConstThermo<equationOfState>::hc() const
|
||||
{
|
||||
return Hf_*this->W();
|
||||
}
|
||||
|
||||
|
||||
@ -102,7 +115,7 @@ inline Foam::scalar Foam::eConstThermo::TH
|
||||
const scalar T0
|
||||
) const
|
||||
{
|
||||
return (h - Hf)/Cp(T0);
|
||||
return (h - Hf_)/Cp(T0);
|
||||
}
|
||||
|
||||
|
||||
@ -112,7 +125,7 @@ inline Foam::scalar Foam::eConstThermo::TE
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return (e - Hf)/CV;
|
||||
return (e - Hf_)/Cv_;
|
||||
}
|
||||
|
||||
|
||||
@ -125,8 +138,8 @@ inline Foam::eConstThermo& Foam::eConstThermo::operator=
|
||||
{
|
||||
specieThermo::operator=(ct);
|
||||
|
||||
CV = ct.CV;
|
||||
Hf = ct.Hf;
|
||||
Cv_ = ct.Cv_;
|
||||
Hf_ = ct.Hf_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -145,8 +158,8 @@ inline Foam::eConstThermo Foam::operator+
|
||||
return eConstThermo
|
||||
(
|
||||
st,
|
||||
ct1.nMoles()/st.nMoles()*ct1.CV + ct2.nMoles()/st.nMoles()*ct2.CV,
|
||||
ct1.nMoles()/st.nMoles()*ct1.Hf + ct2.nMoles()/st.nMoles()*ct2.Hf
|
||||
ct1.nMoles()/st.nMoles()*ct1.Cv_ + ct2.nMoles()/st.nMoles()*ct2.Cv_,
|
||||
ct1.nMoles()/st.nMoles()*ct1.Hf_ + ct2.nMoles()/st.nMoles()*ct2.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
@ -162,8 +175,8 @@ inline Foam::eConstThermo Foam::operator-
|
||||
return eConstThermo
|
||||
(
|
||||
st,
|
||||
ct1.nMoles()/st.nMoles()*ct1.CV - ct2.nMoles()/st.nMoles()*ct2.CV,
|
||||
ct1.nMoles()/st.nMoles()*ct1.Hf - ct2.nMoles()/st.nMoles()*ct2.Hf
|
||||
ct1.nMoles()/st.nMoles()*ct1.Cv_ - ct2.nMoles()/st.nMoles()*ct2.Cv_,
|
||||
ct1.nMoles()/st.nMoles()*ct1.Hf_ - ct2.nMoles()/st.nMoles()*ct2.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
@ -177,8 +190,8 @@ inline Foam::eConstThermo Foam::operator*
|
||||
return eConstThermo
|
||||
(
|
||||
s*((const specieThermo&)ct),
|
||||
ct.CV,
|
||||
ct.Hf
|
||||
ct.Cv_,
|
||||
ct.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -22,28 +22,19 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
Constant properties thermodynamics package
|
||||
templated ito the equationOfState.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "hConstThermo.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class equationOfState>
|
||||
hConstThermo<equationOfState>::hConstThermo(Istream& is)
|
||||
Foam::hConstThermo<equationOfState>::hConstThermo(Istream& is)
|
||||
:
|
||||
equationOfState(is),
|
||||
CP(readScalar(is)),
|
||||
Hf(readScalar(is))
|
||||
Cp_(readScalar(is)),
|
||||
Hf_(readScalar(is))
|
||||
{
|
||||
is.check("hConstThermo::hConstThermo(Istream& is)");
|
||||
}
|
||||
@ -52,18 +43,18 @@ hConstThermo<equationOfState>::hConstThermo(Istream& is)
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class equationOfState>
|
||||
Ostream& operator<<(Ostream& os, const hConstThermo<equationOfState>& ct)
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const hConstThermo<equationOfState>& ct
|
||||
)
|
||||
{
|
||||
os << static_cast<const equationOfState&>(ct) << tab
|
||||
<< ct.CP << tab << ct.Hf;
|
||||
<< ct.Cp_ << tab << ct.Hf_;
|
||||
|
||||
os.check("Ostream& operator<<(Ostream& os, const hConstThermo& ct)");
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -94,13 +94,13 @@ class hConstThermo
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar CP;
|
||||
scalar Hf;
|
||||
scalar Cp_;
|
||||
scalar Hf_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- construct from components
|
||||
//- Construct from components
|
||||
inline hConstThermo
|
||||
(
|
||||
const equationOfState& st,
|
||||
@ -136,6 +136,12 @@ public:
|
||||
//- Enthalpy [J/kmol]
|
||||
inline scalar h(const scalar T) const;
|
||||
|
||||
//- Sensible enthalpy [J/kmol]
|
||||
inline scalar hs(const scalar T) const;
|
||||
|
||||
//- Chemical enthalpy [J/kmol]
|
||||
inline scalar hc() const;
|
||||
|
||||
//- Entropy [J/(kmol K)]
|
||||
inline scalar s(const scalar T) const;
|
||||
|
||||
|
||||
@ -35,8 +35,8 @@ inline Foam::hConstThermo<equationOfState>::hConstThermo
|
||||
)
|
||||
:
|
||||
equationOfState(st),
|
||||
CP(cp),
|
||||
Hf(hf)
|
||||
Cp_(cp),
|
||||
Hf_(hf)
|
||||
{}
|
||||
|
||||
|
||||
@ -50,8 +50,8 @@ inline Foam::hConstThermo<equationOfState>::hConstThermo
|
||||
)
|
||||
:
|
||||
equationOfState(name, ct),
|
||||
CP(ct.CP),
|
||||
Hf(ct.Hf)
|
||||
Cp_(ct.Cp_),
|
||||
Hf_(ct.Hf_)
|
||||
{}
|
||||
|
||||
|
||||
@ -80,21 +80,47 @@ Foam::hConstThermo<equationOfState>::New(Istream& is)
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::hConstThermo<equationOfState>::cp(const scalar) const
|
||||
inline Foam::scalar Foam::hConstThermo<equationOfState>::cp
|
||||
(
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return CP*this->W();
|
||||
return Cp_*this->W();
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::hConstThermo<equationOfState>::h(const scalar T) const
|
||||
inline Foam::scalar Foam::hConstThermo<equationOfState>::h
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return (CP*T + Hf)*this->W();
|
||||
return (Cp_*T + Hf_)*this->W();
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::hConstThermo<equationOfState>::s(const scalar T) const
|
||||
inline Foam::scalar Foam::hConstThermo<equationOfState>::hs
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return Cp_*T*this->W();
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::hConstThermo<equationOfState>::hc() const
|
||||
{
|
||||
return Hf_*this->W();
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::hConstThermo<equationOfState>::s
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
@ -119,8 +145,8 @@ inline void Foam::hConstThermo<equationOfState>::operator+=
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = ct.nMoles()/this->nMoles();
|
||||
|
||||
CP = molr1*CP + molr2*ct.CP;
|
||||
Hf = molr1*Hf + molr2*ct.Hf;
|
||||
Cp_ = molr1*Cp_ + molr2*ct.Cp_;
|
||||
Hf_ = molr1*Hf_ + molr2*ct.Hf_;
|
||||
}
|
||||
|
||||
|
||||
@ -137,8 +163,8 @@ inline void Foam::hConstThermo<equationOfState>::operator-=
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = ct.nMoles()/this->nMoles();
|
||||
|
||||
CP = molr1*CP - molr2*ct.CP;
|
||||
Hf = molr1*Hf - molr2*ct.Hf;
|
||||
Cp_ = molr1*Cp_ - molr2*ct.Cp_;
|
||||
Hf_ = molr1*Hf_ - molr2*ct.Hf_;
|
||||
}
|
||||
|
||||
|
||||
@ -160,8 +186,10 @@ inline Foam::hConstThermo<equationOfState> Foam::operator+
|
||||
return hConstThermo<equationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.CP + ct2.nMoles()/eofs.nMoles()*ct2.CP,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Hf + ct2.nMoles()/eofs.nMoles()*ct2.Hf
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Cp_
|
||||
+ ct2.nMoles()/eofs.nMoles()*ct2.Cp_,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Hf_
|
||||
+ ct2.nMoles()/eofs.nMoles()*ct2.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
@ -182,8 +210,10 @@ inline Foam::hConstThermo<equationOfState> Foam::operator-
|
||||
return hConstThermo<equationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.CP - ct2.nMoles()/eofs.nMoles()*ct2.CP,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Hf - ct2.nMoles()/eofs.nMoles()*ct2.Hf
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Cp_
|
||||
- ct2.nMoles()/eofs.nMoles()*ct2.Cp_,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Hf_
|
||||
- ct2.nMoles()/eofs.nMoles()*ct2.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
@ -198,8 +228,8 @@ inline Foam::hConstThermo<equationOfState> Foam::operator*
|
||||
return hConstThermo<equationOfState>
|
||||
(
|
||||
s*static_cast<const equationOfState&>(ct),
|
||||
ct.CP,
|
||||
ct.Hf
|
||||
ct.Cp_,
|
||||
ct.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -22,23 +22,15 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
JANAF tables based thermodynamics package templated ito the equationOfState.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "janafThermo.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class equationOfState>
|
||||
janafThermo<equationOfState>::janafThermo(Istream& is)
|
||||
Foam::janafThermo<equationOfState>::janafThermo(Istream& is)
|
||||
:
|
||||
equationOfState(is),
|
||||
Tlow_(readScalar(is)),
|
||||
@ -103,7 +95,11 @@ janafThermo<equationOfState>::janafThermo(Istream& is)
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class equationOfState>
|
||||
Ostream& operator<<(Ostream& os, const janafThermo<equationOfState>& jt)
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const janafThermo<equationOfState>& jt
|
||||
)
|
||||
{
|
||||
os << static_cast<const equationOfState&>(jt) << nl
|
||||
<< " " << jt.Tlow_
|
||||
@ -145,8 +141,4 @@ Ostream& operator<<(Ostream& os, const janafThermo<equationOfState>& jt)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -150,6 +150,12 @@ public:
|
||||
//- Enthalpy [J/kmol]
|
||||
inline scalar h(const scalar T) const;
|
||||
|
||||
//- Sensible enthalpy [J/kmol]
|
||||
inline scalar hs(const scalar T) const;
|
||||
|
||||
//- Chemical enthalpy [J/kmol]
|
||||
inline scalar hc() const;
|
||||
|
||||
//- Entropy [J/(kmol K)]
|
||||
inline scalar s(const scalar T) const;
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "janafThermo.H"
|
||||
#include "specie.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -130,8 +131,7 @@ inline Foam::scalar Foam::janafThermo<equationOfState>::h
|
||||
) const
|
||||
{
|
||||
const coeffArray& a = coeffs(T);
|
||||
return
|
||||
this->RR*
|
||||
return this->RR*
|
||||
(
|
||||
((((a[4]/5.0*T + a[3]/4.0)*T + a[2]/3.0)*T + a[1]/2.0)*T + a[0])*T
|
||||
+ a[5]
|
||||
@ -139,6 +139,36 @@ inline Foam::scalar Foam::janafThermo<equationOfState>::h
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::janafThermo<equationOfState>::hs
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
const coeffArray& a = coeffs(T);
|
||||
scalar Tr = T - specie::Tstd;
|
||||
return this->RR*
|
||||
(
|
||||
((((a[4]/5.0*Tr + a[3]/4.0)*Tr + a[2]/3.0)*Tr + a[1]/2.0)*Tr + a[0])*Tr
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::janafThermo<equationOfState>::hc() const
|
||||
{
|
||||
const coeffArray& a = lowCpCoeffs_;
|
||||
const scalar& Tstd = specie::Tstd;
|
||||
return this->RR*
|
||||
(
|
||||
(
|
||||
(((a[4]/5.0*Tstd + a[3]/4.0)*Tstd + a[2]/3.0)*Tstd + a[1]/2.0)*Tstd
|
||||
+ a[0]
|
||||
)*Tstd
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::janafThermo<equationOfState>::s
|
||||
(
|
||||
|
||||
@ -22,34 +22,24 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
Basic thermodynamics type based on the use of fitting functions for
|
||||
cp, h, s obtained from the template argument type thermo. All other
|
||||
properties are derived from these primitive functions.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "specieThermo.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
|
||||
|
||||
template<class thermo>
|
||||
const scalar specieThermo<thermo>::tol_ = 1.0e-4;
|
||||
const Foam::scalar Foam::specieThermo<thermo>::tol_ = 1.0e-4;
|
||||
|
||||
template<class thermo>
|
||||
const int specieThermo<thermo>::maxIter_ = 100;
|
||||
const int Foam::specieThermo<thermo>::maxIter_ = 100;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class thermo>
|
||||
specieThermo<thermo>::specieThermo(Istream& is)
|
||||
Foam::specieThermo<thermo>::specieThermo(Istream& is)
|
||||
:
|
||||
thermo(is)
|
||||
{
|
||||
@ -60,7 +50,7 @@ specieThermo<thermo>::specieThermo(Istream& is)
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class thermo>
|
||||
Ostream& operator<<(Ostream& os, const specieThermo<thermo>& st)
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const specieThermo<thermo>& st)
|
||||
{
|
||||
os << static_cast<const thermo&>(st);
|
||||
|
||||
@ -69,8 +59,4 @@ Ostream& operator<<(Ostream& os, const specieThermo<thermo>& st)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -140,6 +140,12 @@ public:
|
||||
// Enthalpy [J/kmol]
|
||||
//scalar h(const scalar) const;
|
||||
|
||||
// Sensible enthalpy [J/kmol]
|
||||
//scalar hs(const scalar) const;
|
||||
|
||||
// Chemical enthalpy [J/kmol]
|
||||
//scalar hc(const scalar) const;
|
||||
|
||||
// Entropy [J/(kmol K)]
|
||||
//scalar s(const scalar) const;
|
||||
|
||||
@ -158,6 +164,9 @@ public:
|
||||
//- Internal energy [J/kmol]
|
||||
inline scalar e(const scalar T) const;
|
||||
|
||||
//- Sensible internal energy [J/kmol]
|
||||
inline scalar es(const scalar T) const;
|
||||
|
||||
//- Gibbs free energy [J/kmol]
|
||||
inline scalar g(const scalar T) const;
|
||||
|
||||
@ -176,6 +185,12 @@ public:
|
||||
//- Enthalpy [J/kg]
|
||||
inline scalar H(const scalar T) const;
|
||||
|
||||
//- Sensible enthalpy [J/kg]
|
||||
inline scalar Hs(const scalar T) const;
|
||||
|
||||
//- Chemical enthalpy [J/kg]
|
||||
inline scalar Hc() const;
|
||||
|
||||
//- Entropy [J/(kg K)]
|
||||
inline scalar S(const scalar T) const;
|
||||
|
||||
|
||||
@ -24,20 +24,12 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "specieThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// construct from components
|
||||
template<class thermo>
|
||||
inline specieThermo<thermo>::specieThermo
|
||||
inline Foam::specieThermo<thermo>::specieThermo
|
||||
(
|
||||
const thermo& sp
|
||||
)
|
||||
@ -46,10 +38,8 @@ inline specieThermo<thermo>::specieThermo
|
||||
{}
|
||||
|
||||
|
||||
// return the temperature corresponding to the value of the
|
||||
// thermodynamic property f, given the function f = F(T) and dF(T)/dT
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::T
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::T
|
||||
(
|
||||
scalar f,
|
||||
scalar T0,
|
||||
@ -87,9 +77,8 @@ inline scalar specieThermo<thermo>::T
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct as named copy
|
||||
template<class thermo>
|
||||
inline specieThermo<thermo>::specieThermo
|
||||
inline Foam::specieThermo<thermo>::specieThermo
|
||||
(
|
||||
const word& name,
|
||||
const specieThermo& st
|
||||
@ -101,105 +90,114 @@ inline specieThermo<thermo>::specieThermo
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Calculate and return derived properties
|
||||
// (These functions need not provided in derived types)
|
||||
|
||||
// mole specific properties
|
||||
|
||||
// Heat capacities [J/(kmol K)]
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::cv(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::cv(const scalar T) const
|
||||
{
|
||||
return this->cp(T) - this->RR;
|
||||
}
|
||||
|
||||
// gamma = cp/cv []
|
||||
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::gamma(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::gamma(const scalar T) const
|
||||
{
|
||||
scalar CP = this->cp(T);
|
||||
return CP/(CP - this->RR);
|
||||
}
|
||||
|
||||
// Internal energy [J/kmol]
|
||||
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::e(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::e(const scalar T) const
|
||||
{
|
||||
return this->h(T) - this->RR*(T - this->Tstd);
|
||||
}
|
||||
|
||||
// Gibbs free energy [J/kmol]
|
||||
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::g(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::es(const scalar T) const
|
||||
{
|
||||
return this->hs(T) - this->RR*(T - this->Tstd);
|
||||
}
|
||||
|
||||
|
||||
template<class thermo>
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::g(const scalar T) const
|
||||
{
|
||||
return this->h(T) - T*this->s(T);
|
||||
}
|
||||
|
||||
// Helmholtz free energy [J/kmol]
|
||||
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::a(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::a(const scalar T) const
|
||||
{
|
||||
return this->e(T) - T*this->s(T);
|
||||
}
|
||||
|
||||
|
||||
// mass specific properties
|
||||
|
||||
// Heat capacity at constant pressure [J/(kg K)]
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::Cp(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::Cp(const scalar T) const
|
||||
{
|
||||
return this->cp(T)/this->W();
|
||||
}
|
||||
|
||||
// Heat capacity at constant pressure [J/(kg K)]
|
||||
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::Cv(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::Cv(const scalar T) const
|
||||
{
|
||||
return this->cv(T)/this->W();
|
||||
}
|
||||
|
||||
// Enthalpy [J/kg]
|
||||
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::H(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::H(const scalar T) const
|
||||
{
|
||||
return this->h(T)/this->W();
|
||||
}
|
||||
|
||||
// Entropy [J/kg]
|
||||
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::S(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::Hs(const scalar T) const
|
||||
{
|
||||
return this->hs(T)/this->W();
|
||||
}
|
||||
|
||||
|
||||
template<class thermo>
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::Hc() const
|
||||
{
|
||||
return this->hc()/this->W();
|
||||
}
|
||||
|
||||
|
||||
template<class thermo>
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::S(const scalar T) const
|
||||
{
|
||||
return this->s(T)/this->W();
|
||||
}
|
||||
|
||||
// Internal energy [J/kg]
|
||||
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::E(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::E(const scalar T) const
|
||||
{
|
||||
return this->e(T)/this->W();
|
||||
}
|
||||
|
||||
// Gibbs free energy [J/kg]
|
||||
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::G(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::G(const scalar T) const
|
||||
{
|
||||
return this->g(T)/this->W();
|
||||
}
|
||||
|
||||
// Helmholtz free energy [J/kg]
|
||||
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::A(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::A(const scalar T) const
|
||||
{
|
||||
return this->a(T)/this->W();
|
||||
}
|
||||
|
||||
|
||||
// Equilibrium reaction thermodynamics
|
||||
|
||||
// Equilibrium constant []
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::K(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::K(const scalar T) const
|
||||
{
|
||||
scalar arg = -this->nMoles()*this->g(T)/(this->RR*T);
|
||||
|
||||
@ -213,21 +211,16 @@ inline scalar specieThermo<thermo>::K(const scalar T) const
|
||||
}
|
||||
}
|
||||
|
||||
//- Equilibrium constant [] i.t.o. partial pressures
|
||||
// = PIi(pi/Pstd)^nui
|
||||
// For low pressures (where the gas mixture is near perfect) Kp = K
|
||||
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::Kp(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::Kp(const scalar T) const
|
||||
{
|
||||
return K(T);
|
||||
}
|
||||
|
||||
|
||||
//- Equilibrium constant i.t.o. concentration
|
||||
// For low pressures (where the gas mixture is near perfect)
|
||||
// Kc = Kp(pstd/(RR*T))^nu
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::Kc(const scalar T) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::Kc(const scalar T) const
|
||||
{
|
||||
if (equal(this->nMoles(), SMALL))
|
||||
{
|
||||
@ -240,11 +233,12 @@ inline scalar specieThermo<thermo>::Kc(const scalar T) const
|
||||
}
|
||||
|
||||
|
||||
//- Equilibrium constant [] i.t.o. mole-fractions
|
||||
// For low pressures (where the gas mixture is near perfect)
|
||||
// Kx = Kp(pstd/p)^nui
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::Kx(const scalar T, const scalar p) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::Kx
|
||||
(
|
||||
const scalar T,
|
||||
const scalar p
|
||||
) const
|
||||
{
|
||||
if (equal(this->nMoles(), SMALL))
|
||||
{
|
||||
@ -257,11 +251,8 @@ inline scalar specieThermo<thermo>::Kx(const scalar T, const scalar p) const
|
||||
}
|
||||
|
||||
|
||||
//- Equilibrium constant [] i.t.o. number of moles
|
||||
// For low pressures (where the gas mixture is near perfect)
|
||||
// Kn = Kp(n*pstd/p)^nui where n = number of moles in mixture
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::Kn
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::Kn
|
||||
(
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
@ -279,19 +270,23 @@ inline scalar specieThermo<thermo>::Kn
|
||||
}
|
||||
|
||||
|
||||
// Energy->temperature inversion functions
|
||||
|
||||
// Temperature from Enthalpy given an initial temperature T0
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::TH(const scalar h, const scalar T0) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::TH
|
||||
(
|
||||
const scalar h,
|
||||
const scalar T0
|
||||
) const
|
||||
{
|
||||
return T(h, T0, &specieThermo<thermo>::H, &specieThermo<thermo>::Cp);
|
||||
}
|
||||
|
||||
|
||||
// Temperature from internal energy given an initial temperature T0
|
||||
template<class thermo>
|
||||
inline scalar specieThermo<thermo>::TE(const scalar e, const scalar T0) const
|
||||
inline Foam::scalar Foam::specieThermo<thermo>::TE
|
||||
(
|
||||
const scalar e,
|
||||
const scalar T0
|
||||
) const
|
||||
{
|
||||
return T(e, T0, &specieThermo<thermo>::E, &specieThermo<thermo>::Cv);
|
||||
}
|
||||
@ -300,19 +295,25 @@ inline scalar specieThermo<thermo>::TE(const scalar e, const scalar T0) const
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class thermo>
|
||||
inline void specieThermo<thermo>::operator+=(const specieThermo<thermo>& st)
|
||||
inline void Foam::specieThermo<thermo>::operator+=
|
||||
(
|
||||
const specieThermo<thermo>& st
|
||||
)
|
||||
{
|
||||
thermo::operator+=(st);
|
||||
}
|
||||
|
||||
template<class thermo>
|
||||
inline void specieThermo<thermo>::operator-=(const specieThermo<thermo>& st)
|
||||
inline void Foam::specieThermo<thermo>::operator-=
|
||||
(
|
||||
const specieThermo<thermo>& st
|
||||
)
|
||||
{
|
||||
thermo::operator-=(st);
|
||||
}
|
||||
|
||||
template<class thermo>
|
||||
inline void specieThermo<thermo>::operator*=(const scalar s)
|
||||
inline void Foam::specieThermo<thermo>::operator*=(const scalar s)
|
||||
{
|
||||
thermo::operator*=(s);
|
||||
}
|
||||
@ -321,7 +322,7 @@ inline void specieThermo<thermo>::operator*=(const scalar s)
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class thermo>
|
||||
inline specieThermo<thermo> operator+
|
||||
inline Foam::specieThermo<thermo> Foam::operator+
|
||||
(
|
||||
const specieThermo<thermo>& st1,
|
||||
const specieThermo<thermo>& st2
|
||||
@ -335,7 +336,7 @@ inline specieThermo<thermo> operator+
|
||||
|
||||
|
||||
template<class thermo>
|
||||
inline specieThermo<thermo> operator-
|
||||
inline Foam::specieThermo<thermo> Foam::operator-
|
||||
(
|
||||
const specieThermo<thermo>& st1,
|
||||
const specieThermo<thermo>& st2
|
||||
@ -349,7 +350,7 @@ inline specieThermo<thermo> operator-
|
||||
|
||||
|
||||
template<class thermo>
|
||||
inline specieThermo<thermo> operator*
|
||||
inline Foam::specieThermo<thermo> Foam::operator*
|
||||
(
|
||||
const scalar s,
|
||||
const specieThermo<thermo>& st
|
||||
@ -363,7 +364,7 @@ inline specieThermo<thermo> operator*
|
||||
|
||||
|
||||
template<class thermo>
|
||||
inline specieThermo<thermo> operator==
|
||||
inline Foam::specieThermo<thermo> Foam::operator==
|
||||
(
|
||||
const specieThermo<thermo>& st1,
|
||||
const specieThermo<thermo>& st2
|
||||
@ -373,8 +374,4 @@ inline specieThermo<thermo> operator==
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user