diff --git a/dune/solvers/solvers/loopsolver.cc b/dune/solvers/solvers/loopsolver.cc index 1d73be7e026c3fb1d1c9e420a0bd5e319e0231d2..c90363c45e3ff4d50287e4f9e9127e20c5ee08c3 100644 --- a/dune/solvers/solvers/loopsolver.cc +++ b/dune/solvers/solvers/loopsolver.cc @@ -110,7 +110,8 @@ void ::LoopSolver<VectorType, BitVectorType>::solve() // Please don't replace this call to 'diff' by computing the norm of the difference. // In some nonlinear DD applications the 'diff' method may be nonlinear. real_type normOfCorrection = this->errorNorm_->diff(oldSolution,iterationStep_->getSol()); - real_type convRate = normOfCorrection / normOfOldCorrection; + real_type convRate = (normOfOldCorrection > 0) + ? normOfCorrection / normOfOldCorrection : 0.0; error = normOfCorrection; normOfOldCorrection = normOfCorrection; @@ -118,7 +119,7 @@ void ::LoopSolver<VectorType, BitVectorType>::solve() if (referenceSolution_) { normOfError = this->errorNorm_->diff(iterationStep_->getSol(), *referenceSolution_); - convRate = normOfError / normOfOldError; + convRate = (normOfOldError > 0) ? normOfError / normOfOldError : 0.0; error = normOfError; normOfOldError = normOfError; }