Finite Element Analysis
By: Kiran Mak
Tags: Materials Science, Finite Element Analysis, Math, Computer Science

Part 1: Introduction

Now that we have the theory down, let’s move on to the process.

Most natural systems are too complicated to be mathematically computed using their direct formulas. Everything is changing at all times and so if you’re calculating a function for temperature based on a heat flux equation, you need to keep track of the time and xyz coordinates, all of which are constantly changing.

Natural phenomena are frequently based on partial differential equations. These equations include expressions that determine how a dependent variable will change based on an infinitesimal change in independent variable (i.e. the derivative).

An ordinary differential equation (ODE) has only one independent variable and is structured as below: constant * derivative = function(dependent var, independent var).

Since there’s only one independent variable, ODEs are frequently solvable and will give a solution T=f(t) such that the dependent variable can be calculated at any instance of the independent variable.

This could be the differential for conservation of internal thermal energy. ⍴ is the density, Cp is the heat capacity, T is temperature, and t is time. The function g is a variable heat source dependent on time and temperature.

However, in all likelihood, the temperature would be different at each point. This creates a heat flux across different points.

Here we add three more independent variables: x is the vector (x, y, z). The heat flux q is (q ₓ, qᵧ, q𝓏), and the divergence specifies the change across coordinates. Further, heat flux can also be represented as q = -k𝛁T where k is the thermal conductivity; in other words, heat flux is proportional to the temperature gradient. All in all,

So finally substituting back into the initial equation,

This, like other PDEs, is a complex equation that can’t be solved using numerical methods so we have to use numerical approximations.

Part 2: Weak Formulation

The first thing we can do to simplify the problem is bring it from one of infinite dimensions to finite dimensions. Currently the solution space (of functions) is in infinite dimensions. By restricting it with boundaries, we convert the functions to vectors that share nice similar properties. This step is called a weak formulation because it relaxes the requirement that the equation hold for all points and instead just says it must hold for all functions in the Hilbert space.

How exactly does this work?

We’re going to use the same example as above at steady state, meaning that the temperature does not change with time (dT/dt=0). We will model this over the domain 𝛺.

Then we can specify the boundary conditions. For example, let’s assume that we know the temperature along a boundary ∂𝛺₁ and the expression for the heat flux normal to another boundary ∂𝛺₂. The remaining boundaries have 0 heat flux in the outward direction (∂𝛺₃).

n is the outward unit normal vector and h is the heat transfer coefficient

For a visual representation, we have something like this:

We then multiply a test by a test function 𝜙 and integrate over 𝛺. 𝜙 and the solution T belong to a Hilbert space which is an infinite dimensional functional space in which all of the functions share certain nice properties that allow them to be manipulated. Therefore, we have that

Using Green’s identity (like integration by parts), we end up with:

We make the weak formulation by only requiring the above equation to hold for all test functions instead of the previous one (without the integrals) for all points in 𝛺. In this way the original PDE doesn’t have to be well defined for all points; it only needs to be equal in terms of the integral. For example, a discontinuity in the first derivative is fine because it doesn’t affect the integration.

Part 3: Discretization

Now that we have a weak representation and have limited the solution space, we must find an approximation of the infinite dimension Hilbert space in a finite dimensioned subspace. As we discussed at the beginning, this approximation is going to be a linear combination of basis functions φᵢ in the subspace.

A set of basis functions are the only functions needed to describe a space. Every point within the space is then a linear combination of the bases. For example, in a plane, any two non-colinear vectors define the basis for the space.

The most simple example is <0,1> and <1,0>. By adding a coefficient times the vectors, you can get to any xy coordinate.

This applies to higher dimensions as well and we get that Th, the approximation of T, can be represented as

Substituting that back into our weak formulation gives this terribly ugly and messy equation:

As a reminder, the unknowns are the coefficients Tᵣ. The above equation forms a system of equations of the same dimension as the finite-dimensional functional space. If there are n test functions, j goes from 1…n, and we end up with a system of n equations and n unknowns.

If you’re familiar with matrices, then you can see that this can be easily represented in matrix form with ATh = b where T is the vector of unknowns, Th = {T₁, … Tᵢ, … Tn} and A is an nxn matrix with the coefficients of Tᵢ in each equation j. The vector b, then becomes a nonlinear function of the unknown coefficients of Tᵢ.

The great thing about FEM is that you can choose optimal basis functions. By having basis functions that don’t overlap much (remember the triangles at the beginning), the dotted integrals are 0 so the coefficients are frequently 0 and the contribution to the matrix is also 0. The system matrix A is therefore sparse and calculations with it are much faster.

Essentially what we did in this step was to mesh the structure, in other words, break it up into little pieces.

The meshed heat sink

Common mesh geometries

Then we summarized each element with a simpler basis function. Then you can piece together each basis function to get an approximation of the entire function. One notable thing is that the smaller the mesh one uses, the more accurate the approximation would be (same as in Riemann sums).