From 851949b646f878dd58ed3ba55976e35b24672cd9 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 16 Dec 2010 20:57:53 +0000 Subject: [PATCH] Use a better solver. git-svn-id: https://svn.dealii.org/trunk@22980 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-38/step-38.cc | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) 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); } -- 2.39.5