From e81ad9c2e91605e9c2a2502d71a01b13c7a1d714 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 20 Oct 2005 21:37:14 +0000 Subject: [PATCH] Make this thing work. git-svn-id: https://svn.dealii.org/trunk@11637 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-20/step-20.cc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/deal.II/examples/step-20/step-20.cc b/deal.II/examples/step-20/step-20.cc index af5db06e1a..e23f8d0bd7 100644 --- a/deal.II/examples/step-20/step-20.cc +++ b/deal.II/examples/step-20/step-20.cc @@ -11,6 +11,9 @@ /* to the file deal.II/doc/license.html for the text and */ /* further information on this license. */ + +const unsigned int degree = 2; + // The first few (many?) include // files have already been used in // the previous example, so we will @@ -237,7 +240,7 @@ double BoundaryValues::value (const Point &p, // previous example. template LaplaceProblem::LaplaceProblem () : - fe (FE_RaviartThomas(2),1,FE_DGQ(2),1), + fe (FE_RaviartThomas(degree),1,FE_DGQ(degree),1), dof_handler (triangulation) {} @@ -281,7 +284,7 @@ template void LaplaceProblem::make_grid_and_dofs () { GridGenerator::hyper_cube (triangulation, 0, 1); - triangulation.refine_global (0); + triangulation.refine_global (4); std::cout << " Number of active cells: " << triangulation.n_active_cells() @@ -415,7 +418,7 @@ double extract_p (const FEValues &fe_values, template void LaplaceProblem::assemble_system () { - QGauss quadrature_formula(2); + QGauss quadrature_formula(degree+2); // We wanted to have a non-constant // right hand side, so we use an @@ -543,15 +546,8 @@ class SchurComplement SolverControl solver_control (tmp1.size(), 1e-8*tmp1.l2_norm()); PrimitiveVectorMemory<> vector_memory; - SolverGMRES<> cg (solver_control, vector_memory); + SolverCG<> cg (solver_control, vector_memory); - A.block(0,0).print_formatted(std::cout, 2, false, 6, " ", 81); - FullMatrix F(24,24); - F.copy_from (A.block(0,0)); - std::cout << F.norm2() << ' ' << F.relative_symmetry_norm2() << std::endl; - - abort (); - PreconditionSSOR<> precondition; precondition.initialize(A.block(0,0)); cg.solve (A.block(0,0), tmp2, tmp1, precondition); @@ -587,7 +583,7 @@ void LaplaceProblem::solve () SolverControl solver_control (system_matrix.block(0,0).m(), 1e-6*system_rhs.block(1).l2_norm()); PrimitiveVectorMemory<> vector_memory; - SolverGMRES<> cg (solver_control, vector_memory); + SolverCG<> cg (solver_control, vector_memory); cg.solve (SchurComplement(system_matrix), solution.block(1), system_rhs.block(1), @@ -639,7 +635,7 @@ void LaplaceProblem::output_results () const data_out.attach_dof_handler (dof_handler); data_out.add_data_vector (solution, "solution"); - data_out.build_patches (); + data_out.build_patches (3); // Only difference to the previous // example: write output in GMV -- 2.39.5