User:Eml4500.f08.ateam/hw 1

A-Team Teampage

Homework Report #1

This page is intended for Homework Report #1 of the A-Team.

Due date: Friday, 12 September 08, 5 pm EDT = 17:00 EDT (or 21:00 UTC).

Class Overview
EML4500 is an upper level engineering course in the field of Finite Element Analysis and Design. The course, taught by Dr. L. Vu-Quoc at the University of Florida is an overview of the Finite Element Method and its applications. Throughout the course of this semester we will be introduced to the different aspects of the FEM and be applying these to solve different engineering problems. The curriculum will be presented to us through lectures from the professor and homework assignments that will assist in our understanding of the material. To ease in the understanding of the material we will work in small groups that will collaborate on weekly homework reports to be submitted using Wikipedia.

Wiki Homework Reports

As stated previously, we will be using Wikipedia (MediaWiki, WikiVersity,...) to submit our weekly HW reports. Working in small teams, we will be collaborating on the current HW questions and lecture notes to form a weekly HW report. These reports will consist of two parts: the HW problem statement/solution and a summary of that week's lecture notes. For the problem statement and solution we will work with our team to come up with a solution to the problem to the best of our ability and form this into the report. After proof-reading and, if needed, editing each of our team members contribution to the report, our team leader will submit a final copy using our Wiki page. The second half of our weekly reports will consist of a summary of the prevous week's lecture notes. For this section, we will take the lecture notes, rewrite them in our own words and also add any comments or suggestions to clarify and topics that we might not fully understand. In addition to the notes we will also redraw any figures or examples that would assist in our learning of the material.

Pros/Cons of Using Wikipedia

Using Wikipedia to work together and submit our HW reports has its pros and cons. Working in our teams will help our understanding of the material, but also presents some difficulties. This is where using Wiki will help. With this, we will be able to collaborate no matter where we are. As Dr. Vu-Quoc stated, "Even if a group member is in Australia, they will still be able to collaborate with the team." This will be beneficial further in the semester when our schedules keep the entire team from being able to meet in person. As with most good things there is the bad part. For our situation, that problem is the "vandalizing" of Wikipedia pages. Wikipedia is a free online encyclopedia that can be edited by anyone on the internet. This is an issue for us when it comes to submitting our weekly reports. Anyone with malicious intent could go to our page and edit our work to provide incorrect results or even just vandalize it with inappropriate content as seen by an example in class. To counteract this issue, we will be submitting the archived version of our report. Once a page on Wikipedia has been archived, that version can not be changed. The following versions might have been edited, but the archived copy will remain the same.

Trusses, Beams, Frames
Trusses are structural systems consisting of long slender members. The members are arranged so that they are loaded axially and do not experience bending or shear forces. For more information on trusses, please refer to the Truss article on Wikipedia.

Global Picture
Before trusses are analyzed with the Matrix Method or any other method, it is important to develop a standardized system for labeling and drawing the systems. First, the truss system is drawn and the components are labeled. Global nodes are labeled with a number circumscribed in a circle and elements are labeled with a number circumscribed in a triangle.



Global Free Body Diagram
The next step in the process is to draw the global free body diagram (FBD). The global FBD is a diagram of the whole structure that shows the applied forces, as well as the reaction forces. The FBD includes known and reactionary forces represented by arrows. The reaction forces are labeled Rna, where a denotes the direction of the force in reference to the global coordinate system and n represents the global node number. For example, R1X represents the reaction force R applied along the X axis at node 1.



Element Free Body Diagrams
After the global FBD is created, an element FBD must be created. The element FBD is a diagram of each element of the whole structure that includes known, reaction, and internal forces applied to that element. The elemental diagram is labeled with the element number as stated above. Each node of the element is labeled with its global node number as stated above, as well as a local node number that is a number circumscribed in a square. Each internal force of the element is labeled fi(e), where i is the force number and e is the element number. Force numbers are assigned first by local node number and then orientation related to the coordinate system. For example, a force f1(1) is the first degree of freedom (DOF) in element one.



Force-Displacement Relation
The next "big step" in applying the matrix method to a truss problem is to develop a relation between the applied force and the resulting displacement. The deformation of an elastic truss member can be modeled as the deformation of a spring. Therefore, mass-spring relations will be examined.

Spring with One End Constrained
First, consider a one dimensional spring with one end fixed. The force-displacement relation for this system is represented by the equation $$f=kd$$, where f is the force, d is the displacement, and k is the spring constant that it a property of the spring. This relation shows that there is linear relationship between the applied load and the resulting displacement.



Spring with Both Ends Free
Another spring system to consider is a one dimensional spring with both ends free. This system has two degrees of freedom so there is a system of two equations that govern the relationship between the applied force and the resulting displacement. Consider the spring system shown in the figure. Force 1, F1, acts at node 1, causing a displacement, d1 and force 2 acts at node 2, resulting in a displacement d2. The equations of motion for this system are developed for two cases. For the first case, consider an observer sitting on node 1. The resulting equation of motion is $$f_2 = k(d_2-d_1)$$. The second case is when an observer sits on node 2, resulting in the equation $$f_1 = k(d_1-d_2)$$. Therefore, the resulting force-displacement relation for this system is represented by the system of equations below.

$$\begin{bmatrix} F_1 \\ F_2 \\ \end{bmatrix} $$ = $$\begin{bmatrix} k & -k \\ -k & k \\ \end{bmatrix} $$ $$\begin{bmatrix} d_1 \\ d_2 \\ \end{bmatrix} $$



Steps to solve simple truss system described previously
1. Global picture

The global picture consists of a diagram of the entire structure detailing all of the nodes and nodal forces relevant to the problem. A global coordinate system is selected. At the structure level there are two components to be concerned about. These are the global degrees of freedom, or displacement degrees of freedom, and the global forces. Both are divided into known parts and unknown parts. In the previous truss example, the known parts consist of the applied force and the fixed degrees of freedom for nodes 1 and 3. These two nodes are fixed, therefore the degrees of freedom for each is constrained to zero. The unknown part is solved using the Finite Element Method (FEM). FEM is a numerical method used to obtain solutions to ordinary and partial differential equations. In the previous truss system, the reactions forces are unknown.

2. Element picture

An element picture is made of each individual part of the structure. These elements are considered "free" and a free-body diagram with a local coordinate system is made for each. Included in the element picture are both the element degrees of freedom and the element forces. These can be described either in the global coordinate system or the local coordinate system.
 * Element degrees of freedom: $$d_1,\ d_2,\ d_3,\ d_4,$$
 * Element forces: $$f_1,\ f_2,\ f_3,\ f_4$$

3. Global force-displacement relationship

The global force-displacement relationship is shown through matrices. These matrices consist of:
 * Element stiffness matrix in global coordinates ($$k$$) . The dimensions of this matrix are $$n$$ x $$n$$ where $$n$$ is the number of both known and unknown displacement degrees of freedom.
 * Element displacement matrix in global coordinates ( $$d$$) . The dimensions of this matrix are $$n$$ x $$1$$.
 * Element force matrix in global coordinates ($$f$$) . The dimensions of this matrix are $$n$$ x $$1$$.

To assemble the element stiffness matrices, the element displacement matrices, and the element force matrices into global force-displacement relationship matrix multiplication is applied in the form of:


 * $$kd= f$$

This is considered a free-free system where $$k$$ is singular, meaning $$k$$ is not invertible, or $$k^{-1}$$ does not exist.

4. Elimination of known degrees of freedom

In order to make the method more manageable, the global force-displacement relationship is reduced by eliminating the known degrees of freedom. This makes the stiffness matrix non-singular, or invertible. The form is:


 * $$KD= F$$

$$K$$ is the new stiffness matrix with dimensions $$m$$ x $$m$$, where $$m$$ is the number of unknown displacement degrees of freedom. Therefore, $$m$$ < $$n$$. Similarly, $$D$$ is the new displacement matrix with dimensions $$m$$ x $$1$$ and $$F$$ is the new force matrix with dimensions $$m$$ x $$1$$.

To compute the displacement, the equation is rearranged:


 * $$D = K^{-1}F$$

5. Compute element forces

Solving for $$D$$ above, the element stresses can now be determined.

6. Compute reactions

From the element stresses, the reaction forces can be determined.

Example: Truss problem


 Data 

Element length:

L(1) = 4

L(2) = 2

Young's Modulus:

E(1) = 3

E(2) = 5

Cross section area:

A(1) = 1

A(2) = 2

Inclination angle:

θ(1) = 30°

θ(2) = -45°

1. Global picture

Global degrees of freedom: $$d_1,\ d_2,\ d_3,\ d_4,\ d_5,\ d_6$$



n = global node number

Note: When numbering the displacement degrees of freedom, it is useful to follow the order of the global node number. For each individual node, number the displacement degrees of freedom in the order of the global coordinate axes.

Global forces: $$f_1,\ f_2,\ f_3,\ f_4,\ f_5,\ f_6$$



Global force matrix


 * $$\begin{Bmatrix} F_1 \\ F_2 \\ F_3 \\ F_4 \\ F_5 \\ F_6 \end{Bmatrix}$$

Global stiffness matrix


 * $$\begin{bmatrix}

K_{11}&\cdots&\cdots&\cdots&\cdots&\cdots \\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots \\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots \\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots \\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots \\ \cdots&\cdots&\cdots&\cdots&\cdots&K_{66} \\ \end{bmatrix} $$

Global displacement matrix


 * $$\begin{Bmatrix} d_1 \\ d_2 \\ d_3 \\ d_4 \\ d_5 \\ d_6 \end{Bmatrix}$$

To solve for the unknowns, the matrices are arranged according to the equation above.


 * $$\begin{Bmatrix} F_1 \\ F_2 \\ F_3 \\ F_4 \\ F_5 \\ F_6 \end{Bmatrix} = \begin{bmatrix}

K_{11}&\cdots&\cdots&\cdots&\cdots&\cdots \\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots \\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots \\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots \\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots \\ \cdots&\cdots&\cdots&\cdots&\cdots&K_{66} \\ \end{bmatrix} \begin{Bmatrix} d_1 \\ d_2 \\ d_3 \\ d_4 \\ d_5 \\ d_6 \end{Bmatrix}$$

Matlab Tutorial
Matlab Primer, University of Florida, 3rd Edition by Kermit Sigmon



MatLab is developed by the MathWorks Company. Below is their link for further information outside the scope of this document.

http://www.mathworks.com/

About MatLab
MatLab is a matrix-based enginering computation program that is user-interactive. By using matrices to enter and solve complex equations, MatLab can do in a fraction of the time it would take older programming languages to do. When dealing with finite element analysis, depending on the number of nodes, there can be numerous partial differential equations that need to be solved.

Starting Matlab
MatLab can be started 2 ways. The first is using the command window and typing run/matlab. The second is through the start menu >> programs >> matlab.

Matrices
MatLab works solely with matrices to handle all computations. These matrices can range in size from 1 by 1 all the way up to thousands of elements. Entering a matrix into matlab is easy and is done with the following notation: A = [1 2 3; 4 5 6; 7 8 9] This creates a 3 by 3 matrix with the values shown and a new row started after each semi-colon. Additionally, matrices do not have to be entered with just real numbers. Complex numbers (i) can also be entered into matrices. For example: A = [1+3i; 2-4i; 3]

When it comes to large matrices, it may be very time consuming to enter in all the matrix values by hand. In such a case, the values can be read in from an ASCII file. As long as the file has a rectangular matrix in it, simply type: >> load numbers.ext This will load the matrix in the file numbers into the workspace.

Matrix Operations:
MatLab uses the same basic mathematical operators plus a few additional ones. Below are the operators: * + addition * - subtraction * * muntiplication * / right division * \ left division * ^ power * ` conjugate The left division operator is special in that it allows for division of matrices that are not square. If you use the right division operator, MatLab will give an error saying that the matrices are not square.

Statements, Expressions, and Variables
Matlab is an expression language meaning the user types an expression, usually composed of variables, functions, and operators, and Matlab interprets it and performs the expression. After the expression is evaluated, the output is put into a matrix. If no matrix name is specified by the user, matlab puts the result in a matrix called ans. Normally after each expression is evaluated, Matlab outputs the result of the expression. To supress(hold) the output, put a semi-colon at the end of the expression. Variables can have virtually any name you choose, as long as it is not a reserved variable or function name. Matlab is case sensitive but has no restriction on variable name length. Some Helpful Commands: * whos - displays a list of variables currently in the workspace Also, there are come commands that can be used to help the user build matrices Matrix Building Commands: * eye - identity matrix * zeros - matrix of zeros * ones - matrix of ones Each of the commands needs to be followed by the following notation: (# of rows, # on columns) Example: zeros(3,3) yeilds a square 3 by 3 matrix of zeros.

Loops
Loops are used to repeat a series of operations until a certain condition is met. Below are the two types of loops that are used frequently in Matlab.

For
For loops execute continually once a condition is met up until the condition is no longer met.

function problem_1_37

% This function will plot 3 conditional functions

dx = 0.1; x = [-2:dx:6]; for k = 1:length(x) if x(k) >= 5 y(k) = 10*(x(k)-5) + 1; elseif x(k) >= -1 y(k) = 2 + cos(pi*x(k)); else y(k) = exp(x(k)+1); end end

plot(x,y), xlabel('Time x (seconds)'), ylabel('Height y (kilometers)')

While
While loops are similar to for loops except for while loops are guaranteed to execute at least once. It will execute the statement, then check it against the while statement. If it is true, it will run back through the loop. If it is false, it will exit the loop.

function e = macheps

% This function determines the smallest number that can be added to 1 in % Matlab and still get a number greater than 1.

e = 1; while (1+e >1) e = (e/2); end

e = e*2;

'''In addition to loops, one can have an operation performed only IF a condition is met. That type of operator is an if statement. Below is an example of an IF statement.'''

function y = problem_1_36(x) % This function will check conditional statements to evaluate a function given different input values. if x >= 5 y = 10*(x-5)+1; elseif x >= -1 y = 2+cos(pi*x); else y = exp(x+1); end

NOTE: All code was taken from previous homework assignments in Numerical Methods

Relations
The relational operators are used to compare the value of a variable to another variable or to a constant value. Below are some common relational operators: * == equal * ~= not equal * < less than * > greater than * >= greater than or equal to    * <= less than or equal to     * & and * | or    * ~ not

Relational operators are always used in for, while,and if statements to see when to execute, or stop executing expressions within the loop.

Scalar Functions
Certain matlab functions operate on scalar numbers and when applied to a matrix, they act on 1 matrix element at a time. Some scalar Matlab functions are listed below: sin, cos, tan, asin, acos, atan exp, log, rem, abs, sqrt, sin, round, floor, ceil

Vector Functions
Vector functions act on a vector matrix column by column to produce a row matrix as the solution. These functions can only be used when the matrix is larger than 1 by 1. Below are some examples of vector functions: max, min, sort, sum, prod, median, mean, std, any, all

Command Line Editing
The command line in Matlab is denoted by 2 arrows (>>). The command line is the line that the user uses to type in commands. To keep the user from having to re-enter previously used commands, Matlab allows the user to scroll through the old commands used during the session by hitting the up-arrow and down-arrow keys.

Also, it is important to remember that instead of entering a series of commands by hand every time, create an m-file to execute. This will save loads of time and needless typing.

M-Files
M-files are special Matlab files that have a .m extension. These files contain a series of statements that can be exectued at one time, thus saving the user time from having to exectue expressions 1 at a time. There are two types of m-files, script files and function files.

Script files contain a series of normal Matlab scripts. They are traditionally used to enter large amounts of data into matrices. Any variable or matrix is global, meaning the parameter can be used in any other portion of the workspace.

Function files are a type of m-file that allow users to essentially create new Matlab functions. The functions can be specific to a particuar problem that the user is working on.

Text Strings
You can assign text strings to variables by using single quotes around the text to be entered into the variable. Additionally, text can be displayed to the screen using the disp function. The error function also outputs a message to the screen but also aborts the code in an m-file when it is executed. Below are examples of the 2 functions: disp('Hello World') error('Warning!!!')

Managing M-files
The !-feature allows for editing or printing to be done without having to exit MATLAB. Using the command !ed will let the named file be edited and then returned to MATLAB where you left off. Many commands control the working directory. Pwd returns the name of the present working directory. Cd changes the working directory. Dir or ls lists the contents of the working directory, but what lists only the M-files. Files named matlab are accessible from any directory. M-files have to be in a directory MATLAB can excess.

Comparing efficiency of an algorithms: flops, tic and toc
The efficiency of an algorithm can be measured by the number of floating point operations (flops) performed and the elapsed time. The total number of flops performed is kept track of by the function flops. This number can be reset by the command flops(0). Tic and toc are stopwatch times that can return the elapsed time. Tic starts the timer and toc returns the elapsed time.

Output format
The output on display is controlled by a variety of format commands, but the computations are done in double precision. Format compact suppresses most of the blank lines so more information can be added on the screen, while format loose returns the display back.

Hardcopy
The diary command causes the next code written to be written on the name diskfile until the command diary off is given. After this is done the file can be edited and printed on the local system.

Graphics
MATLAB can create planar plots of curves, 3-D plots of curves, 3-D mesh surface plots, and 3-D faceted surface plots.

Planar plots
The command plot produces a liner x-y plot. Plot(x,y) will draw an x-y plot if the vectors x and y are the same length. There can be many different graphic figures, but only one at a time will be call “current.” The command figure(1) will make figure 1 the current figure if it was not before, and gcf will return the number of which figure is current. An example of a linear x-y plot is shown below.


 * x = -1.5:.01:1.5; y = exp(-x.^2); plot(x,y)

Fplot is used to plot the graph of a function. Plots can be made of parametrically defined curves as well.


 * t=0:.001:2*pi; x=cos(3*t); y=sin(2*t); plotx,y)

All graphs can be given titles, labeled axes, and text within the graph.


 * Title: graph title


 * xlabel: x-axis label


 * ylabel: y-axis label


 * gtext: place text on graph using mouse


 * text: place text at specified coordinates

Axes are auto-scaled, but this can be overwritten with the command axis. This command should always be given after the plot command. Multiple plots can also be displayed on a single graph.


 * x = 0: .01:2*pi; y1 = sin(x); y2 = sin(2*x); y3 = sin(4*x); plot(x,y1,x,y2,x,y3)

This can also be done with the hold command. It freezes the current on screen graphics so other plots can be put on the same graph, but the axes may become rescaled. Colors and line types can be added to a plot as well. The code plot(x,y,’r--‘) shows a red dashed line.

Graphics hardcopy
The command print is the easiest way to send a high-resolution copy of the current graphics figure to the default printer. The printopt M-file identifies the default setting used by the print command. Print filename saves the figure to the filename given in the default format. If there is no extension in the filename then the default file format will be assigned. A file will be overwritten if the filename already exists. The option –append will append the current graphics figure into the existing file so more than one figure can be saved in each file. The command code is print –append filename. This command can be overwritten with the option –f3.

3-D line plots
Plot3 makes a curve in three dimensions. If x, y, and z are defined vectors of the same size, then plot3(x,y,z) will create a 3-D curve passing through the coordinates of the respective elements. A zlabel can still be added to this plot. The helix shown below was created using the code:


 * t = .01: .01:20*pi; x = cos(t); y = sin(t); z = t.^3; plot3(x,y,z)

3-D mesh and surface plots
A three dimensional wire mesh surface plot with the elements of matrix z is created with the command mesh(z). The function meshgrid allows for a graph to be drawn over a rectangle by allowing matrices to be created. Surface plots are created using surf(z).

z=e-x^2-y^2 can be drawn over the square [-2,2]x[-2,2] with the following codes:
 * xx = -2: .2:2;


 * yy = xx;


 * [x,y] = meshgrid(xx,yy);


 * z = exp(-x.^2 – y.^2);


 * mesh(z)

Surf(z) of the same code is shown as well.

There are three different settings for the color shading of surfaces: faceted, interpolated, and flat. The command shading should be done after the surf command. Different color profiles can be produced by the command colormap.

Handle Graphics
MATLAB contains many different graphic functions. The user is able to control almost all of the graphics allowing for detailed plots to be made.

Sparse Matrix Computations
MATLAB provides the ability to save storage space, so larger problems can be solved, by only storing the nonzero elements of the matrix. Matlab has the storage mode full, the default, and sparse. The sparse matrix is stored as a linear array of its nonzero elements. The output of a matrix in sparse mode is a list of nonzero entries and their row and column indices. A matrix is sparse if any constituent block is sparse.

Contributing Team Members
The following students contributed to this report:

Daniel DiDomenico Eml4500.f08.ateam.didomenico 20:13, 16 September 2008 (UTC)

Matthew Philbin Eml4500.f08.Ateam.philbin 24:37, 16 September 2008 (UTC)

Mark Barry Eml4500.f08.Ateam.barry 18:23, 18 September 2008 (UTC)

Sean Miller EML4500.f08.Ateam.Miller 18:43, 18 September 2008 (UTC)

Jil Paquette --Eml4500.f08.Ateam.paquette 00:12, 19 September 2008 (UTC)

Ian Slevinski Eml4500.f08.Ateam.Slevinski  00:53, 19 September 2008 (UTC)