]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Reset only constrained nodes to zero when starting the solve.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 7 May 2009 13:44:56 +0000 (13:44 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 7 May 2009 13:44:56 +0000 (13:44 +0000)
git-svn-id: https://svn.dealii.org/trunk@18820 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 77b9dc9a654f3c659cd01bec2cf7da51bdcdf787..4d50744277f6c682e5d7282e9263cf5392370204 100644 (file)
@@ -250,7 +250,6 @@ namespace LinearSolvers
                                             PreconditionerMp > > m_inverse;
       const PreconditionerA &a_preconditioner;
       mutable TrilinosWrappers::MPI::Vector tmp;
-
 };
 
 
@@ -1383,11 +1382,15 @@ void BoussinesqFlowProblem<dim>::solve ()
       gmres (solver_control,
             SolverGMRES<TrilinosWrappers::MPI::BlockVector >::AdditionalData(100));
 
-                                  // currently, have a problem with
-                                  // constrained dofs that are nonzero when
-                                  // entering the solver (see step-31). set
-                                  // the vector to zero for the moment.
-    stokes_solution = 0;
+                                  // now treat the hanging nodes correctly.
+    const unsigned int start = stokes_solution.block(1).local_range().first + 
+      stokes_solution.block(0).size();
+    const unsigned int end = stokes_solution.block(1).local_range().second + 
+      stokes_solution.block(0).size();
+    for (unsigned int i=start; i<end; ++i)
+      if (stokes_constraints.is_constrained (i))
+       stokes_solution(i) = 0;
+
     gmres.solve(stokes_matrix, stokes_solution, stokes_rhs, preconditioner);
 
     pcout << "   "

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.