]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix glitch with assemble_threshold, avoid division by zero 970/head
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 28 May 2015 12:58:36 +0000 (14:58 +0200)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 28 May 2015 12:58:36 +0000 (14:58 +0200)
include/deal.II/algorithms/newton.templates.h

index 1cfb920113b9d297bb0781133c3c4520cec8d73d..4d5b2ad232e5a139b0744bfc774c45f8854c03eb 100644 (file)
@@ -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);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.