mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
templated chemistry readers + developing rho based thermo
This commit is contained in:
@ -1,12 +1,7 @@
|
||||
chemistryModel = chemistryModel
|
||||
chemistrySolver = chemistrySolver
|
||||
chemistryModel/chemistryModel/chemistryModel.C
|
||||
chemistryModel/chemistryModel/newChemistryModel.C
|
||||
chemistryModel/chemistryModel/chemistryModels.C
|
||||
|
||||
$(chemistryModel)/chemistryModel.C
|
||||
|
||||
$(chemistrySolver)/chemistrySolver/chemistrySolver.C
|
||||
$(chemistrySolver)/chemistrySolver/newChemistrySolver.C
|
||||
$(chemistrySolver)/sequential/sequential.C
|
||||
$(chemistrySolver)/EulerImplicit/EulerImplicit.C
|
||||
$(chemistrySolver)/ode/ode.C
|
||||
chemistrySolver/chemistrySolver/makeChemistrySolvers.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libchemistryModel
|
||||
|
||||
@ -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
|
||||
|
||||
@ -24,96 +24,78 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "chemistryModel.H"
|
||||
#include "ODEChemistryModel.H"
|
||||
#include "chemistrySolver.H"
|
||||
#include "multiComponentMixture.H"
|
||||
#include "reactingMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::chemistryModel::chemistryModel
|
||||
(
|
||||
hCombustionThermo& thermo,
|
||||
const volScalarField& rho
|
||||
)
|
||||
template<class ThermoType>
|
||||
Foam::ODEChemistryModel<ThermoType>::ODEChemistryModel(const fvMesh& mesh)
|
||||
:
|
||||
thermo_(thermo),
|
||||
chemistryModel(mesh),
|
||||
|
||||
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())
|
||||
),
|
||||
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()),
|
||||
|
||||
solver_
|
||||
specieThermo_
|
||||
(
|
||||
chemistrySolver::New
|
||||
(
|
||||
chemistryProperties_,
|
||||
*this
|
||||
)
|
||||
dynamic_cast<const reactingMixture<ThermoType>&>
|
||||
(this->thermo()).speciesData()
|
||||
),
|
||||
deltaTChem_
|
||||
(
|
||||
rho_.size(),
|
||||
readScalar(chemistryProperties_.lookup("initialChemicalTimeStep"))
|
||||
)
|
||||
|
||||
nSpecie_(Y_.size()),
|
||||
nReaction_(reactions_.size()),
|
||||
|
||||
solver_(chemistrySolver<ThermoType>::New(*this)),
|
||||
|
||||
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 ThermoType>
|
||||
Foam::ODEChemistryModel<ThermoType>::~ODEChemistryModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalarField Foam::chemistryModel::omega
|
||||
template<class ThermoType>
|
||||
Foam::scalarField Foam::ODEChemistryModel<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 +118,13 @@ Foam::scalarField Foam::chemistryModel::omega
|
||||
}
|
||||
|
||||
return om;
|
||||
} // end omega
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::chemistryModel::omega
|
||||
template<class ThermoType>
|
||||
Foam::scalar Foam::ODEChemistryModel<ThermoType>::omega
|
||||
(
|
||||
const reaction& R,
|
||||
const Reaction<ThermoType>& R,
|
||||
const scalarField& c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
@ -153,8 +136,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 +155,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 +180,7 @@ Foam::scalar Foam::chemistryModel::omega
|
||||
{
|
||||
if (cf > SMALL)
|
||||
{
|
||||
pf *= pow(cf, exp-1.0);
|
||||
pf *= pow(cf, exp - 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -206,7 +189,7 @@ Foam::scalar Foam::chemistryModel::omega
|
||||
}
|
||||
else
|
||||
{
|
||||
pf *= pow(cf, exp-1.0);
|
||||
pf *= pow(cf, exp - 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +198,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 +222,7 @@ Foam::scalar Foam::chemistryModel::omega
|
||||
{
|
||||
if (cr>SMALL)
|
||||
{
|
||||
pr *= pow(cr, exp-1.0);
|
||||
pr *= pow(cr, exp - 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -248,25 +231,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 ThermoType>
|
||||
void Foam::ODEChemistryModel<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 +258,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 +266,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 +275,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 +285,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 ThermoType>
|
||||
void Foam::ODEChemistryModel<ThermoType>::jacobian
|
||||
(
|
||||
const scalar t,
|
||||
const scalarField& c,
|
||||
@ -316,29 +301,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 +342,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 +351,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 +388,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 +397,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 +423,40 @@ 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 ThermoType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODEChemistryModel<ThermoType>::tc() const
|
||||
{
|
||||
|
||||
scalar pf,cf,pr,cr;
|
||||
label lRef, rRef;
|
||||
|
||||
label nCells = rho_.size();
|
||||
label Nr = reactions_.size();
|
||||
label nCells = this->thermo().rho()().size();
|
||||
label nReaction = reactions_.size();
|
||||
|
||||
scalarField t(nCells, SMALL);
|
||||
|
||||
if (chemistry_)
|
||||
{
|
||||
|
||||
for(label celli=0; celli<nCells; celli++)
|
||||
for (label celli=0; celli<nCells; celli++)
|
||||
{
|
||||
scalar rhoi = rho_[celli];
|
||||
scalar Ti = thermo_.T()[celli];
|
||||
scalar pi = thermo_.p()[celli];
|
||||
scalarField c(Ns_);
|
||||
scalar rhoi = this->thermo().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 +465,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 +478,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 +489,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 +507,89 @@ Foam::tmp<Foam::volScalarField> Foam::chemistryModel::tc() const
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::chemistryModel::nEqns() const
|
||||
template<class ThermoType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODEChemistryModel<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 (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 ThermoType>
|
||||
Foam::label Foam::ODEChemistryModel<ThermoType>::nEqns() const
|
||||
{
|
||||
for(label i=0; i<Ns(); i++)
|
||||
// nEqns = number of species + temperature + pressure
|
||||
return nSpecie_ + 2;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
void Foam::ODEChemistryModel<ThermoType>::calculate()
|
||||
{
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
RR_[i].setSize(rho_.size());
|
||||
RR_[i].setSize(this->thermo().rho()().size());
|
||||
}
|
||||
|
||||
if (chemistry_)
|
||||
{
|
||||
for(label celli=0; celli<rho_.size(); celli++)
|
||||
forAll(this->thermo().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 = this->thermo().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 +597,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,11 +606,16 @@ void Foam::chemistryModel::calculate()
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::chemistryModel::solve(const scalar t0, const scalar deltaT)
|
||||
template<class ThermoType>
|
||||
Foam::scalar Foam::ODEChemistryModel<ThermoType>::solve
|
||||
(
|
||||
const scalar t0,
|
||||
const scalar deltaT
|
||||
)
|
||||
{
|
||||
for(label i=0; i<Ns(); i++)
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
RR_[i].setSize(rho_.size());
|
||||
RR_[i].setSize(this->thermo().rho()().size());
|
||||
}
|
||||
|
||||
if (!chemistry_)
|
||||
@ -583,23 +625,23 @@ Foam::scalar Foam::chemistryModel::solve(const scalar t0, const scalar deltaT)
|
||||
|
||||
scalar deltaTMin = GREAT;
|
||||
|
||||
for(label celli=0; celli<rho_.size(); celli++)
|
||||
forAll(this->thermo().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 = this->thermo().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();
|
||||
}
|
||||
@ -620,8 +662,8 @@ 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];
|
||||
}
|
||||
@ -636,13 +678,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;
|
||||
}
|
||||
@ -0,0 +1,223 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::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 "chemistryModel.H"
|
||||
#include "ODE.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class ThermoType>
|
||||
class chemistrySolver;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ODEChemistryModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ThermoType>
|
||||
class ODEChemistryModel
|
||||
:
|
||||
public chemistryModel,
|
||||
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<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);
|
||||
|
||||
|
||||
//- 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<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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,111 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "zeroGradientFvPatchFields.H"
|
||||
|
||||
template<class ThermoType>
|
||||
inline Foam::PtrList<Foam::scalarField>&
|
||||
Foam::ODEChemistryModel<ThermoType>::RR()
|
||||
{
|
||||
return RR_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
inline const Foam::PtrList<Foam::Reaction<ThermoType> >&
|
||||
Foam::ODEChemistryModel<ThermoType>::reactions() const
|
||||
{
|
||||
return reactions_;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline const Foam::PtrList<ThermoType>&
|
||||
Foam::ODEChemistryModel<ThermoType>::specieThermo() const
|
||||
{
|
||||
return specieThermo_;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline Foam::label Foam::ODEChemistryModel<ThermoType>::nSpecie() const
|
||||
{
|
||||
return nSpecie_;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline Foam::label Foam::ODEChemistryModel<ThermoType>::nReaction() const
|
||||
{
|
||||
return nReaction_;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline const Foam::chemistrySolver<ThermoType>&
|
||||
Foam::ODEChemistryModel<ThermoType>::solver() const
|
||||
{
|
||||
return solver_;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODEChemistryModel<ThermoType>::RR
|
||||
(
|
||||
const label i
|
||||
) const
|
||||
{
|
||||
tmp<volScalarField> tRR
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"RR(" + this->Y_[i].name() + ')',
|
||||
this->thermo().rho()().mesh().time().timeName(),
|
||||
this->thermo().rho()().mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->thermo().rho()().mesh(),
|
||||
dimensionedScalar("zero", dimensionSet(1, -3, -1, 0, 0), 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
if (chemistry_)
|
||||
{
|
||||
tRR().internalField() = RR_[i];
|
||||
tRR().correctBoundaryConditions();
|
||||
}
|
||||
return tRR;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,287 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::chemistryModel
|
||||
|
||||
Description
|
||||
Foam::chemistryModel
|
||||
|
||||
SourceFiles
|
||||
chemistryModelI.H
|
||||
chemistryModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef chemistryModel_H
|
||||
#define chemistryModel_H
|
||||
|
||||
#include "hCombustionThermo.H"
|
||||
#include "reactingMixture.H"
|
||||
#include "ODE.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class chemistrySolver;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class chemistryModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class chemistryModel
|
||||
:
|
||||
public ODE
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef reactingMixture::reaction reaction;
|
||||
typedef reactingMixture::reactionThermo reactionThermo;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to the thermo package
|
||||
const hCombustionThermo& thermo_;
|
||||
|
||||
//- Reference to the field of specie mass fractions
|
||||
PtrList<volScalarField>& Y_;
|
||||
|
||||
//- Reference to the density field
|
||||
const volScalarField& rho_;
|
||||
|
||||
//- Chemistry properties dictionary
|
||||
IOdictionary chemistryProperties_;
|
||||
|
||||
//- Flag to activate the chemistry (or not)
|
||||
Switch chemistry_;
|
||||
|
||||
//- List of reactions
|
||||
const PtrList<reaction>& reactions_;
|
||||
|
||||
//- Thermodynamic data of the species
|
||||
const PtrList<reactionThermo>& specieThermo_;
|
||||
|
||||
//- Number of species
|
||||
label Ns_;
|
||||
|
||||
//- Number of reactions
|
||||
label Nr_;
|
||||
|
||||
//- Chemistry solver
|
||||
autoPtr<chemistrySolver> solver_;
|
||||
|
||||
//- Chemical source term
|
||||
PtrList<scalarField> RR_;
|
||||
|
||||
//- Latest estimation of integration step
|
||||
scalarField deltaTChem_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const chemistryModel&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Write access to chemical source terms
|
||||
// (eg, for multi-chemistry model)
|
||||
PtrList<scalarField>& RR()
|
||||
{
|
||||
return RR_;
|
||||
}
|
||||
|
||||
//- Return the latest estimation of integration step
|
||||
// (eg, for multi-chemistry model)
|
||||
scalarField& deltaTChem()
|
||||
{
|
||||
return deltaTChem_;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
chemistryModel
|
||||
(
|
||||
hCombustionThermo& thermo,
|
||||
const volScalarField& rho
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~chemistryModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the thermodynamics model
|
||||
const hCombustionThermo& thermo() const
|
||||
{
|
||||
return thermo_;
|
||||
}
|
||||
|
||||
//- Access the mass fractions of the species
|
||||
const PtrList<volScalarField>& Y() const
|
||||
{
|
||||
return Y_;
|
||||
}
|
||||
|
||||
//- Access the density field
|
||||
const volScalarField& rho() const
|
||||
{
|
||||
return rho_;
|
||||
}
|
||||
|
||||
//- Return the chemistry properties
|
||||
inline const IOdictionary& chemistryProperties() const
|
||||
{
|
||||
return chemistryProperties_;
|
||||
}
|
||||
|
||||
//- Do the chemistry or not.
|
||||
inline Switch chemistry() const
|
||||
{
|
||||
return chemistry_;
|
||||
}
|
||||
|
||||
inline const PtrList<reaction>& reactions() const
|
||||
{
|
||||
return reactions_;
|
||||
}
|
||||
|
||||
inline const PtrList<reactionThermo>& specieThermo() const
|
||||
{
|
||||
return specieThermo_;
|
||||
}
|
||||
|
||||
//- The number of species
|
||||
inline label Ns() const
|
||||
{
|
||||
return Ns_;
|
||||
}
|
||||
|
||||
//- The number of reactions
|
||||
inline label Nr() const
|
||||
{
|
||||
return Nr_;
|
||||
}
|
||||
|
||||
// Return the chemisty solver
|
||||
inline const chemistrySolver& solver() const
|
||||
{
|
||||
return solver_;
|
||||
}
|
||||
|
||||
//- Return the chemical source terms
|
||||
inline tmp<volScalarField> RR(const label i) const;
|
||||
|
||||
//- Return the latest estimation of integration step
|
||||
const scalarField& deltaTChem() const
|
||||
{
|
||||
return deltaTChem_;
|
||||
}
|
||||
|
||||
//- The chemical time scale
|
||||
tmp<volScalarField> tc() const;
|
||||
|
||||
//- dc/dt = omega, rate of change in concentration, for each species
|
||||
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
|
||||
scalar omega
|
||||
(
|
||||
const reaction& r,
|
||||
const scalarField& c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
scalar& pf,
|
||||
scalar& cf,
|
||||
label& lRef,
|
||||
scalar& pr,
|
||||
scalar& cr,
|
||||
label& rRef
|
||||
) const;
|
||||
|
||||
//- The number of ODE to solve
|
||||
label nEqns() const;
|
||||
|
||||
void derivatives
|
||||
(
|
||||
const scalar t,
|
||||
const scalarField& c,
|
||||
scalarField& dcdt
|
||||
) const;
|
||||
|
||||
void jacobian
|
||||
(
|
||||
const scalar t,
|
||||
const scalarField& c,
|
||||
scalarField& dcdt,
|
||||
scalarSquareMatrix& dfdc
|
||||
) const;
|
||||
|
||||
//- Calculates the reaction rates
|
||||
void calculate();
|
||||
|
||||
//- Solve the reaction system for the given start time and time-step
|
||||
// and return the characteristic time
|
||||
scalar solve
|
||||
(
|
||||
const scalar t0,
|
||||
const scalar deltaT
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "chemistryModelI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,73 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "chemistryModel.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
|
||||
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(chemistryModel, 0);
|
||||
defineRunTimeSelectionTable(chemistryModel, fvMesh);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::chemistryModel::chemistryModel(const fvMesh& mesh)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
mesh_(mesh),
|
||||
thermo_(hCombustionThermo::New(mesh)),
|
||||
chemistry_(lookup("chemistry")),
|
||||
deltaTChem_
|
||||
(
|
||||
mesh.nCells(),
|
||||
readScalar(lookup("initialChemicalTimeStep"))
|
||||
)
|
||||
{
|
||||
Info<< "chemistryModel(const fvMesh&)" << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::chemistryModel::~chemistryModel()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,182 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::chemistryModel
|
||||
|
||||
Description
|
||||
Foam::chemistryModel
|
||||
|
||||
SourceFiles
|
||||
chemistryModelI.H
|
||||
chemistryModel.C
|
||||
newChemistryModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef chemistryModel_H
|
||||
#define chemistryModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "Switch.H"
|
||||
#include "scalarField.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "hCombustionThermo.H"
|
||||
//#include "basicMultiComponentMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
class chemistryModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class chemistryModel
|
||||
:
|
||||
public IOdictionary
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Construct as copy (not implemented)
|
||||
chemistryModel(const chemistryModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const chemistryModel&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the mesh database
|
||||
const fvMesh& mesh_;
|
||||
|
||||
//- Thermo package
|
||||
autoPtr<hCombustionThermo> thermo_;
|
||||
|
||||
//- 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("chemistryModel");
|
||||
|
||||
|
||||
//- Declare run-time constructor selection tables
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
chemistryModel,
|
||||
fvMesh,
|
||||
(
|
||||
const fvMesh& mesh
|
||||
),
|
||||
(mesh)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
chemistryModel(const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Selector
|
||||
static autoPtr<chemistryModel> New(const fvMesh& mesh);
|
||||
|
||||
//- Destructor
|
||||
virtual ~chemistryModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return const access to the mesh database
|
||||
inline const fvMesh& mesh() const;
|
||||
|
||||
//- Return access to the thermo package
|
||||
inline hCombustionThermo& thermo();
|
||||
|
||||
//- Return const access to the thermo package
|
||||
inline const hCombustionThermo& thermo() 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 "chemistryModelI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,39 +24,41 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::tmp<Foam::volScalarField> Foam::chemistryModel::RR
|
||||
(
|
||||
const label i
|
||||
) const
|
||||
inline const Foam::fvMesh& Foam::chemistryModel::mesh() const
|
||||
{
|
||||
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
|
||||
)
|
||||
);
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
if (chemistry_)
|
||||
{
|
||||
tRR().internalField() = RR_[i];
|
||||
tRR().correctBoundaryConditions();
|
||||
}
|
||||
return tRR;
|
||||
|
||||
inline Foam::hCombustionThermo& Foam::chemistryModel::thermo()
|
||||
{
|
||||
return thermo_();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::hCombustionThermo& Foam::chemistryModel::thermo() const
|
||||
{
|
||||
return thermo_();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::Switch Foam::chemistryModel::chemistry() const
|
||||
{
|
||||
return chemistry_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::scalarField& Foam::chemistryModel::deltaTChem() const
|
||||
{
|
||||
return deltaTChem_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalarField& Foam::chemistryModel::deltaTChem()
|
||||
{
|
||||
return deltaTChem_;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
InClass
|
||||
Foam::chemistryModel
|
||||
|
||||
Description
|
||||
Creates chemistry model instances templated on the type of thermodynamics
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "thermoPhysicsTypes.H"
|
||||
#include "makeChemistryModel.H"
|
||||
#include "ODEChemistryModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeChemistryModel(ODEChemistryModel, gasThermoPhysics);
|
||||
makeChemistryModel(ODEChemistryModel, icoPoly8ThermoPhysics);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,72 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
InClass
|
||||
Foam::chemistryModel
|
||||
|
||||
Description
|
||||
Macros for instantiating chemistry models based on transport type
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef makeChemistryModel_H
|
||||
#define makeChemistryModel_H
|
||||
|
||||
#include "chemistryModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeChemistryModel(SS, Transport) \
|
||||
\
|
||||
typedef SS<Transport> SS##Transport; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##Transport, \
|
||||
#SS"<"#Transport">", \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
chemistryModel, \
|
||||
SS##Transport, \
|
||||
fvMesh \
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,77 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "chemistryModel.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::chemistryModel> Foam::chemistryModel::New
|
||||
(
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
word chemistryModelType;
|
||||
|
||||
// Enclose the creation of the chemistrtyProperties to ensure it is
|
||||
// deleted before the chemistrtyProperties is created otherwise the
|
||||
// dictionary is entered in the database twice
|
||||
{
|
||||
IOdictionary chemistryPropertiesDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
chemistryPropertiesDict.lookup("chemistryModel") >> chemistryModelType;
|
||||
}
|
||||
|
||||
Info<< "Selecting chemistryModel " << chemistryModelType << endl;
|
||||
|
||||
fvMeshConstructorTable::iterator cstrIter =
|
||||
fvMeshConstructorTablePtr_->find(chemistryModelType);
|
||||
|
||||
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn("chemistryModelBase::New(const mesh&)")
|
||||
<< "Unknown chemistryModel type " << chemistryModelType << nl << nl
|
||||
<< "Valid chemistryModel types are:" << nl
|
||||
<< fvMeshConstructorTablePtr_->toc() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<chemistryModel>(cstrIter()(mesh));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -28,30 +28,16 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "simpleMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(EulerImplicit, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
chemistrySolver,
|
||||
EulerImplicit,
|
||||
dictionary
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::EulerImplicit::EulerImplicit
|
||||
template<class ThermoType>
|
||||
Foam::EulerImplicit<ThermoType>::EulerImplicit
|
||||
(
|
||||
const Foam::dictionary& dict,
|
||||
Foam::chemistryModel& chemistry
|
||||
ODEChemistryModel<ThermoType>& model
|
||||
)
|
||||
:
|
||||
chemistrySolver(dict, chemistry),
|
||||
coeffsDict_(dict.subDict(typeName + "Coeffs")),
|
||||
chemistrySolver<ThermoType>(model),
|
||||
coeffsDict_(model.subDict(typeName + "Coeffs")),
|
||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||
equil_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
{}
|
||||
@ -59,13 +45,15 @@ Foam::EulerImplicit::EulerImplicit
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::EulerImplicit::~EulerImplicit()
|
||||
template<class ThermoType>
|
||||
Foam::EulerImplicit<ThermoType>::~EulerImplicit()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::EulerImplicit::solve
|
||||
template<class ThermoType>
|
||||
Foam::scalar Foam::EulerImplicit<ThermoType>::solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
@ -74,28 +62,27 @@ Foam::scalar Foam::EulerImplicit::solve
|
||||
const scalar dt
|
||||
) const
|
||||
{
|
||||
|
||||
scalar pf, cf, pr, cr;
|
||||
label lRef, rRef;
|
||||
|
||||
label Ns = chemistry_.Ns();
|
||||
simpleMatrix<scalar> RR(Ns);
|
||||
|
||||
for(label i=0; i<Ns; i++)
|
||||
label nSpecie = this->model_.nSpecie();
|
||||
simpleMatrix<scalar> RR(nSpecie);
|
||||
|
||||
for (label i=0; i<nSpecie; i++)
|
||||
{
|
||||
c[i] = max(0.0, c[i]);
|
||||
}
|
||||
|
||||
for(label i=0; i<Ns; i++)
|
||||
for (label i=0; i<nSpecie; i++)
|
||||
{
|
||||
RR.source()[i] = c[i]/dt;
|
||||
}
|
||||
|
||||
for(label i=0; i<chemistry_.reactions().size(); i++)
|
||||
for (label i=0; i<this->model_.reactions().size(); i++)
|
||||
{
|
||||
const chemistryModel::reaction& R = chemistry_.reactions()[i];
|
||||
const Reaction<ThermoType>& R = this->model_.reactions()[i];
|
||||
|
||||
scalar omegai = chemistry_.omega
|
||||
scalar omegai = this->model_.omega
|
||||
(
|
||||
R, c, T, p, pf, cf, lRef, pr, cr, rRef
|
||||
);
|
||||
@ -113,59 +100,59 @@ Foam::scalar Foam::EulerImplicit::solve
|
||||
}
|
||||
}
|
||||
|
||||
for(label s=0; s<R.lhs().size(); s++)
|
||||
for (label s=0; s<R.lhs().size(); s++)
|
||||
{
|
||||
label si = R.lhs()[s].index;
|
||||
scalar sl = R.lhs()[s].stoichCoeff;
|
||||
RR[si][rRef] -= sl*pr*corr;
|
||||
RR[si][lRef] += sl*pf*corr;
|
||||
}
|
||||
|
||||
for(label s=0; s<R.rhs().size(); s++)
|
||||
|
||||
for (label s=0; s<R.rhs().size(); s++)
|
||||
{
|
||||
label si = R.rhs()[s].index;
|
||||
scalar sr = R.rhs()[s].stoichCoeff;
|
||||
RR[si][lRef] -= sr*pf*corr;
|
||||
RR[si][rRef] += sr*pr*corr;
|
||||
}
|
||||
|
||||
|
||||
} // end for(label i...
|
||||
|
||||
|
||||
for(label i=0; i<Ns; i++)
|
||||
|
||||
for (label i=0; i<nSpecie; i++)
|
||||
{
|
||||
RR[i][i] += 1.0/dt;
|
||||
}
|
||||
|
||||
c = RR.LUsolve();
|
||||
for(label i=0; i<Ns; i++)
|
||||
for (label i=0; i<nSpecie; i++)
|
||||
{
|
||||
c[i] = max(0.0, c[i]);
|
||||
}
|
||||
|
||||
// estimate the next time step
|
||||
scalar tMin = GREAT;
|
||||
label n = chemistry_.nEqns();
|
||||
scalarField c1(n, 0.0);
|
||||
label nEqns = this->model_.nEqns();
|
||||
scalarField c1(nEqns, 0.0);
|
||||
|
||||
for(label i=0; i<Ns; i++)
|
||||
for (label i=0; i<nSpecie; i++)
|
||||
{
|
||||
c1[i] = c[i];
|
||||
}
|
||||
c1[Ns] = T;
|
||||
c1[Ns+1] = p;
|
||||
c1[nSpecie] = T;
|
||||
c1[nSpecie+1] = p;
|
||||
|
||||
scalarField dcdt(nEqns, 0.0);
|
||||
this->model_.derivatives(0.0, c1, dcdt);
|
||||
|
||||
scalarField dcdt(n, 0.0);
|
||||
chemistry_.derivatives(0.0, c1, dcdt);
|
||||
|
||||
scalar sumC = sum(c);
|
||||
|
||||
for(label i=0; i<Ns; i++)
|
||||
for (label i=0; i<nSpecie; i++)
|
||||
{
|
||||
scalar d = dcdt[i];
|
||||
if (d < -SMALL)
|
||||
{
|
||||
tMin = min(tMin, -(c[i]+SMALL)/d);
|
||||
tMin = min(tMin, -(c[i] + SMALL)/d);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -173,10 +160,9 @@ Foam::scalar Foam::EulerImplicit::solve
|
||||
scalar cm = max(sumC - c[i], 1.0e-5);
|
||||
tMin = min(tMin, cm/d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cTauChem_*tMin;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -47,16 +47,17 @@ namespace Foam
|
||||
Class EulerImplicit Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ThermoType>
|
||||
class EulerImplicit
|
||||
:
|
||||
public chemistrySolver
|
||||
public chemistrySolver<ThermoType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
dictionary coeffsDict_;
|
||||
|
||||
// model constants
|
||||
|
||||
// Model constants
|
||||
|
||||
scalar cTauChem_;
|
||||
Switch equil_;
|
||||
|
||||
@ -70,16 +71,11 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
EulerImplicit
|
||||
(
|
||||
const dictionary& dict,
|
||||
chemistryModel& chemistry
|
||||
);
|
||||
EulerImplicit(ODEChemistryModel<ThermoType>& chemistry);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~EulerImplicit();
|
||||
//- Destructor
|
||||
virtual ~EulerImplicit();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -102,6 +98,12 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "EulerImplicit.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -29,29 +29,22 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(chemistrySolver, 0);
|
||||
defineRunTimeSelectionTable(chemistrySolver, dictionary);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::chemistrySolver::chemistrySolver
|
||||
template<class ThermoType>
|
||||
Foam::chemistrySolver<ThermoType>::chemistrySolver
|
||||
(
|
||||
const Foam::dictionary& dict,
|
||||
Foam::chemistryModel& chemistry
|
||||
ODEChemistryModel<ThermoType>& model
|
||||
)
|
||||
:
|
||||
dict_(dict),
|
||||
chemistry_(chemistry)
|
||||
model_(model)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::chemistrySolver::~chemistrySolver()
|
||||
template<class ThermoType>
|
||||
Foam::chemistrySolver<ThermoType>::~chemistrySolver()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ SourceFiles
|
||||
#ifndef chemistrySolver_H
|
||||
#define chemistrySolver_H
|
||||
|
||||
#include "chemistryModel.H"
|
||||
#include "ODEChemistryModel.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "scalarField.H"
|
||||
#include "autoPtr.H"
|
||||
@ -48,16 +48,18 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class chemistrySolver Declaration
|
||||
Class chemistrySolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ThermoType>
|
||||
class chemistrySolver
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
const dictionary& dict_;
|
||||
chemistryModel& chemistry_;
|
||||
// Protected data
|
||||
|
||||
//- Reference to the chemistry model
|
||||
ODEChemistryModel<ThermoType>& model_;
|
||||
|
||||
|
||||
public:
|
||||
@ -73,35 +75,27 @@ public:
|
||||
chemistrySolver,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& dict,
|
||||
chemistryModel& chemistry
|
||||
ODEChemistryModel<ThermoType>& model
|
||||
),
|
||||
(dict, chemistry)
|
||||
(model)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
chemistrySolver
|
||||
(
|
||||
const dictionary& dict,
|
||||
chemistryModel& chemistry
|
||||
);
|
||||
chemistrySolver(ODEChemistryModel<ThermoType>& model);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
static autoPtr<chemistrySolver> New
|
||||
(
|
||||
const dictionary& dict,
|
||||
chemistryModel& chemistry
|
||||
);
|
||||
//- Selector
|
||||
static autoPtr<chemistrySolver> New
|
||||
(
|
||||
ODEChemistryModel<ThermoType>& model
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~chemistrySolver();
|
||||
//- Destructor
|
||||
virtual ~chemistrySolver();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -124,6 +118,34 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeChemistrySolver(Thermo) \
|
||||
\
|
||||
defineTemplateTypeNameAndDebug \
|
||||
( \
|
||||
chemistrySolver<Thermo>, \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
defineTemplateRunTimeSelectionTable(chemistrySolver<Thermo>, dictionary);
|
||||
|
||||
|
||||
#define makeChemistrySolverType(SS, Thermo) \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(SS<Thermo>, 0); \
|
||||
\
|
||||
chemistrySolver<Thermo>::adddictionaryConstructorToTable<SS<Thermo> > \
|
||||
add##SS##Thermo##ConstructorToTable_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "chemistrySolver.C"
|
||||
# include "newChemistrySolver.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "thermoPhysicsTypes.H"
|
||||
#include "chemistrySolver.H"
|
||||
|
||||
#include "EulerImplicit.H"
|
||||
#include "ode.H"
|
||||
#include "sequential.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeChemistrySolver(gasThermoPhysics)
|
||||
makeChemistrySolverType(EulerImplicit, gasThermoPhysics)
|
||||
makeChemistrySolverType(ode, gasThermoPhysics)
|
||||
makeChemistrySolverType(sequential, gasThermoPhysics)
|
||||
|
||||
makeChemistrySolver(icoPoly8ThermoPhysics)
|
||||
makeChemistrySolverType(EulerImplicit, icoPoly8ThermoPhysics)
|
||||
makeChemistrySolverType(ode, icoPoly8ThermoPhysics)
|
||||
makeChemistrySolverType(sequential, icoPoly8ThermoPhysics)
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -26,33 +26,33 @@ License
|
||||
|
||||
#include "chemistrySolver.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::chemistrySolver> Foam::chemistrySolver::New
|
||||
template<class ThermoType>
|
||||
Foam::autoPtr<Foam::chemistrySolver<ThermoType> >
|
||||
Foam::chemistrySolver<ThermoType>::New
|
||||
(
|
||||
const dictionary& dict,
|
||||
chemistryModel& chemistry
|
||||
ODEChemistryModel<ThermoType>& model
|
||||
)
|
||||
{
|
||||
word chemistrySolverType(dict.lookup("chemistrySolver"));
|
||||
word chemistrySolverType(model.chemistryModel::lookup("chemistrySolver"));
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
typename dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(chemistrySolverType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"chemistrySolver::New(const dictionary&, const chemistryModel&)"
|
||||
) << "Unknown chemistrySolverType type " << chemistrySolverType
|
||||
<< endl << endl
|
||||
<< "Valid chemistrySolverType types are :" << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
"chemistrySolver::New(const dictionary&, const ODEChemistryModel&)"
|
||||
) << "Unknown chemistrySolver type " << chemistrySolverType
|
||||
<< nl << nl
|
||||
<< "Valid chemistrySolver types are:" << nl
|
||||
<< dictionaryConstructorTablePtr_->toc() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<chemistrySolver>(cstrIter()(dict, chemistry));
|
||||
return autoPtr<chemistrySolver<ThermoType> >(cstrIter()(model));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,36 +25,17 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ode.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(ode, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
chemistrySolver,
|
||||
ode,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
#include "ODEChemistryModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::ode::ode
|
||||
(
|
||||
const Foam::dictionary& dict,
|
||||
Foam::chemistryModel& chemistry
|
||||
)
|
||||
template<class ThermoType>
|
||||
Foam::ode<ThermoType>::ode(ODEChemistryModel<ThermoType>& model)
|
||||
:
|
||||
chemistrySolver(dict, chemistry),
|
||||
chemistry_(chemistry),
|
||||
coeffsDict_(dict.subDict(typeName + "Coeffs")),
|
||||
chemistrySolver<ThermoType>(model),
|
||||
coeffsDict_(model.subDict(typeName + "Coeffs")),
|
||||
solverName_(coeffsDict_.lookup("ODESolver")),
|
||||
odeSolver_(ODESolver::New(solverName_, chemistry)),
|
||||
odeSolver_(ODESolver::New(solverName_, model)),
|
||||
eps_(readScalar(coeffsDict_.lookup("eps"))),
|
||||
scale_(readScalar(coeffsDict_.lookup("scale")))
|
||||
{}
|
||||
@ -62,14 +43,15 @@ Foam::ode::ode
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ode::~ode()
|
||||
template<class ThermoType>
|
||||
Foam::ode<ThermoType>::~ode()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Foam::scalar Foam::ode::solve
|
||||
template<class ThermoType>
|
||||
Foam::scalar Foam::ode<ThermoType>::solve
|
||||
(
|
||||
scalarField& c,
|
||||
const scalar T,
|
||||
@ -78,22 +60,22 @@ Foam::scalar Foam::ode::solve
|
||||
const scalar dt
|
||||
) const
|
||||
{
|
||||
label Ns = chemistry_.Ns();
|
||||
scalarField c1(chemistry_.nEqns(), 0.0);
|
||||
label nSpecie = this->model_.nSpecie();
|
||||
scalarField c1(this->model_.nEqns(), 0.0);
|
||||
|
||||
// copy the concentration, T and P to the total solve-vector
|
||||
for(label i=0; i<Ns; i++)
|
||||
for (label i=0; i<nSpecie; i++)
|
||||
{
|
||||
c1[i] = c[i];
|
||||
}
|
||||
c1[Ns] = T;
|
||||
c1[Ns+1] = p;
|
||||
c1[nSpecie] = T;
|
||||
c1[nSpecie+1] = p;
|
||||
|
||||
scalar dtEst = dt;
|
||||
|
||||
odeSolver_->solve
|
||||
(
|
||||
chemistry_,
|
||||
this->model_,
|
||||
t0,
|
||||
t0 + dt,
|
||||
c1,
|
||||
@ -101,7 +83,7 @@ Foam::scalar Foam::ode::solve
|
||||
dtEst
|
||||
);
|
||||
|
||||
for(label i=0; i<c.size(); i++)
|
||||
for (label i=0; i<c.size(); i++)
|
||||
{
|
||||
c[i] = max(0.0, c1[i]);
|
||||
}
|
||||
|
||||
@ -45,23 +45,22 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ode Declaration
|
||||
Class ode Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ThermoType>
|
||||
class ode
|
||||
:
|
||||
public chemistrySolver
|
||||
public chemistrySolver<ThermoType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
chemistryModel& chemistry_;
|
||||
|
||||
dictionary coeffsDict_;
|
||||
const word solverName_;
|
||||
autoPtr<ODESolver> odeSolver_;
|
||||
|
||||
// model constants
|
||||
|
||||
// Model constants
|
||||
|
||||
scalar eps_;
|
||||
scalar scale_;
|
||||
|
||||
@ -75,16 +74,11 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
ode
|
||||
(
|
||||
const dictionary& dict,
|
||||
chemistryModel& chemistry
|
||||
);
|
||||
ode(ODEChemistryModel<ThermoType>& model);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~ode();
|
||||
//- Destructor
|
||||
virtual ~ode();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -106,6 +100,12 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "ode.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -27,31 +27,13 @@ License
|
||||
#include "sequential.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(sequential, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
chemistrySolver,
|
||||
sequential,
|
||||
dictionary
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::sequential::sequential
|
||||
(
|
||||
const Foam::dictionary& dict,
|
||||
Foam::chemistryModel& chemistry
|
||||
)
|
||||
template<class ThermoType>
|
||||
Foam::sequential<ThermoType>::sequential(ODEChemistryModel<ThermoType>& model)
|
||||
:
|
||||
chemistrySolver(dict, chemistry),
|
||||
coeffsDict_(dict.subDict(typeName + "Coeffs")),
|
||||
chemistrySolver<ThermoType>(model),
|
||||
coeffsDict_(model.subDict(typeName + "Coeffs")),
|
||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||
equil_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
{}
|
||||
@ -59,13 +41,15 @@ Foam::sequential::sequential
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sequential::~sequential()
|
||||
template<class ThermoType>
|
||||
Foam::sequential<ThermoType>::~sequential()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::sequential::solve
|
||||
template<class ThermoType>
|
||||
Foam::scalar Foam::sequential<ThermoType>::solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
@ -79,11 +63,11 @@ Foam::scalar Foam::sequential::solve
|
||||
scalar pf, cf, pb, cb;
|
||||
label lRef, rRef;
|
||||
|
||||
for(label i=0; i<chemistry_.reactions().size(); i++)
|
||||
for (label i=0; i<this->model_.reactions().size(); i++)
|
||||
{
|
||||
const chemistryModel::reaction& R = chemistry_.reactions()[i];
|
||||
const Reaction<ThermoType>& R = this->model_.reactions()[i];
|
||||
|
||||
scalar om0 = chemistry_.omega
|
||||
scalar om0 = this->model_.omega
|
||||
(
|
||||
R, c, T, p, pf, cf, lRef, pb, cb, rRef
|
||||
);
|
||||
@ -108,23 +92,23 @@ Foam::scalar Foam::sequential::solve
|
||||
|
||||
|
||||
// update species
|
||||
for(label s=0; s<R.lhs().size(); s++)
|
||||
for (label s=0; s<R.lhs().size(); s++)
|
||||
{
|
||||
label si = R.lhs()[s].index;
|
||||
scalar sl = R.lhs()[s].stoichCoeff;
|
||||
c[si] -= dt*sl*omeg;
|
||||
c[si] = max(0.0, c[si]);
|
||||
}
|
||||
}
|
||||
|
||||
for(label s=0; s<R.rhs().size(); s++)
|
||||
for (label s=0; s<R.rhs().size(); s++)
|
||||
{
|
||||
label si = R.rhs()[s].index;
|
||||
scalar sr = R.rhs()[s].stoichCoeff;
|
||||
c[si] += dt*sr*omeg;
|
||||
c[si] = max(0.0, c[si]);
|
||||
}
|
||||
}
|
||||
|
||||
} // end for(label i...
|
||||
} // end for (label i...
|
||||
|
||||
return cTauChem_/tChemInv;
|
||||
}
|
||||
|
||||
@ -46,18 +46,19 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class sequential Declaration
|
||||
Class sequential Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ThermoType>
|
||||
class sequential
|
||||
:
|
||||
public chemistrySolver
|
||||
public chemistrySolver<ThermoType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
dictionary coeffsDict_;
|
||||
|
||||
// model constants
|
||||
// Model constants
|
||||
|
||||
scalar cTauChem_;
|
||||
Switch equil_;
|
||||
@ -73,16 +74,11 @@ public:
|
||||
|
||||
|
||||
//- Construct from components
|
||||
sequential
|
||||
(
|
||||
const dictionary& dict,
|
||||
chemistryModel& chemistry
|
||||
);
|
||||
sequential(ODEChemistryModel<ThermoType>& model);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~sequential();
|
||||
//- Destructor
|
||||
virtual ~sequential();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -105,6 +101,12 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "sequential.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
chemistryReaders/chemistryReader/chemistryReader.C
|
||||
chemistryReaders/foamChemistryReader/foamChemistryReader.C
|
||||
chemistryReaders/chemkinReader/chemkinReader.C
|
||||
chemistryReaders/chemkinReader/chemkinLexer.L
|
||||
chemistryReaders/chemkinReader/chemkinLexer.C
|
||||
chemistryReaders/chemistryReader/makeChemistryReaders.C
|
||||
|
||||
/* mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C */
|
||||
mixtures/reactingMixture/reactingMixture.C
|
||||
mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C
|
||||
|
||||
combustion/hCombustionThermo/hCombustionThermo.C
|
||||
combustion/hCombustionThermo/newhCombustionThermo.C
|
||||
@ -14,6 +12,11 @@ combustion/hhuCombustionThermo/hhuCombustionThermo.C
|
||||
combustion/hhuCombustionThermo/newhhuCombustionThermo.C
|
||||
combustion/hhuCombustionThermo/hhuCombustionThermos.C
|
||||
|
||||
reactionThermo/hReactionThermo/hReactionThermo.C
|
||||
reactionThermo/hReactionThermo/newhReactionThermo.C
|
||||
reactionThermo/hReactionThermo/hReactionThermos.C
|
||||
|
||||
|
||||
derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.C
|
||||
derivedFvPatchFields/gradientUnburntEnthalpy/gradientUnburntEnthalpyFvPatchScalarField.C
|
||||
derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField.C
|
||||
|
||||
@ -26,17 +26,11 @@ License
|
||||
|
||||
#include "chemistryReader.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(chemistryReader, 0);
|
||||
defineRunTimeSelectionTable(chemistryReader, dictionary);
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::chemistryReader> Foam::chemistryReader::New
|
||||
template<class ThermoType>
|
||||
Foam::autoPtr<Foam::chemistryReader<ThermoType> >
|
||||
Foam::chemistryReader<ThermoType>::New
|
||||
(
|
||||
const dictionary& thermoDict
|
||||
)
|
||||
@ -50,9 +44,8 @@ Foam::autoPtr<Foam::chemistryReader> Foam::chemistryReader::New
|
||||
|
||||
Info<< "Selecting chemistryReader " << chemistryReaderTypeName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_
|
||||
->find(chemistryReaderTypeName);
|
||||
typename dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(chemistryReaderTypeName);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
@ -60,13 +53,13 @@ Foam::autoPtr<Foam::chemistryReader> Foam::chemistryReader::New
|
||||
(
|
||||
"chemistryReader::New(const dictionary& thermoDict)"
|
||||
) << "Unknown chemistryReader type "
|
||||
<< chemistryReaderTypeName << endl << endl
|
||||
<< "Valid chemistryReaders are : " << endl
|
||||
<< chemistryReaderTypeName << nl << nl
|
||||
<< "Valid chemistryReaders are: " << nl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<chemistryReader>(cstrIter()(thermoDict));
|
||||
return autoPtr<chemistryReader<ThermoType> >(cstrIter()(thermoDict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -39,10 +39,6 @@ SourceFiles
|
||||
#include "typeInfo.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "Reaction.H"
|
||||
#include "sutherlandTransport.H"
|
||||
#include "specieThermo.H"
|
||||
#include "janafThermo.H"
|
||||
#include "perfectGas.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,23 +46,12 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class chemistryReader Declaration
|
||||
Class chemistryReader Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ThermoType>
|
||||
class chemistryReader
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Public data types
|
||||
|
||||
typedef sutherlandTransport<specieThermo<janafThermo<perfectGas> > >
|
||||
reactionThermo;
|
||||
|
||||
typedef Reaction<reactionThermo> reaction;
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -81,6 +66,9 @@ public:
|
||||
//- Runtime type information
|
||||
TypeName("chemistryReader");
|
||||
|
||||
//- The type of thermo package the reader was instantiated for
|
||||
typedef ThermoType thermoType;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -109,17 +97,18 @@ public:
|
||||
static autoPtr<chemistryReader> New(const dictionary& thermoDict);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~chemistryReader()
|
||||
{}
|
||||
//- Destructor
|
||||
virtual ~chemistryReader()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual const speciesTable& species() const = 0;
|
||||
virtual const HashPtrTable<reactionThermo>& speciesThermo() const = 0;
|
||||
virtual const SLPtrList<reaction>& reactions() const = 0;
|
||||
|
||||
virtual const HashPtrTable<ThermoType>& speciesThermo() const = 0;
|
||||
|
||||
virtual const SLPtrList<Reaction<ThermoType> >& reactions() const = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -129,6 +118,41 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeChemistryReader(Thermo) \
|
||||
\
|
||||
defineTemplateTypeNameAndDebug \
|
||||
( \
|
||||
chemistryReader<Thermo>, \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
defineTemplateRunTimeSelectionTable(chemistryReader<Thermo>, dictionary);
|
||||
|
||||
|
||||
#define makeChemistryReaderType(SS, Thermo) \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(SS<Thermo>, 0); \
|
||||
\
|
||||
chemistryReader<Thermo>::adddictionaryConstructorToTable<SS<Thermo> > \
|
||||
add##SS##Thermo##ConstructorToTable_;
|
||||
|
||||
|
||||
#define addChemistryReaderType(SS, Thermo) \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(SS, 0); \
|
||||
\
|
||||
chemistryReader<Thermo>::adddictionaryConstructorToTable<SS> \
|
||||
add##SS##Thermo##ConstructorToTable_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "chemistryReader.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "makeReactionThermo.H"
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
#include "chemistryReader.H"
|
||||
#include "foamChemistryReader.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makeChemistryReader(gasThermoPhysics);
|
||||
makeChemistryReader(icoPoly8ThermoPhysics);
|
||||
|
||||
makeChemistryReaderType(foamChemistryReader, gasThermoPhysics);
|
||||
makeChemistryReaderType(foamChemistryReader, icoPoly8ThermoPhysics);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,4 +1,4 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
@ -306,13 +306,13 @@ List<specieElement> currentSpecieComposition(5);
|
||||
scalar currentLowT = 0;
|
||||
scalar currentHighT = 0;
|
||||
scalar currentCommonT = 0;
|
||||
reactionThermo::coeffArray highCpCoeffs;
|
||||
reactionThermo::coeffArray lowCpCoeffs;
|
||||
gasThermoPhysics::coeffArray highCpCoeffs;
|
||||
gasThermoPhysics::coeffArray lowCpCoeffs;
|
||||
|
||||
reaction::specieCoeffs currentSpecieCoeff;
|
||||
gasReaction::specieCoeffs currentSpecieCoeff;
|
||||
|
||||
DynamicList<reaction::specieCoeffs> lhs;
|
||||
DynamicList<reaction::specieCoeffs> rhs;
|
||||
DynamicList<gasReaction::specieCoeffs> lhs;
|
||||
DynamicList<gasReaction::specieCoeffs> rhs;
|
||||
|
||||
scalarList ArrheniusCoeffs(3);
|
||||
DynamicList<scalar> reactionCoeffs;
|
||||
@ -322,7 +322,7 @@ label currentThirdBodyIndex = -1;
|
||||
word reactionCoeffsName = word::null;
|
||||
HashTable<scalarList> reactionCoeffsTable;
|
||||
|
||||
DynamicList<reaction::specieCoeffs> *lrhsPtr = &lhs;
|
||||
DynamicList<gasReaction::specieCoeffs> *lrhsPtr = &lhs;
|
||||
|
||||
reactionType rType = unknownReactionType;
|
||||
reactionRateType rrType = Arrhenius;
|
||||
@ -614,7 +614,7 @@ bool finishReaction = false;
|
||||
|
||||
<readThermoLineLabel4>{thermoLineLabel4} {
|
||||
|
||||
HashPtrTable<reactionThermo>::iterator specieThermoIter
|
||||
HashPtrTable<gasThermoPhysics>::iterator specieThermoIter
|
||||
(
|
||||
speciesThermo_.find(currentSpecieName)
|
||||
);
|
||||
@ -627,7 +627,7 @@ bool finishReaction = false;
|
||||
speciesThermo_.insert
|
||||
(
|
||||
currentSpecieName,
|
||||
new reactionThermo
|
||||
new gasThermoPhysics
|
||||
(
|
||||
janafThermo<perfectGas>
|
||||
(
|
||||
@ -863,7 +863,7 @@ bool finishReaction = false;
|
||||
{
|
||||
case unimolecularFallOffReactionType:
|
||||
{
|
||||
if (pDependentSpecieName.empty())
|
||||
if (!pDependentSpecieName.size())
|
||||
{
|
||||
FatalErrorIn("chemkinReader::lex()")
|
||||
<< "LOW keyword given for a unimolecular fall-off"
|
||||
@ -898,7 +898,7 @@ bool finishReaction = false;
|
||||
|
||||
case chemicallyActivatedBimolecularReactionType:
|
||||
{
|
||||
if (pDependentSpecieName.empty())
|
||||
if (!pDependentSpecieName.size())
|
||||
{
|
||||
FatalErrorIn("chemkinReader::lex()")
|
||||
<< "HIGH keyword given for a chemically"
|
||||
@ -935,7 +935,7 @@ bool finishReaction = false;
|
||||
|
||||
case TroeReactionType:
|
||||
{
|
||||
if (pDependentSpecieName.empty())
|
||||
if (!pDependentSpecieName.size())
|
||||
{
|
||||
FatalErrorIn("chemkinReader::lex()")
|
||||
<< "TROE keyword given for a"
|
||||
@ -969,7 +969,7 @@ bool finishReaction = false;
|
||||
|
||||
case SRIReactionType:
|
||||
{
|
||||
if (pDependentSpecieName.empty())
|
||||
if (!pDependentSpecieName.size())
|
||||
{
|
||||
FatalErrorIn("chemkinReader::lex()")
|
||||
<< "SRI keyword given for a"
|
||||
@ -1434,7 +1434,7 @@ bool finishReaction = false;
|
||||
|
||||
<readReactionOrder>{reactionCoeff}{endReactionCoeffs} {
|
||||
|
||||
DynamicList<reaction::specieCoeffs>& lrhs = *lrhsPtr;
|
||||
DynamicList<gasReaction::specieCoeffs>& lrhs = *lrhsPtr;
|
||||
|
||||
bool found = false;
|
||||
|
||||
@ -1535,5 +1535,5 @@ bool finishReaction = false;
|
||||
%%
|
||||
|
||||
/* ------------------------------------------------------------------------- *\
|
||||
------ End of STLToFoam.L
|
||||
------ End of chemkinLexer.L
|
||||
\* ------------------------------------------------------------------------- */
|
||||
|
||||
@ -46,8 +46,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(chemkinReader, 0);
|
||||
addToRunTimeSelectionTable(chemistryReader, chemkinReader, dictionary);
|
||||
addChemistryReaderType(chemkinReader, gasThermoPhysics);
|
||||
};
|
||||
|
||||
/* * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * */
|
||||
@ -164,8 +163,8 @@ template<class ReactionRateType>
|
||||
void Foam::chemkinReader::addReactionType
|
||||
(
|
||||
const reactionType rType,
|
||||
DynamicList<reaction::specieCoeffs>& lhs,
|
||||
DynamicList<reaction::specieCoeffs>& rhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& lhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& rhs,
|
||||
const ReactionRateType& rr
|
||||
)
|
||||
{
|
||||
@ -175,9 +174,9 @@ void Foam::chemkinReader::addReactionType
|
||||
{
|
||||
reactions_.append
|
||||
(
|
||||
new IrreversibleReaction<reactionThermo, ReactionRateType>
|
||||
new IrreversibleReaction<gasThermoPhysics, ReactionRateType>
|
||||
(
|
||||
Reaction<reactionThermo>
|
||||
Reaction<gasThermoPhysics>
|
||||
(
|
||||
speciesTable_,
|
||||
lhs.shrink(),
|
||||
@ -194,9 +193,9 @@ void Foam::chemkinReader::addReactionType
|
||||
{
|
||||
reactions_.append
|
||||
(
|
||||
new ReversibleReaction<reactionThermo, ReactionRateType>
|
||||
new ReversibleReaction<gasThermoPhysics, ReactionRateType>
|
||||
(
|
||||
Reaction<reactionThermo>
|
||||
Reaction<gasThermoPhysics>
|
||||
(
|
||||
speciesTable_,
|
||||
lhs.shrink(),
|
||||
@ -234,8 +233,8 @@ void Foam::chemkinReader::addPressureDependentReaction
|
||||
(
|
||||
const reactionType rType,
|
||||
const fallOffFunctionType fofType,
|
||||
DynamicList<reaction::specieCoeffs>& lhs,
|
||||
DynamicList<reaction::specieCoeffs>& rhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& lhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& rhs,
|
||||
const scalarList& efficiencies,
|
||||
const scalarList& k0Coeffs,
|
||||
const scalarList& kInfCoeffs,
|
||||
@ -417,8 +416,8 @@ void Foam::chemkinReader::addPressureDependentReaction
|
||||
|
||||
void Foam::chemkinReader::addReaction
|
||||
(
|
||||
DynamicList<reaction::specieCoeffs>& lhs,
|
||||
DynamicList<reaction::specieCoeffs>& rhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& lhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& rhs,
|
||||
const scalarList& efficiencies,
|
||||
const reactionType rType,
|
||||
const reactionRateType rrType,
|
||||
@ -493,9 +492,9 @@ void Foam::chemkinReader::addReaction
|
||||
reactions_.append
|
||||
(
|
||||
new NonEquilibriumReversibleReaction
|
||||
<reactionThermo, ArrheniusReactionRate>
|
||||
<gasThermoPhysics, ArrheniusReactionRate>
|
||||
(
|
||||
Reaction<reactionThermo>
|
||||
Reaction<gasThermoPhysics>
|
||||
(
|
||||
speciesTable_,
|
||||
lhs.shrink(),
|
||||
@ -546,9 +545,9 @@ void Foam::chemkinReader::addReaction
|
||||
reactions_.append
|
||||
(
|
||||
new NonEquilibriumReversibleReaction
|
||||
<reactionThermo, thirdBodyArrheniusReactionRate>
|
||||
<gasThermoPhysics, thirdBodyArrheniusReactionRate>
|
||||
(
|
||||
Reaction<reactionThermo>
|
||||
Reaction<gasThermoPhysics>
|
||||
(
|
||||
speciesTable_,
|
||||
lhs.shrink(),
|
||||
@ -651,9 +650,9 @@ void Foam::chemkinReader::addReaction
|
||||
reactions_.append
|
||||
(
|
||||
new NonEquilibriumReversibleReaction
|
||||
<reactionThermo, LandauTellerReactionRate>
|
||||
<gasThermoPhysics, LandauTellerReactionRate>
|
||||
(
|
||||
Reaction<reactionThermo>
|
||||
Reaction<gasThermoPhysics>
|
||||
(
|
||||
speciesTable_,
|
||||
lhs.shrink(),
|
||||
@ -797,7 +796,7 @@ void Foam::chemkinReader::read
|
||||
const fileName& thermoFileName
|
||||
)
|
||||
{
|
||||
if (thermoFileName.size())
|
||||
if (thermoFileName != fileName::null)
|
||||
{
|
||||
std::ifstream thermoStream(thermoFileName.c_str());
|
||||
|
||||
|
||||
@ -47,6 +47,8 @@ SourceFiles
|
||||
#include "speciesTable.H"
|
||||
#include "atomicWeights.H"
|
||||
|
||||
#include "reactionTypes.H"
|
||||
|
||||
#include <FlexLexer.h>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -55,12 +57,12 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class chemkin Declaration
|
||||
Class chemkinReader Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class chemkinReader
|
||||
:
|
||||
public chemistryReader,
|
||||
public chemistryReader<gasThermoPhysics>,
|
||||
public yyFlexLexer
|
||||
{
|
||||
|
||||
@ -198,13 +200,13 @@ private:
|
||||
HashTable<phase> speciePhase_;
|
||||
|
||||
//- Table of the thermodynamic data given in the CHEMKIN file
|
||||
HashPtrTable<reactionThermo> speciesThermo_;
|
||||
HashPtrTable<gasThermoPhysics> speciesThermo_;
|
||||
|
||||
//- Table of species composition
|
||||
HashTable<List<specieElement> > specieComposition_;
|
||||
|
||||
//- List of the reactions
|
||||
SLPtrList<reaction> reactions_;
|
||||
SLPtrList<gasReaction> reactions_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -256,8 +258,8 @@ private:
|
||||
void addReactionType
|
||||
(
|
||||
const reactionType rType,
|
||||
DynamicList<reaction::specieCoeffs>& lhs,
|
||||
DynamicList<reaction::specieCoeffs>& rhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& lhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& rhs,
|
||||
const ReactionRateType& rr
|
||||
);
|
||||
|
||||
@ -266,8 +268,8 @@ private:
|
||||
(
|
||||
const reactionType rType,
|
||||
const fallOffFunctionType fofType,
|
||||
DynamicList<reaction::specieCoeffs>& lhs,
|
||||
DynamicList<reaction::specieCoeffs>& rhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& lhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& rhs,
|
||||
const scalarList& thirdBodyEfficiencies,
|
||||
const scalarList& k0Coeffs,
|
||||
const scalarList& kInfCoeffs,
|
||||
@ -279,8 +281,8 @@ private:
|
||||
|
||||
void addReaction
|
||||
(
|
||||
DynamicList<reaction::specieCoeffs>& lhs,
|
||||
DynamicList<reaction::specieCoeffs>& rhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& lhs,
|
||||
DynamicList<gasReaction::specieCoeffs>& rhs,
|
||||
const scalarList& thirdBodyEfficiencies,
|
||||
const reactionType rType,
|
||||
const reactionRateType rrType,
|
||||
@ -363,7 +365,7 @@ public:
|
||||
}
|
||||
|
||||
//- Table of the thermodynamic data given in the CHEMKIN file
|
||||
const HashPtrTable<reactionThermo>& speciesThermo() const
|
||||
const HashPtrTable<gasThermoPhysics>& speciesThermo() const
|
||||
{
|
||||
return speciesThermo_;
|
||||
}
|
||||
@ -375,7 +377,7 @@ public:
|
||||
}
|
||||
|
||||
//- List of the reactions
|
||||
const SLPtrList<reaction>& reactions() const
|
||||
const SLPtrList<gasReaction>& reactions() const
|
||||
{
|
||||
return reactions_;
|
||||
}
|
||||
|
||||
@ -28,36 +28,33 @@ License
|
||||
#include "IFstream.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
/* * * * * * * * * * * * * * * * * Static data * * * * * * * * * * * * * * * */
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(foamChemistryReader, 0);
|
||||
addToRunTimeSelectionTable(chemistryReader, foamChemistryReader, dictionary);
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::foamChemistryReader::foamChemistryReader
|
||||
template<class ThermoType>
|
||||
Foam::foamChemistryReader<ThermoType>::foamChemistryReader
|
||||
(
|
||||
const fileName& reactionsFileName,
|
||||
const fileName& thermoFileName
|
||||
)
|
||||
:
|
||||
chemistryReader<ThermoType>(),
|
||||
speciesThermo_(IFstream(thermoFileName)()),
|
||||
speciesTable_(dictionary(IFstream(reactionsFileName)()).lookup("species")),
|
||||
reactions_
|
||||
(
|
||||
dictionary(IFstream(reactionsFileName)()).lookup("reactions"),
|
||||
reaction::iNew(speciesTable_, speciesThermo_)
|
||||
Reaction<ThermoType>::iNew(speciesTable_, speciesThermo_)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from components
|
||||
Foam::foamChemistryReader::foamChemistryReader(const dictionary& thermoDict)
|
||||
template<class ThermoType>
|
||||
Foam::foamChemistryReader<ThermoType>::foamChemistryReader
|
||||
(
|
||||
const dictionary& thermoDict
|
||||
)
|
||||
:
|
||||
chemistryReader<ThermoType>(),
|
||||
speciesThermo_
|
||||
(
|
||||
IFstream
|
||||
@ -84,7 +81,7 @@ Foam::foamChemistryReader::foamChemistryReader(const dictionary& thermoDict)
|
||||
fileName(thermoDict.lookup("foamChemistryFile")).expand()
|
||||
)()
|
||||
).lookup("reactions"),
|
||||
reaction::iNew(speciesTable_, speciesThermo_)
|
||||
typename Reaction<ThermoType>::iNew(speciesTable_, speciesThermo_)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -51,21 +51,22 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class foamChemistry Declaration
|
||||
Class foamChemistry Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ThermoType>
|
||||
class foamChemistryReader
|
||||
:
|
||||
public chemistryReader
|
||||
public chemistryReader<ThermoType>
|
||||
{
|
||||
//- Table of the thermodynamic data given in the foamChemistry file
|
||||
HashPtrTable<reactionThermo> speciesThermo_;
|
||||
HashPtrTable<ThermoType> speciesThermo_;
|
||||
|
||||
//- Table of species
|
||||
speciesTable speciesTable_;
|
||||
|
||||
//- List of the reactions
|
||||
SLPtrList<reaction> reactions_;
|
||||
SLPtrList<Reaction<ThermoType> > reactions_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -97,10 +98,9 @@ public:
|
||||
foamChemistryReader(const dictionary& thermoDict);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~foamChemistryReader()
|
||||
{}
|
||||
//- Destructor
|
||||
virtual ~foamChemistryReader()
|
||||
{}
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -112,13 +112,13 @@ public:
|
||||
}
|
||||
|
||||
//- Table of the thermodynamic data given in the foamChemistry file
|
||||
const HashPtrTable<reactionThermo>& speciesThermo() const
|
||||
const HashPtrTable<ThermoType>& speciesThermo() const
|
||||
{
|
||||
return speciesThermo_;
|
||||
}
|
||||
|
||||
//- List of the reactions
|
||||
const SLPtrList<reaction>& reactions() const
|
||||
const SLPtrList<Reaction<ThermoType> >& reactions() const
|
||||
{
|
||||
return reactions_;
|
||||
}
|
||||
@ -131,6 +131,12 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "foamChemistryReader.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -25,7 +25,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "hCombustionThermo.H"
|
||||
#include "hMixtureThermo.H"
|
||||
#include "hPsiMixtureThermo.H"
|
||||
|
||||
#include "makeCombustionThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
@ -46,7 +46,7 @@ License
|
||||
#include "multiComponentMixture.H"
|
||||
#include "reactingMixture.H"
|
||||
|
||||
#include "transportTypes.H"
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -58,7 +58,7 @@ namespace Foam
|
||||
makeCombustionThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hMixtureThermo,
|
||||
hPsiMixtureThermo,
|
||||
homogeneousMixture,
|
||||
constTransport,
|
||||
hConstThermo,
|
||||
@ -68,7 +68,7 @@ makeCombustionThermo
|
||||
makeCombustionThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hMixtureThermo,
|
||||
hPsiMixtureThermo,
|
||||
inhomogeneousMixture,
|
||||
constTransport,
|
||||
hConstThermo,
|
||||
@ -78,7 +78,7 @@ makeCombustionThermo
|
||||
makeCombustionThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hMixtureThermo,
|
||||
hPsiMixtureThermo,
|
||||
veryInhomogeneousMixture,
|
||||
constTransport,
|
||||
hConstThermo,
|
||||
@ -88,7 +88,7 @@ makeCombustionThermo
|
||||
makeCombustionThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hMixtureThermo,
|
||||
hPsiMixtureThermo,
|
||||
homogeneousMixture,
|
||||
sutherlandTransport,
|
||||
janafThermo,
|
||||
@ -98,7 +98,7 @@ makeCombustionThermo
|
||||
makeCombustionThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hMixtureThermo,
|
||||
hPsiMixtureThermo,
|
||||
inhomogeneousMixture,
|
||||
sutherlandTransport,
|
||||
janafThermo,
|
||||
@ -108,7 +108,7 @@ makeCombustionThermo
|
||||
makeCombustionThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hMixtureThermo,
|
||||
hPsiMixtureThermo,
|
||||
veryInhomogeneousMixture,
|
||||
sutherlandTransport,
|
||||
janafThermo,
|
||||
@ -118,32 +118,21 @@ makeCombustionThermo
|
||||
makeCombustionThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hMixtureThermo,
|
||||
hPsiMixtureThermo,
|
||||
dieselMixture,
|
||||
sutherlandTransport,
|
||||
janafThermo,
|
||||
perfectGas
|
||||
);
|
||||
|
||||
makeCombustionThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hMixtureThermo,
|
||||
multiComponentMixture,
|
||||
sutherlandTransport,
|
||||
janafThermo,
|
||||
perfectGas
|
||||
);
|
||||
|
||||
|
||||
// Multi-component thermo
|
||||
|
||||
makeCombustionMixtureThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hMixtureThermo,
|
||||
hPsiMixtureThermo,
|
||||
multiComponentMixture,
|
||||
gasTransport
|
||||
gasThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
@ -152,9 +141,9 @@ makeCombustionMixtureThermo
|
||||
makeCombustionMixtureThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hMixtureThermo,
|
||||
hPsiMixtureThermo,
|
||||
reactingMixture,
|
||||
gasTransport
|
||||
gasThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -24,49 +24,14 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "hMixtureThermo.H"
|
||||
#include "hPsiMixtureThermo.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::hMixtureThermo<MixtureType>::hMixtureThermo(const fvMesh& mesh)
|
||||
:
|
||||
hCombustionThermo(mesh),
|
||||
MixtureType(*this, mesh)
|
||||
{
|
||||
scalarField& hCells = h_.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
|
||||
forAll(hCells, celli)
|
||||
{
|
||||
hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(h_.boundaryField(), patchi)
|
||||
{
|
||||
h_.boundaryField()[patchi] == h(T_.boundaryField()[patchi], patchi);
|
||||
}
|
||||
|
||||
hBoundaryCorrection(h_);
|
||||
|
||||
calculate();
|
||||
psi_.oldTime(); // Switch on saving old time
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::hMixtureThermo<MixtureType>::~hMixtureThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
void Foam::hMixtureThermo<MixtureType>::calculate()
|
||||
void Foam::hPsiMixtureThermo<MixtureType>::calculate()
|
||||
{
|
||||
const scalarField& hCells = h_.internalField();
|
||||
const scalarField& pCells = p_.internalField();
|
||||
@ -131,14 +96,51 @@ void Foam::hMixtureThermo<MixtureType>::calculate()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::hPsiMixtureThermo<MixtureType>::hPsiMixtureThermo(const fvMesh& mesh)
|
||||
:
|
||||
hCombustionThermo(mesh),
|
||||
MixtureType(*this, mesh)
|
||||
{
|
||||
scalarField& hCells = h_.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
|
||||
forAll(hCells, celli)
|
||||
{
|
||||
hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(h_.boundaryField(), patchi)
|
||||
{
|
||||
h_.boundaryField()[patchi] == h(T_.boundaryField()[patchi], patchi);
|
||||
}
|
||||
|
||||
hBoundaryCorrection(h_);
|
||||
|
||||
calculate();
|
||||
|
||||
// Switch on saving old time
|
||||
psi_.oldTime();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::hPsiMixtureThermo<MixtureType>::~hPsiMixtureThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
void Foam::hMixtureThermo<MixtureType>::correct()
|
||||
void Foam::hPsiMixtureThermo<MixtureType>::correct()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "entering hMixtureThermo<MixtureType>::correct()" << endl;
|
||||
Info<< "entering hPsiMixtureThermo<MixtureType>::correct()" << endl;
|
||||
}
|
||||
|
||||
// force the saving of the old-time values
|
||||
@ -148,14 +150,14 @@ void Foam::hMixtureThermo<MixtureType>::correct()
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "exiting hMixtureThermo<MixtureType>::correct()" << endl;
|
||||
Info<< "exiting hPsiMixtureThermo<MixtureType>::correct()" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hMixtureThermo<MixtureType>::hs() const
|
||||
Foam::hPsiMixtureThermo<MixtureType>::hs() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
@ -202,7 +204,7 @@ Foam::hMixtureThermo<MixtureType>::hs() const
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hMixtureThermo<MixtureType>::hc() const
|
||||
Foam::hPsiMixtureThermo<MixtureType>::hc() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
@ -247,7 +249,7 @@ Foam::hMixtureThermo<MixtureType>::hc() const
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::hMixtureThermo<MixtureType>::h
|
||||
Foam::hPsiMixtureThermo<MixtureType>::h
|
||||
(
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
@ -267,7 +269,7 @@ Foam::hMixtureThermo<MixtureType>::h
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::hMixtureThermo<MixtureType>::h
|
||||
Foam::hPsiMixtureThermo<MixtureType>::h
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
@ -287,7 +289,7 @@ Foam::hMixtureThermo<MixtureType>::h
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::hMixtureThermo<MixtureType>::Cp
|
||||
Foam::hPsiMixtureThermo<MixtureType>::Cp
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
@ -308,7 +310,7 @@ Foam::hMixtureThermo<MixtureType>::Cp
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hMixtureThermo<MixtureType>::Cp() const
|
||||
Foam::hPsiMixtureThermo<MixtureType>::Cp() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
@ -349,7 +351,7 @@ Foam::hMixtureThermo<MixtureType>::Cp() const
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
bool Foam::hMixtureThermo<MixtureType>::read()
|
||||
bool Foam::hPsiMixtureThermo<MixtureType>::read()
|
||||
{
|
||||
if (hCombustionThermo::read())
|
||||
{
|
||||
@ -23,18 +23,18 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::hMixtureThermo
|
||||
Foam::hPsiMixtureThermo
|
||||
|
||||
Description
|
||||
Foam::hMixtureThermo
|
||||
Foam::hPsiMixtureThermo
|
||||
|
||||
SourceFiles
|
||||
hMixtureThermo.C
|
||||
hPsiMixtureThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef hMixtureThermo_H
|
||||
#define hMixtureThermo_H
|
||||
#ifndef hPsiMixtureThermo_H
|
||||
#define hPsiMixtureThermo_H
|
||||
|
||||
#include "hCombustionThermo.H"
|
||||
|
||||
@ -44,11 +44,11 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class hMixtureThermo Declaration
|
||||
Class hPsiMixtureThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class MixtureType>
|
||||
class hMixtureThermo
|
||||
class hPsiMixtureThermo
|
||||
:
|
||||
public hCombustionThermo,
|
||||
public MixtureType
|
||||
@ -58,23 +58,23 @@ class hMixtureThermo
|
||||
void calculate();
|
||||
|
||||
//- Construct as copy (not implemented)
|
||||
hMixtureThermo(const hMixtureThermo<MixtureType>&);
|
||||
hPsiMixtureThermo(const hPsiMixtureThermo<MixtureType>&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("hMixtureThermo");
|
||||
TypeName("hPsiMixtureThermo");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
hMixtureThermo(const fvMesh&);
|
||||
hPsiMixtureThermo(const fvMesh&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~hMixtureThermo();
|
||||
virtual ~hPsiMixtureThermo();
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -140,7 +140,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "hMixtureThermo.C"
|
||||
# include "hPsiMixtureThermo.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -36,7 +36,7 @@ SourceFiles
|
||||
#ifndef hhuMixtureThermo_H
|
||||
#define hhuMixtureThermo_H
|
||||
|
||||
#include "hMixtureThermo.H"
|
||||
//#include "hPsiMixtureThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -29,32 +29,38 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::reactingMixture::reactingMixture
|
||||
template<class ThermoType>
|
||||
Foam::reactingMixture<ThermoType>::reactingMixture
|
||||
(
|
||||
const dictionary& thermoDict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
autoPtr<chemistryReader>(chemistryReader::New(thermoDict)),
|
||||
multiComponentMixture<chemistryReader::reactionThermo>
|
||||
autoPtr<chemistryReader<ThermoType> >
|
||||
(
|
||||
chemistryReader<ThermoType>::New(thermoDict)
|
||||
),
|
||||
multiComponentMixture<ThermoType>
|
||||
(
|
||||
thermoDict,
|
||||
autoPtr<chemistryReader>::operator()().species(),
|
||||
autoPtr<chemistryReader>::operator()().speciesThermo(),
|
||||
autoPtr<chemistryReader<ThermoType> >::operator()().species(),
|
||||
autoPtr<chemistryReader<ThermoType> >::operator()().speciesThermo(),
|
||||
mesh
|
||||
),
|
||||
PtrList<chemistryReader::reaction>
|
||||
PtrList<Reaction<ThermoType> >
|
||||
(
|
||||
autoPtr<chemistryReader>::operator()().reactions(), species_
|
||||
autoPtr<chemistryReader<ThermoType> >::operator()().reactions(),
|
||||
this->species_
|
||||
)
|
||||
{
|
||||
autoPtr<chemistryReader>::clear();
|
||||
autoPtr<chemistryReader<ThermoType> >::clear();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::reactingMixture::read(const dictionary& thermoDict)
|
||||
template<class ThermoType>
|
||||
void Foam::reactingMixture<ThermoType>::read(const dictionary& thermoDict)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -48,21 +48,13 @@ namespace Foam
|
||||
Class reactingMixture Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ThermoType>
|
||||
class reactingMixture
|
||||
:
|
||||
public autoPtr<chemistryReader>,
|
||||
public multiComponentMixture<chemistryReader::reactionThermo>,
|
||||
public PtrList<chemistryReader::reaction>
|
||||
public autoPtr<chemistryReader<ThermoType> >,
|
||||
public multiComponentMixture<ThermoType>,
|
||||
public PtrList<Reaction<ThermoType> >
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef chemistryReader::reaction reaction;
|
||||
typedef chemistryReader::reactionThermo reactionThermo;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -74,6 +66,10 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
//- The type of thermo package this mixture is instantiated for
|
||||
typedef ThermoType thermoType;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary and mesh
|
||||
@ -98,6 +94,12 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "reactingMixture.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "hReactionThermo.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(hReactionThermo, 0);
|
||||
defineRunTimeSelectionTable(hReactionThermo, fvMesh);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::hReactionThermo::hReactionThermo(const fvMesh& mesh)
|
||||
:
|
||||
basicRhoThermo(mesh),
|
||||
|
||||
h_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"h",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionSet(0, 2, -2, 0, 0),
|
||||
this->hBoundaryTypes()
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::hReactionThermo::~hReactionThermo()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,141 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::hReactionThermo
|
||||
|
||||
Description
|
||||
Foam::hReactionThermo
|
||||
|
||||
SourceFiles
|
||||
hReactionThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef hReactionThermo_H
|
||||
#define hReactionThermo_H
|
||||
|
||||
#include "basicRhoThermo.H"
|
||||
#include "basicMultiComponentMixture.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class hReactionThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class hReactionThermo
|
||||
:
|
||||
public basicRhoThermo
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Enthalpy field
|
||||
volScalarField h_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("hReactionThermo");
|
||||
|
||||
|
||||
//- Declare run-time constructor selection tables
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
hReactionThermo,
|
||||
fvMesh,
|
||||
(const fvMesh& mesh),
|
||||
(mesh)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary and mesh
|
||||
hReactionThermo(const fvMesh&);
|
||||
|
||||
|
||||
//- Selector
|
||||
static autoPtr<hReactionThermo> New(const fvMesh&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~hReactionThermo();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the composition of the multi-component mixture
|
||||
virtual basicMultiComponentMixture& composition() = 0;
|
||||
|
||||
//- Return the composition of the multi-component mixture
|
||||
virtual const basicMultiComponentMixture& composition() const = 0;
|
||||
|
||||
|
||||
// Access to thermodynamic state variables
|
||||
|
||||
//- 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_;
|
||||
}
|
||||
|
||||
|
||||
//- Sensible enthalpy [J/kg]
|
||||
virtual tmp<volScalarField> hs() const = 0;
|
||||
|
||||
//- Chemical enthalpy [J/kg]
|
||||
virtual tmp<volScalarField> hc() const = 0;
|
||||
|
||||
//- Update properties
|
||||
virtual void correct() = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,71 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "hReactionThermo.H"
|
||||
#include "hRhoMixtureThermo.H"
|
||||
|
||||
#include "makeReactionThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
#include "multiComponentMixture.H"
|
||||
#include "reactingMixture.H"
|
||||
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Multi-component thermo
|
||||
|
||||
makeReactionMixtureThermo
|
||||
(
|
||||
hReactionThermo,
|
||||
hRhoMixtureThermo,
|
||||
multiComponentMixture,
|
||||
icoPoly8ThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// Multi-component reaction thermo
|
||||
|
||||
makeReactionMixtureThermo
|
||||
(
|
||||
hReactionThermo,
|
||||
hRhoMixtureThermo,
|
||||
reactingMixture,
|
||||
icoPoly8ThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,96 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
InClass
|
||||
Foam::hReactionThermo
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef makeReactionThermo_H
|
||||
#define makeReactionThermo_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeReactionThermo(CThermo,MixtureThermo,Mixture,Transport,Thermo,EqnOfState) \
|
||||
\
|
||||
typedef MixtureThermo \
|
||||
<Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \
|
||||
MixtureThermo##Mixture##Transport##Thermo##EqnOfState; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
|
||||
#MixtureThermo \
|
||||
"<"#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>>", \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
basicThermo, \
|
||||
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
|
||||
fvMesh \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
CThermo, \
|
||||
MixtureThermo##Mixture##Transport##Thermo##EqnOfState, \
|
||||
fvMesh \
|
||||
)
|
||||
|
||||
|
||||
#define makeReactionMixtureThermo(CThermo,MixtureThermo,Mixture,Transport) \
|
||||
\
|
||||
typedef MixtureThermo<Mixture<Transport> > MixtureThermo##Mixture##Transport; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
MixtureThermo##Mixture##Transport, \
|
||||
#MixtureThermo"<"#Mixture"<"#Transport">>", \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
basicThermo, \
|
||||
MixtureThermo##Mixture##Transport, \
|
||||
fvMesh \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
CThermo, \
|
||||
MixtureThermo##Mixture##Transport, \
|
||||
fvMesh \
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,78 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "hReactionThermo.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::hReactionThermo> Foam::hReactionThermo::New
|
||||
(
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
word hReactionThermoTypeName;
|
||||
|
||||
// Enclose the creation of the thermophysicalProperties to ensure it is
|
||||
// deleted before the turbulenceModel is created otherwise the dictionary
|
||||
// is entered in the database twice
|
||||
{
|
||||
IOdictionary thermoDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermophysicalProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
thermoDict.lookup("thermoType") >> hReactionThermoTypeName;
|
||||
}
|
||||
|
||||
Info<< "Selecting thermodynamics package " << hReactionThermoTypeName
|
||||
<< endl;
|
||||
|
||||
fvMeshConstructorTable::iterator cstrIter =
|
||||
fvMeshConstructorTablePtr_->find(hReactionThermoTypeName);
|
||||
|
||||
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn("hReactionThermo::New(const fvMesh&)")
|
||||
<< "Unknown hReactionThermo type "
|
||||
<< hReactionThermoTypeName << nl << nl
|
||||
<< "Valid hReactionThermo types are:" << nl
|
||||
<< fvMeshConstructorTablePtr_->toc() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<hReactionThermo>(cstrIter()(mesh));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,367 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "hRhoMixtureThermo.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
void Foam::hRhoMixtureThermo<MixtureType>::calculate()
|
||||
{
|
||||
const scalarField& hCells = h_.internalField();
|
||||
const scalarField& pCells = p_.internalField();
|
||||
|
||||
scalarField& TCells = T_.internalField();
|
||||
scalarField& psiCells = psi_.internalField();
|
||||
scalarField& rhoCells = rho_.internalField();
|
||||
scalarField& muCells = mu_.internalField();
|
||||
scalarField& alphaCells = alpha_.internalField();
|
||||
|
||||
forAll(TCells, celli)
|
||||
{
|
||||
const typename MixtureType::thermoType& mixture_ =
|
||||
this->cellMixture(celli);
|
||||
|
||||
TCells[celli] = mixture_.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(T_.boundaryField(), patchi)
|
||||
{
|
||||
fvPatchScalarField& pp = p_.boundaryField()[patchi];
|
||||
fvPatchScalarField& pT = T_.boundaryField()[patchi];
|
||||
fvPatchScalarField& ppsi = psi_.boundaryField()[patchi];
|
||||
fvPatchScalarField& prho = rho_.boundaryField()[patchi];
|
||||
|
||||
fvPatchScalarField& ph = h_.boundaryField()[patchi];
|
||||
|
||||
fvPatchScalarField& pmu_ = mu_.boundaryField()[patchi];
|
||||
fvPatchScalarField& palpha_ = alpha_.boundaryField()[patchi];
|
||||
|
||||
if (pT.fixesValue())
|
||||
{
|
||||
forAll(pT, facei)
|
||||
{
|
||||
const typename MixtureType::thermoType& mixture_ =
|
||||
this->patchFaceMixture(patchi, facei);
|
||||
|
||||
ph[facei] = mixture_.H(pT[facei]);
|
||||
|
||||
ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
|
||||
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::hRhoMixtureThermo<MixtureType>::hRhoMixtureThermo(const fvMesh& mesh)
|
||||
:
|
||||
hReactionThermo(mesh),
|
||||
MixtureType(*this, mesh)
|
||||
{
|
||||
scalarField& hCells = h_.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
|
||||
forAll(hCells, celli)
|
||||
{
|
||||
hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(h_.boundaryField(), patchi)
|
||||
{
|
||||
h_.boundaryField()[patchi] == h(T_.boundaryField()[patchi], patchi);
|
||||
}
|
||||
|
||||
hBoundaryCorrection(h_);
|
||||
|
||||
calculate();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::hRhoMixtureThermo<MixtureType>::~hRhoMixtureThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class MixtureType>
|
||||
void Foam::hRhoMixtureThermo<MixtureType>::correct()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "entering hRhoMixtureThermo<MixtureType>::correct()" << endl;
|
||||
}
|
||||
|
||||
calculate();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "exiting hRhoMixtureThermo<MixtureType>::correct()" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hRhoMixtureThermo<MixtureType>::hs() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
tmp<volScalarField> ths
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"hs",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
h_.dimensions()
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& hsf = ths();
|
||||
scalarField& hsCells = hsf.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
|
||||
forAll(TCells, celli)
|
||||
{
|
||||
hsCells[celli] = this->cellMixture(celli).Hs(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(T_.boundaryField(), patchi)
|
||||
{
|
||||
scalarField& hsp = hsf.boundaryField()[patchi];
|
||||
const scalarField& Tp = T_.boundaryField()[patchi];
|
||||
|
||||
forAll(Tp, facei)
|
||||
{
|
||||
hsp[facei] = this->patchFaceMixture(patchi, facei).Hs(Tp[facei]);
|
||||
}
|
||||
}
|
||||
|
||||
return ths;
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::hRhoMixtureThermo<MixtureType>::hc() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
tmp<volScalarField> thc
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"hc",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
h_.dimensions()
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& hcf = thc();
|
||||
scalarField& hcCells = hcf.internalField();
|
||||
|
||||
forAll(hcCells, celli)
|
||||
{
|
||||
hcCells[celli] = this->cellMixture(celli).Hc();
|
||||
}
|
||||
|
||||
forAll(hcf.boundaryField(), patchi)
|
||||
{
|
||||
scalarField& hcp = hcf.boundaryField()[patchi];
|
||||
|
||||
forAll(hcp, facei)
|
||||
{
|
||||
hcp[facei] = this->patchFaceMixture(patchi, facei).Hc();
|
||||
}
|
||||
}
|
||||
|
||||
return thc;
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::hRhoMixtureThermo<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::hRhoMixtureThermo<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::hRhoMixtureThermo<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::hRhoMixtureThermo<MixtureType>::Cp() const
|
||||
{
|
||||
const fvMesh& mesh = T_.mesh();
|
||||
|
||||
tmp<volScalarField> tCp
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Cp",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionSet(0, 2, -2, -1, 0)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& cp = tCp();
|
||||
|
||||
scalarField& cpCells = cp.internalField();
|
||||
const scalarField& TCells = T_.internalField();
|
||||
|
||||
forAll(TCells, celli)
|
||||
{
|
||||
cpCells[celli] = this->cellMixture(celli).Cp(TCells[celli]);
|
||||
}
|
||||
|
||||
forAll(T_.boundaryField(), patchi)
|
||||
{
|
||||
cp.boundaryField()[patchi] = Cp(T_.boundaryField()[patchi], patchi);
|
||||
}
|
||||
|
||||
return tCp;
|
||||
}
|
||||
|
||||
|
||||
template<class MixtureType>
|
||||
bool Foam::hRhoMixtureThermo<MixtureType>::read()
|
||||
{
|
||||
if (hReactionThermo::read())
|
||||
{
|
||||
MixtureType::read(*this);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,150 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::hRhoMixtureThermo
|
||||
|
||||
Description
|
||||
Foam::hRhoMixtureThermo
|
||||
|
||||
SourceFiles
|
||||
hRhoMixtureThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef hRhoMixtureThermo_H
|
||||
#define hRhoMixtureThermo_H
|
||||
|
||||
#include "hReactionThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class hRhoMixtureThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class MixtureType>
|
||||
class hRhoMixtureThermo
|
||||
:
|
||||
public hReactionThermo,
|
||||
public MixtureType
|
||||
{
|
||||
// Private member functions
|
||||
|
||||
void calculate();
|
||||
|
||||
//- Construct as copy (not implemented)
|
||||
hRhoMixtureThermo(const hRhoMixtureThermo<MixtureType>&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("hRhoMixtureThermo");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
hRhoMixtureThermo(const fvMesh&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~hRhoMixtureThermo();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the compostion of the multi-component mixture
|
||||
virtual basicMultiComponentMixture& composition()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- Return the compostion of the multi-component mixture
|
||||
virtual const basicMultiComponentMixture& composition() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- Update properties
|
||||
virtual void correct();
|
||||
|
||||
//- Sensible enthalpy [J/kg]
|
||||
virtual tmp<volScalarField> hs() const;
|
||||
|
||||
//- Chemical enthalpy [J/kg]
|
||||
virtual tmp<volScalarField> hc() const;
|
||||
|
||||
|
||||
// Fields derived from thermodynamic state variables
|
||||
|
||||
//- Enthalpy for cell-set [J/kg]
|
||||
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;
|
||||
|
||||
|
||||
//- Read thermophysicalProperties dictionary
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "hRhoMixtureThermo.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -33,7 +33,7 @@ Description
|
||||
#ifndef reactionTypes_H
|
||||
#define reactionTypes_H
|
||||
|
||||
#include "transportTypes.H"
|
||||
#include "thermoPhysicsTypes.H"
|
||||
#include "Reaction.H"
|
||||
|
||||
#include "icoPolynomial.H"
|
||||
@ -44,11 +44,11 @@ Description
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef Reaction<gasTransport> gasReaction;
|
||||
typedef Reaction<gasThermoPhysics> gasReaction;
|
||||
|
||||
typedef Reaction<constGasTransport> constGasReaction;
|
||||
typedef Reaction<constGasThermoPhysics> constGasReaction;
|
||||
|
||||
typedef Reaction<icoPoly8Transport> icoPoly8Reaction;
|
||||
typedef Reaction<icoPoly8ThermoPhysics> icoPoly8Reaction;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -23,15 +23,15 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Typedefs
|
||||
Foam::transportTypes
|
||||
Foam::thermoPhysicsTypes
|
||||
|
||||
Description
|
||||
Type definitions for reacting transport models
|
||||
Type definitions for thermo-physics models
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef transportTypes_H
|
||||
#define transportTypes_H
|
||||
#ifndef thermoPhysicsTypes_H
|
||||
#define thermoPhysicsTypes_H
|
||||
|
||||
#include "perfectGas.H"
|
||||
#include "hConstThermo.H"
|
||||
@ -49,10 +49,10 @@ Description
|
||||
namespace Foam
|
||||
{
|
||||
typedef sutherlandTransport<specieThermo<janafThermo<perfectGas> > >
|
||||
gasTransport;
|
||||
gasThermoPhysics;
|
||||
|
||||
typedef constTransport<specieThermo<hConstThermo<perfectGas> > >
|
||||
constGasTransport;
|
||||
constGasThermoPhysics;
|
||||
|
||||
typedef polynomialTransport
|
||||
<
|
||||
@ -66,7 +66,7 @@ namespace Foam
|
||||
>,
|
||||
8
|
||||
>
|
||||
icoPoly8Transport;
|
||||
icoPoly8ThermoPhysics;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -26,7 +26,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "makeReactionJanaf.H"
|
||||
#include "reactionTypes.H"
|
||||
#include "makeReactionThermo.H"
|
||||
|
||||
#include "ArrheniusReactionRate.H"
|
||||
#include "thirdBodyArrheniusReactionRate.H"
|
||||
@ -47,21 +48,39 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTemplateTypeNameAndDebug(reaction, 0);
|
||||
defineTemplateRunTimeSelectionTable(reaction, Istream);
|
||||
defineTemplateTypeNameAndDebug(gasReaction, 0);
|
||||
defineTemplateRunTimeSelectionTable(gasReaction, Istream);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Make CHEMKIN reactions * * * * * * * * * * * * //
|
||||
|
||||
makeIRNReactions(ArrheniusReactionRate)
|
||||
makeIRNReactions(LandauTellerReactionRate)
|
||||
makeIRNReactions(thirdBodyArrheniusReactionRate)
|
||||
makeIRReactions(JanevReactionRate)
|
||||
makeIRReactions(powerSeriesReactionRate)
|
||||
makeIRNReactions(gasThermoPhysics, ArrheniusReactionRate)
|
||||
makeIRNReactions(gasThermoPhysics, LandauTellerReactionRate)
|
||||
makeIRNReactions(gasThermoPhysics, thirdBodyArrheniusReactionRate)
|
||||
makeIRReactions(gasThermoPhysics, JanevReactionRate)
|
||||
makeIRReactions(gasThermoPhysics, powerSeriesReactionRate)
|
||||
|
||||
makePressureDependentReactions
|
||||
(
|
||||
gasThermoPhysics,
|
||||
ArrheniusReactionRate,
|
||||
LindemannFallOffFunction
|
||||
)
|
||||
|
||||
makePressureDependentReactions
|
||||
(
|
||||
gasThermoPhysics,
|
||||
ArrheniusReactionRate,
|
||||
TroeFallOffFunction
|
||||
)
|
||||
|
||||
makePressureDependentReactions
|
||||
(
|
||||
gasThermoPhysics,
|
||||
ArrheniusReactionRate,
|
||||
SRIFallOffFunction
|
||||
)
|
||||
|
||||
makePressureDependentReactions(ArrheniusReactionRate, LindemannFallOffFunction)
|
||||
makePressureDependentReactions(ArrheniusReactionRate, TroeFallOffFunction)
|
||||
makePressureDependentReactions(ArrheniusReactionRate, SRIFallOffFunction)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -26,17 +26,15 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "makeReactionJanaf.H"
|
||||
#include "makeReactionThermo.H"
|
||||
#include "reactionTypes.H"
|
||||
#include "LangmuirHinshelwoodReactionRate.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
makeIRReactions(LangmuirHinshelwoodReactionRate)
|
||||
|
||||
makeIRReactions(gasThermoPhysics, LangmuirHinshelwoodReactionRate)
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -1,118 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
InClass
|
||||
Foam::makeReactionJanaf
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef makeReactionJanaf_H
|
||||
#define makeReactionJanaf_H
|
||||
|
||||
#include "Reaction.H"
|
||||
|
||||
#include "IrreversibleReaction.H"
|
||||
#include "ReversibleReaction.H"
|
||||
#include "NonEquilibriumReversibleReaction.H"
|
||||
|
||||
#include "sutherlandTransport.H"
|
||||
#include "specieThermo.H"
|
||||
#include "janafThermo.H"
|
||||
#include "perfectGas.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
typedef sutherlandTransport<specieThermo<janafThermo<perfectGas> > >
|
||||
reactionThermo;
|
||||
|
||||
typedef Reaction<reactionThermo>
|
||||
reaction;
|
||||
|
||||
#define makeReaction(Reaction, ReactionRate) \
|
||||
\
|
||||
typedef Reaction<reactionThermo, ReactionRate> \
|
||||
Reaction##ReactionRate; \
|
||||
\
|
||||
template<> \
|
||||
const word Reaction##ReactionRate::typeName \
|
||||
( \
|
||||
Reaction::typeName_() \
|
||||
+ ReactionRate::type() \
|
||||
+ reaction::typeName_() \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable(reaction, Reaction##ReactionRate, Istream);
|
||||
|
||||
#define makePressureDependentReaction(Reaction, PressureDependentReactionRate, ReactionRate, FallOffFunction) \
|
||||
\
|
||||
typedef PressureDependentReactionRate<ReactionRate, FallOffFunction> \
|
||||
PressureDependentReactionRate##ReactionRate##FallOffFunction; \
|
||||
\
|
||||
makeReaction \
|
||||
(Reaction, PressureDependentReactionRate##ReactionRate##FallOffFunction)
|
||||
|
||||
#define makeIRReactions(ReactionRate) \
|
||||
makeReaction(IrreversibleReaction, ReactionRate) \
|
||||
makeReaction(ReversibleReaction, ReactionRate)
|
||||
|
||||
#define makeIRNReactions(ReactionRate) \
|
||||
makeIRReactions(ReactionRate) \
|
||||
makeReaction(NonEquilibriumReversibleReaction, ReactionRate)
|
||||
|
||||
#define makePressureDependentReactions(ReactionRate, FallOffFunction) \
|
||||
\
|
||||
makePressureDependentReaction \
|
||||
(IrreversibleReaction, FallOffReactionRate, \
|
||||
ReactionRate, FallOffFunction) \
|
||||
\
|
||||
makePressureDependentReaction \
|
||||
(ReversibleReaction, FallOffReactionRate, \
|
||||
ReactionRate, FallOffFunction) \
|
||||
\
|
||||
makePressureDependentReaction \
|
||||
(IrreversibleReaction, ChemicallyActivatedReactionRate, \
|
||||
ReactionRate, FallOffFunction) \
|
||||
\
|
||||
makePressureDependentReaction \
|
||||
(ReversibleReaction, ChemicallyActivatedReactionRate, \
|
||||
ReactionRate, FallOffFunction)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,158 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
InClass
|
||||
Foam::makeReactionThermo
|
||||
|
||||
Description
|
||||
Macros for instantiating reactions on given thermo packages
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef makeReactionTherno_H
|
||||
#define makeReactionThermo_H
|
||||
|
||||
#include "Reaction.H"
|
||||
|
||||
#include "IrreversibleReaction.H"
|
||||
#include "ReversibleReaction.H"
|
||||
#include "NonEquilibriumReversibleReaction.H"
|
||||
|
||||
#include "specieThermo.H"
|
||||
|
||||
#include "sutherlandTransport.H"
|
||||
#include "janafThermo.H"
|
||||
#include "perfectGas.H"
|
||||
|
||||
#include "polynomialTransport.H"
|
||||
#include "polynomialThermo.H"
|
||||
#include "icoPolynomial.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeReaction(Thermo, ReactionType, ReactionRate) \
|
||||
\
|
||||
typedef Reaction<Thermo> Reaction##Thermo; \
|
||||
\
|
||||
typedef ReactionType<Thermo, ReactionRate> \
|
||||
ReactionType##Thermo##ReactionRate; \
|
||||
\
|
||||
template<> \
|
||||
const word ReactionType##Thermo##ReactionRate::typeName \
|
||||
( \
|
||||
ReactionType::typeName_() \
|
||||
+ ReactionRate::type() \
|
||||
+ Reaction##Thermo::typeName_() \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Reaction##Thermo, \
|
||||
ReactionType##Thermo##ReactionRate, \
|
||||
Istream \
|
||||
);
|
||||
|
||||
|
||||
#define makePressureDependentReaction(Thermo, Reaction, PressureDependentReactionRate, ReactionRate, FallOffFunction) \
|
||||
\
|
||||
typedef PressureDependentReactionRate<ReactionRate, FallOffFunction> \
|
||||
PressureDependentReactionRate##ReactionRate##FallOffFunction; \
|
||||
\
|
||||
makeReaction \
|
||||
( \
|
||||
Thermo, \
|
||||
Reaction, \
|
||||
PressureDependentReactionRate##ReactionRate##FallOffFunction \
|
||||
)
|
||||
|
||||
|
||||
#define makeIRReactions(Thermo, ReactionRate) \
|
||||
\
|
||||
makeReaction(Thermo, IrreversibleReaction, ReactionRate) \
|
||||
\
|
||||
makeReaction(Thermo, ReversibleReaction, ReactionRate)
|
||||
|
||||
|
||||
#define makeIRNReactions(Thermo, ReactionRate) \
|
||||
\
|
||||
makeIRReactions(Thermo, ReactionRate) \
|
||||
\
|
||||
makeReaction(Thermo, NonEquilibriumReversibleReaction, ReactionRate)
|
||||
|
||||
|
||||
#define makePressureDependentReactions(Thermo, ReactionRate, FallOffFunction) \
|
||||
\
|
||||
makePressureDependentReaction \
|
||||
( \
|
||||
Thermo, \
|
||||
IrreversibleReaction, \
|
||||
FallOffReactionRate, \
|
||||
ReactionRate, \
|
||||
FallOffFunction \
|
||||
) \
|
||||
\
|
||||
makePressureDependentReaction \
|
||||
( \
|
||||
Thermo, \
|
||||
ReversibleReaction, \
|
||||
FallOffReactionRate, \
|
||||
ReactionRate, \
|
||||
FallOffFunction \
|
||||
) \
|
||||
\
|
||||
makePressureDependentReaction \
|
||||
( \
|
||||
Thermo, \
|
||||
IrreversibleReaction, \
|
||||
ChemicallyActivatedReactionRate, \
|
||||
ReactionRate, \
|
||||
FallOffFunction \
|
||||
) \
|
||||
\
|
||||
makePressureDependentReaction \
|
||||
( \
|
||||
Thermo, \
|
||||
ReversibleReaction, \
|
||||
ChemicallyActivatedReactionRate, \
|
||||
ReactionRate, \
|
||||
FallOffFunction \
|
||||
)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user