如何获得流域中等值面的最小流向坐标?
-
最近在写一个燃烧流场后处理的代码,目的是要提取出以燃烧释热率(Qdot)为1E+10J/m3/s的等值面在流向(y方向)的最小坐标,将其定义为Flame lift-off。目前在OF教程中的aachenBomb案例(图1)基础上进行测试,编译成功的代码如下。但是输出的Flame lift-off值(图2)和paraview中提取的流场数据不一致;比如在0.0004s时Flame lift-off值大概是y=0.075,但是后处理程序输出的是0.1。应该是程序没有遍历整个流域的网格,请问大家知道怎么解决么?个人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;// maxmimum y position in domain //scalar MinQdot = 0.0; label index_ = 0; forAll(Qdot, cellI) { if (Qdot[cellI] == scalar(10000000000.0)) { // Info << "caculating y position" << endl; 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; } // ************************************************************************* //