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\begin{equation}   (u,u)_{D^k} = ||u||^2_{D^k}\end{equation}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?
Discontinuous Galerkin energy method
discontinuous galerkin
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.Typically, the application of integration by parts is done in weak/finite element method derivations to move one derivative from  a second order term from the unknown solution onto the test function (which leads to symmetry for that term and lower-order derivatives). I don't see the need for it here, yet, but I can't access that book, so I don't know if it appears in latter parts of the derivation. 