mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
chemistryModel/laminar/PaSR: Add support for LTS to laminar model and to PaSR by derivation
This commit is contained in:
@ -35,7 +35,7 @@ Foam::combustionModels::PaSR<Type>::PaSR
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Type(modelType, mesh),
|
laminar<Type>(modelType, mesh),
|
||||||
Cmix_(readScalar(this->coeffs().lookup("Cmix"))),
|
Cmix_(readScalar(this->coeffs().lookup("Cmix"))),
|
||||||
turbulentReaction_(this->coeffs().lookup("turbulentReaction")),
|
turbulentReaction_(this->coeffs().lookup("turbulentReaction")),
|
||||||
kappa_
|
kappa_
|
||||||
@ -50,21 +50,8 @@ Foam::combustionModels::PaSR<Type>::PaSR
|
|||||||
),
|
),
|
||||||
mesh,
|
mesh,
|
||||||
dimensionedScalar("kappa", dimless, 0.0)
|
dimensionedScalar("kappa", dimless, 0.0)
|
||||||
),
|
|
||||||
integrateReactionRate_
|
|
||||||
(
|
|
||||||
this->coeffs().lookupOrDefault("integrateReactionRate", true)
|
|
||||||
)
|
)
|
||||||
{
|
{}
|
||||||
if (integrateReactionRate_)
|
|
||||||
{
|
|
||||||
Info<< " using integrated reaction rate" << endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< " using instantaneous reaction rate" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -76,28 +63,12 @@ Foam::combustionModels::PaSR<Type>::~PaSR()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::tmp<Foam::volScalarField> Foam::combustionModels::PaSR<Type>::tc() const
|
|
||||||
{
|
|
||||||
return this->chemistryPtr_->tc();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::combustionModels::PaSR<Type>::correct()
|
void Foam::combustionModels::PaSR<Type>::correct()
|
||||||
{
|
{
|
||||||
if (this->active())
|
if (this->active())
|
||||||
{
|
{
|
||||||
const scalar dt = this->mesh().time().deltaTValue();
|
laminar<Type>::correct();
|
||||||
|
|
||||||
if (integrateReactionRate_)
|
|
||||||
{
|
|
||||||
this->chemistryPtr_->solve(dt);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->chemistryPtr_->calculate();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (turbulentReaction_)
|
if (turbulentReaction_)
|
||||||
{
|
{
|
||||||
@ -108,7 +79,7 @@ void Foam::combustionModels::PaSR<Type>::correct()
|
|||||||
tmp<volScalarField> tmuEff(this->turbulence().muEff());
|
tmp<volScalarField> tmuEff(this->turbulence().muEff());
|
||||||
const volScalarField& muEff = tmuEff();
|
const volScalarField& muEff = tmuEff();
|
||||||
|
|
||||||
tmp<volScalarField> ttc(tc());
|
tmp<volScalarField> ttc(this->tc());
|
||||||
const volScalarField& tc = ttc();
|
const volScalarField& tc = ttc();
|
||||||
|
|
||||||
forAll(epsilon, i)
|
forAll(epsilon, i)
|
||||||
@ -138,18 +109,7 @@ template<class Type>
|
|||||||
Foam::tmp<Foam::fvScalarMatrix>
|
Foam::tmp<Foam::fvScalarMatrix>
|
||||||
Foam::combustionModels::PaSR<Type>::R(volScalarField& Y) const
|
Foam::combustionModels::PaSR<Type>::R(volScalarField& Y) const
|
||||||
{
|
{
|
||||||
tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime));
|
return kappa_*laminar<Type>::R(Y);
|
||||||
|
|
||||||
fvScalarMatrix& Su = tSu();
|
|
||||||
|
|
||||||
if (this->active())
|
|
||||||
{
|
|
||||||
const label specieI = this->thermo().composition().species()[Y.name()];
|
|
||||||
|
|
||||||
Su += kappa_*this->chemistryPtr_->RR(specieI);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tSu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -157,32 +117,7 @@ template<class Type>
|
|||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::combustionModels::PaSR<Type>::dQ() const
|
Foam::combustionModels::PaSR<Type>::dQ() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tdQ
|
return kappa_*laminar<Type>::dQ();
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
typeName + ":dQ",
|
|
||||||
this->mesh().time().timeName(),
|
|
||||||
this->mesh(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
this->mesh(),
|
|
||||||
dimensionedScalar("dQ", dimEnergy/dimTime, 0.0),
|
|
||||||
zeroGradientFvPatchScalarField::typeName
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this->active())
|
|
||||||
{
|
|
||||||
volScalarField& dQ = tdQ();
|
|
||||||
dQ = kappa_*this->chemistryPtr_->dQ();
|
|
||||||
}
|
|
||||||
|
|
||||||
return tdQ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -190,44 +125,17 @@ template<class Type>
|
|||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::combustionModels::PaSR<Type>::Sh() const
|
Foam::combustionModels::PaSR<Type>::Sh() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tSh
|
return kappa_*laminar<Type>::Sh();
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
typeName + ":Sh",
|
|
||||||
this->mesh().time().timeName(),
|
|
||||||
this->mesh(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
this->mesh(),
|
|
||||||
dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0),
|
|
||||||
zeroGradientFvPatchScalarField::typeName
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this->active())
|
|
||||||
{
|
|
||||||
scalarField& Sh = tSh();
|
|
||||||
Sh = kappa_*this->chemistryPtr_->Sh();
|
|
||||||
}
|
|
||||||
|
|
||||||
return tSh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool Foam::combustionModels::PaSR<Type>::read()
|
bool Foam::combustionModels::PaSR<Type>::read()
|
||||||
{
|
{
|
||||||
if (Type::read())
|
if (laminar<Type>::read())
|
||||||
{
|
{
|
||||||
this->coeffs().lookup("Cmix") >> Cmix_;
|
this->coeffs().lookup("Cmix") >> Cmix_;
|
||||||
this->coeffs().lookup("turbulentReaction") >> turbulentReaction_;
|
this->coeffs().lookup("turbulentReaction") >> turbulentReaction_;
|
||||||
this->coeffs().lookup("integrateReactionRate")
|
|
||||||
>> integrateReactionRate_;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -38,6 +38,8 @@ SourceFiles
|
|||||||
#ifndef PaSR_H
|
#ifndef PaSR_H
|
||||||
#define PaSR_H
|
#define PaSR_H
|
||||||
|
|
||||||
|
#include "laminar.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -52,7 +54,7 @@ namespace combustionModels
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
class PaSR
|
class PaSR
|
||||||
:
|
:
|
||||||
public Type
|
public laminar<Type>
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
@ -65,16 +67,9 @@ class PaSR
|
|||||||
//- Mixing parameter
|
//- Mixing parameter
|
||||||
volScalarField kappa_;
|
volScalarField kappa_;
|
||||||
|
|
||||||
//- Integrate reaction rate over the time-step
|
|
||||||
// using the selected ODE solver
|
|
||||||
bool integrateReactionRate_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Return the chemical time scale
|
|
||||||
tmp<volScalarField> tc() const;
|
|
||||||
|
|
||||||
//- Disallow copy construct
|
//- Disallow copy construct
|
||||||
PaSR(const PaSR&);
|
PaSR(const PaSR&);
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "laminar.H"
|
#include "laminar.H"
|
||||||
#include "fvmSup.H"
|
#include "fvmSup.H"
|
||||||
|
#include "localEulerDdtScheme.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -76,7 +77,37 @@ void Foam::combustionModels::laminar<Type>::correct()
|
|||||||
{
|
{
|
||||||
if (integrateReactionRate_)
|
if (integrateReactionRate_)
|
||||||
{
|
{
|
||||||
this->chemistryPtr_->solve(this->mesh().time().deltaTValue());
|
word ddtScheme(this->mesh().ddtScheme("Yi"));
|
||||||
|
|
||||||
|
if (ddtScheme == fv::localEulerDdtScheme<scalar>::typeName)
|
||||||
|
{
|
||||||
|
const scalarField& rDeltaT =
|
||||||
|
this->mesh().objectRegistry::lookupObject<volScalarField>
|
||||||
|
(
|
||||||
|
"rDeltaT"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (this->coeffs().found("maxIntegrationTime"))
|
||||||
|
{
|
||||||
|
scalar maxIntegrationTime
|
||||||
|
(
|
||||||
|
readScalar(this->coeffs().lookup("maxIntegrationTime"))
|
||||||
|
);
|
||||||
|
|
||||||
|
this->chemistryPtr_->solve
|
||||||
|
(
|
||||||
|
min(1.0/rDeltaT, maxIntegrationTime)()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->chemistryPtr_->solve((1.0/rDeltaT)());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->chemistryPtr_->solve(this->mesh().time().deltaTValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -57,12 +57,17 @@ class laminar
|
|||||||
// using the selected ODE solver
|
// using the selected ODE solver
|
||||||
bool integrateReactionRate_;
|
bool integrateReactionRate_;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
// Private Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Return the chemical time scale
|
//- Return the chemical time scale
|
||||||
tmp<volScalarField> tc() const;
|
tmp<volScalarField> tc() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow copy construct
|
//- Disallow copy construct
|
||||||
laminar(const laminar&);
|
laminar(const laminar&);
|
||||||
|
|
||||||
|
|||||||
@ -156,6 +156,10 @@ public:
|
|||||||
// and return the characteristic time
|
// and return the characteristic time
|
||||||
virtual scalar solve(const scalar deltaT) = 0;
|
virtual scalar solve(const scalar deltaT) = 0;
|
||||||
|
|
||||||
|
//- Solve the reaction system for the given time step
|
||||||
|
// and return the characteristic time
|
||||||
|
virtual scalar solve(const scalarField& deltaT) = 0;
|
||||||
|
|
||||||
//- Return the chemical time scale
|
//- Return the chemical time scale
|
||||||
virtual tmp<volScalarField> tc() const = 0;
|
virtual tmp<volScalarField> tc() const = 0;
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "chemistryModel.H"
|
#include "chemistryModel.H"
|
||||||
#include "reactingMixture.H"
|
#include "reactingMixture.H"
|
||||||
|
#include "UniformField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -742,9 +743,10 @@ void Foam::chemistryModel<CompType, ThermoType>::calculate()
|
|||||||
|
|
||||||
|
|
||||||
template<class CompType, class ThermoType>
|
template<class CompType, class ThermoType>
|
||||||
|
template<class DeltaTType>
|
||||||
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
||||||
(
|
(
|
||||||
const scalar deltaT
|
const DeltaTType& deltaT
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CompType::correct();
|
CompType::correct();
|
||||||
@ -795,9 +797,9 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
|||||||
|
|
||||||
// initialise timing parameters
|
// initialise timing parameters
|
||||||
scalar t = 0;
|
scalar t = 0;
|
||||||
|
scalar timeLeft = deltaT[celli];
|
||||||
scalar tauC = this->deltaTChem_[celli];
|
scalar tauC = this->deltaTChem_[celli];
|
||||||
scalar dt = min(deltaT, tauC);
|
scalar dt = min(timeLeft, tauC);
|
||||||
scalar timeLeft = deltaT;
|
|
||||||
|
|
||||||
// calculate the chemical source terms
|
// calculate the chemical source terms
|
||||||
while (timeLeft > SMALL)
|
while (timeLeft > SMALL)
|
||||||
@ -823,17 +825,39 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
|||||||
dc = c - c0;
|
dc = c - c0;
|
||||||
for (label i=0; i<nSpecie_; i++)
|
for (label i=0; i<nSpecie_; i++)
|
||||||
{
|
{
|
||||||
RR_[i][celli] = dc[i]*specieThermo_[i].W()/deltaT;
|
RR_[i][celli] = dc[i]*specieThermo_[i].W()/deltaT[celli];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't allow the time-step to change more than a factor of 2
|
|
||||||
deltaTMin = min(deltaTMin, 2*deltaT);
|
|
||||||
|
|
||||||
return deltaTMin;
|
return deltaTMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class CompType, class ThermoType>
|
||||||
|
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
||||||
|
(
|
||||||
|
const scalar deltaT
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Don't allow the time-step to change more than a factor of 2
|
||||||
|
return min
|
||||||
|
(
|
||||||
|
this->solve<UniformField<scalar> >(UniformField<scalar>(deltaT)),
|
||||||
|
2*deltaT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class CompType, class ThermoType>
|
||||||
|
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
||||||
|
(
|
||||||
|
const scalarField& deltaT
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return this->solve<scalarField>(deltaT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CompType, class ThermoType>
|
template<class CompType, class ThermoType>
|
||||||
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
||||||
(
|
(
|
||||||
|
|||||||
@ -70,6 +70,11 @@ class chemistryModel
|
|||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const chemistryModel&);
|
void operator=(const chemistryModel&);
|
||||||
|
|
||||||
|
//- Solve the reaction system for the given time step
|
||||||
|
// of given type and return the characteristic time
|
||||||
|
template<class DeltaTType>
|
||||||
|
scalar solve(const DeltaTType& deltaT);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -221,6 +226,10 @@ public:
|
|||||||
// and return the characteristic time
|
// and return the characteristic time
|
||||||
virtual scalar solve(const scalar deltaT);
|
virtual scalar solve(const scalar deltaT);
|
||||||
|
|
||||||
|
//- Solve the reaction system for the given time step
|
||||||
|
// and return the characteristic time
|
||||||
|
virtual scalar solve(const scalarField& deltaT);
|
||||||
|
|
||||||
//- Return the chemical time scale
|
//- Return the chemical time scale
|
||||||
virtual tmp<volScalarField> tc() const;
|
virtual tmp<volScalarField> tc() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user