运行结束后输出密度rho
-
对于你的问题,我最近也在修改,加入以下代码,然后在类定义中添加成员变量就行了。我这边是可以成功输出每个物质对应的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; }