mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Adding virtual function to basicChemistryModel.H to calculate the consumption rate
of specieI in reactionI. This is used by the diffusionMulticomponent combustion model to ignite the mixture
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -146,6 +146,13 @@ public:
|
||||
const label i
|
||||
) = 0;
|
||||
|
||||
//- Return reaction rate of the specieI in reactionI
|
||||
virtual tmp<DimensionedField<scalar, volMesh> > calculateRR
|
||||
(
|
||||
const label reactionI,
|
||||
const label specieI
|
||||
) const = 0;
|
||||
|
||||
|
||||
// Chemistry solution
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -626,6 +626,88 @@ Foam::label Foam::chemistryModel<CompType, ThermoType>::nEqns() const
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
|
||||
Foam::chemistryModel<CompType, ThermoType>::calculateRR
|
||||
(
|
||||
const label reactionI,
|
||||
const label specieI
|
||||
) const
|
||||
{
|
||||
scalar pf, cf, pr, cr;
|
||||
label lRef, rRef;
|
||||
|
||||
const volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
this->time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->thermo().rho()
|
||||
);
|
||||
|
||||
tmp<DimensionedField<scalar, volMesh> > tRR
|
||||
(
|
||||
new DimensionedField<scalar, volMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"RR",
|
||||
this->mesh().time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
DimensionedField<scalar, volMesh>& RR = tRR();
|
||||
|
||||
const scalarField& T = this->thermo().T();
|
||||
const scalarField& p = this->thermo().p();
|
||||
|
||||
forAll(rho, celli)
|
||||
{
|
||||
const scalar rhoi = rho[celli];
|
||||
const scalar Ti = T[celli];
|
||||
const scalar pi = p[celli];
|
||||
|
||||
scalarField c(nSpecie_, 0.0);
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
const scalar Yi = Y_[i][celli];
|
||||
c[i] = rhoi*Yi/specieThermo_[i].W();
|
||||
}
|
||||
|
||||
const scalar w = omegaI
|
||||
(
|
||||
reactionI,
|
||||
c,
|
||||
Ti,
|
||||
pi,
|
||||
pf,
|
||||
cf,
|
||||
lRef,
|
||||
pr,
|
||||
cr,
|
||||
rRef
|
||||
);
|
||||
|
||||
RR[celli] = w*specieThermo_[specieI].W();
|
||||
|
||||
}
|
||||
|
||||
return tRR;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
void Foam::chemistryModel<CompType, ThermoType>::calculate()
|
||||
{
|
||||
|
||||
@ -198,6 +198,13 @@ public:
|
||||
const label i
|
||||
);
|
||||
|
||||
//- Return reaction rate of the specieI in reactionI
|
||||
virtual tmp<DimensionedField<scalar, volMesh> > calculateRR
|
||||
(
|
||||
const label reactionI,
|
||||
const label specieI
|
||||
) const;
|
||||
|
||||
//- Solve the reaction system for the given time step
|
||||
// and return the characteristic time
|
||||
virtual scalar solve(const scalar deltaT);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -84,4 +84,27 @@ Foam::basicSolidChemistryModel::RR(const label i)
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
|
||||
Foam::basicSolidChemistryModel::calculateRR
|
||||
(
|
||||
const label reactionI,
|
||||
const label specieI
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"Foam::DimensionedField<Foam::scalar, Foam::volMesh>&"
|
||||
"basicSolidChemistryModel::calculateRR(const label)"
|
||||
);
|
||||
|
||||
return dynamic_cast<tmp<DimensionedField<scalar, volMesh> >&>
|
||||
(
|
||||
const_cast<DimensionedField<scalar, volMesh>& >
|
||||
(
|
||||
DimensionedField<scalar, volMesh>::null()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -133,6 +133,13 @@ public:
|
||||
const label i
|
||||
) const = 0;
|
||||
|
||||
//- Returns the reaction rate of the specieI in reactionI
|
||||
virtual tmp<DimensionedField<scalar, volMesh> > calculateRR
|
||||
(
|
||||
const label reactionI,
|
||||
const label specieI
|
||||
) const;
|
||||
|
||||
//- Return sensible enthalpy for gas i [J/Kg]
|
||||
virtual tmp<volScalarField> gasHs
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user