70 lines
1.7 KiB
C
70 lines
1.7 KiB
C
|
|
||
|
# include "createTime.H"
|
||
|
# include "createMesh.H"
|
||
|
# include "createFields_icoFoam.H"
|
||
|
# include "initContinuityErrs.H"
|
||
|
|
||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||
|
|
||
|
Info<< "\nStarting time loop\n" << endl;
|
||
|
|
||
|
for (runTime++; !runTime.end(); runTime++)
|
||
|
{
|
||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||
|
|
||
|
# include "readPISOControls.H"
|
||
|
# include "CourantNo.H"
|
||
|
|
||
|
fvVectorMatrix UEqn
|
||
|
(
|
||
|
fvm::ddt(U)
|
||
|
+ fvm::div(phi, U)
|
||
|
- fvm::laplacian(nu, U)
|
||
|
);
|
||
|
|
||
|
solve(UEqn == -fvc::grad(p));
|
||
|
|
||
|
// --- PISO loop
|
||
|
|
||
|
for (int corr=0; corr<nCorr; corr++)
|
||
|
{
|
||
|
volScalarField rUA = 1.0/UEqn.A();
|
||
|
|
||
|
U = rUA*UEqn.H();
|
||
|
phi = (fvc::interpolate(U) & mesh.Sf())
|
||
|
+ fvc::ddtPhiCorr(rUA, U, phi);
|
||
|
|
||
|
adjustPhi(phi, U, p);
|
||
|
|
||
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||
|
{
|
||
|
fvScalarMatrix pEqn
|
||
|
(
|
||
|
fvm::laplacian(rUA, p) == fvc::div(phi)
|
||
|
);
|
||
|
|
||
|
pEqn.setReference(pRefCell, pRefValue);
|
||
|
pEqn.solve();
|
||
|
|
||
|
if (nonOrth == nNonOrthCorr)
|
||
|
{
|
||
|
phi -= pEqn.flux();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
# include "continuityErrs.H"
|
||
|
|
||
|
U -= rUA*fvc::grad(p);
|
||
|
U.correctBoundaryConditions();
|
||
|
}
|
||
|
|
||
|
runTime.write();
|
||
|
|
||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||
|
<< nl << endl;
|
||
|
}
|
||
|
|
||
|
Info<< "End\n" << endl;
|
||
|
|