int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" #include "initContinuityErrs.H" simpleControl simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; p.storePrevIter(); // --- Pressure-velocity SIMPLE corrector { #include "UrelEqn.H" #include "pEqn.H" } turbulence->correct(); if (runTime.outputTime()) { volVectorField Uabs ( IOobject ( "Uabs", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), Urel + SRF->U() ); runTime.write(); } Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; }
int main(int argc, char *argv[]) { # include <OpenFOAM/setRootCase.H> # include <OpenFOAM/createTime.H> # include <OpenFOAM/createMesh.H> # include "createFields.H" # include <finiteVolume/initContinuityErrs.H> //mesh.clearPrimitives(); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; for (runTime++; !runTime.end(); runTime++) { Info<< "Time = " << runTime.timeName() << nl << endl; # include <finiteVolume/readSIMPLEControls.H> p.storePrevIter(); // Pressure-velocity SIMPLE corrector { // Momentum predictor tmp<fvVectorMatrix> UrelEqn ( fvm::div(phi, Urel) + turbulence->divDevReff(Urel) + SRF->Su() ); UrelEqn().relax(); solve(UrelEqn() == -fvc::grad(p)); p.boundaryField().updateCoeffs(); volScalarField AUrel = UrelEqn().A(); Urel = UrelEqn().H()/AUrel; UrelEqn.clear(); phi = fvc::interpolate(Urel) & mesh.Sf(); adjustPhi(phi, Urel, p); // Non-orthogonal pressure corrector loop for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix pEqn ( fvm::laplacian(1.0/AUrel, p) == fvc::div(phi) ); pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); if (nonOrth == nNonOrthCorr) { phi -= pEqn.flux(); } } # include <finiteVolume/continuityErrs.H> // Explicitly relax pressure for momentum corrector p.relax(); // Momentum corrector Urel -= fvc::grad(p)/AUrel; Urel.correctBoundaryConditions(); } turbulence->correct(); if (runTime.outputTime()) { volVectorField Uabs ( IOobject ( "Uabs", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), Urel + SRF->U() ); runTime.write(); } Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return(0); }