# Finite element method applied to variational problem/functional VS weak formulation

I am confused.

I read an introduction to finite element method where it was derived for the poisson equation: $$-\Delta u + cu = f,\qquad, u = g_0 \text{ on Dirichlet boundaries},\qquad\partial_n u g_1 \text{ on Neumann boundaries}.$$

It introduced the concept of the weak form:

Find u such that $u=g_0$ on Dirichlet boundaries $$\int_\Omega \nabla u \bullet \nabla v +c \int_\Omega uv = \int_\Omega fv + \int g_1 v$$

And derives the method from there.

In another paper I was reading however, a variational formulation of the Poisson equation was presented: $$\Delta u + k = 0$$

Which was then formulated as

Minimize $\int_\Omega \nabla u \bullet \nabla u - 2ku$

s.t $u=0$ on boundary

## My Question

In the paper they say that is it now trivial to use the variational formulation to use finite element methods. But I don't understand the connection with the weak formulation and hence I do not understand the link with the finite element method.

• Hi tgoossens and welcome to scicomp! Are you asking how to obtain the weak form from the variational formulation (or vice versa)? Or are you asking how to use the variational form directly as a numerical method? – Paul Feb 16 '16 at 15:06
• @Paul Hi thanks! I am asking how to derive the finite element method given a variational formulation. SInce christian pointed out the connection between to the weak form I was able to derive the finite element methods for the problems I wanted to solve. But I'm sure there is a more direct way. I guess when I discretize the optimization problem, linear algebra will bring me to the same conclusions. Any hints? – tgoossens Feb 16 '16 at 15:36
• Nevermind. I understand it now – tgoossens Feb 17 '16 at 9:47

The connection is quite straightforward (but note that your two examples have different boundary conditions and are thus not equivalent). Assume that you know (e.g., from physical considerations) that your unknown function minimizes the functional $$J(u) = \int_\Omega |\nabla u|^2 - 2fu\,dx$$ over all functions in a certain function space (here, $u\in H^1_0(\Omega)$, the space of all weakly differentiable functions which vanish at the boundary).

Just as in standard calculus, a necessary condition for $u$ to be a minimizer is that the derivative vanishes at $u$; specifically, that the directional derivative satisfies $$J(u;v) := \lim_{t\to 0} \frac{J(u+tv)-J(u)}{t} = 0 \qquad\text{for all }v\in H^1_0(\Omega)$$ (intuitively, $J$ does not further decrease by going a small step in any direction $v$ from $u$). Now, inserting the definition, canceling what you can, and taking the limit yields $$0=J(u;v) = 2\int_\Omega \nabla u\cdot \nabla v\,dx - 2\int_\Omega f v\,dx \qquad \text{for all } v\in H^1_0(\Omega),$$ which is precisely the weak formulation.

If you now replace $H^1_0(\Omega)$ by a finite-dimensional subspace $V_h$ of (say) piecewise linear polynomials defined on a triangulation, you arrive (after rearranging and dividing by $2$) at the finite element formulation $$\int_\Omega \nabla u_h\cdot \nabla v_h\,dx = \int_\Omega f v_h\,dx \qquad \text{for all } v_h\in V_h.$$

For Neumann boundary conditions, you proceed similarly, but the functional now involves a boundary integral similar to the volume integral for the right-hand side. For nonhomogeneous Dirichlet conditions, you'd write $u=u_g + u_0$, where $u_g$ is a suitable function with $u=g$ on the boundary and $u_0$ satisfies $u=0$ on the boundary and is similarly characterized as a minimizer (or solution of a weak form).

EDIT: In principle, you could also first replace $u\in H^1_0(\Omega)$ by $V_h$ in $J$, i.e., minimize $J(u_h)$ over all $u_h\in V_h$ and then compute the derivative, and end up at the same equation.

You could also discretize the functional and then apply a minimization algorithm to $J(u_h)$, e.g., steepest descent or Newton's method. (Or vice versa, formulate the minimization algorithm in function space and discretize each iteration.) For a linear equation, though, this would be equivalent to applying Richardson iteration to the weak formulation or just solving it, respectively, so there's no real gain. But for a nonlinear problem (where the weak formulation would be a nonlinear PDE), this so-called direct method can make sense and is actually used in practice.

• So If I understand it correctly: when *Given" a variational statement to solve, I first have to derive the weak for which then allows me to derive the finite element equations – tgoossens Feb 16 '16 at 14:44
• Exactly. If you have a $J(u)$, you differentiate with respect to $u$ in an arbitrary direction $v$ to obtain the weak formulation, and then replace $u$ and $v$ by trial and test functions from an appropriate finite-dimensional subspace to obtain the finite element formulation. (Or the other way around, see the edit.) – Christian Clason Feb 16 '16 at 15:01
• This was a great answer and I was able to solve the problem I was trying to solve! – tgoossens Feb 16 '16 at 15:09
• Great, happy to help! – Christian Clason Feb 16 '16 at 15:09