# Numerical Methods Qualification Exam Problems and Solutions (University of Maryland)/Aug09 667

## Problem 4

 Given the two-point boundary value problem ${\begin{cases}-u''+\alpha u=f(x),\quad 0\leq x\leq 1,\quad \alpha >0\\u'(0)=A,\\u'(1)=B\end{cases}}\!\,$ ## Problem 4a

 Set up the finite element approximation for this problem, based on piecewise linear elements in equidistant points. Determine the convergence rate in an appropriate norm

## Solution 4a

Let $V=\{v\in H^{1}[0,1]\}\!\,$

Find $u\in V\!\,$  such that for all $v\in V\!\,$

$\int _{0}^{1}-u''v+\alpha \int _{0}^{1}uv=\int _{0}^{1}fv\!\,$

or after integrating by parts and including initial conditions

$\int _{0}^{1}u'v'+\alpha \int _{0}^{1}uv=\int _{0}^{1}fv+Bv(1)-Av(0)\!\,$

### Discrete Variational Form

$V_{h}=\{v\in H^{1}[0,1]:v=\!\,$  piecewise linear $\}\!\,$

$\{\phi _{i}\}_{i=0}^{N+1}\!\,$  is basis for $V_{h}\!\,$ ;$h={\frac {1}{N+2}}\!\,$

For $i=1,2,\ldots ,N\!\,$

$\phi _{i}={\begin{cases}{\frac {x-x_{i-1}}{h}}{\mbox{ for }}x\in [x_{i-1},x_{i}]\\{\frac {x_{i+1}-x}{h}}{\mbox{ for }}x\in [x_{i},x_{i+1}]\\0{\mbox{ otherwise}}\end{cases}}\!\,$

$\phi _{i}'={\begin{cases}{\frac {1}{h}}{\mbox{ for }}x\in [x_{i-1},x_{i}]\\-{\frac {1}{h}}{\mbox{ for }}x\in [x_{i},x_{i+1}]\\0{\mbox{ otherwise}}\end{cases}}\!\,$

$\int \phi _{i}\phi _{j}={\begin{cases}{\frac {2}{3}}h{\mbox{ for }}i=j\\{\frac {1}{6}}h{\mbox{ for }}|i-j|=1\\0{\mbox{ otherwise}}\end{cases}}\!\,$

$\int \phi _{i}'\phi _{j}'={\begin{cases}{\frac {2}{h}}{\mbox{ for }}i=j\\-{\frac {1}{h}}{\mbox{ for }}|i-j|=1\\0{\mbox{ otherwise}}\end{cases}}\!\,$

$\phi _{0}={\begin{cases}{\frac {x_{1}-x}{h}}{\mbox{ for }}x\in [x_{0},x_{1}]\\0{\mbox{ otherwise }}\end{cases}}\!\,$

$\phi _{N+1}={\begin{cases}{\frac {x-x_{N}}{h}}{\mbox{ for }}x\in [x_{N},x_{N+1}]\\0{\mbox{ otherwise }}\end{cases}}\!\,$

Find $u_{h}\in V_{h}\!\,$  such that for all $v\in V_{h}\!\,$

$\int u_{h}'v_{h}'+\alpha \int _{0}^{1}u_{h}v_{h}=\int _{0}^{1}fv_{h}+Bv(1)-Av(0)\!\,$

Since $\{\phi _{i}\}_{i=0}^{N+1}\!\,$  forms a basis

$u_{h}=\sum _{i=0}^{N+1}u_{h_{i}}\phi _{i}\!\,$

Therefore we have system of equations

For $j=0,1,\ldots ,N+1\!\,$

$\sum _{i=0}^{N+1}u_{h_{i}}\int _{0}^{1}\phi _{i}'\phi _{j}'+\alpha \sum _{i=0}^{N+1}u_{h_{i}}\int _{0}^{1}\phi _{i}\phi _{j}=\int _{0}^{1}f\phi _{j}+B\phi _{j}(1)-A\phi _{j}(0)\!\,$

${\begin{bmatrix}\alpha {\frac {1}{3}}h+{\frac {1}{h}}&{\frac {\alpha }{6}}h-{\frac {1}{h}}&&\\{\frac {\alpha }{6}}-{\frac {1}{h}}&\alpha {\frac {2}{3}}h+{\frac {2}{h}}&{\frac {\alpha }{6}}h-{\frac {1}{h}}&\\\ddots &\ddots &\ddots &\\&{\frac {\alpha }{6}}h-{\frac {1}{6}}&\alpha {\frac {2}{3}}h+{\frac {2}{h}}&{\frac {\alpha }{6}}h-{\frac {1}{h}}\\&&{\frac {\alpha }{6}}h-{\frac {1}{h}}&\alpha {\frac {1}{3}}h+{\frac {1}{h}}\end{bmatrix}}{\begin{bmatrix}u_{h_{0}}\\u_{h_{1}}\\\vdots \\u_{h_{N}}\\u_{h_{N+1}}\end{bmatrix}}={\begin{bmatrix}\int _{0}^{1}f\phi _{0}-A\\\int _{0}^{1}f\phi _{1}\\\vdots \\\int _{0}^{1}f\phi _{N}\\\int _{0}^{1}f\phi _{N+1}+B\end{bmatrix}}\!\,$

### Convergence Rate

In general terms, we can use Cea's Lemma to obtain

$\|u-u_{h}\|_{1}\leq C\inf _{v_{h}\in V_{h}}\|u-v_{h}\|_{1}$

In particular, we can consider $v_{h}\!\,$  as the Lagrange interpolant, which we denote by $v_{I}\!\,$ . Then,

$\|u-u_{h}\|_{1}\leq C\|u-v_{I}\|_{1}\leq Ch\|u\|_{H^{2}(0,1)}$ .

It's easy to prove that the finite element solution is nodally exact. Then it coincides with the Lagrange interpolant, and we have the following punctual estimation:

$\|u(x)-u_{h}(x)\|_{L^{\infty }([x_{i-1},x_{i}])}\leq \max _{x\in [x_{i-1},x_{i}]}{\frac {u^{(2)}(x)}{(2)!}}\left({\frac {h}{2}}\right)^{2}$

## Problem 4b

 Explain whether $\alpha >0\!\,$ is necessary for the convergence in part (a).

## Solution 4b

If $\alpha \geq 0\!\,$ , then the stiffness matrix is diagonally dominant and hence solvable.