Content uploaded by Daniele Kauctz Monteiro

Author content

All content in this area was uploaded by Daniele Kauctz Monteiro on Apr 18, 2023

Content may be subject to copyright.

Development of a computational routine in Fortran language for analysis

of plane and space trusses using the ﬁnite element method

Lucas A. de Aguiar1, Marcos B. Guimar˜

aes1, Daniele K. Monteiro1, Patrick de O. B. da Costa1

1Department of Civil Engineering, Federal University of Rio Grande do Sul

Av. Osvaldo Aranha 99, 99, 90035-190, Rio Grande do Sul, Brazil

lucas.a.aguiar@hotmail.com, bressan.marcos@hotmail.com,

danielekauctz@hotmail.com, ecivilpatrick@yahoo.com

Abstract. Computational tools applied to the teaching and learning of structural analysis have been increasingly

developed and improved to optimize computational time and cost. The method to solve the analysis, the language

to be chosen, the organization of the algorithm, as well as the programming paradigm adopted, are factors that

must be taken into account in numerical analysis. Thus, this paper aims to study the behavior of 2D and 3D trusses

in the linear-elastic range using a code developed with Fortran programming language, showing the importance

of computational application and numerical methods in civil engineering. To solve this problem, the bar ﬁnite

element formulation was used. Three different benchmark examples were analyzed and veriﬁed with a commercial

software, one plane truss and one space truss. The results of these structures in stresses and displacements were

compared with MASTAN2, proving the efﬁciency of the built algorithms to solve the studied problems.

Keywords: Trusses, Fortran, FEM.

1 Introduction

The advancement of technology and the development of numerical methods have been gaining more and

more space in the ﬁeld of structures, both in engineering ofﬁces and in pedagogical education. Among the main

reasons that can be highlighted are the use of open source, the possibility of greater cooperation and integration

between projects and disciplines, the versatility of the code, and the greater security for the proposed solutions. In

this context, the computationally implemented ﬁnite element method (FEM) becomes a powerful tool with wide

application in Structural Engineering. This method proposes to simulate the behavior of a real structure through a

geometrical discratization of the proposed problem, where the results can be approximated numerically [1].

Trusses are an example of a structure widely used in civil construction and easy to implement numerically.

This type of system is a viable solution for large spans due to its: high stiffness with reduced weight; high degree

of hyperasticity with excellent effort redistribution; and easiness of transport and assembly. According to Martha

[2], both plane and space trusses are considered reticulated structures, i.e., the bars are designed only to work under

axial tensile and/or compression forces.

Thus, this work aims to study the behavior of 2D and 3D trusses in the linear-elastic range using a code de-

veloped with the FORTRAN programming language. Consequently, the importance of computational application

and numerical methods in educational practice is shown, using ﬁnite element method.

2 Finite element formulation for trusses

The proposed problems are solved through the adoption of bar elements, using a computational routine in

FORTRAN based on the Displacement Method. To analyze these systems, it is necessary to: deﬁne the element

associated with the problem and the global reference system, identify the members by name and their respective

connectivity, and specify the material properties and their cross-section.

With these predeﬁned data and knowing the restrictions of the degrees of freedom (DOF), it is possible to

calculate the stiffness matrix and the load vector of each element. Therefore, by applying the boundary conditions

and solving the equilibrium equation, the generalized displacements of the nodes are obtained and the stresses on

CILAMCE-2022

Proceedings of the XLIII Ibero-Latin-American Congress on Computational Methods in Engineering, ABMEC

Foz do Iguac¸u, Brazil, November 21-25, 2022

Development of a computational routine in Fortran language for analysis of plane and space trusses using the ﬁnite element method

the members are calculated. In the following subsections, the formulation for plane (2D) and space (3D) trusses

will be detailed.

2.1 Plane trusses

To formulate the equilibrium equation, the simple example of the spring can be used, mainly because this

element only transmits axial forces as well as trusses. Consider a spring subjected to an external pulling force (F).

Note that the internal force of the spring can be expressed by the product of the stiffness coefﬁcient (k)and the

displacement (u), thus, deﬁning the generic equilibrium equation ku =F(see Filho [3]).

According to Filho [3], analogous to the spring problem, the generic equilibrium equation can be extended

to plane truss bars, according to the scheme in Fig. 1, where the coefﬁcient kis the axial stiffness of the bar with

k=EA/L.

,,E A L

i

j

L

j

u

L

i

u

L

i

Fx

L

j

Fx

L

y

L

x

Figure 1. Plane truss bar equilibrium diagram

Filho [3] and Soriano [4] detail the procedures and equations described below related to the Displacement

Method. In summary, a unitary and positive displacement is applied at node “i”, i.e., uL

i= 1 and the node “j”is

blocked. Thus, the load that causes the displacement (F xL

i)and the respective reaction in “j” (F xL

j)are given by

the set of expressions in eq. (1).

F xL

i=EA

LuL

i=EA

L=kii;F xL

j=−EA

L=kji (1)

Applying a positive unit displacement at node “j”and blocking node “i”, in the same way as shown in

eq. (1), the terms kjj and kij are obtained. Therefore, a generic term kij indicates the action of node “i”due to a unit

displacement at node “j”. As stated by the theorems of Betti and Maxwell kij =kji, where kii and kjj are always

positive. Hence, the set of expressions in eq. (2) express a general case of forces F xL

iand F xL

j, and displacements

uL

iand uL

j.

F xL

i=−EA

L∆Li=−EA

LuL

j−uL

i;F xL

j=−EA

L∆Lj=EA

LuL

j−uL

i(2)

This can also be expressed in matrix form, according to eq. (3).

EA

L

1−1

−1 1

·

uL

i

uL

j

=

kii kij

kji kjj

·

uL

i

uL

j

=

F xL

i

F xL

j

(3)

Since truss elements only transmit axial forces, and no forces or displacements acting in the yLdirection, the

matrix expression that represents the equilibrium of bars can be described by eq. (4) when referring to local axes.

Where uL

iand vL

iare displacements on the x-axis and the y-axis.

EA

L

1 0 −1 0

0 0 0 0

−1 0 1 0

0 0 0 0

·

uL

i

vL

i

uL

j

vL

j

=

F xL

i

0

F xL

j

0

(4)

CILAMCE-2022

Proceedings of the XLIII Ibero-Latin-American Congress on Computational Methods in Engineering, ABMEC

Foz do Iguac¸u, Brazil, November 21-25, 2022

L. A. Aguiar, M. B. Guimar˜

aes, D. K. Monteiro, P. O. B. Costa

Similar to the generic expression ku =F, one can write the matrix equilibrium equation for plane truss

elements (eq. (4)) in a compact form, as presented in eq. (5), where mindicates the number of the bar, Lrepresents

the local system, and K

˜,U

˜and P

˜are the stiffness matrix, displacement vectors, and forces respectively. (see

McGuire et al. [5]).

K

˜

m,LU

˜

m,L =P

˜

m,L (5)

The stiffness matrix of an element is normally obtained in the local coordinate system, as well as the nodal

forces. However, while results from the equilibrium equation are given in the global reference system. Therefore,

it is necessary the rotation of the axes as shown in Fig. 2, whose formulation is established by Soriano [4].

X

Y

y

x

X

u

x

u

Y

u

y

u

Figure 2. Rotation of axes in the plane, adapted from Soriano [4]

As shown in Fig. 2, the vector

uis considered in the XY (global) and xy (local) references, according to eq. (6).

ux

uy

=

cos αsin α

−sin αcos α

·

uX

uY

(6)

The rotation matrix (r

˜) and its respective expansion (R

˜) for plane trusses are indicated in eq. (7), which is

described in nodal partitions [4, 5].

r

˜=

cos αsin α

−sin αcos α

→R

˜=

r

˜0

˜

0

˜r

˜

(7)

Finally, using the rotation K

˜

m,G =R

˜

TK

˜

m,LR

˜, according to the procedure indicated by Soriano [4] and McGuire

et al. [5], the global stiffness matrix of plane trusses (eq. (8)) is obtained.

Fx1

Fy1

Fx2

Fy2

=EA

L

cos2αsin αcos α−cos2α−sin αcos α

sin αcos αsin2α−sin αcos α−sin2α

−cos2α−sin αcos αcos2αsin αcos α

−sin αcos α−sin2αsin αcos αsin2α

·

u1

v1

u2

v2

(8)

2.2 Space trusses

Space trusses (3D) are deﬁned by the Cartesian coordinate system (x,y,z)and their bars and loads can be in

any direction in space. Taking eq. (4) as a reference, and knowing that space truss elements also only transmit

CILAMCE-2022

Proceedings of the XLIII Ibero-Latin-American Congress on Computational Methods in Engineering, ABMEC

Foz do Iguac¸u, Brazil, November 21-25, 2022

Development of a computational routine in Fortran language for analysis of plane and space trusses using the ﬁnite element method

axial forces (there are no forces or displacements acting on the yLand zLaxes), the matrix expression of eq. (9) is

deﬁned. It represents the equilibrium equation for space truss bars, referring to local axes, or in a compact form as

already demonstrated in eq. (5). Where wL

iis displacements on the z-axis.

EA

L

100−1 0 0

000 000

000 000

−1 0 0 1 0 0

000 000

000 000

·

uL

i

vL

i

wL

i

uL

j

vL

j

wL

j

=

F xL

i

0

0

F xL

j

0

0

(9)

The rotation matrix r

˜is deﬁned in three-dimensional space with its lines referring to the directional cosines

of the x,y, and zaxes, as indicated in eq. (10) [4]. The y-axis directional cosines are illustrated in Fig. 3.

r

˜=

λxX λxY λxZ

λyX λyY λyZ

λzX λzY λzZ

.(10)

X

Y

y

x

z

Z

cos

cos

cos

yX

yY

yZ

=

=

=

Figure 3. Rotation of axes in three-dimensional space, adapted from Soriano [4]

The x-axis passes through the initial (i)and ﬁnal (j)nodal points of the bar of coordinates (Xi,Yi,Zi)and

(Xj,Yj,Zj). Thus, the directional cosines of each axis are given by eq. (11), as proposed by Soriano [4].

λxX =Xj−Xi

L, λxY =Yj−Yi

L, λxZ =Zj−Zi

L(11)

where Ldeﬁnes the length of the bar, expressed by eq. (12).

L=q(Xj−Xi)2+ (Yj−Yi)2+ (Zj−Zi)2(12)

Therefore, the rotation matrix R

˜for space trusses (dimensions 6x6) is deﬁned in a compact form in eq. (7),

using the rotation matrix r

˜of three-dimensional space (eq. (10)). Again, applying K

˜

m,G =R

˜

TK

˜

m,LR

˜, the global

stiffness matrix for space trusses (eq. (13)) is obtained.

CILAMCE-2022

Foz do Iguac¸u, Brazil, November 21-25, 2022

L. A. Aguiar, M. B. Guimar˜

aes, D. K. Monteiro, P. O. B. Costa

K

˜

m,G =EA

L

λ2

xX λxXλxY λxX λxZ −λ2

xX −λxXλxY −λxX λxZ

·λ2

xY λxYλxZ −λxY λxX −λ2

xY −λxYλxZ

· · λ2

xZ −λxZλxX −λxZ λxY −λ2

xZ

· · · λ2

xX λxXλxY λxX λxZ

· · · · λ2

xY λxYλxZ

Sim· · · · · λ2

xZ

(13)

3 Numerical examples

In this chapter, two problems were proposed: a plane truss and a space truss. The solution was developed

computationally in FORTRAN language, following the formulation detailed in the previous chapter.

3.1 Plane Truss

The routine for plane trusses was tested with the Warren truss shown in Fig. 4. The structure has width

L= 10.5m, height H= 3mand elastic modulus E= 200GPa. Table 1 indicates the cross-sectional area of the

bars.

3.5 m

3.5 m

3.5 m

1

2

3 5

46

7

1

234

5

6

7

8

9

10

11

X

Y

3 m

Figure 4. Warren truss

Table 1. Cross sectional areas of the members of the Warren truss

Group Member number Area (m2)

Inferior chord 1, 6 e 10 0.0060

Diagonals 2, 3, 4, 7, 9, 11 0.0040

Superior chord 5 e 8 0.0080

Initially, to use the FORTRAN routine, it is necessary to build a data input ﬁle in .txt format, containing the

material properties, including its geometry, the connectivity vector, the relationship that informs the number of

bars connected, and the coordinate vector.

Next, the program must be informed of the boundary conditions. In this example, it was applied to nodes

1and 7movement restrictions in the Xand Ydirections, imposing zero value. As for the loading, two 150kN

loads were applied vertically downward at nodes 3and 5. In the computational routine developed, the vectors and

matrices must have the appropriate dimensions for the plane truss solution, considering two degrees of freedom

per node, i.e., K∈R14x14 eF, P ∈R14x1. The allocation of the individual stiffness matrix of each member in

the global stiffness matrix is done by the “do”command. This creates a loop that traverses the rows and columns

of the matrix, adding the corresponding degree of freedom portion.

After the processing of eq. (8), the support reactions (VX and VY) were equal at nodes 1and 7, since the plane

truss structure and the load’s application are symmetrical. The results obtained by the FORTRAN code resulted

in VX = 116.67kN and VY = 150.00kN at the support points. As for the axial forces in the bars, the results

CILAMCE-2022

Foz do Iguac¸u, Brazil, November 21-25, 2022

Development of a computational routine in Fortran language for analysis of plane and space trusses using the ﬁnite element method

obtained were compared with the software MASTAN2, which has its formulation based on McGuire et al. [5].

Table 2 shows the results of both analyses for the Warren truss. Note that the results obtained were identical in

both analyses, except for the diagonal bars 2,3,9, and 11. There was a divergence of only 0.02%.

Table 2. Axial forces of the plane truss bars

Member number FORTRAN (kN)MASTAN2 (kN)Member number FORTRAN (kN)MASTAN2 (kN)

1 -29.17 -29.17 7 0.00 0.00

2 -173.66 -173.70 8 -175.00 -175.00

3 173.66 173.70 9 173.66 173.70

4 0.00 0.00 10 -29.17 -29.17

5 -175.00 -175.00 11 -173.66 -173.70

6 58.33 58.33 - - -

3.2 Space Truss

The proposed space truss was a 25-bar electricity transmission tower, presented by Ribas [6] (Fig. 5). The

structure has elastic modulus E= 210GPa, cross-sectional area of the bars A= 0.0016m2, height H= 5m, and

length L= 1.9m. Motion constraints were applied in the three main directions (X,Y, and Z). As for the loading,

those present in Tab. 3 were considered.

10

X

2.5 m

2.5 m

Y

Z

1.9 m

1.9 m

5 m

5 m

12

3

4

56

7

8

9

1

23

45

6

7

8

9

11 12

13

14

15

17

16

18

19

20

21 22 23

24

25

Figure 5. Electricity transmission tower

From the plane truss formulation, the vectors and matrices must be expanded in the computational routine, as

shown in the 3D truss formulation in Chapter 2. Furthermore, it should be noted that for allocation in the global

stiffness matrix, the “do”loop must be modiﬁed from the value 4 to 6, because each space truss bar has 6 degrees

of freedom. The results obtained in the numerical method were also compared with the software MASTAN2, as

shown in Tab. 4. It can be seen that the values obtained in the support nodes are identical.

Finally, Tab. 5 presents the axial forces in each bar of the electricity transmission tower. The largest variation

found between the FORTRAN and MASTAN2 values was 0.03%, thus verifying the results obtained.

CILAMCE-2022

Foz do Iguac¸u, Brazil, November 21-25, 2022

L. A. Aguiar, M. B. Guimar˜

aes, D. K. Monteiro, P. O. B. Costa

Table 3. Total loads of the electricity transmission tower (kN)

N´

os X Y Z

1 4.48 135.57 -44.84

2 0.00 135.57 -44.84

3 2.24 0.00 0.00

6 2.24 0.00 0.00

Table 4. Support reactions of the space truss

FORTRAN (kN) MASTAN2 (kN)

N´

os X Y Z X Y Z

7 131.82 -82.47 154.63 131.82 -82.47 154.63

8 -136.31 -87.86 161.35 -136.31 -87.86 161.35

9 96.41 -47.71 -109.79 96.41 -47.71 -109.79

10 -100.89 -53.10 -116.51 -100.89 -53.10 -116.51

Table 5. Axial forces of the space truss bars

Member number FORTRAN (kN) MASTAN2 (kN) Member number FORTRAN (kN) MASTAN2 (kN)

1 8.60 8.60 14 -45.66 -45.66

2 -91.29 -91.29 15 31.98 31.98

3 -87.42 -87.42 16 -48.59 -48.59

4 68.71 68.71 17 29.05 29.05

5 72.57 72.57 18 -85.79 -85.79

6 -143.54 -143.54 19 -86.54 -86.54

7 107.68 107.70 20 68.38 68.38

8 -140.39 -140.40 21 67.63 67.63

9 110.83 110.80 22 138.29 138.30

10 2.87 2.87 23 -166.19 -166.20

11 4.69 4.69 24 -172.43 -172.40

12 21.16 21.16 25 132.06 132.10

13 -20.33 -20.33 - - -

4 Conclusions

The diffusion of knowledge involving linear static analysis, through the ﬁnite element method of truss struc-

tures, is extremely relevant for academic students and engineers. However, in order to solve problems of large

variables or various complexities, it is recommended to implement FEM numerically to optimize time and process.

Thus, this work developed a code in FORTRAN language using the FEM formulation for truss bars. The

computational routines were applied to two problems: a plane truss and a space truss. In summary, the results

obtained were satisfactory in both problems, with a maximum variation of 0.03% in relation to MASTAN2.

Acknowledgements. The authors are grateful for the ﬁnancial support provided by CAPES and CNPq.

Authorship statement. The authors hereby conﬁrm that they are the sole liable persons responsible for the au-

thorship of this work, and that all material that has been herein included as part of the present paper is either the

property (and authorship) of the authors, or has the permission of the owners to be included here.

References

[1] H. L. Soriano. M´

etodo de Elementos Finitos em An´

alise de Estruturas Vol. 48. Edusp, 2003.

[2] L. F. Martha. An ´

alise matricial de estruturas com orientac¸ ˜

ao a objetos. Elsevier Brasil, 2018.

[3] A. A. Filho. Elementos Finitos–A base da tecnologia CAE. Saraiva Educac¸ ˜

ao SA, 2018.

[4] H. L. Soriano. An ´

alise de Estruturas: Formulac¸ ˜

ao e Implementac¸ ˜

ao Computacional. Ciˆ

encia Moderna, 2005.

[5] W. McGuire, R. H. Gallagher, and R. D. Ziemian. Matrix Structural Analysis, 2014.

[6] H. S. Ribas. Projeto ´

Otimo da Geometria de Trelic¸as Espaciais. Master’s thesis, Federal University of Rio

Grande do Sul, 1980.

CILAMCE-2022

Foz do Iguac¸u, Brazil, November 21-25, 2022