Skip to content
Snippets Groups Projects
Commit f1a78af6 authored by Elias Pipping's avatar Elias Pipping
Browse files

Avoid division by zero convergence rate

parent 5dd12933
No related branches found
No related tags found
No related merge requests found
...@@ -110,7 +110,8 @@ void ::LoopSolver<VectorType, BitVectorType>::solve() ...@@ -110,7 +110,8 @@ void ::LoopSolver<VectorType, BitVectorType>::solve()
// Please don't replace this call to 'diff' by computing the norm of the difference. // 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. // In some nonlinear DD applications the 'diff' method may be nonlinear.
real_type normOfCorrection = this->errorNorm_->diff(oldSolution,iterationStep_->getSol()); 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; error = normOfCorrection;
normOfOldCorrection = normOfCorrection; normOfOldCorrection = normOfCorrection;
...@@ -118,7 +119,7 @@ void ::LoopSolver<VectorType, BitVectorType>::solve() ...@@ -118,7 +119,7 @@ void ::LoopSolver<VectorType, BitVectorType>::solve()
if (referenceSolution_) if (referenceSolution_)
{ {
normOfError = this->errorNorm_->diff(iterationStep_->getSol(), *referenceSolution_); normOfError = this->errorNorm_->diff(iterationStep_->getSol(), *referenceSolution_);
convRate = normOfError / normOfOldError; convRate = (normOfOldError > 0) ? normOfError / normOfOldError : 0.0;
error = normOfError; error = normOfError;
normOfOldError = normOfError; normOfOldError = normOfError;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment