From 3f8439f01872827d6c6b71741e22173b9c540fd2 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Thu, 28 May 2015 14:58:36 +0200 Subject: [PATCH] fix glitch with assemble_threshold, avoid division by zero --- include/deal.II/algorithms/newton.templates.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- 2.39.5