# The weak form

### Intro

One can write a general differential equation as:

$A(u)=f(x)$

An example, which we will often consider is

ex. $A(u)=-\frac{d}{dx}\left( a(x)\frac{d u }{dx}\right),$

to model e.g. heat conduction with a space-dependent heat conduction coefficient $a(x)$ and a heat production term $f(x)$. (Notice the “ex” when we are talking about a particular example.)

On top of that we of course need boundary conditions, Neumann, Dirichlet, Robin… In our case we will consider

ex. $u(x=0) =u_0\qquad\left(a(x)\frac{du}{dx}\right)_{x=L}=Q_0.$

### Three steps to the weak form

###### Step 1 – weighted residual

Cast the problem as in the method of weighted residuals (that article is pretty similar to this one up to here). In the end, we have:

$\int_0^L \psi_i\left[A(\sum_{j=1}^Nc_j\phi_j+\phi_0) - f\right]dx=0,$

where we have $N+1$ approximation functions (aka solution functions) ${\phi_j}$ and $N$ weight functions (aka test functions) ${\psi_j}$.

###### Step 2 – weak form

Now, only if the $A$ involves derivatives of even order, we can evenly distribute the derivatives between $u$ and $w$, thanks to integration by parts. In this instance,

ex. $\int w\left[-\frac{d}{dx}\left( a(x)\frac{d u }{dx}\right)-f\right]=0$

(notice we write $w$ for any of the weight functions) is converted into

ex. $\int\left[ a\frac{du}{dx}\frac{d w }{dx}-wf\right]-wa\left.\frac{du}{dx}\right]_0^L=0$

This is the weak form of the original differential equation. It is weaker in the sense that, clearly, less derivatives of $u$ appear than in the original equation (in this instance, we go from second to only first). This translates into less derivatives for the solution functions, too.

###### Step 3 – boundary conditions

We must not forget the boundary conditions. In the weak form, we can clearly spot the boundary term, the last one:

ex. $wa\left.\frac{du}{dx}\right]_0^L.$

In general, we may encounter natural and essential boundary conditions (NBCs and EBCs, resp.).

NBCs are the ones that relate to $w$ and its derivatives at the boundaries. In this instance, we car readily identify $a\left.\frac{du}{dx}\right]_0^L$ as the term that multiplies $w$. This term is often of physical importance: in this case we can identify it with the heat flux at the borders, $Q=+- a\frac{du}{dx}$, where the sign depends on the border: on the left, $x=0$, we have a plus for heat influx; at the right we have a minus for the same reason. All together, we may write

ex. $wa\left.\frac{du}{dx}\right]_0^L = -(wQ)_0-(wQ)_L$

EBCs are the ones that relate to $u$ or its derivatives at the boundaries. This term is, however, deduced from the same as the previous one: one must look at the way in which $w$ appears: this will be the way $u$ appears too. In this instance, $w$ appears simply alone, so the EBCs will refer to $u$ only (not its derivatives). (I know this is confusing, read twice!)

In general, NBCs and EBCs come in pairs. Both carry physical information, on quantities that are usually mutually conjugate in some sense. Only one of the two must be specified at each boundary, though. In this instance

ex. $u(x=0) =u_0\qquad\left(a(x)\frac{du}{dx}\right)_{x=L}=Q_0.$

This entails:

• The EBC $u(x=0) =u_0$ at the left boundary, trivially.
• The NBC $a du/dx=Q_0$ at the right boundary, trivially.
• The NBC $w(x=0) =0$ at the left boundary, not trivially.
The later fact involves an interesting argument. It turns out that $w$ may be viewed as virtual displacement around the true solution: $u=u_N+w$. The weighted residual being equal to zero is equivalent to a variational problem in which we are at a local extremum (I think a minimum) of a functional, in exactly the way this is done in classical mechanics (the action being the path integral of the Lagrangian, all that). If $u$ is given a value at some point, then $w$ must then be zero at that point, since we do not want a variation there at all. Mathematically, this means $w$ satisfies the homogeneous BC wherever $u$ satisfies a non-homogeneous one. We finally may write for our example:
ex. $\int\left[ a\frac{du}{dx}\frac{d w }{dx}-wf\right]-w(L)Q_0=0$
as the final form of our weak problem. Notice we have no information about $w(L)$. This would be the start of a computational problem; to proceed we still have to make choices for the ${\phi_j}$ (to approximate $u$) and the ${\psi_j}$ (to try for $w$).