From 3235037173b64a020aa4dbf84571135d9cad16cc Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Sun, 6 Jul 2014 00:47:18 +0200 Subject: [PATCH] [Cleanup] Do not require 2 fixed point iterations --- src/sand-wedge.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/sand-wedge.cc b/src/sand-wedge.cc index 9972840c..db6fc471 100644 --- a/src/sand-wedge.cc +++ b/src/sand-wedge.cc @@ -128,7 +128,7 @@ class FixedPointIterator { multigridStep, velocityMaxIterations_, velocityTolerance_, &velocityMatrixNorm, verbosity_, false); // absolute error - Vector previousVelocityIterate; + Vector previousVelocityIterate = velocityIterate; for (size_t fixedPointIteration = 1; fixedPointIteration <= fixedPointMaxIterations_; @@ -152,12 +152,10 @@ class FixedPointIterator { velocityProblemSolver.preprocess(); velocityProblemSolver.solve(); - if (fixedPointIteration > 1) { - auto const velocityCorrection = - velocityMatrixNorm.diff(previousVelocityIterate, velocityIterate); - if (velocityCorrection < fixedPointTolerance_) - break; - } + if (velocityMatrixNorm.diff(previousVelocityIterate, velocityIterate) < + fixedPointTolerance_) + break; + if (fixedPointIteration == fixedPointMaxIterations_) DUNE_THROW(Dune::Exception, "FPI failed to converge"); -- GitLab