I'm working on a finite element approximation to solve the following ODE type:


$u(0) = u(1) = a(0)$ using a Galerkin method.

We start by defining a mesh $x_j=jh$ over $N$ points.

We take the piecewise function $\phi$ as a basis:

$\phi_j(x) =\begin{cases} 0&\text{if}\, ~x\not\in(x_{j-1},x_{j+1})\\ \dfrac{x-x_{j-1}}{x_{j}-x_{j-1}}&\text{if}\, x\in (x_{j-1},x_{j})\\ \dfrac{x_{j+1}-x}{x_{j+1}-x_j}&\text{if}~x\in (x_j,x_{j+1}) \end{cases}$

Specifically, for the problem:

We take the test method $v(x)=\phi_i(x)$ and the Galerkin method we are using is:

Find $u$ such that $\displaystyle\int_0^1 a(x)\dfrac{du}{dx}\dfrac{dv}{dx}~dx=\displaystyle\int_0^1 f(x)v(x) dx$, for approximation:


Substituting for u and v into the method, the left hand side gives the stiffness matrix with entries

$(a_{ij})=\displaystyle\int_0^1 a(x)\dfrac{d\phi_j}{dx}\dfrac{d\phi_i}{dx}~dx$

In the specific example I'm doing, $a(x)=1$ and we should find:

$(a_{ij})=\begin{cases} \frac{2}{h}&\text{if}\, ~i=j\\ \frac{-1}{h}&\text{if}\, i=j+1,~\text{or}~i=j-1 \end{cases}$

I don't understand how to get those values for $(a_{ij})$?

My attempt:

$\phi_j'(x) =\begin{cases} 0&\text{if}\, ~x\not\in(x_{j-1},x_{j+1})\\ \dfrac{1}{h}&\text{if}\, x\in (x_{j-1},x_{j})\\ \dfrac{-1}{h}&\text{if}~x\in (x_j,x_{j+1}) \end{cases}$

But computing $\phi_i'$ seems to be throwing me.

  • $\begingroup$ Further attempt: split $(a_{ij})$ into 2 regions of integration; have an integral from $x_{j-1}$ to $x_j$, and an integral from $x_j$ to $x_{j+1}$. We know the value of $\phi_j'$ in each region, and so it remains to work out which piecewise region $\phi_i$ belongs to at each point $i$ in relation to $j$. For example, for $i=j$, we have that from $x_{j-1}$ to $x_j$ , we're clearly in the middle 'zone' of the piecewise function, whilst from $x_j$ to $x_{j+1}$, we're in the bottom zone. Taking the corresponding values for $\phi'$ over each region of integration, we can proceed, since $x_j = jh$ ? $\endgroup$ – MildConcern May 28 '17 at 0:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.