This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/multiSolver/multiSolverDemo/solverIcoFoam.H

72 lines
1.6 KiB
C
Raw Normal View History

2011-06-20 00:52:40 +00:00
# include "createTime.H"
# include "createMesh.H"
pisoControl piso(mesh);
2011-06-20 00:52:40 +00:00
# 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())
2011-06-20 00:52:40 +00:00
{
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf())
2011-06-20 00:52:40 +00:00
+ fvc::ddtPhiCorr(rUA, U, phi);
adjustPhi(phi, U, p);
while (piso.correctNonOrthogonal())
2011-06-20 00:52:40 +00:00
{
fvScalarMatrix pEqn
(
fvm::laplacian(rUA, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (piso.finalNonOrthogonalIter())
2011-06-20 00:52:40 +00:00
{
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;