From 19f3227b28a4c9a45250ce0a2dad27b288f87b49 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Wed, 8 Aug 2018 17:17:29 +0200 Subject: [PATCH] address comments --- examples/step-16/doc/results.dox | 22 +++++++++++----------- examples/step-16/step-16.cc | 15 +++++++++------ examples/step-16b/doc/intro.dox | 2 +- examples/step-16b/doc/results.dox | 8 ++------ examples/step-16b/step-16b.cc | 7 +++---- 5 files changed, 26 insertions(+), 28 deletions(-) diff --git a/examples/step-16/doc/results.dox b/examples/step-16/doc/results.dox index d03a6a0c2a..31836288ad 100644 --- a/examples/step-16/doc/results.dox +++ b/examples/step-16/doc/results.dox @@ -13,42 +13,42 @@ the solver performance. Therefore, here is the textual output: Cycle 0 Number of active cells: 80 Number of degrees of freedom: 89 (by level: 8, 25, 89) - Number of CG iterations: 8 + Number of CG iterations: 8 Cycle 1 Number of active cells: 158 Number of degrees of freedom: 183 (by level: 8, 25, 89, 138) - Number of CG iterations: 9 + Number of CG iterations: 9 Cycle 2 Number of active cells: 302 Number of degrees of freedom: 352 (by level: 8, 25, 89, 223, 160) - Number of CG iterations: 10 + Number of CG iterations: 10 Cycle 3 Number of active cells: 578 Number of degrees of freedom: 649 (by level: 8, 25, 89, 231, 494, 66) - Number of CG iterations: 10 + Number of CG iterations: 10 Cycle 4 Number of active cells: 1100 Number of degrees of freedom: 1218 (by level: 8, 25, 89, 274, 764, 417, 126) - Number of CG iterations: 10 + Number of CG iterations: 10 Cycle 5 Number of active cells: 2096 Number of degrees of freedom: 2317 (by level: 8, 25, 89, 304, 779, 1214, 817) - Number of CG iterations: 11 + Number of CG iterations: 11 Cycle 6 Number of active cells: 3986 Number of degrees of freedom: 4366 (by level: 8, 25, 89, 337, 836, 2270, 897, 1617) - Number of CG iterations: 10 + Number of CG iterations: 10 Cycle 7 Number of active cells: 7574 Number of degrees of freedom: 8350 (by level: 8, 25, 89, 337, 1086, 2835, 2268, 1789, 3217) - Number of CG iterations: 11 + Number of CG iterations: 11 That's almost perfect multigrid performance: the linear residual gets reduced by 12 orders of @@ -60,7 +60,7 @@ it shows the power of multigrid methods.

Possible extensions

-We encourage you to switch generate timings for the solve() call and compare to +We encourage you to generate timings for the solve() call and compare to step 6. You will see that the multigrid method has quite an overhead on coarse meshes, but that it always beats other methods on fine meshes because of its optimal complexity. @@ -78,8 +78,8 @@ preconditioner that uses some sort of multigrid hierarchy for good performance but can figure out level matrices and similar things by itself. Algebraic multigrid methods do exactly this, and we will use them in step-31 for the solution of a Stokes problem and in step-32 and step-40 for a parallel -variation. That said, a parallel version of this example program with MPI is found -as step-50. +variation. That said, a parallel version of this example program with MPI can be +found in step-50. Finally, one may want to think how to use geometric multigrid for other kinds of problems, specifically @ref vector_valued "vector valued problems". This is the diff --git a/examples/step-16/step-16.cc b/examples/step-16/step-16.cc index f28d688d3c..c6cc1c80be 100644 --- a/examples/step-16/step-16.cc +++ b/examples/step-16/step-16.cc @@ -84,10 +84,11 @@ namespace Step16 { // @sect3{The Scratch and Copy objects} // - // We use MeshWorker::mesh_loop() to assemble our matrices. For this, we need - // a ScratchData object to store temporary data on each cell (this is just the - // FEValues object) and a CopyData object that will contain the output of each - // cell assembly. + // We use MeshWorker::mesh_loop() to assemble our matrices. For this, we + // need a ScratchData object to store temporary data on each cell (this is + // just the FEValues object) and a CopyData object that will contain the + // output of each cell assembly. For more details about the usage of scratch + // and copy objects, see the WorkStream namespace. template struct ScratchData { @@ -424,7 +425,9 @@ namespace Step16 // us, and thus the difference between this function and the previous lies // only in the setup of the assembler and the different iterators in the loop. // - // We generate an AffineConstraints<> object + // We generate an AffineConstraints<> object for each level containing the + // boundary and interface dofs as constrained entries. The corresponding + // object is then used to generate the level matrices. template void LaplaceProblem::assemble_multigrid() { @@ -587,7 +590,7 @@ namespace Step16 solution = 0; solver.solve(system_matrix, solution, system_rhs, preconditioner); - std::cout << " Number of CG iterations: " << solver_control.last_step() + std::cout << " Number of CG iterations: " << solver_control.last_step() << "\n" << std::endl; constraints.distribute(solution); diff --git a/examples/step-16b/doc/intro.dox b/examples/step-16b/doc/intro.dox index 594e00507d..5e4375c42a 100644 --- a/examples/step-16b/doc/intro.dox +++ b/examples/step-16b/doc/intro.dox @@ -9,4 +9,4 @@ of manually assembling the matrices.

The testcase

-The problem we solve here is similar to step-16. +The problem we solve here is the same as the one in step-16. diff --git a/examples/step-16b/doc/results.dox b/examples/step-16b/doc/results.dox index c7e3f8fb58..4f5baa31f4 100644 --- a/examples/step-16b/doc/results.dox +++ b/examples/step-16b/doc/results.dox @@ -6,7 +6,8 @@ As in step-16, the solution looks like this on the finest mesh:

-The output is formatted in a slightly different way compared to step-16: +The output is formatted in a slightly different way compared to step-16 but is +functionally the same and shows the same convergence properties:
 DEAL::Cycle 0
 DEAL::   Number of active cells:       20
@@ -49,8 +50,3 @@ DEAL::   Number of degrees of freedom: 2359 (by level: 8, 25, 89, 308, 779, 1262
 DEAL:cg::Starting value 0.141519
 DEAL:cg::Convergence step 10 value 5.74965e-13
 
- - -

Possible extensions

- -See step-16. diff --git a/examples/step-16b/step-16b.cc b/examples/step-16b/step-16b.cc index 5446333291..b35c6d4f55 100644 --- a/examples/step-16b/step-16b.cc +++ b/examples/step-16b/step-16b.cc @@ -278,10 +278,9 @@ namespace Step16 const std::map *> dirichlet_boundary_functions = { {types::boundary_id(0), &homogeneous_dirichlet_bc}}; - VectorTools::interpolate_boundary_values( - static_cast &>(dof_handler), - dirichlet_boundary_functions, - constraints); + VectorTools::interpolate_boundary_values(dof_handler, + dirichlet_boundary_functions, + constraints); constraints.close(); constraints.condense(dsp); sparsity_pattern.copy_from(dsp); -- 2.39.5