# DG-FEM integration by parts

I am going through the book of Hesthaven and Warburton on discontinuous Galerkin methods. I have difficulties understanding some basic steps in the calculations.

Consider the PDE: $$\frac{\partial u}{\partial t} + \frac{\partial f(u)}{\partial x} = 0$$ where the linear flux is given as $$f(u) = au$$.

The residual will be expressed as $$R_h(x,t) = \frac{\partial u_h}{\partial t} + \frac{\partial au_h}{\partial x}.$$ And it is supposed to be orthorgonal to the testspace $$\int_{D^k} R_h(x,t) \psi_n(x) \, dx = 0$$

By applying partial integration to this expression, the authors arrive at

$$\int_{D^k} \left( \frac{\partial u_h^k}{\partial t} \psi_n-au_h^k\frac{d \psi_n}{d x} \right)\, dx = - \int_{\partial D^k} \hat{n}\cdot au^k_h\psi_n \,dx \qquad 1 \leq n\leq N \tag{1}$$ Where $$\hat{n}$$ is the local outward pointing normal. But I don't see how the left term vanishes.

For the next step, the authors introduce the numerical flux $$(au_h)^*$$ that is supposed to correctly describe the fluxes between the elements. It is expressed as

$$\int_{D^k} \left( \frac{\partial u_h^k}{\partial t} \psi_n-au_h^k\frac{d \psi_n}{d x} \right)\, dx = - \int_{\partial D^k} \hat{n}\cdot(au_h)^*\psi_n \,dx \qquad 1 \leq n\leq N$$

With the same trick they arrive at

$$\int_{D^k} R_h \psi_n\, dx = \int_{\partial D^k} \hat{n}\cdot \left( au_h^k-(au_h)^* \right)\psi_n \,dx \qquad 1 \leq n\leq N \tag{2}$$

It would be of great help if I could see the details of the steps.

We are considering the one-dimensional scalar conservation law, $$\frac{\partial u}{\partial t} + \frac{\partial f(u)}{\partial x}= 0, \quad x \in \Omega, \quad t > 0,$$ subject to appropriate initial and boundary conditions. For a DG method, we would like to seek solutions $$u_h(\cdot, t)$$ in the space $$V_h \subset L^2(\Omega)$$ containing functions that are degree $$p$$ polynomials on each element $$D^k$$ such that the residual is orthogonal to all test functions $$v$$ in that space (due to linearity of all terms with respect to the test function, it is sufficient to consider only basis functions $$\{\psi_n\}_{n=1}^{N}$$, where in one dimension, $$N = p+1$$, as you have done). This might imply that for each element $$D^k$$, the local solution $$u_h^k$$ statisfies $$\int_{D^k}v\left(\frac{\partial u_h^k}{\partial t}+ \frac{\partial f(u_h^k)}{\partial x}\right)\, \mathrm{d} x = 0, \quad \forall v\in V_h.$$ The above local formulation, however, does not enforce any boundary conditions or connection between elements, so we cannot hope to obtain a well-posed approximation this way. In contrast with the continuous Galerkin approach of restricting $$V_h$$ to satisfy essential boundary conditions and inter-element continuity, a DG method involves the weak enforcement of interface and boundary conditions through a numerical flux function.

To apply the numerical flux, the second term in the above integral can be expressed through integration by parts as $$\int_{D^k}v\frac{\partial f(u_h^k)}{\partial x}\, \mathrm{d} x = \left[v f(u_h^k) \right]_{x_{k-1/2}}^{x_{k+1/2}} - \int_{D^k} \frac{\partial v}{\partial x} f(u_h^k) \, \mathrm{d} x,$$ where $$x_{k-1/2}$$ and $$x_{k+1/2}$$ denote the left and right boundaries of $$D^k$$. Of course, we could apply integration by parts in higher dimensions for a vector-valued flux $$\mathbf{f}$$ as $$\int_{D^k}v \nabla \cdot \mathbf{f}(u_h^k)\, \mathrm{d} x = \int_{\partial D^k}v \mathbf{f}(u_h^k) \cdot \mathbf{\hat{n}} \, \mathrm{d}s - \int_{D^k}\mathbf{f}(u_h^k) \cdot \nabla v \, \mathrm{d} x,$$ which motivates the more general notation presented by Hesthaven and Warburton. Applying the integration by parts formula results in a "weak" formulation of the DG method, $$\int_{D^k}\left( v\frac{\partial u_h^k}{\partial t} - \frac{\partial v}{\partial x}f(u_h^k)\right)\, \mathrm{d} x = - \left[v f^* \right]_{x_{k-1/2}}^{x_{k+1/2}},\quad \forall v\in V_h,$$ where $$f(u_h^k)$$ has been replaced with the appropriate numerical flux $$f^*$$ for the boundary/interface term. Now using integration by parts in "reverse", we can go back to a "strong" formulation, $$\int_{D^k}v\left(\frac{\partial u_h^k}{\partial t} + \frac{\partial f(u_h^k)}{\partial x}\right)\, \mathrm{d} x = \left[v \left(f(u_h^k) - f^*\right) \right]_{x_{k-1/2}}^{x_{k+1/2}},\quad \forall v\in V_h,$$ where the left-hand side is the inner product of the test function and residual, and the right-hand side is a penalty term which weakly enforces inter-element coupling or boundary conditions.

Please let me know if this was helpful or if you have any further questions.

• Thanks! Can you elaborate on how to treat the time derivative in the integral?
– dba
Jun 28, 2019 at 8:38
• So just for completeness, I will mention that there are two general approaches for treating the time derivative. The most common method is the semi-discrete, or "method of lines", approach, where the time derivative is left continuous at first, and then after applying a spatial discretization, one obtains a system of ordinary differential equations to solve using a time-marching method such as a Runge-Kutta scheme. The second approach is to apply the DG method on a space-time domain, though this is much less common and not treated in detail by Hesthaven and Warburton. Jun 28, 2019 at 15:29
• Last question: in Example 2.2 in the text it says that the weak form of this scheme does not allow a space of nonsmooth test functions. But the strong form does. Why is that?
– dba
Jun 28, 2019 at 15:36
• The weak form involves the spatial derivative of the test function, so the test function must be sufficiently regular for that to be possible. Applying integration by parts to obtain the strong form transfers the spatial derivative back to the flux, so we no longer require (weak) differentiability of the test function. Jun 28, 2019 at 15:44