ENH: Further updates relating from vhange from total- to sensible enthalpy

- Added chemical enthalpy access function to top level api.
- Re-worked source term for enthalpy equation(s) in chemistry model, and
- Re-worked heat release calculation

STYLE: Using worded dimensions instead of dimensionSet(...)
This commit is contained in:
andy
2010-02-12 16:54:12 +00:00
parent 76036b5d8b
commit b635f73f51
16 changed files with 96 additions and 63 deletions

View File

@ -343,6 +343,13 @@ Foam::tmp<Foam::scalarField> Foam::basicThermo::hs
} }
Foam::tmp<Foam::volScalarField> Foam::basicThermo::hc() const
{
notImplemented("basicThermo::hc()");
return volScalarField::null();
}
Foam::volScalarField& Foam::basicThermo::e() Foam::volScalarField& Foam::basicThermo::e()
{ {
notImplemented("basicThermo::e()"); notImplemented("basicThermo::e()");

View File

@ -183,6 +183,9 @@ public:
const label patchi const label patchi
) const; ) const;
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
//- Internal energy [J/kg] //- Internal energy [J/kg]
// Non-const access allowed for transport equations // Non-const access allowed for transport equations
virtual volScalarField& e(); virtual volScalarField& e();

View File

@ -466,7 +466,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
this->thermo().rho() this->thermo().rho()
); );
tmp<volScalarField> tsource tmp<volScalarField> ttc
( (
new volScalarField new volScalarField
( (
@ -484,7 +484,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
) )
); );
scalarField& t = tsource(); scalarField& tc = ttc();
label nReaction = reactions_.size(); label nReaction = reactions_.size();
@ -517,17 +517,59 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
forAll(R.rhs(), s) forAll(R.rhs(), s)
{ {
scalar sr = R.rhs()[s].stoichCoeff; scalar sr = R.rhs()[s].stoichCoeff;
t[celli] += sr*pf*cf; tc[celli] += sr*pf*cf;
} }
} }
t[celli] = nReaction*cSum/t[celli]; tc[celli] = nReaction*cSum/tc[celli];
} }
} }
tsource().correctBoundaryConditions(); ttc().correctBoundaryConditions();
return tsource; return ttc;
}
template<class CompType, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::ODEChemistryModel<CompType, ThermoType>::Sh() const
{
tmp<volScalarField> trhodQ
(
new volScalarField
(
IOobject
(
"Sh",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh_,
dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->chemistry_)
{
scalarField& rhodQ = trhodQ();
forAll(Y_, i)
{
forAll(rhodQ, cellI)
{
scalar Ti = this->thermo().T()[cellI];
scalar hi = specieThermo_[i].H(Ti);
rhodQ[cellI] -= hi*RR_[i][cellI];
}
}
}
return trhodQ;
} }
@ -545,37 +587,19 @@ Foam::ODEChemistryModel<CompType, ThermoType>::dQ() const
this->mesh_.time().timeName(), this->mesh_.time().timeName(),
this->mesh_, this->mesh_,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE,
false
), ),
this->mesh_, this->mesh_,
dimensionedScalar dimensionedScalar("dQ", dimEnergy/dimTime, 0.0),
( zeroGradientFvPatchScalarField::typeName
"zero",
dimensionSet(0, 2, -3 , 0, 0, 0, 0),
0.0
)
) )
); );
if (this->chemistry_) if (this->chemistry_)
{ {
scalarField& dQ = tdQ(); volScalarField& dQ = tdQ();
dQ.dimensionedInternalField() = this->mesh_.V()*Sh()();
scalarField rhoEff(dQ.size(), 0.0);
forAll(Y_, i)
{
forAll(dQ, cellI)
{
scalar Ti = this->thermo().T()[cellI];
scalar pi = this->thermo().p()[cellI];
rhoEff[cellI] += Y_[i][cellI]*specieThermo_[i].rho(pi, Ti);
scalar hi = specieThermo_[i].H(Ti);
dQ[cellI] -= hi*RR_[i][cellI];
}
}
dQ /= rhoEff;
} }
return tdQ; return tdQ;
@ -678,6 +702,9 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
scalar deltaTMin = GREAT; scalar deltaTMin = GREAT;
tmp<volScalarField> thc = this->thermo().hc();
const scalarField& hc = thc();
forAll(rho, celli) forAll(rho, celli)
{ {
for (label i=0; i<nSpecie_; i++) for (label i=0; i<nSpecie_; i++)
@ -687,7 +714,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
scalar rhoi = rho[celli]; scalar rhoi = rho[celli];
scalar Ti = this->thermo().T()[celli]; scalar Ti = this->thermo().T()[celli];
scalar hi = this->thermo().h()[celli]; scalar hi = this->thermo().hs()[celli] + hc[celli];
scalar pi = this->thermo().p()[celli]; scalar pi = this->thermo().p()[celli];
scalarField c(nSpecie_); scalarField c(nSpecie_);

View File

@ -182,6 +182,9 @@ public:
//- Return the chemical time scale //- Return the chemical time scale
virtual tmp<volScalarField> tc() const; virtual tmp<volScalarField> tc() const;
//- Return source for enthalpy equation [kg/m/s3]
virtual tmp<volScalarField> Sh() const;
//- Return the heat release, i.e. enthalpy/sec [m2/s3] //- Return the heat release, i.e. enthalpy/sec [m2/s3]
virtual tmp<volScalarField> dQ() const; virtual tmp<volScalarField> dQ() const;

View File

@ -97,7 +97,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::RR
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
this->mesh(), this->mesh(),
dimensionedScalar("zero", dimensionSet(1, -3, -1, 0, 0), 0.0), dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName zeroGradientFvPatchScalarField::typeName
) )
); );

View File

@ -120,7 +120,7 @@ public:
// Fields // Fields
//- Return const access to chemical source terms //- Return const access to chemical source terms [kg/m3/s]
virtual tmp<volScalarField> RR(const label i) const = 0; virtual tmp<volScalarField> RR(const label i) const = 0;
@ -133,7 +133,10 @@ public:
//- Return the chemical time scale //- Return the chemical time scale
virtual tmp<volScalarField> tc() const = 0; virtual tmp<volScalarField> tc() const = 0;
//- Return the heat release //- Return source for enthalpy equation [kg/m/s3]
virtual tmp<volScalarField> Sh() const = 0;
//- Return the heat release, i.e. enthalpy/sec [m2/s3]
virtual tmp<volScalarField> dQ() const = 0; virtual tmp<volScalarField> dQ() const = 0;
}; };

View File

@ -128,9 +128,6 @@ public:
} }
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const = 0;
//- Update properties //- Update properties
virtual void correct() = 0; virtual void correct() = 0;
}; };

View File

@ -127,8 +127,6 @@ public:
return hs_; return hs_;
} }
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const = 0;
//- Update properties //- Update properties
virtual void correct() = 0; virtual void correct() = 0;

View File

@ -280,7 +280,7 @@ Foam::hPsiMixtureThermo<MixtureType>::Cp() const
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh, mesh,
dimensionSet(0, 2, -2, -1, 0) dimEnergy/dimMass/dimTemperature
) )
); );

View File

@ -94,12 +94,12 @@ public:
//- Update properties //- Update properties
virtual void correct(); virtual void correct();
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
// Fields derived from thermodynamic state variables // Fields derived from thermodynamic state variables
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
//- Enthalpy for cell-set [J/kg] //- Enthalpy for cell-set [J/kg]
virtual tmp<scalarField> h virtual tmp<scalarField> h
( (

View File

@ -296,7 +296,7 @@ Foam::hhuMixtureThermo<MixtureType>::Cp() const
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh, mesh,
dimensionSet(0, 2, -2, -1, 0) dimEnergy/dimMass/dimTemperature
) )
); );

View File

@ -205,15 +205,15 @@ Foam::hsPsiMixtureThermo<MixtureType>::hs
const labelList& cells const labelList& cells
) const ) const
{ {
tmp<scalarField> th(new scalarField(T.size())); tmp<scalarField> ths(new scalarField(T.size()));
scalarField& hs = th(); scalarField& hs = ths();
forAll(T, celli) forAll(T, celli)
{ {
hs[celli] = this->cellMixture(cells[celli]).Hs(T[celli]); hs[celli] = this->cellMixture(cells[celli]).Hs(T[celli]);
} }
return th; return ths;
} }
@ -225,15 +225,15 @@ Foam::hsPsiMixtureThermo<MixtureType>::hs
const label patchi const label patchi
) const ) const
{ {
tmp<scalarField> th(new scalarField(T.size())); tmp<scalarField> ths(new scalarField(T.size()));
scalarField& hs = th(); scalarField& hs = ths();
forAll(T, facei) forAll(T, facei)
{ {
hs[facei] = this->patchFaceMixture(patchi, facei).Hs(T[facei]); hs[facei] = this->patchFaceMixture(patchi, facei).Hs(T[facei]);
} }
return th; return ths;
} }
@ -277,7 +277,7 @@ Foam::hsPsiMixtureThermo<MixtureType>::Cp() const
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh, mesh,
dimensionSet(0, 2, -2, -1, 0) dimEnergy/dimMass/dimTemperature
) )
); );

View File

@ -95,11 +95,11 @@ public:
virtual void correct(); virtual void correct();
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
// Fields derived from thermodynamic state variables // Fields derived from thermodynamic state variables
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
//- Sensible enthalpy for cell-set [J/kg] //- Sensible enthalpy for cell-set [J/kg]
virtual tmp<scalarField> hs virtual tmp<scalarField> hs
( (

View File

@ -128,9 +128,6 @@ public:
} }
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const = 0;
//- Update properties //- Update properties
virtual void correct() = 0; virtual void correct() = 0;
}; };

View File

@ -128,9 +128,6 @@ public:
} }
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const = 0;
//- Update properties //- Update properties
virtual void correct() = 0; virtual void correct() = 0;
}; };

View File

@ -94,12 +94,13 @@ public:
//- Update properties //- Update properties
virtual void correct(); virtual void correct();
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
// Fields derived from thermodynamic state variables // Fields derived from thermodynamic state variables
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
//- Sensible nthalpy for cell-set [J/kg] //- Sensible nthalpy for cell-set [J/kg]
virtual tmp<scalarField> hs virtual tmp<scalarField> hs
( (