# How to impose Neumann boundary conditions in interior penalty DG method

Consider the following two point BVP: $$-u''(x)=f(x),~~~u(0)=u(1)=0.$$ An interior penalty DG method for this BVP that weakly imposes homogeneous Dirichlet boundary conditions is of the form: $$\sum_{i=0}^{N-1} \int_{I_i} u'(x) v'(x)\,dx + \frac{1}{h} \sum_{i=0}^{N } [\![u]\!]|_{x_i} [\![ v]\!]|_{x_i} - \epsilon (\!( v')\!)|_{x_i} [\![ u ]\!]|_{x_i} - (\!( u')\!)|_{x_i} [\![ v ]\!]|_{x_i} = \int_{0}^{1} f(x)v(x)\,dx,$$ where $[\![ \cdot ]\!]$ is the jump operator, and $(\!( \cdot )\!)$ is the average operator (see for more detail: https://scicomp.stackexchange.com/questions/19394/help-implementing-1d-ode-discontinuous-galerkin-method).

Question: How can I modify the above interior penalty DG method so that it can handle Neumann boundary conditions? For Poisson's equation in 2D and 3D, I've seen Neumann boundary conditions handled through integrals on the boundary of the elements...not sure if there is analogy of this for ODEs...

It works exactly the same as in higher dimensions, except that the integral is replaced by evaluation at the boundary points of the interval. You have $$\int_{(0,1)} -u'' v \,dx = \int_{(0,1)} u' v' \,dx - (u'(1) v(1) - u'(0) v(0)),$$ so if you have known values $g_0$ or $g_1$ for $u'(0)$ or $u'(1)$, you simply insert them into this equation and get new terms which should go on the right-hand side, $g_1 v(1)$ or $-g_0 v(0)$.
• Ahh, I see. However, if I have homogeneous Neumann boundary conditions, it seems natural to do nothing to the above DG formulation (since $g_1=g_0=0$). However, this means we have done nothing to alter the above DG formulation, which still imposes Dirichlet boundary conditions. – user107904 May 1 '15 at 15:16
• @user107904, The DG formulation in this case is different from the case when a Dirichlet condition is imposed because it lacks the term in which the jump in $u$ appears. – DanielRch May 2 '15 at 12:43
• @DanielRch I guess that is my main confusion; if I have a Neumann boundary condition, I'm not sure how the scheme should look. If I remove the jump in $u$, we end up with $\sum_{i=0}^{N-1} \int_{I_i} u'(x) v'(x)\,dx + \frac{1}{h} \sum_{i=0}^{N } [\![u]\!]|_{x_i} [\![ v]\!]|_{x_i} - (\!( u')\!)|_{x_i} [\![ v ]\!]|_{x_i} = \int_{0}^{1} f(x)v(x)\,dx$. But is this still an interior penalty method? – user107904 May 2 '15 at 19:25
• @user107904 You shold also remove the second term, there's a jump in $u$ there as well, which you cannot specify. I agree that this is just like a regular imposition of Neumann conditions - they are not imposed weakly like Dirichlet condition. But isn't the regular method of imposing Neumann conditions "weak" in a sense? – DanielRch May 3 '15 at 16:52
• @DanielRch You are correct, this makes sense now that I think about it. I was under the impression that the jump penalty term $\sum_{i=0}^{N } [\![u]\!]|_{x_i} [\![ v]\!]|_{x_i}$ acted as some sort of stabilization. The scheme I have now is $\sum_{i=0}^{N-1} \int_{I_i} u'(x) v'(x)\,dx - (\!( u')\!)|_{x_i} [\![ v ]\!]|_{x_i} = \int_{0}^{1} f(x)v(x)\,dx$; should I do anything to stabilize this scheme? – user107904 May 3 '15 at 20:35