从0开始计算没问题,停掉再续算过几步就出错
-
在compressibleInterFoam中添加组分方程,组分方程如下:
tmp<fv::convectionScheme<scalar>> mvConvection ( fv::convectionScheme<scalar>::New ( mesh, fields, alpharho2Phi, mesh.divScheme("div(phi,Yi)") ) ); { combustion->correct(); volScalarField Yt(0.0*Y[0]); alpharho2 = alpha2*rho2; alpharho2Phi = fvc::interpolate(alpharho2)*phi; volScalarField alphamuEff("alphamuEff",alpha2*turbulence.muEff()); forAll(Y, i) { if (i != inertIndex && composition.active(i)) { volScalarField& Yi = Y[i]; fvScalarMatrix YEqn ( fvm::ddt(alpharho2, Yi) + mvConvection->fvmDiv(alpharho2Phi, Yi) - fvm::laplacian(alphamuEff, Yi) == parcels.SYi(i, Yi) + combustion->R(Yi) + fvOptions(alpharho2, Yi) ); YEqn.relax(); fvOptions.constrain(YEqn); YEqn.solve("Yi"); fvOptions.correct(Yi); Yi.max(0.0); Yt += Yi; } } Y[inertIndex] = scalar(1) - Yt; Y[inertIndex].max(0.0); }
从0时刻开始计算没有问题,在某一时刻停掉计算后续算,没过几步就会报错,报错如下,请问各位有什么建议。
-
@李东岳 就算仿照sprayfoam进行添加的,createFields.H里还添加了下面部分,twoPhaseMixtureThermo里将RhoThermo改为了rhoReactionThermo,应该就这些。
rhoReactionThermo& thermo2 = mixture.thermo2(); basicSpecieMixture& composition = thermo2.composition(); PtrList<volScalarField>& Y = composition.Y(); const word inertSpecie(thermo2.lookup("inertSpecie")); if (!composition.species().found(inertSpecie)) { FatalIOErrorIn(args.executable().c_str(), thermo2) << "Inert specie " << inertSpecie << " not found in available species " << composition.species() << exit(FatalIOError); } const label inertIndex(composition.species()[inertSpecie]); multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields; forAll(Y, i) { fields.add(Y[i]); } surfaceScalarField alpharho2 ( IOobject ( "alphaRho2Phi", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), alpha2*rho2 ); surfaceScalarField alphaRho2Phi ( IOobject ( "alphaRho2Phi", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), fvc::interpolate(alpha2*rho2)*phi );
-
@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() );