<h1>Results</h1>


The program performs two tasks, the first being to generate a
visualization of the mapped domain, the second to compute pi by the
two methods described. Let us first take a look at the generated
graphics. They are generated in Gnuplot format, and can be viewed with
the commands
@code
set style data lines
set size ratio -1
unset key
unset xtics
unset ytics
plot [-1:1][-1:1] "ball_0_mapping_q_1.dat" lw 4 lt rgb "black"
@endcode
or using one of the other filenames. The second line makes sure that
the aspect ratio of the generated output is actually 1:1, i.e. a
circle is drawn as a circle on your screen, rather than as an
ellipse. The third line switches off the key in the graphic, as that
will only print information (the filename) which is not that important
right now. Similarly, the third and fourth disable tic marks. The plot
is then generated with a specific line width ("`lw`", here set to 4)
and line type ("`lt`", here chosen by saying that the line should be
drawn using the RGB color "black").

The following table shows the triangulated computational domain for $Q_1$,
$Q_2$, and $Q_3$ mappings, for the original coarse grid (left), and a once
uniformly refined grid (right).

<div class="twocolumn" style="width: 80%">
  <div>
    <img src="https://www.dealii.org/images/steps/developer/step_10_ball_0_q1.svg"
         alt="Five-cell discretization of the disk."
         width="400" height="400">
  </div>
  <div>
    <img src="https://www.dealii.org/images/steps/developer/step_10_ball_1_q1.svg"
         alt="20-cell discretization of the disk (i.e., five cells
              refined once)."
         width="400" height="400">
  </div>
  <div>
    <img src="https://www.dealii.org/images/steps/developer/step_10_ball_0_q2.svg"
         alt="Five-cell discretization of the disk with quadratic edges. The
              boundary is nearly indistinguishable from the actual circle."
         width="400" height="400"
         >
  </div>
  <div>
    <img src="https://www.dealii.org/images/steps/developer/step_10_ball_1_q2.svg"
         alt="20-cell discretization with quadratic edges."
         width="400" height="400">
  </div>
  <div>
    <img src="https://www.dealii.org/images/steps/developer/step_10_ball_0_q3.svg"
         alt="Five-cell discretization of the disk with cubic edges. The
              boundary is nearly indistinguishable from the actual circle."
         width="400" height="400">
  </div>
  <div>
    <img src="https://www.dealii.org/images/steps/developer/step_10_ball_1_q3.svg"
         alt="20-cell discretization with cubic edges."
         width="400" height="400">
  </div>
</div>

These pictures show the obvious advantage of higher order mappings: they
approximate the true boundary quite well also on rather coarse meshes. To
demonstrate this a little further, here is part of the upper right quarter
circle of the coarse meshes with $Q_2$ and $Q_3$ mappings, where the dashed
red line marks the actual circle:

<div class="twocolumn" style="width: 80%">
  <div>
    <img src="https://www.dealii.org/images/steps/developer/step_10_exact_vs_interpolate_q2.svg"
         alt="Close-up of quadratic discretization. The distance between the
         quadratic interpolant and the actual circle is small."
         width="400" height="400">
  </div>
  <div>
    <img src="https://www.dealii.org/images/steps/developer/step_10_exact_vs_interpolate_q3.svg"
         alt="Close-up of cubic discretization. The distance between the
         cubic interpolant and the actual circle is very small."
         width="400" height="400">
  </div>
</div>

Obviously the quadratic mapping approximates the boundary quite well,
while for the cubic mapping the difference between approximated domain
and true one is hardly visible already for the coarse grid. You can
also see that the mapping only changes something at the outer
boundaries of the triangulation. In the interior, all lines are still
represented by linear functions, resulting in additional computations
only on cells at the boundary. Higher order mappings are therefore
usually not noticeably slower than lower order ones, because the
additional computations are only performed on a small subset of all
cells.



The second purpose of the program was to compute the value of pi to
good accuracy. This is the output of this part of the program:
@code
Output of grids into gnuplot files:
===================================
Refinement level: 0
Degree = 1
Degree = 2
Degree = 3

Refinement level: 1
Degree = 1
Degree = 2
Degree = 3

Computation of Pi by the area:
==============================
Degree = 1
cells      eval.pi            error
    5 1.9999999999999993 1.1416e+00    -
   20 2.8284271247461890 3.1317e-01 1.87
   80 3.0614674589207174 8.0125e-02 1.97
  320 3.1214451522580511 2.0148e-02 1.99
 1280 3.1365484905459380 5.0442e-03 2.00
 5120 3.1403311569547516 1.2615e-03 2.00

Degree = 2
cells      eval.pi            error
    5 3.1045694996615860 3.7023e-02    -
   20 3.1391475703122267 2.4451e-03 3.92
   80 3.1414377167038290 1.5494e-04 3.98
  320 3.1415829366419006 9.7169e-06 4.00
 1280 3.1415920457576898 6.0783e-07 4.00
 5120 3.1415926155921117 3.7998e-08 4.00

Degree = 3
cells      eval.pi            error
    5 3.1410033851499288 5.8927e-04    -
   20 3.1415830393583839 9.6142e-06 5.94
   80 3.1415925017363797 1.5185e-07 5.98
  320 3.1415926512106696 2.3791e-09 6.00
 1280 3.1415926535525927 3.7200e-11 6.00
 5120 3.1415926535892100 5.8302e-13 6.00

Degree = 4
cells      eval.pi            error
    5 3.1415871927401131 5.4608e-06    -
   20 3.1415926314742428 2.2116e-08 7.95
   80 3.1415926535026202 8.7173e-11 7.99
  320 3.1415926535894498 3.4350e-13 7.99
 1280 3.1415926535897896 3.4671e-15 6.63
 5120 3.1415926535897909 2.4009e-15 0.53

Computation of Pi by the perimeter:
===================================
Degree = 1
cells      eval.pi            error
    5 2.8284271247461898 3.1317e-01    -
   20 3.0614674589207178 8.0125e-02 1.97
   80 3.1214451522580520 2.0148e-02 1.99
  320 3.1365484905459389 5.0442e-03 2.00
 1280 3.1403311569547525 1.2615e-03 2.00
 5120 3.1412772509327724 3.1540e-04 2.00

Degree = 2
cells      eval.pi            error
    5 3.1248930668550594 1.6700e-02    -
   20 3.1404050605605449 1.1876e-03 3.81
   80 3.1415157631807009 7.6890e-05 3.95
  320 3.1415878042798613 4.8493e-06 3.99
 1280 3.1415923498174534 3.0377e-07 4.00
 5120 3.1415926345931995 1.8997e-08 4.00

Degree = 3
cells      eval.pi            error
    5 3.1414940401456048 9.8613e-05    -
   20 3.1415913432549156 1.3103e-06 6.23
   80 3.1415926341726910 1.9417e-08 6.08
  320 3.1415926532906897 2.9910e-10 6.02
 1280 3.1415926535851355 4.6578e-12 6.00
 5120 3.1415926535897190 7.4216e-14 5.97

Degree = 4
cells      eval.pi            error
    5 3.1415921029432572 5.5065e-07     -
   20 3.1415926513737595 2.2160e-09  7.96
   80 3.1415926535810712 8.7222e-12  7.99
  320 3.1415926535897576 3.5525e-14  7.94
 1280 3.1415926535897936 4.6729e-16  6.25
 5120 3.1415926535897918 1.4929e-15 -1.68
@endcode



One of the immediate observations from the output is that in all cases the
values converge quickly to the true value of
$\pi=3.141592653589793238462643$. Note that for the $Q_4$ mapping, we are
already in the regime of roundoff errors and the convergence rate levels off,
which is already quite a lot. However, also note that for the $Q_1$ mapping,
even on the finest grid the accuracy is significantly worse than on the coarse
grid for a $Q_3$ mapping!



The last column of the output shows the convergence order, in powers of the
mesh width $h$. In the introduction, we had stated that the convergence order
for a $Q_p$ mapping should be $h^{p+1}$. However, in the example shown, the
order is rather $h^{2p}$! This at first surprising fact is explained by the
properties of the $Q_p$ mapping. At order <i>p</i>, it uses support points
that are based on the <i>p</i>+1 point Gauss-Lobatto quadrature rule that
selects the support points in such a way that the quadrature rule converges at
order 2<i>p</i>. Even though these points are here only used for interpolation
of a <i>p</i>th order polynomial, we get a superconvergence effect when
numerically evaluating the integral, resulting in the observed high order of
convergence. (This effect is also discussed in detail in the following
publication: A. Bonito, A. Demlow, and J. Owen: "A priori error
estimates for finite element approximations to eigenvalues and
eigenfunctions of the Laplace-Beltrami operator", submitted, 2018.)
