next up previous contents
Next: Variational Formulation Up: BOUNDARY VALUE PROBLEMS (BVP) Previous: Collocation Method:   Contents

Galerkin Method:

Choose $ w_i(x)=\phi_i(x)$, the basis of the trial space. If we used a different basis we have Petrov-Galerkin. So

$\displaystyle \int_{\Omega} r(x)\phi_i(x0 \mathrm{d}x = 0$

ie we require that $ r(x)$ be orthogonal to $ \phi_i(x)$.

Example:

    $\displaystyle \mathcal{L}u = \left(\frac{ \mathrm{d}^2}{ \mathrm{d}x^2} + k^2\right) u = 0 \qquad 0<x<1$
    $\displaystyle u(0)=1 \qquad u(1)=0$

Again the nodes are $x=0$, $ x=0.5$ and $x=1$.

$\displaystyle v(x)=\sum_{j=1}^3 v_j \phi_j(x)$

$ v_1=1$ and $ v_3=0$ by boundary conditions. So we only have to work out things for node 2:

$\displaystyle \int_0^1 \left( \frac{ \mathrm{d}^2 v}{ \mathrm{d}x^2} + k^2v \right) \phi_2(x)
 \mathrm{d}x =0$

or

$\displaystyle \sum_{j=1}^3 v_j \int_0^1 \left( \frac{ \mathrm{d}^2 \phi_j}{ \mathrm{d}x^2}
+ k^2\phi_j \right) \phi_2(x)
 \mathrm{d}x =0$

However we can rewrite using integration by parts

$\displaystyle \int_0^1 \left( \frac{ \mathrm{d}^2 v}{ \mathrm{d}x^2} + k^2v \...
...mathrm{d}x + \left.\frac{ \mathrm{d}v}{ \mathrm{d}x} \phi_2
\right\vert _0^1
$

but $ \phi_2=0$ at $x=0$ and $x=1$ so the last term is zero.

\begin{multline*}
\int_0^1\left( -\frac{ \mathrm{d}v}{ \mathrm{d}x}\frac{ \m...
...+ v_3\left[\frac{1}{\Delta x} + \frac{k^2\Delta x}{6} \right]
=0
\end{multline*}

$\Box$

Another Comparative Example

Solve the


  $\displaystyle BVP\left\{\begin{array}{ll}
Y''=6t & 0\le t\le 1\\
Y(0)=0 & \mbox{}\\
Y(1)=1 & \mbox{}
\end{array}\right.$    

The exact solution is clearly $Y(t)=t^3$. First, let's solve this problem using:

A) Collocation Technique

seek a function $u(t)$ that satisfies BVP at a discrete set of mesh points in interval. We choose $u(t)$ as a simple polynomial, capable of satisfying the boundary conditions and with the regularity suggested by the BVP.

For illustration $\rightarrow$ only 1 point $t=0.5$ and $y=0$, at $t=1$.

\begin{displaymath}
\begin{array}{ll}
\mbox {Pick } & u(t)=x_0+x_1t+x_2t^2\\
\m...
...o } & u'(t)=x_1+2x_2t\\
\mbox {and } & u''(t)=2x^2
\end{array}\end{displaymath}

So for
  $\displaystyle \left\{\begin{array}{ll}
Y''=f(t,Y,Y') & x_0\le t=b\\
Y(a)=\alpha &\\
Y(b)=\beta
\end{array}\right.$    

we require that $u=Y$ at 3 points requires 3 equations:

(86) \begin{displaymath}\begin{array}{ll} x_0+x_1a+x_2a^2=\alpha \end{array}\end{displaymath}

(87) $\displaystyle x_0+x_1b+x_0b^2=\beta$

equations (86) and (87) lead to
      $\displaystyle x_0=0$
      $\displaystyle x_1+x_2=1$

and for some $t\in(a,b)\quad u''(t)=f(t,u(t),u'(t)).$

For us $u''(0.5)=f(0.5, u(0.5), u'(0.5))$

Thus

(88) $\displaystyle 2x_2=6(0.5)=3$

So solving (86), (87), (88) get $x_0=0$, $x_1=-5$, $x_2=1.5$ thus the approximate solution is $u=-0.5 t+1.5 t^2$. A comparison to the exact solution appears in Figure (15)
Figure 15: Comparison of exact and approximate solution via collocation
\includegraphics[height=3in]{cmp.ps}


  $\displaystyle u(0.5)$ $\displaystyle =$ $\displaystyle -0.5(0.5) + 1.5(0.5)^2=(0.5)^2(-1+1.5)=(0.5)^3$
  compare to $\displaystyle Y(0.5)$ $\displaystyle =$ $\displaystyle (0.5)^3$   residual is 0

B) FEM/Galerkin Method:

Same BVP and use same 3 mesh points, which now become ``knots'' in the piecewise polynomial approximation. Take ``hat'' basis or elements, which are shown in Figure (16).

Figure 16: Hat functions, on the unit interval.
\includegraphics[height=2in]{phi1.ps} \includegraphics[height=2in]{phi2.ps} \includegraphics[height=2in]{phi3.ps}

So $Y(t)\approx u(t)=x_1\phi(t)+x_2\phi_2 (t)+x_3\psi(t)$.

Applying the boundary conditions,

  $\displaystyle u(0)$ $\displaystyle =$ $\displaystyle 0=x_1\phi_1(0)+x_2\phi_2(0)+x_3\phi_3(0)\Rightarrow
x_1=0$
  $\displaystyle u(1)$ $\displaystyle =$ $\displaystyle 1=x_1\phi_1(1)+x_2\phi_2(1)+x_3\phi_3(1)\Rightarrow x_3=1$

Galerkin condition applied at $t=0.5\Rightarrow$ residual must be orthogonal to space spanned by the basis functions and hence to each basis individually
  $\displaystyle \mbox {Orthogonality condition:}
\begin{array}{l}
\\
\displaysty...
...displaystyle \int^1_0 u''\phi_2(t)dt-6\int^1_0 6\phi_2(t)dt\equiv 0
\end{array}$    

integrate by parts:
      $\displaystyle =-\int^1_0 u\overbrace{\phi'_2(t)dt+u'(t)\phi_2(t)}\vert^1_0-\frac32=0$
      since % latex2html id marker 24587
$\displaystyle \phi_2(0)=\phi_2(1)=0\therefore 2^{nd }$ term drops out, thus$\displaystyle ,$
      $\displaystyle =+\int^1_0u'\phi'_2(t)dt+\frac32=0.$


      $\displaystyle \int^1_0\left(\sum^3_{i=1}x_i\phi'_i(t)\right)\phi'_2(t)+\frac32=0$
      $\displaystyle \sum^3_{i=\alpha}x_i\int^1_0\phi'_i(t)\phi'_2(t)dt+\frac32=0\Righ...
...ht)+x_2\left(\frac{2}{h}\right)+x_3\left(-\frac{1}{h}\right)+\frac32}_{(\$)}=0,$

where $h=1/2$. Substituting $x_1$ and $x_3$ gives $x_2=\displaystyle \frac18$ in ($). We conclude that the approximation is

$\displaystyle u(t)=0.125\phi_2(t)+\phi_3(t)
$

A comparison of the exact and approximated solution appears in Figure (17).
Figure 17: Comparison of exact and FEM approximate solution
\includegraphics[height=3in]{fem.ps}

Remark: One particularly nice feature of Galerkin/FEM and collocation methods is that the approximation $u(t)$ of the solution $Y(t)$ is defined over all of the range of $t$ prescribed in the problem statement. This is not true for the finite difference solution, which only gives you an approximation $y$ of $Y$, at specified locations $t_i$ defined by the grid.

We'll consider more BVP issues in the context of PDE's, which is in the next part of the courseII.

$\Box$


next up previous contents
Next: Variational Formulation Up: BOUNDARY VALUE PROBLEMS (BVP) Previous: Collocation Method:   Contents
Juan Restrepo 2003-05-02