@Tens
您好,我参考您的代码也在compressibleInterFoam中添加了组分方程,目前出现了某种组分的质量分数超过1的情况,这个问题困扰我很久了,可以麻烦您帮我看一下代码有什么问题吗?万分感谢!
tmp<fv::convectionScheme<scalar>> mvConvection
(
fv::convectionScheme<scalar>::New//convectionScheme:Abstract base class for convection schemes.
(
mesh,
fields,
alpha2rho2phi,
mesh.divScheme("div(alpha2rho2phi,Yi)")
)
);
{
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(turbulence.muEff()*alpha2, Yi)
==
alpha2*parcels.SYi(i, Yi)
+ fvOptions(rho2, 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;
Info<<"info::inertIndex.................="<< inertIndex <<endl;
Info<<"info::Y[inertIndex].................="<< max(Y[inertIndex]) <<endl;
Y[inertIndex].max(0.0);
我在createField.H中声明了下列变量:
volScalarField alpha2rho2
(
IOobject
(
"alpha2rho2",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
alpha2*rho2
);
surfaceScalarField alpha2rho2phi
(
IOobject
(
"alpha2rho2phi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
linearInterpolate(alpha2*rho2*U) & mesh.Sf()
);