diff --git a/src/sand-wedge.cc b/src/sand-wedge.cc index 9972840c8910b91072844092658517e37aa24dea..db6fc4714382af87d8567b9ee196f642acd988f3 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");