]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix a sign error in step-25.
authorDavid Wells <wellsd2@rpi.edu>
Sat, 25 Jun 2016 21:31:35 +0000 (17:31 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Sat, 25 Jun 2016 23:40:53 +0000 (19:40 -0400)
Credit for this fix belongs to Anup Basak, who mentioned it on the
mailing list in March 2016.

Even with the sign error the Newton solver converged to the right
solution: changing the sign only altered the solution in the fifth
decimal place.

The fixed version now only requires three, instead of four, Newton steps
in 2D.

examples/step-25/step-25.cc

index 9ce719834df5f748d72fa268045516c4c5cb4165..5ee224cf5833ec40e1aed7203ba9130c3b1c1f06 100644 (file)
@@ -353,7 +353,7 @@ namespace Step25
 
     SparseMatrix<double> tmp_matrix (sparsity_pattern);
     compute_nl_matrix (old_solution, solution, tmp_matrix);
-    system_matrix.add (-std::pow(time_step*theta,2), tmp_matrix);
+    system_matrix.add (std::pow(time_step*theta,2), tmp_matrix);
 
     // Then, we compute the right-hand side vector $-F_h(U^{n,l})$.
     //

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.