# Finite Element Method

## Differential Equations and Boundary Conditions

### Two Types of Boundary Conditions

As an example, we have a partial differential equation

which describes a 1D problem.

- Dirichlet boundary condition: specify values for $u$, such as $u(0)=u_0$ and $u(L)=u_L$;
- Neumann boundary condition: specifiy values for $u_{,x}$.

If we have only Neumann boundary condition, the solution is not unique. The example for it is tossing a bar, which can have both Neumann BC at both ends but it is moving.

### Example Problems

#### Elasticity Problem

We consider the displacement $u(x)$ at each space coordinate $x$ of a elastic bar under some external force. The strain is proportional to $u_{,x}$. The equation would be

#### Heat Transfer

Define temperature on a bar at each point $u(x)$. Heat transfer is proportional to the head gradient, $j= - \kappa u_{,x}$. The quation would be

### Strong Form and Weak Form of PDE

Strong form of differential equations is basically the original form we write down. Strong form requires each term to be well defined at each point. However, we can derive a weak form that require each part to be well defined through the whole domain only, which is a relaxed requirement.

## Galerkin Method

Suppose we need to find the solution to equation

The key is that the solution can be approximated by

where $\phi_i(x)$ are the basis functions.

**The purpose is to find the the coefficients** $u_i$. Galerkin method has three steps.

- discretize the space $x$ and function space: triangulation,
- discretize the function using weak form: assembly,
- error estimation.

Triangulation is basically setting up the basis function in a discretized space $x$. One of the choice is the hat function.

At each point $x$, there is a hat function responsible for the approximation within $[x-\Delta x, x+\Delta x]$.

Those hat functions forms the basis for the approximated solution

With this approximation, it requires the *test function* $v$ to write down the weak form. Basically we multiply $v$ on both sides of the equation then integrate by step. Then the differential equation can be rewrite into matrix form with basis $\phi_i$,

We solve the coefficients $\mathbf U$ from the matrix equation.

## Collocation Method

This method is named collocation method because it employs two sets of basis functions.

To be specific, the result function should be

where $\psi(x_0)$ takes care of the boundary condition at $x_0$.

With two set of basis functions the matrix form of the equation is double sized.

## References and Notes

- Freitag, K. J. (2007). Neural networks and differential equations.
- COMSOL Multiphysics has a nice article