Galerkin Approximation for Finite Elements

60 Views Asked by At

so I've been trying my hand at this approximation but I can't quite seem to get a good answer. Would really appreciate if anyone can identify where I've gone wrong. Given a first order DE:

$$u''-\frac{6}{x^2}u+\frac{12}{x}=0,1<x<3$$

I would like to use two piecewise elements, each of length $L=1$ to approximate this solution. Hence, for each element, the trial solution, $u(x)$, would have the following form and shape functions, $N_i$, to satisfy partition of unity:

$$u(x)=N_1a_1+N_2a_2$$ $$N_1=1-\frac{x}{L},N_2=\frac{x}{L}$$

  • Element Level

Using the Galerkin method, I will have to integrate in the following fashion:

$$\int_{x_1}^{x_1+L} N_i\left[ u''-\frac{6}{x^2}u+\frac{12}{x}\right]dx=0$$

This gives the following 2x2 symmetric matrix after some integration by parts:

$$\int_{x_1}^{x_1+L} N'_iN'_j+\frac{6}{x^2}N_iN_j\, dx\begin{bmatrix} a_1\\ a_2 \\ \end{bmatrix} =\int_{x_1}^{x_1+L}\frac{12}{x}N_i\, dx+[N_iu']^{x_i+L}_{x_i}$$

Now I understand that if I simply perform this integration for the domain $0<x<1$, the integration will fail due to the denominator having $x$. This would mean I have to "shift" my shape function, for e.g. in the domain $1<x<2$, $$N_1=2-x,N_2=x-1$$

The above integral was then evaluated and the same was done for the domain $2<x<3$.

  • Global Level

With the given boundary condition $u(1)=1$ and $u'(1)=-1$, I get an assembled global matrix of the following: $$\begin{bmatrix} 2.3645 & -0.5234 & 0\\ -0.5234 & 3.0855 & -0.8360\\ 0 & -0.8360 & 1.2688 \end{bmatrix} \begin{bmatrix}1\\u(2)\\u(3) \end{bmatrix}= \begin{bmatrix}4.6355\\6.2789\\2.2688 \end{bmatrix}+\begin{bmatrix}-u'_1\\0\\u'_3\end{bmatrix}$$

This gives me $u(2)=-6.25$ and $u(3)=-31.20$, which is a bad approximation for the actual function $$u(x)=2x-x^3$$

Perhaps, could someone enlighten me on where I may have gone wrong and correct my conceptual understanding? Thank you!!