implemented EMD combustionModel (added edm() to chemistryModel)

This commit is contained in:
ignis 2018-01-23 04:54:04 +09:00
parent 786d9fba2e
commit 2e799dbc77
4 changed files with 156 additions and 3 deletions

View file

@ -77,12 +77,51 @@ void Foam::combustionModels::EDM<Type>::correct()
{
if (this->active())
{
tmp<volScalarField> tk(this->turbulence().k());
const volScalarField& k = tk();
tmp<volScalarField> tepsilon(this->turbulence().epsilon());
const volScalarField& epsilon = tepsilon();
this->chemistryPtr_->edm(epsilon/k, A_, B_);
if (finiteRate_)
{
// Copy edm rate stored in chemistryPtr_->RR(i)
PtrList<DimensionedField<scalar, volMesh>> edmRates
(
this->thermo().composition().Y().size()
);
forAll(edmRates, i)
{
edmRates.set
(
i,
new DimensionedField<scalar, volMesh>
(
this->chemistryPtr_->RR(i)
)
);
}
this->chemistryPtr_->calculate();
}
else
{
forAll(edmRates, i)
{
DimensionedField<scalar, volMesh> &finiteRatei
(
this->chemistryPtr_->RR(i)
);
forAll(finiteRatei, celli)
{
finiteRatei[celli] = min(finiteRatei[celli], edmRates[i][celli]);
finiteRatei[celli] =
finiteRatei[celli]*edmRates[i][celli]
/ (finiteRatei[celli] + edmRates[i][celli] + SMALL);
}
}
}
}
}

View file

@ -159,6 +159,14 @@ public:
//- Calculates the reaction rates
virtual void calculate() = 0;
//- Calculates the eddy dissipation reaction rates
virtual void edm
(
const scalarField& mixing,
const scalar A,
const scalar B
) = 0;
//- Solve the reaction system for the given time step
// and return the characteristic time
virtual scalar solve(const scalar deltaT) = 0;

View file

@ -756,6 +756,104 @@ void Foam::chemistryModel<CompType, ThermoType>::calculate()
}
template<class CompType, class ThermoType>
void Foam::chemistryModel<CompType, ThermoType>::edm
(
const scalarField& mixing,
const scalar A,
const scalar B
)
{
if (!this->chemistry_)
{
return;
}
const volScalarField rho
(
IOobject
(
"rho",
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->thermo().rho()
);
forAll(rho, celli)
{
const scalar rhoi = rho[celli];
const scalar mixingi = mixing[celli];
scalarField Yi(nSpecie_, 0.0);
for (label k=0; k<nSpecie_; k++)
{
Yi[k] = Y_[k][celli];
}
scalarField om(nSpecie_, 0.0);
scalar minYR = 1.0;
scalar YP = 0.0;
forAll(reactions_, m)
{
const Reaction<ThermoType>& R = reactions_[m];
scalar num = 0.0;
scalar den = 0.0;
forAll(R.lhs(), s)
{
const label k = R.lhs()[s].index;
const scalar vk = R.lhs()[s].stoichCoeff;
const scalar Wk = specieThermo_[k].W();
minYR = min(minYR, Yi[k]/Wk/vk);
}
forAll(R.rhs(), s)
{
const label k = R.rhs()[s].index;
const scalar vk = R.rhs()[s].stoichCoeff;
const scalar Wk = specieThermo_[k].W();
num += Yi[k];
den += vk*Wk;
}
YP = num/den;
scalar omegam = min (A*rhoi*mixingi*minYR, A*B*rhoi*mixingi*YP);
forAll(R.lhs(), s)
{
const label k = R.lhs()[s].index;
const scalar vk = R.lhs()[s].stoichCoeff;
const scalar Wk = specieThermo_[k].W();
om[k] -= vk*Wk*omegam;
}
forAll(R.rhs(), s)
{
const label k = R.rhs()[s].index;
const scalar vk = R.rhs()[s].stoichCoeff;
const scalar Wk = specieThermo_[k].W();
om[k] += vk*Wk*omegam;
}
}
for (label k=0; k<nSpecie_; k++)
{
RR_[k][celli] = om[k];
}
}
}
template<class CompType, class ThermoType>
template<class DeltaTType>
Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve

View file

@ -191,6 +191,14 @@ public:
//- Calculates the reaction rates
virtual void calculate();
//- Calculates the eddy dissipation reaction rates
virtual void edm
(
const scalarField& mixing,
const scalar A,
const scalar B
);
// Chemistry model functions (overriding abstract functions in
// basicChemistryModel.H)