diff --git a/applications/solvers/basic/laplacianFoam/laplacianFoam.C b/applications/solvers/basic/laplacianFoam/laplacianFoam.C index 830a266a40..5ed2849be9 100644 --- a/applications/solvers/basic/laplacianFoam/laplacianFoam.C +++ b/applications/solvers/basic/laplacianFoam/laplacianFoam.C @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { solve ( diff --git a/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C b/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C index 7dbbc97dac..8eade6a545 100644 --- a/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C +++ b/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { solve ( diff --git a/applications/solvers/combustion/PDRFoam/PDRFoam.C b/applications/solvers/combustion/PDRFoam/PDRFoam.C index 40a48cfbdb..bf70e83c5d 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoam.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoam.C @@ -114,12 +114,12 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=1; corr<=pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "bEqn.H" #include "ftEqn.H" diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index 557c8aa1fb..0c5082df04 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C @@ -167,13 +167,13 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=1; corr<=pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "bEqn.H" #include "ftEqn.H" diff --git a/applications/solvers/combustion/PDRFoam/pEqn.H b/applications/solvers/combustion/PDRFoam/pEqn.H index 3c6a6341f9..e2a2a471e2 100644 --- a/applications/solvers/combustion/PDRFoam/pEqn.H +++ b/applications/solvers/combustion/PDRFoam/pEqn.H @@ -15,7 +15,7 @@ if (pimple.transonic()) ) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -24,12 +24,9 @@ if (pimple.transonic()) - fvm::laplacian(rho*invA, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -44,7 +41,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -53,12 +50,9 @@ else - fvm::laplacian(rho*invA, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/XiFoam/XiFoam.C b/applications/solvers/combustion/XiFoam/XiFoam.C index 71b03064fa..069e5b8caa 100644 --- a/applications/solvers/combustion/XiFoam/XiFoam.C +++ b/applications/solvers/combustion/XiFoam/XiFoam.C @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" @@ -105,8 +105,8 @@ int main(int argc, char *argv[]) hu == h; } - // --- PISO loop - for (int corr=0; corrcorrect(); #include "UEqn.H" #include "hEqn.H" - // --- PISO loop - for (int corr=0; corr tpEqn; @@ -37,7 +37,7 @@ if (simple.transonic()) tpEqn().solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi == tpEqn().flux(); } @@ -50,7 +50,7 @@ else closedVolume = adjustPhi(phi, U, p); - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { tmp tpEqn; @@ -67,7 +67,7 @@ else tpEqn().solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi -= tpEqn().flux(); } diff --git a/applications/solvers/compressible/rhoSimplecFoam/pEqn.H b/applications/solvers/compressible/rhoSimplecFoam/pEqn.H index 9eb783feca..ccc7a1b21e 100644 --- a/applications/solvers/compressible/rhoSimplecFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimplecFoam/pEqn.H @@ -14,7 +14,7 @@ bool closedVolume = false; if (simple.transonic()) { - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { surfaceScalarField phid ( @@ -44,17 +44,9 @@ if (simple.transonic()) pEqn.setReference(pRefCell, pRefValue); - // Retain the residual from the first iteration - if (nonOrth == 0) - { - pEqn.solve(); - } - else - { - pEqn.solve(); - } + pEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi == phic + pEqn.flux(); } @@ -62,7 +54,7 @@ if (simple.transonic()) } else { - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { phi = fvc::interpolate(rho*U) & mesh.Sf(); closedVolume = adjustPhi(phi, U, p); @@ -77,18 +69,9 @@ else pEqn.setReference(pRefCell, pRefValue); - // Retain the residual from the first iteration - if (nonOrth == 0) - { - pEqn.solve(); - } - else - { - pEqn.solve(); - } + pEqn.solve(); - - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C b/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C index c0311807d4..37bea3c176 100644 --- a/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C +++ b/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) runTime++; - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { solve(fvm::laplacian(murf, psi) + fvc::div(murf*Mrf)); } diff --git a/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/pEqn.H index 17bf590f29..d2793d7192 100644 --- a/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/pEqn.H @@ -14,7 +14,7 @@ surfaceScalarField buoyancyPhi(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); phi -= buoyancyPhi; - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -24,7 +24,7 @@ p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { // Calculate the conservative fluxes phi -= p_rghEqn.flux(); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C index c00c1fe8d8..461578e864 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C @@ -79,13 +79,13 @@ int main(int argc, char *argv[]) #include "setDeltaT.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "TEqn.H" - // --- PISO loop - for (int corr=0; corr tpEqn; @@ -25,17 +25,10 @@ for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) } tpEqn().setReference(pRefCell, pRefValue); - // retain the residual from the first iteration - if (nonOrth == 0) - { - tpEqn().solve(); - } - else - { - tpEqn().solve(); - } - if (nonOrth == simple.nNonOrthCorr()) + tpEqn().solve(); + + if (simple.finalNonOrthogonalIter()) { phi -= tpEqn().flux(); } diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C b/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C index dc642e7c72..23c9e03229 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C @@ -87,7 +87,7 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { turbulence->correct(); @@ -95,8 +95,8 @@ int main(int argc, char *argv[]) #include "YEqn.H" #include "hsEqn.H" - // --- PISO loop - for (int corr=0; corrcorrect(); - // --- Outer-corrector loop - for (pimple.start(); pimple.loop(); pimple++) + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) { #include "alphaEqnsSubCycle.H" @@ -125,8 +125,8 @@ int main(int argc, char *argv[]) #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr 1 && pimple.nOuterCorr() != 1) + if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) { FatalErrorIn(args.executable()) << "Sub-cycling alpha is only allowed for PISO, " diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 02d6764ae2..4ad1b3d01d 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -74,8 +74,8 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - // --- Outer-corrector loop - for (pimple.start(); pimple.loop(); pimple++) + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) { #include "alphaEqnsSubCycle.H" @@ -83,8 +83,8 @@ int main(int argc, char *argv[]) #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr 1 && pimple.nOuterCorr() != 1) + if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) { FatalErrorIn(args.executable()) - << "Sub-cycling alpha is only allowed for PISO, " + << "Sub-cycling alpha is only allowed for PISO operation, " "i.e. when the number of outer-correctors = 1" << exit(FatalError); } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C index c764472cb7..d29da482ba 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "alphaEqn.H" #include "kEpsilon.H" @@ -85,8 +85,8 @@ int main(int argc, char *argv[]) #include "TEqns.H" #include "UEqns.H" - // --- PISO loop - for (int corr=0; corrcorrect(); // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corrcorrect(); // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr("nOuterCorrectors", 1); - nCorr_ = pimpleDict.lookupOrDefault