# Introduction to Finite Elements CVEN45255525

Gratis

## Draft

7–9 7.5 Duality between the Flexibility and the Stiﬀness Methods . 13–4 13.3 Solution of the Tanscendental Equation for the Buckling Load of a Fixed-HingedColumn .

## MATRIX STRUCTURAL ANALYSIS

7–9 7.5 Duality between the Flexibility and the Stiﬀness Methods . 13–4 13.3 Solution of the Tanscendental Equation for the Buckling Load of a Fixed-HingedColumn .

## Chapter 1 INTRODUCTION

### 1.1 Why Matrix Structural Analysis?

This is essential, as in practice most, if not all, structural analysis are done by the computer and it is imperative that as structural engineers you understand what is inside those “blackboxes”, develop enough self assurance to be capable of opening them and modify them to6 perform certain speciﬁc tasks, and most importantly to understand their limitations. Once the theory and the algorithms are thoroughly explained, you will be expected to program them in either Fortran(preferably 90) or C (sorry, but no Basic) on the computer of your choice.

### 1.2 Overview of Structural Analysis

To put things into perspective, it may be helpful to consider classes of Structural Analysis which are distinguished by: 1. Structure model(a) Global geometry ∂u ) ∂x 1.2 Overview of Structural Analysis1–3 Draft 2 du1 dv 2 dx (b) Structural elements element types: (f) Structural supports: 3.

### 1.3 Structural Idealization

### 15 Prior to analysis, a structure must be idealized for a suitable mathematical representation

Partial collapse or local yielding (would the failure of a single element trigger the failure of the entire structure?). Small or large deformations (In the analysis of a high rise building subjected to wind load, the moments should be ampliﬁed by the product of the axial load times the lateraldeformation, P − ∆ eﬀects).

**1.3.1 Structural Discretization**

Hence, the need to deﬁne two coordinate systems (one for the entire structure, and one for 1–6 INTRODUCTION Draft Group Element MaterialNo. Type Group 1 1 1 2 2 1 3 1 2 Table 1.3: Example of Group Number each element), and a sign convention become apparent.22 1.3.2 Coordinate Systems We should diﬀerentiate between 2 coordinate systems:Global: to describe the structure nodal coordinates. The x-axis is assumed to be along the member, and the direction is chosen such that it points24 from the 1st node to the 2nd node, Fig.

### 1.4 Degrees of Freedom

Hence, it is essential that we understand the degrees of freedom which can be associated with the various types of structures made up of one dimensional rod elements, Table 1.4. for the entire structure: Starting with the 1st node, number all the unrestrained global d.o.f.’s, and then move to the next one until all global d.o.f have been numbered, Fig.

### 1.5 Course Organization

1–12 INTRODUCTION Draft Type Node 1 Node 2 [k] [K](Local) (Global) 1 DimensionalF , M F , M y1 z2 y3 z4 {p}Beam 4 × 4 4 × 4 v 1 , θ 2 v 3 , θ 4 {δ} 2 DimensionalF x1 F x2 {p}Truss 2 × 2 4 × 4 u u 1 2 {δ}F x1 , F y2 , M z3 F x4 , F y5 , M z6 {p}Frame 6 × 6 6 × 6 u , v , θ u , v , θ 1 2 3 4 5 6 {δ}T x1 , F y2 , M z3 T x4 , F y5 , M z6 {p}Grid 6 × 6 6 × 6θ , v , θ θ , v , θ 1 2 3 4 5 6 {δ} 3DimensionalF x1 , F x2 {p}Truss 2 × 2 6 × 6 u , u 1 2 {δ}F x1 , F y2 , F y3 , F x7 , F y8 , F y9 , {p}T M , M T M , M x4 y5 z6 x10 y11 z12 Frame12 × 12 12 × 12 u , v , w , u , v , w , 1 2 3 7 8 9 {δ}θ , θ θ θ , θ θ 4 5 6 10 11 12 Table 1.4: Degrees of Freedom of Diﬀerent Structure Types Systems 1.5 Course Organization1–13 Draft Figure 1.6: Examples of Global Degrees of Freedom 1–14 INTRODUCTION Draft Figure 1.7: Organization of the Course Part I Matrix Structural Analysis of Framed Structures Draft## Chapter 2 ELEMENT STIFFNESS MATRIX

Thus, in deriving the element stiﬀness matrix, we will be reviewing concepts earlier seen.3 The other approach, based on energy consideration through the use of assumed shape func- tions, will be examined in chapter 11. It should be recalled that inﬂuence lines are associated with the analysis of structures sub- jected to moving loads (such as bridges), and that the ﬂexibility and stiﬀness coeﬃcients arecomponents of matrices used in structural analysis.

### 2.3 Flexibility Matrix (Review)

Considering the simply supported beam shown in Fig. Here, both the external virtual force and moment are usualy taken as unity.

### 2.4 Stiffness Coefficients

In the ﬂexibility method, we have applied a unit force at a time and determined all the10 induced displacements in the statically determinate structure. (2.8)11 {p} = [k]{δ}Hence k will correspond to the reaction at dof i due to a unit deformation (translation or ij12 rotation) at dof j, Fig.

### 2.5 Force-Displacement Relations

14 2.5.1 Axial Deformations From strength of materials, the force/displacement relation in axial members isσ = Eǫ AEAσ = ∆ (2.9) L P 1 AE Hence, for a unit displacement, the applied force should be equal to . V = V (v , θ , v , θ ) (2.10-a) 1 1 1 1 2 2 M = M (v , θ , v , θ ) (2.10-b) 1 1 1 1 2 2 V = V (v , θ , v , θ ) (2.10-c) 2 2 1 1 2 2 M = M (v , θ , v , θ ) (2.10-d)16 2 2 1 1 2 2 We start from the diﬀerential equation of a beam, Fig.

### 2 V =

V (2.17) 1 2 1 = −V21 LSubstituting V into the expressions for θ and v in Eq. 2.15 and rearranging 1 2 z z 2 2EI 2EI M = θ θ 1 2 1 2 − M − L L (2.18) 6EI z 6EI z 6EI z 2M = + θ v v 1 2 12 12 2 − M − L22 L L Solving those two equations, we obtain: 2EI 6EI z z M = (2θ + θ ) + (v ) (2.19) 1 1 2 1 2 − v 2 L L 2EI z 6EI zM = (θ + 2θ ) + (v ) (2.20) 2 1 2 1 2 − v 223 L L Finally, we can substitute those expressions in Eq.

**2.5.3 Torsional Deformations**

Since torsional eﬀects are seldom covered in basic structural analysis, and students may have forgotten the derivation of the basic equations from the Strength of Material25 course, we shall brieﬂy review them. 2.5 we have:ρ T = τ dA ρ (2.23) max A carea armstress F orcetorque τ max 2 = ρ dA (2.24) c A J T cτ max = (2.25)J M c Note the analogy of this last equation with σ = .z I26 2 ρ dA is the polar moment of inertia J.

**2.5.4 Shear Deformation**

### 30 In general, shear deformations are quite small. However, for beams with low span to depth

2.6 and for linear elastic ma- terial, the shear strain (assuming small displacement, i.e. tan γ ≈ γ) is given bydv τ s = (2.30) tan γ ≈ γ =dx G Kinematics M aterial dv s where is the slope of the beam neutral axis from the horizontal while the vertical sections dx remain undeformed, G is the shear modulus, τ the shear stress, and v s the shear induced32 displacement. 2.21 and setting θ = 1 and θ = v = v = 0, or V = .

### 2.6 Putting it All Together, [k]

At this point, and keeping inmind the deﬁnition of degrees of freedom, we seek to assemble the individual element stiﬀness matrices [k]. We shall start with the simplest one, the truss element, then consider the beam,40 2D frame, grid, and ﬁnally the 3D frame element.

**2.6.1 Truss Element**

### 41 The truss element (whether in 2D or 3D) has only one degree of freedom associated with

each node. Hence, from Eq.

**2.6.2 Beam Element**

Due to translation, we must divide (or normalize) the coeﬃcients of the ﬁrst and third columns of the stiﬀness matrix by 1 + Φ so that the net translation at both ends is unity. 2.19(v θ 2 v 1 θ 1 v ] = b [k 1 2 ] = 2 Eq. 2.20(v b (2.44)44 The stiﬀness matrix of the beam element (neglecting shear and axial deformation) will thus be[k = 1) 2 = 1) Eq.

### 2 L 1 + Φ

4EI 6EI 1 (2.48-c) 1 (−0.5ΦL) 2 L L 1 + Φ Due to Unit Rotation bt v s Due to Parasitic Shear k21 4 + Φ EI= (2.48-d) 1 + Φ L 2EI 6EI 1 M + =(2.48-e) 2 (−0.5ΦL) 2 L L 1 + Φ Due to Unit Rotation bt v s Due to Parasitic Shear k21 EI 2 − Φ= (2.48-f) 1 + Φ L 2.6 Putting it All Together, [k]2–1746 Thus, the element stiﬀness matrix given in Eq. 2 bV ] = v 1 θ 1 v θ 6EI z L2 (1+Φ y ) (4+Φ y )EI z(1+Φ y )L 2 V 1 12EI z L3 (1+Φ y ) 6EI z L2 (1+Φ y ) − 12EI z L3 (1+Φ y ) 6EI z L2 (1+Φ y ) M 1 t [k b k b 11 k b 12 k b 13 b 1 14 M 1 k b 21 k b 22 k k 12 V 2df r u ] = u 1 v 1 θ 1 2 t v 2 θ 2 P 1 k t 11 k and ﬂexure must be modiﬁed in accordance with Eq.

**2.6.4 Grid Element**

### 49 The stiﬀness matrix of the grid element is very analogous to the one of the 2D frame element

2.29 u b 2 β 2 α 1 u 1 β 1 α −k 12 except that the axial component is replaced by the torsional one. Hence, the stiﬀness matrix is[k b 44 −kb b k 34 b 31 −kb k 32 b −k 2 43 V k k 41 b 42 −kb k 2 M 2 Eq.

### 50 Note that if shear deformations must be accounted for, the entries corresponding to shear

[k 22 V y2 14 34 V z2 0 k b13 −k b b k 33 b k 14 b k 13 b k t b 33 −kb k 21 t k 24 P x2 b k 12 b 22 −kb k 21 b k 24 M z1 k 34 T x2 k b and ﬂexure must be modiﬁed in accordance with Eq. 2.49 2.6.5 (2.54) 44 b k 43 b k 24 b k 12 −k k 44 M z2 b k 43 b 24 −kb k 12 b k 22 M y2 g k 12 g b 12 3df r 2 11 t P x1 k z2 θ y2 θ x2 θ 2 w 2 v u t z1 θ y1 θ x1 3D Frame Element 1 w 1 v 1 u ] = k 21 V y1 b 14 T x1 k 22 b k 32 b k 12 M y1 g k 11 g k b 13 −kb k k 12 b 11 −kb 14 V z1 0 k b k 13 b k 12 b k 11 b θ 2.7 Remarks on Element Stiﬀness Matrices 2–19For [k 3D 11 ] and with we obtain: [k3 df r ] = P u 1 v 1 w 1 θ x1 θ y1 θ z1 u 2 v 2 w 2 θ x2 θ y2 θ z2 x1 EA l − EA LV y112 EIz L36 EIz L 2 −12 EIz L36 EIz L2 V z112 EIy L 3 −6 EIy L 2 −12 EIy L 3 −6 EIy LGIx 2 T x1 L − GIx L M y1 −6 EIy L24 EIy L6 EIy L2M 2 EIy L z16 EIz L24 EIz L −6 EIz L2P 2 EIz L x2 − EA L EA LV y2 −12 EIz L 3 −6 EIz L212 EIz L 3 −6 EIz L− 2 V z212 EIy L36 EIy L212 EIy L36 EIy L− 2 T x2 GIx L GIx L M y2 −6 EIy L22 EIy L6 EIy L2M 4 EIy L z26 EIz L22 EIz L −6 EIz L24 EIz L (2.55)51 Note that if shear deformations must be accounted for, the entries corresponding to shear and ﬂexure must be modiﬁed in accordance with Eq. 2.49### 2.7 Remarks on Element Stiffness Matrices

For example in the beam element,row 4 = −row 1; and L times row 2 is equal to the sum of row 3and 6. This singularity(not present in the ﬂexibility matrix) is caused by the linear relations introduced by the equilibrium equations which are embedded in the formulation.

## Chapter 3 STIFFNESS METHOD; Part I: ORTHOGONAL STRUCTURES

In the previous chapter our starting point was basic displacement-force relations resulting in element stiﬀness matrices [k].4 In this chapter, our starting point are those same element stiﬀness matrices [k], and our objective is to determine the structure stiﬀness matrix [K], which when inverted, would yield5 the nodal displacements.6 The element stiﬀness matrices were derived for fully restrained elements. Then the method will be generalizedin chapter 5 to describe an algorithm which can automate the assembly of the structure global stiﬀness matrix in terms of the one of its individual elements.

### 3.2 The Stiffness Method

### 8 As a “vehicle” for the introduction to the stiﬀness method let us consider the problem in Fig

We then determine the ﬁxed end actions caused by the element load, and sum them for each d.o.f., Fig 3.1-c: ΣFEM 1 and ΣFEM 2 . Apply a unit load at point B, and then C, and compute the deﬂections f 3–2 STIFFNESS METHOD; Part I: ORTHOGONAL STRUCTURES 3.1-a, and recognize that there are only two unknown displacements, or more precisely, two global d.o.f: θ 1 and θ 2 .9 If we were to analyse this problem by the force (or ﬂexibility) method, then 1.

### 1 M

θ and θ 1 2 3–4 STIFFNESS METHOD; Part I: ORTHOGONAL STRUCTURES Draft11 Note that the FEM being on the right hand side, they are detemined as the reactions to the applied load. Strictly speaking, it is a load which should appear on the left hand side of the12 equation, and are the nodal equivalent loads to the element load (more about this later).

### 3.3 Examples

If we now rotate dof 2 by a unit angle, then we will have K = (k ) and K = 22 12 22 L L BC (k ) . We ﬁrst identify the three degrees of freedom, θ , ∆ , and θ .

## AB GJ AB AB

(a) AB (Torsion) K = , K = 0, K = 0 11 21 31 L BC 4EI BC 6EI BC (b) BC (Flexure) K = , K = 2 , K = 0 11 21 31 L L 4. 12EI 6EI AB AB AB (a) AB (Flexure): K = 0, K = , K32 12 22 32 = − L LBC 6EI BC 12EI BC (b) BC (Flexure): K = , K = , K = 022 12 22 32 L L 5.

## AB AB

6EI AB 4EI (a) AB (Flexure): K = 0, K 2 , K = 13 23 = − 33 L L GJ BC BC BC (b) BC (Torsion): K = 0, K = 0, K = 13 23 4. The structures stiﬀness matrix will now be assembled: GJ 4EI 6EI K K K2 11 12### 13 L L L

Note these operations shouldbe accomplished in local coordinate system, and great care should be exercized in writing the nodal displacements in the same local coordinate system as the one used for the derivation ofthe element stiﬀness matrix, Eq. Those questions, and others, will be addressed in the next chapters which will outline the general algorithm for the direct stiﬀness method.

### 3.4 Observations

### 13 On the basis of these two illustrative examples we note that the global structure equilibrium

### 3. How to determine the {FEA} or the nodal equivalent load for an element load?

3–14 STIFFNESS METHOD; Part I: ORTHOGONAL STRUCTURES Draft Draft## Chapter 4 TRANSFORMATION MATRICES

### 4.1 Derivations

e e1 4.1.1 [k ] [K ] Relation In the previous chapter, in which we focused on orthogonal structures, the assembly of the e structure’s stiﬀness matrix [K ] in terms of the element stiﬀness matrices was relatively straight-2 forward. The determination of the element stiﬀness matrix in global coordinates, from the element3 stiﬀness matrix in local coordinates requires the introduction of a transformation.

**4.1.2 Direction Cosines**

The problem confronting us is the general transfoormation of a vector V from (X, Y, Z) coordinate system to (X, Y, Z), Fig. 4.2, l = cos α; l = cos β, and l = cos γ or xX xY xZ V = V cos α + V cos β + V cos γ (4.11)12 x X Y Z Recalling that the dot product of two vectors: (4.12)A · : B = |A|.|B| cos α A, and α is the angle between the two vectors.

### 13 If we use indecis instead of cartesian system, then direction cosines can be expressed as

V x = V X l 11 + V Y l 12 + V Z l 13 (4.16) or by extension: V l l l V x 11 12 13 X V = l l l V (4.17) y 21 22 23 Y V l l l V z 31 32 33 Z [ γ ] Alternatively, [γ] is the matrix whose columns are the direction cosines of x, y, z with respect to X, Y, Z: l l l 11 21 31 T [γ] = l l l (4.18) 12 22 32 l l l 13 23 33 The transformation of V can be written as: (4.19){v} = [γ] {V} where: {v} is the rotated coordinate system and {V} is in the original one. 4.1 Derivations4–5 Draft14 Direction cosines are unit orthogonal vectors 3 l l = 1 i = 1, 2, 3(4.20) ij ij j=1 i.e: 2 2 2 l + l + l = 1 (4.21) 11 12 13 2 2 2 cos α + cos β + cos γ = 1 = δ (4.22) 11 and 3 i = 1, 2, 3 l l = 0 k = 1, 2, 3 (4.23) ij kj j=1 i = k l l + l l + l l = 0 = δ (4.24) 11 21 12 22 13 23 1215 T T T By direct multiplication of [γ] and [γ] it can be shown that: [γ] =[γ] = [I] ⇒ [γ] −1 [γ]16 ⇒ [γ] is an orthogonal matrix. The reverse transformation (from local to global) would be T (4.25)17 {V} = [γ] {v}Finally, recalling that the transofrmation matrix [γ] is orthogonal, we have: V l l l V X xX yX zX x V = l l l V (4.26) Y xY yY xY y V l l l V Z xZ yZ zZ z−1 T [ γ ] =[ γ ]### 4.2 Transformation Matrices For Framework Elements

### 18 The rotation matrix, [Γ], will obviously vary with the element type. In the most general case

[γ][γ] [ Γ ] F X1 F Y 1 F Z1 M X1 M Y 1 M Z1 F X2 F Y 2 F Draft M X2 M Y 2 M Z2 (4.27) and should distinguish between the vector transformation [γ] and the element transformationmatrix [Γ].19 In the next sections, we will examine the transformation matrix of each type of element. 4.2.1 [γ][γ] Z2 = z1 4–6TRANSFORMATION MATRICES (3D element, 6 d.o.f. per node), we would have to deﬁne: F x1F y1 F z1 M x1M y1 M F z2 x2 F y2 F z2 M x2 M y2 M ### 2 D cases

We can start with the ﬁrst row of the transformation matrix which corresponds to the direction cosines of the reference axis (X , Y , Z ) with respect to X . This will deﬁne the 1 1 1 2 ﬁrst row of the vector rotation matrix [γ]: C C C X Y Z [γ] = l l l (4.32) 21 22 23 l l l 31 32 33!x j i y j i z j i −x −y −z 2 2 2 where C = , C = , C = , L = (x ) + (y ) + (z ) .

## Chapter 5 STIFFNESS METHOD; Part II

### 1 The direct stiﬀness method, covered in Advanced Structural Analysis is brieﬂy reviewed in this lecture

(c) Number of material properties S 1. Identify type of structure (Plane stress/strain/Axisymmetric/Plate/Shell/3D) and determine the(a) Number of spatial coordinates (1D, 2D, or 3D)(b) Number of degree of freedom per node 5. Assemble load vector {P}1 More about these operations in chapter C. 4. For traction, body forces, determine the nodal equivalent load. 1 . where [L] is a lower triangle matrix T ] = [L][L] ] into [K 2. Determine the global unrestrained degree of freedom equation numbers for each node, to be stored in the [ID] matrix.Analysis : 2 A slightly diﬀerent algorithm will be used for the assembly of the global stiﬀness matrix.Preliminaries: First we shall 3. Decompose [K S ] of unconstrained degree of freedom’s. 2. Assemble the structure stiﬀness matrix [K ]. This may require a numerical integration e (b) Element stiﬀness matrix [K 1. For each element, determine (a) Vector LM relating local to global degree of freedoms. S 5–2STIFFNESS METHOD; Part II Draft 6. Backsubstitute and obtain nodal displacements 7. For each element, determine strain and stresses. 8. For each restrained degree of freedom compute its reaction from # of elem. [K i {R} = Σ ]{∆}3 i=1 Some of the prescribed steps are further discussed in the next sections. 5.24 [ID] Matrix Because of the boundary condition restraints, the total structure number of active degrees of freedom (i.e unconstrained) will be less than the number of nodes times the number of degrees5 of freedom per node. To obtain the global degree of freedom for a given node, we need to deﬁne an [ID] matrix such that: ID has dimensions l × k where l is the number of degree of freedom per node, and k is thenumber of nodes). ID matrix is initialized to zero. 1. At input stage read ID(idof,inod) of each degree of freedom for every node such that: if unrestrained d.o.f. ID (idof, inod) =(5.1) 1 if restrained d.o.f. 2. After all the node boundary conditions have been read, assign incrementally equation numbers(a) First to all the active dof (b) Then to the other (restrained) dof. (c) Multiply by -1 all the passive dof.Note that the total number of dof will be equal to the number of nodes times the number of dof/node NEQA. 3 . The largest positive global degree of freedom number will be equal to NEQ (Number Of6 Equations), which is the size of the square matrix which will have to be decomposed. For example, for the frame shown in Fig. 5.1: 1. The input data ﬁle may contain: 5.3 LM Vector5–3 DraftT Node No. [ID] 1 0 0 02 1 1 0 3 0 0 04 1 0 0 2. At this stage, the [ID] matrix is equal to: 0 1 0 1 ID = 0 1 0 0 (5.2) 0 0 0 0 3. After we determined the equation numbers, we would have: 1 −10 5 −12 ID = 8 (5.3) 2 −11 6 3 4 7 9 5.37 LM Vector The LM vector of a given element gives the global degree of freedom of each one of the element degree of freedom’s. For the structure shown in Fig. 5.1, we would have:⌊LM⌋ = ⌊ −10 −11 4 5 6 7 ⌋ element 1 (2 → 3)⌊LM⌋ = ⌊ 5 6 7 1 2 3 ⌋ element 2 (3 → 1)⌊LM⌋ = ⌊ 1 2 3 −12 8 9 ⌋ element 3(1 → 4)8### 5.4 Assembly of Global Stiffness Matrix

5–4STIFFNESS METHOD; Part II Draft13 Because each term of all the element stiﬀness matrices must ﬁnd its position inside the global stiﬀness matrix [K], it is found computationally most eﬀective to initialize the global stiﬀness S matrix [K ] to zero, and then loop through all the elements, and then through N EQA×NEQA e each entry of the respective element stiﬀness matrix K . ij14e The assignment of the element stiﬀness matrix term K (note that e, i, and j are all known ij since we are looping on e from 1 to the number of elements, and then looping on the rows and S columns of the element stiﬀness matrix i, j) into the global stiﬀness matrix K is made through kl15 the LM vector (note that it is k and l which must be determined).

### 18 From this example problem, we note that:

### 5.5 Skyline Storage of Global Stiffness Matrix, MAXA Vector

### 19 The stiﬀness matrix of a structure will be a square matrix of dimension NEQxNEQ

5.5 Skyline Storage of Global Stiﬀness Matrix, MAXA Vector 5–7 Draft Figure 5.3: Example of BandwidthFigure 5.4: Numbering Schemes for Simple Structure 5–8STIFFNESS METHOD; Part II23 In the following global stiﬀness matrix, the individual entries which must be stored in the global stiﬀness matrix are replaced by their address in the vector representation of this samematrix. Following matrix decomposition, all zero terms outside the skyline terms remain zero, and all others are altered.

### 5.6 Augmented Stiffness Matrix

those on Γ t . (5.12) 5–20STIFFNESS METHOD; Part II Draft Figure 5.6: ID Values for Simple Beam 50kN 4 kN/m11118 m 000 111 7.416 m 000 111 000 111 111 000 000 111 3 m 8 m Figure 5.7: Simple Frame Anlysed with the MATLAB Code .

**5.7.3 Assembly**

Loop backward from the last column to the ﬁrst, and for each one determine the address of the diagonal term from MAXA(IEQ) = MAXA(IEQ + 1) − MAXA(IEQ)36 Once the MAXA vector has been determine, then term K(i, j) in the square matrix, would be stored in KK(MAXA(j)+j-i) (assuming j > i) in the compacted form of {K}.37 The assembly of the global stiﬀness matrix is next described, Fig. Since the matrix is both symmetric and positive T deﬁnite, the matrix can be decomposed using Cholesky’s method into: [K] = [L][L] .

### 5.8 Computer Implementation with MATLAB

You will be required, as part of your term project, to write a simple MATLAB (or whatever other language you choose) program for the analysis of two dimensional frames with nodal loadand initial displacement, as well as element load.43 To facilitate the task, your instructor has taken the liberty of taking a program written byMr. Dean Frank (as part of his term project with this instructor in the Advanced StructuralAnalysis course, Fall 1995), modiﬁed it with the aid of Mr.

**5.8.1 Program Input**

The number of rows in the matrix correspond with the number of nodes in thestructure and the number of columns corresponds with the number of degrees of freedom for each node for that type of structure type. E is the modulus of elasticity, A is the cross-sectional area, Iy is the moment of inertia about the y axes Pnods This is an array of nodal loads in global degrees of freedom.

**5.8.2 Program Listing**

M% %MAIN FILE : CASAP% %Description : This file re-assambles the ID matrix such that the restrained% degrees of freedom are given negative values and the unrestrained % degrees of freedom are given incremental values begining with one% and ending with the total number of unrestrained degrees of freedom.% % By Dean A. M SCRIPTFILE 5.8 Computer Implementation with MATLAB 5–45 Draft 5.8.2.4 Element Lengths %********************************************************************************************** % Scriptfile name : length3.m (for 2d-frame structures)% % Main program : casap.m% % When this file is called, it computes the length of each element and the% angle alpha between the local and global x-axes.

## XXXXXXXXXXXXXXXXXXXXXX COMPLETE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

5.8 Computer Implementation with MATLAB 5–53 Draft% PRINT DISPLACEMENTS WITH NODE INFO fprintf(fid,’ Displacements:\n’);for k=1:size(Delta,1) %WORK BACKWARDS WITH LM MATRIX TO FIND NODE# AND DOF LM_spot=find(LM’==k); elem=fix(LM_spot(1)/(nterm+1))+1;dof=mod(LM_spot(1)-1,nterm)+1; node=lnods(elem,fix(dof/4)+1);switch(dof) case {1,4}, dof=’delta X’;case {2,5}, dof=’delta Y’; otherwise, dof=’rotate ’;end %PRINT THE DISPLACEMENTSfprintf(fid,’ (Node: %2d %s) %14d\n’,node, dof, Delta(k)); endfprintf(fid,’\n’); % END OF DISP3.M SCRIPTFILE 5.8.2.12 Reactions %********************************************************************************************** % Scriptfile name : react3.m (for 2d-frame structures)% % Main program : casap.m% % When this file is called, it calculates the reactions at the restrained degrees of% freedom.% % Variable Descriptions:% % Reactions = Reactions at restrained degrees of freedom% Kut = Upper left part of aug stiffness matrix, normal structure stiff matrix % Delta = vector of displacements% fea_vector_react = vector of fea’s in restrained dofs %% % By Dean A. Frank% CVEN 5525 - Term Project % Fall 1995% % Edited by Pawel Smolarkiewicz, 3/16/99% Simplified for 2D Frame Case only %%********************************************************************************************** % CALCULATE THE REACTIONS FROM THE AUGMENTED STIFFNESS MATRIX 5–54STIFFNESS METHOD; Part II DraftReactions= XXXXXXXXXXXXXXXXXXXXXX COMPLETE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX fprintf(fid,’ Reactions:\n’);for k=1:size(Reactions,1) %WORK BACKWARDS WITH LM MATRIX TO FIND NODE# AND DOF LM_spot=find(LM’==-k); elem=fix(LM_spot(1)/(nterm+1))+1;dof=mod(LM_spot(1)-1,nterm)+1; node=lnods(elem,fix(dof/4)+1);switch(dof) case {1,4}, dof=’Fx’;case {2,5}, dof=’Fy’; otherwise, dof=’M ’;end %PRINT THE REACTIONSfprintf(fid,’ (Node: %2d %s) %14d\n’,node, dof, Reactions(k)); endfprintf(fid,’\n’); % END OF REACT3.M SCRIPTFILE 5.8.2.13 Internal Forces %********************************************************************************************** % Scriptfile name : intern3.m (for 2d-frame structures)% % Main program : casap.m% % When this file is called, it calculates the internal forces in all elements% freedom.% % By Pawel Smolarkiewicz, 3/16/99% Simplified for 2D Frame Case only %%********************************************************************************************** Pglobe=zeros(6,nelem);Plocal=Pglobe; fprintf(fid,’ Internal Forces:’);%LOOP FOR EACH ELEMENT for ielem=1:nelem %FIND ALL 6 LOCAL DISPLACEMENTS elem_delta=zeros(6,1);for idof=1:6 gdof=LM(ielem,idof);if gdof<0 elem_delta(idof)= XXXXXXXXXXXXXXXXXXXXXX COMPLETE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX elseelem_delta(idof)= 5.8 Computer Implementation with MATLAB 5–55 Draft XXXXXXXXXXXXXXXXXXXXXX COMPLETE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX endend %SOLVE FOR ELEMENT FORCES (GLOBAL)Pglobe(:,ielem)=K(:,:,ielem)*elem_delta+feamatrix_global(:,ielem); %ROTATE FORCES FROM GLOBAL TO LOCAL COORDINATES%ROTATE FORCES TO LOCAL COORDINATES Plocal(:,ielem)= XXXXXXXXXXXXXXXXXXXXXX COMPLETE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX %PRINT RESULTSfprintf(fid,’\n Element: %2d\n’,ielem); for idof=1:6if idof==1 fprintf(fid,’ At Node: %d\n’,lnods(ielem,1));end if idof==4fprintf(fid,’ At Node: %d\n’,lnods(ielem,2)); endswitch(idof) case {1,4}, dof=’Fx’;case {2,5}, dof=’Fy’; otherwise, dof=’M ’;end fprintf(fid,’ (Global : %s ) %14d’,dof, Pglobe(idof,ielem));fprintf(fid,’ (Local : %s ) %14d\n’,dof, Plocal(idof,ielem)); endend fprintf(fid,’\n_________________________________________________________________________\n\n’); 5.8.2.14 Sample Output File CASAP will display ﬁgure 5.16. Number of Nodes: 3 Number of Elements: 2Number of Load Cases: 1 Number of Restrained dofs: 6Number of Free dofs: 3 Node Info: Node 1 (0,0) Free dofs: none; node is fixedNode 2 (7416,3000) Free dofs: X Y RotNode 3 (15416,3000) Free dofs: none; node is fixed Element Info: Element 1 (1->2) E=200 A=6000 Iz=200000000 5–56STIFFNESS METHOD; Part II Draft 6000 80004000 200011223 −6000 −4000 −2000 2000 4000 6000 8000 10000 12000 14000 16000 Figure 5.16: Structure Plotted with CASAP Element 2 (2->3) E=200 A=6000 Iz=200000000 _________________________________________________________________________Load Case: 1 Nodal Loads: Node: 2 Fx = 1.875000e+001 Node: 2 Fy = -4.635000e+001 Elemental Loads:Element: 1 Point load = 0 at 0 from left Distributed load = 0Element: 2 Point load = 0 at 0 from left Distributed load = 4.000000e-003 Displacements: (Node: 2 delta X) 9.949820e-001(Node: 2 delta Y) -4.981310e+000 (Node: 2 rotate ) -5.342485e-004 Reactions: (Node: 1 Fx) 1.304973e+002 (Node: 1 Fy) 5.567659e+001 (Node: 1 M ) 1.337416e+004 (Node: 3 Fx) -1.492473e+002 (Node: 3 Fy) 2.267341e+001 (Node:### 3 M ) -4.5557e+004

Draft 5.8 Computer Implementation with MATLAB 5–57 Internal Forces: Element: 1 At Node: 1 (Global : Fx ) 1.304973e+002 (Local : Fx ) 1.418530e+002(Global : Fy ) 5.567659e+001 (Local : Fy ) 2.675775e+000 (Global : M ) 1.337416e+004 (Local : M ) 1.337416e+004 At Node: 2 (Global : Fx ) -1.304973e+002 (Local : Fx ) -1.418530e+002(Global : Fy ) -5.567659e+001 (Local : Fy ) -2.675775e+000 (Global : M ) 8.031549e+003 (Local : M ) 8.031549e+003 Element: 2 At Node: 2 (Global : Fx ) 1.492473e+002 (Local : Fx ) 1.492473e+002(Global : Fy ) 9.326590e+000 (Local : Fy ) 9.326590e+000 (Global : M ) -8.031549e+003 (Local : M ) -8.031549e+003 At Node: 3 (Global : Fx ) -1.492473e+002 (Local : Fx ) -1.492473e+002(Global : Fy ) 2.267341e+001 (Local : Fy ) 2.267341e+001 (Global : M ) -4.535573e+004 (Local : M ) -4.535573e+004 _________________________________________________________________________ 5–58STIFFNESS METHOD; Part II Draft Draft## Chapter 6 EQUATIONS OF STATICS and KINEMATICS Note: This section is largely based on chapter 6 of Mc-Guire and Gallagher, Matrix Structural

6.13 Statics Matrix [B] The statics matrix [B] relates the vector of all the structure’s {P} nodal forces in global coordinates to all the unknown forces (element internal forces in their local coordinate systemand structure’s external reactions) {F}, through equilibrium relationships and is deﬁned as: (6.1)4 {P} ≡ [B] {F}[B] would have as many rows as the total number of independent equations of equilibrium; and as many columns as independent internal forces. Assumingall the element forces to be tensile, and the reactions as shown in the ﬁgure, the equilibrium equations are: = 0Table 6.1: Internal Element Force Deﬁnition for the Statics Matrix of independent element internal forces which can be selected.6 Matrix [B] will be a square matrix for a statically determinate structure, and rectangular (more columns than rows) otherwise.