Finite Element Method: Note 2. Triangular Element Program For 2-D Stress Analysis and Application
Finite Element Method: Note 2. Triangular Element Program For 2-D Stress Analysis and Application
Note 2. Triangular element program for 2-D stress analysis and application
Software: GNU Octave (https://www.gnu.org/software/octave/download.html)
Development of a computer program to generate the corresponding equations for a
triangular element for 2-D stress analysis. The next plot presents the function k, which was
code in GNU Octave. The function k corresponds to stiffness matrix for a triangular
element.
function k = PlaneStressTriElement (e, nu, h, coord)
% k = PlaneStressTriElement (e, nu, h, coord)
% Generate stiffness matrix for a triangular element for plane stress
% e = Modulus of elasticity
% nu = Poissons ratio
% h = Thickness
% coord = Coordinates at the element ends
x1=coord (1,1); y1=coord(1,2);
x2=coord (2,1); y2=coord(2,2);
x3=coord (3,1); y3=coord(3,2);
b1= y2-y3; b2= y3-y1; b3= y1-y2;
c1= x3-x2; c2= x1-x3; c3= x2-x1;
f1= x2*y3 - x3*y2; f2= x3*y1 - x1*y3; f3 = x1*y2 - x2*y1;
A= (f1+f2+f3)/2;
C= e/(1-nu^2)*[1, nu, 0; nu, 1, 0; 0, 0, (1-nu)/2];
B= [b1, 0, c1; 0, c1, b1; b2, 0, c2; 0, c2, b2; b3, 0, c3; 0, c3, b3]/(2*A);
k= h*A*(B*C*B');
1
notes
The triangular element can have a uniformly distributed load in the normal and tangential
directions qn and qt on each side. The function rq is code in GNU Octave to determine the
equivalent nodal vector rq. The next plot presents the function rq.
function rq= PlaneStressTriLoad(side, qn, qt, h, coord)
% rq = PlaneStressTriLoad(side, qn, qt, h, coord)
% Generates equivalent load vector for a triangular element
% side = side over which the load is specified
% qn, qt = load components in the normal and the tangential direction
% h = thickness
% coord = coordinates at the element ends
x1=coord(1,1); y1=coord(1,2);
x2=coord(2,1); y2=coord(2,2);
x3=coord(3,1); y3=coord(3,2);
switch (side)
case 1
L=sqrt((x2-x1)^2+(y2-y1)^2);
nx=(y2-y1)/L; ny=-(x2-x1)/L;
qx= nx*qn-ny*qt;
qy= ny*qn+nx*qt;
rq= h*L/2*[qx; qy; qx; qy; 0; 0];
case 2
L=sqrt((x2-x3)^2+(y2-y3)^2);
nx=(y3-y2)/L; ny=-(x3-x2)/L;
qx= nx*qn - ny*qt;
qy= ny*qn + nx*qt;
rq= h*L/2*[0; 0; qx; qy; qx; qy];
case 3
L=sqrt((x3-x1)^2+(y3-y1)^2);
nx=(y1-y3)/L; ny=-(x1-x3)/L;
qx= nx*qn - ny*qt;
qy= ny*qn +nx*qt;
rq= h*L/2*[qx; qy; 0; 0; qx; qy];
end
Table I presents the global coordinates for a mesh of triangular elements. Apply the
function k for a triangular element connected between the nodes 4, 7 and 11. The side 3 of
this triangular element has an applied load along the negative outer normal direction (qn =
-50 and qt = 0). The variables E, v, and h are 3000000, 0.2 and 4.
2
notes
Coordinates (x, y)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(0, 5)
(0, 22/3)
(0, 29/3)
(0, 12)
(3, 5)
(4, 22/3)
(5, 29/3)
(6, 0)
(6, 5/2)
(6, 5)
(6, 12)
(8, 22/3)
(10, 29/3)
(23/2, 17/3)
(12, 12)
(15, 4)
(17, 53/6)
(20, 0)
(45/2, 12)
(24, 8)
(80/3, 4)
(33, 12)
(100/3, 8)
(37, 0)
(40, 12)
(121/3, 4)
(131/3, 8)
(47, 12)
(54, 0)
(54, 4)
(54, 8)
(54, 12)
The stiffness matrix k and load vector rq for the triangular element connected between the
nodes 4, 7 and 11 are presented below.
>> % Plane stress element equations
>> nodes = [0, 5; 0, 22/3; 0, 29/3; 0, 12; 3, 5; 4, 22/3;
5, 29/3; 6, 0; 6, 5/2; 6, 5; 6, 12; 8, 22/3; 10, 29/3;
23/2, 17/3; 12, 12; 15, 4; 17, 53/6; 20, 0;45/2, 12;
24, 8; 80/3, 4; 33, 12; 100/3, 8; 37,0; 40, 12; 121/3, 4;
131/3, 8; 47, 12; 54, 0; 54, 4; 54, 8; 54, 12];
>> k = PlaneStressTriElement(3000000, .2, 4, nodes([4 7 11],:))
k=
2.6091e+006 -6.2500e+005 -1.0714e+006 1.2500e+006 -1.5377e+006 -6.2500e+005
-6.2500e+005 1.4187e+006 2.5000e+006 -2.6786e+006 -1.8750e+006 1.2599e+006
3
notes
4
notes