]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix the bug that we only re-set the rhs vector to zero if we were building the matrix...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 22 Oct 2007 19:12:50 +0000 (19:12 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 22 Oct 2007 19:12:50 +0000 (19:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@15365 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 3e9e17060053b55b113710cc294d3a6bd72211bb..9ddfaf893f077d795a5c255b7beb1117da96e603 100644 (file)
@@ -502,11 +502,10 @@ template <int dim>
 void BoussinesqFlowProblem<dim>::assemble_system () 
 {
   if (rebuild_matrices == true)
-    {
-      system_matrix=0;
-      system_rhs=0;
-    }
-      
+    system_matrix=0;
+
+  system_rhs=0;
+  
   QGauss<dim>   quadrature_formula(degree+2); 
   QGauss<dim-1> face_quadrature_formula(degree+2);
 
@@ -1048,7 +1047,7 @@ void BoussinesqFlowProblem<dim>::solve ()
 template <int dim>
 void BoussinesqFlowProblem<dim>::output_results ()  const
 {
-  if (timestep_number % 1 != 0)
+  if (timestep_number % 10 != 0)
     return;
   
   std::vector<std::string> solution_names (dim, "velocity");
@@ -1202,17 +1201,32 @@ void BoussinesqFlowProblem<dim>::run ()
     }
   
 
-  setup_dofs(false);    
+  const bool do_adaptivity = false;
 
-  VectorTools::project (dof_handler,
-                       hanging_node_constraints,
-                       QGauss<dim>(degree+2),
-                       InitialValues<dim>(),
-                       old_solution);
+  if (do_adaptivity)
+    {
+      setup_dofs(false);
+
+      VectorTools::project (dof_handler,
+                           hanging_node_constraints,
+                           QGauss<dim>(degree+2),
+                           InitialValues<dim>(),
+                           old_solution);
   
-  for (unsigned int pre_refinement=0; pre_refinement<4-dim; ++pre_refinement)
+      for (unsigned int pre_refinement=0; pre_refinement<4-dim; ++pre_refinement)
+       {
+         refine_mesh ();
+
+         VectorTools::project (dof_handler,
+                               hanging_node_constraints,
+                               QGauss<dim>(degree+2),
+                               InitialValues<dim>(),
+                               old_solution);
+       }
+    }
+  else
     {
-      refine_mesh ();
+      setup_dofs(true);
 
       VectorTools::project (dof_handler,
                            hanging_node_constraints,
@@ -1246,8 +1260,9 @@ void BoussinesqFlowProblem<dim>::run ()
 
       std::cout << std::endl;
 
-      if (timestep_number % 10 == 0)
-       refine_mesh ();
+      if (do_adaptivity)
+       if (timestep_number % 10 == 0)
+         refine_mesh ();
     }
   while (time <= 500);
 }

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.