]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Use a better solver.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Dec 2010 20:57:53 +0000 (20:57 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Dec 2010 20:57:53 +0000 (20:57 +0000)
git-svn-id: https://svn.dealii.org/trunk@22980 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 005b4fa875c84890efd33c6e82ed17be57bbf6f1..b7e166250b503eb009f913125cd515685fb6a2d0 100755 (executable)
@@ -160,8 +160,6 @@ class LaplaceBeltrami
     DoFHandler<dim-1,dim>      dof_handler;
     MappingQ<dim-1, dim>       mapping;
 
-    ConstraintMatrix     matrix_constraints;
-
     SparsityPattern      sparsity_pattern;
     SparseMatrix<double> system_matrix;
   
@@ -228,14 +226,10 @@ void LaplaceBeltrami<dim>::setup_system ()
            << " degrees of freedom."
            << std::endl;
   
-  matrix_constraints.clear ();
-  matrix_constraints.close ();
-
   CompressedSparsityPattern csp (dof_handler.n_dofs(),
                                  dof_handler.n_dofs());
 
   DoFTools::make_sparsity_pattern (dof_handler, csp);
-  matrix_constraints.condense (csp);
 
   sparsity_pattern.copy_from (csp);
 
@@ -331,25 +325,20 @@ void LaplaceBeltrami<dim>::assemble_system ()
                                      system_matrix,
                                      solution,
                                      system_rhs,false);
-
-                                  // condense matrices
-  matrix_constraints.condense (system_matrix);
-  matrix_constraints.condense (system_rhs);
 }
 
 
 template <int dim>
 void LaplaceBeltrami<dim>::solve () 
 {
-  SolverControl           solver_control (1000, 1e-7);
+  SolverControl           solver_control (solution.size(), 1e-7);
   SolverCG<>              cg (solver_control);
 
-  cg.solve (system_matrix, solution, system_rhs,
-           PreconditionIdentity());
-
-
-  matrix_constraints.distribute (solution);
+  PreconditionSSOR<> preconditioner;
+  preconditioner.initialize(system_matrix, 1.2);
 
+  cg.solve (system_matrix, solution, system_rhs,
+           preconditioner);
 }
 
 

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.