Suppose we have Poisson in 1D: $u'' = f(t)$ where $0<t<1$ and $u(0)=0$ and $u(1)=1$
We approximate the solution by $U(t) \approx \sum_{i=1}^n x_i \phi_i(t) $ where $\phi_i(t)$ are some basis functions. Once we put this into our equation we get some residual $r(x_i,t) = U''(t) - f(t) $. The idea is to multiply by some ${\bf weight }$ function and solve
$$ \int\limits_0^1 r(x_i,t) w(t) d t $$
In the Galerkin method, we take $w(t) = \phi_i(t)$ and use integration by parts to derive a system of equations where we find $x_1,...,x_n$. The question is
Suppose the hat function is used as the shape function (piecewise linear shape function) and the domain is decomposed into subintervals of lenght $h=0.2$ Compute the element stiffness matrix ${\bf K}$
If I understood correctly, we use
$$ \phi_i(x) = \begin{cases} \frac{ x - x_{i-1} }{h} & x_{i-1} \leq x \leq x_i \\ \frac{x_{i+1}-x}{h} & x_i \leq x \leq x_{i+1} \end{cases} $$
as our basis functions. We are given that
$$ K_{ij} = \sum_{e} K_{ij}^e $$
where $K_{ij}^e$ is the element stiffness matrix for element $\Omega_e$. In our case, we have $5$ elements as $h=0.2$. For example, for the first element: $[x_0,x_1]$ we have
$$ K_{ij}^1 = \int\limits_{x_0}^{x_1} ( \phi_i' \phi_j' + \phi_i \phi_j) dx $$
Is this how finite element method works?
$$-\int_0^1 u_0'(x)\phi'_i(x) dx = \int_0^1 f(x) \phi_i(x)dx + \int_0^1 \tilde{u}'(x) \phi_i'(x)dx$$
– VoB Apr 06 '21 at 14:33