May 25, 2023, 05:13
|
How to add the species mass fraction equation to compressibleInterFoam?
|
#1
|
New Member
Qian Meng
Join Date: Nov 2022
Posts: 2
Rep Power: 0
|
Hello,everyone!
I am now trying to add the species mass fraction equation to compressibleInterFoam, but since I have less programming experience, I am not sure if this is correct?
Code:
tmp<fv::convectionScheme<scalar>> mvConvection
(
fv::convectionScheme<scalar>::New
(
mesh,
fields,
alpha2rho2phi,
mesh.divScheme("div(alpha2rho2phi,Yi)")
)
);
{
combustion->correct();
Qdot = combustion->Qdot();
volScalarField Yt(0.0*Y[0]);
volScalarField alpha2muEff("alpha2muEff" , alpha2*turbulence.muEff());
forAll(Y, i)
{
if (i != inertIndex && composition.active(i))
{
volScalarField& Yi = Y[i];
fvScalarMatrix YEqn
(
fvm::ddt(alpha2rho2, Yi)
+ mvConvection->fvmDiv(alpha2rho2phi, Yi)
- fvm::laplacian(alpha2muEff, Yi)
==
parcels.SYi(i, Yi)
+ combustion->R(Yi)
+ fvOptions(rho, Yi)
);
YEqn.relax();
fvOptions.constrain(YEqn);
YEqn.solve(mesh.solver("Yi"));
fvOptions.correct(Yi);
Yi.max(0.0);
Yt += Yi;
}
}
Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].max(0.0);
Variables,such as alpha2rho2phi and alpha2rho2 are defined in createField.H.
Code:
volScalarField alpha2rho2
(
IOobject
(
"alpha2rho2",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
alpha2*rho2
);
surfaceScalarField alpha2rho2phi
(
IOobject
(
"alpha2phi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
linearInterpolate(alpha2*rho2*U) & mesh.Sf()
);
Is this correct?Besides,What does mvconvection stand for?
|
|
|