Matlab implementation of 2D Interior penalty discontinuous Galerkin poisson problem

Basically, I am trying to solve the 2D poisson problem in order to learn implementation of IPDG methods. The problem states $-\nabla a(x)(\nabla u)=0\ \text{in} \ \Omega$ with $U=0$ on Dirichlet boundary $\Gamma_D$. The weak DG formulation gives find u such that $$a_{\epsilon}(u,v)=l(v)$$ where $$a_{\epsilon}(u,v)=\sum_{K\in T_h}\int_K a\nabla u\cdot \nabla v-\sum_{e\in \Gamma_h\cup \Gamma_D}\int_e\{a\nabla u\cdot n_e\}[v]+ \sum_{e\in \Gamma_h\cup \Gamma_D}\int_e\epsilon\{a\nabla v\cdot n_e\}[u] + \sum_{e\in \Gamma_h\cup \Gamma_D}\frac{\sigma_0}{|e|}\int_e[u][v]$$ Note that $\Gamma_h$ represents the collection of interior edges and $\epsilon$ chooses the method from SIPG,NIPG or IIPG. I understand very well how to compute and assemble the integral over volume in matlab but the skeleton terms (2nd and third terms and fourth ) are my problems. I need help with a simple matlab code for these three terms. I need to know how to code them and assemble them.

• I highly recommend reading Riviere's book, Discontinuous Galerkin Methods for Elliptic & Parabolic Equations: Theory & Implementation. It should have what you're looking for. – Paul Jul 4 '15 at 18:16
• Dear paul, I have the book and am following the algorithm, but I still get confused on the computation and assembly of the interior and boundary integrals on page 54. Any help with matlab code will be appreciated. – sola Jul 5 '15 at 18:00

1 Answer

Since you read Riviere's book and know how to assemble element integrals I assume you are familiar with concepts such as

• transformation to reference elements,
• numerical quadrature.

These techniques are applied analogously to edge integrals - with two differences:

1. Integrals are transformed to integrals over edges of the reference element, and then a second transformation brings them to the reference interval [0,1] or [-1,1], such that 1D quadrature rules can be applied.
2. To account for the contributions from neighboring elements, you will obtain multiple terms (contributions in your system matrix) from each integral of the original formulation.

My recommendation is to write out the semi-discrete system in full detail before starting to implement.

For another DG-formulation (LDG) you can read up on discretization and implementation details here: http://dx.doi.org/10.1016/j.camwa.2015.04.013 Many of the techniques explained there apply similarly to IPDG. The corresponding code is available on Github: https://github.com/FESTUNG/project