From 986062e959b8ec674f74a0d9710237135c42ba8b Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Thu, 6 Aug 2015 15:20:20 -0500 Subject: [PATCH] distribute() after solution transfer several examples forgot to call ConstraintMatrix::distribute() after a SolutionTransfer, which is required to get a conforming interpolated solution. --- examples/step-28/step-28.cc | 14 +++++++++++--- examples/step-32/step-32.cc | 11 +++++++++++ examples/step-42/step-42.cc | 5 +++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/examples/step-28/step-28.cc b/examples/step-28/step-28.cc index 255c1b2ab3..df06162d05 100644 --- a/examples/step-28/step-28.cc +++ b/examples/step-28/step-28.cc @@ -1106,10 +1106,15 @@ namespace Step28 triangulation.execute_coarsening_and_refinement (); dof_handler.distribute_dofs (fe); + this->setup_linear_system (); solution.reinit (dof_handler.n_dofs()); soltrans.interpolate(solution_old, solution); + // enforce constraints to make the interpolated solution conforming on + // the new mesh: + hanging_node_constraints.distribute(solution); + solution_old.reinit (dof_handler.n_dofs()); solution_old = solution; } @@ -1644,7 +1649,12 @@ namespace Step28 std::cout << "Cycle " << cycle << ':' << std::endl; if (cycle == 0) - initialize_problem(); + { + initialize_problem(); + for (unsigned int group=0; groupsetup_linear_system (); + } + else { refine_grid (); @@ -1652,8 +1662,6 @@ namespace Step28 energy_groups[group]->solution *= k_eff; } - for (unsigned int group=0; groupsetup_linear_system (); std::cout << " Numbers of active cells: "; for (unsigned int group=0; group