# Discontinuous Galerkin energy method

I am studying DG for conservation laws from this book.

Local inner product is defined like

$$(u,v)_{D^k} = \int_{D^k} uv dx$$

and the $L^2(D^k)$-norm as

$$(u,u)_{D^k} = ||u||^2_{D^k}$$

Now, consider the following problem where the flux $f(u) = au$

$$\frac{\partial u}{\partial t} + \frac{\partial (au)}{\partial x} = 0$$

I am a little confused in example 2.3 they have

$$\frac{d}{dt}||u_h||^2_{\Omega,h} = -a(u^2(R)-u^2(L))$$

and they say that it is derived from multiplying the equation of the problem by $u(x,t)$, integration over the domain $D^k$, followed by integration by parts.

If I take the equation of the problem and multiply it by $u(x,t)$ is it correct to have the following?

$$\frac{\partial u^2}{\partial t} + \frac{\partial (au^2)}{\partial x} = 0$$

Note the square exponent in $u$. Or should it be?

$$u \frac{\partial u}{\partial t} + u\frac{\partial (au)}{\partial x} = 0$$

Perhaps they are equivalent but don't have arguments to convince myself.

Following with the integration over the domain $D^k$ I have $$\int_{D^k} \frac{\partial u^2}{\partial t} dx + \int_{D^k} \frac{\partial (au^2)}{\partial x} dx = 0$$

Now assuming I can change the derivate and integral (is there some theorem or condition the function must satisfy so that I am allowed to do this?) of the first term and using fundamental theorem of calculus in the second I get

$$\frac{\partial}{\partial t} \int_{D^k} u^2 dx + a[u^2]^R_L = \frac{d}{dt} ||u||^2_{D^k} + a[u^2(R)-u^2(L)]^R_L$$

which gives the result they have in the book (the notation is a little bit off don't know if I make a mistake on it but it seems to me that there are some typos in the book)

So my last question is, where does the third step comes into play? I don't see where to apply integration by parts.

I believe my confusion comes from the notation and some theorems/conditions I am missing to do certain stuff with the integrals/derivatives. Could someone clarify all the small details I asked?

• "Integration by parts" is the multidimensional analogon of the fundamental theorem of calculus. People use the term interchangeably. – Wolfgang Bangerth Jan 10 '15 at 23:04
• @WolfgangBangerth could you give me a hint on how to check that? Integration by parts comes from the derivative of a products but don't see the connection with the fundamental theorem of calculus – BRabbit27 Jan 11 '15 at 12:53
• The fundamental theorem of calculus states that $\int_a^b \frac{d}{dx} f(x) \; dx = f(b)-f(a)$. Assume that $f(x)=u(x)v(x)$ then $\int_a^b \frac{d}{dx} [u(x)v(x)] \; dx = \int_a^b u'(x)v(x) + u(x)v'(x) \; dx = u(b)v(b)-u(a)v(a)$, or put differently: $\int_a^b u'(x)v(x) \; dx = u(b)v(b)-u(a)v(a) - \int_a^b u(x)v'(x) \; dx$. This is integration by parts in 1d. – Wolfgang Bangerth Jan 11 '15 at 18:59

Don't skip steps. $$\frac{\partial u^2}{\partial t} = 2 u \frac{\partial u}{\partial t}$$ by the Product Rule. The same applies to the flux term as well assuming $a$ is constant. Integration by parts is another name for the Divergence Theorem or the Fundamental Theorem of Calculus in 1D, so converting the second term from an interior integral to a boundary integral, which is point evaluation in 1D, is an application of Integration by Parts.
In Gibbs notation, the Divergence Theorem says for some vector function $w$: $$\int_\Omega \nabla \cdot w \; dx = \int_{\partial \Omega} w\cdot\hat n \; ds$$ If you have $w=au$, where $a$ is a scalar function, then $$\nabla\cdot(au)=\nabla a \cdot u + a\nabla \cdot u$$ Putting the two together gives: $$\int_\Omega \nabla\cdot(au) \; dx = \int_{\partial\Omega} \hat n \cdot au \; ds = \int_\Omega \nabla a \cdot u + a\nabla \cdot u \; dx$$ which allows you to freely convert between either of the two terms on the right (which you may have derived from the physics of your problem) and boundary term. In 1D the surface integration term is integration around the zero-dimensional end points of your domain, which is just evaluation of the integrand at those endpoints.
• $u^2$ is the same as $u * u$, so you may use the product rule or chain rule at your convenience. – Bill Barth Jan 9 '15 at 14:23
When you apply an energy method, multiply by the solution $u$ and integrate over the domain $D^k$ you obtain $$\displaystyle\int_{D^k} \left(\frac{\partial u}{\partial t} + \frac{\partial (au)}{\partial x}\right)u \;dx = (u_t,u)_{D^k} + ((au)_x,u)_{D^k} = 0.$$ As was noted previously by Bill Barth we know $$u\frac{\partial u}{\partial t} = \frac {1}{2}\frac{\partial (u^2)}{\partial t}.$$ If we assume that the value of $a$ is constant then it is also true that $$u\frac{\partial (au)}{\partial x} = \frac {1}{2}\frac{\partial (au^2)}{\partial x}.$$ So we can rewrite the first equation (as you have previously) $$\displaystyle\int_{D^k} \frac{\partial (u^2)}{\partial t} + \frac{\partial (au^2)}{\partial x}\;dx = 0.$$ From previous answers your concerns about integration by parts have been addressed (though if you assume $x$ dependence on the wavespeed $a$ the problem becomes slightly more complicated/subtle).
You final concern was can you exchange the time derivative and integration. In general, as long as a given function $f$ and $\frac{\partial f}{\partial t}$ are continuous in the space-time rectangle $[a,b]\times[c,d]$, then $$\frac{\partial}{\partial t}\int_a^b f(x,t)\,dx = \int_a^b \frac{\partial f}{\partial t}(x,t)\,dx \quad\textrm{for }t\in[c,d].$$ The idea of this result is simply that $$\frac{1}{\Delta t}\left[\int_a^b f(x,t + \Delta t)\,dx - \int_a^b f(x,t)\,dx \right]= \int_a^b \frac{f(x,t + \Delta t) - f(x,t)}{\Delta t}\,dx,$$ from which one passes to the limit as $\Delta t \rightarrow 0$.