# Discontinuous Galerkin order of convergence on arbirary refined mesh: step-12 deal.ii tutorial

I'm learning DG methods and in order to practice a little bit I'm using the deal.ii library. In particular, I'm looking at step-12, where they solve

$$\operatorname{div}(\beta u) = 0$$ $$u = g_D \text{ on } \Gamma^-$$

for a field $$\beta$$ and a discontinuous data on the inflow boundary.

In order to verify the order of convergence, I decided to construct a manufactured solution $$U(x,y)=e^x \sin(y)$$ using as field $$\beta =(-y,x)$$ which is the same as the one they have, but not scaled to one. In this way, the inflow boundary is the same as before, namely the lower and right boundaries. The equation then becomes

$$\operatorname{div}(\beta u) = e^x(\cos(y)x \sin(y) y)$$ $$u=U_{|\Gamma^-}$$ As you can read in the possible extension section, they say that

one can prove that for elements of degree p, the order of convergence is $$p + \frac{1}{2}$$ on arbitrary meshes

In my case $$p=1$$ so I should get order $$\frac{3}{2}$$ in the $$L^2$$ norm, but here's what I get (by using reduction_rate_log2 in the ConvergenceTable class)

cycle cells dofs        L2             H1
0    64   256 9.776e-04    - 5.471e-02    -
1   121   484 6.739e-04 0.54 4.156e-02 0.40
2   220   880 4.225e-04 0.67 3.323e-02 0.32
3   409  1636 2.138e-04 0.98 2.326e-02 0.51
4   757  3028 1.203e-04 0.83 1.720e-02 0.44
5  1399  5596 7.136e-05 0.75 1.311e-02 0.39
6  2575 10300 3.567e-05 1.00 9.398e-03 0.48
7  4699 18796 1.991e-05 0.84 7.059e-03 0.41
8  8635 34540 1.037e-05 0.94 5.142e-03 0.46
9 15799 63196 5.284e-06 0.97 3.727e-03 0.46

Question: Is that correct? I mean, does this agree with the theoretical bound of order $$\frac{3}{2}$$?

To confirm the goodness of my code, which is essentially the same as the step-12, with the obvious fixes (namely, the assembly, the definition of the exact solution and the change in the scaling of $$\beta$$) here's what I have by refining globally the mesh:

cycle cells  dofs        L2             H1

0    64    256 9.776e-04    - 5.471e-02    -

1   256   1024 2.463e-04 1.99 2.744e-02 1.00

2  1024   4096 6.180e-05 1.99 1.373e-02 1.00

3  4096  16384 1.548e-05 2.00 6.871e-03 1.00

4 16384  65536 3.873e-06 2.00 3.436e-03 1.00

5 65536 262144 9.686e-07 2.00 1.718e-03 1.00

The $$L^2$$ error and $$H^1$$ error converge properly, as you can see from the following table so I think that there are no mistakes in my code actually.

EDIT:

As you may see, the EOC in $$H^1$$ drops after a certain number of dofs. How can I justify this?

cells  dofs     u_L2_norm      u_H1_norm
64    1024 9.679e-08    - 1.223e-05    -
256    4096 6.045e-09 4.00 1.532e-06 3.00
1024   16384 3.777e-10 4.00 1.918e-07 3.00
4096   65536 2.360e-11 4.00 2.556e-08 2.91
16384  262144 1.475e-12 4.00 9.353e-09 1.45
65536 1048576 9.528e-14 3.95 8.801e-09 0.09

I assume you are solving a two dimensional problem:

Your refinement in your first example is not $$\frac{\Delta x}{2}$$. Generally this does not make problems if you refine uniformly. If you look a the number of elements, the error and the EOC something does not match. I am no expert for deal.ii, but i think the EOC routine is not able to handle different refinement levels other than $$\frac{\Delta x}{2}$$.

You have to use something like: ($$N$$ = number of elements, $$\epsilon$$ = error)

$$\text{EOC}= \log\left(\frac{\epsilon_{1}}{\epsilon_{2}}\right)/\log\left(\sqrt{\frac{N_{1}}{ N_{2}}}\right)$$

A good example, why i am not a big fan of learning computational science via blackbox libraries.

Regards

• Thanks @ConvexHull (nice nick !) That was my suspect. One question: what I should observe is order $p+1$ in $L^2$ and $p$ in $H^1$, using uniformly refined meshes? Aug 7 '21 at 11:35
• Yes you should observe these EOC's. About $H^1$ I am not sure. Aug 7 '21 at 12:23
• You need not have uniform refinements for convergence studies. You can choose element sizes arbitrarily and adjust the element size appropriately when calculating the convergence rate. The slope on log-log plot should be (p+1) (for L2); it does not matter which points you choose. Aug 7 '21 at 13:07
• @Chenna K Uniform refinement does not exclude arbitrary element sizes. At the end you have to calculate a global EOC. How would you proceed if each element is refined differently. Aug 7 '21 at 13:08
• @ChennaK Thanks for you comment. Do you know what order I should observe in $H^1$ norm? Aug 7 '21 at 13:47