User:Eml4500.f08.wiki1.ambrosio/hw2

Notes 9/8
HW1 left off with the description of elements as springs and explained the 6 steps of the FEM process.

In order to continue on with the FEM process and develop the element stiffness matrix, an understanding of director cosines must exits. The director cosines of the $$\tilde{x}$$ axis with respect to the global ($$ \ x $$,$$ \ y $$) coordinates are derived below from the figure below.





\ l^{(e)} =  \cos \theta^{(e)} $$



\ m^{(e)} =  \cos (90^{o} - \theta^{(e)}) $$



\ m^{(e)} =  \sin \theta^{(e)} $$

A further proof is presented below to show the relationship of the director cosines.


 * $$ \bar{\tilde{i}} = \cos \theta^{(e)} \bar{i} + \sin \theta^{(e)} \bar{j}  $$



\begin{array}{lcl} \begin{align} \bar{\tilde{i}} \cdot \bar{i} & = (\cos \theta^{(e)} \bar{i} + \sin \theta^{(e)} \bar{j}) \cdot \bar{i} \\ & = \cos \theta^{(e)} \bar{i} \cdot \bar{i} + \sin \theta^{(e)} \bar{j} \cdot \bar{i} \\ & = \cos \theta^{(e)} (1) + \sin \theta^{(e)} (0)\\ & = \cos \theta^{(e)} \end{align} \\ l^{(e)} =  \cos \theta^{(e)} \end{array} $$



\begin{array}{lcl} \begin{align} \bar{\tilde{i}} \cdot \bar{j} & = (\cos \theta^{(e)} \bar{i} + \sin \theta^{(e)} \bar{j}) \cdot \bar{j} \\ & = \cos \theta^{(e)} \bar{i} \cdot \bar{j} + \sin \theta^{(e)} \bar{j} \cdot \bar{j} \\ & = \cos \theta^{(e)} (0) + \sin \theta^{(e)} (1)\\ & = \sin \theta^{(e)} \end{align} \\ m^{(e)} =  \sin \theta^{(e)} \end{array} $$

In order to describe the global force displacement at the element level, the k(e) matrix must first be determined. The k(e) matrix for a 4x4 matrix is defined below.



\mathbf{k} ^{(e)} = k^{(e)} \begin{bmatrix} (l^{(e)})^2    & l^{(e)}m^{(e)}  & -(l^{(e)})^2    & -l^{(e)}m^{(e)}  \\ l^{(e)}m^{(e)} & (m^{(e)})^2     & -l^{(e)}m^{(e)} & -(m^{(e)})^2  \\

-(l^{(e)})^2   & -l^{(e)}m^{(e)} & (l^{(e)})^2     & l^{(e)}m^{(e)}  \\ -l^{(e)}m^{(e)} & -(m^{(e)})^2   & l^{(e)}m^{(e)}  & (m^{(e)})^2 \end{bmatrix} $$

Where


 * $$ k^{(e)} =

\frac{E^{(e)} A^{(e)}} {L^{(e)}} $$

And


 * $$ \mathbf{k}^{(e)} \mathbf{d}^{(e)} = \mathbf{f}^{(e)} $$

m-file
% Two bar truss example clear all; e = [3 5]; A = [1 2]; P = 7; L=[4 2]; alpha = pi/3; beta = pi/4;

nodes = [0, 0; L(1)*cos(pi/2-alpha), L(1)*sin(pi/2-alpha); L(1)*cos(pi/2-alpha)+L(2)*sin(beta),L(1)*sin(pi/2-alpha)-L(2)*cos(beta)];

dof=2*length(nodes);

conn=[1,2; 2,3]; lmm = [1, 2, 3, 4; 3, 4, 5, 6]; elems=size(lmm,1); K=zeros(dof); R = zeros(dof,1); debc = [1, 2, 5, 6]; ebcVals = zeros(length(debc),1);

%load vector R = zeros(dof,1); R(4) = P;

% Assemble global stiffness matrix K=zeros(dof); for i=1:elems lm=lmm(i,:); con=conn(i,:); k_local=e(i)*A(i)/L(i)*[1 -1; -1 1] k=PlaneTrussElement(e(i), A(i), nodes(con,:)) K(lm, lm) = K(lm, lm) + k; end K R % Nodal solution and reactions [d, reactions] = NodalSoln(K, R, debc, ebcVals) results=[]; for i=1:elems results = [results; PlaneTrussResults(e, A, ...           nodes(conn(i,:),:), d(lmm(i,:)))]; end format short g

Results
k_local =

0.75       -0.75        -0.75         0.75

k =

0.5625     0.32476      -0.5625     -0.32476      0.32476       0.1875     -0.32476      -0.1875      -0.5625     -0.32476       0.5625      0.32476     -0.32476      -0.1875      0.32476       0.1875

k_local =

5   -5    -5     5

k =

2.5        -2.5         -2.5          2.5         -2.5          2.5          2.5         -2.5         -2.5          2.5          2.5         -2.5          2.5         -2.5         -2.5          2.5

K =

0.5625     0.32476      -0.5625     -0.32476            0            0      0.32476       0.1875     -0.32476      -0.1875            0            0      -0.5625     -0.32476       3.0625      -2.1752         -2.5          2.5     -0.32476      -0.1875      -2.1752       2.6875          2.5         -2.5            0            0         -2.5          2.5          2.5         -2.5            0            0          2.5         -2.5         -2.5          2.5

R =

0    0     0     7     0     0

d =

0           0        4.352       6.1271            0            0

reactions =

-4.4378     -2.5622       4.4378      -4.4378

results =

1.7081      5.1244       8.5406       5.1244       17.081       0.6276       1.8828        3.138       1.8828        6.276