如何看流场中的加速度云图?
-
@Yu_Tian 在createFields.H文件中,添加变量声明
volVectorField js ( IOobject ( "js", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), -sigma*fvc::grad(Ue) );
在求解完Ue后,更新一下js
js=-sigma*fvc::grad(Ue);
我一般这样通过求解器实现的。
也可以用postProcess实现,但是需要具体看一下他的源码,这个我不是很熟悉
放一个我之前写过的一个求边界“axis”上的最大速度,这个是参考之前版本的calc方法写的,后来calc全部整合到postProcess中了,但是在OpenFOAM 6里面,按照calc的思虑一样可以用#include "timeSelector.H" #include "calcType.H" void calc(const argList& args, const Time& runTime, const fvMesh& mesh) { IOobject UHeader ( "U", runTime.timeName(), mesh, IOobject::MUST_READ ); if (phiHeader.headerOk()) { volVectorField U(UHeader, mesh); forAll(U.boundaryField(), patchi) { const fvPatchVectorField & pU = U.boundaryField()[patchi]; const fvPatch & pU_B = pU.patch(); if(pU_B.name() == "axis") { Foam::Info<< "mag(U) max : " << max(mag(pU)).value() << Foam::endl; break; } } } else { Foam::Info<< "No U exists!" << Foam::endl; } Info<< "\nEnd\n" << endl; } int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); #include "createNamedMesh.H" forAll(timeDirs, timeI) { runTime.setTime(timeDirs[timeI], timeI); Foam::Info<< "Time = " << runTime.timeName() << Foam::endl; mesh.readUpdate(); calc(args, runTime, mesh); Foam::Info<< Foam::endl; } Foam::Info<< "End\n" << Foam::endl; return 0; }