From 111cdf3a65c2840b6b7ba7ef817b28ce30e545e3 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Mon, 11 Feb 2019 17:10:38 +0000 Subject: [PATCH] solutionControl: Renaming and improved final logic The sub-loops of the solution control are now named more consistently, with ambiguously named methods such as finalIter replaced with ones like finalPimpleIter, so that it is clear which loop they represent. In addition, the final logic has been improved so that it restores state after a sub-iteration, and so that sub-iterations can be used on their own without an outer iteration in effect. Previously, if the non-orthogonal loop were used outside of a pimple/piso iteration, the final iteration would not execute with final settings. --- .../basic/potentialFoam/potentialFoam.C | 6 +-- .../solvers/combustion/reactingFoam/pEqn.H | 2 +- .../solvers/combustion/reactingFoam/pcEqn.H | 2 +- .../rhoReactingFoam/rhoReactingFoam.C | 6 +-- .../compressible/rhoPimpleFoam/correctPhi.H | 4 +- .../solvers/compressible/rhoPimpleFoam/pEqn.H | 2 +- .../compressible/rhoPimpleFoam/pcEqn.H | 2 +- .../rhoPimpleFoam/rhoPimpleFoam.C | 6 +-- .../chtMultiRegionFoam/fluid/pEqn.H | 2 +- .../chtMultiRegionFoam/fluid/solveFluid.H | 2 +- .../pimpleFoam/SRFPimpleFoam/pEqn.H | 2 +- .../incompressible/pimpleFoam/correctPhi.H | 4 +- .../solvers/incompressible/pimpleFoam/pEqn.H | 2 +- .../incompressible/pimpleFoam/pimpleFoam.C | 4 +- .../solvers/lagrangian/DPMFoam/correctPhic.H | 4 +- .../solvers/lagrangian/sprayFoam/pEqn.H | 2 +- .../compressibleInterFoam.C | 4 +- .../compressibleInterFoam/correctPhi.H | 4 +- .../solvers/multiphase/interFoam/correctPhi.H | 4 +- .../multiphase/interFoam/initCorrectPhi.H | 4 +- .../solvers/multiphase/interFoam/interFoam.C | 4 +- .../interMixingFoam/interMixingFoam.C | 4 +- .../interPhaseChangeFoam/correctPhi.H | 4 +- .../interPhaseChangeFoam/initCorrectPhi.H | 4 +- .../interPhaseChangeFoam.C | 4 +- .../multiphaseEulerFoam/correctPhi.H | 4 +- .../multiphaseInterFoam/multiphaseInterFoam.C | 4 +- .../potentialFreeSurfaceFoam/correctPhi.H | 4 +- .../potentialFreeSurfaceFoam/pEqn.H | 2 +- .../potentialFreeSurfaceFoam.C | 4 +- .../populationBalanceModel.C | 2 +- .../moveDynamicMesh/moveDynamicMesh.C | 4 +- .../pimpleControl/pimpleControl.C | 11 ++--- .../pimpleControl/pimpleControl.H | 2 +- .../pimpleControl/pimpleControlI.H | 4 +- .../pimpleControl/pimpleLoop/pimpleLoop.C | 13 ++--- .../pimpleControl/pimpleLoop/pimpleLoop.H | 11 ++--- .../pimpleControl/pimpleLoop/pimpleLoopI.H | 22 ++++----- .../pimpleMultiRegionControl.C | 25 +++++----- .../pimpleMultiRegionControlI.H | 4 +- .../pimpleNoLoopControl/pimpleNoLoopControl.C | 14 +++++- .../pimpleNoLoopControl/pimpleNoLoopControl.H | 19 ++++++-- .../solutionControl/pisoControl/pisoControl.C | 48 ++++++------------- .../solutionControl/pisoControl/pisoControl.H | 35 +++++++------- .../pisoControl/pisoControlI.H | 22 +++++---- .../simpleControl/simpleControl.C | 8 +--- .../simpleControl/simpleControl.H | 8 +--- .../solidNoLoopControl/solidNoLoopControl.C | 14 ++++-- .../solidNoLoopControl/solidNoLoopControl.H | 26 ++++++++-- .../nonOrthogonalSolutionControl.C | 45 ++++------------- .../nonOrthogonalSolutionControl.H | 15 +++--- .../nonOrthogonalSolutionControlI.H | 16 +++++-- .../singleRegionSolutionControl.C | 19 +++++++- .../singleRegionSolutionControl.H | 9 +++- 54 files changed, 248 insertions(+), 254 deletions(-) diff --git a/applications/solvers/basic/potentialFoam/potentialFoam.C b/applications/solvers/basic/potentialFoam/potentialFoam.C index fe19cf0cc8..5904a31525 100644 --- a/applications/solvers/basic/potentialFoam/potentialFoam.C +++ b/applications/solvers/basic/potentialFoam/potentialFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "pisoControl.H" +#include "nonOrthogonalSolutionControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" - pisoControl potentialFlow(mesh, "potentialFlow"); + nonOrthogonalSolutionControl potentialFlow(mesh, "potentialFlow"); #include "createFields.H" diff --git a/applications/solvers/combustion/reactingFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/pEqn.H index 9f8f837ee2..d16070952b 100644 --- a/applications/solvers/combustion/reactingFoam/pEqn.H +++ b/applications/solvers/combustion/reactingFoam/pEqn.H @@ -4,7 +4,7 @@ volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); -if (pimple.nCorrPISO() <= 1) +if (pimple.nCorrPiso() <= 1) { tUEqn.clear(); } diff --git a/applications/solvers/combustion/reactingFoam/pcEqn.H b/applications/solvers/combustion/reactingFoam/pcEqn.H index 8d514f3a40..45f2573d39 100644 --- a/applications/solvers/combustion/reactingFoam/pcEqn.H +++ b/applications/solvers/combustion/reactingFoam/pcEqn.H @@ -4,7 +4,7 @@ volScalarField rAU(1.0/UEqn.A()); volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1())); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); -if (pimple.nCorrPISO() <= 1) +if (pimple.nCorrPiso() <= 1) { tUEqn.clear(); } diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/rhoReactingFoam.C b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/rhoReactingFoam.C index 3e67f88fe7..bb3d92dedf 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/rhoReactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/rhoReactingFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - if (pimple.firstIter() || moveMeshOuterCorrectors) + if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) { // Store momentum to set rhoUf for introduced faces. autoPtr rhoU; @@ -139,7 +139,7 @@ int main(int argc, char *argv[]) } } - if (pimple.firstIter() && !pimple.simpleRho()) + if (pimple.firstPimpleIter() && !pimple.simpleRho()) { #include "rhoEqn.H" } diff --git a/applications/solvers/compressible/rhoPimpleFoam/correctPhi.H b/applications/solvers/compressible/rhoPimpleFoam/correctPhi.H index d142a3ed66..d71739f8fb 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/correctPhi.H +++ b/applications/solvers/compressible/rhoPimpleFoam/correctPhi.H @@ -1,5 +1,3 @@ -nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName()); - CorrectPhi ( U, @@ -9,5 +7,5 @@ CorrectPhi psi, dimensionedScalar("rAUf", dimTime, 1), divrhoU(), - pcorrControl + pimple ); diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H index 9c6785109f..79c76f8c5a 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H @@ -11,7 +11,7 @@ volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); -if (pimple.nCorrPISO() <= 1) +if (pimple.nCorrPiso() <= 1) { tUEqn.clear(); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H index 62033c1ae8..b2016bcf8b 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H @@ -11,7 +11,7 @@ volScalarField rAU(1.0/UEqn.A()); volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1())); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); -if (pimple.nCorrPISO() <= 1) +if (pimple.nCorrPiso() <= 1) { tUEqn.clear(); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index fd0c922baa..9c5c2a8984 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - if (pimple.firstIter() || moveMeshOuterCorrectors) + if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) { // Store momentum to set rhoUf for introduced faces. autoPtr rhoU; @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) } } - if (pimple.firstIter() && !pimple.simpleRho()) + if (pimple.firstPimpleIter() && !pimple.simpleRho()) { #include "rhoEqn.H" } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H index 3c5098a38e..3dd6922d4a 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H @@ -6,7 +6,7 @@ if (!mesh.steady() && !pimple.simpleRho()) volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); -if (pimple.nCorrPISO() <= 1) +if (pimple.nCorrPiso() <= 1) { tUEqn.clear(); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/solveFluid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/solveFluid.H index f56be68e86..b543c07dde 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/solveFluid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/solveFluid.H @@ -24,7 +24,7 @@ else turbulence.correct(); } - if (!mesh.steady() && pimples.finalIter()) + if (!mesh.steady() && pimples.finalPimpleIter()) { rho = thermo.rho(); } diff --git a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H index f904075ed7..d56081ed55 100644 --- a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H @@ -21,7 +21,7 @@ if (pimple.consistent()) HbyA -= (rAUrel - rAtUrel())*fvc::grad(p); } -if (pimple.nCorrPISO() <= 1) +if (pimple.nCorrPiso() <= 1) { tUrelEqn.clear(); } diff --git a/applications/solvers/incompressible/pimpleFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/correctPhi.H index 29fe7f0180..da0ee46df6 100644 --- a/applications/solvers/incompressible/pimpleFoam/correctPhi.H +++ b/applications/solvers/incompressible/pimpleFoam/correctPhi.H @@ -1,5 +1,3 @@ -nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName()); - CorrectPhi ( U, @@ -7,7 +5,7 @@ CorrectPhi p, dimensionedScalar("rAUf", dimTime, 1), geometricZeroField(), - pcorrControl + pimple ); #include "continuityErrs.H" diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H index fd7a4ee871..da7e5d26c8 100644 --- a/applications/solvers/incompressible/pimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H @@ -26,7 +26,7 @@ if (pimple.consistent()) HbyA -= (rAU - rAtU())*fvc::grad(p); } -if (pimple.nCorrPISO() <= 1) +if (pimple.nCorrPiso() <= 1) { tUEqn.clear(); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C index af02b442b8..b970945062 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - if (pimple.firstIter() || moveMeshOuterCorrectors) + if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) { mesh.update(); diff --git a/applications/solvers/lagrangian/DPMFoam/correctPhic.H b/applications/solvers/lagrangian/DPMFoam/correctPhic.H index 149f31122e..46ef721fa2 100644 --- a/applications/solvers/lagrangian/DPMFoam/correctPhic.H +++ b/applications/solvers/lagrangian/DPMFoam/correctPhic.H @@ -1,5 +1,3 @@ -nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName()); - CorrectPhi ( Uc, @@ -7,7 +5,7 @@ CorrectPhi p, dimensionedScalar("rAUf", dimTime, 1), geometricZeroField(), - pcorrControl + pimple ); #include "continuityErrs.H" diff --git a/applications/solvers/lagrangian/sprayFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/pEqn.H index d006952d34..e1c09c9217 100644 --- a/applications/solvers/lagrangian/sprayFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/pEqn.H @@ -7,7 +7,7 @@ volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); -if (pimple.nCorrPISO() <= 1) +if (pimple.nCorrPiso() <= 1) { tUEqn.clear(); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 747f0a0d5b..979c659716 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - if (pimple.firstIter() || moveMeshOuterCorrectors) + if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) { mesh.update(); diff --git a/applications/solvers/multiphase/compressibleInterFoam/correctPhi.H b/applications/solvers/multiphase/compressibleInterFoam/correctPhi.H index aa789b72b6..79860853b8 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/correctPhi.H +++ b/applications/solvers/multiphase/compressibleInterFoam/correctPhi.H @@ -1,5 +1,3 @@ -nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName()); - CorrectPhi ( U, @@ -7,7 +5,7 @@ CorrectPhi p, dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1), divU, - pcorrControl + pimple ); #include "continuityErrs.H" diff --git a/applications/solvers/multiphase/interFoam/correctPhi.H b/applications/solvers/multiphase/interFoam/correctPhi.H index c4c30431ed..fcb5020587 100644 --- a/applications/solvers/multiphase/interFoam/correctPhi.H +++ b/applications/solvers/multiphase/interFoam/correctPhi.H @@ -1,5 +1,3 @@ -nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName()); - CorrectPhi ( U, @@ -7,7 +5,7 @@ CorrectPhi p_rgh, surfaceScalarField("rAUf", fvc::interpolate(rAU())), geometricZeroField(), - pcorrControl + pimple ); #include "continuityErrs.H" diff --git a/applications/solvers/multiphase/interFoam/initCorrectPhi.H b/applications/solvers/multiphase/interFoam/initCorrectPhi.H index 7dca181930..76e0646a63 100644 --- a/applications/solvers/multiphase/interFoam/initCorrectPhi.H +++ b/applications/solvers/multiphase/interFoam/initCorrectPhi.H @@ -20,8 +20,6 @@ if (correctPhi) } else { - nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName()); - CorrectPhi ( U, @@ -29,7 +27,7 @@ else p_rgh, dimensionedScalar(dimTime/rho.dimensions(), 1), geometricZeroField(), - pcorrControl + pimple ); #include "continuityErrs.H" diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 0b65af9ee1..5faf9fb85c 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - if (pimple.firstIter() || moveMeshOuterCorrectors) + if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) { mesh.update(); diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C index 0ed4b33efb..93b2b7e861 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - if (pimple.firstIter() || moveMeshOuterCorrectors) + if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) { mesh.update(); diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H b/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H index df68d5fc0e..58b79bed40 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H @@ -1,5 +1,3 @@ -nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName()); - CorrectPhi ( U, @@ -7,7 +5,7 @@ CorrectPhi p_rgh, surfaceScalarField("rAUf", fvc::interpolate(rAU())), divU, - pcorrControl + pimple ); #include "continuityErrs.H" diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/initCorrectPhi.H b/applications/solvers/multiphase/interPhaseChangeFoam/initCorrectPhi.H index 537dcf6e64..59b96c87a9 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/initCorrectPhi.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/initCorrectPhi.H @@ -22,8 +22,6 @@ if (correctPhi) } else { - nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName()); - CorrectPhi ( U, @@ -31,7 +29,7 @@ else p_rgh, dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1), geometricZeroField(), - pcorrControl + pimple ); #include "continuityErrs.H" diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C index e563565381..4150454a9e 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -96,7 +96,7 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - if (pimple.firstIter() || moveMeshOuterCorrectors) + if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) { mesh.update(); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H b/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H index 425cc4cb75..9afcd58a66 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H @@ -1,5 +1,3 @@ -nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName()); - CorrectPhi ( U, @@ -7,7 +5,7 @@ CorrectPhi p_rgh, dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1), geometricZeroField(), - pcorrControl + pimple ); #include "continuityErrs.H" diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C index 35a61bbc2e..d62117b8a8 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - if (pimple.firstIter() || moveMeshOuterCorrectors) + if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) { scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/correctPhi.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/correctPhi.H index 92e208bd1d..f060cce12c 100644 --- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/correctPhi.H +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/correctPhi.H @@ -1,5 +1,3 @@ -nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName()); - CorrectPhi ( U, @@ -7,7 +5,7 @@ CorrectPhi p_gh, surfaceScalarField("rAUf", fvc::interpolate(rAU)), geometricZeroField(), - pcorrControl + pimple ); #include "continuityErrs.H" diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H index ec342f7d67..6d9409b7dd 100644 --- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H @@ -2,7 +2,7 @@ rAU = 1.0/UEqn.A(); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_gh)); -if (pimple.nCorrPISO() <= 1) +if (pimple.nCorrPiso() <= 1) { tUEqn.clear(); } diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C index c1aa5d87ac..ef88eb2d4e 100644 --- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - if (pimple.firstIter() || moveMeshOuterCorrectors) + if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) { scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C index 580f47ae81..c862f1921f 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C @@ -1233,7 +1233,7 @@ void Foam::diameterModels::populationBalanceModel::solve() bool solveOnFinalIterOnly = solutionControls.lookupOrDefault("solveOnFinalIterOnly", false); - if (!solveOnFinalIterOnly || pimple_.finalIter()) + if (!solveOnFinalIterOnly || pimple_.finalPimpleIter()) { const label nCorr = this->nCorr(); const scalar tolerance = diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C index b7079f30c3..4443614c24 100644 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C +++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) while (pimple.loop()) { - if (pimple.firstIter() || moveMeshOuterCorrectors) + if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) { mesh.update(); } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.C index 2ecfa7e32b..5144ebe4ca 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,7 +37,7 @@ namespace Foam Foam::pimpleControl::pimpleControl(fvMesh& mesh, const word& algorithmName) : - pimpleNoLoopControl(mesh, algorithmName), + pimpleNoLoopControl(mesh, algorithmName, *this), pimpleLoop(static_cast(*this)) { read(); @@ -91,17 +91,14 @@ bool Foam::pimpleControl::loop() if (!pimpleLoop::loop(*this)) { - mesh().data::remove("finalIteration"); + updateFinal(); return false; } storePrevIterFields(); - if (finalIter()) - { - mesh().data::add("finalIteration", true); - } + updateFinal(); return true; } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.H index 2edfa12e55..9a0dc02889 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControlI.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControlI.H index 23042fc14d..995db033f0 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControlI.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControlI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,7 @@ License inline bool Foam::pimpleControl::turbCorr() const { - return !turbOnFinalIterOnly() || finalIter(); + return !turbOnFinalIterOnly() || finalPimpleIter(); } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C index 18a1183e4e..21bcb1b4e7 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -67,15 +67,13 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence) { read(); - ++ corrPimple_; - // Handle quit conditions first { // If converged on the last iteration then end the correction loop if (converged_) { - Info<< control_.algorithmName() << ": Converged in " - << corrPimple_ - 1 << " iterations" << endl; + Info<< control_.algorithmName() << ": Converged in " << corrPimple_ + << " iterations" << endl; corrPimple_ = 0; converged_ = false; @@ -84,7 +82,7 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence) } // If all corrections have been completed then end the correction loop - if (corrPimple_ > nCorrPimple_) + if (corrPimple_ >= nCorrPimple_) { if (convergence.hasCorrResidualControls() && nCorrPimple_ > 1) { @@ -100,6 +98,9 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence) } // If we reached here, we are doing another loop + ++ corrPimple_; + + // Set up the next loop { // If convergence has been reached then set the flag so that the loop // exits next time around diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.H index 81b0764c6b..b41a0eb439 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,18 +99,15 @@ public: //- Maximum number of pimple correctors inline label nCorrPimple() const; + //- Flat to indicate any pimple iteration + inline bool anyPimpleIter() const; + //- Flag to indicate the first pimple iteration inline bool firstPimpleIter() const; //- Flag to indicate the last pimple iteration inline bool finalPimpleIter() const; - //- Flag to indicate the first iteration - inline bool firstIter() const; - - //- Flag to indicate the last iteration - inline bool finalIter() const; - // Evolution diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoopI.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoopI.H index 9799e67f39..5e2592b201 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoopI.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoopI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,12 @@ inline Foam::label Foam::pimpleLoop::nCorrPimple() const } +inline bool Foam::pimpleLoop::anyPimpleIter() const +{ + return corrPimple_ != 0; +} + + inline bool Foam::pimpleLoop::firstPimpleIter() const { return corrPimple_ == 1; @@ -39,19 +45,7 @@ inline bool Foam::pimpleLoop::firstPimpleIter() const inline bool Foam::pimpleLoop::finalPimpleIter() const { - return corrPimple_ >= nCorrPimple_; -} - - -inline bool Foam::pimpleLoop::firstIter() const -{ - return firstPimpleIter(); -} - - -inline bool Foam::pimpleLoop::finalIter() const -{ - return converged_ || finalPimpleIter(); + return converged_ || corrPimple_ >= nCorrPimple_; } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleMultiRegionControl/pimpleMultiRegionControl.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleMultiRegionControl/pimpleMultiRegionControl.C index 5ceb8d203b..4af741dc1b 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleMultiRegionControl/pimpleMultiRegionControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleMultiRegionControl/pimpleMultiRegionControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,7 +84,7 @@ Foam::pimpleMultiRegionControl::pimpleMultiRegionControl { pimpleControls_.append ( - new pimpleNoLoopControl(pimpleMeshes[i], algorithmName) + new pimpleNoLoopControl(pimpleMeshes[i], algorithmName, *this) ); allSteady = allSteady && pimpleMeshes[i].steady(); @@ -95,7 +95,7 @@ Foam::pimpleMultiRegionControl::pimpleMultiRegionControl { solidControls_.append ( - new solidNoLoopControl(solidMeshes[i], algorithmName) + new solidNoLoopControl(solidMeshes[i], algorithmName, *this) ); allSteady = allSteady && solidMeshes[i].steady(); @@ -278,11 +278,11 @@ bool Foam::pimpleMultiRegionControl::loop() { forAll(pimpleControls_, i) { - pimpleControls_[i].mesh().data::remove("finalIteration"); + pimpleControls_[i].updateFinal(); } forAll(solidControls_, i) { - solidControls_[i].mesh().data::remove("finalIteration"); + solidControls_[i].updateFinal(); } return false; @@ -297,16 +297,13 @@ bool Foam::pimpleMultiRegionControl::loop() solidControls_[i].storePrevIterFields(); } - if (finalIter()) + forAll(pimpleControls_, i) { - forAll(pimpleControls_, i) - { - pimpleControls_[i].mesh().data::add("finalIteration", true); - } - forAll(solidControls_, i) - { - solidControls_[i].mesh().data::add("finalIteration", true); - } + pimpleControls_[i].updateFinal(); + } + forAll(solidControls_, i) + { + solidControls_[i].updateFinal(); } return true; diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleMultiRegionControl/pimpleMultiRegionControlI.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleMultiRegionControl/pimpleMultiRegionControlI.H index cc6700a98b..d66206d0cc 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleMultiRegionControl/pimpleMultiRegionControlI.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleMultiRegionControl/pimpleMultiRegionControlI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,7 @@ Foam::pimpleMultiRegionControl::solid(const label i) inline bool Foam::pimpleMultiRegionControl::pimpleTurbCorr(const label i) const { - return !pimpleControls_[i].turbOnFinalIterOnly() || finalIter(); + return !pimpleControls_[i].turbOnFinalIterOnly() || finalPimpleIter(); } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleNoLoopControl/pimpleNoLoopControl.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleNoLoopControl/pimpleNoLoopControl.C index 768a65810f..8e3e09eaaf 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleNoLoopControl/pimpleNoLoopControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleNoLoopControl/pimpleNoLoopControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,8 @@ namespace Foam Foam::pimpleNoLoopControl::pimpleNoLoopControl ( fvMesh& mesh, - const word& algorithmName + const word& algorithmName, + const pimpleLoop& loop ) : pisoControl(mesh, algorithmName), @@ -51,6 +52,7 @@ Foam::pimpleNoLoopControl::pimpleNoLoopControl static_cast(*this), "outerCorrector" ), + loop_(loop), simpleRho_(false), turbOnFinalIterOnly_(true) { @@ -90,4 +92,12 @@ bool Foam::pimpleNoLoopControl::read() } +bool Foam::pimpleNoLoopControl::isFinal() const +{ + return + (!anyPisoIter() && loop_.finalPimpleIter()) + || pisoControl::isFinal(); +} + + // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleNoLoopControl/pimpleNoLoopControl.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleNoLoopControl/pimpleNoLoopControl.H index ee2139f835..24c40513e0 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleNoLoopControl/pimpleNoLoopControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleNoLoopControl/pimpleNoLoopControl.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,6 +38,7 @@ SourceFiles #ifndef pimpleNoLoopControl_H #define pimpleNoLoopControl_H +#include "pimpleLoop.H" #include "pisoControl.H" #include "singleRegionConvergenceControl.H" #include "singleRegionCorrectorConvergenceControl.H" @@ -64,6 +65,9 @@ protected: // Protected data + //- The pimple loop + const pimpleLoop& loop_; + //- Flag to indicate whether to update the density in SIMPLE mode rather // than PISO mode bool simpleRho_; @@ -83,8 +87,14 @@ public: // Constructors - //- Construct from a mesh and the name of the algorithm - pimpleNoLoopControl(fvMesh& mesh, const word& algorithmName); + //- Construct from a mesh, the name of the algorithm, and a reference + // to the pimple loop + pimpleNoLoopControl + ( + fvMesh& mesh, + const word& algorithmName, + const pimpleLoop& loop + ); //- Destructor @@ -100,6 +110,9 @@ public: // Access + //- Flag to indicate whether in final state + virtual bool isFinal() const; + //- Flag to indicate whether to update the density in simple mode inline bool simpleRho() const; diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pisoControl/pisoControl.C b/src/finiteVolume/cfdTools/general/solutionControl/pisoControl/pisoControl.C index 06838841c2..dd833fe138 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pisoControl/pisoControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pisoControl/pisoControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,8 +38,8 @@ namespace Foam Foam::pisoControl::pisoControl(fvMesh& mesh, const word& algorithmName) : fluidSolutionControl(mesh, algorithmName), - nCorrPISO_(-1), - corrPISO_(0) + nCorrPiso_(-1), + corrPiso_(0) { read(); } @@ -62,57 +62,37 @@ bool Foam::pisoControl::read() const dictionary& solutionDict = dict(); - nCorrPISO_ = solutionDict.lookupOrDefault