You are on page 1of 3

Phillip Koelpin

AERO 430
Project #3
December 11, 2014
Part 1: Explanation of FEM as implemented in CODE2
The method of finite elements in CODE2 follows the following routine of running through the
MATLAB functions to develop the solution to the problem. A main file must be set up that
defines the problem that must be solved. This includes all parameters for the problem like the
dimensions. This process is carried out through the function pipe.m in CODE2.
The next step in the solution is to mesh the problem. In this case it would be meshing the pipe
as defined in the initialization phase. This function allows the definition of material properties,
number of elements, element sizes. The MATLAB function that performs this meshing is
mesh_pipe.m.
The boundary conditions for the problem are defined in the function BCdata.m. This function
defines the type of boundary condition and the value of the boundary condition.
After the problem has been properly meshed and the boundary conditions defined, the
stiffness matrix must be formed. The function formkf2D.m will form the stiffness matrix and
the load vector for the problem. This function utilizes the function elem2D and to get the
local stiffness matrix and load vector for each element individually and then inserts these local
stiffness matrices into the global stiffness matrix and global load vector as appropriate through
the function assemble2D.m.
Once the global stiffness matrix and global load vector are formed, the function applyBC2D.m
is called to apply the boundary conditions to the global stiffness matrix and global load vector.
This function utilizes the penalty method to enforce the boundary conditions
The problem is now all set up and the resulting system of equations is solved and the results
formatted.
The following sections will explain some of the more interesting functions in more detail.
A)
Element Calculations in ELEM routine
The ELEM routine is implemented in the elem2D.m function. The function begins by
specifying the number of integration points and integration weights. Using the function
shape2D.m the shape functions at the integration points are calculated. Once the shape
functions are calculated, the values x, y, dx/d, dx/d, dy/d, and dy/d are found using quad9
elements. Next the Jacobian is calculated at each integration point. The function also
implements an error checking mechanism that checks for a vanishing Jacobian. The coefficients
for the elements are found and then the integration point values are accumulated in the
element stiffness matrix and element load vector. Finally this function returns the element
stiffness matrix and element load vector.
B)
The assembly
The assembly process is implemented in the assemble2D.m function. This function inserts the
entries of the element stiffness matrix and element load vector in the proper locations in the
global stiffness matrix and global load vector. Essentially the function loops through all the
nodal coordinates for the elements and determines which location in the global stiffness matrix
to insert it into. It takes in the global stiffness matrix and global load vector and returns the
updated matrix and vector.
C)
The application of Dirichlet boundary conditions
The Dirichlet boundary condition is applied using the applyBC2D.m function in CODE2. The
Dirichlet boundary condition is imposed onto partial or ordinary differential equations and
specify the value a solution is required to have at the domain boundary. In the function, the
nodes laying on the boundary edge are specified. The function BCdata.m is called to get the
values at the boundaries. The global stiffness matrix and global load vector are then modified
and reassembled to to enforce the Dirichlet boundary conditions
D)
How the domain/mesh enters the code, how to input the mesh, how the coefficients of the PDE
enter the code, how the Dirichlet conditions consistent with a known analytical solution enter
the code
The domain/mesh enters the code through user generated files such as pipe.m and
mesh_pipe.m. The mesh specifically is entered in using mesh_pipe.m by specifying the
coordinates of each node and how the nodes are connected to define elements. The
coefficients of the PDE are found inside the data.m function and enter the code through the
elem2D.m function to calculate the local stiffness matrices and local load vectors. The
Dirichlet boundary conditions enter CODE2 through the BCdata.m function.
Part 2: Modification of the ELEM routine
CODE2 needs to be slightly modified to implement the following PDE:
( ) k u C u Bu f V V + V + =

x y
u u u u
k k C C Bu f
x x y y x y
| | c c c c c c | |
+ + + =
| |
c c c c c c
\ .
\ .

The first step to implement this change is to modify the function file elem2D.m to implement
the parameters necessary for the new PDEs. This change will affect how the code calculates the
element values of the stiffness matrix and load vector In addition the modifications to
elem2D.m, the data.m function needs to be updated to hold the appropriate coefficients
for the new PDEs. In its current state, CODE2 will solve the problems for a pipe or fin. To
perform the patch tests, some new input files and meshes need to be created for simple
rectangles.

You might also like