From 0a61b59f0c6a07f6ee1120f814c92896a204f713 Mon Sep 17 00:00:00 2001 From: David Wells Date: Mon, 6 May 2019 22:18:33 -0400 Subject: [PATCH] step-28: fix a bug with the first mesh cycle. Previously the first cycle converged in a single iteration since the error is calculated to be zero. --- examples/step-28/step-28.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/step-28/step-28.cc b/examples/step-28/step-28.cc index e2d277abe0..20ee55437f 100644 --- a/examples/step-28/step-28.cc +++ b/examples/step-28/step-28.cc @@ -1570,7 +1570,9 @@ namespace Step28 boost::io::ios_flags_saver restore_flags(std::cout); std::cout << std::setprecision(12) << std::fixed; - double k_eff_old = k_eff; + // We calculate the error below by the change in k_eff (i.e., the + // difference between k_eff_old, + double k_eff_old = 0.0; for (unsigned int cycle = 0; cycle < parameters.n_refinement_cycles; ++cycle) -- 2.39.5