]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
step-32: fix sadd with ghosted vectors
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 31 Aug 2012 15:21:43 +0000 (15:21 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 31 Aug 2012 15:21:43 +0000 (15:21 +0000)
git-svn-id: https://svn.dealii.org/trunk@26182 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-32/step-32.cc

index a07419dc95915a52ff721f233f03e14f8833b535..e01eb034f470f126f4fe2d232fbafd1eed9ae5a6 100644 (file)
@@ -4343,11 +4343,25 @@ namespace Step32
         old_temperature_solution     = temperature_solution;
         if (old_time_step > 0)
           {
-            stokes_solution.sadd (1.+time_step/old_time_step, -time_step/old_time_step,
-                                  old_old_stokes_solution);
-            temperature_solution.sadd (1.+time_step/old_time_step,
-                                       -time_step/old_time_step,
-                                       old_old_temperature_solution);
+            //Trilinos sadd does not like ghost vectors even as input. Copy into distributed vectors for now:
+            {
+              TrilinosWrappers::MPI::BlockVector distr_solution (stokes_rhs);
+              distr_solution = stokes_solution;
+              TrilinosWrappers::MPI::BlockVector distr_old_solution (stokes_rhs);
+              distr_old_solution = old_old_stokes_solution;
+              distr_solution .sadd (1.+time_step/old_time_step, -time_step/old_time_step,
+                  distr_old_solution);
+              stokes_solution = distr_solution;
+            }
+            {
+              TrilinosWrappers::MPI::Vector distr_solution (temperature_rhs);
+              distr_solution = temperature_solution;
+              TrilinosWrappers::MPI::Vector distr_old_solution (temperature_rhs);
+              distr_old_solution = old_old_temperature_solution;
+              distr_solution .sadd (1.+time_step/old_time_step, -time_step/old_time_step,
+                  distr_old_solution);
+              temperature_solution = distr_solution;
+            }
           }
 
         if ((timestep_number > 0) && (timestep_number % 100 == 0))

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.