Tutorial of iFEM

Contents

Features of iFEM

Basic Data Stucture

Mesh: node and elem.

Two matrices node(1:N,1:d) and elem(1:NT,1:d+1) are used to represent a d-dimensional triangulation embedded in $R^d$, where N is the number of vertices and NT is the number of elements.

node(k,1) and node(k,2) are the x- and y-coordinates of the k-th node for points in 2-D. In 3-D, node(k,3) gives the additional z-coordinates of the k-th node.

elem(t,1:d+1) are the global indices of d+1 vertices which form the abstract $d$-simplex t. By convention, the vertices of a simplex is ordered such that the signed volume is positive. Therefore in 2-D, three vertices of a triangle is ordered counterclockwise and in 3-D, the ordering of vertices follows the right-hand rule.

Related functions: fixorientation, label, label3

Documentation: meshdoc

clear all; close all;

Example: L-shape domain in 2-D.

node = [1,0; 1,1; 0,1; -1,1; -1,0; -1,-1; 0,-1; 0,0];
elem = [1,2,8; 3,8,2; 8,3,5; 4,5,3; 7,8,6; 5,6,8];
figure(1)
showmesh(node,elem)
axis on
findnode(node)
findelem(node,elem)

Example: Cube in 3-D.

node = [-1,-1,-1; 1,-1,-1; 1,1,-1; -1,1,-1; -1,-1,1; 1,-1,1; 1,1,1; -1,1,1];
elem = [1,2,3,7; 1,6,2,7; 1,5,6,7; 1,8,5,7; 1,4,8,7; 1,3,4,7];
figure(2)
showmesh3(node,elem,[],'FaceAlpha',0.25);
view([-53,8]);
axis on
findnode3(node)
findelem3(node,elem)

Boundary: bdEdge or bdFace.

For 2-D triangulations, we use bdEdge(1:NT,1:3) to record the type of three edges of each element. Similarly in 3-D, we use bdFace(1:NT,1:4) to record the type of four faces of each element. The value is the type of boundary condition listed as follows.

We label three edges of a triangle such that bdEdge(t,i) is the edge opposite to the i-th vertex. Similarly bdFace(t,i) is the face opposite to the i-th vertex.

Related functions: findboundary, setboundary, findboundary3 setboundary3.

Documentation: bddoc

node = [1,0; 1,1; 0,0];
elem = [1 2 3];
edge = [2 3; 1 3; 1 2];
subplot(1,2,1);
showmesh(node,elem);
findedge(node,edge);
findnode(node);
node = [1,1,1; 0,0,0; 1,1,0; 1,0,0];
elem = [1,2,3,4];
subplot(1,2,2);
showmesh3(node,elem,[],'FaceAlpha',0.35); view([-10,18]);
findnode3(node);
findelem3(node,[2,3,4; 1,3,4; 1,2,4; 1,2,3])

Finite Element Method

Adaptive Finite Element Method

Time-dependent Problems