mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: code clean-up/restructure
This commit is contained in:
@ -552,6 +552,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::Sh() const
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if (this->chemistry_)
|
||||
{
|
||||
scalarField& Sh = tSh();
|
||||
@ -560,7 +561,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::Sh() const
|
||||
{
|
||||
forAll(Sh, cellI)
|
||||
{
|
||||
scalar hi = specieThermo_[i].Hc();
|
||||
const scalar hi = specieThermo_[i].Hc();
|
||||
Sh[cellI] -= hi*RR_[i][cellI];
|
||||
}
|
||||
}
|
||||
@ -734,7 +735,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
|
||||
t += dt;
|
||||
|
||||
// update the temperature
|
||||
scalar cTot = sum(c);
|
||||
const scalar cTot = sum(c);
|
||||
ThermoType mixture(0.0*specieThermo_[0]);
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
|
||||
@ -39,7 +39,7 @@ Foam::EulerImplicit<CompType, ThermoType>::EulerImplicit
|
||||
chemistrySolver<CompType, ThermoType>(model, modelName),
|
||||
coeffsDict_(model.subDict(modelName + "Coeffs")),
|
||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||
equil_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
eqRateLimiter_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
{}
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::solve
|
||||
);
|
||||
|
||||
scalar corr = 1.0;
|
||||
if (equil_)
|
||||
if (eqRateLimiter_)
|
||||
{
|
||||
if (omegai < 0.0)
|
||||
{
|
||||
@ -100,20 +100,20 @@ Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::solve
|
||||
}
|
||||
}
|
||||
|
||||
forAll(R.lhs(), s)
|
||||
forAll(R.lhs(), specieI)
|
||||
{
|
||||
label si = R.lhs()[s].index;
|
||||
scalar sl = R.lhs()[s].stoichCoeff;
|
||||
RR[si][rRef] -= sl*pr*corr;
|
||||
RR[si][lRef] += sl*pf*corr;
|
||||
const label id = R.lhs()[specieI].index;
|
||||
const scalar sc = R.lhs()[specieI].stoichCoeff;
|
||||
RR[id][rRef] -= sc*pr*corr;
|
||||
RR[id][lRef] += sc*pf*corr;
|
||||
}
|
||||
|
||||
forAll(R.rhs(), s)
|
||||
forAll(R.rhs(), specieI)
|
||||
{
|
||||
label si = R.rhs()[s].index;
|
||||
scalar sr = R.rhs()[s].stoichCoeff;
|
||||
RR[si][lRef] -= sr*pf*corr;
|
||||
RR[si][rRef] += sr*pr*corr;
|
||||
const label id = R.rhs()[specieI].index;
|
||||
const scalar sc = R.rhs()[specieI].stoichCoeff;
|
||||
RR[id][lRef] -= sc*pf*corr;
|
||||
RR[id][rRef] += sc*pr*corr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::solve
|
||||
scalarField dcdt(nEqns, 0.0);
|
||||
this->model_.derivatives(0.0, c1, dcdt);
|
||||
|
||||
scalar sumC = sum(c);
|
||||
const scalar sumC = sum(c);
|
||||
|
||||
for (label i = 0; i < nSpecie; i++)
|
||||
{
|
||||
|
||||
@ -57,12 +57,17 @@ class EulerImplicit
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Coefficients dictionary
|
||||
dictionary coeffsDict_;
|
||||
|
||||
|
||||
// Model constants
|
||||
|
||||
//- Chemistry timescale
|
||||
scalar cTauChem_;
|
||||
Switch equil_;
|
||||
|
||||
//- Equilibrium rate limiter flag (on/off)
|
||||
Switch eqRateLimiter_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -38,7 +38,7 @@ Foam::sequential<CompType, ThermoType>::sequential
|
||||
chemistrySolver<CompType, ThermoType>(model, modelName),
|
||||
coeffsDict_(model.subDict(modelName + "Coeffs")),
|
||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||
equil_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
eqRateLimiter_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
{}
|
||||
|
||||
|
||||
@ -70,45 +70,41 @@ Foam::scalar Foam::sequential<CompType, ThermoType>::solve
|
||||
{
|
||||
const Reaction<ThermoType>& R = this->model_.reactions()[i];
|
||||
|
||||
scalar om0 = this->model_.omega
|
||||
scalar omega = this->model_.omega
|
||||
(
|
||||
R, c, T, p, pf, cf, lRef, pb, cb, rRef
|
||||
);
|
||||
|
||||
scalar omeg = 0.0;
|
||||
if (!equil_)
|
||||
if (eqRateLimiter_)
|
||||
{
|
||||
omeg = om0;
|
||||
if (omega < 0.0)
|
||||
{
|
||||
omega /= 1.0 + pb*dt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (om0<0.0)
|
||||
{
|
||||
omeg = om0/(1.0 + pb*dt);
|
||||
}
|
||||
else
|
||||
{
|
||||
omeg = om0/(1.0 + pf*dt);
|
||||
omega /= 1.0 + pf*dt;
|
||||
}
|
||||
}
|
||||
tChemInv = max(tChemInv, mag(omeg));
|
||||
|
||||
tChemInv = max(tChemInv, mag(omega));
|
||||
|
||||
|
||||
// update species
|
||||
forAll(R.lhs(), s)
|
||||
forAll(R.lhs(), specieI)
|
||||
{
|
||||
label si = R.lhs()[s].index;
|
||||
scalar sl = R.lhs()[s].stoichCoeff;
|
||||
c[si] -= dt*sl*omeg;
|
||||
c[si] = max(0.0, c[si]);
|
||||
const label id = R.lhs()[specieI].index;
|
||||
const scalar sc = R.lhs()[specieI].stoichCoeff;
|
||||
c[id] -= dt*sc*omega;
|
||||
c[id] = max(0.0, c[id]);
|
||||
}
|
||||
|
||||
forAll(R.rhs(), s)
|
||||
forAll(R.rhs(), specieI)
|
||||
{
|
||||
label si = R.rhs()[s].index;
|
||||
scalar sr = R.rhs()[s].stoichCoeff;
|
||||
c[si] += dt*sr*omeg;
|
||||
c[si] = max(0.0, c[si]);
|
||||
const label id = R.rhs()[specieI].index;
|
||||
const scalar sc = R.rhs()[specieI].stoichCoeff;
|
||||
c[id] += dt*sc*omega;
|
||||
c[id] = max(0.0, c[id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -59,12 +59,17 @@ class sequential
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Coefficients dictionary
|
||||
dictionary coeffsDict_;
|
||||
|
||||
|
||||
// Model constants
|
||||
|
||||
//- Chemistry time scale
|
||||
scalar cTauChem_;
|
||||
Switch equil_;
|
||||
|
||||
//- Equilibrium rate limiter flag (on/off)
|
||||
Switch eqRateLimiter_;
|
||||
|
||||
|
||||
public:
|
||||
@ -75,7 +80,6 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
|
||||
//- Construct from components
|
||||
sequential
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user