From 4bd59d64db473a4f2a3654dc93081d958559dcad Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Thu, 17 May 2018 17:42:33 +0100 Subject: [PATCH] pimpleLoop: Fixed bug when convergence occurs on last iteration Resolves bug report https://bugs.openfoam.org/view.php?id=2940 --- .../pimpleControl/pimpleLoop/pimpleLoop.C | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C index 29c4b03399..4d0051ed2a 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C @@ -71,6 +71,18 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence) // 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; + + corrPimple_ = 0; + converged_ = false; + + return false; + } + // If all corrections have been completed then end the correction loop if (corrPimple_ > nCorrPimple_) { @@ -80,17 +92,6 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence) << nCorrPimple_ << " iterations" << endl; } - corrPimple_ = 0; - - return false; - } - - // If converged on the last iteration then end the correction loop - if (converged_) - { - Info<< control_.algorithmName() << ": Converged in " - << corrPimple_ - 1 << " iterations" << endl; - corrPimple_ = 0; converged_ = false;