Consider this BVP with variable coefficients: $$-\nabla\cdot(a\nabla u) = f\ in\ \Omega$$ $$-n\cdot(a\nabla u) = \kappa(u-g_D)-g_N\ on\ \partial \Omega$$ where $a>0,f,\kappa>0,g_D,g_N$ are given functions. To obtain the variational formulation of this problem, multiply $f=-\nabla\cdot(a\nabla u)$ by a test function $v$ and integrate over the domain $\Omega$: $$\int_{\Omega} fv\ dx = \int_{\Omega}-\nabla\cdot(a\nabla u)v\ dx$$ $$= \int_{\Omega} a\nabla u\cdot \nabla v\ dx-\int_{\partial \Omega}n\cdot (a\nabla u)v\ ds$$ $$= \int_{\Omega} a\nabla u\cdot \nabla v\ dx-\int_{\partial \Omega} (\kappa(u-g_D)-g_N)v\ ds$$

Green's thm was used in the second-to-last equality, and for the final equality we just used the BC. The steps and calculations following this are not a problem.

Now consider the BVP $$-\Delta u=f\ in\ \Omega$$ $$u=\sin{2\pi x_1}\cdot \sin{2\pi x_2}\ on\ \partial \Omega$$

Following the same idea as above we end up with $$\int_{\Omega} fv\ dx = \int_{\Omega} \nabla u\cdot \nabla v\ dx-\int_{\partial \Omega} n\cdot \nabla uv\ ds$$

At this point I am stuck. What should I do about $n$? I can't find any clues on this particular problem anywhere. Should I attempt to "eliminate" $n$ as in the first example (if so, how?), or should I use $n$ directly in further calculations?

I'm just looking for hints on how to handle $n$, no one seems to have had this same problem though.

  • 4
    $\begingroup$ Actually, many thousands of mathematicians have had this problem back to the days of Euler! ;-) When there is a Dirichlet condition on the boundary (i.e. the dependent variable is specified), the trick to dealing with the integral over the boundary is to simply place a special requirement on the function, $v$; it must equal zero on the boundary where $u$ is specified. So the boundary integral disappears. $\endgroup$ Commented Dec 7, 2016 at 22:38
  • $\begingroup$ Thanks! I think I know what you're saying, it's similar to advice I got on the corresponding 1D case. But ok... when we implement this, won't we eventually need to adjust the stiffness matrix using values of $n$? (Not a very specific question, I know :-/ ) $\endgroup$ Commented Dec 7, 2016 at 22:56
  • 1
    $\begingroup$ No, the restriction on $v$ eliminates this integral on all sections of the boundary where $u$ is prescribed. Prescribing $u$ is done by restricting $u$ as needed to satisfy the constraints. Usually this is done by fixing the nodal values of $u$ and this often involves modifying the stiffness matrix in some way. $\endgroup$ Commented Dec 8, 2016 at 1:24

1 Answer 1


As @BillGreen already said in one of the comments, the test function $v$ is actually zero on the boundary, so the whole boundary integral simply disappears.

If you want to understand why $v$ is zero, take a look at lecture 21.5 of mine: http://www.math.colostate.edu/~bangerth/videos.html . The point is that $v$ is a variation of the solution $u$; so if $u=g$ on the boundary, then any variation $u+\epsilon v$ must also be equal to $g$ on the boundary, which can only be the case if $v$ is zero on the boundary.

  • $\begingroup$ I'm going to show my ignorance coming from DG here, but then how do you enforce the BC when the boundary term drops out to zero due to the test function being zero on the boundaries? $\endgroup$
    – Aurelius
    Commented Dec 8, 2016 at 13:39
  • 1
    $\begingroup$ You enforce it as part of the function space, i.e. strongly via constraints, as opposed to weakly via the bilinear form. $\endgroup$ Commented Dec 8, 2016 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.