71 lines
1.6 KiB
C
71 lines
1.6 KiB
C
|
|
# include "createTime.H"
|
|
# include "createMesh.H"
|
|
|
|
pisoControl piso(mesh);
|
|
|
|
# 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 "CourantNo.H"
|
|
|
|
fvVectorMatrix UEqn
|
|
(
|
|
fvm::ddt(U)
|
|
+ fvm::div(phi, U)
|
|
- fvm::laplacian(nu, U)
|
|
);
|
|
|
|
solve(UEqn == -fvc::grad(p));
|
|
|
|
// --- PISO loop
|
|
|
|
while (piso.correct())
|
|
{
|
|
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);
|
|
|
|
while (piso.correctNonOrthogonal())
|
|
{
|
|
fvScalarMatrix pEqn
|
|
(
|
|
fvm::laplacian(rUA, p) == fvc::div(phi)
|
|
);
|
|
|
|
pEqn.setReference(pRefCell, pRefValue);
|
|
pEqn.solve();
|
|
|
|
if (piso.finalNonOrthogonalIter())
|
|
{
|
|
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;
|
|
|