# Nonlinear finite elements/Bubnov Galerkin method

## (Bubnov)-Galerkin Method for Problem 2

The Bubnov-Galerkin method is the most widely used weighted average method. This method is the basis of most finite element methods.

The finite-dimensional Galerkin form of the problem statement of our second order ODE is :

{\displaystyle {\text{(20)}}\qquad {\begin{aligned}{\text{Find}}~u_{h}(x)\in {\mathcal {H}}_{0}^{n}~&~{\text{such that}}\\&\int _{0}^{1}\left({\frac {du_{h}}{dx}}{\frac {dw_{h}}{dx}}+u_{h}~w_{h}-x~w_{h}\right)~dx=0\qquad ~{\text{for all}}~w_{h}(x)\in {\mathcal {H}}_{0}^{n}\\&u_{h}(0)=0,u_{h}(1)=0~;~~\qquad w_{h}(0)=0,w_{h}(1)=0\end{aligned}}}


Since the basis functions (${\displaystyle N_{i}}$ ) are known and linearly independent, the approximate solution ${\displaystyle u_{h}}$  is completely determined once the constants (${\displaystyle a_{i}}$ ) are known.

The Galerkin method provides a great way of constructing solutions. But the question is: how do we choose ${\displaystyle N_{i}}$  so that these functions are not only linearly independent but arbitrary? Since the solution is expressed as a sum of these functions, the accuracy of our result depends strongly on the choice of ${\displaystyle N_{i}}$ .

Let the trial solution take the form,

${\displaystyle u_{h}(x)=\sum _{i=1}^{n}a_{i}N_{i}(x)~.}$

According to the Bubnov-Galerkin approach, the weighting function also takes a similar form

${\displaystyle w_{h}(x)=\sum _{j=1}^{n}b_{j}N_{j}(x)~.}$

Plug these values into the weak form to get

${\displaystyle \int _{0}^{1}\left[\left(\sum _{i=1}^{n}a_{i}{\cfrac {dN_{i}}{dx}}\right)\left(\sum _{j=1}^{n}b_{j}{\cfrac {dN_{j}}{dx}}\right)+\left(\sum _{i=1}^{n}a_{i}N_{i}\right)\left(\sum _{j=1}^{n}b_{j}N_{j}\right)-x\left(\sum _{j=1}^{n}b_{j}N_{j}\right)\right]~dx=0}$

or

${\displaystyle \int _{0}^{1}\left[\sum _{j=1}^{n}b_{j}\left({\cfrac {dN_{j}}{dx}}\sum _{i=1}^{n}a_{i}{\cfrac {dN_{i}}{dx}}+N_{j}\sum _{i=1}^{n}a_{i}N_{i}-x~N_{j}\right)\right]~dx=0}$

or

${\displaystyle \int _{0}^{1}\left[\sum _{j=1}^{n}b_{j}\left(\sum _{i=1}^{n}\left(a_{i}{\cfrac {dN_{j}}{dx}}{\cfrac {dN_{i}}{dx}}+a_{i}N_{j}N_{i}\right)-x~N_{j}\right)\right]~dx=0~.}$

Taking the sums and constants outside the integrals and rearranging, we get

${\displaystyle \sum _{j=1}^{n}b_{j}\left[\sum _{i=1}^{n}a_{i}\int _{0}^{1}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx-\int _{0}^{1}x~N_{j}~dx\right]=0~.}$

Since the ${\displaystyle b_{j}}$ s are arbitrary, the quantity inside the square brackets must be zero. That is

${\displaystyle {\text{(21)}}\qquad {\sum _{i=1}^{n}a_{i}\int _{0}^{1}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx-\int _{0}^{1}x~N_{j}~dx=0\qquad j=1\dots n~.}}$

Let us define

${\displaystyle {\text{(22)}}\qquad {K_{ji}:=\int _{0}^{1}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx\qquad {\text{and}}\qquad f_{j}:=\int _{0}^{1}x~N_{j}~dx~.}}$

Then we get a set of simultaneous linear equations

${\displaystyle {\text{(23)}}\qquad {\sum _{i=1}^{n}K_{ji}a_{i}=f_{j}~.}}$

In matrix form,

${\displaystyle {\mathbf {K} \mathbf {a} =\mathbf {f} ~.}}$