TMHL62.
Computer Task 2 Last updated February 8, 2023
Computer Task 2 – Implementation of the method
In this task you will implement and test code for element stiffness and stress calcula-
tions for the isoparametric Quad8 element for 2D, plane-stress elasticity in MATLAB.
Code templates together with routines for mesh generation, shape functions and so
on can be downloaded from Lisam. The codes are extensively commented, so please
read the comments carefully in order to understand what happens and what you need
to do.
A ”groupnumber” is used to generate unique data for each student, and is obtained
by signing up on a list in Lisam.
Computer Task 2 consists of three subtasks:
Subtask 1. Implement a routine for computing the element stiffness matrix of an
iso-parametric Quad8 element called KeQ8.m. An empty code starting with
function Ke = KeQ8(xy,D,t)
is provided. Here xy is an 8×2 array containing the x- and y-coordinates of the nodes,
D is the constitutive matrix and t is the thickness. Use the code main subtask 1.m
for developing and testing your code. See comments therein for further instructions.
The code obtained from element check.m should be stated in your report together
with your group number.
Subtask 2. a) Use your code from subtask 1 to solve the cantilever beam problem
illustrated below. The template script main subtask 2.m should be used as a starting
Figure 1: A long slender structure modelled as a beam or as
a membrane. A load with total magnitude F [N] is applied on
the free end.
point for your work. Compare the displacement with an analytical solution from
elementary beam theory assuming a rectangular cross-section and with the length set
to L = 4 + 0.05 · groupnumber [m].
b) Write a code for calculating the stress vector σ at an arbitrary point (ξ, η) in
an element and use it to compute the (nodally averaged) von Mises stress in the
cantilever beam.
1
TMHL62. Computer Task 2 Last updated February 8, 2023
Subtask 3. The figure below shows a curved domain Ω with inner radius ri
and outer radius ro loaded by an in-plane body load b = b(x, y). The displacement
u = (u(x, y), v(x, y))T is prescribed to 0 on the boundary Γ. Consider the stationary
Figure 2: Curved domain Ω with boundary Γ.
plane-stress, isotropic linear elasticity problem
divσ(u) + b = 0 in Ω
u = 0, on Γ.
Based on this problem, we construct a related problem with an analytical solution by
choosing a displacement, call it uMMS such that uMMS = 0 on Γ and computing the
corresponding body load as bMMS = −divσ(uMMS ). The displacement uMMS is now
the1 analytical solution to the problem
divσ(u) + bMMS = 0 in Ω
u = 0, on Γ,
and we can use this to verify our finite element method by comparing our FE-solution
to this problem with the manufactured solution uMMS . This technique for construct-
ing analytical solutions is known as the Method of Manufactured Solutions, hence the
subscript MMS.
Your task is to, based on the script main subtask 3.m where a constructed solu-
tion is given and the corresponding body load computed using symbolic calculations,
finish the implementation of the mapping technique to mesh the domain, incorporate
1
We write the analytical solution, because with boundary conditions that prevent rigid body
motion, the stationary linear elasticity problem has a unique solution.
2
TMHL62. Computer Task 2 Last updated February 8, 2023
your own element stiffness matrix and stress routines from subtasks 1 and 2. Then
make a comparison between the analytical and the FE displacements. In addition
you should provide a plot of the FE (von Mises) stress field.
3
TMHL62. Computer Task 2 Last updated February 8, 2023
Report
The written report must contain the following parts:
- Theoretical description of stiffness matrix and stress calculations with all entities
carefully defined.
- Flow charts for the stiffness matrix calculations.
- Displacement and stress plots.
- Comparisons with analytical solutions.
- Program listing. You should only include the .m-files in which you have made
additions and/or modifications.