[Summary] Weak Forumation For Finite Element Analysis

$$ % This version will make mathjax ignore the width of the annotation and keep the main % formula centered. Obviously this mean the annotation is forcefully placed to the right % and may bleed out: \newcommand{Annotation}[1]{ \rlap{~~~~~~\raise 0.8em {\color{grey}\scriptsize{ #1 }}} } \newcommand{annotation}[1]{ {~~~~~~\raise 0.8em {\color{grey}\scriptsize{ #1 }}} } $$

Strong form

Poisson equation PDE:

$$ u''(x) = f(x) $$

boundary conditions for the PDE $u(0)=0$, $u'(1) =0$

Weak form:

$$ \int u'(x)v'(x) = [u'(x)v(x)] - \int f(x)v(x) \ \ dx \ \ \text{ for all } v(x) $$

$v(x)$ is called the test function and can be any function.

$$ \begin{aligned} u''(x) &= f(x) \\ u''(x)v(x) &= f(x)v(x) \\ \int_a^b u''(x)v(x) &= \int_a^b f(x)v(x) \\ [u'(x)v(x)]_a^b - \int_a^b u'(x)v'(x) \ \ dx &= \int_a^b f(x)v(x) \annotation{ \text{partial integration} \\ \text{of left hand side} } \\ \end{aligned} $$

Set integral range to $[0,1]$, and with boundary conditions for the PDE $u(0)=0$, $u'(1) =0$ and forcing the test function to respect $v(0) = 0$:

$$ \begin{aligned} u'(1)v(1) - u'(0)v(0) - \int_a^b u'(x)v'(x) \ \ dx &= \int_a^b f(x)v(x) \\ - \int_a^b u'(x)v'(x) \ \ dx &= \int_a^b f(x)v(x) \\ \end{aligned} $$

Transcripts

This is a transcript of the video https://www.youtube.com/watch?v=xZpESocdvn4 all images and text are all properties of the original author

The weak formulation! You probably stumbled over this term already in one of your classes on finite elements or partial differential equations, and perhaps you had problems understanding where the weak formulation comes from and why it is so useful.

In this video we will take a close look at the weak formulation and visually explore its properties. If you never heard about the weak formulation before, don't worry, we will  start from the very beginning here.

Many problems in physics or engineering can be described by differential equations, which we want to solve for an unknown solution function.

$$ u''(x) = f(x) $$ Here you see differential equation in its conventional form, which is called the strong form, we will see later why. Transforming differential equations from their conventional form into what is called their weak form is nowadays an indispensable tool when it comes to numerically solving differential equations. $$ \int u'(x)v'(x) = [u'(x)v(x)] - \int f(x)v(x) \ \ dx \ \ \text{ for all } v(x) $$

However, just from looking at the formulas, it is not quite easy to understand the  concept concept of the weak formulation.

Why are there other functions than our unknown solution function in the weak formulation?

$$ \int u'(x){\color{red}v'(x)} = [u'(x){\color{red}v(x)}] - \int f(x){\color{red}v(x)} \ \ dx \ \ \text{ for all } v(x) $$ What does it mean that the weak formulation has to hold true for all of these functions? $$ \int u'(x)v'(x) = [u'(x)v(x)] - \int f(x)v(x) \ \ dx \ \ \color{red} \text{ for all } v(x) $$

And why is it even called weak formulation? These questions will be addressed in this video and we will explore why the weak formulation is so incredibly useful for solving differential equations with the finite element method (FEM). And I promise you: once having understood the weak formulation understanding the finite element method will be comparatively easy.

The strong formulation

But let's start from the very beginning. Before we talk about the weak formulation let's take a look at the differential equation in its conventional form: the strong formulation.

In this video we will take a look at the arguably most popular differential equation: the Poisson equation. This differential equation is so popular because it naturally appears in many scientific applications. The strong formulation of the Poisson problem in 1D states that for a given function $f(x)$ find a function $u(x)$ such that its second derivative which is here denoted by u'' is equal to f(x).

$$ \begin{aligned} \text{Given } f(x) \text{, find } u(x) \text{ such that}\\ u''(x) = f(x) \end{aligned} $$

So we want to find the function $u$ whose second derivative is $f$. Typically we are only interested in how this function looks like on a specific region of interest. Here I'm choosing the interval $0 \leq x \leq 1$.

$$ \begin{aligned} \text{Given } f(x) \text{, find} u(x) \text{ such that}\\ u''(x) = f(x) \\ \text{for all } 0 \leq x \leq 1 \end{aligned} $$

Let's visualize this. We are interested in the function $u$ of $x$. How does function looks like is not known.

Here I'm just illustrating an exemplary function.

As you know the derivative of u describes the slope of $u$ at each point $x$

and the second derivative which appears in our differential equation describes the slope of the slope of $u$ which can also be interpreted as the curvature of $u$.

We have given a function $f$ of $x$. In this video I will assume that $f(x)$ is constant taking the same value at each point $x$. I will denote this value by $f$ bar.

Our differential equation states that we want to find the function $u$ such that its second derivative is equal to $f$. Here I'm illustrating an exemplary function whose second derivative equals $f$:

So this function is a solution to our differential equation. Notice however that moving the function u up and down

has no influence on the slope and no influence on the curvature of $u$, likewise "rotating" (What I really mean here is that adding a linear function to u does not change its curvature. If the linear function is ax + b and if a is small, adding this function to u looks a bit like rotating u.) $u$ does change the slope of $u$ but again it does not have an influence on the curvature of $u$.

Therefore we could find infinitely many functions $u$ that fulfill our given differential equation. To avoid this we add boundary conditions to our problem. Here I will assume that $u$ at $x = 0$ is $0$ and the first derivative of $u$ at $x = 1$ is $0$.

$$ \begin{aligned} \text{Given } f(x) \text{, find} u(x) \text{ such that}\\ u''(x) = f(x) \\ \text{for all } 0 \leq x \leq 1 \\ u(0) = 0, u'(1) = 0 \end{aligned} $$

There's only one function that fulfills the differential equation and the boundary conditions at the same time. For this very simple one-dimensional example we can even find an analytical expression for this function. We obtain this quadratic expression for $u$.

$$ u(x) = \frac{1}{2} \bar fx^2 - \bar f x $$

By plotting $u$ and its derivatives we observe that $u$ indeed fulfills the differential equation because the second derivative of $u$ equals $f$ and $u$ indeed fulfills the boundary conditions because $u$ is $0$ at $x = 0$ and $u'$ is $0$ at $x = 1$.

Note however that deriving such analytical expressions for our solution is only possible for very simple differential equations. In general the solution to the differential equation may not be so easy to compute by hand hand and we have to rely on computer algorithms for finding the solution function $u$ or sufficiently good approximations of it.

5:10

The so-called finite element method is one of the most popular methods for solving differential equations numerically. The idea of the finite element method is to split our region of interest into a number of segments.

These segments are called elements and the points between the segments are called nodes. Next, we formulate a set of very simple functions which are respectively one at one node and zero at the other nodes.

These functions are called shape functions. As we have six nodes in this example there are six shape functions $N_i$. The index $i$ of $N_i$ indicates to which node a shape function belongs to.

Finally we assume that our solution function can be expressed as the sum of the shape functions multiplied by a set of parameters which are here denoted by $u_i$.

$$ u(x) = \sum_{i=0}^5 u_i N_i(x) $$

These parameters can take arbitrary values. If we set all of them to zero, our solution function is zero. By tweaking the parameters we obtain differently shaped functions $u$

Note that by assuming that our solution can be expressed as the sum of simple functions multiplied by tunable parameters, that is by introducing a parametric "ansatz" for our solution (I am using the word ansatz for the assumed form of the solution function u. Although ansatz is a German word, it is also frequently used in English, especially in the mathematical context.), we have reformulated the problem of finding an unknown function into a problem of finding a set of unknown parameters. Such problems can be handled much better by computers. But how could we possibly find out which values the unknown parameters should take?

The naïve approach would be to substitute our assumed expression for the solution function into the differential equation and see if we can solve for the unknown parameters.

$$ \begin{aligned} \Biggl ( \sum_{i=0}^5 u_i N_i(x) \Biggr )''(x) = f(x) \\ \text{for all } 0 \leq x \leq 1 \\ u(0) = 0, u'(1) = 0 \end{aligned} $$

But there is a catch! This naïve strategy is not possible which becomes clear immediately after looking at how the second derivative of our solution function looks like.

Ignoring the points at which our function is not differentiable we see that the second derivative of $u$ is zero everywhere and this does not change upon changing the values of the unknown parameters. This means that there is no possible combination of parameters such that the strong formulation of the differential equation is fulfilled. We arrived at the dead end. We have introduced a parametric ansatz for our solution function but we cannot substitute it in the differential equation to compute the unknown parameters in our ansatz.

Therefore we need to reformulate our problem into a form that is more suitable to be solved with the finite element method . We need to transform the strong formulation into what is called the weak formulation of the problem

8:11

The Weak Formulation

So let's talk about the weak formulation. In what follows we will derive the weak formulation from the strong formulation and for the next few minutes please do not focus on why we are doing this but rather focus on why we are mathematically allowed to reformulate the problem like this. The usefulness of the weak formulation will become apparent later.

First we write down the problem in the strong form.

$$ u''(x) = f(x) $$

Next we introduce a type of functions which we call test functions $v(x)$. The test functions are like $u(x)$ defined on an interval between x equals 0 and 1 and they may take any arbitrary shape on this interval.

Now we multiply both sides of the differential equation by these test functions.

$$ u''(x)v(x) = f(x)v(x) $$

This is a valid mathematical operation because we apply the same manipulations on both sides of the differential equation. If $u''$ is equal to $f$ then also $u'' \times v$ must be equal to $f \times v$.

Afterwards we integrate both sides of the differential equation over our region of interest that is from $x = 0$ to $x = 1$.

$$ \int_0^1 u''(x)v(x) = \int_0^1 f(x)v(x) $$

Once again this is a valid mathematical operation because we are applying the same manipulations on both sides of the equation. Note now, that we can apply these manipulations on both sides of the differential equation for any arbitrarily chosen test function $v$. No matter how we choose $v$ our newly derived integral equation must hold true. Therefore we write that the integral equation must hold true for all test functions $v$.

Finally like the strong formulation the weak formulation must fulfill the boundary conditions. That's it. $$ \begin{aligned} & \int_0^1 u''(x)v(x) = \int_0^1 f(x)v(x) \\ & \text{for all } v(x) \\ & u(0) = 0, \ u'(1) = 0 \\ \end{aligned} $$

We have derived the weak formulation from the strong formulation by multiplying both sides of the differential equation by the test functions and integrating both sides of the equation over the region of interest.

However are we really allowed to do this?

Whenever we manipulate an equation we must be very careful not to lose any information that the equation provides us. So the natural question that arises is whether we can recover all information that the strong form provides us from the weak form. In other words: we know that we can derive the weak form from the strong form but can we likewise derive the strong from the weak form? In the following we will try to answer this question by visually exploring the weak formulation.

Let's take a look at the weak formulation and let's focus on the right hand side of the equation

$$ \int_0^1 u''(x)v(x) = \color{red} \int_0^1 f(x)v(x) $$

first the function $f(x)$ is given we have assumed that it takes a constant value $\bar f$

the test function $v(x)$ is arbitrary the weak formulation must hold true for all test functions that we could think of so we can choose any shape for the test function here

but let's choose a test function with a constant value of 1 for now

next let's plot $f \times v$.

Multiplying two functions is a pointwise operation that means for every point $x$ we multiply the corresponding values $f(x)$ and $v(x)$ as $f$ is constantly taking the value $\bar f$ and $v$ is constantly 1. $f \times v$ is again a constant function that takes the value $\bar f$.

note that the right hand side side of the weak form is the integral of $f \times v$ from $0$ to $1$ which describes this area here.

Now let's move on to the left hand side of our equation.

$$ {\color{red} \int_0^1 u''(x)v(x)} = \int_0^1 f(x)v(x) $$ The second derivative of $u$ is unknown because $u$ is our unknown. The test function is the same as on the right hand side of the equation, which we have arbitrarily chosen as constantly $1$ for now. Finally the second derivative of $u$ times the test function $v$ is also unknown, because the second derivative of $u$ is unknown so the second derivative of $u$ times the test function $v$ can be a function of arbitrary shape

however there's one constraint the weak formulation tells us that the integral of $u'\times v$ must be equal to the integral of $f \times v$ therefore this area must be equal to this area

this means that $u'' \times v$ can take arbitrary shapes as long as the area is preserved for example this shape is allowed or this shape or this shape

knowing that $\int u'' v = \int vf$ what does this tell us about $u''$?

In this particular example we have chosen a test function that is constantly one this means that $u'' = u''v$, but we can see that choosing the test function as constant does not provide us much information about how $u''$ looks like. $u''$ can take any shape as long as $\int u''v = \int fv$.

We can conclude that by choosing a test function of constantly 1, we force the integral of $u''$ to be equal to $\int f$, however, we don't obtain any further information about how $u''$ should look like. That being said, the weak formulation must hold true for any test function $v$, so let's see if we can construct a test function that is more useful for getting information about how $u''$ looks like.

Let's start with a test function that is 1 over an interval $I$ and 0 elsewhere.

$fv$ is now a function that is equal to $\bar f$ over the interval $I$ and 0 elsewhere. We also know that $u''v$ must be 0 outside the interval $I$ because $v$ is 0 there. Inside the interval the shape of $u''v$ is unknown, we only know that its integral is equal to $\int fv$ (same area).$

Because $v$ is constantly 1 over the interval $I$, we know that $u''$ and $u''v$ are equal over the interval $I$.

But we do not know how $u''$ could look like outside the interval $I$

On the first glance it seems that we did not gain any new information about how $u''$ should look like after changing the shape of our test function. But let's take a closer look if we assume that $u''$ is a continuous function, which we will do here. We can observe that $u''$ must cross at some point in the interval $I$ the value $\bar f$, even if we change the shape of $u''$ crosses $\bar f$ at least once.

this is because otherwise the area under $u''v$ cannot be equal to the area under $fv$.

Now this is a useful information we have chosen the test function $v$ such that we know that $u''$ takes the value $\bar f$ somewhere in the interval $I$. We just don't know where exactly.

but let me remind you once more the weak formulation must hold true for any test function therefore we can decrease the interval $I$ over which our test function is chosen to be equal to 1. By doing so we narrowed down the interval in which we know that $u''$ is equal to $\bar f$... Can you see where this is going! We can decrease the interval even further, and in the limit, we will see that we are very certain about where u'' must take the value $\bar f$.

Let's step back for a second and see what we have achieved. By choosing a specifically designed test function we found that $u'' = \bar f$ at one point $x$.

Because the weak formulation must hold true for any test function we can repeat the same argument to find that $u'' = \bar f$ at another point $x$ let's see what happens if we repeat this argument a couple of times

We observe that for every test function that we choose we find that u'' equals $\bar f$ at 1 point x and we can choose infinitely many of such test [Music] functions thus we will find that u'' equals $\bar f$ at each point x do you remember this equation we have recovered the original form of our differential equation that is we have derived the strong form from the weak [Music] form let's recap earlier in this video we have seen that we can derive the weak form from the strong form and now we have seen that the strong form can be derived from the weak form thus the strong form and the weak form are equivalent or to put it in other words both formulations entail the same information about our unknown solution function U this means that we can choose either of the formulations for the numerical analysis as$I$already mentioned the finite element method is one of the most powerful numerical methods and it turns out that the weak form is much better suited for applying the finite element method than the strong form but still one important step is missing before we can apply the finite element method earlier in this video we have seen that in the finite element method we want to parameterize the solution using a linear combination of shape functions and unknown parameters UI using linear shape functions we have observed that the second derivative of our parameterized ansatz is zero no matter how we choose the unknown parameters in our ansatz therefore we couldn't substitute the ansatz in the strong formulation to compute the unknown parameters UI but we can see that we still have the same problem for the weak formulation because the solution function U still appears with its second derivative in the week formulation and this is the reason why one important last transformation of the weak formulation is required for this final transformation we use the concept of partial integration recall that the formula for partial integration states that the integral from 0 to 1 of the derivative of a function U * a function V is equal to the product of U and V evaluated at x = 1 minus the product of u and v evaluated at x = 0 minus the integral of U * the derivative of V to apply partial integration to our weak formulation we have to slightly modify this formula note that the formula of partial integration must hold true for any function U therefore we can substitute the function u in the formula by its derivative u'' the resulting formula looks like this we observe that the left hand side of the partial integration formula is equivalent to the left hand side of the weak form thus we can substitute the right hand side of the partial integration formula in the weak form we can see that because of the boundary condition that states that u'' at x = 1 is zero one term in the weak form vanishes the other boundary condition states that U at xal 0 is 0 now we can use a small trick as the weak form must hold true for all test functions we can freely decide how the test functions should look like as we already know the value of U at x equals z we constrain the test functions to be zero at this point that is we claim that the weak form must hold true for all test functions that are zero at x equals 0 this trick further simplifies the expression for our weak formulation now we have finally rearranged the weak form such that it is well suited for numerical analysis and we can see why applying partial integration was so useful until now the second derivative of the solution function U was present in the weak form but after applying partial integration the highest derivative of U that appears in the weak form is u'' at this point we can finally realize why the strong form is called the strong form and the weak form is called the weak form the strong formulation puts strong requirements on how the solution function U should look like it requires U to be two times differentiable the weak formulation puts weaker requirements on how the solution function U should look like it requires you to be just once differentiable therefore the weak form is much better suited for numerical analysis and in particular for the finite element analysis in the scope of this video we cannot take a deep dive into the finite element method but a video about the weak formulation without touching the finite element method wouldn't feel right therefore let's take a short look at the core ideas of the finite element [Music] method to apply the finite element method let's recap the parametric ansatz for the solution function we assume that the solution can be expressed by a linear combination of unknown parameters UI and known shape functions n note that this is an approximation with numerical methods like the finite element method we do not intend to find the solution function U exactly but a sufficiently good approximation of it for linear shape functions we get a piecewise linear ANW for U by tweaking the parameters UI we obtain differently shaped functions U our goal is now to compute the unknown parameters UI the first thing that we observe is that the boundary condition U at xal 0 is 0 tells us that the first parameter u0 must be zero and therefore our un simplifies slightly as the first derivative of U appears in the weak formulation we have to differentiate the anwers this is not difficult because the parameters UI do not depend on X and only the shape functions depend on X therefore the derivative of U is simply the sum of the parameters UI times the derivatives of the shape functions next we simply substitute our ANS in the week formulation note that the integral of a sum of some functions is equal to the sum of the integrals of the functions therefore we can switch the integral and the sum sign in our weak form expanding the sum we obtain the following expression let's take a closer look at this expression the unknown parameters UI do not depend on X therefore they can be written outside the integrals let's carefully think think about what this expression tells us on the left hand side we have our unknown parameters UI which are respectively multiplied by an integral of a shape function derivative and a test function derivative on the right hand side we have the integral of f times the test function both the shape function derivatives and the function f are known therefore all the integrals in our expression could be computed if a test function V was given we also observed that if all the integrals in our expression could be computed we would obtain a linear equation for our unknown parameters UI this is an important result because for any given test function V we obtain a linear equation for our unknown parameters we recall that the weak form must be fulfilled for any test function that is zero at X equals z thus we can simply choose as many distinct test functions as we have unknown parameters and for every of these chosen test functions we obtain a linear equation we have a lot of freedom on how to choose the test functions but the most convenient choice is to choose the shape functions n as test functions we finally arrive at at five equations in which the integrals are computable because the integrants are known quantities a fundamental advantage of the finite element method is that these integrals can be computed very efficiently however this goes beyond the scope of this video Computing all integrals on the left hand side and denoting the result by capital K and Computing all integrals on the right hand side and denoting the results by capital f leads to this compact representation of the system of equations because we have as many equations as unknowns this system of equations can be solved for the unknown parameters UI let's plot the resulting solution for our specific example comparing the result to the analytical solution in yellow we observe that the numerical and the analytical solution are quite similar$I$hope you were able to develop some intuition about the weak formulation and the finite element method at the end$I$want to emphasize that there are some fairly important Concepts that are not covered in this video first the concept of the weak formulation is closely related to the calculus of variations many weak formulations can be interpreted as the necessary condition for minimizing an energy functional however this is not always possible and in physics or engineering classes differential equations are typically introduced by deriving their strong formulation through physical arguments like for example the balance of linear momentum or the conservation of energy in form of heat therefore$I$think that deriving the weak formulation from the strong formulation is slightly more accessible further please keep in mind that this video did not intend to provide Prof found mathematical proofs but rather some intuition about the concept of the weak formulation for example we have not taken a close look at the properties that the solution function and the test functions must fulfill in terms of differentiability and integrability that is we have not specified which function spaces these functions should belong to this is a matter of study of functional analysis a field of mathematics that is well suited to rigorously study differential equations and how they can be solved finally in this video we left out many technical details about the finite element method which would have gone beyond the scope of this video about the weak formulation most importantly we have not discussed how to compute the integrals appearing in the parameterized version of the week formulation and we did not leave the one-dimensional setting let me know if you would be interested in any content of this kind if you found this video useful please consider sharing it with your friends thanks for staying till the end bye
 
Paypal donation Donate

No comments

(optional field, I won't disclose or spam but it's necessary to notify you if I respond to your comment)
All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Anti-spam question: