CE595 HW1 Spr2013
CE595 HW1 Spr2013
CE595 HW1 Spr2013
v
e) Verify your result in part (d) above using the divergence theorem and a surface integral
(Equation (91) in Hjelmstads textbook).
Spring 2013
CE 595: Finite Elements in Elasticity
3
Problem 4: (5 points)
MATLAB Introduction: If you do not have experience with MATLAB, please refer to page 5.
Finite element programs usually read input data from a text file
(similar to the provided text files SquarePlatePlotting.txt,
and FE2DBeam0160plotting.txt) which contain the locations
of discrete points (called nodes) and information on how the nodes
are connected to each other to form elements. This collection of nodes
and elements is called a mesh. The underlying structure of the input
file SquarePlatePlotting.txt is shown on the right. The last
two lines in these input files are inline MATLAB functions handles
that describe the 2D displacement field (u
x
(x,y), u
y
(x,y)) for the given
mesh.
In this problem you will be required to write a MATLAB program to read general input files like the ones
provided, compute the deformed shape of the mesh, compute the strains resulting from that deformation
and then plot the strains. To accomplish these tasks, do the following steps:
a) Download and study the MATLAB file TwoDFEgetinputplot.m. Complete this MATLAB
file to read the element connectivities from any general input file into the variable elems which
should contain the same information as that provided in the sample input files. You may test if
your function is finally working or not by calling it from the command window as:
>> [xylocations, elems, Ux, Uy] = TwoDFEgetinputplot('SquarePlatePlotting.txt')
b) Once you have the input function coded correctly, download and study the MATLAB file
TwoDFEplotting.m. Run this file to check if your code plots both the provided input file(s).
c) Complete the TwoDFEplotting.m file (by writing your code below the specified line in the
file) to compute the new deformed locations of all the nodes using the displacement field
provided in the input files. Hint: For a node with coordinates (a,b), you can execute the following
commands on the command window to compute its displacement:
>> Ux(a,b)
>> Uy(a,b)
d) In addition to the new locations, write MATLAB code to calculate the linearized strain tensor
( )
1
2
T
= + u u using the given displacement field in the input files, for all the nodes of the
mesh. ote: You should use approximate finite differences to calculate the derivatives inu .
For example one of the components of u is:
( , ) ( , )
x x x
u u X X Y u X Y
X X
+
e) Use the patch() command to plot the 3 strain components (
xx
,
yy
, and
xy
) on the deformed
mesh for the input file SquarePlatePlotting.txt as shown on page 4.
f) Note that the given displacement field in the FE2DBeam0160plotting.txt file is 0.
Change the last two lines of this input file to specify the displacement field (u,v) given in the
textbook by Zienkiewicz & Taylor, Volume 1, Chapter 2, pages 40-41, Example 2.3.
Plot the strain components same as part (e) for this file.
ote:
You are OT permitted to change anything outside this designated area of the .m files, especially the
structure of the function input-output variables.
Submit online on Blackboard along with your pdf-file: your MATLAB codes (as .m files) and both
the input files (required to run your codes).
Your pdf-file must also include your output from parts (e) and (f) above.
Spring 2013
CE 595: Finite Elements in Elasticity
4
Sample output from the two given input files:
Spring 2013
CE 595: Finite Elements in Elasticity
5
MATLAB Guidelines
If you do not have experience with MATLAB, follow these steps:
1. Use Purdues Software Remote or go to an ECN/iTaP lab (CIVL 1212) and open MATLAB.
2. On the top menu bar select Help -> Product Help.
3. In the new Help Window that opens up, there is a lot of information that you may not need
immediately. In the left column, under Contents, expand the MATLAB link by clicking on the
+ sign to the left of the MATLAB link and go through the Getting Started section.
These are some of the most basic and most important functionalities of MATLAB. You should also
search in MATLAB Help directly for new commands as you encounter them.
Basic Tutorial:
For a basic tutorial on MATLAB look at the posted notes Intro2MATLAB.pdf or search the web for a
quick tutorial.
In particular for HW-1, look at chapters 6 and 7 from the Intro2MATLAB.pdf MATLAB notes for
information on MATLAB functions and File Input/Output.
MATLAB Debugger:
This is a very useful tool integrated with the MATLAB editor that helps you find errors in your code and
follow the execution of your code line by line. You can place a breakpoint (by clicking on the - next
to the line number in MATLAB editor) at an executable line in any .m file (for example line 5 in
hw1p3sol.m). Now, when you run this file, MATLAB freezes execution at this line and returns the
control to you. At this point you can check all your variables in the Workspace window and run
commands as you normally would. To proceed from a breakpoint you may press F10 (step) or F11 (step-
in) to follow your code line by line or press F5 to continue execution till the next breakpoint (if any).