Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2010-02-17 15:19:08 +00:00
155 changed files with 3254 additions and 1325 deletions

View File

@ -29,6 +29,9 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::string Foam::meshWriter::defaultMeshName = "meshExport";
const Foam::cellModel* Foam::meshWriter::unknownModel = Foam::cellModeller::
lookup
(
@ -64,10 +67,6 @@ lookup
);
Foam::string Foam::meshWriter::defaultMeshName = "meshExport";
Foam::string Foam::meshWriter::defaultSurfaceName = "surfExport";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::meshWriter::meshWriter(const polyMesh& mesh, const scalar scaleFactor)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,7 +85,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class meshWriter Declaration
Class meshWriter Declaration
\*---------------------------------------------------------------------------*/
class meshWriter
@ -133,13 +133,12 @@ public:
// Static data members
//- Specify a default mesh name
static string defaultMeshName;
static string defaultSurfaceName;
// Constructors
//- Ccreate a writer obejct
//- Create a writer obejct
meshWriter
(
const polyMesh&,
@ -167,26 +166,14 @@ public:
writeBoundary_ = false;
}
// Write
//- Write volume mesh
// subclass must to supply this method
//- Write volume mesh. Subclass must supply this method
virtual bool write
(
const fileName& timeName = fileName::null
) const = 0;
//- Write surface mesh with optional triangulation
// subclass could supply this information
virtual bool writeSurface
(
const fileName& timeName = fileName::null,
const bool triangulate = false
) const
{
return false;
}
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -527,201 +527,4 @@ bool Foam::meshWriters::STARCD::write(const fileName& meshName) const
}
bool Foam::meshWriters::STARCD::writeSurface
(
const fileName& meshName,
const bool triangulate
) const
{
fileName baseName(meshName);
if (baseName.empty())
{
baseName = meshWriter::defaultSurfaceName;
if
(
mesh_.time().timeName() != "0"
&& mesh_.time().timeName() != "constant"
)
{
baseName += "_" + mesh_.time().timeName();
}
}
rmFiles(baseName);
OFstream celFile(baseName + ".cel");
writeHeader(celFile, "CELL");
Info<< "Writing " << celFile.name() << endl;
// mesh and patch info
const pointField& points = mesh_.points();
const labelList& owner = mesh_.faceOwner();
const faceList& meshFaces = mesh_.faces();
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
label shapeId = 3; // shell/baffle element
label typeId = 4; // 4(shell)
// remember which points need to be written
labelHashSet pointHash;
// write boundary faces as normal STAR-CD mesh
if (triangulate)
{
// cell Id has no particular meaning - just increment
// use the cellTable id from the patch Number
label cellId = 0;
forAll(patches, patchI)
{
label patchStart = patches[patchI].start();
label patchSize = patches[patchI].size();
label ctableId = patchI + 1;
for
(
label faceI = patchStart;
faceI < (patchStart + patchSize);
++faceI
)
{
const face& f = meshFaces[faceI];
label nTri = f.nTriangles(points);
faceList triFaces;
// triangulate polygons, but not quads
if (nTri <= 2)
{
triFaces.setSize(1);
triFaces[0] = f;
}
else
{
triFaces.setSize(nTri);
nTri = 0;
f.triangles(points, nTri, triFaces);
}
forAll(triFaces, faceI)
{
const labelList& vrtList = triFaces[faceI];
celFile
<< cellId + 1 << " "
<< shapeId << " "
<< vrtList.size() << " "
<< ctableId << " "
<< typeId;
// must be 3 (triangle) but could be quad
label count = 0;
forAll(vrtList, i)
{
if ((count % 8) == 0)
{
celFile
<< nl
<< " " << cellId + 1;
}
// remember which points we'll need to write
pointHash.insert(vrtList[i]);
celFile << " " << vrtList[i] + 1;
count++;
}
celFile << endl;
cellId++;
}
}
}
}
else
{
// cell Id is the OpenFOAM face Id
// use the cellTable id from the face owner
// - allows separation of parts
forAll(patches, patchI)
{
label patchStart = patches[patchI].start();
label patchSize = patches[patchI].size();
for
(
label faceI = patchStart;
faceI < (patchStart + patchSize);
++faceI
)
{
const labelList& vrtList = meshFaces[faceI];
label cellId = faceI;
celFile
<< cellId + 1 << " "
<< shapeId << " "
<< vrtList.size() << " "
<< cellTableId_[owner[faceI]] << " "
<< typeId;
// likely <= 8 vertices, but prevent overrun anyhow
label count = 0;
forAll(vrtList, i)
{
if ((count % 8) == 0)
{
celFile
<< nl
<< " " << cellId + 1;
}
// remember which points we'll need to write
pointHash.insert(vrtList[i]);
celFile << " " << vrtList[i] + 1;
count++;
}
celFile << endl;
}
}
}
OFstream vrtFile(baseName + ".vrt");
writeHeader(vrtFile, "VERTEX");
vrtFile.precision(10);
vrtFile.setf(std::ios::showpoint); // force decimal point for Fortran
Info<< "Writing " << vrtFile.name() << endl;
// build sorted table of contents
SortableList<label> toc(pointHash.size());
{
label i = 0;
forAllConstIter(labelHashSet, pointHash, iter)
{
toc[i++] = iter.key();
}
}
toc.sort();
toc.shrink();
pointHash.clear();
// write points in sorted order
forAll(toc, i)
{
label vrtId = toc[i];
vrtFile
<< vrtId + 1
<< " " << scaleFactor_ * points[vrtId].x()
<< " " << scaleFactor_ * points[vrtId].y()
<< " " << scaleFactor_ * points[vrtId].z()
<< endl;
}
return true;
}
// ************************************************************************* //

View File

@ -28,11 +28,6 @@ Class
Description
Writes polyMesh in pro-STAR (v4) bnd/cel/vrt format
Alternatively, extracts the surface of the FOAM mesh into
pro-STAR (v4) .cel/.vrt/ format.
This can be useful, for example, for surface morphing in an external
package.
The cellTableId and cellTable information are used (if available).
Otherwise the cellZones are used (if available).
@ -131,12 +126,6 @@ public:
const fileName& meshName = fileName::null
) const;
//- Write surface mesh with optional triangulation
virtual bool writeSurface
(
const fileName& meshName = fileName::null,
const bool triangulate = false
) const;
};

View File

@ -247,7 +247,7 @@ bool Foam::parcel::move(spray& sDB)
{
oMass[i] = m()*oYf[i];
label j = sDB.liquidToGasIndex()[i];
oHg += oYf[i]*sDB.gasProperties()[j].H(T());
oHg += oYf[i]*sDB.gasProperties()[j].Hs(T());
}
vector oMom = m()*U();
@ -273,7 +273,7 @@ bool Foam::parcel::move(spray& sDB)
{
nMass[i] = m()*nYf[i];
label j = sDB.liquidToGasIndex()[i];
nHg += nYf[i]*sDB.gasProperties()[j].H(T());
nHg += nYf[i]*sDB.gasProperties()[j].Hs(T());
}
vector nMom = m()*U();
@ -286,11 +286,9 @@ bool Foam::parcel::move(spray& sDB)
{
sDB.srhos()[i][celli] += oMass[i] - nMass[i];
}
sDB.sms()[celli] += oMom - nMom;
sDB.sms()[celli] += oMom - nMom;
sDB.shs()[celli] +=
oTotMass*(oH + oPE)
- m()*(nH + nPE);
sDB.shs()[celli] += oTotMass*(oH + oPE) - m()*(nH + nPE);
// Remove evaporated mass from stripped mass
ms() -= ms()*(oTotMass-m())/oTotMass;
@ -446,7 +444,7 @@ void Foam::parcel::updateParcelProperties
for (label i=0; i<Nf; i++)
{
label j = sDB.liquidToGasIndex()[i];
oldhg += Yf0[i]*sDB.gasProperties()[j].H(T());
oldhg += Yf0[i]*sDB.gasProperties()[j].Hs(T());
}
scalar oldhv = fuels.hl(pg, T(), X());
@ -478,7 +476,7 @@ void Foam::parcel::updateParcelProperties
for (label i=0; i<Nf; i++)
{
label j = sDB.liquidToGasIndex()[i];
newhg += Ynew[i]*sDB.gasProperties()[j].H(Tnew);
newhg += Ynew[i]*sDB.gasProperties()[j].Hs(Tnew);
}
newhv = fuels.hl(pg, Tnew, X());
@ -616,7 +614,8 @@ void Foam::parcel::updateParcelProperties
{
if (n>100)
{
Info<< "n = " << n << ", T = " << Td << ", pv = " << pAtSurface << endl;
Info<< "n = " << n << ", T = " << Td << ", pv = "
<< pAtSurface << endl;
}
}
}

View File

@ -185,7 +185,8 @@ public:
//- Return the names of the liquid components
inline const List<word>& liquidNames() const;
//- Return the names of the liquid fuel components - identical with liquidNames
//- Return the names of the liquid fuel components
// - identical with liquidNames
inline const List<word>& fuelNames() const;
//- Return diameter of droplets in parcel

View File

@ -260,6 +260,9 @@ void Foam::KinematicCloud<ParcelType>::evolve()
evolveCloud();
postEvolve();
info();
Info<< endl;
}
}

View File

@ -272,6 +272,9 @@ void Foam::ReactingCloud<ParcelType>::evolve()
evolveCloud();
postEvolve();
info();
Info<< endl;
}
}

View File

@ -228,6 +228,9 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::evolve()
evolveCloud();
postEvolve();
info();
Info<< endl;
}
}

View File

@ -160,20 +160,6 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
),
this->mesh(),
dimensionedScalar("zero", dimEnergy, 0.0)
),
hcTrans_
(
IOobject
(
this->name() + "hcTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar("zero", dimEnergy, 0.0)
)
{
if (readFields)
@ -220,7 +206,6 @@ void Foam::ThermoCloud<ParcelType>::resetSourceTerms()
{
KinematicCloud<ParcelType>::resetSourceTerms();
hsTrans_.field() = 0.0;
hcTrans_.field() = 0.0;
}
@ -234,6 +219,9 @@ void Foam::ThermoCloud<ParcelType>::evolve()
evolveCloud();
postEvolve();
info();
Info<< endl;
}
}

View File

@ -108,15 +108,9 @@ protected:
// Sources
//- Sensible enthalpy transfer
//- Sensible enthalpy transfer [J/kg]
DimensionedField<scalar, volMesh> hsTrans_;
//- Chemical enthalpy transfer
// - If solving for total enthalpy, the carrier phase enthalpy will
// receive the full enthalpy of reaction via creation of reaction
// products
DimensionedField<scalar, volMesh> hcTrans_;
// Protected member functions
@ -194,19 +188,10 @@ public:
// Enthalpy
//- Return reference to sensible enthalpy source
//- Sensible enthalpy transfer [J/kg]
inline DimensionedField<scalar, volMesh>& hsTrans();
//- Return tmp total sensible enthalpy source term
inline tmp<DimensionedField<scalar, volMesh> > Shs() const;
//- Return reference to chemical enthalpy source
inline DimensionedField<scalar, volMesh>& hcTrans();
//- Return tmp chemical enthalpy source term
inline tmp<DimensionedField<scalar, volMesh> > Shc() const;
//- Return tmp total enthalpy source term
//- Return enthalpy source [J/kg/m3/s]
inline tmp<DimensionedField<scalar, volMesh> > Sh() const;

View File

@ -85,82 +85,6 @@ Foam::ThermoCloud<ParcelType>::hsTrans()
}
template<class ParcelType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ThermoCloud<ParcelType>::Shs() const
{
tmp<DimensionedField<scalar, volMesh> > tShs
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + "Shs",
this->db().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
this->mesh(),
dimensionedScalar
(
"zero",
dimMass/dimLength/pow3(dimTime),
0.0
)
)
);
scalarField& Shs = tShs().field();
Shs = hsTrans_/(this->mesh().V()*this->db().time().deltaT());
return tShs;
}
template<class ParcelType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<ParcelType>::hcTrans()
{
return hcTrans_;
}
template<class ParcelType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ThermoCloud<ParcelType>::Shc() const
{
tmp<DimensionedField<scalar, volMesh> > tShc
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + "Shc",
this->db().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
this->mesh(),
dimensionedScalar
(
"zero",
dimMass/dimLength/pow3(dimTime),
0.0
)
)
);
scalarField& Shc = tShc().field();
Shc = hcTrans_/(this->mesh().V()*this->db().time().deltaT());
return tShc;
}
template<class ParcelType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ThermoCloud<ParcelType>::Sh() const
@ -178,19 +102,10 @@ Foam::ThermoCloud<ParcelType>::Sh() const
IOobject::AUTO_WRITE,
false
),
this->mesh(),
dimensionedScalar
(
"zero",
dimMass/dimLength/pow3(dimTime),
0.0
)
hsTrans_/(this->mesh().V()*this->db().time().deltaT())
)
);
scalarField& Sh = tSh().field();
Sh = (hsTrans_ + hcTrans_)/(this->mesh().V()*this->db().time().deltaT());
return tSh;
}
@ -205,7 +120,7 @@ Foam::ThermoCloud<ParcelType>::Ep() const
(
IOobject
(
this->name() + "radiationEp",
this->name() + "radiation::Ep",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
@ -248,7 +163,7 @@ Foam::ThermoCloud<ParcelType>::ap() const
(
IOobject
(
this->name() + "radiationAp",
this->name() + "radiation::ap",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
@ -291,7 +206,7 @@ Foam::ThermoCloud<ParcelType>::sigmap() const
(
IOobject
(
this->name() + "radiationSigmap",
this->name() + "radiation::sigmap",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,

View File

@ -267,7 +267,6 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
YLiquid_,
dMassPC,
Sh,
dhsTrans,
Ne,
NCpW,
Cs
@ -296,7 +295,6 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
canCombust_,
dMassDV,
Sh,
dhsTrans,
Ne,
NCpW,
Cs
@ -398,19 +396,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
{
label gid = td.cloud().composition().localToGlobalCarrierId(GAS, i);
td.cloud().rhoTrans(gid)[cellI] += np0*dMassGas[i];
td.cloud().hcTrans()[cellI] +=
np0
*dMassGas[i]
*td.cloud().mcCarrierThermo().speciesData()[gid].Hc();
}
forAll(YLiquid_, i)
{
label gid = td.cloud().composition().localToGlobalCarrierId(LIQ, i);
td.cloud().rhoTrans(gid)[cellI] += np0*dMassLiquid[i];
td.cloud().hcTrans()[cellI] +=
np0
*dMassLiquid[i]
*td.cloud().mcCarrierThermo().speciesData()[gid].Hc();
}
/*
// No mapping between solid components and carrier phase
@ -418,19 +408,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
{
label gid = td.cloud().composition().localToGlobalCarrierId(SLD, i);
td.cloud().rhoTrans(gid)[cellI] += np0*dMassSolid[i];
td.cloud().hcTrans()[cellI] +=
np0
*dMassSolid[i]
*td.cloud().mcCarrierThermo().speciesData()[gid].Hc();
}
*/
forAll(dMassSRCarrier, i)
{
td.cloud().rhoTrans(i)[cellI] += np0*dMassSRCarrier[i];
td.cloud().hcTrans()[cellI] +=
np0
*dMassSRCarrier[i]
*td.cloud().mcCarrierThermo().speciesData()[i].Hc();
}
// Update momentum transfer
@ -476,7 +458,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
*/
td.cloud().UTrans()[cellI] += np0*mass1*U1;
td.cloud().hsTrans()[cellI] +=
np0*mass1*HEff(td, pc, T1, idG, idL, idS);
np0*mass1*HEff(td, pc, T1, idG, idL, idS); // using total h
}
}
@ -520,7 +502,6 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
bool& canCombust,
scalarField& dMassDV,
scalar& Sh,
scalar& dhsTrans,
scalar& N,
scalar& NCpW,
scalarField& Cs

View File

@ -238,7 +238,6 @@ protected:
bool& canCombust, // 'can combust' flag
scalarField& dMassDV, // mass transfer - local to particle
scalar& Sh, // explicit particle enthalpy source
scalar& dhsTrans, // sensible enthalpy transfer to carrier
scalar& N, // flux of species emitted from particle
scalar& NCpW, // sum of N*Cp*W of emission species
scalarField& Cs // carrier conc. of emission species

View File

@ -287,7 +287,6 @@ void Foam::ReactingParcel<ParcelType>::calc
Y_,
dMassPC,
Sh,
dhsTrans,
Ne,
NCpW,
Cs
@ -341,10 +340,6 @@ void Foam::ReactingParcel<ParcelType>::calc
{
label gid = td.cloud().composition().localToGlobalCarrierId(0, i);
td.cloud().rhoTrans(gid)[cellI] += np0*dMassPC[i];
td.cloud().hcTrans()[cellI] +=
np0
*dMassPC[i]
*td.cloud().mcCarrierThermo().speciesData()[gid].Hc();
}
// Update momentum transfer
@ -371,7 +366,7 @@ void Foam::ReactingParcel<ParcelType>::calc
td.cloud().rhoTrans(gid)[cellI] += np0*mass1*Y_[i];
}
td.cloud().UTrans()[cellI] += np0*mass1*U1;
td.cloud().hcTrans()[cellI] +=
td.cloud().hsTrans()[cellI] +=
np0*mass1*td.cloud().composition().H(0, Y_, pc_, T1);
}
}
@ -417,7 +412,6 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
const scalarField& YComponents,
scalarField& dMassPC,
scalar& Sh,
scalar& dhsTrans, // TODO: not used
scalar& N,
scalar& NCpW,
scalarField& Cs
@ -469,6 +463,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
td.cloud().composition().localToGlobalCarrierId(idPhase, i);
const label idl = td.cloud().composition().globalIds(idPhase)[i];
// Calculate enthalpy transfer
if
(
td.cloud().phaseChange().enthalpyTransfer()

View File

@ -209,7 +209,6 @@ protected:
const scalarField& YComponents, // component mass fractions
scalarField& dMassPC, // mass transfer - local to particle
scalar& Sh, // explicit particle enthalpy source
scalar& dhsTrans, // sensible enthalpy transfer to carrier
scalar& N, // flux of species emitted from particle
scalar& NCpW, // sum of N*Cp*W of emission species
scalarField& Cs // carrier conc. of emission species

View File

@ -410,6 +410,130 @@ Foam::scalar Foam::CompositionModel<CloudType>::H
}
template<class CloudType>
Foam::scalar Foam::CompositionModel<CloudType>::Hs
(
const label phaseI,
const scalarField& Y,
const scalar p,
const scalar T
) const
{
const phaseProperties& props = phaseProps_[phaseI];
scalar HsMixture = 0.0;
switch (props.phase())
{
case phaseProperties::GAS:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HsMixture += Y[i]*mcCarrierThermo_.speciesData()[gid].Hs(T);
}
break;
}
case phaseProperties::LIQUID:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HsMixture +=
Y[i]
*(
this->liquids().properties()[gid].h(p, T)
- this->liquids().properties()[gid].h(p, 298.25)
);
}
break;
}
case phaseProperties::SOLID:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HsMixture += Y[i]*this->solids().properties()[gid].cp()*T;
}
break;
}
default:
{
FatalErrorIn
(
"Foam::scalar Foam::CompositionModel<CloudType>::Hs"
"("
" const label, "
" const scalarField&, "
" const scalar, "
" const scalar"
") const"
) << "Unknown phase enumeration" << nl << abort(FatalError);
}
}
return HsMixture;
}
template<class CloudType>
Foam::scalar Foam::CompositionModel<CloudType>::Hc
(
const label phaseI,
const scalarField& Y,
const scalar p,
const scalar T
) const
{
const phaseProperties& props = phaseProps_[phaseI];
scalar HcMixture = 0.0;
switch (props.phase())
{
case phaseProperties::GAS:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HcMixture += Y[i]*mcCarrierThermo_.speciesData()[gid].Hc();
}
break;
}
case phaseProperties::LIQUID:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HcMixture +=
Y[i]*this->liquids().properties()[gid].h(p, 298.15);
}
break;
}
case phaseProperties::SOLID:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HcMixture += Y[i]*this->solids().properties()[gid].Hf();
}
break;
}
default:
{
FatalErrorIn
(
"Foam::scalar Foam::CompositionModel<CloudType>::Hc"
"("
" const label, "
" const scalarField&, "
" const scalar, "
" const scalar"
") const"
) << "Unknown phase enumeration" << nl << abort(FatalError);
}
}
return HcMixture;
}
template<class CloudType>
Foam::scalar Foam::CompositionModel<CloudType>::cp
(

View File

@ -226,7 +226,7 @@ public:
// Evaluation
//- Return enthalpy for the phase phaseI
//- Return total enthalpy for the phase phaseI
virtual scalar H
(
const label phaseI,
@ -235,6 +235,24 @@ public:
const scalar T
) const;
//- Return sensible enthalpy for the phase phaseI
virtual scalar Hs
(
const label phaseI,
const scalarField& Y,
const scalar p,
const scalar T
) const;
//- Return chemical enthalpy for the phase phaseI
virtual scalar Hc
(
const label phaseI,
const scalarField& Y,
const scalar p,
const scalar T
) const;
//- Return specific heat caoacity for the phase phaseI
virtual scalar cp
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -225,9 +225,9 @@ void Foam::fileFormats::OBJsurfaceFormat<Face>::write
// for no zones, suppress the group name
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst, "")
surf.surfZones().empty()
? oneZone(faceLst, "")
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -52,9 +52,9 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -256,9 +256,9 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -213,9 +213,9 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -139,9 +139,9 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,9 +70,9 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -53,9 +53,9 @@ void Foam::fileFormats::WRLsurfaceFormat<Face>::write
// for no zones, suppress the group name
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst, "")
surf.surfZones().empty()
? oneZone(faceLst, "")
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,9 +55,9 @@ void Foam::fileFormats::X3DsurfaceFormat<Face>::write
// for no zones, suppress the group name
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst, "")
surf.surfZones().empty()
? oneZone(faceLst, "")
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -6,11 +6,13 @@ basicThermo/basicThermo.C
psiThermo/basicPsiThermo/basicPsiThermo.C
psiThermo/basicPsiThermo/newBasicPsiThermo.C
psiThermo/hPsiThermo/hPsiThermos.C
psiThermo/hsPsiThermo/hsPsiThermos.C
psiThermo/ePsiThermo/ePsiThermos.C
rhoThermo/basicRhoThermo/basicRhoThermo.C
rhoThermo/basicRhoThermo/newBasicRhoThermo.C
rhoThermo/hRhoThermo/hRhoThermos.C
rhoThermo/hsRhoThermo/hsRhoThermos.C
derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.C
derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C

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()
{
notImplemented("basicThermo::e()");

View File

@ -145,17 +145,17 @@ public:
// Non-const access allowed for transport equations
virtual volScalarField& h();
//- Enthalpy [J/kg]
//- Total enthalpy [J/kg]
virtual const volScalarField& h() const;
//- Enthalpy for cell-set [J/kg]
//- Total enthalpy for cell-set [J/kg]
virtual tmp<scalarField> h
(
const scalarField& T,
const labelList& cells
) const;
//- Enthalpy for patch [J/kg]
//- Total enthalpy for patch [J/kg]
virtual tmp<scalarField> h
(
const scalarField& T,
@ -166,23 +166,26 @@ public:
// Non-const access allowed for transport equations
virtual volScalarField& hs();
//- Enthalpy [J/kg]
//- Sensible enthalpy [J/kg]
virtual const volScalarField& hs() const;
//- Enthalpy for cell-set [J/kg]
//- Sensible enthalpy for cell-set [J/kg]
virtual tmp<scalarField> hs
(
const scalarField& T,
const labelList& cells
) const;
//- Enthalpy for patch [J/kg]
//- Sensible enthalpy for patch [J/kg]
virtual tmp<scalarField> hs
(
const scalarField& T,
const label patchi
) const;
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
//- Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& e();
@ -197,7 +200,7 @@ public:
const labelList& cells
) const;
//-Internal energy for patch [J/kg]
//- Internal energy for patch [J/kg]
virtual tmp<scalarField> e
(
const scalarField& T,

View File

@ -0,0 +1,347 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#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_.alpha(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_.alpha(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_.alpha(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,
dimensionSet(0, 2, -2, -1, 0),
this->T_.boundaryField().types()
)
);
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

@ -0,0 +1,178 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#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

@ -0,0 +1,346 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#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_.alpha(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_.alpha(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_.alpha(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,
this->T_.boundaryField().types()
)
);
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

@ -0,0 +1,178 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "makeBasicRhoThermo.H"
#include "perfectGas.H"
#include "hConstThermo.H"
#include "janafThermo.H"
#include "specieThermo.H"
#include "constTransport.H"
#include "sutherlandTransport.H"
#include "hsRhoThermo.H"
#include "pureMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
makeBasicRhoThermo
(
hsRhoThermo,
pureMixture,
constTransport,
hConstThermo,
perfectGas
);
makeBasicRhoThermo
(
hsRhoThermo,
pureMixture,
sutherlandTransport,
hConstThermo,
perfectGas
);
makeBasicRhoThermo
(
hsRhoThermo,
pureMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -466,7 +466,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
this->thermo().rho()
);
tmp<volScalarField> tsource
tmp<volScalarField> ttc
(
new volScalarField
(
@ -484,7 +484,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
)
);
scalarField& t = tsource();
scalarField& tc = ttc();
label nReaction = reactions_.size();
@ -517,17 +517,58 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
forAll(R.rhs(), s)
{
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> tSh
(
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& Sh = tSh();
forAll(Y_, i)
{
forAll(Sh, cellI)
{
scalar hi = specieThermo_[i].Hc();
Sh[cellI] -= hi*RR_[i][cellI];
}
}
}
return tSh;
}
@ -545,37 +586,19 @@ Foam::ODEChemistryModel<CompType, ThermoType>::dQ() const
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
IOobject::NO_WRITE,
false
),
this->mesh_,
dimensionedScalar
(
"zero",
dimensionSet(0, 2, -3 , 0, 0, 0, 0),
0.0
)
dimensionedScalar("dQ", dimEnergy/dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->chemistry_)
{
scalarField& dQ = tdQ();
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;
volScalarField& dQ = tdQ();
dQ.dimensionedInternalField() = this->mesh_.V()*Sh()();
}
return tdQ;
@ -678,6 +701,9 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
scalar deltaTMin = GREAT;
tmp<volScalarField> thc = this->thermo().hc();
const scalarField& hc = thc();
forAll(rho, celli)
{
for (label i=0; i<nSpecie_; i++)
@ -687,7 +713,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
scalar rhoi = rho[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];
scalarField c(nSpecie_);

View File

@ -39,9 +39,9 @@ SourceFiles
#ifndef ODEChemistryModel_H
#define ODEChemistryModel_H
#include "hCombustionThermo.H"
#include "Reaction.H"
#include "ODE.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,6 +49,8 @@ namespace Foam
{
// Forward declaration of classes
class fvMesh;
template<class CompType, class ThermoType>
class chemistrySolver;
@ -180,6 +182,9 @@ public:
//- Return the chemical time scale
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]
virtual tmp<volScalarField> dQ() const;

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "volFields.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -96,7 +97,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::RR
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimensionSet(1, -3, -1, 0, 0), 0.0),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);

View File

@ -120,7 +120,7 @@ public:
// 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;
@ -133,7 +133,10 @@ public:
//- Return the chemical time scale
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;
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,10 @@ combustionThermo/hCombustionThermo/hCombustionThermo.C
combustionThermo/hCombustionThermo/newhCombustionThermo.C
combustionThermo/hCombustionThermo/hCombustionThermos.C
combustionThermo/hsCombustionThermo/hsCombustionThermo.C
combustionThermo/hsCombustionThermo/newhsCombustionThermo.C
combustionThermo/hsCombustionThermo/hsCombustionThermos.C
combustionThermo/hhuCombustionThermo/hhuCombustionThermo.C
combustionThermo/hhuCombustionThermo/newhhuCombustionThermo.C
combustionThermo/hhuCombustionThermo/hhuCombustionThermos.C
@ -16,6 +20,9 @@ reactionThermo/hReactionThermo/hReactionThermo.C
reactionThermo/hReactionThermo/newhReactionThermo.C
reactionThermo/hReactionThermo/hReactionThermos.C
reactionThermo/hsReactionThermo/hsReactionThermo.C
reactionThermo/hsReactionThermo/newhsReactionThermo.C
reactionThermo/hsReactionThermo/hsReactionThermos.C
derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.C
derivedFvPatchFields/gradientUnburntEnthalpy/gradientUnburntEnthalpyFvPatchScalarField.C

View File

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

View File

@ -25,8 +25,6 @@ License
InClass
Foam::hCombustionThermo
Description
\*---------------------------------------------------------------------------*/
#ifndef makeCombustionThermo_H

View File

@ -0,0 +1,67 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#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

@ -0,0 +1,144 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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

@ -0,0 +1,153 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#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 "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,
gasThermoPhysics
);
// Multi-component reaction thermo
makeHsCombustionMixtureThermo
(
hsCombustionThermo,
hsPsiMixtureThermo,
reactingMixture,
gasThermoPhysics
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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

@ -0,0 +1,151 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "hsCombustionThermo.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::hsCombustionThermo> Foam::hsCombustionThermo::New
(
const fvMesh& mesh
)
{
word hsCombustionThermoTypeName;
// Enclose the creation of the thermophysicalProperties to ensure it is
// deleted before the turbulenceModel is created otherwise the dictionary
// is entered in the database twice
{
IOdictionary thermoDict
(
IOobject
(
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
thermoDict.lookup("thermoType") >> hsCombustionThermoTypeName;
}
Info<< "Selecting thermodynamics package " << hsCombustionThermoTypeName
<< endl;
fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(hsCombustionThermoTypeName);
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn("hsCombustionThermo::New(const fvMesh&)")
<< "Unknown hsCombustionThermo type "
<< hsCombustionThermoTypeName << nl << nl
<< "Valid hsCombustionThermo types are:" << nl
<< fvMeshConstructorTablePtr_->toc() << nl
<< exit(FatalError);
}
return autoPtr<hsCombustionThermo>(cstrIter()(mesh));
}
Foam::autoPtr<Foam::hsCombustionThermo> Foam::hsCombustionThermo::NewType
(
const fvMesh& mesh,
const word& thermoType
)
{
word hsCombustionThermoTypeName;
// Enclose the creation of the thermophysicalProperties to ensure it is
// deleted before the turbulenceModel is created otherwise the dictionary
// is entered in the database twice
{
IOdictionary thermoDict
(
IOobject
(
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
thermoDict.lookup("thermoType") >> hsCombustionThermoTypeName;
if (hsCombustionThermoTypeName.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
<< hsCombustionThermoTypeName << nl << nl << "Please select a "
<< "thermo package based on " << thermoType
<< ". Valid options include:" << nl << validModels << nl
<< exit(FatalError);
}
}
Info<< "Selecting thermodynamics package " << hsCombustionThermoTypeName
<< endl;
fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(hsCombustionThermoTypeName);
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn("hsCombustionThermo::New(const fvMesh&)")
<< "Unknown hsCombustionThermo type "
<< hsCombustionThermoTypeName << nl << nl
<< "Valid hsCombustionThermo types are:" << nl
<< fvMeshConstructorTablePtr_->toc() << nl
<< exit(FatalError);
}
return autoPtr<hsCombustionThermo>(cstrIter()(mesh));
}
// ************************************************************************* //

View File

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

View File

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

View File

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

View File

@ -0,0 +1,318 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#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_.alpha(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_.alpha(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_.alpha(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

@ -0,0 +1,147 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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
// ************************************************************************* //

View File

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

View File

@ -25,8 +25,6 @@ License
InClass
Foam::hReactionThermo
Description
\*---------------------------------------------------------------------------*/
#ifndef makeReactionThermo_H

View File

@ -0,0 +1,67 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "hsReactionThermo.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(hsReactionThermo, 0);
defineRunTimeSelectionTable(hsReactionThermo, fvMesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::hsReactionThermo::hsReactionThermo(const fvMesh& mesh)
:
basicRhoThermo(mesh),
hs_
(
IOobject
(
"hs",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
this->hBoundaryTypes()
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::hsReactionThermo::~hsReactionThermo()
{}
// ************************************************************************* //

View File

@ -0,0 +1,144 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::hsReactionThermo
Description
Sensible enthalpy variant for reactionThermo
SourceFiles
hReactionThermo.C
\*---------------------------------------------------------------------------*/
#ifndef hsReactionThermo_H
#define hsReactionThermo_H
#include "basicRhoThermo.H"
#include "basicMultiComponentMixture.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hsReactionThermo Declaration
\*---------------------------------------------------------------------------*/
class hsReactionThermo
:
public basicRhoThermo
{
protected:
// Protected data
//- Sensible enthalpy [J/kg]
volScalarField hs_;
public:
//- Runtime type information
TypeName("hsReactionThermo");
//- Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
hsReactionThermo,
fvMesh,
(const fvMesh& mesh),
(mesh)
);
// Constructors
//- Construct from dictionary and mesh
hsReactionThermo(const fvMesh&);
// Selectors
//- Standard selection based on fvMesh
static autoPtr<hsReactionThermo> New(const fvMesh&);
//- Select and check that package contains 'thermoType'
static autoPtr<hsReactionThermo> NewType
(
const fvMesh&,
const word& thermoType
);
//- Destructor
virtual ~hsReactionThermo();
// 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

@ -0,0 +1,171 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "makeHsReactionThermo.H"
#include "hsReactionThermo.H"
#include "hsRhoMixtureThermo.H"
#include "perfectGas.H"
#include "hConstThermo.H"
#include "janafThermo.H"
#include "specieThermo.H"
#include "constTransport.H"
#include "sutherlandTransport.H"
#include "homogeneousMixture.H"
#include "inhomogeneousMixture.H"
#include "veryInhomogeneousMixture.H"
#include "dieselMixture.H"
#include "multiComponentMixture.H"
#include "reactingMixture.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeHsReactionThermo
(
hsReactionThermo,
hsRhoMixtureThermo,
homogeneousMixture,
constTransport,
hConstThermo,
perfectGas
);
makeHsReactionThermo
(
hsReactionThermo,
hsRhoMixtureThermo,
inhomogeneousMixture,
constTransport,
hConstThermo,
perfectGas
);
makeHsReactionThermo
(
hsReactionThermo,
hsRhoMixtureThermo,
veryInhomogeneousMixture,
constTransport,
hConstThermo,
perfectGas
);
makeHsReactionThermo
(
hsReactionThermo,
hsRhoMixtureThermo,
homogeneousMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
makeHsReactionThermo
(
hsReactionThermo,
hsRhoMixtureThermo,
inhomogeneousMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
makeHsReactionThermo
(
hsReactionThermo,
hsRhoMixtureThermo,
veryInhomogeneousMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
makeHsReactionThermo
(
hsReactionThermo,
hsRhoMixtureThermo,
dieselMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
// Multi-component thermo
makeHsReactionMixtureThermo
(
hsReactionThermo,
hsRhoMixtureThermo,
multiComponentMixture,
icoPoly8ThermoPhysics
);
makeHsReactionMixtureThermo
(
hsReactionThermo,
hsRhoMixtureThermo,
multiComponentMixture,
gasThermoPhysics
);
// Multi-component reaction thermo
makeHsReactionMixtureThermo
(
hsReactionThermo,
hsRhoMixtureThermo,
reactingMixture,
icoPoly8ThermoPhysics
);
makeHsReactionMixtureThermo
(
hsReactionThermo,
hsRhoMixtureThermo,
reactingMixture,
gasThermoPhysics
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::hReactionThermo
\*---------------------------------------------------------------------------*/
#ifndef makeReactionThermo_H
#define makeReactionThermo_H
#include "addToRunTimeSelectionTable.H"
#include "basicRhoThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeHsReactionThermo(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 \
( \
basicRhoThermo, \
MixtureThermo##Mixture##Transport##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, \
fvMesh \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,151 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "hsReactionThermo.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::hsReactionThermo> Foam::hsReactionThermo::New
(
const fvMesh& mesh
)
{
word hsReactionThermoTypeName;
// Enclose the creation of the thermophysicalProperties to ensure it is
// deleted before the turbulenceModel is created otherwise the dictionary
// is entered in the database twice
{
IOdictionary thermoDict
(
IOobject
(
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
thermoDict.lookup("thermoType") >> hsReactionThermoTypeName;
}
Info<< "Selecting thermodynamics package " << hsReactionThermoTypeName
<< endl;
fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(hsReactionThermoTypeName);
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn("hsReactionThermo::New(const fvMesh&)")
<< "Unknown hsReactionThermo type "
<< hsReactionThermoTypeName << nl << nl
<< "Valid hsReactionThermo types are:" << nl
<< fvMeshConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
return autoPtr<hsReactionThermo>(cstrIter()(mesh));
}
Foam::autoPtr<Foam::hsReactionThermo> Foam::hsReactionThermo::NewType
(
const fvMesh& mesh,
const word& thermoType
)
{
word hsReactionThermoTypeName;
// Enclose the creation of the thermophysicalProperties to ensure it is
// deleted before the turbulenceModel is created otherwise the dictionary
// is entered in the database twice
{
IOdictionary thermoDict
(
IOobject
(
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
thermoDict.lookup("thermoType") >> hsReactionThermoTypeName;
if (hsReactionThermoTypeName.find(thermoType) == string::npos)
{
wordList allModels = fvMeshConstructorTablePtr_->sortedToc();
DynamicList<word> validModels;
forAll(allModels, i)
{
if (allModels[i].find(thermoType) != string::npos)
{
validModels.append(allModels[i]);
}
}
FatalErrorIn
(
"autoPtr<hsReactionThermo> hsReactionThermo::NewType"
"("
"const fvMesh&, "
"const word&"
")"
) << "Inconsistent thermo package selected:" << nl << nl
<< hsReactionThermoTypeName << nl << nl << "Please select a "
<< "thermo package based on " << thermoType
<< ". Valid options include:" << nl << validModels << nl
<< exit(FatalError);
}
}
Info<< "Selecting thermodynamics package " << hsReactionThermoTypeName
<< endl;
fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(hsReactionThermoTypeName);
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn("hsReactionThermo::New(const fvMesh&)")
<< "Unknown hsReactionThermo type "
<< hsReactionThermoTypeName << nl << nl
<< "Valid hsReactionThermo types are:" << nl
<< fvMeshConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
return autoPtr<hsReactionThermo>(cstrIter()(mesh));
}
// ************************************************************************* //

View File

@ -0,0 +1,320 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "hsRhoMixtureThermo.H"
#include "fvMesh.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::hsRhoMixtureThermo<MixtureType>::calculate()
{
const scalarField& hsCells = hs_.internalField();
const scalarField& pCells = p_.internalField();
scalarField& TCells = T_.internalField();
scalarField& psiCells = psi_.internalField();
scalarField& rhoCells = rho_.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]);
rhoCells[celli] = mixture.rho(pCells[celli], TCells[celli]);
muCells[celli] = mixture.mu(TCells[celli]);
alphaCells[celli] = mixture.alpha(TCells[celli]);
}
forAll(T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = p_.boundaryField()[patchi];
fvPatchScalarField& pT = T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = psi_.boundaryField()[patchi];
fvPatchScalarField& prho = rho_.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]);
prho[facei] = mixture.rho(pp[facei], pT[facei]);
pmu_[facei] = mixture.mu(pT[facei]);
palpha_[facei] = mixture.alpha(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.alpha(pT[facei]);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hsRhoMixtureThermo<MixtureType>::hsRhoMixtureThermo(const fvMesh& mesh)
:
hsReactionThermo(mesh),
MixtureType(*this, mesh)
{
scalarField& hsCells = hs_.internalField();
const scalarField& TCells = T_.internalField();
forAll(hsCells, celli)
{
hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]);
}
forAll(hs_.boundaryField(), patchi)
{
hs_.boundaryField()[patchi] == hs(T_.boundaryField()[patchi], patchi);
}
hBoundaryCorrection(hs_);
calculate();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hsRhoMixtureThermo<MixtureType>::~hsRhoMixtureThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::hsRhoMixtureThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering hsRhoMixtureThermo<MixtureType>::correct()" << endl;
}
calculate();
if (debug)
{
Info<< "exiting hsRhoMixtureThermo<MixtureType>::correct()" << endl;
}
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::hsRhoMixtureThermo<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::hsRhoMixtureThermo<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::hsRhoMixtureThermo<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::hsRhoMixtureThermo<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::hsRhoMixtureThermo<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::hsRhoMixtureThermo<MixtureType>::read()
{
if (hsReactionThermo::read())
{
MixtureType::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,148 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::hsRhoMixtureThermo
Description
Foam::hsRhoMixtureThermo
SourceFiles
hsRhoMixtureThermo.C
\*---------------------------------------------------------------------------*/
#ifndef hsRhoMixtureThermo_H
#define hsRhoMixtureThermo_H
#include "hsReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hsRhoMixtureThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class hsRhoMixtureThermo
:
public hsReactionThermo,
public MixtureType
{
// Private member functions
void calculate();
//- Construct as copy (not implemented)
hsRhoMixtureThermo(const hsRhoMixtureThermo<MixtureType>&);
public:
//- Runtime type information
TypeName("hsRhoMixtureThermo");
// Constructors
//- Construct from mesh
hsRhoMixtureThermo(const fvMesh&);
//- Destructor
virtual ~hsRhoMixtureThermo();
// 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 nthalpy 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 "hsRhoMixtureThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //