Project: Linear Finite Element Methods

The purpose of this project is to write a finite element code for solving the Poisson equation in a general polygonal domain using piecewise linear finite elements.

Contents

Step 1: Download and Install iFEM

Step 2: Mesh

[node,elem] = squaremesh([0,1,0,1],0.25);
showmesh(node,elem);
[node,elem] = circlemesh(0,0,1,0.2);
showmesh(node,elem);
 - Min quality 0.7571 - Mean quality 0.9696 - Uniformity 4.34% 
[node,elem] = uniformrefine(node,elem);
showmesh(node,elem);

Step 3: Assembling

Compare three ways of assembling stiffness matrix discussed in Programming of FEM.

   profile on
   tic; assemblingstandard; toc;
   tic; assemblingsparse; toc;
   tic; assembling; toc;
   profile viewer

Compare the computational time for different N (by uniform refinement of the initial mesh).

Step 4: Right hand side

Using three points quadrature (i.e. 3 middle points of a triangle) to compute the right hand side vector.

Step 5: Boundary conditions

Step 6: Convergence

Code your subroutine in a general way such that you can solve the Poisson equation on a different mesh by changing the input arguments. After you get the desireable results for the unit square, try to solve $-\Delta u = 1$ with constant Neumann boundary conditions on the unit disk. The exact solution can be found using the polar coordinate.