From: Guido Kanschat Date: Thu, 28 May 2015 12:58:36 +0000 (+0200) Subject: fix glitch with assemble_threshold, avoid division by zero X-Git-Tag: v8.3.0-rc1~144^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F970%2Fhead;p=dealii.git fix glitch with assemble_threshold, avoid division by zero --- diff --git a/include/deal.II/algorithms/newton.templates.h b/include/deal.II/algorithms/newton.templates.h index 1cfb920113..4d5b2ad232 100644 --- a/include/deal.II/algorithms/newton.templates.h +++ b/include/deal.II/algorithms/newton.templates.h @@ -122,7 +122,7 @@ namespace Algorithms // fill res with (f(u), v) (*residual)(out1, src1); double resnorm = res->l2_norm(); - double old_residual = resnorm / assemble_threshold + 1; + double old_residual = 0.; if (debug_vectors) { @@ -140,7 +140,7 @@ namespace Algorithms while (control.check(step++, resnorm) == SolverControl::iterate) { // assemble (Df(u), v) - if (resnorm/old_residual >= assemble_threshold) + if ((step > 1) && (resnorm/old_residual >= assemble_threshold)) inverse_derivative->notify (Events::bad_derivative); Du->reinit(u);