From: bangerth Date: Thu, 16 Dec 2010 20:57:53 +0000 (+0000) Subject: Use a better solver. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=851949b646f878dd58ed3ba55976e35b24672cd9;p=dealii-svn.git Use a better solver. git-svn-id: https://svn.dealii.org/trunk@22980 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-38/step-38.cc b/deal.II/examples/step-38/step-38.cc index 005b4fa875..b7e166250b 100755 --- a/deal.II/examples/step-38/step-38.cc +++ b/deal.II/examples/step-38/step-38.cc @@ -160,8 +160,6 @@ class LaplaceBeltrami DoFHandler dof_handler; MappingQ mapping; - ConstraintMatrix matrix_constraints; - SparsityPattern sparsity_pattern; SparseMatrix system_matrix; @@ -228,14 +226,10 @@ void LaplaceBeltrami::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::assemble_system () system_matrix, solution, system_rhs,false); - - // condense matrices - matrix_constraints.condense (system_matrix); - matrix_constraints.condense (system_rhs); } template void LaplaceBeltrami::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); }