merge of thermo branch into master

This commit is contained in:
andy
2009-06-19 13:21:55 +01:00
437 changed files with 10923 additions and 7274 deletions

View File

@ -60,6 +60,10 @@ $(sha1)/SHA1Digest.C
primitives/random/Random.C
functions = primitives/functions
$(functions)/Polynomial/makePolynomialsOrder7.C
containers/HashTables/HashTable/HashTableName.C
containers/HashTables/StaticHashTable/StaticHashTableName.C
containers/Lists/SortableList/ParSortableListName.C

View File

@ -134,14 +134,26 @@ bool Foam::regIOobject::checkIn()
// any mapping
registered_ = db().checkIn(*this);
// checkin on defaultRegion is allowed to fail, since subsetted meshes
// check-in on defaultRegion is allowed to fail, since subsetted meshes
// are created with the same name as their originating mesh
if (!registered_ && debug && name() != polyMesh::defaultRegion)
{
WarningIn("regIOobject::checkIn()")
<< "failed to register object " << objectPath()
<< " the name already exists in the objectRegistry"
<< endl;
if (debug == 2)
{
// for ease of finding where attempted duplicate check-in
// originated
FatalErrorIn("regIOobject::checkIn()")
<< "failed to register object " << objectPath()
<< " the name already exists in the objectRegistry"
<< abort(FatalError);
}
else
{
WarningIn("regIOobject::checkIn()")
<< "failed to register object " << objectPath()
<< " the name already exists in the objectRegistry"
<< endl;
}
}
}

View File

@ -0,0 +1,225 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-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 "Polynomial.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial()
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
name_("unknownPolynomialName"),
logActive_(false),
logCoeff_(0.0)
{}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial(const word& name, Istream& is)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
name_(is),
logActive_(false),
logCoeff_(0.0)
{
if (name_ != name)
{
FatalErrorIn
(
"Polynomial<PolySize>::Polynomial(const word&, Istream&)"
) << "Expected polynomial name " << name << " but read " << name_
<< nl << exit(FatalError);
}
VectorSpace<Polynomial<PolySize>, scalar, PolySize>::
operator=(VectorSpace<Polynomial<PolySize>, scalar, PolySize>(is));
if (this->size() == 0)
{
FatalErrorIn
(
"Polynomial<PolySize>::Polynomial(const word&, Istream&)"
) << "Polynomial coefficients for entry " << name_
<< " are invalid (empty)" << nl << exit(FatalError);
}
}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial(const Polynomial<PolySize>& poly)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(poly),
name_(poly.name_),
logActive_(poly.logActive_),
logCoeff_(poly.logCoeff_)
{}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial
(
const word& name,
const Polynomial<PolySize>& poly
)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(poly),
name_(name),
logActive_(poly.logActive_),
logCoeff_(poly.logCoeff_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<int PolySize>
Foam::Polynomial<PolySize>::~Polynomial()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<int PolySize>
const Foam::word& Foam::Polynomial<PolySize>::name() const
{
return name_;
}
template<int PolySize>
bool& Foam::Polynomial<PolySize>::logActive()
{
return logActive_;
}
template<int PolySize>
Foam::scalar& Foam::Polynomial<PolySize>::logCoeff()
{
return logCoeff_;
}
template<int PolySize>
Foam::scalar Foam::Polynomial<PolySize>::evaluate(const scalar x) const
{
scalar y = this->v_[0];
for (label i=1; i<PolySize; i++)
{
y += this->v_[i]*pow(x, i);
}
if (logActive_)
{
y += logCoeff_*log(x);
}
return y;
}
template<int PolySize>
Foam::scalar Foam::Polynomial<PolySize>::integrateLimits
(
const scalar x1,
const scalar x2
) const
{
if (logActive_)
{
FatalErrorIn
(
"scalar Polynomial<PolySize>::integrateLimits"
"("
"const scalar, "
"const scalar"
") const"
) << "Cannot integrate polynomial with logarithmic coefficients"
<< nl << abort(FatalError);
}
intPolyType poly = this->integrate();
return poly.evaluate(x2) - poly.evaluate(x1);
}
template<int PolySize>
typename Foam::Polynomial<PolySize>::intPolyType
Foam::Polynomial<PolySize>::integrate(const scalar intConstant)
{
intPolyType newCoeffs;
newCoeffs[0] = intConstant;
forAll(*this, i)
{
newCoeffs[i + 1] = this->v_[i]/(i + 1);
}
return newCoeffs;
}
template<int PolySize>
typename Foam::Polynomial<PolySize>::polyType
Foam::Polynomial<PolySize>::integrateMinus1(const scalar intConstant)
{
polyType newCoeffs;
if (this->v_[0] > VSMALL)
{
newCoeffs.logActive() = true;
newCoeffs.logCoeff() = this->v_[0];
}
newCoeffs[0] = intConstant;
if (PolySize > 0)
{
for (label i=1; i<PolySize; i++)
{
newCoeffs[i] = this->v_[i]/i;
}
}
return newCoeffs;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<int PolySize>
void Foam::Polynomial<PolySize>::operator=(const Polynomial<PolySize>& poly)
{
name_ = poly.name_;
VectorSpace<Polynomial<PolySize>, scalar, PolySize>::operator=(poly);
logActive_ = poly.logActive_;
logCoeff_ = poly.logCoeff_;
}
// ************************************************************************* //

View File

@ -0,0 +1,198 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-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::Polynomial
Description
Polynomial templated on size (order):
poly = logCoeff*log(x) + sum(coeff_[i]*x^i)
where 0 <= i <= n
- integer powers, starting at zero
- evaluate(x) to evaluate the poly for a given value
- integrate(x1, x2) between two scalar values
- integrate() to return a new, intergated coeff polynomial
- increases the size (order)
- integrateMinus1() to return a new, integrated coeff polynomial where
the base poly starts at order -1
SourceFiles
Polynomial.C
\*---------------------------------------------------------------------------*/
#ifndef Polynomial_H
#define Polynomial_H
#include "word.H"
#include "scalar.H"
#include "Ostream.H"
#include "VectorSpace.H"
#include "Vector.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<int PolySize>
class Polynomial;
// Forward declaration of friend functions
template<int PolySize>
Ostream& operator<<
(
Ostream&,
const Polynomial<PolySize>&
);
/*---------------------------------------------------------------------------*\
Class Polynomial Declaration
\*---------------------------------------------------------------------------*/
template<int PolySize>
class Polynomial
:
public VectorSpace<Polynomial<PolySize>, scalar, PolySize>
{
private:
// Private data
//- Polynomial name
word name_;
//- Include the log term? - only activated using integrateMinus1()
bool logActive_;
//- Log coefficient - only activated using integrateMinus1()
scalar logCoeff_;
public:
typedef Polynomial<PolySize> polyType;
typedef Polynomial<PolySize+1> intPolyType;
//- Run-time type information
TypeName("Polynomial")
// Constructors
//- Construct null
Polynomial();
//- Construct from name and Istream
Polynomial(const word& name, Istream& is);
//- Copy constructor
Polynomial(const Polynomial& poly);
//- Copy constructor with name
Polynomial(const word& name, const Polynomial& poly);
//- Destructor
~Polynomial();
// Member Functions
// Access
//- Return const access to the polynomial name
const word& name() const;
//- Return access to the log term active flag
bool& logActive();
//- Return access to the log coefficient
scalar& logCoeff();
// Evaluation
//- Return polynomial value
scalar evaluate(const scalar x) const;
//- Return integrated polynomial coefficients
// argument becomes zeroth element (constant of integration)
intPolyType integrate(const scalar intConstant = 0.0);
//- Return integrated polynomial coefficients when lowest order
// is -1. Argument added to zeroth element
polyType integrateMinus1(const scalar intConstant = 0.0);
//- Integrate between two values
scalar integrateLimits(const scalar x1, const scalar x2) const;
// Member operators
void operator=(const Polynomial& poly);
//- Ostream Operator
friend Ostream& operator<< <PolySize>
(
Ostream&,
const Polynomial&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makePolynomial(PolySize) \
\
defineTemplateTypeNameAndDebugWithName \
( \
Polynomial<PolySize>, \
"Polynomial<"#PolySize">", \
0 \
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "Polynomial.C"
# include "PolynomialIO.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-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 "Polynomial.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<int PolySize>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Polynomial<PolySize>& poly
)
{
os << poly.name_ << token::SPACE
<< static_cast
<VectorSpace<Polynomial<PolySize>, scalar, PolySize> >(poly);
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const Polynomial<PolySize>&)"
);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-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 "Polynomial.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
namespace Foam
{
makePolynomial(2);
makePolynomial(3);
makePolynomial(4);
makePolynomial(5);
makePolynomial(6);
makePolynomial(7);
makePolynomial(8);
// explicitly define max order + 1 to define the integrated form
defineTemplateTypeNameAndDebugWithName
(
Polynomial<9>,
"Polynomial<9>",
0
);
}
// ************************************************************************* //

View File

@ -33,15 +33,11 @@ Description
{
dimensionedScalar totalMass = fvc::domainIntegrate(rho);
scalar sumLocalContErr =
(
fvc::domainIntegrate(mag(rho - thermo->rho()))/totalMass
).value();
scalar sumLocalContErr =
(fvc::domainIntegrate(mag(rho - thermo.rho()))/totalMass).value();
scalar globalContErr =
(
fvc::domainIntegrate(rho - thermo->rho())/totalMass
).value();
scalar globalContErr =
(fvc::domainIntegrate(rho - thermo.rho())/totalMass).value();
cumulativeContErr += globalContErr;

View File

@ -1301,7 +1301,11 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::correction
{
tmp<Foam::fvMatrix<Type> > tAcorr = A - (A & A.psi());
if ((A.hasUpper() || A.hasLower()) && A.mesh().fluxRequired(A.psi().name()))
if
(
(A.hasUpper() || A.hasLower())
&& A.psi().mesh().fluxRequired(A.psi().name())
)
{
tAcorr().faceFluxCorrectionPtr() = (-A.flux()).ptr();
}
@ -1321,7 +1325,11 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::correction
// Note the matrix coefficients are still that of matrix A
const fvMatrix<Type>& A = tAcorr();
if ((A.hasUpper() || A.hasLower()) && A.mesh().fluxRequired(A.psi().name()))
if
(
(A.hasUpper() || A.hasLower())
&& A.psi().mesh().fluxRequired(A.psi().name())
)
{
tAcorr().faceFluxCorrectionPtr() = (-A.flux()).ptr();
}

View File

@ -35,7 +35,7 @@ Foam::CoalCloud<ThermoType>::CoalCloud
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
)
:
ReactingMultiphaseCloud<CoalParcel<ThermoType> >

View File

@ -76,7 +76,7 @@ public:
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
);

View File

@ -10,7 +10,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
@ -30,6 +30,6 @@ LIB_LIBS = \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lcombustionThermophysicalModels \
-lreactionThermophysicalModels \
-lcompressibleRASModels \
-lcompressibleLESModels

View File

@ -28,7 +28,7 @@ License
#define createCoalParcelTypes_H
#include "makeParcelIOList.H"
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "CoalCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -38,12 +38,17 @@ License
createCoalParcelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
createCoalParcelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
createCoalParcelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "ReactingMultiphaseCloud.H"
#include "NoSurfaceReaction.H"
@ -44,12 +44,17 @@ License
makeCoalSurfaceReactionModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
makeCoalSurfaceReactionModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
makeCoalSurfaceReactionModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -50,10 +50,10 @@ Foam::COxidationDiffusionLimitedRate<CloudType>::COxidationDiffusionLimitedRate
CsLocalId_ = owner.composition().localId(idSolid, "C");
// Set local copies of thermo properties
WO2_ = owner.composition().carrierSpecies()[O2GlobalId_].W();
scalar WCO2 = owner.composition().carrierSpecies()[CO2GlobalId_].W();
WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
WC_ = WCO2 - WO2_;
HcCO2_ = owner.composition().carrierSpecies()[CO2GlobalId_].Hc();
HcCO2_ = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].Hc();
if (Sb_ < 0)
{
@ -120,8 +120,7 @@ Foam::scalar Foam::COxidationDiffusionLimitedRate<CloudType>::calculate
}
// Local mass fraction of O2 in the carrier phase
const scalar YO2 =
this->owner().carrierThermo().composition().Y(O2GlobalId_)[cellI];
const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
// Change in C mass [kg]
scalar dmC =

View File

@ -58,10 +58,10 @@ COxidationKineticDiffusionLimitedRate
CsLocalId_ = owner.composition().localId(idSolid, "C");
// Set local copies of thermo properties
WO2_ = owner.composition().carrierSpecies()[O2GlobalId_].W();
scalar WCO2 = owner.composition().carrierSpecies()[CO2GlobalId_].W();
WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
WC_ = WCO2 - WO2_;
HcCO2_ = owner.composition().carrierSpecies()[CO2GlobalId_].Hc();
HcCO2_ = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].Hc();
if (Sb_ < 0)
{
@ -128,8 +128,7 @@ Foam::scalar Foam::COxidationKineticDiffusionLimitedRate<CloudType>::calculate
}
// Local mass fraction of O2 in the carrier phase
const scalar YO2 =
this->owner().carrierThermo().composition().Y(O2GlobalId_)[cellI];
const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
// Diffusion rate coefficient
const scalar D0 = C1_/d*pow(0.5*(T + Tc), 0.75);

View File

@ -69,8 +69,8 @@ Foam::COxidationMurphyShaddix<CloudType>::COxidationMurphyShaddix
CsLocalId_ = owner.composition().localId(idSolid, "C");
// Set local copies of thermo properties
WO2_ = owner.composition().carrierSpecies()[O2GlobalId_].W();
scalar WCO2 = owner.composition().carrierSpecies()[CO2GlobalId_].W();
WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
WC_ = WCO2 - WO2_;
}
@ -125,7 +125,7 @@ Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::calculate
// Cell carrier phase O2 species density [kg/m^3]
const scalar rhoO2 =
rhoc*this->owner().carrierThermo().composition().Y(O2GlobalId_)[cellI];
rhoc*this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
if (rhoO2 < SMALL)
{
@ -211,9 +211,9 @@ Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::calculate
this->owner().composition().solids().properties()[CsLocalId_].Hf()
+ this->owner().composition().solids().properties()[CsLocalId_].cp()*T;
const scalar HCO2 =
this->owner().composition().carrierSpecies()[CO2GlobalId_].H(T);
this->owner().mcCarrierThermo().speciesData()[CO2GlobalId_].H(T);
const scalar HO2 =
this->owner().composition().carrierSpecies()[O2GlobalId_].H(T);
this->owner().mcCarrierThermo().speciesData()[O2GlobalId_].H(T);
// Heat of reaction
return dOmega*(WC_*HC + WO2_*HO2 - (WC_ + WO2_)*HCO2);

View File

@ -11,7 +11,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude
LIB_LIBS = \

View File

@ -34,15 +34,14 @@ License
#include "wallPolyPatch.H"
#include "wedgePolyPatch.H"
#include "processorPolyPatch.H"
#include "combustionMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineParticleTypeNameAndDebug(parcel, 0);
defineTemplateTypeNameAndDebug(Cloud<parcel>, 0);
defineParticleTypeNameAndDebug(parcel, 0);
defineTemplateTypeNameAndDebug(Cloud<parcel>, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -30,7 +30,7 @@ License
#include "dragModel.H"
#include "evaporationModel.H"
#include "heatTransferModel.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -93,7 +93,7 @@ void parcel::setRelaxationTimes
for(label i=0; i<Nf; i++)
{
label j = sDB.liquidToGasIndex()[i];
scalar Y = sDB.composition().Y()[j][celli];
scalar Y = sDB.composition().Y()[j][celli];
scalar Wi = sDB.gasProperties()[j].W();
Yf[i] = Y;
Xf[i] = Y*W/Wi;
@ -139,14 +139,14 @@ void parcel::setRelaxationTimes
scalar Prandtl = Pr(cpMixture, muf, kMixture);
// calculate the characteritic times
if(liquidCore_> 0.5)
{
// no drag for parcels in the liquid core..
tauMomentum = GREAT;
}
else
{
{
tauMomentum = sDB.drag().relaxationTime
(
Urel(Up),
@ -218,10 +218,10 @@ void parcel::setRelaxationTimes
{
scalar Nusselt =
sDB.heatTransfer().Nu(Reynolds, Prandtl);
// calculating the boiling temperature of the liquid at ambient pressure
scalar tBoilingSurface = Td;
label Niter = 0;
scalar deltaT = 10.0;
scalar dp0 = fuels.properties()[i].pv(pressure, tBoilingSurface) - pressure;
@ -255,16 +255,16 @@ void parcel::setRelaxationTimes
}
dp0 = dp;
}
scalar vapourSurfaceEnthalpy = 0.0;
scalar vapourFarEnthalpy = 0.0;
for(label k = 0; k < sDB.gasProperties().size(); k++)
{
vapourSurfaceEnthalpy += sDB.composition().Y()[k][celli]*sDB.gasProperties()[k].H(tBoilingSurface);
vapourFarEnthalpy += sDB.composition().Y()[k][celli]*sDB.gasProperties()[k].H(temperature);
}
scalar kLiquid = fuels.properties()[i].K(pressure, 0.5*(tBoilingSurface+T()));
tauBoiling[i] = sDB.evaporation().boilingTime

View File

@ -36,7 +36,7 @@ License
#include "injectorModel.H"
#include "wallModel.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
#include "symmetryPolyPatch.H"
#include "wedgePolyPatch.H"
@ -56,8 +56,8 @@ Foam::spray::spray
const volScalarField& rho,
const volScalarField& p,
const volScalarField& T,
const combustionMixture& composition,
const PtrList<specieProperties>& gasProperties,
const basicMultiComponentMixture& composition,
const PtrList<gasThermoPhysics>& gasProperties,
const dictionary&,
const dictionary& environmentalProperties
)
@ -264,7 +264,7 @@ Foam::spray::spray
"spray::spray(const volVectorField& U, "
"const volScalarField& rho, const volScalarField& p, "
"const volScalarField& T, const combustionMixture& composition,"
"const PtrList<specieProperties>& gaseousFuelProperties, "
"const PtrList<gasThermoPhsyics>& gaseousFuelProperties, "
"const dictionary& thermophysicalProperties, "
"const dictionary& environmentalProperties)"
) << "spray::(...) only one wedgePolyPatch found. "

View File

@ -38,10 +38,10 @@ Description
#include "IOPtrList.H"
#include "interpolation.H"
#include "liquid.H"
#include "sprayThermoTypes.H"
#include "autoPtr.H"
#include "liquidMixture.H"
#include "Random.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,7 +58,7 @@ class injectorModel;
class heatTransferModel;
class wallModel;
class combustionMixture;
class basicMultiComponentMixture;
/*---------------------------------------------------------------------------*\
Class spray Declaration
@ -127,8 +127,8 @@ class spray
// Composition properties
const PtrList<specieProperties>& gasProperties_;
const combustionMixture& composition_;
const PtrList<gasThermoPhysics>& gasProperties_;
const basicMultiComponentMixture& composition_;
List<label> liquidToGasIndex_;
List<label> gasToLiquidIndex_;
@ -192,8 +192,8 @@ public:
const volScalarField& rho,
const volScalarField& p,
const volScalarField& T,
const combustionMixture& composition,
const PtrList<specieProperties>& gasProperties,
const basicMultiComponentMixture& composition,
const PtrList<gasThermoPhysics>& gasProperties,
const dictionary& thermophysicalProperties,
const dictionary& environmentalProperties
);
@ -257,8 +257,8 @@ public:
inline const vector& g() const;
inline const liquidMixture& fuels() const;
inline const PtrList<specieProperties>& gasProperties() const;
inline const combustionMixture& composition() const;
inline const PtrList<gasThermoPhysics>& gasProperties() const;
inline const basicMultiComponentMixture& composition() const;
inline const List<label>& liquidToGasIndex() const;
inline const List<label>& gasToLiquidIndex() const;

View File

@ -36,71 +36,85 @@ inline const Time& spray::runTime() const
return runTime_;
}
inline const fvMesh& spray::mesh() const
{
return mesh_;
}
inline const volVectorField& spray::U() const
{
return U_;
}
inline const volScalarField& spray::rho() const
{
return rho_;
}
inline const volScalarField& spray::p() const
{
return p_;
}
inline const volScalarField& spray::T() const
{
return T_;
}
inline PtrList<injector>& spray::injectors()
{
return injectors_;
}
inline const PtrList<injector>& spray::injectors() const
{
return injectors_;
}
inline const atomizationModel& spray::atomization() const
{
return atomization_;
}
inline const breakupModel& spray::breakup() const
{
return breakupModel_;
}
inline const collisionModel& spray::collisions() const
{
return collisionModel_;
}
inline const dispersionModel& spray::dispersion() const
{
return dispersionModel_;
}
inline const dragModel& spray::drag() const
{
return drag_;
}
inline const evaporationModel& spray::evaporation() const
{
return evaporation_;
}
inline const heatTransferModel& spray::heatTransfer() const
{
return heatTransfer_;
@ -112,11 +126,13 @@ inline const injectorModel& spray::injection() const
return injectorModel_;
}
inline const wallModel& spray::wall() const
{
return wall_;
}
inline tmp<volVectorField> spray::momentumSource() const
{
tmp<volVectorField> tsource
@ -146,6 +162,7 @@ inline tmp<volVectorField> spray::momentumSource() const
return tsource;
}
inline tmp<volScalarField> spray::evaporationSource(const label si) const
{
tmp<volScalarField> tsource
@ -179,6 +196,7 @@ inline tmp<volScalarField> spray::evaporationSource(const label si) const
return tsource;
}
inline tmp<volScalarField> spray::heatTransferSource() const
{
tmp<volScalarField> tsource
@ -209,6 +227,7 @@ inline Random& spray::rndGen()
return rndGen_;
}
inline label spray::subCycles() const
{
return subCycles_;
@ -226,81 +245,97 @@ inline const liquidMixture& spray::fuels() const
return fuels_;
}
inline const PtrList<specieProperties>& spray::gasProperties() const
inline const PtrList<gasThermoPhysics>& spray::gasProperties() const
{
return gasProperties_;
}
inline const combustionMixture& spray::composition() const
inline const basicMultiComponentMixture& spray::composition() const
{
return composition_;
}
inline const List<label>& spray::liquidToGasIndex() const
{
return liquidToGasIndex_;
}
inline const List<label>& spray::gasToLiquidIndex() const
{
return gasToLiquidIndex_;
}
inline const List<bool>& spray::isLiquidFuel() const
{
return isLiquidFuel_;
}
inline const bool& spray::twoD() const
{
return twoD_;
}
inline const vector& spray::axisOfSymmetry() const
{
return axisOfSymmetry_;
}
inline const vector& spray::axisOfWedge() const
{
return axisOfWedge_;
}
inline const vector& spray::axisOfWedgeNormal() const
{
return axisOfWedgeNormal_;
}
inline const scalar& spray::angleOfWedge() const
{
return angleOfWedge_;
}
inline const interpolation<vector>& spray::UInterpolator() const
{
return UInterpolator_;
}
inline const interpolation<scalar>& spray::rhoInterpolator() const
{
return rhoInterpolator_;
}
inline const interpolation<scalar>& spray::pInterpolator() const
{
return pInterpolator_;
}
inline const interpolation<scalar>& spray::TInterpolator() const
{
return TInterpolator_;
}
inline vectorField& spray::sms()
{
return sms_;
}
inline const vectorField& spray::sms() const
{
return sms_;
@ -312,6 +347,7 @@ inline scalarField& spray::shs()
return shs_;
}
inline const scalarField& spray::shs() const
{
return shs_;
@ -323,16 +359,19 @@ inline PtrList<scalarField>& spray::srhos()
return srhos_;
}
inline const PtrList<scalarField>& spray::srhos() const
{
return srhos_;
}
inline const scalar& spray::ambientPressure() const
{
return ambientPressure_;
}
inline const scalar& spray::ambientTemperature() const
{
return ambientTemperature_;

View File

@ -28,7 +28,7 @@ License
#include "LISA.H"
#include "addToRunTimeSelectionTable.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
#include "RosinRammler.H"
@ -84,7 +84,7 @@ void LISA::atomizeParcel
) const
{
const PtrList<volScalarField>& Y = spray_.composition().Y();
label Ns = Y.size();
@ -98,7 +98,7 @@ void LISA::atomizeParcel
{
Winv += Y[i][cellI]/spray_.gasProperties()[i].W();
}
scalar R = specie::RR*Winv;
// ideal gas law to evaluate density
@ -113,31 +113,31 @@ void LISA::atomizeParcel
scalar WeberNumber = p.We(vel, rhoAverage, sigma);
scalar tau = 0.0;
scalar dL = 0.0;
scalar dL = 0.0;
scalar k = 0.0;
scalar muFuel = fuels.mu(pressure, p.T(), p.X());
scalar rhoFuel = fuels.rho(1.0e+5, p.T(), p.X());
scalar nuFuel = muFuel/rhoFuel;
vector uDir = p.U()/mag(p.U());
scalar uGas = mag(vel & uDir);
vector Ug = uGas*uDir;
/*
/*
TL
It might be the relative velocity between Liquid and Gas, but I use the
absolute velocity of the parcel as suggested by the authors
absolute velocity of the parcel as suggested by the authors
*/
// scalar U = mag(p.Urel(vel));
scalar U = mag(p.U());
p.ct() += deltaT;
scalar Q = rhoAverage/rhoFuel;
const injectorType& it =
const injectorType& it =
spray_.injectors()[label(p.injector())].properties();
if (it.nHoles() > 1)
@ -150,38 +150,38 @@ void LISA::atomizeParcel
scalar pWalk = mag(p.position() - itPosition);
// Updating liquid sheet tickness... that is the droplet diameter
const vector direction = it.direction(0, spray_.runTime().value());
scalar h = (p.position() - itPosition) & direction;
scalar d = sqrt(sqr(pWalk)-sqr(h));
scalar time = pWalk/mag(p.U());
scalar elapsedTime = spray_.runTime().value();
scalar massFlow = it.massFlowRate(max(0.0,elapsedTime-time));
scalar hSheet = massFlow/(mathematicalConstant::pi*d*rhoFuel*mag(p.U()));
scalar hSheet = massFlow/(mathematicalConstant::pi*d*rhoFuel*mag(p.U()));
p.d() = min(hSheet,p.d());
if(WeberNumber > 27.0/16.0)
{
scalar kPos = 0.0;
scalar kNeg = Q*pow(U, 2.0)*rhoFuel/sigma;
scalar derivativePos = sqrt
(
Q*pow(U,2.0)
);
scalar derivativeNeg =
);
scalar derivativeNeg =
(
8.0*pow(nuFuel, 2.0)*pow(kNeg, 3.0)
+ Q*pow(U, 2.0)*kNeg
8.0*pow(nuFuel, 2.0)*pow(kNeg, 3.0)
+ Q*pow(U, 2.0)*kNeg
- 3.0*sigma/2.0/rhoFuel*pow(kNeg, 2.0)
)
/
@ -189,23 +189,23 @@ void LISA::atomizeParcel
(
4.0*pow(nuFuel, 2.0)*pow(kNeg, 4.0)
+ Q*pow(U, 2.0)*pow(kNeg, 2.0)
- sigma*pow(kNeg, 3.0)/rhoFuel
- sigma*pow(kNeg, 3.0)/rhoFuel
)
-
4.0*nuFuel*kNeg;
scalar kOld = 0.0;
scalar kOld = 0.0;
for(label i=0; i<40; i++)
{
k = kPos - (derivativePos/((derivativeNeg-derivativePos)/(kNeg-kPos)));
scalar derivativek =
scalar derivativek =
(
8.0*pow(nuFuel, 2.0)*pow(k, 3.0)
+ Q*pow(U, 2.0)*k
8.0*pow(nuFuel, 2.0)*pow(k, 3.0)
+ Q*pow(U, 2.0)*k
- 3.0*sigma/2.0/rhoFuel*pow(k, 2.0)
)
/
@ -213,10 +213,10 @@ void LISA::atomizeParcel
(
4.0*pow(nuFuel, 2.0)*pow(k, 4.0)
+ Q*pow(U, 2.0)*pow(k, 2.0)
- sigma*pow(k, 3.0)/rhoFuel
- sigma*pow(k, 3.0)/rhoFuel
)
-
4.0*nuFuel*k;
4.0*nuFuel*k;
if(derivativek > 0)
{
@ -228,17 +228,17 @@ void LISA::atomizeParcel
derivativeNeg = derivativek;
kNeg = k;
}
if(mag(k-kOld)/k < 1e-4)
{
break;
}
kOld = k;
}
scalar omegaS =
scalar omegaS =
- 2.0 * nuFuel * pow(k, 2.0)
+ sqrt
(
@ -246,22 +246,22 @@ void LISA::atomizeParcel
+ Q*pow(U, 2.0)*pow(k, 2.0)
- sigma*pow(k, 3.0)/rhoFuel
);
tau = cTau_/omegaS;
tau = cTau_/omegaS;
dL = sqrt(8.0*p.d()/k);
}
else
{
k =
k =
rhoAverage*pow(U, 2.0)
/
2.0*sigma;
scalar J = pWalk*p.d()/2.0;
tau = pow(3.0*cTau_,2.0/3.0)*cbrt(J*sigma/(sqr(Q)*pow(U,4.0)*rhoFuel));
dL = sqrt(4.0*p.d()/k);
@ -269,78 +269,78 @@ void LISA::atomizeParcel
scalar kL =
scalar kL =
1.0
/
(
dL *
dL *
pow(0.5 + 1.5 * muFuel/pow((rhoFuel*sigma*dL), 0.5), 0.5)
);
scalar dD = cbrt(3.0*mathematicalConstant::pi*pow(dL, 2.0)/kL);
scalar dD = cbrt(3.0*mathematicalConstant::pi*pow(dL, 2.0)/kL);
scalar lisaExp = 0.27;
scalar ambientPressure = 1.0e+5;
scalar pRatio = spray_.ambientPressure()/ambientPressure;
dD = dD*pow(pRatio,lisaExp);
// modifications to take account of the flash boiling on primary breakUp
scalar pExp = 0.135;
scalar chi = 0.0;
label Nf = fuels.components().size();
label Nf = fuels.components().size();
scalar Td = p.T();
for(label i = 0; i < Nf ; i++)
{
if(fuels.properties()[i].pv(spray_.ambientPressure(), Td) >= 0.999*spray_.ambientPressure())
{
// The fuel is boiling.....
// Calculation of the boiling temperature
// Calculation of the boiling temperature
scalar tBoilingSurface = Td;
label Niter = 200;
for(label k=0; k< Niter ; k++)
{
scalar pBoil = fuels.properties()[i].pv(pressure, tBoilingSurface);
if(pBoil > pressure)
{
tBoilingSurface = tBoilingSurface - (Td-temperature)/Niter;
tBoilingSurface = tBoilingSurface - (Td-temperature)/Niter;
}
else
{
break;
}
}
scalar hl = fuels.properties()[i].hl(spray_.ambientPressure(), tBoilingSurface);
scalar iTp = fuels.properties()[i].h(spray_.ambientPressure(), Td) - spray_.ambientPressure()/fuels.properties()[i].rho(spray_.ambientPressure(), Td);
scalar iTb = fuels.properties()[i].h(spray_.ambientPressure(), tBoilingSurface) - spray_.ambientPressure()/fuels.properties()[i].rho(spray_.ambientPressure(), tBoilingSurface);
chi += p.X()[i]*(iTp-iTb)/hl;
}
}
}
// bounding chi
chi = max(chi, 0.0);
chi = min(chi, 1.0);
// modifing dD to take account of flash boiling
dD = dD*(1.0 - chi*pow(pRatio, -pExp));
scalar lBU = Cl_ * mag(p.U())*tau;
if(pWalk > lBU)
@ -349,7 +349,7 @@ void LISA::atomizeParcel
p.liquidCore() = 0.0;
// calculate the new diameter with a Rosin Rammler distribution
scalar minValue = min(p.d(),dD/10.0);
scalar maxValue = dD;
@ -357,30 +357,30 @@ void LISA::atomizeParcel
if(maxValue - minValue < SMALL)
{
minValue = p.d()/10.0;
}
}
scalar range = maxValue - minValue;
scalar y = 0;
scalar x = 0;
bool success = false;
while(!success)
{
x = minValue + range*rndGen_.scalar01();
y = rndGen_.scalar01();
scalar p = 0.0;
scalar nExp = 1;
scalar xx = pow(x/dD, nExp);
p = xx*exp(-xx);
if (y<p)
if (y<p)
{
success = true;
}
@ -388,13 +388,13 @@ void LISA::atomizeParcel
}
// New droplet diameter
p.d() = x;
p.ct() = 0.0;
}
}
}

View File

@ -28,7 +28,7 @@ License
#include "blobsSheetAtomization.H"
#include "addToRunTimeSelectionTable.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
#include "RosinRammler.H"

View File

@ -28,7 +28,7 @@ License
#include "noAtomization.H"
#include "addToRunTimeSelectionTable.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,7 +28,7 @@ License
#include "reitzDiwakar.H"
#include "addToRunTimeSelectionTable.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -9,7 +9,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
@ -28,6 +28,6 @@ LIB_LIBS = \
-lsolidMixture \
-lspecie \
-lbasicThermophysicalModels \
-lcombustionThermophysicalModels \
-lreactionThermophysicalModels \
-lcompressibleRASModels \
-lcompressibleLESModels

View File

@ -151,18 +151,18 @@ Foam::KinematicCloud<ParcelType>::~KinematicCloud()
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
if (!fullyDescribed)
{
pPtr->rho() = constProps_.rho0();
parcel.rho() = constProps_.rho0();
}
scalar carrierDt = this->db().time().deltaT().value();
pPtr->stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
}

View File

@ -357,7 +357,7 @@ public:
//- Check parcel properties
void checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);

View File

@ -28,7 +28,6 @@ License
#include "CompositionModel.H"
#include "PhaseChangeModel.H"
#include "multiComponentMixture.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
@ -68,14 +67,16 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
)
:
ThermoCloud<ParcelType>(cloudName, rho, U, g, thermo),
reactingCloud(),
constProps_(this->particleProperties()),
carrierThermo_(thermo),
carrierSpecies_(thermo.composition().Y().size()),
mcCarrierThermo_
(
dynamic_cast<multiComponentMixture<thermoType>&>(thermo)
),
compositionModel_
(
CompositionModel<ReactingCloud<ParcelType> >::New
@ -92,23 +93,9 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
*this
)
),
rhoTrans_(thermo.composition().Y().size()),
rhoTrans_(mcCarrierThermo_.species().size()),
dMassPhaseChange_(0.0)
{
// Create the carrier species
forAll(carrierSpecies_, specieI)
{
carrierSpecies_.set
(
specieI,
new thermoType
(
dynamic_cast<const multiComponentMixture<thermoType>&>
(thermo).speciesData()[specieI]
)
);
}
// Set storage for mass source fields and initialise to zero
forAll(rhoTrans_, i)
{
@ -119,9 +106,7 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
(
IOobject
(
this->name()
+ "rhoTrans_"
+ thermo.composition().Y()[i].name(),
this->name() + "rhoTrans_" + mcCarrierThermo_.species()[i],
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
@ -148,34 +133,34 @@ Foam::ReactingCloud<ParcelType>::~ReactingCloud()
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
ThermoCloud<ParcelType>::checkParcelProperties
(
pPtr,
parcel,
lagrangianDt,
fullyDescribed
);
if (!fullyDescribed)
{
pPtr->Y() = composition().YMixture0();
parcel.Y() = composition().YMixture0();
}
else
{
checkSuppliedComposition
(
pPtr->Y(),
parcel.Y(),
composition().YMixture0(),
"YMixture"
);
}
// derived information - store initial mass
pPtr->mass0() = pPtr->mass();
parcel.mass0() = parcel.mass();
}
@ -193,9 +178,9 @@ void Foam::ReactingCloud<ParcelType>::resetSourceTerms()
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::evolve()
{
const volScalarField& T = carrierThermo_.T();
const volScalarField cp = carrierThermo_.Cp();
const volScalarField& p = carrierThermo_.p();
const volScalarField& T = this->carrierThermo().T();
const volScalarField cp = this->carrierThermo().Cp();
const volScalarField& p = this->carrierThermo().p();
autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
(

View File

@ -41,11 +41,9 @@ SourceFiles
#ifndef ReactingCloud_H
#define ReactingCloud_H
#include "autoPtr.H"
#include "hCombustionThermo.H"
#include "ThermoCloud.H"
#include "reactingCloud.H"
#include "multiComponentMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -94,11 +92,8 @@ protected:
//- Parcel constant properties
typename ParcelType::constantProperties constProps_;
//- Thermodynamics package (combustion)
hCombustionThermo& carrierThermo_;
//- Gas phase properties
PtrList<thermoType> carrierSpecies_;
//- Multi-component carrier phase thermo
multiComponentMixture<thermoType>& mcCarrierThermo_;
// References to the cloud sub-models
@ -148,7 +143,7 @@ public:
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
);
@ -168,14 +163,12 @@ public:
inline const typename ParcelType::constantProperties&
constProps() const;
//- Return const access to carrier phase thermo package
inline const hCombustionThermo& carrierThermo() const;
//- Return const access to multi-component carrier phase thermo
inline const multiComponentMixture<thermoType>&
mcCarrierThermo() const;
//- Return access to carrier phase thermo package
inline hCombustionThermo& carrierThermo();
//- Gas phase properties
inline const PtrList<thermoType>& carrierSpecies() const;
//- Return access to multi-component carrier phase thermo
inline multiComponentMixture<thermoType>& mcCarrierThermo();
// Sub-models
@ -224,7 +217,7 @@ public:
//- Check parcel properties
void checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);

View File

@ -35,26 +35,18 @@ Foam::ReactingCloud<ParcelType>::constProps() const
template<class ParcelType>
inline const Foam::hCombustionThermo&
Foam::ReactingCloud<ParcelType>::carrierThermo() const
inline const Foam::multiComponentMixture<typename ParcelType::thermoType>&
Foam::ReactingCloud<ParcelType>::mcCarrierThermo() const
{
return carrierThermo_;
return mcCarrierThermo_;
}
template<class ParcelType>
inline Foam::hCombustionThermo&
Foam::ReactingCloud<ParcelType>::carrierThermo()
inline Foam::multiComponentMixture<typename ParcelType::thermoType>&
Foam::ReactingCloud<ParcelType>::mcCarrierThermo()
{
return carrierThermo_;
}
template<class ParcelType>
inline const Foam::PtrList<typename ParcelType::thermoType>&
Foam::ReactingCloud<ParcelType>::carrierSpecies() const
{
return carrierSpecies_;
return mcCarrierThermo_;
}

View File

@ -38,7 +38,7 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
)
:
ReactingCloud<ParcelType>(cloudName, rho, U, g, thermo),
@ -76,14 +76,14 @@ Foam::ReactingMultiphaseCloud<ParcelType>::~ReactingMultiphaseCloud()
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
ReactingCloud<ParcelType>::checkParcelProperties
(
pPtr,
parcel,
lagrangianDt,
fullyDescribed
);
@ -94,27 +94,27 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::checkParcelProperties
if (!fullyDescribed)
{
pPtr->YGas() = this->composition().Y0(idGas);
pPtr->YLiquid() = this->composition().Y0(idLiquid);
pPtr->YSolid() = this->composition().Y0(idSolid);
parcel.YGas() = this->composition().Y0(idGas);
parcel.YLiquid() = this->composition().Y0(idLiquid);
parcel.YSolid() = this->composition().Y0(idSolid);
}
else
{
this->checkSuppliedComposition
(
pPtr->YGas(),
parcel.YGas(),
this->composition().Y0(idGas),
"YGas"
);
this->checkSuppliedComposition
(
pPtr->YLiquid(),
parcel.YLiquid(),
this->composition().Y0(idLiquid),
"YLiquid"
);
this->checkSuppliedComposition
(
pPtr->YSolid(),
parcel.YSolid(),
this->composition().Y0(idSolid),
"YSolid"
);

View File

@ -123,7 +123,7 @@ public:
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
);
@ -178,7 +178,7 @@ public:
//- Check parcel properties
void checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);

View File

@ -113,22 +113,22 @@ Foam::ThermoCloud<ParcelType>::~ThermoCloud()
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
KinematicCloud<ParcelType>::checkParcelProperties
(
pPtr,
parcel,
lagrangianDt,
fullyDescribed
);
if (!fullyDescribed)
{
pPtr->T() = constProps_.T0();
pPtr->cp() = constProps_.cp0();
parcel.T() = constProps_.T0();
parcel.cp() = constProps_.cp0();
}
}

View File

@ -40,11 +40,9 @@ SourceFiles
#ifndef ThermoCloud_H
#define ThermoCloud_H
#include "autoPtr.H"
#include "hCombustionThermo.H"
#include "KinematicCloud.H"
#include "thermoCloud.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -220,7 +218,7 @@ public:
//- Check parcel properties
void checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);

View File

@ -35,7 +35,7 @@ Foam::BasicReactingCloud<ThermoType>::BasicReactingCloud
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
)
:
ReactingCloud<BasicReactingParcel<ThermoType> >

View File

@ -81,7 +81,7 @@ public:
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
);

View File

@ -35,8 +35,7 @@ Foam::BasicReactingMultiphaseCloud<ThermoType>::BasicReactingMultiphaseCloud
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo,
PtrList<ThermoType>& carrierSpecies
basicThermo& thermo
)
:
ReactingMultiphaseCloud<BasicReactingMultiphaseParcel<ThermoType> >
@ -45,8 +44,7 @@ Foam::BasicReactingMultiphaseCloud<ThermoType>::BasicReactingMultiphaseCloud
rho,
U,
g,
thermo,
carrierSpecies
thermo
)
{
BasicReactingMultiphaseParcel<ThermoType>::readFields(*this);

View File

@ -81,8 +81,7 @@ public:
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo,
PtrList<ThermoType>& carrierSpecies
basicThermo& thermo
);

View File

@ -35,7 +35,7 @@ Foam::BasicTrackedReactingCloud<ThermoType>::BasicTrackedReactingCloud
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
)
:
ReactingCloud<BasicTrackedReactingParcel<ThermoType> >

View File

@ -81,7 +81,7 @@ public:
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
);

View File

@ -27,14 +27,15 @@ License
#ifndef createReactingCloudTypes_H
#define createReactingCloudTypes_H
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define createReactingCloudType(CloudType) \
\
createReactingCloudThermoType(CloudType, specieConstProperties); \
createReactingCloudThermoType(CloudType, specieReactingProperties);
createReactingCloudThermoType(CloudType, constGasThermoPhysics); \
createReactingCloudThermoType(CloudType, gasThermoPhysics); \
createReactingCloudThermoType(CloudType, icoPoly8ThermoPhysics);
#define createReactingCloudThermoType(CloudType, ThermoType) \

View File

@ -49,7 +49,7 @@ void Foam::KinematicParcel<ParcelType>::setCellValues
"const scalar, "
"const label"
")"
) << "Limiting density in cell " << cellI << " to "
) << "Limiting observed density in cell " << cellI << " to "
<< td.constProps().rhoMin() << nl << endl;
rhoc_ = td.constProps().rhoMin();
@ -113,9 +113,6 @@ void Foam::KinematicParcel<ParcelType>::calc
// Motion
// ~~~~~~
// No additional forces
vector Fx = vector::zero;
// Calculate new particle velocity
vector U1 = calcVelocity(td, dt, cellI, d0, U0, rho0, mass0, Su, dUTrans);

View File

@ -168,7 +168,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::cellValueSourceCorrection
forAll(td.cloud().rhoTrans(), i)
{
scalar Y = td.cloud().rhoTrans(i)[cellI]/addedMass;
cpEff += Y*td.cloud().carrierSpecies()[i].Cp(this->Tc_);
cpEff +=
Y*td.cloud().mcCarrierThermo().speciesData()[i].Cp(this->Tc_);
}
}
const scalar cpc = td.cpInterp().psi()[cellI];
@ -248,7 +249,12 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
scalarField dMassSRGas(YGas_.size(), 0.0);
scalarField dMassSRLiquid(YLiquid_.size(), 0.0);
scalarField dMassSRSolid(YSolid_.size(), 0.0);
scalarField dMassSRCarrier(td.cloud().carrierSpecies().size(), 0.0);
scalarField
dMassSRCarrier
(
td.cloud().mcCarrierThermo().species().size(),
0.0
);
// Clac mass and enthalpy transfer due to surface reactions
calcSurfaceReactions
@ -340,7 +346,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
td.cloud().hcTrans()[cellI] +=
np0
*dMassGas[i]
*td.cloud().composition().carrierSpecies()[gid].H(T0);
*td.cloud().mcCarrierThermo().speciesData()[gid].H(T0);
}
forAll(YLiquid_, i)
{
@ -349,7 +355,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
td.cloud().hcTrans()[cellI] +=
np0
*dMassLiquid[i]
*td.cloud().composition().carrierSpecies()[gid].H(T0);
*td.cloud().mcCarrierThermo().speciesData()[gid].H(T0);
}
/*
// No mapping between solid components and carrier phase
@ -360,7 +366,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
td.cloud().hcTrans()[cellI] +=
np0
*dMassSolid[i]
*td.cloud().composition().carrierSpecies()[gid].H(T0);
*td.cloud().mcCarrierThermo().speciesData()[gid].H(T0);
}
*/
forAll(dMassSRCarrier, i)
@ -369,7 +375,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
td.cloud().hcTrans()[cellI] +=
np0
*dMassSRCarrier[i]
*td.cloud().composition().carrierSpecies()[i].H(T0);
*td.cloud().mcCarrierThermo().speciesData()[i].H(T0);
}
// Update momentum transfer

View File

@ -50,7 +50,7 @@ void Foam::ReactingParcel<ParcelType>::setCellValues
"const scalar, "
"const label"
")"
) << "Limiting pressure in cell " << cellI << " to "
) << "Limiting observed pressure in cell " << cellI << " to "
<< td.constProps().pMin() << nl << endl;
pc_ = td.constProps().pMin();
@ -86,7 +86,8 @@ void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection
forAll(td.cloud().rhoTrans(), i)
{
scalar Y = td.cloud().rhoTrans(i)[cellI]/addedMass;
cpEff += Y*td.cloud().carrierSpecies()[i].Cp(this->Tc_);
cpEff +=
Y*td.cloud().mcCarrierThermo().speciesData()[i].Cp(this->Tc_);
}
}
const scalar cpc = td.cpInterp().psi()[cellI];
@ -190,9 +191,6 @@ void Foam::ReactingParcel<ParcelType>::calc
// Motion
// ~~~~~~
// No additional forces
vector Fx = vector::zero;
// Calculate new particle velocity
vector U1 = calcVelocity(td, dt, cellI, d0, U0, rho0, mass0, Su, dUTrans);
@ -210,7 +208,7 @@ void Foam::ReactingParcel<ParcelType>::calc
td.cloud().hcTrans()[cellI] +=
np0
*dMassPC[i]
*td.cloud().composition().carrierSpecies()[gid].H(T0);
*td.cloud().mcCarrierThermo().speciesData()[gid].H(T0);
}
// Update momentum transfer
@ -317,16 +315,15 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
td.cloud().addToMassPhaseChange(this->nParticle_*dMassTot);
// Enthalphy transfer to carrier phase
label id;
forAll(YComponents, i)
{
label gid;
id = td.cloud().composition().localToGlobalCarrierId(idPhase, i);
const scalar hv = td.cloud().mcCarrierThermo().speciesData()[id].H(T);
gid = td.cloud().composition().localToGlobalCarrierId(idPhase, i);
const scalar hv = td.cloud().composition().carrierSpecies()[gid].H(T);
gid = td.cloud().composition().globalIds(idPhase)[i];
id = td.cloud().composition().globalIds(idPhase)[i];
const scalar hl =
td.cloud().composition().liquids().properties()[gid].h(pc_, T);
td.cloud().composition().liquids().properties()[id].h(pc_, T);
Sh += dMassPC[i]*(hl - hv)/dt;
}

View File

@ -53,7 +53,7 @@ void Foam::ThermoParcel<ParcelType>::setCellValues
"const scalar, "
"const label"
")"
) << "Limiting temperature in cell " << cellI << " to "
) << "Limiting observed temperature in cell " << cellI << " to "
<< td.constProps().TMin() << nl << endl;
Tc_ = td.constProps().TMin();
@ -178,13 +178,13 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
if (mag(htc) < ROOTVSMALL && !td.cloud().radiation())
{
return T + dt*Sh/(this->mass()*cp);
return T + dt*Sh/(this->volume(d)*rho*cp);
}
scalar ap;
scalar bp;
if(td.cloud().radiation())
if (td.cloud().radiation())
{
const scalarField& G =
td.cloud().mesh().objectRegistry::lookupObject<volScalarField>("G");

View File

@ -28,7 +28,7 @@ License
#define createReactingMultiphaseParcelTypes_H
#include "makeParcelIOList.H"
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -37,12 +37,17 @@ License
createReactingMultiphaseParcelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
createReactingMultiphaseParcelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
createReactingMultiphaseParcelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -28,14 +28,15 @@ License
#define createReactingParcelTypes_H
#include "makeParcelIOList.H"
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define createReactingParcelType(ParcelType) \
\
createReactingParcelThermoType(ParcelType, specieConstProperties); \
createReactingParcelThermoType(ParcelType, specieReactingProperties);
createReactingParcelThermoType(ParcelType, constGasThermoPhysics); \
createReactingParcelThermoType(ParcelType, gasThermoPhysics); \
createReactingParcelThermoType(ParcelType, icoPoly8ThermoPhysics);
#define createReactingParcelThermoType(ParcelType, ThermoType) \

View File

@ -36,12 +36,17 @@ License
createTrackedReactingParcelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
createTrackedReactingParcelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
createTrackedReactingParcelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "ReactingCloud.H"
#include "SingleMixtureFraction.H"
@ -41,12 +41,17 @@ License
makeReactingMultiphaseCompositionModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
makeReactingMultiphaseCompositionModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
makeReactingMultiphaseCompositionModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "ReactingMultiphaseCloud.H"
#include "ConstantRateDevolatilisation.H"
@ -43,12 +43,17 @@ License
makeReactingMultiphaseDevolatilisationModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
makeReactingMultiphaseDevolatilisationModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
makeReactingMultiphaseDevolatilisationModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "KinematicCloud.H"
#include "ConeInjection.H"
@ -45,13 +45,19 @@ License
makeReactingMultiphaseInjectionModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
\
makeReactingMultiphaseInjectionModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
\
makeReactingMultiphaseInjectionModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "ReactingMultiphaseCloud.H"
#include "NoSurfaceReaction.H"
@ -41,12 +41,17 @@ License
makeReactingMultiphaseSurfaceReactionModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
makeReactingMultiphaseSurfaceReactionModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
makeReactingMultiphaseSurfaceReactionModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "ReactingCloud.H"
#include "SinglePhaseMixture.H"
@ -41,12 +41,17 @@ License
makeReactingCompositionModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
makeReactingCompositionModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
makeReactingCompositionModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "KinematicCloud.H"
#include "NoDispersion.H"
@ -43,13 +43,19 @@ License
makeReactingDispersionModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
\
makeReactingDispersionModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
\
makeReactingDispersionModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "KinematicCloud.H"
#include "NoDrag.H"
@ -42,12 +42,17 @@ License
makeReactingDragModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
makeReactingDragModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
makeReactingDragModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "ThermoCloud.H"
#include "NoHeatTransfer.H"
@ -42,12 +42,17 @@ License
makeReactingHeatTransferModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
makeReactingHeatTransferModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
makeReactingHeatTransferModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "KinematicCloud.H"
#include "ConeInjection.H"
@ -46,13 +46,19 @@ License
makeReactingInjectionModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
\
makeReactingInjectionModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
\
makeReactingInjectionModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "KinematicCloud.H"
#include "LocalInteraction.H"
@ -43,13 +43,19 @@ License
makeReactingPatchInteractionModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
\
makeReactingPatchInteractionModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
\
makeReactingPatchInteractionModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "ReactingCloud.H"
#include "NoPhaseChange.H"
@ -42,13 +42,19 @@ License
makeReactingPhaseChangeModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
\
makeReactingPhaseChangeModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
\
makeReactingPhaseChangeModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "KinematicCloud.H"
#include "NoPostProcessing.H"
@ -42,13 +42,19 @@ License
makeReactingPostProcessingModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
\
makeReactingPostProcessingModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
\
makeReactingPostProcessingModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -401,7 +401,7 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
setProperties(parcelI, newParcels, timeInj, *pPtr);
// Check new parcel properties
td.cloud().checkParcelProperties(pPtr, dt, fullyDescribed());
td.cloud().checkParcelProperties(*pPtr, dt, fullyDescribed());
// Apply correction to velocity for 2-D cases
meshTools::constrainDirection

View File

@ -29,17 +29,20 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template <class CloudType>
bool Foam::LocalInteraction<CloudType>::applyToPatch(const polyPatch& pp) const
Foam::label Foam::LocalInteraction<CloudType>::applyToPatch
(
const label globalPatchI
) const
{
forAll(patchIds_, patchI)
{
if (patchIds_[patchI] == pp.index())
if (patchIds_[patchI] == globalPatchI)
{
return true;
return patchI;
}
}
return false;
return -1;
}
@ -75,7 +78,11 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
DynamicList<word> badWalls;
forAll(bMesh, patchI)
{
if (isA<wallPolyPatch>(bMesh[patchI]) && !applyToPatch(bMesh[patchI]))
if
(
isA<wallPolyPatch>(bMesh[patchI])
&& applyToPatch(bMesh[patchI].index()) < 0
)
{
badWalls.append(bMesh[patchI].name());
}
@ -115,7 +122,9 @@ bool Foam::LocalInteraction<CloudType>::correct
vector& U
) const
{
if (applyToPatch(pp))
label patchI = applyToPatch(pp.index());
if (patchI >= 0)
{
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);
@ -125,10 +134,10 @@ bool Foam::LocalInteraction<CloudType>::correct
if (Un > 0)
{
U -= (1.0 + patchData_[pp.index()].e())*Un*nw;
U -= (1.0 + patchData_[patchI].e())*Un*nw;
}
U -= patchData_[pp.index()].mu()*Ut;
U -= patchData_[patchI].mu()*Ut;
return true;
}

View File

@ -132,8 +132,8 @@ class LocalInteraction
// Private member functions
//- Returns true if patch is in patchIds_ list
bool applyToPatch(const polyPatch& pp) const;
//- Returns local patchI if patch is in patchIds_ list
label applyToPatch(const label globalPatchI) const;

View File

@ -39,15 +39,14 @@ Foam::CompositionModel<CloudType>::CompositionModel
dict_(dict),
owner_(owner),
coeffDict_(dict.subDict(type + "Coeffs")),
carrierThermo_(owner.carrierThermo()),
carrierSpecies_(owner.carrierSpecies()),
mcCarrierThermo_(owner.mcCarrierThermo()),
liquids_
(
liquidMixture::New
(
owner.mesh().objectRegistry::lookupObject<dictionary>
(
carrierThermo_.name()
owner.carrierThermo().name()
)
)
),
@ -57,14 +56,14 @@ Foam::CompositionModel<CloudType>::CompositionModel
(
owner.mesh().objectRegistry::lookupObject<dictionary>
(
carrierThermo_.name()
owner.carrierThermo().name()
)
)
),
phaseProps_
(
coeffDict_.lookup("phases"),
carrierThermo_.composition().species(),
mcCarrierThermo_.species(),
liquids_().components(),
solids_().components()
)
@ -102,18 +101,10 @@ const Foam::dictionary& Foam::CompositionModel<CloudType>::coeffDict() const
template<class CloudType>
const Foam::hCombustionThermo&
Foam::CompositionModel<CloudType>::carrierThermo() const
const Foam::multiComponentMixture<typename CloudType::thermoType>&
Foam::CompositionModel<CloudType>::mcCarrierThermo() const
{
return carrierThermo_;
}
template<class CloudType>
const Foam::PtrList<typename CloudType::thermoType>&
Foam::CompositionModel<CloudType>::carrierSpecies() const
{
return carrierSpecies_;
return mcCarrierThermo_;
}
@ -184,10 +175,9 @@ Foam::label Foam::CompositionModel<CloudType>::globalCarrierId
const word& cmptName
) const
{
forAll(carrierThermo_.composition().species(), i)
forAll(mcCarrierThermo_.species(), i)
{
word carrierSpecieName = carrierThermo_.composition().species()[i];
if (cmptName == carrierSpecieName)
if (cmptName == mcCarrierThermo_.species()[i])
{
return i;
}
@ -323,8 +313,8 @@ Foam::scalarField Foam::CompositionModel<CloudType>::X
forAll(Y, i)
{
label gid = props.globalIds()[i];
WInv += Y[i]/this->carrierSpecies()[gid].W();
X[i] = Y[i]/this->carrierSpecies()[gid].W();
WInv += Y[i]/mcCarrierThermo_.speciesData()[gid].W();
X[i] = Y[i]/mcCarrierThermo_.speciesData()[gid].W();
}
break;
}
@ -374,7 +364,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::H
forAll(Y, i)
{
label gid = props.globalIds()[i];
HMixture += Y[i]*this->carrierSpecies()[gid].H(T);
HMixture += Y[i]*mcCarrierThermo_.speciesData()[gid].H(T);
}
break;
}
@ -438,7 +428,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::cp
forAll(Y, i)
{
label gid = props.globalIds()[i];
cpMixture += Y[i]*this->carrierSpecies()[gid].Cp(T);
cpMixture += Y[i]*mcCarrierThermo_.speciesData()[gid].Cp(T);
}
break;
}

View File

@ -44,7 +44,7 @@ SourceFiles
#include "runTimeSelectionTables.H"
#include "PtrList.H"
#include "hCombustionThermo.H"
#include "multiComponentMixture.H"
#include "liquidMixture.H"
#include "solidMixture.H"
@ -74,11 +74,8 @@ class CompositionModel
//- The coefficients dictionary
const dictionary& coeffDict_;
//- Reference to the carrier phase thermo package
hCombustionThermo& carrierThermo_;
//- Reference to the carrier phase species
const PtrList<typename CloudType::thermoType>& carrierSpecies_;
//- Reference to the multi-component carrier phase thermo
multiComponentMixture<typename CloudType::thermoType>& mcCarrierThermo_;
//- Global (additional) liquid properties data
autoPtr<liquidMixture> liquids_;
@ -146,15 +143,12 @@ public:
const dictionary& coeffDict() const;
//- Return the carrier phase thermo package
const hCombustionThermo& carrierThermo() const;
const multiComponentMixture<typename CloudType::thermoType>&
mcCarrierThermo() const;
// Composition lists
//- Return the carrier species
const PtrList<typename CloudType::thermoType>&
carrierSpecies() const;
//- Return the global (additional) liquids
const liquidMixture& liquids() const;

View File

@ -35,14 +35,14 @@ Foam::scalarField Foam::LiquidEvaporation<CloudType>::calcXc
const label cellI
) const
{
scalarField Xc(this->owner().carrierThermo().composition().Y().size());
scalarField Xc(this->owner().mcCarrierThermo().Y().size());
scalar Winv = 0.0;
forAll(Xc, i)
{
scalar Y = this->owner().carrierThermo().composition().Y()[i][cellI];
Winv += Y/this->owner().carrierSpecies()[i].W();
Xc[i] = Y/this->owner().carrierSpecies()[i].W();
scalar Y = this->owner().mcCarrierThermo().Y()[i][cellI];
Winv += Y/this->owner().mcCarrierThermo().speciesData()[i].W();
Xc[i] = Y/this->owner().mcCarrierThermo().speciesData()[i].W();
}
return Xc/Winv;
@ -104,7 +104,7 @@ Foam::LiquidEvaporation<CloudType>::LiquidEvaporation
owner.composition().globalCarrierId(activeLiquids_[i]);
}
// Determine mapping between local and global liquids
// Determine mapping between model active liquids and global liquids
label idLiquid = owner.composition().idLiquid();
forAll(activeLiquids_, i)
{
@ -153,8 +153,8 @@ void Foam::LiquidEvaporation<CloudType>::calculate
// Reynolds number
scalar Re = mag(Ur)*d/(nuc + ROOTVSMALL);
// film temperature evaluated using the particle temperature
scalar Tf = T;
// film temperature evaluated using the 2/3 rule
scalar Tf = (2.0*T + Tc)/3.0;
// calculate mass transfer of each specie in liquid
forAll(activeLiquids_, i)
@ -162,12 +162,13 @@ void Foam::LiquidEvaporation<CloudType>::calculate
label gid = liqToCarrierMap_[i];
label lid = liqToLiqMap_[i];
// vapour diffusivity [m2/s]
// vapour diffusivity at film temperature and cell pressure [m2/s]
scalar Dab = liquids_->properties()[lid].D(pc, Tf);
// saturation pressure for species i [pa]
// - carrier phase pressure assumed equal to the liquid vapour pressure
// close to the surface
// saturation pressure for species i at film temperature and cell
// pressure [pa] - carrier phase pressure assumed equal to the liquid
// vapour pressure close to the surface
// - limited to pc if pSat > pc
scalar pSat = min(liquids_->properties()[lid].pv(pc, Tf), pc);
// Schmidt number
@ -179,11 +180,11 @@ void Foam::LiquidEvaporation<CloudType>::calculate
// mass transfer coefficient [m/s]
scalar kc = Sh*Dab/(d + ROOTVSMALL);
// vapour concentration at droplet surface [kmol/m3]
// vapour concentration at droplet surface at film temperature [kmol/m3]
scalar Cs = pSat/(specie::RR*Tf);
// vapour concentration in bulk gas [kmol/m3]
scalar Cinf = Xc[gid]*pc/(specie::RR*Tc);
// vapour concentration in bulk gas at film temperature [kmol/m3]
scalar Cinf = Xc[gid]*pc/(specie::RR*Tf);
// molar flux of vapour [kmol/m2/s]
scalar Ni = max(kc*(Cs - Cinf), 0.0);

View File

@ -10,7 +10,7 @@ wmake libso solids
wmake libso solidMixture
wmake libso basic
wmake libso combustion
wmake libso reactionThermo
wmake libso laminarFlameSpeed
wmake libso chemistryModel
wmake libso pdfs

View File

@ -1,13 +1,16 @@
basicMixture = mixtures/basicMixture
basicThermo = basicThermo
mixtures/basicMixture/basicMixture.C
mixtures/basicMixture/basicMixtures.C
$(basicMixture)/basicMixture.C
$(basicMixture)/basicMixtures.C
$(basicThermo)/basicThermo.C
$(basicThermo)/newBasicThermo.C
basicThermo/basicThermo.C
hThermo/hThermos.C
eThermo/eThermos.C
psiThermo/basicPsiThermo/basicPsiThermo.C
psiThermo/basicPsiThermo/newBasicPsiThermo.C
psiThermo/hPsiThermo/hPsiThermos.C
psiThermo/ePsiThermo/ePsiThermos.C
rhoThermo/basicRhoThermo/basicRhoThermo.C
rhoThermo/basicRhoThermo/newBasicRhoThermo.C
rhoThermo/hRhoThermo/hRhoThermos.C
derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.C
derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C

View File

@ -35,20 +35,16 @@ License
#include "gradientInternalEnergyFvPatchScalarField.H"
#include "mixedInternalEnergyFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
defineTypeNameAndDebug(basicThermo, 0);
defineRunTimeSelectionTable(basicThermo, fvMesh);
defineTypeNameAndDebug(basicThermo, 0);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
wordList basicThermo::hBoundaryTypes()
Foam::wordList Foam::basicThermo::hBoundaryTypes()
{
const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
@ -77,7 +73,8 @@ wordList basicThermo::hBoundaryTypes()
return hbt;
}
void basicThermo::hBoundaryCorrection(volScalarField& h)
void Foam::basicThermo::hBoundaryCorrection(volScalarField& h)
{
volScalarField::GeometricBoundaryField& hbf = h.boundaryField();
@ -96,7 +93,8 @@ void basicThermo::hBoundaryCorrection(volScalarField& h)
}
}
wordList basicThermo::eBoundaryTypes()
Foam::wordList Foam::basicThermo::eBoundaryTypes()
{
const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
@ -125,7 +123,8 @@ wordList basicThermo::eBoundaryTypes()
return ebt;
}
void basicThermo::eBoundaryCorrection(volScalarField& e)
void Foam::basicThermo::eBoundaryCorrection(volScalarField& e)
{
volScalarField::GeometricBoundaryField& ebf = e.boundaryField();
@ -146,7 +145,7 @@ void basicThermo::eBoundaryCorrection(volScalarField& e)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
basicThermo::basicThermo(const fvMesh& mesh)
Foam::basicThermo::basicThermo(const fvMesh& mesh)
:
IOdictionary
(
@ -173,19 +172,6 @@ basicThermo::basicThermo(const fvMesh& mesh)
mesh
),
T_
(
IOobject
(
"T",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
),
psi_
(
IOobject
@ -200,6 +186,19 @@ basicThermo::basicThermo(const fvMesh& mesh)
dimensionSet(0, -2, 2, 0, 0)
),
T_
(
IOobject
(
"T",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
),
mu_
(
IOobject
@ -232,20 +231,184 @@ basicThermo::basicThermo(const fvMesh& mesh)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
basicThermo::~basicThermo()
Foam::basicThermo::~basicThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool basicThermo::read()
Foam::volScalarField& Foam::basicThermo::p()
{
return p_;
}
const Foam::volScalarField& Foam::basicThermo::p() const
{
return p_;
}
const Foam::volScalarField& Foam::basicThermo::psi() const
{
return psi_;
}
Foam::volScalarField& Foam::basicThermo::h()
{
notImplemented("basicThermo::h()");
return const_cast<volScalarField&>(volScalarField::null());
}
const Foam::volScalarField& Foam::basicThermo::h() const
{
notImplemented("basicThermo::h() const");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::h
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::h"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::h
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::h"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
Foam::volScalarField& Foam::basicThermo::e()
{
notImplemented("basicThermo::e()");
return const_cast<volScalarField&>(volScalarField::null());
}
const Foam::volScalarField& Foam::basicThermo::e() const
{
notImplemented("basicThermo::e()");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::e
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::e
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
const Foam::volScalarField& Foam::basicThermo::T() const
{
return T_;
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::Cp
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::Cp"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::volScalarField> Foam::basicThermo::Cp() const
{
notImplemented("basicThermo::Cp() const");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::Cv
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::Cv"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::volScalarField> Foam::basicThermo::Cv() const
{
notImplemented("basicThermo::Cv() const");
return volScalarField::null();
}
const Foam::volScalarField& Foam::basicThermo::mu() const
{
return mu_;
}
const Foam::volScalarField& Foam::basicThermo::alpha() const
{
return alpha_;
}
bool Foam::basicThermo::read()
{
return regIOobject::read();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -41,7 +41,6 @@ SourceFiles
#include "typeInfo.H"
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,7 +48,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicThermo Declaration
Class basicThermo Declaration
\*---------------------------------------------------------------------------*/
class basicThermo
@ -61,21 +60,45 @@ protected:
// Protected data
volScalarField p_;
volScalarField T_;
volScalarField psi_;
// Fields
volScalarField mu_;
volScalarField alpha_;
//- Pressure [Pa]
volScalarField p_;
//- Compressibility [s^2/m^2]
volScalarField psi_;
//- Temperature [K]
volScalarField T_;
//- Laminar dynamic viscosity [kg/m/s]
volScalarField mu_;
//- Laminar thermal diffusuvity [kg/m/s]
volScalarField alpha_;
// Protected member functions
wordList hBoundaryTypes();
void hBoundaryCorrection(volScalarField& h);
// Enthalpy
//- Return the enthalpy field boundary types by interrogating the
// temperature field boundary types
wordList hBoundaryTypes();
//- Correct the enthalpy field boundaries
void hBoundaryCorrection(volScalarField& h);
// Internal energy
//- Return the internal energy field boundary types by
// interrogating the temperature field boundary types
wordList eBoundaryTypes();
//- Correct the internal energy field boundaries
void eBoundaryCorrection(volScalarField& e);
wordList eBoundaryTypes();
void eBoundaryCorrection(volScalarField& e);
//- Construct as copy (not implemented)
basicThermo(const basicThermo&);
@ -87,29 +110,12 @@ public:
TypeName("basicThermo");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
basicThermo,
fvMesh,
(const fvMesh& mesh),
(mesh)
);
// Constructors
//- Construct from mesh
basicThermo(const fvMesh&);
// Selectors
static autoPtr<basicThermo> New(const fvMesh&);
//- Destructor
virtual ~basicThermo();
@ -120,193 +126,101 @@ public:
virtual void correct() = 0;
// Access to thermodynamic state variables.
// Access to thermodynamic state variables
//- Pressure [Pa]
// Non-const access allowed for transport equations
virtual volScalarField& p()
{
return p_;
}
virtual volScalarField& p();
//- Pressure [Pa]
virtual const volScalarField& p() const
{
return p_;
}
virtual const volScalarField& p() const;
//- Density [kg/m^3]
virtual tmp<volScalarField> rho() const = 0;
//- Compressibility [s^2/m^2]
virtual const volScalarField& psi() const;
//- Enthalpy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& h()
{
notImplemented("basicThermo::h()");
return const_cast<volScalarField&>(volScalarField::null());
}
virtual volScalarField& h();
//- Enthalpy [J/kg]
virtual const volScalarField& h() const
{
notImplemented("basicThermo::h() const");
return volScalarField::null();
}
virtual const volScalarField& h() const;
//- Enthalpy for cell-set [J/kg]
virtual tmp<scalarField> h
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::h"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
) const;
//- Enthalpy for patch [J/kg]
virtual tmp<scalarField> h
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::h"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
) const;
//- Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& e()
{
notImplemented("basicThermo::e()");
return const_cast<volScalarField&>(volScalarField::null());
}
virtual volScalarField& e();
//- Internal energy [J/kg]
virtual const volScalarField& e() const
{
notImplemented("basicThermo::e()");
return volScalarField::null();
}
virtual const volScalarField& e() const;
//- Internal energy for cell-set [J/kg]
virtual tmp<scalarField> e
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
) const;
//-Internal energy for patch [J/kg]
virtual tmp<scalarField> e
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
) const;
// Fields derived from thermodynamic state variables
//- Temperature [K]
virtual const volScalarField& T() const
{
return T_;
}
//- Density [kg/m^3]
virtual tmp<volScalarField> rho() const
{
return p_*psi();
}
//- Compressibility [s^2/m^2]
virtual const volScalarField& psi() const
{
return psi_;
}
virtual const volScalarField& T() const;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::Cp"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
) const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const
{
notImplemented("basicThermo::Cp() const");
return volScalarField::null();
}
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
{
notImplemented
(
"basicThermo::Cv"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
) const;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const
{
notImplemented("basicThermo::Cv() const");
return volScalarField::null();
}
virtual tmp<volScalarField> Cv() const;
// Access to transport state variables
//- Dynamic viscosity of mixture [kg/ms]
virtual const volScalarField& mu() const
{
return mu_;
}
//- Dynamic viscosity of mixture [kg/m/s]
virtual const volScalarField& mu() const;
//- Thermal diffusivity for enthalpy of mixture [kg/ms]
virtual const volScalarField& alpha() const
{
return alpha_;
}
//- Thermal diffusivity for enthalpy of mixture [kg/m/s]
virtual const volScalarField& alpha() const;
//- Read thermophysicalProperties dictionary
virtual bool read() = 0;
virtual bool read();
};

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "error.H"

View File

@ -47,7 +47,7 @@ class fvMesh;
class dictionary;
/*---------------------------------------------------------------------------*\
Class basicMixture Declaration
Class basicMixture Declaration
\*---------------------------------------------------------------------------*/
class basicMixture
@ -65,9 +65,8 @@ public:
basicMixture(const dictionary&, const fvMesh&);
// Destructor
virtual ~basicMixture();
//- Destructor
virtual ~basicMixture();
};

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Selection function for internal energy based thermodynamics package.
Mixture instantiation
\*---------------------------------------------------------------------------*/

View File

@ -24,40 +24,29 @@ License
\*---------------------------------------------------------------------------*/
#include "zeroGradientFvPatchFields.H"
#include "basicPsiThermo.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline Foam::tmp<Foam::volScalarField> Foam::chemistryModel::RR
(
const label i
) const
namespace Foam
{
tmp<volScalarField> tRR
(
new volScalarField
(
IOobject
(
"RR(" + Y_[i].name() + ')',
rho_.time().timeName(),
rho_.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho_.mesh(),
dimensionedScalar("zero", dimensionSet(1, -3, -1, 0, 0), 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (chemistry_)
{
tRR().internalField() = RR_[i];
tRR().correctBoundaryConditions();
}
return tRR;
defineTypeNameAndDebug(basicPsiThermo, 0);
defineRunTimeSelectionTable(basicPsiThermo, fvMesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicPsiThermo::basicPsiThermo(const fvMesh& mesh)
:
basicThermo(mesh)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::basicPsiThermo::~basicPsiThermo()
{}
// ************************************************************************* //

View File

@ -0,0 +1,114 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::basicPsiThermo
Description
Basic thermodynamic properties based on compressibility
SourceFiles
basicPsiThermo.C
newBasicPsiThermo.C
\*---------------------------------------------------------------------------*/
#ifndef basicPsiThermo_H
#define basicPsiThermo_H
#include "basicThermo.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicPsiThermo Declaration
\*---------------------------------------------------------------------------*/
class basicPsiThermo
:
public basicThermo
{
protected:
// Protected member functions
//- Construct as copy (not implemented)
basicPsiThermo(const basicPsiThermo&);
public:
//- Runtime type information
TypeName("basicPsiThermo");
//- Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
basicPsiThermo,
fvMesh,
(const fvMesh& mesh),
(mesh)
);
// Constructors
//- Construct from mesh
basicPsiThermo(const fvMesh&);
//- Selector
static autoPtr<basicPsiThermo> New(const fvMesh&);
//- Destructor
virtual ~basicPsiThermo();
// Member functions
// Fields derived from thermodynamic state variables
//- Density [kg/m^3] - uses current value of pressure
virtual tmp<volScalarField> rho() const
{
return p_*psi();
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -23,39 +23,38 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::hCombustionThermo
Foam::basicPsiThermo
Description
Macros for creating 'basic' compresibility-based thermo packages
\*---------------------------------------------------------------------------*/
#ifndef makeCombustionThermo_H
#define makeCombustionThermo_H
#ifndef makeBasicPsiThermo_H
#define makeBasicPsiThermo_H
#include "basicPsiThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeCombustionThermo(CThermo,MixtureThermo,Mixture,Transport,Thermo,EqnOfState) \
#define makeBasicPsiThermo(Cthermo,Mixture,Transport,Thermo,EqnOfState) \
\
typedef MixtureThermo \
<Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState; \
typedef Cthermo<Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \
Cthermo##Mixture##Transport##Thermo##EqnOfState; \
\
defineTemplateTypeNameAndDebugWithName \
(MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
#MixtureThermo \
"<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", 0); \
\
addToRunTimeSelectionTable \
( \
basicThermo, \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
#Cthermo \
"<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
CThermo, \
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
basicPsiThermo, \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
)

View File

@ -24,19 +24,16 @@ License
\*---------------------------------------------------------------------------*/
#include "hCombustionThermo.H"
#include "fvMesh.H"
#include "basicPsiThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
Foam::autoPtr<Foam::basicPsiThermo> Foam::basicPsiThermo::New
(
const fvMesh& mesh
)
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
autoPtr<hCombustionThermo> hCombustionThermo::New(const fvMesh& mesh)
{
word hCombustionThermoTypeName;
word thermoTypeName;
// Enclose the creation of the thermophysicalProperties to ensure it is
// deleted before the turbulenceModel is created otherwise the dictionary
@ -54,31 +51,25 @@ autoPtr<hCombustionThermo> hCombustionThermo::New(const fvMesh& mesh)
)
);
thermoDict.lookup("thermoType") >> hCombustionThermoTypeName;
thermoDict.lookup("thermoType") >> thermoTypeName;
}
Info<< "Selecting thermodynamics package "
<< hCombustionThermoTypeName << endl;
Info<< "Selecting thermodynamics package " << thermoTypeName << endl;
fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(hCombustionThermoTypeName);
fvMeshConstructorTablePtr_->find(thermoTypeName);
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn("hCombustionThermo::New(const fvMesh&)")
<< "Unknown hCombustionThermo type "
<< hCombustionThermoTypeName << endl << endl
<< "Valid hCombustionThermo types are :" << endl
<< fvMeshConstructorTablePtr_->toc()
FatalErrorIn("basicPsiThermo::New(const fvMesh&)")
<< "Unknown basicPsiThermo type " << thermoTypeName << nl << nl
<< "Valid basicPsiThermo types are:" << nl
<< fvMeshConstructorTablePtr_->toc() << nl
<< exit(FatalError);
}
return autoPtr<hCombustionThermo>(cstrIter()(mesh));
return autoPtr<basicPsiThermo>(cstrIter()(mesh));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -24,72 +24,22 @@ License
\*---------------------------------------------------------------------------*/
#include "eThermo.H"
#include "ePsiThermo.H"
#include "fvMesh.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::eThermo<MixtureType>::eThermo(const fvMesh& mesh)
:
basicThermo(mesh),
MixtureType(*this, mesh),
e_
(
IOobject
(
"e",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionSet(0, 2, -2, 0, 0),
eBoundaryTypes()
)
{
scalarField& eCells = e_.internalField();
const scalarField& TCells = T_.internalField();
forAll(eCells, celli)
{
eCells[celli] = this->cellMixture(celli).E(TCells[celli]);
}
forAll(e_.boundaryField(), patchi)
{
e_.boundaryField()[patchi] == e(T_.boundaryField()[patchi], patchi);
}
eBoundaryCorrection(e_);
calculate();
psi_.oldTime(); // Switch on saving old time
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::eThermo<MixtureType>::~eThermo()
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::eThermo<MixtureType>::calculate()
void Foam::ePsiThermo<MixtureType>::calculate()
{
const scalarField& eCells = e_.internalField();
const scalarField& pCells = p_.internalField();
const scalarField& pCells = this->p_.internalField();
scalarField& TCells = T_.internalField();
scalarField& psiCells = psi_.internalField();
scalarField& muCells = mu_.internalField();
scalarField& alphaCells = alpha_.internalField();
scalarField& TCells = this->T_.internalField();
scalarField& psiCells = this->psi_.internalField();
scalarField& muCells = this->mu_.internalField();
scalarField& alphaCells = this->alpha_.internalField();
forAll(TCells, celli)
{
@ -103,16 +53,16 @@ void Foam::eThermo<MixtureType>::calculate()
alphaCells[celli] = mixture_.alpha(TCells[celli]);
}
forAll(T_.boundaryField(), patchi)
forAll(this->T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = p_.boundaryField()[patchi];
fvPatchScalarField& pT = T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = psi_.boundaryField()[patchi];
fvPatchScalarField& pp = this->p_.boundaryField()[patchi];
fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi];
fvPatchScalarField& pe = e_.boundaryField()[patchi];
fvPatchScalarField& pmu = mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = alpha_.boundaryField()[patchi];
fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi];
if (pT.fixesValue())
{
@ -146,30 +96,83 @@ void Foam::eThermo<MixtureType>::calculate()
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::ePsiThermo<MixtureType>::ePsiThermo(const fvMesh& mesh)
:
basicPsiThermo(mesh),
MixtureType(*this, mesh),
e_
(
IOobject
(
"e",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionSet(0, 2, -2, 0, 0),
this->eBoundaryTypes()
)
{
scalarField& eCells = e_.internalField();
const scalarField& TCells = this->T_.internalField();
forAll(eCells, celli)
{
eCells[celli] = this->cellMixture(celli).E(TCells[celli]);
}
forAll(e_.boundaryField(), patchi)
{
e_.boundaryField()[patchi] ==
e(this->T_.boundaryField()[patchi], patchi);
}
this->eBoundaryCorrection(e_);
calculate();
// Switch on saving old time
this->psi_.oldTime();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::ePsiThermo<MixtureType>::~ePsiThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::eThermo<MixtureType>::correct()
void Foam::ePsiThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering eThermo<MixtureType>::correct()" << endl;
Info<< "entering ePsiThermo<MixtureType>::correct()" << endl;
}
// force the saving of the old-time values
psi_.oldTime();
this->psi_.oldTime();
calculate();
if (debug)
{
Info<< "exiting eThermo<MixtureType>::correct()" << endl;
Info<< "exiting ePsiThermo<MixtureType>::correct()" << endl;
}
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::eThermo<MixtureType>::e
Foam::tmp<Foam::scalarField> Foam::ePsiThermo<MixtureType>::e
(
const scalarField& T,
const labelList& cells
@ -188,7 +191,7 @@ Foam::tmp<Foam::scalarField> Foam::eThermo<MixtureType>::e
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::eThermo<MixtureType>::e
Foam::tmp<Foam::scalarField> Foam::ePsiThermo<MixtureType>::e
(
const scalarField& T,
const label patchi
@ -205,8 +208,9 @@ Foam::tmp<Foam::scalarField> Foam::eThermo<MixtureType>::e
return te;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::eThermo<MixtureType>::Cp
Foam::tmp<Foam::scalarField> Foam::ePsiThermo<MixtureType>::Cp
(
const scalarField& T,
const label patchi
@ -223,10 +227,11 @@ Foam::tmp<Foam::scalarField> Foam::eThermo<MixtureType>::Cp
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::eThermo<MixtureType>::Cp() const
Foam::tmp<Foam::volScalarField> Foam::ePsiThermo<MixtureType>::Cp() const
{
const fvMesh& mesh = T_.mesh();
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCp
(
@ -242,20 +247,20 @@ Foam::tmp<Foam::volScalarField> Foam::eThermo<MixtureType>::Cp() const
),
mesh,
dimensionSet(0, 2, -2, -1, 0),
T_.boundaryField().types()
this->T_.boundaryField().types()
)
);
volScalarField& cp = tCp();
forAll(T_, celli)
forAll(this->T_, celli)
{
cp[celli] = this->cellMixture(celli).Cp(T_[celli]);
cp[celli] = this->cellMixture(celli).Cp(this->T_[celli]);
}
forAll(T_.boundaryField(), patchi)
forAll(this->T_.boundaryField(), patchi)
{
const fvPatchScalarField& pT = T_.boundaryField()[patchi];
const fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& pCp = cp.boundaryField()[patchi];
forAll(pT, facei)
@ -269,7 +274,7 @@ Foam::tmp<Foam::volScalarField> Foam::eThermo<MixtureType>::Cp() const
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::eThermo<MixtureType>::Cv
Foam::tmp<Foam::scalarField> Foam::ePsiThermo<MixtureType>::Cv
(
const scalarField& T,
const label patchi
@ -288,9 +293,9 @@ Foam::tmp<Foam::scalarField> Foam::eThermo<MixtureType>::Cv
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::eThermo<MixtureType>::Cv() const
Foam::tmp<Foam::volScalarField> Foam::ePsiThermo<MixtureType>::Cv() const
{
const fvMesh& mesh = T_.mesh();
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCv
(
@ -311,14 +316,15 @@ Foam::tmp<Foam::volScalarField> Foam::eThermo<MixtureType>::Cv() const
volScalarField& cv = tCv();
forAll(T_, celli)
forAll(this->T_, celli)
{
cv[celli] = this->cellMixture(celli).Cv(T_[celli]);
cv[celli] = this->cellMixture(celli).Cv(this->T_[celli]);
}
forAll(T_.boundaryField(), patchi)
forAll(this->T_.boundaryField(), patchi)
{
cv.boundaryField()[patchi] = Cv(T_.boundaryField()[patchi], patchi);
cv.boundaryField()[patchi] =
Cv(this->T_.boundaryField()[patchi], patchi);
}
return tCv;
@ -326,9 +332,9 @@ Foam::tmp<Foam::volScalarField> Foam::eThermo<MixtureType>::Cv() const
template<class MixtureType>
bool Foam::eThermo<MixtureType>::read()
bool Foam::ePsiThermo<MixtureType>::read()
{
if (basicThermo::read())
if (basicPsiThermo::read())
{
MixtureType::read(*this);
return true;

View File

@ -23,20 +23,20 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::eThermo
Foam::ePsiThermo
Description
Internal energy for a mixture
Internal energy for a mixture based on compressibility
SourceFiles
eThermo.C
ePsiThermo.C
\*---------------------------------------------------------------------------*/
#ifndef eThermo_H
#define eThermo_H
#ifndef ePsiThermo_H
#define ePsiThermo_H
#include "basicThermo.H"
#include "basicPsiThermo.H"
#include "basicMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,42 +45,44 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class eThermo Declaration
Class ePsiThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class eThermo
class ePsiThermo
:
public basicThermo,
public basicPsiThermo,
public MixtureType
{
// Private data
//- Internal energy field
volScalarField e_;
// Private member functions
//- Calculate the thermo variables
void calculate();
//- Construct as copy (not implemented)
eThermo(const eThermo<MixtureType>&);
ePsiThermo(const ePsiThermo<MixtureType>&);
public:
//- Runtime type information
TypeName("eThermo");
TypeName("ePsiThermo");
// Constructors
//- Construct from mese
eThermo(const fvMesh&);
ePsiThermo(const fvMesh&);
//- Destructor
virtual ~eThermo();
virtual ~ePsiThermo();
// Member functions
@ -166,7 +168,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "eThermo.C"
# include "ePsiThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -22,15 +22,9 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Selection function for internal energy based thermodynamics package.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "basicThermo.H"
#include "makeBasicThermo.H"
#include "makeBasicPsiThermo.H"
#include "perfectGas.H"
@ -41,11 +35,9 @@ Description
#include "constTransport.H"
#include "sutherlandTransport.H"
#include "hThermo.H"
#include "ePsiThermo.H"
#include "pureMixture.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -53,34 +45,34 @@ namespace Foam
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
makeBasicThermo
makeBasicPsiThermo
(
hThermo,
ePsiThermo,
pureMixture,
constTransport,
hConstThermo,
perfectGas
);
makeBasicThermo
makeBasicPsiThermo
(
hThermo,
ePsiThermo,
pureMixture,
sutherlandTransport,
hConstThermo,
perfectGas
);
makeBasicThermo
makeBasicPsiThermo
(
hThermo,
ePsiThermo,
pureMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -24,72 +24,20 @@ License
\*---------------------------------------------------------------------------*/
#include "hThermo.H"
#include "fvMesh.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hThermo<MixtureType>::hThermo(const fvMesh& mesh)
:
basicThermo(mesh),
MixtureType(*this, mesh),
h_
(
IOobject
(
"h",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionSet(0, 2, -2, 0, 0),
hBoundaryTypes()
)
{
scalarField& hCells = h_.internalField();
const scalarField& TCells = T_.internalField();
forAll(hCells, celli)
{
hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
}
forAll(h_.boundaryField(), patchi)
{
h_.boundaryField()[patchi] == h(T_.boundaryField()[patchi], patchi);
}
hBoundaryCorrection(h_);
calculate();
psi_.oldTime(); // Switch on saving old time
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hThermo<MixtureType>::~hThermo()
{}
#include "hPsiThermo.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::hThermo<MixtureType>::calculate()
void Foam::hPsiThermo<MixtureType>::calculate()
{
const scalarField& hCells = h_.internalField();
const scalarField& pCells = p_.internalField();
const scalarField& pCells = this->p_.internalField();
scalarField& TCells = T_.internalField();
scalarField& psiCells = psi_.internalField();
scalarField& muCells = mu_.internalField();
scalarField& alphaCells = alpha_.internalField();
scalarField& TCells = this->T_.internalField();
scalarField& psiCells = this->psi_.internalField();
scalarField& muCells = this->mu_.internalField();
scalarField& alphaCells = this->alpha_.internalField();
forAll(TCells, celli)
{
@ -105,14 +53,14 @@ void Foam::hThermo<MixtureType>::calculate()
forAll(T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = p_.boundaryField()[patchi];
fvPatchScalarField& pT = T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = psi_.boundaryField()[patchi];
fvPatchScalarField& pp = this->p_.boundaryField()[patchi];
fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = this->psi_.boundaryField()[patchi];
fvPatchScalarField& ph = h_.boundaryField()[patchi];
fvPatchScalarField& pmu = mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = alpha_.boundaryField()[patchi];
fvPatchScalarField& pmu = this->mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = this->alpha_.boundaryField()[patchi];
if (pT.fixesValue())
{
@ -146,30 +94,83 @@ void Foam::hThermo<MixtureType>::calculate()
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hPsiThermo<MixtureType>::hPsiThermo(const fvMesh& mesh)
:
basicPsiThermo(mesh),
MixtureType(*this, mesh),
h_
(
IOobject
(
"h",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionSet(0, 2, -2, 0, 0),
this->hBoundaryTypes()
)
{
scalarField& hCells = h_.internalField();
const scalarField& TCells = this->T_.internalField();
forAll(hCells, celli)
{
hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
}
forAll(h_.boundaryField(), patchi)
{
h_.boundaryField()[patchi] ==
h(this->T_.boundaryField()[patchi], patchi);
}
hBoundaryCorrection(h_);
calculate();
// Switch on saving old time
this->psi_.oldTime();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::hPsiThermo<MixtureType>::~hPsiThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::hThermo<MixtureType>::correct()
void Foam::hPsiThermo<MixtureType>::correct()
{
if (debug)
{
Info<< "entering hThermo<MixtureType>::correct()" << endl;
Info<< "entering hPsiThermo<MixtureType>::correct()" << endl;
}
// force the saving of the old-time values
psi_.oldTime();
this->psi_.oldTime();
calculate();
if (debug)
{
Info<< "exiting hThermo<MixtureType>::correct()" << endl;
Info<< "exiting hPsiThermo<MixtureType>::correct()" << endl;
}
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::h
Foam::tmp<Foam::scalarField> Foam::hPsiThermo<MixtureType>::h
(
const scalarField& T,
const labelList& cells
@ -188,7 +189,7 @@ Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::h
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::h
Foam::tmp<Foam::scalarField> Foam::hPsiThermo<MixtureType>::h
(
const scalarField& T,
const label patchi
@ -205,8 +206,9 @@ Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::h
return th;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::Cp
Foam::tmp<Foam::scalarField> Foam::hPsiThermo<MixtureType>::Cp
(
const scalarField& T,
const label patchi
@ -223,10 +225,11 @@ Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::Cp
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cp() const
Foam::tmp<Foam::volScalarField> Foam::hPsiThermo<MixtureType>::Cp() const
{
const fvMesh& mesh = T_.mesh();
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCp
(
@ -242,20 +245,20 @@ Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cp() const
),
mesh,
dimensionSet(0, 2, -2, -1, 0),
T_.boundaryField().types()
this->T_.boundaryField().types()
)
);
volScalarField& cp = tCp();
forAll(T_, celli)
forAll(this->T_, celli)
{
cp[celli] = this->cellMixture(celli).Cp(T_[celli]);
cp[celli] = this->cellMixture(celli).Cp(this->T_[celli]);
}
forAll(T_.boundaryField(), patchi)
forAll(this->T_.boundaryField(), patchi)
{
const fvPatchScalarField& pT = T_.boundaryField()[patchi];
const fvPatchScalarField& pT = this->T_.boundaryField()[patchi];
fvPatchScalarField& pCp = cp.boundaryField()[patchi];
forAll(pT, facei)
@ -269,7 +272,7 @@ Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cp() const
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::Cv
Foam::tmp<Foam::scalarField> Foam::hPsiThermo<MixtureType>::Cv
(
const scalarField& T,
const label patchi
@ -288,9 +291,9 @@ Foam::tmp<Foam::scalarField> Foam::hThermo<MixtureType>::Cv
template<class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cv() const
Foam::tmp<Foam::volScalarField> Foam::hPsiThermo<MixtureType>::Cv() const
{
const fvMesh& mesh = T_.mesh();
const fvMesh& mesh = this->T_.mesh();
tmp<volScalarField> tCv
(
@ -311,23 +314,25 @@ Foam::tmp<Foam::volScalarField> Foam::hThermo<MixtureType>::Cv() const
volScalarField& cv = tCv();
forAll(T_, celli)
forAll(this->T_, celli)
{
cv[celli] = this->cellMixture(celli).Cv(T_[celli]);
cv[celli] = this->cellMixture(celli).Cv(this->T_[celli]);
}
forAll(T_.boundaryField(), patchi)
forAll(this->T_.boundaryField(), patchi)
{
cv.boundaryField()[patchi] = Cv(T_.boundaryField()[patchi], patchi);
cv.boundaryField()[patchi] =
Cv(this->T_.boundaryField()[patchi], patchi);
}
return tCv;
}
template<class MixtureType>
bool Foam::hThermo<MixtureType>::read()
bool Foam::hPsiThermo<MixtureType>::read()
{
if (basicThermo::read())
if (basicPsiThermo::read())
{
MixtureType::read(*this);
return true;

View File

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

View File

@ -22,15 +22,9 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Selection function for internal energy based thermodynamics package.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "basicThermo.H"
#include "makeBasicThermo.H"
#include "makeBasicPsiThermo.H"
#include "perfectGas.H"
@ -41,11 +35,9 @@ Description
#include "constTransport.H"
#include "sutherlandTransport.H"
#include "hThermo.H"
#include "hPsiThermo.H"
#include "pureMixture.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -53,27 +45,27 @@ namespace Foam
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
makeBasicThermo
makeBasicPsiThermo
(
hThermo,
hPsiThermo,
pureMixture,
constTransport,
hConstThermo,
perfectGas
);
makeBasicThermo
makeBasicPsiThermo
(
hThermo,
hPsiThermo,
pureMixture,
sutherlandTransport,
hConstThermo,
perfectGas
);
makeBasicThermo
makeBasicPsiThermo
(
hThermo,
hPsiThermo,
pureMixture,
sutherlandTransport,
janafThermo,

View File

@ -0,0 +1,5 @@
[Dolphin]
AdditionalInfo=3
SortOrder=0
Timestamp=2009,6,10,15,58,20
ViewMode=1

View File

@ -0,0 +1,79 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "basicRhoThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(basicRhoThermo, 0);
defineRunTimeSelectionTable(basicRhoThermo, fvMesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicRhoThermo::basicRhoThermo(const fvMesh& mesh)
:
basicThermo(mesh),
rho_
(
IOobject
(
"rhoThermo",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimDensity
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::basicRhoThermo::~basicRhoThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::basicRhoThermo::rho() const
{
return rho_;
}
Foam::volScalarField& Foam::basicRhoThermo::rho()
{
return rho_;
}
// ************************************************************************* //

View File

@ -0,0 +1,123 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::basicRhoThermo
Description
Basic thermodynamic properties based on density
SourceFiles
basicRhoThermo.C
newBasicRhoThermo.C
\*---------------------------------------------------------------------------*/
#ifndef basicRhoThermo_H
#define basicRhoThermo_H
#include "basicThermo.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicRhoThermo Declaration
\*---------------------------------------------------------------------------*/
class basicRhoThermo
:
public basicThermo
{
protected:
// Protected data
//- Density field [kg/m^3]
// Named 'rhoThermo' to avoid (potential) conflict with solver density
volScalarField rho_;
// Protected member functions
//- Construct as copy (not implemented)
basicRhoThermo(const basicRhoThermo&);
public:
//- Runtime type information
TypeName("basicRhoThermo");
//- Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
basicRhoThermo,
fvMesh,
(const fvMesh& mesh),
(mesh)
);
// Constructors
//- Construct from mesh
basicRhoThermo(const fvMesh&);
//- Selector
static autoPtr<basicRhoThermo> New(const fvMesh&);
//- Destructor
virtual ~basicRhoThermo();
// Member functions
// Fields derived from thermodynamic state variables
//- Density [kg/m^3]
virtual tmp<volScalarField> rho() const;
//- Return non-const access to the local density field [kg/m^3]
virtual volScalarField& rho();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -23,36 +23,42 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::basicThermo
Foam::basicRhoThermo
Description
Macros for creating 'basic' density-based thermo packages
\*---------------------------------------------------------------------------*/
#ifndef makeBasicThermo_H
#define makeBasicThermo_H
#ifndef makeBasicRhoThermo_H
#define makeBasicRhoThermo_H
#include "basicThermo.H"
#include "basicRhoThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeBasicThermo(Cthermo,Mixture,Transport,Thermo,EqnOfState) \
#define makeBasicRhoThermo(Cthermo,Mixture,Transport,Thermo,EqnOfState) \
\
typedef Cthermo<Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \
Cthermo##Mixture##Transport##Thermo##EqnOfState; \
\
defineTemplateTypeNameAndDebugWithName \
(Cthermo##Mixture##Transport##Thermo##EqnOfState, \
( \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
#Cthermo \
"<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", 0); \
"<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
basicThermo, \
basicRhoThermo, \
Cthermo##Mixture##Transport##Thermo##EqnOfState, \
fvMesh \
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -23,23 +23,20 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Selection function for internal energy based thermodynamics package.
Selection function for 'basic' density-based thermodynamics
\*---------------------------------------------------------------------------*/
#include "basicThermo.H"
#include "fvMesh.H"
#include "basicRhoThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
Foam::autoPtr<Foam::basicRhoThermo> Foam::basicRhoThermo::New
(
const fvMesh& mesh
)
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
autoPtr<basicThermo> basicThermo::New(const fvMesh& mesh)
{
word basicThermoTypeName;
word thermoTypeName;
// Enclose the creation of the thermophysicalProperties to ensure it is
// deleted before the turbulenceModel is created otherwise the dictionary
@ -57,30 +54,25 @@ autoPtr<basicThermo> basicThermo::New(const fvMesh& mesh)
)
);
thermoDict.lookup("thermoType") >> basicThermoTypeName;
thermoDict.lookup("thermoType") >> thermoTypeName;
}
Info<< "Selecting thermodynamics package " << basicThermoTypeName << endl;
Info<< "Selecting thermodynamics package " << thermoTypeName << endl;
fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(basicThermoTypeName);
fvMeshConstructorTablePtr_->find(thermoTypeName);
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
FatalErrorIn("basicThermo::New(const fvMesh&)")
<< "Unknown basicThermo type " << basicThermoTypeName
<< endl << endl
<< "Valid basicThermo types are :" << endl
<< fvMeshConstructorTablePtr_->toc()
FatalErrorIn("basicRhoThermo::New(const fvMesh&)")
<< "Unknown basicRhoThermo type " << thermoTypeName << nl << nl
<< "Valid basicRhoThermo types are:" << nl
<< fvMeshConstructorTablePtr_->toc() << nl
<< exit(FatalError);
}
return autoPtr<basicThermo>(cstrIter()(mesh));
return autoPtr<basicRhoThermo>(cstrIter()(mesh));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

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

View File

@ -23,20 +23,20 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::hThermo
Foam::hPsiThermo
Description
Enthalpy for a mixture
Enthalpy for a mixture based on density
SourceFiles
hThermo.C
hRhoThermo.C
\*---------------------------------------------------------------------------*/
#ifndef hThermo_H
#define hThermo_H
#ifndef hRhoThermo_H
#define hRhoThermo_H
#include "basicThermo.H"
#include "basicRhoThermo.H"
#include "basicMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,42 +45,44 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hThermo Declaration
Class hRhoThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class hThermo
class hRhoThermo
:
public basicThermo,
public basicRhoThermo,
public MixtureType
{
// Private data
//- Enthalpy field
volScalarField h_;
// Private member functions
//- Calculate the thermo variables
void calculate();
//- Construct as copy (not implemented)
hThermo(const hThermo<MixtureType>&);
hRhoThermo(const hRhoThermo<MixtureType>&);
public:
//- Runtime type information
TypeName("hThermo");
TypeName("hRhoThermo");
// Constructors
//- Construct from mesh
hThermo(const fvMesh&);
hRhoThermo(const fvMesh&);
//- Destructor
virtual ~hThermo();
virtual ~hRhoThermo();
// Member functions
@ -166,7 +168,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "hThermo.C"
# include "hRhoThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -22,15 +22,9 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Selection function for internal energy based thermodynamics package.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "basicThermo.H"
#include "makeBasicThermo.H"
#include "makeBasicRhoThermo.H"
#include "perfectGas.H"
@ -41,11 +35,9 @@ Description
#include "constTransport.H"
#include "sutherlandTransport.H"
#include "eThermo.H"
#include "hRhoThermo.H"
#include "pureMixture.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -53,34 +45,34 @@ namespace Foam
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
makeBasicThermo
makeBasicRhoThermo
(
eThermo,
hRhoThermo,
pureMixture,
constTransport,
hConstThermo,
perfectGas
);
makeBasicThermo
makeBasicRhoThermo
(
eThermo,
hRhoThermo,
pureMixture,
sutherlandTransport,
hConstThermo,
perfectGas
);
makeBasicThermo
makeBasicRhoThermo
(
eThermo,
hRhoThermo,
pureMixture,
sutherlandTransport,
janafThermo,
perfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -1,12 +1,13 @@
chemistryModel = chemistryModel
chemistrySolver = chemistrySolver
chemistryModel/basicChemistryModel/basicChemistryModel.C
$(chemistryModel)/chemistryModel.C
chemistryModel/psiChemistryModel/psiChemistryModel.C
chemistryModel/psiChemistryModel/newPsiChemistryModel.C
chemistryModel/psiChemistryModel/psiChemistryModels.C
$(chemistrySolver)/chemistrySolver/chemistrySolver.C
$(chemistrySolver)/chemistrySolver/newChemistrySolver.C
$(chemistrySolver)/sequential/sequential.C
$(chemistrySolver)/EulerImplicit/EulerImplicit.C
$(chemistrySolver)/ode/ode.C
chemistryModel/rhoChemistryModel/rhoChemistryModel.C
chemistryModel/rhoChemistryModel/newRhoChemistryModel.C
chemistryModel/rhoChemistryModel/rhoChemistryModels.C
chemistrySolver/chemistrySolver/makeChemistrySolvers.C
LIB = $(FOAM_LIBBIN)/libchemistryModel

View File

@ -1,15 +1,16 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/functions/Polynomial \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude
LIB_LIBS = \
-lbasicThermophysicalModels \
-lcombustionThermophysicalModels \
-lbasicThermophysicalModels \
-lreactionThermophysicalModels \
-lspecie \
-lthermophysicalFunctions \
-lspecie \
-lODE
-lODE

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) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,96 +24,91 @@ License
\*---------------------------------------------------------------------------*/
#include "chemistryModel.H"
#include "ODEChemistryModel.H"
#include "chemistrySolver.H"
#include "multiComponentMixture.H"
#include "reactingMixture.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::chemistryModel::chemistryModel
template<class CompType, class ThermoType>
Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
(
hCombustionThermo& thermo,
const volScalarField& rho
const fvMesh& mesh,
const word& compTypeName,
const word& thermoTypeName
)
:
thermo_(thermo),
CompType(mesh, thermoTypeName),
Y_(thermo.composition().Y()),
rho_(rho),
ODE(),
chemistryProperties_
Y_(this->thermo().composition().Y()),
reactions_
(
IOobject
(
"chemistryProperties",
rho_.time().constant(),
rho_.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
dynamic_cast<const reactingMixture<ThermoType>&>(this->thermo())
),
specieThermo_
(
dynamic_cast<const reactingMixture<ThermoType>&>
(this->thermo()).speciesData()
),
chemistry_(chemistryProperties_.lookup("chemistry")),
reactions_(dynamic_cast<const reactingMixture&>(thermo)),
specieThermo_(dynamic_cast<const reactingMixture&>(thermo).speciesData()),
Ns_(thermo.composition().Y().size()),
Nr_(reactions_.size()),
nSpecie_(Y_.size()),
nReaction_(reactions_.size()),
solver_
(
chemistrySolver::New
chemistrySolver<CompType, ThermoType>::New
(
chemistryProperties_,
*this
*this,
compTypeName,
thermoTypeName
)
),
deltaTChem_
(
rho_.size(),
readScalar(chemistryProperties_.lookup("initialChemicalTimeStep"))
)
RR_(nSpecie_)
{
// set the size of the chemistry sources
RR_.setSize(Ns());
for(label i=0; i<Ns(); i++)
// create the fields for the chemistry sources
forAll(RR_, fieldI)
{
RR_.set
(
i,
new scalarField(rho_.size(), 0.0)
fieldI,
new scalarField(mesh.nCells(), 0.0)
);
}
Info<< "chemistryModel::chemistryModel: Number of species = " << Ns()
<< " and reactions = " << Nr() << endl;
Info<< "ODEChemistryModel: Number of species = " << nSpecie_
<< " and reactions = " << nReaction_ << endl;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::chemistryModel::~chemistryModel()
template<class CompType, class ThermoType>
Foam::ODEChemistryModel<CompType, ThermoType>::~ODEChemistryModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalarField Foam::chemistryModel::omega
template<class CompType, class ThermoType>
Foam::scalarField Foam::ODEChemistryModel<CompType, ThermoType>::omega
(
const scalarField& c,
const scalar T,
const scalar p
) const
{
scalar pf,cf,pr,cr;
scalar pf, cf, pr, cr;
label lRef, rRef;
scalarField om(nEqns(), 0.0);
forAll(reactions_, i)
{
const reaction& R = reactions_[i];
const Reaction<ThermoType>& R = reactions_[i];
scalar omegai = omega
(
@ -136,12 +131,13 @@ Foam::scalarField Foam::chemistryModel::omega
}
return om;
} // end omega
}
Foam::scalar Foam::chemistryModel::omega
template<class CompType, class ThermoType>
Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::omega
(
const reaction& R,
const Reaction<ThermoType>& R,
const scalarField& c,
const scalar T,
const scalar p,
@ -153,8 +149,8 @@ Foam::scalar Foam::chemistryModel::omega
label& rRef
) const
{
scalarField c2(Ns(), 0.0);
for(label i=0; i<Ns(); i++)
scalarField c2(nSpecie_, 0.0);
for (label i=0; i<nSpecie_; i++)
{
c2[i] = max(0.0, c[i]);
}
@ -172,7 +168,7 @@ Foam::scalar Foam::chemistryModel::omega
lRef = R.lhs()[slRef].index;
pf = kf;
for(label s=1; s<Nl; s++)
for (label s=1; s<Nl; s++)
{
label si = R.lhs()[s].index;
@ -197,7 +193,7 @@ Foam::scalar Foam::chemistryModel::omega
{
if (cf > SMALL)
{
pf *= pow(cf, exp-1.0);
pf *= pow(cf, exp - 1.0);
}
else
{
@ -206,7 +202,7 @@ Foam::scalar Foam::chemistryModel::omega
}
else
{
pf *= pow(cf, exp-1.0);
pf *= pow(cf, exp - 1.0);
}
}
@ -215,7 +211,7 @@ Foam::scalar Foam::chemistryModel::omega
// find the matrix element and element position for the rhs
pr = kr;
for(label s=1; s<Nr; s++)
for (label s=1; s<Nr; s++)
{
label si = R.rhs()[s].index;
if (c[si] < c[rRef])
@ -239,7 +235,7 @@ Foam::scalar Foam::chemistryModel::omega
{
if (cr>SMALL)
{
pr *= pow(cr, exp-1.0);
pr *= pow(cr, exp - 1.0);
}
else
{
@ -248,25 +244,26 @@ Foam::scalar Foam::chemistryModel::omega
}
else
{
pr *= pow(cr, exp-1.0);
pr *= pow(cr, exp - 1.0);
}
}
return pf*cf - pr*cr;
} // end omega
}
void Foam::chemistryModel::derivatives
template<class CompType, class ThermoType>
void Foam::ODEChemistryModel<CompType, ThermoType>::derivatives
(
const scalar time,
const scalarField &c,
scalarField& dcdt
) const
{
scalar T = c[Ns_];
scalar p = c[Ns_ + 1];
scalar T = c[nSpecie_];
scalar p = c[nSpecie_ + 1];
dcdt = omega(c, T, p);
@ -274,7 +271,7 @@ void Foam::chemistryModel::derivatives
// dT/dt = ...
scalar rho = 0.0;
scalar cSum = 0.0;
for(label i=0; i<Ns(); i++)
for (label i=0; i<nSpecie_; i++)
{
scalar W = specieThermo_[i].W();
cSum += c[i];
@ -282,7 +279,7 @@ void Foam::chemistryModel::derivatives
}
scalar mw = rho/cSum;
scalar cp = 0.0;
for(label i=0; i<Ns(); i++)
for (label i=0; i<nSpecie_; i++)
{
scalar cpi = specieThermo_[i].cp(T);
scalar Xi = c[i]/rho;
@ -291,7 +288,7 @@ void Foam::chemistryModel::derivatives
cp /= mw;
scalar dT = 0.0;
for(label i=0; i<Ns(); i++)
for (label i=0; i<nSpecie_; i++)
{
scalar hi = specieThermo_[i].h(T);
dT += hi*dcdt[i];
@ -301,14 +298,15 @@ void Foam::chemistryModel::derivatives
// limit the time-derivative, this is more stable for the ODE
// solver when calculating the allowed time step
scalar dtMag = min(500.0, mag(dT));
dcdt[Ns_] = -dT*dtMag/(mag(dT) + 1.0e-10);
dcdt[nSpecie_] = -dT*dtMag/(mag(dT) + 1.0e-10);
// dp/dt = ...
dcdt[Ns_+1] = 0.0;
dcdt[nSpecie_+1] = 0.0;
}
void Foam::chemistryModel::jacobian
template<class CompType, class ThermoType>
void Foam::ODEChemistryModel<CompType, ThermoType>::jacobian
(
const scalar t,
const scalarField& c,
@ -316,29 +314,29 @@ void Foam::chemistryModel::jacobian
scalarSquareMatrix& dfdc
) const
{
scalar T = c[Ns_];
scalar p = c[Ns_ + 1];
scalar T = c[nSpecie_];
scalar p = c[nSpecie_ + 1];
scalarField c2(Ns(), 0.0);
for(label i=0; i<Ns(); i++)
scalarField c2(nSpecie_, 0.0);
for (label i=0; i<nSpecie_; i++)
{
c2[i] = max(c[i], 0.0);
}
for(label i=0; i<nEqns(); i++)
for (label i=0; i<nEqns(); i++)
{
for(label j=0; j<nEqns(); j++)
for (label j=0; j<nEqns(); j++)
{
dfdc[i][j] = 0.0;
}
}
// length of the first argument must be Ns()
// length of the first argument must be nSpecie()
dcdt = omega(c2, T, p);
for (label ri=0; ri<reactions_.size(); ri++)
{
const reaction& R = reactions_[ri];
const Reaction<ThermoType>& R = reactions_[ri];
scalar kf0 = R.kf(T, p, c2);
scalar kr0 = R.kr(T, p, c2);
@ -357,7 +355,7 @@ void Foam::chemistryModel::jacobian
{
if (c2[si]>SMALL)
{
kf *= el*pow(c2[si]+VSMALL, el-1.0);
kf *= el*pow(c2[si] + VSMALL, el - 1.0);
}
else
{
@ -366,7 +364,7 @@ void Foam::chemistryModel::jacobian
}
else
{
kf *= el*pow(c2[si], el-1.0);
kf *= el*pow(c2[si], el - 1.0);
}
}
else
@ -403,7 +401,7 @@ void Foam::chemistryModel::jacobian
{
if (c2[si]>SMALL)
{
kr *= er*pow(c2[si]+VSMALL, er-1.0);
kr *= er*pow(c2[si] + VSMALL, er - 1.0);
}
else
{
@ -412,7 +410,7 @@ void Foam::chemistryModel::jacobian
}
else
{
kr *= er*pow(c2[si], er-1.0);
kr *= er*pow(c2[si], er - 1.0);
}
}
else
@ -438,40 +436,54 @@ void Foam::chemistryModel::jacobian
// calculate the dcdT elements numerically
scalar delta = 1.0e-8;
scalarField dcdT0 = omega(c2, T-delta, p);
scalarField dcdT1 = omega(c2, T+delta, p);
scalarField dcdT0 = omega(c2, T - delta, p);
scalarField dcdT1 = omega(c2, T + delta, p);
for(label i=0; i<nEqns(); i++)
for (label i=0; i<nEqns(); i++)
{
dfdc[i][Ns()] = 0.5*(dcdT1[i]-dcdT0[i])/delta;
dfdc[i][nSpecie()] = 0.5*(dcdT1[i] - dcdT0[i])/delta;
}
} // end jacobian
}
Foam::tmp<Foam::volScalarField> Foam::chemistryModel::tc() const
template<class CompType, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
{
scalar pf,cf,pr,cr;
label lRef, rRef;
label nCells = rho_.size();
label Nr = reactions_.size();
const volScalarField rho
(
IOobject
(
"rho",
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->thermo().rho()
);
label nCells = rho.size();
label nReaction = reactions_.size();
scalarField t(nCells, SMALL);
if (chemistry_)
if (this->chemistry_)
{
for(label celli=0; celli<nCells; celli++)
forAll(rho, celli)
{
scalar rhoi = rho_[celli];
scalar Ti = thermo_.T()[celli];
scalar pi = thermo_.p()[celli];
scalarField c(Ns_);
scalar rhoi = rho[celli];
scalar Ti = this->thermo().T()[celli];
scalar pi = this->thermo().p()[celli];
scalarField c(nSpecie_);
scalar cSum = 0.0;
for(label i=0; i<Ns_; i++)
for (label i=0; i<nSpecie_; i++)
{
scalar Yi = Y_[i][celli];
c[i] = rhoi*Yi/specieThermo_[i].W();
@ -480,7 +492,7 @@ Foam::tmp<Foam::volScalarField> Foam::chemistryModel::tc() const
forAll(reactions_, i)
{
const reaction& R = reactions_[i];
const Reaction<ThermoType>& R = reactions_[i];
omega
(
@ -493,7 +505,7 @@ Foam::tmp<Foam::volScalarField> Foam::chemistryModel::tc() const
t[celli] += sr*pf*cf;
}
}
t[celli] = Nr*cSum/t[celli];
t[celli] = nReaction*cSum/t[celli];
}
}
@ -504,13 +516,13 @@ Foam::tmp<Foam::volScalarField> Foam::chemistryModel::tc() const
IOobject
(
"tc",
rho_.time().timeName(),
rho_.db(),
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho_.mesh(),
dimensionedScalar("zero", dimensionSet(0, 0, 1, 0, 0), 0.0),
this->mesh_,
dimensionedScalar("zero", dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
@ -522,37 +534,103 @@ Foam::tmp<Foam::volScalarField> Foam::chemistryModel::tc() const
}
Foam::label Foam::chemistryModel::nEqns() const
template<class CompType, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::ODEChemistryModel<CompType, ThermoType>::dQ() const
{
// nEqns = number of species + temperature + pressure
return Ns_ + 2;
tmp<volScalarField> tdQ
(
new volScalarField
(
IOobject
(
"dQ",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh_,
dimensionedScalar
(
"zero",
dimensionSet(1, -3, -1 , 0, 0, 0, 0),
0.0
)
)
);
if (this->chemistry_)
{
scalarField& dQ = tdQ();
scalarField cp(dQ.size(), 0.0);
forAll(Y_, i)
{
forAll(dQ, cellI)
{
scalar Ti = this->thermo().T()[cellI];
cp[cellI] += Y_[i][cellI]*specieThermo_[i].Cp(Ti);
scalar hi = specieThermo_[i].h(Ti);
dQ[cellI] -= hi*RR_[i][cellI];
}
}
dQ /= cp;
}
return tdQ;
}
void Foam::chemistryModel::calculate()
template<class CompType, class ThermoType>
Foam::label Foam::ODEChemistryModel<CompType, ThermoType>::nEqns() const
{
for(label i=0; i<Ns(); i++)
// nEqns = number of species + temperature + pressure
return nSpecie_ + 2;
}
template<class CompType, class ThermoType>
void Foam::ODEChemistryModel<CompType, ThermoType>::calculate()
{
const volScalarField rho
(
IOobject
(
"rho",
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->thermo().rho()
);
for (label i=0; i<nSpecie_; i++)
{
RR_[i].setSize(rho_.size());
RR_[i].setSize(rho.size());
}
if (chemistry_)
if (this->chemistry_)
{
for(label celli=0; celli<rho_.size(); celli++)
forAll(rho, celli)
{
for(label i=0; i<Ns(); i++)
for (label i=0; i<nSpecie_; i++)
{
RR_[i][celli] = 0.0;
}
scalar rhoi = rho_[celli];
scalar Ti = thermo_.T()[celli];
scalar pi = thermo_.p()[celli];
scalar rhoi = rho[celli];
scalar Ti = this->thermo().T()[celli];
scalar pi = this->thermo().p()[celli];
scalarField c(Ns_);
scalarField c(nSpecie_);
scalarField dcdt(nEqns(), 0.0);
for(label i=0; i<Ns_; i++)
for (label i=0; i<nSpecie_; i++)
{
scalar Yi = Y_[i][celli];
c[i] = rhoi*Yi/specieThermo_[i].W();
@ -560,7 +638,7 @@ void Foam::chemistryModel::calculate()
dcdt = omega(c, Ti, pi);
for(label i=0; i<Ns_; i++)
for (label i=0; i<nSpecie_; i++)
{
RR_[i][celli] = dcdt[i]*specieThermo_[i].W();
}
@ -569,44 +647,63 @@ void Foam::chemistryModel::calculate()
}
Foam::scalar Foam::chemistryModel::solve(const scalar t0, const scalar deltaT)
template<class CompType, class ThermoType>
Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
(
const scalar t0,
const scalar deltaT
)
{
for(label i=0; i<Ns(); i++)
const volScalarField rho
(
IOobject
(
"rho",
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->thermo().rho()
);
for (label i=0; i<nSpecie_; i++)
{
RR_[i].setSize(rho_.size());
RR_[i].setSize(rho.size());
}
if (!chemistry_)
if (!this->chemistry_)
{
return GREAT;
}
scalar deltaTMin = GREAT;
for(label celli=0; celli<rho_.size(); celli++)
forAll(rho, celli)
{
for(label i=0; i<Ns(); i++)
for (label i=0; i<nSpecie(); i++)
{
RR_[i][celli] = 0.0;
}
scalar rhoi = rho_[celli];
scalar Ti = thermo_.T()[celli];
scalar hi = thermo_.h()[celli];
scalar pi = thermo_.p()[celli];
scalar rhoi = rho[celli];
scalar Ti = this->thermo().T()[celli];
scalar hi = this->thermo().h()[celli];
scalar pi = this->thermo().p()[celli];
scalarField c(Ns_);
scalarField c0(Ns_);
scalarField dc(Ns_, 0.0);
scalarField c(nSpecie_);
scalarField c0(nSpecie_);
scalarField dc(nSpecie_, 0.0);
for(label i=0; i<Ns_; i++)
for (label i=0; i<nSpecie_; i++)
{
c[i] = rhoi*Y_[i][celli]/specieThermo_[i].W();
}
c0 = c;
scalar t = t0;
scalar tauC = deltaTChem_[celli];
scalar tauC = this->deltaTChem_[celli];
scalar dt = min(deltaT, tauC);
scalar timeLeft = deltaT;
@ -620,15 +717,15 @@ Foam::scalar Foam::chemistryModel::solve(const scalar t0, const scalar deltaT)
// update the temperature
cTot = sum(c);
reactionThermo mixture(0.0*specieThermo_[0]);
for(label i=0; i<Ns_; i++)
ThermoType mixture(0.0*specieThermo_[0]);
for (label i=0; i<nSpecie_; i++)
{
mixture += (c[i]/cTot)*specieThermo_[i];
}
Ti = mixture.TH(hi, Ti);
timeLeft -= dt;
deltaTChem_[celli] = tauC;
this->deltaTChem_[celli] = tauC;
dt = min(timeLeft, tauC);
dt = max(dt, SMALL);
}
@ -636,13 +733,13 @@ Foam::scalar Foam::chemistryModel::solve(const scalar t0, const scalar deltaT)
dc = c - c0;
scalar WTot = 0.0;
for(label i=0; i<Ns_; i++)
for (label i=0; i<nSpecie_; i++)
{
WTot += c[i]*specieThermo_[i].W();
}
WTot /= cTot;
for(label i=0; i<Ns_; i++)
for (label i=0; i<nSpecie_; i++)
{
RR_[i][celli] = dc[i]*specieThermo_[i].W()/deltaT;
}

View File

@ -0,0 +1,227 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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::ODEChemistryModel
Description
Extends base chemistry model by adding a thermo package, and ODE functions.
Introduces chemistry equation system and evaluation of chemical source
terms.
SourceFiles
ODEChemistryModelI.H
ODEChemistryModel.C
\*---------------------------------------------------------------------------*/
#ifndef ODEChemistryModel_H
#define ODEChemistryModel_H
#include "hCombustionThermo.H"
#include "Reaction.H"
#include "ODE.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class CompType, class ThermoType>
class chemistrySolver;
/*---------------------------------------------------------------------------*\
Class ODEChemistryModel Declaration
\*---------------------------------------------------------------------------*/
template<class CompType, class ThermoType>
class ODEChemistryModel
:
public CompType,
public ODE
{
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const ODEChemistryModel&);
protected:
// Private data
//- Reference to the field of specie mass fractions
PtrList<volScalarField>& Y_;
//- Reactions
const PtrList<Reaction<ThermoType> >& reactions_;
//- Thermodynamic data of the species
const PtrList<ThermoType>& specieThermo_;
//- Number of species
label nSpecie_;
//- Number of reactions
label nReaction_;
//- Chemistry solver
autoPtr<chemistrySolver<CompType, ThermoType> > solver_;
//- Chemical source term
PtrList<scalarField> RR_;
// Protected Member Functions
//- Write access to chemical source terms
// (e.g. for multi-chemistry model)
inline PtrList<scalarField>& RR();
public:
//- Runtime type information
TypeName("ODEChemistryModel");
// Constructors
//- Construct from components
ODEChemistryModel
(
const fvMesh& mesh,
const word& compTypeName,
const word& thermoTypeName
);
//- Destructor
virtual ~ODEChemistryModel();
// Member Functions
//- The reactions
inline const PtrList<Reaction<ThermoType> >& reactions() const;
//- Thermodynamic data of the species
inline const PtrList<ThermoType>& specieThermo() const;
//- The number of species
inline label nSpecie() const;
//- The number of reactions
inline label nReaction() const;
//- Return the chemisty solver
inline const chemistrySolver<CompType, ThermoType>& solver() const;
//- dc/dt = omega, rate of change in concentration, for each species
virtual scalarField omega
(
const scalarField& c,
const scalar T,
const scalar p
) const;
//- Return the reaction rate for reaction r and the reference
// species and charateristic times
virtual scalar omega
(
const Reaction<ThermoType>& r,
const scalarField& c,
const scalar T,
const scalar p,
scalar& pf,
scalar& cf,
label& lRef,
scalar& pr,
scalar& cr,
label& rRef
) const;
//- Calculates the reaction rates
virtual void calculate();
// Chemistry model functions (overriding abstract functions in
// chemistryModel.H)
//- Return const access to the chemical source terms
inline tmp<volScalarField> RR(const label i) const;
//- Solve the reaction system for the given start time and time
// step and return the characteristic time
virtual scalar solve(const scalar t0, const scalar deltaT);
//- Return the chemical time scale
virtual tmp<volScalarField> tc() const;
//- Return the heat release
virtual tmp<volScalarField> dQ() const;
// ODE functions (overriding abstract functions in ODE.H)
//- Number of ODE's to solve
virtual label nEqns() const;
virtual void derivatives
(
const scalar t,
const scalarField& c,
scalarField& dcdt
) const;
virtual void jacobian
(
const scalar t,
const scalarField& c,
scalarField& dcdt,
scalarSquareMatrix& dfdc
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ODEChemistryModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ODEChemistryModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,113 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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 "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CompType, class ThermoType>
inline Foam::PtrList<Foam::scalarField>&
Foam::ODEChemistryModel<CompType, ThermoType>::RR()
{
return RR_;
}
template<class CompType, class ThermoType>
inline const Foam::PtrList<Foam::Reaction<ThermoType> >&
Foam::ODEChemistryModel<CompType, ThermoType>::reactions() const
{
return reactions_;
}
template<class CompType, class ThermoType>
inline const Foam::PtrList<ThermoType>&
Foam::ODEChemistryModel<CompType, ThermoType>::specieThermo() const
{
return specieThermo_;
}
template<class CompType, class ThermoType>
inline Foam::label
Foam::ODEChemistryModel<CompType, ThermoType>::nSpecie() const
{
return nSpecie_;
}
template<class CompType, class ThermoType>
inline Foam::label
Foam::ODEChemistryModel<CompType, ThermoType>::nReaction() const
{
return nReaction_;
}
template<class CompType, class ThermoType>
inline const Foam::chemistrySolver<CompType, ThermoType>&
Foam::ODEChemistryModel<CompType, ThermoType>::solver() const
{
return solver_;
}
template<class CompType, class ThermoType>
inline Foam::tmp<Foam::volScalarField>
Foam::ODEChemistryModel<CompType, ThermoType>::RR
(
const label i
) const
{
tmp<volScalarField> tRR
(
new volScalarField
(
IOobject
(
"RR(" + this->Y_[i].name() + ')',
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimensionSet(1, -3, -1, 0, 0), 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->chemistry_)
{
tRR().internalField() = RR_[i];
tRR().correctBoundaryConditions();
}
return tRR;
}
// ************************************************************************* //

View File

@ -0,0 +1,69 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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 "basicChemistryModel.H"
#include "fvMesh.H"
#include "Time.H"
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
defineTypeNameAndDebug(basicChemistryModel, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh)
:
IOdictionary
(
IOobject
(
"chemistryProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
mesh_(mesh),
chemistry_(lookup("chemistry")),
deltaTChem_
(
mesh.nCells(),
readScalar(lookup("initialChemicalTimeStep"))
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::basicChemistryModel::~basicChemistryModel()
{}
// ************************************************************************* //

View File

@ -0,0 +1,153 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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::basicChemistryModel
Description
Base class for chemistry models
SourceFiles
basicChemistryModelI.H
basicChemistryModel.C
\*---------------------------------------------------------------------------*/
#ifndef basicChemistryModel_H
#define basicChemistryModel_H
#include "IOdictionary.H"
#include "Switch.H"
#include "scalarField.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class fvMesh;
/*---------------------------------------------------------------------------*\
class basicChemistryModel Declaration
\*---------------------------------------------------------------------------*/
class basicChemistryModel
:
public IOdictionary
{
// Private Member Functions
//- Construct as copy (not implemented)
basicChemistryModel(const basicChemistryModel&);
//- Disallow default bitwise assignment
void operator=(const basicChemistryModel&);
protected:
// Protected data
//- Reference to the mesh database
const fvMesh& mesh_;
//- Chemistry activation switch
Switch chemistry_;
//- Latest estimation of integration step
scalarField deltaTChem_;
// Protected member functions
//- Return non-const access to the latest estimation of integration
// step, e.g. for multi-chemistry model
scalarField& deltaTChem();
public:
//- Runtime type information
TypeName("basicChemistryModel");
// Constructors
//- Construct from mesh
basicChemistryModel(const fvMesh& mesh);
//- Destructor
virtual ~basicChemistryModel();
// Member Functions
//- Return const access to the mesh database
inline const fvMesh& mesh() const;
//- Chemistry activation switch
inline Switch chemistry() const;
//- Return the latest estimation of integration step
inline const scalarField& deltaTChem() const;
// Functions to be derived in derived classes
// Fields
//- Return const access to chemical source terms
virtual tmp<volScalarField> RR(const label i) const = 0;
// Chemistry solution
//- Solve the reaction system for the given start time and
// timestep and return the characteristic time
virtual scalar solve(const scalar t0, const scalar deltaT) = 0;
//- Return the chemical time scale
virtual tmp<volScalarField> tc() const = 0;
//- Return the heat release
virtual tmp<volScalarField> dQ() const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "basicChemistryModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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