Finite elements method: why test fuction vanishes on boundaries

509 Views Asked by At

I am trying to understand why (and exactly when) the test functions must vanish at the boundaries when Dirichlet conditions are applied to a PDE. The context is the learning of the finite element method (FEM) by a chemist.

What I understood from reading several articles is that this is necessary because the test functions can be considered as virtual changes to the unknown function, and since we would know the values of the latter at the extremes, there can be no change there.

While I understand the idea behind the previous paragraph, I do not know how to relate that to the equations that I am using and to my little understanding of calculus of variations (obtained by self learning).

What confuses me is:

In calculus of variations, we look for a function $y$ that minimizes the functional $$J[y] := \int_{x_1}^{x_2}L(x,y(x),y^{\prime}(x)) dx$$ by using a variation $\epsilon \eta(x)$ with which the following expression is derived $$\int_{x_1}^{x_2} \eta (x)\times \left(\frac{\partial L}{\partial y} - \frac{d}{dx}\frac{\partial L}{\partial y^{\prime}} \right) dx = 0$$ While in FEM the first step is to get the weak formulation of a problem $Au(x) =f(x)$ (where only $u$ is unknown), that after multiply for a test function $v$ and integrating and reodering we have: $$ \int _{x_1}^{x_2} v(x)\times(Au(x)-f(x))dx=0$$

The doubts I have are:

  1. Is $v$ playing a similar role to $\eta$? Why? In the first Eq. $\eta$ was taken to be arbitrary and then is deduced that parenthesis must be zero. But in the second Eq.we already knew that the parenthesis is zero, so $v$ can could be almost anything. Isn't that right?

  2. The first Eq. is derived minimizing $J[y+\epsilon \eta]$ which makes it clear to me why we are talking about variations. But, in which sense $v$ is related to a variation?

  3. I've seen this condition applied to the Poisson equation with Dirichlet conditions, for example: $$u''=f \quad\text{ for }\quad \Omega=(0,1)\quad\text{ and }\quad u(0)=u(1)=0$$ From where $$\int_{0}^{1}v'u'dx + u^{'}(0)v(0) - u'(1)v(1) = \int_{0}^{1} fvdx$$

If $v$ is zero irrespective of the values of $u$ on the boundaries, the equation seems to lead to the same solution. What I am missing here?

1

There are 1 best solutions below

4
On BEST ANSWER

From what I can see, your understanding of the problem is correct.

For 3. I'm not sure what by it leads to the same solution, but you're correct, since v vanishes at the end points you end up with the weak form of the Poisson problem

$$\int u'v' =\int fv,$$

which can be rearranged to your Au - f statement.

For 1 and 2, typically the variation $\eta\in C^\infty_0$ (smooth with compact support), so that $y +\epsilon \eta$ belongs to the same space as $y$ (notice that if y satisfies an inhomogeneous BC this is not changed by $\eta$).

Indeed, after some integration by parts, you arrive at your first integral, which holds for all smooth and compactly supported $\eta$, which, by the fundamental lemma of the calculus of variations tells us that the integrand is zero - which means you can put more general functions v there, not just smooth compact support ones.

Another way to think about the change from $\eta$ to v, is that $C_0^\infty$ is dense in $L^2$.

Further clarification on your questions: first let's tidy up the notation a bit. It's good to give the lagrangian some dummy variables to avoid confusion, I.e. defining $L$ via $L(x,p,q)$, so that $L(x,y,y')$ is obtained by substituting $p=y,q=y'$. Then, written explicitly, the Euler Lagrange equation is: $$\int v\times\left(\frac{\partial L(x,y,y')}{\partial p} -\frac{d}{dx}\left(\frac{\partial L(x,y,y')}{\partial q}\right)\right) = 0.$$ Looking at a concrete example helps, so let's set $L(x,p,q) = 0.5q^2 +fp$ (for some given function f), so that $\frac{\partial L}{\partial p}=f$, and $\frac{\partial L}{\partial q} =q$. This gives us $$\frac{d}{dx}\left(\frac{\partial L(x,y,y')}{\partial q}\right) =\frac{d}{dx}\left(y'\right)=y''.$$ Our EL equation is then $$\int v\times(f - y'') =0.$$ Letting the unknown $u=y$ this is the same as $$\int v\times(Au - f) =0,$$ where $Au = u''$ (note that we flipped the sign of the integral).

The same thing happens in the general example, as you can break down the calculations to get to the $Au - f$ form. I think perhaps some of the confusion stems from the inaccurate $f$ and $f'$ notation on the derivatives that should have been $y$ and $y'$. Hope that helps!

For the Galerkin method reference, all that they're saying is that when you su substitute in a general galerkin function, it no longer satisfies $Au -f =0$, so the goal is now to find such a function that satisfies

$$\int x_i\times(Au_h - f) =0$$ for all $x_i$, i.e., the residual is orthogonal to the space.