最近在写一个燃烧流场后处理的代码,目的是要提取出以燃烧释热率(Qdot)为1E+9J/m3/s的等值面在流向(y方向)的最小坐标,将其定义为Flame lift-off,代码如图1所示。目前在OF教程中的aachenBomb案例(图2)基础上进行测试,编译成功后输出的Flame lift-off值(图3)和paraview中提取的流场数据(图2)不一致;比如在0.0004s时Flame lift-off值大概是y=0.07,但是后处理程序输出的是0.0005;而且所有时刻的Flame lift-off都是0.0005,请问大家知道怎么解决么?个人C++小白,如果需要C++语句的撰写修改,请前辈指出方向,我去学习下,非常感谢!
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "timeSelector.H"
#include "fvCFD.H"
#include "transformGeometricField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
timeSelector::addOptions();
#include "addRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
#include "createMesh.H"
std::ofstream file("Flame-lifty.plt",ios_base::app); // open a file ++
forAll(timeDirs, timeI)
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Reading field Qdot\n" << endl;
volScalarField Qdot
(
IOobject
(
"Qdot",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
scalar MinYlocation = 0.1;// 0.1 is the maximum y position in the domain
label index_ = 0;
forAll(Qdot, cellI)
{
if (Qdot[cellI] == scalar(1e9))
{
scalar y = mesh.C()[cellI].component(vector::Y);
if (y < MinYlocation)
{
MinYlocation = y;
}
}
}
MinYlocation = mesh.C()[index_].component(vector::Y);
Info << " Time= " << runTime.value()<<"," << " flame lift_off=" << MinYlocation << endl ;
file << runTime.value() << " " <<MinYlocation << " " << std::endl;
}
file.close(); //close the file ++
return 0;
}