MATLAB® Code for Two-Dimensional Interval Finite

0 downloads 0 Views 241KB Size Report
problems. 7.1 MATLAB CODE FOR PLANE TRUSS ELEMENT .... l=cos(x); m=sin(x); y=(E*A/L)*[-l -m l m]*u;. 5. PlaneTrussElementStress (a, b, alpha, L, theta, u).
CHAPTER 7

MATLAB® Code for Two-Dimensional Interval Finite Element In this chapter, we will develop the MATLAB® codes for two-dimensional interval finite element, viz. plane truss, beam, plane frame, and linear triangular elements. A systematic procedure is followed to develop the MATLAB® codes and then these are used to investigate few example problems.

7.1 MATLAB CODE FOR PLANE TRUSS ELEMENT Plane truss is a two-dimensional commonly used structural element. In plane truss element, forces are subjected axially and it cannot sustain shear and moment. The truss elements are assumed to be pin connected where all the loads act only at joints. Let us consider a plane truss element having interval modulus of elasticity EI, cross-section area is A, and length L. For simplicity, the interval modulus of elasticity EI is written further as E only. The interval constant E is then defined as E I ¼ ½a, b ¼ E ¼ a + w ½0, 1

(7.1)

where a and b are the left and the right bounds of the interval modulus of elasticity E; w ¼ b  a is the width of the interval. Interval (Eq. 7.1) can be represented in the parametric form E ¼ a + wα

(7.2)

where α 2 [0, 1]. This generic form is used in the further discussion. Considering the parametric form for interval modulus of elasticity, the interval elemental stiffness matrix is written from Eq. (6.18) as

Interval Finite Element Method with MATLAB® https://doi.org/10.1016/B978-0-12-812973-9.00007-2

© 2018 Elsevier Inc. All rights reserved.

79

Interval Finite Element Method with MATLAB®

80

2

l2

lm m2

l 2 lm

3

6 lm lm m2 7 6 7 ½K  ¼ k6 2 7 4 l lm l2 lm 5 lm m2 lm m2

(7.3)

where k ¼ EA L , cos θ ¼ l, and sin θ ¼ m; here, θ is the angle made by the local axes with the global axes (shown in Fig. 6.5, Chapter 6). Since the plane truss element has four degrees of freedom (each node has two degrees of freedom), the interval elemental stiffness matrix is of size 4  4. Hence, for a system of n  1 elements (n nodes), the size of the global stiffness matrix KG will be of order 2n  2n. Here, the global stiffness matrix KG is obtained by assembling the element stiffness matrices Ki , i ¼ 1 , 2 , … , n, using the MATLAB® function PlaneTrussElementAssemble.m. After the formation of global stiffness matrix KG, we get the following system of equations ½KGfU g ¼ fF g

(7.4)

where U and F are called the global nodal displacement and the global nodal force vectors, respectively. Next, the boundary conditions are implemented to the vectors U and F, and Eq. (7.4) is solved by any standard methods for the system of equations. In the following paragraph, we will discuss various MATLAB® functions used for the plane truss element (Kattan, 2007; Nayak and Chakraverty, 2013).

7.1.1 MATLAB® Functions for Plane Truss Element 1. PlaneTrussElementLength (x1, y1, x2, y2) This MATLAB® function calculates the length of the plane truss element that has the first node at (x1, y1) and second node at (x2, y2). It returns a crisp real value. function y = PlaneTrussElementLength (x1, y1, x2, y2) % PlaneTrussElementLength

This function gives the length of the

%

plane truss element having first and

%

second coordinates (x1, y1) and (x2, y2)

%

respectively.

y= sqrt((x2-x1)^2 +(y2-y1)^2);

MATLAB® Code for Two-Dimensional Interval Finite Element

81

2. PlaneTrussElementStiffness (a, b, alpha, A, L, theta) This MATLAB® function calculates the element stiffness matrix K for each plane truss element having interval modulus of elasticity E, cross-section area A, length L, and angle theta (in degrees). Here, a and b are the left and the right bounds of interval modulus of elasticity. However, alpha belongs to [0, 1]. It gives element stiffness for plane truss element of size 4  4. function y = PlaneTrussElementStiffness (a, b, alpha, A, L, theta) % PlaneTrussElementStiffness

This function gives element stiffness

%

matrix with modulus of elasticity E,

%

cross sectional area A, length L and

%

angle theta (in degrees). Here, a

%

and b are the left and right bound of

%

interval spring constant; alpha belongs

%

to [0, 1].

x=theta*pi/180; l=cos(x); m=sin(x); E=a +(b-a)*alpha; y=(E*A/L)*[l^2 l*m -l^2 -l*m;l*m m^2 -l*m -m^2; -l^2 -l*m l^2 l*m;-l*m -m^2 -l*m m^2];

3. PlaneTrussElementAssemble (KG, K, i, j) This MATLAB® function is used to assemble the elemental stiffness matrix K of the plane truss element whose nodes are i (left-end node) and j (rightend node) into the global stiffness matrix KG. This function gives 2n  2n global stiffness matrix KG. function y = PlaneTrussElementAssemble (KG, K, i, j) % PlaneTrussElementAssemble

This function assembles the element

%

stiffness matrix K of the spring with nodes

%

i and j into the global stiffness matrix

%

KG.

KG(2*i-1,2*i-1)=KG(2*i-1,2*i-1)+K(1,1); KG(2*i-1,2*i)=KG(2*i-1,2*i)+K(1,2); KG(2*i-1,2*j-1)=KG(2*i-1,2*j-1)+K(1,3); KG(2*i-1,2*j)=KG(2*i-1,2*j)+K(1,4); KG(2*i,2*i-1)=KG(2*i,2*i-1)+K(2,1); KG(2*i,2*i)=KG(2*i,2*i)+K(2,2); KG(2*i,2*j-1)=KG(2*i,2*j-1)+K(2,3); KG(2*i,2*j)=KG(2*i,2*j)+K(2,4);

Interval Finite Element Method with MATLAB®

82

KG(2*j-1,2*i-1)=KG(2*j-1,2*i-1)+K(3,1); KG(2*j-1,2*i)=KG(2*j-1,2*i)+K(3,2); KG(2*j-1,2*j-1)=KG(2*j-1,2*j-1)+K(3,3); KG(2*j-1,2*j)=KG(2*j-1,2*j)+K(3,4); KG(2*j,2*i-1)=KG(2*j,2*i-1)+K(4,1); KG(2*j,2*i)=KG(2*j,2*i)+K(4,2); KG(2*j,2*j-1)=KG(2*j,2*j-1)+K(4,3); KG(2*j,2*j)=KG(2*j,2*j)+K(4,4); y= KG;

4. PlaneTrussElementForce (a, b, alpha, A, L, theta, u) This MATLAB® function is used to calculate the element force vector that returns 4  1 vector. function y = PlaneTrussElementForce (a, b, alpha, A, L, theta, u) % PlaneTrussElementForce

This function gives the element force vector

%

when the modulus of elasticity is E, the cross

%

sectional area is A, length is L, the angle

%

theta (in degrees) and the element nodal

%

displacement vector u are given.

E= a+(b-a)*alpha; x= theta*pi/180; l= cos(x); m= sin(x); y=(E*A/L)*[-l -m l m]*u;

5. PlaneTrussElementStress (a, b, alpha, L, theta, u) This MATLAB® function calculates the element stress. It gives a scalar value. function y = PlaneTrussElementStress (a, b, alpha, L, theta, u) % PlaneTrussElementStress

This function gives element stress when

%

the modulus of elasticity E, the length

%

L, the angle theta (in degrees) and the

%

element nodal displacement vector u are

%

given.

%

Here, a and b are the left and right

%

bounds of interval modulus of elasticity;

%

alpha belongs to [0, 1].

x= theta*pi/180; C= cos(x); S= sin(x); E= a+(b-a)*alpha; y=(E/L)*[-C -S C S]*u;

MATLAB® Code for Two-Dimensional Interval Finite Element

83

6. PlaneTrussInclinedSupport (T, i, theta) This MATLAB® function calculates the transformation matrix of the inclined support at node i with angle of inclination theta (in degrees). It gives transformation matrix of size 2n  2n. function y = PlaneTrussInclinedSupport (T, i, alpha) % PlaneTrussInclinedSupport

This function computes the transformation

%

matrix T of the inclined support at node

%

i with angle of inclination theta (in

%

degrees).

x=theta*pi/180; T(2*i-1,2*i-1)=cos(x); T(2*i-1,2*i)=sin(x); T(2*i,2*i-1)=-sin(x); T(2*i,2*i)=cos(x); y=T;

Let us introduce now the algorithm to write the program of plane truss element using this MATLAB® functions. Step 1: Discretization of the domain The domain is discretized into a finite number of elements. Then, the element connectivity table is generated. Step 2: Evaluation of element stiffness matrices Element stiffness matrices Ki , i ¼ 1 , 2 , … , n are obtained by using the MATLAB® function “PlaneTrussElementStiffness.” Here, each matrix is of size 4  4. Step 3: Evaluation of global stiffness matrix Element stiffness matrices are assembled by using the MATLAB® function “PlaneTrussElementAssemble” and global stiffness matrix is formed. Step 4: Application of boundary conditions Boundary conditions are applied to the global stiffness matrix and a global system of equations are generated. Step 5: Solution of system of equations A system of equations (after applying boundary conditions to the global system of equations) are solved. The unknown variables are found by using the MATLAB® function “PlaneTrussElementForces.” Example 7.1 Consider a system of plane truss as shown in Fig. 7.1. Here, the interval modulus of elasticity is assumed as E ¼ [200, 220] GPa and area is A ¼ 1  104 m2. We will investigate the displacements at each node.

84

Interval Finite Element Method with MATLAB®

20 kN 10 kN

3

5m 1

2 3m

3m

Fig. 7.1 System of plane truss.

Table 7.1 Element connectivity for system of plane trusses Element number Node i Node j

1 2 3

1 1 2

2 3 3

The system of plane truss (Fig. 7.1) is composed of three plane truss elements where each node of the element is connected with the other two elements. Considering discretization of the system of truss, the element connectivity is presented in Table 7.1. Here, the nodes i and j represent the first and the last nodes of each element. In Fig. 7.1, the first node (node 1) is fixed; hence, the displacement at node 1 is zero. However, forces P ¼ 20 kN and 10 kN are applied at the node 3. We are now going to investigate the nodal displacements. Let us consider the architecture of the plane truss elements and the MATLAB® functions, Code 7.1 is developed to investigate the displacements. Code 7.1 is shown only for the alpha (α) value of zero.

Code 7.1: Plane Truss Element A=1*10^(-4); l1= 6; theta1= 0; theta2= atan(5/3)*(180/pi); theta3= 180-theta2; l2= PlaneTrussElementLength (0,0,3,5); l3= PlaneTrussElementLength (6,0,3,5); % – –––– ––– –––– ––– –––– ––– –––– ––– –

MATLAB® Code for Two-Dimensional Interval Finite Element

85

% Stiffness matrices of the elements % –– –––– ––– –––– ––– –––– ––– –––– ––– K1=PlaneTrussElementStiffness (200,220,0,A,l1,theta1); K2=PlaneTrussElementStiffness (200,220,0,A,l2,theta2); K3=PlaneTrussElementStiffness (200,220,0,A, l3, theta3); % –– –––– ––– –––– ––– –––– ––– –––– ––– % Assembling of the stiffness matrices % –– –––– ––– –––– ––– –––– ––– –––– ––– KG=zeros(6,6); KG=PlaneTrussElementAssemble (KG,K1,1,2); KG=PlaneTrussElementAssemble (KG,K2,1,3); KG=PlaneTrussElementAssemble (KG,K3,2,3); %––– ––– –––– ––– –––– ––– –––– –––– –– %Boundary conditions %––– ––– –––– ––– –––– ––– –––– –––– –– K=[KG(3,3) KG(3,5:6);KG(5,3) KG(5,5:6);KG(6,3) KG(6,5:6)]; f=[0;10;-20]; % –– –––– ––– –––– ––– –––– ––– –––– ––– % Nodal displacements % –– –––– ––– –––– ––– –––– ––– –––– ––– u=K\f

Using Code 7.1 for different values of alpha (α), nodal displacements for this system of trusses are obtained. The nodal displacements are given in Table 7.2. Union of these displacements generates the united solution (displacements) of the system. Now, considering the various displacements in Table 7.2, we get the following interval solution (united solution) that is presented in Table 7.3. Table 7.2 Nodal displacements of system of truss for different α values α50 α 5 0.2 α 5 0.4 α 5 0.6 α 5 0.8

α51

u3 u5 u6

0.0030 0.0065 0.0045

0.0033 0.0072 0.0050

0.0032 0.0070 0.0049

0.0032 0.0069 0.0048

0.0031 0.0068 0.0047

Table 7.3 United solution for plane truss system

u3 u5 u6

[0.0030, 0.0033] [0.0065, 0.0072] [0.0050, 0.0045]

0.0031 0.0066 0.0046

Interval Finite Element Method with MATLAB®

86

7.2 MATLAB® CODE FOR BEAM ELEMENT Beam is also one of the commonly used two-dimensional elements in structural analysis. Unlike the truss or the rod, beam experiences transverse deflection. Beam element undergoes the same transverse deflection on the entire cross section as the neutral axis. Consider a beam element that exerts transverse deflection v and slope of the deflection (rotation) curve I dv dx. Each beam element has interval modulus of elasticity E , length l, and moment of inertia Ia. For simplicity, the interval modulus of elasticity EI is next written as E. The interval modulus of elasticity E and its parametric form are defined in Eqs. (7.1), (7.2), respectively. The element stiffness matrix for beam element from Eq. (6.30) is 2 3 12 6l 12 6l EIa 6 6l 4l 2 6l 2l 2 7 7 (7.5) ½K  ¼ 3 6 l 4 12 6l 12 6l 5 6l 2l2 6l 4l 2 which is of order 4  4 due to the four degrees of freedom, two at each nodes. For a structure or a domain with n nodes, we obtain a global stiffness matrix KG of size 2n  2n. The elemental stiffness matrices are assembled through the MATLAB® function BeamElementAssemble.m and global stiffness matrix KG is obtained. Considering the global stiffness matrix along with the global displacement vectors and global force vectors, we get the global elemental equation (7.4). Finally, the boundary conditions are applied to Eq. (7.4) and unknown field variables are investigated by using standard methods for the system of equations. Next, we will discuss various MATLAB® functions used for the beam element (Chapman, 2007; Nayak and Chakraverty, 2016).

7.2.1 MATLAB® Functions for Beam Element 1. BeamElementStiffness (a, b, alpha, Ia, l) This MATLAB® function calculates the element stiffness matrix K for each beam element having interval modulus of elasticity E, length l, and moment of inertia Ia. Here, a and b are the left and the right bounds of interval modulus of elasticity. However, alpha belongs to [0, 1]. It gives the element stiffness matrix for beam element of size 4  4. function y = BeamElementStiffness(a, b, alpha, Ia, l) % BeamElementStiffness

This function gives element stiffness matrix

%

for a beam element having modulus of

MATLAB® Code for Two-Dimensional Interval Finite Element

%

elasticity E, moment of inertia Ia and length

%

l. Here, a and b are the left and right bound

%

of interval modulus of elasticity; alpha

%

belongs to [0, 1].

87

E=a +(b-a)*alpha; y=((E*Ia)/l^3)*[12 6*l -12 6*l;6*l 4*l^2 -6*l 2*l^2; -12 -6*l 12 -6*l;6*l 2*l^2 -6*l 4*l^2];

2. BeamElementAssemble (KG, K, i, j) This MATLAB® function is used to assemble the elemental stiffness matrix K of the beam element whose nodes are i (left-end node) and j (right-end node) into the global stiffness matrix KG. It gives 2n  2n global stiffness matrix KG. function y = BeamElementAssemble (KG, K, i, j) % BeamElementAssemble

This function is used to assemble the element

%

stiffness matrix K of the beam element having

%

the nodes i and j into the global stiffness

%

matrix KG.

KG(2*i-1,2*i-1)=KG(2*i-1,2*i-1)+K(1,1); KG(2*i-1,2*i)=KG(2*i-1,2*i)+K(1,2); KG(2*i-1,2*j-1)=KG(2*i-1,2*j-1)+K(1,3); KG(2*i-1,2*j)=KG(2*i-1,2*j)+K(1,4); KG(2*i,2*i-1)=KG(2*i,2*i-1)+K(2,1); KG(2*i,2*i)=KG(2*i,2*i)+K(2,2); KG(2*i,2*j-1)=KG(2*i,2*j-1)+K(2,3); KG(2*i,2*j)=KG(2*i,2*j)+K(2,4); KG(2*j-1,2*i-1)=KG(2*j-1,2*i-1)+K(3,1); KG(2*j-1,2*i)=KG(2*j-1,2*i)+K(3,2); KG(2*j-1,2*j-1)=KG(2*j-1,2*j-1)+K(3,3); KG(2*j-1,2*j)=KG(2*j-1,2*j)+K(3,4); KG(2*j,2*i-1)=KG(2*j,2*i-1)+K(4,1); KG(2*j,2*i)=KG(2*j,2*i)+K(4,2); KG(2*j,2*j-1)=KG(2*j,2*j-1)+K(4,3); KG(2*j,2*j)=KG(2*j,2*j)+K(4,4); y=KG;

3. BeamElementForces (K, u) This MATLAB® function is used to calculate the element force vector that returns 4  1 vector. function y = BeamElementForces (K, u) % BeamElementForces

This function gives element nodal force vector

Interval Finite Element Method with MATLAB®

88

%

when the elemental stiffness matrix K and

% given.

elemental nodal displacement vector u are

y= K*u;

Let us now introduce the algorithm to write the program of plane truss element using the MATLAB® functions. Step 1: Discretization of the domain The domain is discretized into a finite number of elements. Then, the element connectivity table is obtained. Step 2: Evaluation of element stiffness matrices Element stiffness matrices Ki , i ¼ 1 , 2 , … , n are generated by using the MATLAB® function “BeamElementStiffness.” Here, each matrix has size 4  4. Step 3: Evaluation of global stiffness matrix Element stiffness matrices are assembled by using the MATLAB® function “BeamElementAssemble” and a global stiffness matrix is found. Step 4: Application of boundary conditions Boundary conditions are applied to the global stiffness matrix and a global system of equations are formed. Step 5: Solution of system of equations A system of equations (after applying boundary conditions to the global system of equations) are solved. The unknown variables are obtained by using the MATLAB® function “BeamElementForces.” Example 7.2 Consider a system of beam elements shown in Fig. 7.2. Here, the interval modulus of elasticity is E ¼ [200, 220] GPa, moment of inertia Ia ¼ 50  106 m4, external force P ¼ 25 kN, and length l ¼ 3. Now, we will determine the displacements at each node. The system of beam elements (Fig. 7.2) is discretized into three elements where elements are connected end to end. Considering the discretization of the system of beams, the element connectivity Table 7.4 is presented. In Table 7.4, the nodes i and j represent the first and the last nodes of the

P 1

3m

Fig. 7.2 System of beam elements.

2

3m

3

3m

MATLAB® Code for Two-Dimensional Interval Finite Element

Table 7.4 Element connectivity for system of beam elements Element number Node i Node j

1 2 3

1 2 3

2 3 4

element. In Fig. 7.2, the first node (node 1) is fixed; hence, the displacement at node 1 is zero. However, a force P ¼ 25 kN is subjected at the node 3. Next, we are going to investigate the nodal displacements. Considering the architecture of the beam elements and these MATLAB® functions, Code 7.2 is given to investigate the displacements. Code 7.2 is developed only for the alpha (α) value of zero.

Code 7.2: Beam Element Ia=50*10^(-6); l=3; % –– –––– ––– –––– ––– –––– ––– –––– ––– % Stiffness matrices of the elements % –– –––– ––– –––– ––– –––– ––– –––– ––– K1=BeamElementStiffness(200,220,0, Ia, l); K2=BeamElementStiffness(200,220,0, Ia, l); K3=BeamElementStiffness(200,220,0, Ia, l); % –– –––– ––– –––– ––– –––– ––– –––– ––– % Assembling of the stiffness matrices % –– –––– ––– –––– ––– –––– ––– –––– ––– KG=zeros(8,8); KG=BeamElementAssemble(KG, K1, 1, 2); KG=BeamElementAssemble(KG, K2, 2, 3); KG=BeamElementAssemble(KG, K3, 3, 4); %––– ––– –––– ––– –––– ––– –––– –––– –– %Boundary conditions %––– ––– –––– ––– –––– ––– –––– –––– –– K=[KG(5:6,5:6) KG(5:6,8);KG(8,5:6) KG(8,8)]; f=[-25;0;0]; % –– –––– ––– –––– ––– –––– ––– –––– ––– % Nodal displacements % –– –––– ––– –––– ––– –––– ––– –––– ––– u=K\f

89

90

Interval Finite Element Method with MATLAB®

Table 7.5 Nodal displacements of system of beams for different α values α50 α 5 0.2 α 5 0.4 α 5 0.6 α 5 0.8

u5 u6 u8

0.0049 0.0007 0.0028

0.0048 0.0007 0.0028

0.0047 0.0007 0.0027

0.0046 0.0007 0.0027

0.0046 0.0007 0.0026

α51

0.0045 0.0006 0.0026

Table 7.6 United solution for system of beams

u5 u6 u8

[0.0049, 0.0045] [0.0007, 0.0006] [0.0026, 0.0028]

Using the Code 7.2 for different values of alpha (α), nodal displacements for this system of beam elements are obtained. The nodal displacements are given in Table 7.5. Union of these displacements generates the united solution (displacements) of the system. Considering the various displacements in Table 7.5, we may get the interval solution (united solution) that is presented in Table 7.6.

7.3 MATLAB® CODE FOR PLANE FRAME ELEMENT Plane frame element is a two-dimensional finite element. It is similar to the beam element in addition with two extra properties, i.e., it experiences an axial force due to loads and these elements are oriented in any direction in the plane. Each beam element is assumed to have interval modulus of elasticity EI, length l, cross-sectional area A, and moment of inertia Ia. Each plane frame element has two nodes that make an angle θ with positive global X-axis in counterclockwise direction. Again, for simplicity, the interval modulus of elasticity EI is written further as E. The interval modulus of elasticity E and its parametric form are defined in Eqs. (7.1), (7.2), respectively. As the plane frame undergoes both the axial and the transversal forces, it possesses six degrees of freedom (three degrees of freedom at each node). The element stiffness matrix for beam element from Eq. (6.41) is

MATLAB® Code for Two-Dimensional Interval Finite Element ! 12Ia 2 12Ia 6Ia S A CS  S 6 AC 2 + l 6 l2 l2 6 6 ! 6 6 12Ia 12Ia 2 6Ia 6 C A C CS AS2 + 6 l 6 2 2 l l 6 6 6 6Ia 6Ia 6  S C 4Ia 6 l l 6 E6 6 ! ! l6 6 12Ia 2 12Ia 6Ia 6  AC 2 + S  A CS S 6 l l2 l2 6 6 6 ! ! 6 6 12Ia 12Ia 2 6Ia 6  A C CS  AS2 +  C 6 l l2 l2 6 6 4 6Ia 6Ia C 2Ia  S l l 2

! ! 12Ia 2 12Ia S  A CS l2 l2 ! ! 12Ia 12Ia 2 2  A C CS  AS + l2 l2

 AC 2 +

6Ia S l 12Ia 2 S l2 ! 12Ia A CS l2

AC 2 +

6Ia C l ! 12Ia CS A l2 

AS2 +

6Ia S l



12Ia 2 C l2

6Ia C l

91

3 6Ia S7 l 7 7 7 7 6Ia 7 C 7 7 l 7 7 7 7 2Ia 7 7 7 7: 7 7 6Ia 7 S 7 7 l 7 7 7 7 6Ia 7  C7 7 l 7 7 5 4Ia 

(7.6)

The interval elemental stiffness matrix for plane frame element is of order 6  6 due to the six degrees of freedom, three at each node. For a structure or a domain with n nodes, we obtain a global stiffness matrix KG of size 3n  3n. The elemental stiffness matrices are assembled through the MATLAB® function PlaneFrameElementAssemble.m and global stiffness matrix KG is obtained. Considering the global stiffness matrix along with the global displacement vectors and global force vectors, we get the global elemental equation (7.4). Finally, the boundary conditions are applied to Eq. (7.4) and unknown field variables are investigated by using standard methods for the system of equations. Next, we will discuss various MATLAB® functions used for the plane frame element (Chapman, 2007; Kattan, 2007; Pratap, 2005).

7.3.1 MATLAB® Functions for Plane Frame Element 1. PlaneFrameElementLength (x1, y1, x2, y2) This MATLAB® function calculates the length of the plane frame element that has the first node at (x1, y1) and the second node at (x2, y2). It returns a crisp real value. function y = PlaneFrameElementLength (x1, y1, x2, y2) % PlaneFrameElementLength

This function gives length of the plane

%

frame element whose first and

%

second nodes have coordinates (x1,y1) and

%

(x2,y2) respectively.

y=sqrt((x2-x1)^2+(y2-y1)^2);

Interval Finite Element Method with MATLAB®

92

2. PlaneFrameElementStiffness (a, b, alpha, A, Ia, l, theta) This MATLAB® function calculates the element stiffness matrix K for each plane frame element having interval modulus of elasticity E, length l, crosssectional area A, moment of inertia Ia, and the angle theta (in degrees). Here, a and b are the left and the right bounds of interval modulus of elasticity. However, alpha belongs to [0, 1]. It gives the element stiffness matrix for plane frame element of size 6  6. function y = PlaneFrameElementStiffness (a, b, alpha, A, Ia, l, theta) % PlaneFrameElementStiffness

This function gives element stiffness

%

matrix for a plane frame element having

%

modulus of elasticity E, cross sectional

%

area A, moment of inertia Ia, length l

%

and angle theta (in degrees). Here, a and

%

b are the left and right bound of interval

%

modulus of elasticity; alpha belongs to

%

[0, 1].

E= a+(b-a)*alpha; x= theta*pi/180; C= cos(x); S= sin(x); w1 =A*C^2+(12*Ia*S^2)/(l^2); w2 =A*S^2 +(12*Ia*C^2)/(l^2); w3 =((A-12*Ia)/(l^2))*C*S; w4 =6*Ia*S/l; w5 =6*Ia*C/l; y=(E/l)*[w1 w3 -w4 -w1 -w3 -w4;w3 w2 w5 -w3 -w2 w5; -w4 w5 4*Ia w4 -w5 2*Ia;-w1 -w3 w4 w1 w3 w4; -w3 -w2 -w5 w3 w2 -w5;-w4 w5 2*Ia w4 -w5 4*Ia];

3. PlaneFrameElementAssemble (KG, K, i, j) This MATLAB® function is used to assemble the elemental stiffness matrix K of the plane frame element whose nodes are i (left-end node) and j (rightend node) into the global stiffness matrix KG. This function gives 3n  3n global stiffness matrix KG. function y = PlaneFrameElementAssemble (KG, K, i, j) % PlaneFrameElementAssemble

This function is used to assemble the

%

element stiffness matrix K of the plane

%

frame element having nodes i and j

%

into the global stiffness matrix KG.

KG(3*i-2,3*i-2)=KG(3*i-2,3*i-2)+K(1,1); KG(3*i-2,3*i-1)=KG(3*i-2,3*i-1)+K(1,2);

MATLAB® Code for Two-Dimensional Interval Finite Element

93

KG(3*i-2,3*i)=KG(3*i-2,3*i)+K(1,3); KG(3*i-2,3*j-2)=KG(3*i-2,3*j-2)+K(1,4); KG(3*i-2,3*j-1)=KG(3*i-2,3*j-1)+K(1,5); KG(3*i-2,3*j)=KG(3*i-2,3*j)+K(1,6); KG(3*i-1,3*i-2)=KG(3*i-1,3*i-2)+K(2,1); KG(3*i-1,3*i-1)=KG(3*i-1,3*i-1)+K(2,2); KG(3*i-1,3*i)=KG(3*i-1,3*i)+K(2,3); KG(3*i-1,3*j-2)=KG(3*i-1,3*j-2)+K(2,4); KG(3*i-1,3*j-1)=KG(3*i-1,3*j-1)+K(2,5); KG(3*i-1,3*j)=KG(3*i-1,3*j)+K(2,6); KG(3*i,3*i-2)=KG(3*i,3*i-2)+K(3,1); KG(3*i,3*i-1)=KG(3*i,3*i-1)+K(3,2); KG(3*i,3*i)=KG(3*i,3*i)+K(3,3); KG(3*i,3*j-2)=KG(3*i,3*j-2)+K(3,4); KG(3*i,3*j-1)=KG(3*i,3*j-1)+K(3,5); KG(3*i,3*j)=KG(3*i,3*j)+K(3,6); KG(3*j-2,3*i-2)=KG(3*j-2,3*i-2)+K(4,1); KG(3*j-2,3*i-1)=KG(3*j-2,3*i-1)+K(4,2); KG(3*j-2,3*i)=KG(3*j-2,3*i)+K(4,3); KG(3*j-2,3*j-2)=KG(3*j-2,3*j-2)+K(4,4); KG(3*j-2,3*j-1)=KG(3*j-2,3*j-1)+K(4,5); KG(3*j-2,3*j)=KG(3*j-2,3*j)+K(4,6); KG(3*j-1,3*i-2)=KG(3*j-1,3*i-2)+K(5,1); KG(3*j-1,3*i-1)=KG(3*j-1,3*i-1)+K(5,2); KG(3*j-1,3*i)=KG(3*j-1,3*i)+K(5,3); KG(3*j-1,3*j-2)=KG(3*j-1,3*j-2)+K(5,4); KG(3*j-1,3*j-1)=KG(3*j-1,3*j-1)+K(5,5); KG(3*j-1,3*j)=KG(3*j-1,3*j)+K(5,6); KG(3*j,3*i-2)=KG(3*j,3*i-2)+K(6,1); KG(3*j,3*i-1)=KG(3*j,3*i-1)+K(6,2); KG(3*j,3*i)=KG(3*j,3*i)+K(6,3); KG(3*j,3*j-2)=KG(3*j,3*j-2)+K(6,4); KG(3*j,3*j-1)=KG(3*j,3*j-1)+K(6,5); KG(3*j,3*j)=KG(3*j,3*j)+K(6,6); y=KG;

4. PlaneFrameElementForces (a, b, alpha, A, Ia, l, theta, u) This MATLAB® function is used to calculate the element force vector that returns 6  1 vector. function y = PlaneFrameElementForces (a, b, alpha, A, Ia, l, theta, u) % PlaneFrameElementForces

This function gives element force vector

Interval Finite Element Method with MATLAB®

94

%

when modulus of elasticity E, cross

%

sectional area A, moment of inertia Ia,

%

length l, angle theta (in degrees) and

%

element nodal displacement vector u are

%

given.

E= a+(b-a)*alpha; x= theta*pi/180; C= cos(x); S= sin(x); w1 =E*A/l; w2 =(12*E*Ia)/(l^3); w3 =(6*E*Ia)/(l^2); w4 =(4*E*Ia)/l; w5 =(2*E*Ia)/l; Kprime=[w1 0 0 -w1 0 0;0 w2 w3 0 -w2 w3;0 w3 w4 0 -w3 w5; -w1 0 0 w1 0 0;0 -w2 -w3 0 w2 -w3;0 w3 w5 0 -w3 w4]; T=[C S 0 0 0 0;-S C 0 0 0 0;0 0 1 0 0 0;0 0 0 C S 0; 0 0 0 -S C 0;0 0 0 0 0 1]; y= Kprime*T*u;

Let us introduce the algorithm to write the program of plane frame element using these MATLAB® functions. Step 1: Discretization of the domain The domain is discretized into a finite number of elements. Then, the element connectivity table is obtained. Step 2: Evaluation of element stiffness matrices Element stiffness matrices Ki , i ¼ 1 , 2 , … , n are formed by using the MATLAB® function “PlaneFrameElementStiffness.” Here, each matrix has size 6  6. Step 3: Evaluation of global stiffness matrix Element stiffness matrices are assembled by using the MATLAB® function “PlaneFrameElementAssemble” and global stiffness matrix is generated. Step 4: Application of boundary conditions Boundary conditions are applied to the global stiffness matrix and a global system of equations are obtained. Step 5: Solution of system of equations A system of equations (after applying boundary conditions to the global system of equations) are solved. The unknown variables are found using the MATLAB® function “PlaneFrameElementForces.”

MATLAB® Code for Two-Dimensional Interval Finite Element

Example 7.3 Consider the system of plane frame shown in Fig. 7.3. Here, the interval modulus of elasticity E ¼ [200, 220] GPa, area A ¼ 3  102 m2, and moment of inertia Ia ¼ 6  105 m4. Now, we will determine the displacements at each node of the plane frame system. The system of plane frame (Fig. 7.3) has been discretized into five elements. Taking the arrangement of plane frame elements in Fig. 7.3, a connectivity Table 7.7 is provided. Here, the nodes i and j represent the first and the last nodes of the element. In Fig. 7.3, the first (node 1), fourth (node 4), and sixth (node 6) are fixed; hence, the displacements at node 1, 4, and 6 are zero. However, a force P ¼ 25 kN is subjected at the node 2. Now, we are going to investigate the nodal displacements. Considering the architecture of the plane frame elements and these MATLAB® functions, Code 7.3 is given to investigate the displacements. Code 7.3 is developed for alpha (α) value of zero only. 25 kN

5m 2

4m

5m 3

5

4m 1

4m 4

6

Fig. 7.3 System of plane frame. Table 7.7 Element connectivity for system of plane frame elements Element number Node i Node j

1 2 3 4 5

1 2 3 3 5

Code 7.3: Plane Frame Element A=3*10^(-2); Ia=6*10^(-5); l1=4; l2=5; l3=4;

2 3 4 5 6

95

96

Interval Finite Element Method with MATLAB®

l4= 5; l5= 4; theta1= 90; theta2= 0; theta3= 90; theta4= 0; theta5= 270; % – –––– ––– –––– ––– –––– ––– –––– ––– – % Stiffness matrices of the elements % – –––– ––– –––– ––– –––– ––– –––– ––– – K1= PlaneFrameElementStiffness(200, 220, 0, A, Ia, l1, theta1); K2= PlaneFrameElementStiffness(200, 220, 0, A, Ia, l2, theta2); K3= PlaneFrameElementStiffness(200, 220, 0, A, Ia, l3, theta3); K4= PlaneFrameElementStiffness(200, 220, 0, A, Ia, l4, theta4); K5= PlaneFrameElementStiffness(200, 220, 0, A, Ia, l5, theta5); % – –––– ––– –––– ––– –––– ––– –––– ––– – % Assembling of the stiffness matrices % – –––– ––– –––– ––– –––– ––– –––– ––– – KG= zeros(18,18); KG= PlaneFrameElementAssemble(KG, K1, 1, 2); KG= PlaneFrameElementAssemble(KG, K2, 2, 3); KG= PlaneFrameElementAssemble(KG, K3, 3, 4); KG= PlaneFrameElementAssemble(KG, K4, 3, 5); KG= PlaneFrameElementAssemble(KG, K5, 5, 6); %–– ––– –––– ––– –––– ––– –––– ––– –––– %Boundary conditions %–– ––– –––– ––– –––– ––– –––– ––– –––– K=[KG(4:9,4:9) KG(4:9,13:15);KG(13:15,4:9) KG(13:15,13:15)]; f=[-25;0;0;0;0;0;0;0;0]; % – –––– ––– –––– ––– –––– ––– –––– ––– – % Nodal displacements % – –––– ––– –––– ––– –––– ––– –––– ––– – u=K\f

Using the Code 7.3 for different values of alpha (α), nodal displacements for this system of plane frame elements are obtained. The nodal displacements are given in Table 7.8. Union of these displacements generates the united solution (displacements) of the system. Considering the various displacements in Table 7.8, we may get the interval solution (united solution) that is presented in Table 7.9.

MATLAB® Code for Two-Dimensional Interval Finite Element

97

Table 7.8 Nodal displacements of system of plane frames for different α values α50 α 5 0.2 α 5 0.4 α 5 0.6 α 5 0.8 α51

u4 u5 u6 u7 u8 u9 u13 u14 u15

0.0073 0 0.0019 0.0073 0 0.0016 0.0073 0 0.0019

0.0072 0 0.0019 0.0072 0 0.0016 0.0072 0 0.0018

0.0070 0 0.0018 0.0070 0 0.0016 0.0070 0 0.0018

0.0069 0 0.0018 0.0069 0 0.0015 0.0069 0 0.0018

0.0068 0 0.0017 0.0068 0 0.0015 0.0068 0 0.0017

0.0067 0 0.0017 0.0066 0 0.0015 0.0066 0 0.0017

Table 7.9 United solution for system of plane frame

u4 u5 u6 u7 u8 u9 u13 u14 u15

[0.0073, 0.0067] [0, 0] [0.0017, 0.0019] [0.0073, 0.0066] [0, 0] [0.0016, 0.0015] [0.0073, 0.0066] [0, 0] [0.0017, 0.0019]

7.4 MATLAB® CODE FOR LINEAR TRIANGULAR ELEMENT A linear triangular element is a two-dimensional finite element that consists of three nodes and three sides. It has three nodes having coordinates (x1, y1) , (x2, y2) , (x3, y3) in global Cartesian coordinate system. Each linear triangular element has six degrees of freedom. Here, the order of the nodes plays an important role and the node should be numbered in a counterclockwise direction starting from any node. In the following paragraph, we will discuss various MATLAB® functions used for the linear triangular element (Kattan, 2007; Pratap, 2005).

7.4.1 MATLAB® Functions for Linear Triangular Element 1. LinearTriangularElementArea (xi, yi, xj, yj, xm, ym) This MATLAB® function is used to calculate the area of each linear triangular element. It returns a real crisp value.

Interval Finite Element Method with MATLAB®

98

function y = LinearTriangularElementArea (xi, yi, xj, yj, xm, ym) % LinearTriangularElementArea

This function gives area of the

%

linear triangular element whose first,

%

second and third nodes have coordinates

%

(xi,yi),(xj,yj) and (xm,ym) respectively.

y=(xi*(yj-ym)+xj(ym-yi)+xm*(yi-yj))/2;

2. LinearTriangularElementStiffness (a, b, alpha, NU, t, xi, yi, xj, yj, xm, ym, p) This MATLAB® function calculates the element stiffness matrix K for each linear triangular element having interval modulus of elasticity E, Poisson’s ratio NU, thickness t, and first, second, and third node coordinates (xi, yi), (xj, yj) and (xm, ym), respectively. Here, a and b are the left and the right bounds of interval modulus of elasticity, while alpha belongs to [0, 1]. It gives the element stiffness matrix for plane frame element of size 6  6. function y=LinearTriangularElementStiffness (a,b,alpha,NU,t,xi,yi, xj,yj,xm,ym,p) % LinearTriangularElementStiffness

This function gives element

%

stiffness matrix for a linear

%

triangular element having modulus

%

of elasticity E, Poisson’s ratio

%

NU, thickness t, coordinates of

%

first, second and third nodes

%

(xi,yi), (xj,yj) and (xm,ym)

%

respectively.

%

Here, p= 1 for plane stress and

%

p=2 for plane strain. Further, a

%

and b are the left and right

%

bound of interval modulus of

%

elasticity; Whereas, alpha belongs

%

to [0, 1].

E= a+(b-a)*alpha; A=(xi*(yj-ym)+xj*(ym-yi)+xm*(yi-yj))/2; betai= yj-ym; betaj= ym-yi; betam= yi-yj; gammai= xm-xj;

MATLAB® Code for Two-Dimensional Interval Finite Element

99

gammaj=xi-xm; gammam=xj-xi; B=[betai 0 betaj 0 betam 0;0 gammai 0 gammaj 0 gammam; gammai betai gammaj betaj gammam betam]/(2*A); if p ==1 D=(E/(1-NU^2))*[1 NU 0;NU 1 0;0 0 (1-NU)/2]; end if p ==2 D =(E/((1+ NU)*(1-2*NU)))*[1-NU NU 0;NU 1-NU 0;0 0 (1-2*NU)/2]; end y=t*A*B’*D*B;

3. LinearTriangleElementAssemble (KG, K, i, j, m) This MATLAB® function is used to assemble the elemental stiffness matrix K of the linear triangular element whose nodes are i, j, and m into the global stiffness matrix KG. It gives 2n  2n global stiffness matrix KG. function y = LinearTriangleElementAssemble (KG, K, i, j, m) % LinearTriangleElementAssemble

This function is used to assemble the

%

element stiffness matrix K of the

%

linear triangular element having nodes

%

i, j and m into the global stiffness

%

matrix KG.

KG(2*i-1,2*i-1)=KG(2*i-1,2*i-1)+K(1,1); KG(2*i-1,2*i)=KG(2*i-1,2*i)+K(1,2); KG(2*i-1,2*j-1)=KG(2*i-1,2*j-1)+K(1,3); KG(2*i-1,2*j)=KG(2*i-1,2*j)+K(1,4); KG(2*i-1,2*m-1)=KG(2*i-1,2*m-1)+K(1,5); KG(2*i-1,2*m)=KG(2*i-1,2*m)+K(1,6); KG(2*i,2*i-1)=KG(2*i,2*i-1)+K(2,1); KG(2*i,2*i)=KG(2*i,2*i)+K(2,2); KG(2*i,2*j-1)=KG(2*i,2*j-1)+K(2,3); KG(2*i,2*j)=KG(2*i,2*j)+K(2,4); KG(2*i,2*m-1)=KG(2*i,2*m-1)+K(2,5); KG(2*i,2*m)=KG(2*i,2*m)+K(2,6); KG(2*j-1,2*i-1)=KG(2*j-1,2*i-1)+K(3,1); KG(2*j-1,2*i)=KG(2*j-1,2*i)+K(3,2); KG(2*j-1,2*j-1)=KG(2*j-1,2*j-1)+K(3,3); KG(2*j-1,2*j)=KG(2*j-1,2*j)+K(3,4); KG(2*j-1,2*m-1)=KG(2*j-1,2*m-1)+K(3,5);

100

Interval Finite Element Method with MATLAB®

KG(2*j-1,2*m)=KG(2*j-1,2*m)+K(3,6); KG(2*j,2*i-1)=KG(2*j,2*i-1)+K(4,1); KG(2*j,2*i)=KG(2*j,2*i)+K(4,2); KG(2*j,2*j-1)=KG(2*j,2*j-1)+K(4,3); KG(2*j,2*j)=KG(2*j,2*j)+K(4,4); KG(2*j,2*m-1)=KG(2*j,2*m-1)+K(4,5); KG(2*j,2*m)=KG(2*j,2*m)+K(4,6); KG(2*m-1,2*i-1)=KG(2*m-1,2*i-1)+K(5,1); KG(2*m-1,2*i)=KG(2*m-1,2*i)+K(5,2); KG(2*m-1,2*j-1)=KG(2*m-1,2*j-1)+K(5,3); KG(2*m-1,2*j)=KG(2*m-1,2*j)+K(5,4); KG(2*m-1,2*m-1)=KG(2*m-1,2*m-1)+K(5,5); KG(2*m-1,2*m)=KG(2*m-1,2*m)+K(5,6); KG(2*m,2*i-1)=KG(2*m,2*i-1)+K(6,1); KG(2*m,2*i)=KG(2*m,2*i)+K(6,2); KG(2*m,2*j-1)=KG(2*m,2*j-1)+K(6,3); KG(2*m,2*j)=KG(2*m,2*j)+K(6,4); KG(2*m,2*m-1)=KG(2*m,2*m-1)+K(6,5); KG(2*m,2*m)=KG(2*m,2*m)+K(6,6); y= KG;

Let us introduce the algorithm to write the program of linear triangular element using these MATLAB® functions. Step 1: Discretization of the domain The domain is discretized into a finite number of elements. Then, the element connectivity table is generated. Step 2: Evaluation of element stiffness matrices Element stiffness matrices Ki , i ¼ 1 , 2 , … , n are obtained by using the MATLAB® function “LinearTriangleElementStiffness.” Here, each matrix has size 6  6. Step 3: Evaluation of global stiffness matrix Element stiffness matrices are assembled by using the MATLAB® function “LinearTriangleElementAssemble” and global stiffness matrix is formed. Step 4: Application of boundary conditions Boundary conditions are applied to the global stiffness matrix and a global system of equations are found. Step 5: Solution of system of equations A system of equations (after applying boundary conditions to the global system of equations) are solved.

MATLAB® Code for Two-Dimensional Interval Finite Element

Example 7.4 Consider a thin plate subjected to a uniformly distributed load as shown in Fig. 7.4. The plate is discretized into two linear triangular elements as shown in Fig. 7.4. Here, the interval modulus of elasticity is E ¼ [200, 220] GPa, NU ¼ 0.5, and moment of inertia is Ia ¼ 0.03 m. Next our target is to investigate the displacements at each node. The thin plate (Fig. 7.4) is discretized into two elements. Considering the arrangement of discretized thin plate, a connectivity Table 7.10 is constructed. Here, the nodes i, j, and m are the three vertices (nodes) of the linear triangular element. In Fig. 7.4, nodes 1 and 2 are fixed; hence, the displacements at these nodes are zero. It may be noted that a force P ¼ 10 kN is subjected at nodes 3 and 4, respectively. Now, we are going to investigate the nodal displacements of discretized thin plate. Considering the architecture of the discretized thin plate and these MATLAB® functions, Code 7.4 is given to investigate the displacements. Code 7.4 is developed for the alpha (α) value of zero only.

2

3 10 kN

1

0.3 m

2 1

0.4 m

10 kN 4

Fig. 7.4 Thin plate.

Table 7.10 Element connectivity for thin plate Element number Node i Node j

Node m

1 2

4 3

1 1

Code 7.4: Linear Triangular Element NU=0.5; t=0.03; p=1;

3 2

101

102

Interval Finite Element Method with MATLAB®

% – –––– ––– –––– ––– –––– ––– –––– ––– – % Stiffness matrices of the elements % – –––– ––– –––– ––– –––– ––– –––– ––– – K1= LinearTriangularElementStiffness(E,NU,t,0,0,0.4,0.3,0,0.3,p); K2= LinearTriangularElementStiffne ss(E,NU,t,0,0,0.4,0,0.4,0.3,p); % – –––– ––– –––– ––– –––– ––– –––– ––– – % Assembling of the stiffness matrices % – –––– ––– –––– ––– –––– ––– –––– ––– – KG= zeros(8,8); KG= LinearTriangleElementAssemble(KG, K1, 1, 3, 4); KG= LinearTriangleElementAssemble(KG, K2, 1, 2, 3); %–– ––– –––– ––– –––– ––– –––– ––– –––– %Boundary conditions %–– ––– –––– ––– –––– ––– –––– ––– –––– K=[KG(3:6,3:6)]; f=[10;0;10;0]; % – –––– ––– –––– ––– –––– ––– –––– ––– – % Nodal displacements % – –––– ––– –––– ––– –––– ––– –––– ––– – u=K\f

Using the Code 7.4 for different values of alpha (α), nodal displacements for thin plate are investigated. The nodal displacements are given in Table 7.11. Union of these displacements generates the united solution (displacements) of the system. Now, considering the various displacements in Table 7.11, we may get the final interval solution (united solution) that is presented in Table 7.12.

Table 7.12 United solution for thin plate

u3 u4 u5 u6

[0.4059, 0.4465]  105 [0.1456, 0.1601]  105 [0.3011, 0.3312]  105 [0.0064, 0.0058]  105

u3 u4 u5 u6

0.4465  105 0.1601  105 0.3312  105 0.0064  105

0.4377  105 0.1570  105 0.3247  105 0.0063  105

0.4293  105 0.1540  105 0.3185  105 0.0062  105

α 5 0.6

α 5 0.8

α51

0.4212  105 0.1511  105 0.3125  105 0.0060  105

0.4134  105 0.1483  105 0.3067  105 0.0059  105

0.4059  105 0.1456  105 0.3011  105 0.0058  105

MATLAB® Code for Two-Dimensional Interval Finite Element

Table 7.11 Nodal displacements of thin plate for different α values α50 α 5 0.2 α 5 0.4

103

104

Interval Finite Element Method with MATLAB®

REFERENCES Chapman, S.J., 2007. MATLAB Programming for Engineers, fourth ed. CL Engineering, Toronto. Kattan, P.I., 2007. MATLAB Guide to Finite Elements: An Interactive Approach, second ed. Springer, New York. Nayak, S., Chakraverty, S., 2013. A new approach to solve fuzzy system of linear equations. J. Math. Comput. Sci. 7, 205–212. International Scientific Research Publications. Nayak, S., Chakraverty, S., 2016. Numerical solution of stochastic point kinetic neutron diffusion equation with fuzzy parameters. Nucl. Technol. 193 (3), 444–456. American Nuclear Society. Pratap, R., 2005. Getting Started With MATLAB 7: A Quick Introduction for Scientists and Engineers (The Oxford Series in Electrical and Computer Engineering). Oxford University Press, New York.