]> https://gitweb.dealii.org/ - dealii.git/commitdiff
distribute() after solution transfer 1292/head
authorTimo Heister <timo.heister@gmail.com>
Thu, 6 Aug 2015 20:20:20 +0000 (15:20 -0500)
committerTimo Heister <timo.heister@gmail.com>
Thu, 6 Aug 2015 20:20:20 +0000 (15:20 -0500)
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
examples/step-32/step-32.cc
examples/step-42/step-42.cc

index 255c1b2ab3d53af9597d4a3ddb5881200e9fe92d..df06162d0558c99f5a34c6b146efd8436ab55290 100644 (file)
@@ -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; group<parameters.n_groups; ++group)
+              energy_groups[group]->setup_linear_system ();
+          }
+
         else
           {
             refine_grid ();
@@ -1652,8 +1662,6 @@ namespace Step28
               energy_groups[group]->solution *= k_eff;
           }
 
-        for (unsigned int group=0; group<parameters.n_groups; ++group)
-          energy_groups[group]->setup_linear_system ();
 
         std::cout << "   Numbers of active cells:       ";
         for (unsigned int group=0; group<parameters.n_groups; ++group)
index c83ff0bda9209bb167217fabfdfedd219fb8e3a3..d927e3170ce69d45d40c97a46567af29a6992460 100644 (file)
@@ -3538,6 +3538,11 @@ namespace Step32
       tmp[1] = &(distributed_temp2);
       temperature_trans.interpolate(tmp);
 
+      // enforce constraints to make the interpolated solution conforming on
+      // the new mesh:
+      temperature_constraints.distribute(distributed_temp1);
+      temperature_constraints.distribute(distributed_temp2);
+
       temperature_solution     = distributed_temp1;
       old_temperature_solution = distributed_temp2;
     }
@@ -3551,6 +3556,12 @@ namespace Step32
       stokes_tmp[1] = &(old_distributed_stokes);
 
       stokes_trans.interpolate (stokes_tmp);
+
+      // enforce constraints to make the interpolated solution conforming on
+      // the new mesh:
+      stokes_constraints.distribute(distributed_stokes);
+      stokes_constraints.distribute(old_distributed_stokes);
+
       stokes_solution     = distributed_stokes;
       old_stokes_solution = old_distributed_stokes;
     }
index 585b6498a8631caaf49d099ca5917100249e5501..077e1ee2294e231b4acc58e3733f74dc61ae6e12 100644 (file)
@@ -1906,6 +1906,11 @@ namespace Step42
       {
         TrilinosWrappers::MPI::Vector distributed_solution(locally_owned_dofs, mpi_communicator);
         solution_transfer.interpolate(distributed_solution);
+
+        // enforce constraints to make the interpolated solution conforming on
+        // the new mesh:
+        constraints_hanging_nodes.distribute(distributed_solution);
+
         solution = distributed_solution;
         compute_nonlinear_residual(solution);
       }

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.