fea assignment - lucas dos santos almeida p13175018

22
Faculty of Technology Department of Mechanical Engineering DE MONTFORT UNIVERSITY Module: ENGD 3016 Student: Lucas dos Santos Almeida P-number: 13175018 Course: Mechanical Engineering Lecturer: Warren Manning 2014

Upload: lucas-almeida

Post on 21-Dec-2015

6 views

Category:

Documents


6 download

DESCRIPTION

FEA Assignment, teaching how to use Autodesk algor and pro engineer

TRANSCRIPT

Page 1: FEA Assignment - Lucas Dos Santos Almeida p13175018

Faculty of Technology

Department of Mechanical Engineering

DE MONTFORT UNIVERSITY

Module: ENGD 3016

Student: Lucas dos Santos Almeida

P-number: 13175018

Course: Mechanical Engineering

Lecturer: Warren Manning

2014

Page 2: FEA Assignment - Lucas Dos Santos Almeida p13175018

Contents

Contents............................................................................................................................2

Matlab CODE..................................................................................................................3

Results...............................................................................................................................7

Square cross-sectional area results......................................................................10

Circular cross-sectional area results....................................................................12

Discussion and conclusion.............................................................................................14

Appendix........................................................................................................................15

Matrix analysis of a truss.............................................................................................15

References......................................................................................................................19

2

Page 3: FEA Assignment - Lucas Dos Santos Almeida p13175018

Matlab CODE

The following code was developed in order to solve the truss problem. The mode how

the data is entered is well explained in appendix. The appendix (partially presented) and

the program were developed by me as a course monitor in Brazil to aid a professor in

the lecture of FEA in Solid Mechanics II. It was only necessary to modify the entering

data as the program calculates for every truss if the data is correctly entered.

clear allclc num_nos = 3;coord = [0 0;0 .3;.4 0];num_elem = 3;incid = [1 2;1 3;2 3];mat = [200E9];num_load = 1;load = [3 2 -5000];prop_geo = [1.11E-4];num_restr = 3;restr = [1 1; 2 1; 2 2];counter = 1; Kglobal = zeros(num_nos*2);for n=1:num_elem incidz = incid(n,:); % Gets the incidence of element n % Gets the coordinate of the element nodes 1 Co1 = coord(incidz(1),:); Co2 = coord(incidz(2),:); % Calculate the length of the bar by the Pythagorean relationship. L = sqrt((Co2(1)-Co1(1))^2+(Co2(2)-Co1(2))^2); % calculates the cosine and sine bars. s = (Co2(2) - Co1(2))/L; c = (Co2(1) - Co1(1))/L; c2 = c^2; s2 = s^2; cs = c*s; % Calculate the element stiffness matrix n% mat (1) refers to the Young's modulus, prop_geo (1) the cross-sectional area. Ke = mat(1)*prop_geo/L*[c2 cs -c2 -cs; cs s2 -cs -s2; -c2 -cs c2 cs; -cs -s2 cs s2]; % Gets the Degrees of Freedom for the element. To find the degree of% freedom for each element was used the node logic * 2 Y and node * 2-1

3

Page 4: FEA Assignment - Lucas Dos Santos Almeida p13175018

% X DOF = [incidz(1)*2-1 incidz(1)*2 incidz(2)*2-1 incidz(2)*2]; % Algorithm to add the element stiffness matrix in the global matrix for n=1:4 for m=1:4 Kglobal(DOF(m),DOF(n)) = Kglobal(DOF(m),DOF(n)) + Ke(m,n); end end end Kglobal1 = Kglobal; %verifica onde os deslocamentos são iguais a zero, e os guarda no %vetor constrDOFfor n=1:num_restr if restr(n,2) == 1 constrDOF(n)=restr(n,1)*2-1; end if restr(n,2) == 2 constrDOF(n)=restr(n,1)*2; end end constrDOF = constrDOF'; %Elimina as constrDOFs e colunas onde os deslocamentos são iguais a zero,%obtidos no vetor constrDOF.Kglobal1(constrDOF,:) = [];Kglobal1(:,constrDOF) = []; Load = zeros(num_nos*2,1);% Allocate the forces in the load vector according to your DOFfor n=1:num_load if load(n,2) == 1 Load(load(n,1)*2-1) = load(n,3); end if load(n,2) == 2 Load(load(n,1)*2) = load(n,3); endendLoad;% excludes constrDOFs in which we have the Load Vector support reactions.Load(constrDOF,:) = []; U = Kglobal1\Load;% Set a counter to be used in the next loop.j=1;n=1;% adds the offsets equal to zeros missing from the vector displacement%% Initially the vector U just have different load of zero.% It creates an auxiliary variable U1.

4

Page 5: FEA Assignment - Lucas Dos Santos Almeida p13175018

for i=1:(num_nos*2+1) if j<(num_restr+1) j~=(num_restr); if i== constrDOF(j) U1(i)=0; j = j+1; else U1(i)=U(n); n=n+1; end end if j>=(num_restr+1) && n~=(num_nos*2-num_restr+1); U1(i+1)=U(n); n=n+1; endendU=U1'; % Calculate the overall loading vector for the simple multiplication% global matrix with the vector global displacementFRg = Kglobal*U; % Calculate the overall loading vector for the simple multiplication% repeat operations to find out the bar L to calculate% strains and stressesfor n=1:num_elem incidz = incid(n,:); Co1 = coord(incidz(1),:); Co2 = coord(incidz(2),:); L = sqrt((Co2(1)-Co1(1))^2+(Co2(2)-Co1(2))^2); s = (Co2(2) - Co1(2))/L; c = (Co2(1) - Co1(1))/L; % strain is calculated using the equation given in the literature.% U (incidz (1) * 2-1) and U (incidz (1) * 2) return the% respective deformations of degrees of freedom of each element Strain(n) = (1/L)*[-c -s c s]*[U(incidz(1)*2-1) U(incidz(1)*2) U(incidz(2)*2-1) U(incidz(2)*2)]'; end Strain = Strain';% To calculate the normal stress simply multiplies the Young's modulus% by deformationStress = Strain*mat(1); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Solver END%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% DOFs numberingNodalDOFNumbers = zeros(num_nos,3);

5

Page 6: FEA Assignment - Lucas Dos Santos Almeida p13175018

for n=1:num_nos NodalDOFNumbers(n,1) = n; NodalDOFNumbers(n,2) = 2*n-1; NodalDOFNumbers(n,3) = 2*n;end %% Numbers of free and restricted dofsTotalNumFreeDOFs = num_nos*2 - num_restr;TotalNumRestrDOFs = num_restr; %% Post-processingdisp('==================================================================');fprintf(1,'Generated output file ResultsAssignment.out\n');disp('=================================================================='); %% Output fileOutFileName = sprintf('ResultsAssignment.out');OutFile = fopen(OutFileName, 'w'); fprintf(OutFile, '*Displacements\n%6d\n', num_nos);for i = 1 : num_nos displa = [U(NodalDOFNumbers(i,[2 3]))' 0]; fprintf(OutFile, '%5d %6.4e %6.4e %6.4e\n', i, displa); end fprintf(OutFile, '\n*Reactions\n%5d\n', TotalNumRestrDOFs);for i = 1 : TotalNumRestrDOFs ElemEqs = NodalDOFNumbers(restr(i, 1),restr(i, 2)+1); if restr(i, 2) == 1 fprintf(OutFile, '%5d RX = %e\n', restr(i, 1), FRg(ElemEqs)); end if restr(i, 2) == 2 fprintf(OutFile, '%5d RY = %e\n', restr(i, 1), FRg(ElemEqs)); end end fprintf(OutFile, '\n*Element strain\n%6d\n', num_elem);for i = 1 : num_elem fprintf(OutFile, '%5d %e\n', i, Strain(i));end fprintf(OutFile, '\n*Element stress\n%6d\n', num_elem);for i = 1 : num_elem fprintf(OutFile, '%5d %e\n', i, Stress(i));

6

Page 7: FEA Assignment - Lucas Dos Santos Almeida p13175018

end fclose(OutFile); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Results

The results shown in the ResultsAssignment.out file is as it shows:

*Displacements (m) 3 1 0.0000e+000 0.0000e+000 0.0000e+000 2 0.0000e+000 0.0000e+000 0.0000e+000 3 -1.2012e-004 -4.7297e-004 0.0000e+000 *Reactions (N) 3 1 RX = 6.666667e+003 2 RX = -6.666667e+003 2 RY = 5.000000e+003 *Element strain 3 1 0.000000e+000 2 -3.003003e-004 3 3.753754e-004 *Element stress (Pa) 3 1 0.000000e+000 2 -6.006006e+007 3 7.507508e+007

The results obtained via CREO is shown below. Me and some friends simulated the

truss in DMU. So they are the same images;

7

Page 8: FEA Assignment - Lucas Dos Santos Almeida p13175018

Figure: Structure

Figure: Constraints definition

8

Page 9: FEA Assignment - Lucas Dos Santos Almeida p13175018

Figure: Square beam section definition* Figure: Circular beam section definition*

Figure: Material definition*

*values shown in the images are just representative, the values used were:

9

Page 10: FEA Assignment - Lucas Dos Santos Almeida p13175018

a=10.54mm, R=5.94mm and E=200GPa.

Square cross-sectional area results

Figure: Displacement in X

Figure: Displacement in Y

10

Page 11: FEA Assignment - Lucas Dos Santos Almeida p13175018

Figure: Reactions in X

Figure: Reactions in Y

11

Page 12: FEA Assignment - Lucas Dos Santos Almeida p13175018

Figure: Stress results

Circular cross-sectional area results

Figure: Displacement in X

12

Page 13: FEA Assignment - Lucas Dos Santos Almeida p13175018

Figure: Displacement in Y

Figure: Reactions in X

13

Page 14: FEA Assignment - Lucas Dos Santos Almeida p13175018

Figure: Reactions in Y

Figure: Stress results

Discussion and conclusion

After all the calculation done by the programs MATLAB and CREO, it is no

time for discussion. The results generated by both programs indicate a good

convergence. The difference is mainly explained by the considerations taken by the

methods of calculations. MATLAB program uses the matrix analysis of a truss using

14

Page 15: FEA Assignment - Lucas Dos Santos Almeida p13175018

only bars. This means that this program does not considerate bending. On the other

hand, CREO uses beams as elements to simulate. It is possible to observe that CREO

simulation produces different results when using different cross-section areas. Note that

in the MATLAB algorithm the shape of cross-section area isn’t even taken in

consideration; It only gets the value of the area to do the calculation. The simulation of

the same truss was carried with ALGOR simulate and produced EXACLTY the same

results obtained in the calculation by the MATLAB algorithm. This is explained by the

fact that ALGOR uses the same calculation process as MATLAB.

Appendix

Matrix analysis of a truss

The model of the following input variables is just a suggestion. Set the following

variables beforehand can help when writing the program.

example:

data:

E1 = E2 = E3 = 200x103 MPa, P = 1000N

The areas of horizontal and vertical bars is 1mm2 area while the inclined 1,414 mm2.

The lengths in the figure are in millimeters;

15

Page 16: FEA Assignment - Lucas Dos Santos Almeida p13175018

 

Figure 1: Truss

We can define the beginning, the number of nodes of the truss and number of elements.

For this case:

 

  Figure 2: Nodes and defined elements.

The red numbers indicate the element and black indicate the node.

Num_nodes = 4;

Then define the coordinates of us and put in a matrix.

coord =

16

Page 17: FEA Assignment - Lucas Dos Santos Almeida p13175018

    1 0 0

    2 0 21

    3 21 0

    4 21 21

The first column represents the node, the second and third represent the coordinates x

and y.

We now define the elements. In this example are 6 bars.

Num_elem = 6;

You must set the cost of each element, that is, tell the program where they are situated.

For example, the element 1 is connected at node 1 and node 2, while the element 3 is

connected node 3 and node 4. The first column represents the number of the element.

INCID =

      1 1 2

      1 2 3

      3 3 4

      4 2 4

      5 2 3

      6 1 4

     

It is necessary to define the geometric properties of the materials and the bars. As the 6

bars have the same material, will be a simple vector. In prop_geo vector placed the

areas of bars.

Mat =17

Page 18: FEA Assignment - Lucas Dos Santos Almeida p13175018

   200E3

Prop_geo =

      1 1

      2 1

      3 1

      4 1

      5 1,414

      6 1,414

We see that movement is restricted in the lattice 4 degrees of freedom. Node 1 is

restricted in x and y, the node 2 in x and y as well.

Num_restr = 4;

We must create a matrix with restrictions. In the first column put what is the node where

the restriction is. In the second place which is the degree of freedom has been restricted.

The number 1 represents the degree of freedom in x and number 2 represents the degree

of freedom in y. If this trellis, node 1 and node 2 are restricted in DOF 1 and 2 (x and

y).

Is then:

restr =

      1 1

      1 2

      2 1

      2 2

18

Page 19: FEA Assignment - Lucas Dos Santos Almeida p13175018

Then remains to define the shipments of the trellis. It creates a vector with the number

of shipments. In this case, there is a force.

Num_loads = 1;

One should tell the program where this load is located. If this lattice power is being

applied to the node 4, the DOF 2.

In the matrix, the first column indicates the node, the second the DOF and the third

magnitude.

Loads =

            4 2 -1000

References

Bittencourt , Marco - Analise Computacional de Estruturas, com aplicação do

método de elementos finitos.

19