From 9f450e2f3a44c24f837a3475d3c2dbd060911d83 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Sun, 12 May 2019 10:57:07 -0600 Subject: [PATCH] fix prm formatting, expand prm documentation, doc changes, hook in step-63 --- doc/doxygen/tutorial/tutorial.h.in | 10 ++++++- examples/step-63/block_jacobi.prm | 25 ++++++++--------- examples/step-63/block_sor.prm | 24 ++++++++-------- examples/step-63/doc/intro.dox | 9 +++++- examples/step-63/doc/kind | 3 +- examples/step-63/doc/results.dox | 45 +++++------------------------- examples/step-63/jacobi.prm | 24 ++++++++-------- examples/step-63/sor.prm | 24 ++++++++-------- examples/step-63/step-63.cc | 24 +++++++++------- 9 files changed, 87 insertions(+), 101 deletions(-) diff --git a/doc/doxygen/tutorial/tutorial.h.in b/doc/doxygen/tutorial/tutorial.h.in index c63f011c2d..9193597220 100644 --- a/doc/doxygen/tutorial/tutorial.h.in +++ b/doc/doxygen/tutorial/tutorial.h.in @@ -480,6 +480,13 @@ * boundary conditions. Parallelization via MUMPS and MPI. * * + * + * step-63 + * Block smoothers for geometric multigrid. A scalar convection + * diffusion equation is solved with different additive or + * multiplicative multigrid smoothers. + * + * * * * @@ -809,7 +816,8 @@ * step-42, * step-43, * step-56, - * step-59 + * step-59, + * step-63 * * * diff --git a/examples/step-63/block_jacobi.prm b/examples/step-63/block_jacobi.prm index 941a0df9ed..bc71ffc755 100644 --- a/examples/step-63/block_jacobi.prm +++ b/examples/step-63/block_jacobi.prm @@ -1,21 +1,20 @@ -#Epsilon -set Epsilon = 0.005 +# Diffusion parameter +set Epsilon = 0.005 # Finite Element degree -set Fe degree = 1 +set Fe degree = 1 -# Smoother Type: SOR|Jacobi|block SOR|block Jacobi -set Smoother type = block Jacobi +# Select smoother: SOR|Jacobi|block SOR|block Jacobi +set Smoother type = block Jacobi -# Number of smoothing steps -set Smoothing steps = 3 +# Select DoF renumbering: none|downstream|upstream|random +set DoF renumbering = downstream -# DoF renumbering: no|downstream|upstream|random -set DoF renumbering = downstream +# Number of smoothing steps +set Smoothing steps = 3 -# With streamline diffusion: true|false +# Enable streamline diffusion stabilization: true|false set With streamline diffusion = true -# Output: true|false -set Output = false - +# Generate graphical output: true|false +set Output = true diff --git a/examples/step-63/block_sor.prm b/examples/step-63/block_sor.prm index 3b20e403a2..6b03124400 100644 --- a/examples/step-63/block_sor.prm +++ b/examples/step-63/block_sor.prm @@ -1,20 +1,20 @@ -#Epsilon -set Epsilon = 0.005 +# Diffusion parameter +set Epsilon = 0.005 # Finite Element degree -set Fe degree = 1 +set Fe degree = 1 -# Smoother Type: SOR|Jacobi|block SOR|block Jacobi -set Smoother type = block SOR +# Select smoother: SOR|Jacobi|block SOR|block Jacobi +set Smoother type = block SOR -# Number of smoothing steps -set Smoothing steps = 1 +# Select DoF renumbering: none|downstream|upstream|random +set DoF renumbering = downstream -# DoF renumbering: no|downstream|upstream|random -set DoF renumbering = downstream +# Number of smoothing steps +set Smoothing steps = 1 -# With streamline diffusion: true|false +# Enable streamline diffusion stabilization: true|false set With streamline diffusion = true -# Output: true|false -set Output = false +# Generate graphical output: true|false +set Output = true diff --git a/examples/step-63/doc/intro.dox b/examples/step-63/doc/intro.dox index 4b90b10a30..1f2e11e4b8 100644 --- a/examples/step-63/doc/intro.dox +++ b/examples/step-63/doc/intro.dox @@ -1,6 +1,13 @@
-This program was contributed by Thomas Clevenger and Timo Heister. +This program was contributed by Thomas C. Clevenger and Timo Heister. + +Timo Heister was partially supported by NSF Award DMS-1522191, DMS-1901529, +OAC-1835452, by the Computational Infrastructure in Geodynamics initiative +(CIG), through the NSF under Award EAR-0949446 and EAR-1550901 and The +University of California - Davis, and by Technical Data Analysis, +Inc. through US Navy STTR N16A-T003. +

Introduction

diff --git a/examples/step-63/doc/kind b/examples/step-63/doc/kind index 387b9f817c..c1d9154931 100644 --- a/examples/step-63/doc/kind +++ b/examples/step-63/doc/kind @@ -1,2 +1 @@ -unfinished - +techniques diff --git a/examples/step-63/doc/results.dox b/examples/step-63/doc/results.dox index d2fe3c9640..cd989ae5ad 100644 --- a/examples/step-63/doc/results.dox +++ b/examples/step-63/doc/results.dox @@ -10,13 +10,14 @@ Each of the following tables gives the GMRES iteration counts to reduce the init Staring with the additive smoothers, we see that renumbering the DoFs/cells has no effect on convergence speed. This is because these smoothers compute operations on each DoF (point-smoother) or cell (block-smoother) independently and add up the results. Since we can define these smoothers as an application of a sum of matrices, and matrix addition is communicative, the order at which we sum the different components will not affect the end result. - +
+ @@ -25,7 +26,6 @@ Staring with the additive smoothers, we see that renumbering the DoFs/cells has - @@ -34,7 +34,6 @@ Staring with the additive smoothers, we see that renumbering the DoFs/cells has - @@ -47,7 +46,6 @@ Staring with the additive smoothers, we see that renumbering the DoFs/cells has - @@ -60,7 +58,6 @@ Staring with the additive smoothers, we see that renumbering the DoFs/cells has - @@ -73,7 +70,6 @@ Staring with the additive smoothers, we see that renumbering the DoFs/cells has - @@ -86,7 +82,6 @@ Staring with the additive smoothers, we see that renumbering the DoFs/cells has - @@ -99,7 +94,6 @@ Staring with the additive smoothers, we see that renumbering the DoFs/cells has - @@ -112,7 +106,6 @@ Staring with the additive smoothers, we see that renumbering the DoFs/cells has - @@ -125,7 +118,6 @@ Staring with the additive smoothers, we see that renumbering the DoFs/cells has - @@ -138,14 +130,13 @@ Staring with the additive smoothers, we see that renumbering the DoFs/cells has -
$Q_1$ Smoother (smoothing steps)
Block Jacobi (3)
Renumbering Strategy
Cells Random Upstream
32 3 3
128 6 6
512 9 9
2048 13 13
8192 15 15
32768 16 16
131072 16 16
On the other hand, for multiplicative smoothers, we can speed up convergence by renumbering the DoFs/cells in the advection direction, and similarly, we can slow down convergence if we do the renumbering in the opposite direction. This is because the multiplicative smoothers transfer information from DoF to DoF, and the solutions at any one DoF of an advection-dominate problem is highly dependent on the solution at DoFs upstream of the advection direction. As we increase $\varepsilon$, however, the problem becomes more diffusion-dominated and the effectiveness of DoF/cell renumbering drops. On the other hand, in the extreme case of $\varepsilon=0$ (advection-only), we have a 1st-order PDE and multiplicative methods become effective solvers (Note: special care must be taken for the boundary conditions in this case). - +
@@ -160,7 +151,6 @@ As we increase $\varepsilon$, however, the problem becomes more diffusion-domina - @@ -169,7 +159,6 @@ As we increase $\varepsilon$, however, the problem becomes more diffusion-domina - @@ -182,7 +171,6 @@ As we increase $\varepsilon$, however, the problem becomes more diffusion-domina - @@ -195,7 +183,6 @@ As we increase $\varepsilon$, however, the problem becomes more diffusion-domina - @@ -208,7 +195,6 @@ As we increase $\varepsilon$, however, the problem becomes more diffusion-domina - @@ -221,7 +207,6 @@ As we increase $\varepsilon$, however, the problem becomes more diffusion-domina - @@ -234,7 +219,6 @@ As we increase $\varepsilon$, however, the problem becomes more diffusion-domina - @@ -247,7 +231,6 @@ As we increase $\varepsilon$, however, the problem becomes more diffusion-domina - @@ -260,7 +243,6 @@ As we increase $\varepsilon$, however, the problem becomes more diffusion-domina - @@ -273,7 +255,6 @@ As we increase $\varepsilon$, however, the problem becomes more diffusion-domina -
Block SOR (1)
Renumbering Strategy
Cells Random Upstream
32 2 3
128 5 7
512 7 12
2048 10 17
8192 11 20
32768 12 21
131072 12 21
@@ -281,7 +262,7 @@ As we increase $\varepsilon$, however, the problem becomes more diffusion-domina We will limit the results to runs using the downstream renumbering. Here is a cross comparison of all four smoothers for both $Q_1$ and $Q_3$ elements: - +
- - - - - - - - -
@@ -291,7 +272,6 @@ We will limit the results to runs using the downstream renumbering. Here is a cr $Q_3$ Smoother (smoothing steps)
Cells @@ -307,7 +287,6 @@ We will limit the results to runs using the downstream renumbering. Here is a cr SOR (3) Block SOR (1)
32 @@ -323,7 +302,6 @@ We will limit the results to runs using the downstream renumbering. Here is a cr 15 6
128 @@ -339,7 +317,6 @@ We will limit the results to runs using the downstream renumbering. Here is a cr 21 9
512 @@ -355,7 +332,6 @@ We will limit the results to runs using the downstream renumbering. Here is a cr 28 9
2048 @@ -371,7 +347,6 @@ We will limit the results to runs using the downstream renumbering. Here is a cr 32 9
8192 @@ -387,7 +362,6 @@ We will limit the results to runs using the downstream renumbering. Here is a cr 34 10
32768 @@ -398,7 +372,6 @@ We will limit the results to runs using the downstream renumbering. Here is a cr 10
131072 @@ -409,7 +382,6 @@ We will limit the results to runs using the downstream renumbering. Here is a cr 11
We see that for $Q_1$, both multiplicative smoothers require a smaller combination of smoothing steps and iteration counts than either additive smoother. However, when we in increase the degree to a $Q_3$ element, there is a clear advantage for the block smoothers in terms of the increase in smoothing steps and iterations required to solve. Specifically, the block SOR smoother gives constant iterations over degree, and the block Jacobi only sees about a 38% increase in iterations compared to 75% and 183% for Jacobi and SOR respectively. @@ -418,12 +390,11 @@ We see that for $Q_1$, both multiplicative smoothers require a smaller combinati Iteration counts do not tell the full story in the optimality of a one smoother over another. Obviously we must examine the cost of an iteration. Block smoothers here are at a disadvantage as they are having to construct and invert a cell matrix for each cell. Here is a comparison of solve times for a $Q_3$ element with 74,496 DoFs: - +
- @@ -431,7 +402,6 @@ Iteration counts do not tell the full story in the optimality of a one smoother - -
$Q_3$ Smoother (smoothing steps)
DoFs Jacobi (6)SOR (3) Block SOR (1)
74496 0.689 s @@ -439,7 +409,6 @@ Iteration counts do not tell the full story in the optimality of a one smoother 1.189 s 1.021 s
The smoother that requires the most iterations (Jacobi) actually take the shortest time (roughly 2/3 the time of the next fastest method). This is because all that is requires to apply a Jacobi smoothing step is multiplication by a diagonal matrix which is very cheap. On the other hand, while SOR requires over 3x more iterations (each with 3x more smoothing steps) than block SOR, the times are roughly equivalent, implying that a smoothing step of block SOR is roughly 9x slower than a smoothing step of SOR. Lastly, block Jacobi is almost 6x more expensive than block SOR, which intuitively makes sense from the fact that 1 step of each method has the same cost (inverting the cell matrices and either adding or multiply them together), and block Jacobi has 3 times the smoothing step per iteration with 2 times the iterations. @@ -459,11 +428,11 @@ Combining 1. and 2. gives a good reason for expecting that a method like block J

Possible Extensions

-
Constant iterations for $Q_5$
+
Constant iterations for Q5
Change the number of smoothing steps and the smoother relaxation parameter (set in Smoother::AdditionalData() inside create_smoother(), only necessary for point smoothers) so that we maintain a constant number of iterations for a $Q_5$ element. -
Effectiveness of renumbering for changing $\varepsilon$
+
Effectiveness of renumbering for changing epsilon
Increase/decrease the parameter ``Epsilon" in the .prm files of the multiplicative methods and observe the relationship of downstream vs. upstream reordering. diff --git a/examples/step-63/jacobi.prm b/examples/step-63/jacobi.prm index 75314cd087..821b1320e5 100644 --- a/examples/step-63/jacobi.prm +++ b/examples/step-63/jacobi.prm @@ -1,20 +1,20 @@ -#Epsilon -set Epsilon = 0.005 +# Diffusion parameter +set Epsilon = 0.005 # Finite Element degree -set Fe degree = 1 +set Fe degree = 1 -# Smoother Type: SOR|Jacobi|block SOR|block Jacobi -set Smoother type = Jacobi +# Select smoother: SOR|Jacobi|block SOR|block Jacobi +set Smoother type = Jacobi -# Number of smoothing steps -set Smoothing steps = 6 +# Select DoF renumbering: none|downstream|upstream|random +set DoF renumbering = downstream -# DoF renumbering: no|downstream|upstream|random -set DoF renumbering = downstream +# Number of smoothing steps +set Smoothing steps = 6 -# With streamline diffusion: true|false +# Enable streamline diffusion stabilization: true|false set With streamline diffusion = true -# Output: true|false -set Output = false +# Generate graphical output: true|false +set Output = true diff --git a/examples/step-63/sor.prm b/examples/step-63/sor.prm index 51d83bf3bb..c465caea22 100644 --- a/examples/step-63/sor.prm +++ b/examples/step-63/sor.prm @@ -1,20 +1,20 @@ -#Epsilon -set Epsilon = 0.005 +# Diffusion parameter +set Epsilon = 0.005 # Finite Element degree -set Fe degree = 1 +set Fe degree = 1 -# Smoother Type: SOR|Jacobi|block SOR|block Jacobi -set Smoother type = SOR +# Select smoother: SOR|Jacobi|block SOR|block Jacobi +set Smoother type = SOR -# Number of smoothing steps -set Smoothing steps = 3 +# Select DoF renumbering: none|downstream|upstream|random +set DoF renumbering = downstream -# DoF renumbering: no|downstream|upstream|random -set DoF renumbering = downstream +# Number of smoothing steps +set Smoothing steps = 3 -# With streamline diffusion: true|false +# Enable streamline diffusion stabilization: true|false set With streamline diffusion = true -# Output: true|false -set Output = false +# Generate graphical output: true|false +set Output = true diff --git a/examples/step-63/step-63.cc b/examples/step-63/step-63.cc index 65d2fae72e..977a1d4aab 100644 --- a/examples/step-63/step-63.cc +++ b/examples/step-63/step-63.cc @@ -155,28 +155,32 @@ namespace Step63 { ParameterHandler prm; - prm.declare_entry("Epsilon", "0.005", Patterns::Double(0), "Epsilon"); + prm.declare_entry("Epsilon", + "0.005", + Patterns::Double(0), + "Diffusion parameter"); prm.declare_entry("Fe degree", "1", - Patterns::Integer(0), + Patterns::Integer(1), "Finite Element degree"); prm.declare_entry("Smoother type", "block SOR", Patterns::Selection("SOR|Jacobi|block SOR|block Jacobi"), - "Smoother Type: SOR|Jacobi|block SOR|block Jacobi"); + "Select smoother: SOR|Jacobi|block SOR|block Jacobi"); prm.declare_entry("Smoothing steps", "2", Patterns::Integer(1), "Number of smoothing steps"); - prm.declare_entry("DoF renumbering", - "downstream", - Patterns::Selection("none|downstream|upstream|random"), - "DoF renumbering: none|downstream|upstream|random"); + prm.declare_entry( + "DoF renumbering", + "downstream", + Patterns::Selection("none|downstream|upstream|random"), + "Select DoF renumbering: none|downstream|upstream|random"); prm.declare_entry("With streamline diffusion", "true", Patterns::Bool(), - "With streamline diffusion: true|false"); + "Enable streamline diffusion stabilization: true|false"); prm.declare_entry("Output", "true", Patterns::Bool(), @@ -211,7 +215,7 @@ namespace Step63 } - // @sect1{Cell permutations} + // @sect3{Cell permutations} // // The ordering in which cells and degrees of freedom are traversed // will play a roll in the speed of convergence for multiplicative @@ -870,7 +874,7 @@ namespace Step63 // The relaxation parameter for point smoothers is chosen based on trial and // error, and they reflect values necessary to keep the iteration counts in // the GMRES solve constant (or as close as possible) as we refine the mesh. - // The two values given for both ``Jacobi" and ``SOR" are for degree 1 and + // The two values given for both "Jacobi" and "SOR" are for degree 1 and // degree 3 finite elements. If the user wants to change to another degree, // they may need to adjust these numbers. For block smoothers, this parameter // has a more straightforward interpretation, namely that for additive methods -- 2.39.5