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