I am looking at a tutorial on the Fenics software library for solving PDEs with finite elements. I have a question about the handling of the boundary term when we find the weak form for the 2D heat equation. My confusion is that the boundary term would drop out when the boundary integral is equal to zero, but in the tutorial the boundary integral is ignored by does not seem to integrate to zero. So I am wondering if this is an error in the tutorial or if I am missing something in the math?
The statement of the problem is:
$$ \frac{\partial u}{\partial t} = \nabla^2 u + f, \quad \text{in } \Omega $$ $$ u = u_D \text{ on } \partial\Omega $$ $$ u = u_0 \text{ at } t = 0 $$ $$ u_D = 1 + x^2 + \alpha y^2 + \beta t $$
We can discretize in time using finite differences, and then solve for the weak form as follows.
$$ \int_\Omega u^{n+1}v dV - \int_\Omega u^nv dV - \int_\Omega \Delta t \nabla^2 u^{n+1}v dV - \int_\Omega \Delta t f^{n+1}v dV = 0 $$
Now of course we would use the divergence theorem to reduce the order of the Laplacian term and get the following result. In the equation below, $dV, ds$ refer to the volume integral and surface(boundary) integral respectively.
$$ \int_\Omega u^{n+1}v dV - \int_\Omega u^nv dV - \int_{\partial \Omega} \Delta t v \frac{du}{dn}ds + \int_\Omega \Delta t \nabla u^{n+1}v dV - \int_\Omega \Delta t f^{n+1}v dV = 0 $$
So in this setup--my own derivation, that boundary term $\partial \Omega$ would disappear if the integral over the boundary is equal to zero. However, in the problem setup above, the value of $u = u_D$ on the boundary, and in the tutorial, $u_D = 1 + x^2 + \alpha*y^2 + \beta*t$.
So in tutorial itself, the weak form is missing that boundary term. My assumption is that the authors believe that term integrated to zero. Here is the actual description of the weak form from the tutorial. I included the $n+1$ superscript as that was omitted in the original tutorial text.
$$ \int_\Omega u^{n+1}v + \Delta t \nabla u^{n+1}\nabla v -(u^n + \Delta t f^{n+1})v dx = 0 $$
I am just wondering why the boundary term over $\partial \Omega$ seems to have disappeared?
Note, I can ask this question on the Fenics forum, however I figured that this was more a math question than a specific coding problem. I imagine that the tutorial is correct and that I am missing something in the math, but I was not sure what I am missing, haha.
Hence I would appreciate it if someone can just tell me why that boundary term disappears, given that the boundary function does not seem to integrate to zero at each time step.