36行Burgers方程的OpenFOAM源代码
-
#include "fvCFD.H" int main(int argc, char *argv[]) { #include "setRootCaseLists.H" #include "createTime.H" #include "createMesh.H" volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); while (runTime.loop()) { Info<< "Time = " << runTime.userTimeName() << nl << endl; surfaceScalarField phi(fvc::flux(U)); solve ( fvm::ddt(U) + 0.5*fvm::div(phi, U, "div(phi,U)") ); runTime.write(); } return 0; }
测试算例: burgers.tar.xz
相应的结果:一个好一个坏