From a82b5de3fc0b532335aa017bd109f087d204a308 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Mon, 12 Aug 2013 16:02:06 +0000 Subject: [PATCH] Some results on computing times, cleanup. git-svn-id: https://svn.dealii.org/trunk@30289 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-51/doc/intro.dox | 14 +-- deal.II/examples/step-51/doc/results.dox | 113 ++++++++++++++++++++++- deal.II/examples/step-51/step-51.cc | 15 +-- 3 files changed, 124 insertions(+), 18 deletions(-) diff --git a/deal.II/examples/step-51/doc/intro.dox b/deal.II/examples/step-51/doc/intro.dox index 1bcbd31906..d5ecfd4b70 100644 --- a/deal.II/examples/step-51/doc/intro.dox +++ b/deal.II/examples/step-51/doc/intro.dox @@ -65,20 +65,20 @@ The HDG formulation used for this example is taken from We consider the convection-diffusion equation: @f{eqnarray*} - \nabla \cdot (\mathbf{c} u) - \nabla \cdot (\kappa \nabla u) &= f, + \nabla \cdot (\mathbf{c} u) - \nabla \cdot (\kappa \nabla u) &=& f, \quad \text{ in } \Omega, \\ - u &= g_D, \quad \text{ on } \partial \Omega_D, \\ - (\mathbf{c} u - \kappa \nabla u)\cdot \mathbf{n} &= g_N, + u &=& g_D, \quad \text{ on } \partial \Omega_D, \\ + (\mathbf{c} u - \kappa \nabla u)\cdot \mathbf{n} &=& g_N, \quad \text{ on } \partial \Omega_D. @f} Introduce the auxiliary variable $\mathbf{q}=-\kappa \nabla u$ and rewrite the above equation as the first order system: @f{eqnarray*} - \mathbf{q} + \kappa \nabla u &= 0, \quad \text{ in } \Omega, \\ - \nabla \cdot (\mathbf{c} u + \mathbf{q}) &= f, \quad \text{ in } \Omega, \\ - u &= g_D, \quad \text{ on } \partial \Omega_D, \\ - (\mathbf{q} + \mathbf{c}u)\cdot\mathbf{n} = &= g_N, + \mathbf{q} + \kappa \nabla u &=& 0, \quad \text{ in } \Omega, \\ + \nabla \cdot (\mathbf{c} u + \mathbf{q}) &=& f, \quad \text{ in } \Omega, \\ + u &=& g_D, \quad \text{ on } \partial \Omega_D, \\ + (\mathbf{q} + \mathbf{c}u)\cdot\mathbf{n} &=& g_N, \quad \text{ on } \partial \Omega_D. @f} diff --git a/deal.II/examples/step-51/doc/results.dox b/deal.II/examples/step-51/doc/results.dox index d070c1e618..e96ab8191a 100644 --- a/deal.II/examples/step-51/doc/results.dox +++ b/deal.II/examples/step-51/doc/results.dox @@ -1,11 +1,25 @@

Results

-The program writes convergence tables to the screen while running: - +When the program is run, it outputs information about the respective steps and +convergence tables with errors in the various components in the end. In 2D, +the convergence tables look the following: @code -Q1 elements: +Q1 elements, adaptive refinement: +cells dofs val L2 grad L2 val L2-post + 4 24 6.101e+00 1.065e+01 5.098e+00 + 10 58 3.168e+00 9.223e+00 2.431e+00 + 28 148 2.888e+00 9.368e+00 2.644e+00 + 55 272 6.756e-01 4.088e+00 2.400e-01 + 109 578 2.175e-01 1.529e+00 7.350e-02 + 214 1072 9.783e-02 9.006e-01 2.219e-02 + 409 2056 4.812e-02 5.193e-01 1.081e-02 + 811 3880 2.714e-02 2.971e-01 4.669e-03 + 1555 7204 1.365e-02 1.789e-01 2.627e-03 + 2956 13198 7.919e-03 1.009e-01 1.006e-03 + +Q1 elements, global refinement: cells dofs val L2 grad L2 val L2-post 16 80 4.570e+00 - 1.221e+01 - 4.333e+00 - 36 168 1.869e+00 2.20 7.299e+00 1.27 1.734e+00 2.26 @@ -18,7 +32,7 @@ cells dofs val L2 grad L2 val L2-post 4096 16640 1.043e-02 1.96 7.185e-02 1.96 5.306e-04 2.94 9216 37248 4.690e-03 1.97 3.228e-02 1.97 1.600e-04 2.96 -Q3 elements: +Q3 elements, global refinement: cells dofs val L2 grad L2 val L2-post 16 160 2.398e-01 - 1.873e+00 - 1.354e-01 - 36 336 5.843e-02 3.48 5.075e-01 3.22 1.882e-02 4.87 @@ -43,7 +57,9 @@ postprocessed scalar variable at fifth order. The same convergence rates are observed in 3d. @code -Q1 elements: +Q1 elements, adaptive refinement: + +Q1 elements, global refinement: cells dofs val L2 grad L2 val L2-post 8 144 3.846e+00 - 1.519e+01 - 2.388e+00 - 27 432 4.677e+00 -0.48 2.158e+01 -0.87 3.441e+00 -0.90 @@ -56,6 +72,7 @@ cells dofs val L2 grad L2 val L2-post 32768 405504 4.637e-02 1.88 3.986e-01 1.89 5.932e-03 2.82 110592 1354752 2.133e-02 1.92 1.831e-01 1.92 1.851e-03 2.87 +Q3 elements, global refinement: cells dofs val L2 grad L2 val L2-post 8 576 3.845e+00 - 1.742e+01 - 3.550e+00 - 27 1728 8.915e-01 3.60 6.939e+00 2.27 5.865e-01 4.44 @@ -68,3 +85,89 @@ cells dofs val L2 grad L2 val L2-post 32768 1622016 1.723e-04 3.91 1.518e-03 3.93 5.603e-06 4.99 110592 5419008 3.482e-05 3.94 3.057e-04 3.95 7.375e-07 5.00 @endcode + + +

Possibilities for extensions

+ +This tutorial program shows the a basic implementation of an HDG method +without particular focus on a high performance implementation. Let us look at +the computing time of the tutorial program and the share of the individual +components: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  SetupAssembleSolveTrace reconstructPost-processingOutput
 Total timeRelative share
2D, Q1, cycle 9, 37,248 dofs5.34s0.7%1.2%89.5%0.9%2.3%5.4%
2D, Q3, cycle 9, 74,496 dofs22.2s0.4%4.3%84.1%4.1%3.5%3.6%
3D, Q1, cycle 7, 172,800 dofs9.06s3.1%8.9%42.7%7.0%20.6%17.7%
3D, Q3, cycle 7, 691,200 dofs516s0.6%34.5%13.4%32.8%17.1%1.5%
+ +As can be seen from the table, the solver and assembly calls dominate the +runtime of the program. This also gives a clear indication of where an +improvement makes most sense. + +
    +
  1. Better linear solvers: We use a GMRES iterative solver without + preconditioner, where the number of iteration increases with increasing + problem size (the number of iterations for Q1 elements and global + refinements start at 8 for the small sizes but increase up to 2592 for the + largest size). To do better, one could for example use an algebraic + multigrid preconditioner from Trilinos. For diffusion-dominated problems as + the problem at hand with finer meshes, such a solver can be designed that + uses the matrix-vector products from the more efficient ChunkSparseMatrix on + the finest level, as long as we are not working in parallel with MPI. + +
  2. Speed up assembly by pre-assembling parts that do not change from one + cell to another (those that do neither contain variable coefficients nor + mapping-dependent terms. +
diff --git a/deal.II/examples/step-51/step-51.cc b/deal.II/examples/step-51/step-51.cc index 747a270408..662f3f25ad 100644 --- a/deal.II/examples/step-51/step-51.cc +++ b/deal.II/examples/step-51/step-51.cc @@ -1044,12 +1044,15 @@ void Step51::run () convergence_table.set_precision("val L2-post", 3); convergence_table.set_scientific("val L2-post", true); - convergence_table - .evaluate_convergence_rates("val L2", "cells", ConvergenceTable::reduction_rate_log2, dim); - convergence_table - .evaluate_convergence_rates("grad L2", "cells", ConvergenceTable::reduction_rate_log2, dim); - convergence_table - .evaluate_convergence_rates("val L2-post", "cells", ConvergenceTable::reduction_rate_log2, dim); + if (refinement_mode == global_refinement) + { + convergence_table + .evaluate_convergence_rates("val L2", "cells", ConvergenceTable::reduction_rate_log2, dim); + convergence_table + .evaluate_convergence_rates("grad L2", "cells", ConvergenceTable::reduction_rate_log2, dim); + convergence_table + .evaluate_convergence_rates("val L2-post", "cells", ConvergenceTable::reduction_rate_log2, dim); + } convergence_table.write_text(std::cout); } -- 2.39.5