运行结束后输出密度rho
-
@wangfei9088 好的,我仔细看下。谢谢。
-
@wangfei9088 感谢大佬,程序正常输出,正确性还没测试,也许可以和cantera的结果比一下,代码就是上面发的加上根据大佬说的改的。另外,我在想可不可以更进一步,写出每一个反应步每个组分的Qdot,命名为Qdot.Ri.Speciei,类似输出RR.Speciei?
-
对于你的问题,我最近也在修改,加入以下代码,然后在类定义中添加成员变量就行了。我这边是可以成功输出每个物质对应的Qdot
template<class ReactionThermo, class ThermoType> Foam::tmp<Foam::volScalarField> Foam::StandardChemistryModel<ReactionThermo, ThermoType>::Qdot() const { tmp<volScalarField> tQdot ( new volScalarField ( IOobject ( "Qdot", this->mesh_.time().timeName(), this->mesh_, IOobject::NO_READ, IOobject::NO_WRITE, IOobject::NO_REGISTER ), this->mesh_, dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) ) ); QdotSpecies_; if (!QdotSpecies_.size()) { // 首次调用时初始化 QdotSpecies_.setSize(nSpecie_); forAll(Y_, i) { QdotSpecies_.set ( i, new volScalarField ( IOobject ( "Qdot." + Y_[i].name(), this->mesh_.time().timeName(), this->mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE, IOobject::REGISTER ), this->mesh_, dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) ) ); } } if (this->chemistry_) { scalarField& Qdot = tQdot.ref(); Qdot = 0.0; forAll(Y_, i) { volScalarField& QdotI = QdotSpecies_[i]; const scalar hi = specieThermo_[i].Hc(); forAll(Qdot, celli) { QdotI[celli] = -hi*RR_[i][celli]; Qdot[celli] += QdotI[celli]; } // 修正边界条件 QdotSpecies_[i].correctBoundaryConditions(); } tQdot.ref().correctBoundaryConditions(); } return tQdot; }