comparative assessment between three programming ...

60 downloads 1886 Views 1MB Size Report
(Python, MatLab and Fortran) applied for geometrical nonlinear analyses of truss structures modeled by the ... in Fortran, was adapted to Python and MatLab programming languages; using the same solver for the ...... F.B., 2012. Comparison ...
COMPARATIVE ASSESSMENT BETWEEN THREE PROGRAMMING LANGUAGES APPLIED FOR GEOMETRICAL NONLINEAR ANALYSES OF TRUSS STRUCTURES Juliano dos Santos Becho Walliston dos Santos Fernandes Marcelo Greco [email protected] [email protected] [email protected] Graduate Program in Structural Engineering, Department of Structural Engineering, School of Engineering, Federal University of Minas Gerais. Av. Presidente Antônio Carlos, 6627 / Escola de Engenharia / Bloco 1 / Sala 4127 / Belo Horizonte – MG, Zip-Code: 31270-901, Brazil Abstract. This paper presents a comparative study between three programming languages (Python, MatLab and Fortran) applied for geometrical nonlinear analyses of truss structures modeled by the Finite Elements Method (FEM). The adopted numerical formulation, called positional, uses nodal positions rather than nodal displacements to describe the finite elements kinematics. The strains are calculated directly from the proposed position concept, using a Cartesian coordinate system fixed in space. The implemented code, originally written in Fortran, was adapted to Python and MatLab programming languages; using the same solver for the systems of equations. The numerical examples demonstrate the time processing performances and the convergence rate for the responses using different languages. Three numerical examples were analyzed, including a lattice beam with post critical behavior and a reticulated shell truss structure with snap-through behavior. The different implemented codes present good responses agreement, but with very different efficiency for the numeric calculations. Keywords: Python, Fortran, MatLab, Nonlinear Analysis, FEM.

CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

Comparative assessment between three programming languages

1

INTRODUCTION

Fortran programming language has been widely used for engineering and science applications since 1960s decade (Kupfershmid, 2009). The Fortran success in the scientific computation scenario is justified by its speed for numerical calculation and its simplicity for implementation. Another reason for its success is due to the code transfer among researchers, professors and students. In engineering field, several important softwares used for numerical analyses were written in Fortran and nowadays run using Fortran libraries and codes. The Fortran license was owned by several giant companies, such as IBM, Microsoft, Compaq and Intel. Nonetheless, for some application, such as Parallel Computing and Object-Oriented Programming, the Fortran versions have arrived too late. Despite some important resources available for numerical calculations available in some Fortran versions, such as International Mathematics and Statistics Library (IMSL), Numerical Recipes and Intel's Math Kernel Library (MKL), other programming languages have been obtained success in the scientific computation field. Since version 2003, the Fortran compiler presents Object-oriented programming support. The MatLab (MatrixLaboratory) is a numerical programming environment used for engineering and scientific computations, widely used since 1980s decade. MatLab itself is a programming language and the programming environment have been disposed very interesting resources, such as a wide built-in library of functions and commands, an easy-touse interface, a wide range of tools (graphical, statistics and analyses) and a symbolic computation capability (Chapman, 2012). Moreover, the MatLab language is very easy to learn and use. More recently, a “new” programming language has been taken the scientific programming scenario. The Python programming language, as MatLab, is an Object-Oriented Programming language, but with a different scope. Python was created in 1990s decade and it has focus on the programming efficiency and on the speed for numerical calculations. Differently from Fortran, Python and MatLab are interpreted programming languages and as Fortran and MatLab, Python has several built-in library of numerical functions and commands. Python is a very dynamic programming language and works with an automatic memory management (Newman, 2012). A major difference regarding Python is that it is an open source software, often used as a scripting language working with other engineering softwares, such as Abaqus®, Code-Aster®, Maya® and Rhinoceros 3D®. The present paper is dedicated to present a comparative study regarding the numerical performance between Fortran, MatLab and Python for a nonlinear finite elements formulation applied to nonlinear analyses of truss structures. The implemented formulation is based on the position concept to describe the finite elements kinematics (Greco et al., 2006) using a single global system of coordinates to map structural elements strains. An adapted code compiled in gFortran (GNU Fortran Compiler for linux) was also included in the study of comparative performances, but running on an executable file under the same operating system used to run Fortran, MatLab and Python programs. Recently, several MatLab codes were developed for engineering applications. Xia et al. (2013) have been used a mesh generator developed in MatLab to the optimization of lattice structures. Rokhi and Shariati (2013) have been developed a mesh generator in MatLab for crack propagation analyses. Cétkovic and Vuksanovic (2009) had developed a numerical formulation in MatLab for composite structural elements. Alam et al. (2012) present a CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

J. S. Becho, W. S. Fernandes, M. Greco.

numerical formulation for transient linear analyses of laminated Euler-Bernoulli beams, implemented using a MatLab code. Python programming language has been strongly used since the last decade, but with a different scope, when compared to MatLab programming language. Perez and Jansen (2012) have been pointed the easy integration of the Python with other programming languages, such as Fortran. Several numerical formulations and models were implemented in Python, but dedicated to run under softwares for analyses of multiphysics problems. Kuutti and Kolari (2012) have been developed a mesh mapping in Python scripting for crack propagation analyses and running on Abaqus software. Ross and Oñate (2010) used Python nonlinear fitting routines for fluid-structure coupled analysis. Španiel et al. (2009) used a finite elements model implemented in Python for crack propagation analyses. On the other way, Niyari (2013) have been developed a numerical modeling using MatLab software but dedicated to run using Abaqus software. In this case, it is not possible to use directly a MatLab script on Abaqus software, once Python is the Abaqus native programming language used to run scripts. The nonlinear truss analysis was chosen in this study because it can be modeled by the simplest finite element available and, therefore, allows faster code conversions among programming languages. On the other hand, the nonlinear formulation allows comparisons between structures with complex behaviors and, consequently, with larger CPU times. Thus, the used nonlinear formulation allows both faster implementations and heavier structural analyses.

2

NONLINEAR NUMERICAL FORMULATION

Shabana et al. (1998) had presented a finite elements formulation based on absolute nodal coordinate formulation applied for nonlinear analyses. The absolute nodal coordinate formulation is developed using the Principle of Virtual Works. The adopted nonlinear formulation used in the present paper (called positional) is not conceptually far different from the absolute nodal coordinate formulation, but the developments, derivatives and integrals evaluations are significantly different. Another similar nonlinear formulation (Toklu, 2004) was used for the truss structures for post critical analysis. The positional formulation (Greco et al. 2006) is based on Finite Elements Method and it can be classified as a total Lagrangian formulation with exact kinematics. Moreover, instead of displacements, the kinematics of the positional formulation describes the finite elements kinematics through its nodal positions. The stiffness matrix is represented by the Hessian matrix and the calculation of the strain follows directly from the proposed concept. The equilibrium can be derived from the amount of potential energy (Π) accumulated in the structural conservative system through the principle of minimum potential energy. This total potential energy can be written in terms of the strain energy (U) and the potential energy of applied forces (P) as follows: (1) The present paper considers only geometrical nonlinearity and the development of material nonlinearity applied on the positional formulation for space truss analyses can be found in Greco and Ferreira (2009). The paper also presents the logarithmic strain measure applied to the positional formulation and some invariance properties. CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

Comparative assessment between three programming languages

For the initial volume (V) of a finite element, the strain energy can be written as follows: ∫

∫ ∫

∫ ∫



(2)

In Eq. (2), σ is the Cauchy’s stress, ε is the engineering strain measure and E is the Young’s modulus. This stress-strain pair is energy conjugated and the strain energy is assumed to be zero at an initial position, defined as the non-deformed position. The variable u is the specific strain energy, while the potential energy of the applied forces is given by: ∑

(3)

where X is the set of independent positions, which may be occupied by a finite element nodal point. It is interesting to note that the applied force potential energy may not be zero at the initial configuration. Thus, the total potential energy is written as: ∑



(4)

For the evaluation of finite element strain measure its geometry should be mapped. Figure 1 present the general kinematics for a space truss element at initial configuration (Ω0) and deformed configuration (Ω).

Figure 1. Space truss finite element mapping from its initial position to its deformed position.

The truss finite element kinematics presented in Fig. 1 can be parameterized in terms of a dimensionless co-ordinate ξ that varies from 0 to 1. For ξ = 0 the mapping points to the initial node of the finite element and for ξ = 1 the mapping points to the final node of the finite element. (

)

(5)

(

)

(6)

(

)

(7)

Only the longitudinal stress and strain components considered for truss finite element. The engineering strain measure can be written in terms of the finite elements initial length (ds0) and, after the structural deformation, in terms of the finite elements deformed length (ds). Thus, the engineering strain measure can be evaluated by Eq. (8). (8)

CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

J. S. Becho, W. S. Fernandes, M. Greco.

Greco and Rocha da Costa (2012) had proved that the strain measure invariance regarding the geometrically nonlinear formulation considered, i.e. positional formulation. Equation (8) can be written in terms of the dimensionless co-ordinate, as follows: (9) where ds0/dξ and ds/dξ are the stretching ratios regarding initial and deformed configurations. These ratios can be evaluated through nodal positions of the finite elements. √( )

( )

√( )

( )

( )

√(

( )

√(

) )

( (

) )

(

)

(10)

(

)

(11)

For truss analyses, the stretching rates are equal to the finite elements initial (l0) and deformed (l) lengths. Considering finite elements with constant cross sectional-areas (A), the strain energy presented in Eq. (2) can be rewritten in terms of the dimensionless co-ordinate, as follows: ∫



(12)

For a finite element, the Total Potential Energy can be written in terms of its nodal positions (X1, Y1, Z1, X2, Y2, Z2). ∫

(13)

Where (FX1, FY1, FZ1, FX2, FY2, FZ2,) are the external forces applied in the directions of the finite elements nodal co-ordinates. The equilibrium equations are obtained differentiating Eq. (13) in terms of the nodal positions. To simplify the calculations, the following rule between classical co-ordinates representation and index notations is used: (X1, Y1, Z1, X2, Y2, Z2) = (1, 2, 3, 4, 5, 6). Thus, one has: ∫

(14)

At the equilibrium state, Eq. (14) can be represented implicitly as follows: ( )

(15)

The vector of residues g(X) is nonlinear regarding nodal positions and to solve Eq. (15) one can use the Newton-Raphson procedure: ( )

(

)

(

)

(16)

where X0 and X are vectors representing initial and deformed positions, respectively. The Hessian matrix g(X0) can be evaluated as follows: (

)

(

)

(17)

Where i = 1, 2, …, 6 and k = 1, 2, …, 6 represent nodal positions. Thus, the following expression can be found: (

)



(18)

CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

Comparative assessment between three programming languages

The vector of residues g(X0) at initial position can be evaluated by: (

)



(19)

The iterative Newton-Raphson process is summarized as follows: 1) Assume X0 as the initial configuration (non-deformed). Compute g(X0) through Eq. (19). 2) Find the Hessian matrix g(X0) through Eq. (18). 3) Solve the system defined in Eq. (16) to find ∆X. Update nodal positions: X = X0 + ∆X. Return to step 1 until ∆X is sufficiently small.

3

COMPUTATIONAL IMPLEMENTATION

The computational implementation of the algebraic development must be performed trough the calculation of specific strain energy derivatives (u,i and u,ik). Thus, Eq. (12) and their derivatives can be rewritten as follows: √

( (



[

(√ )

)

(20)

)

(21) (



)

]

(22)

Where: (

)

(

)

(

)

(23)

It should be noted that the deformed length is related with an auxiliary variable B (i.e. l = √ ). The explicit values of derivatives of the auxiliary variable B are presented in Table 1. Table 1. Derivates of variable B First derivatives

Second derivatives

(

)

(

)

(

)

(

)

(

)

(

)

Considering previous equations and finite elements nodal positions, one can be use the Newton-Raphson procedure to search for the structural system equilibrium position: a) Compute the value B and their derivatives (B,i, B,k and B,ik) for each finite element. CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

J. S. Becho, W. S. Fernandes, M. Greco.

b) Compute the specific strain energy derivatives (u,i and u,ik). c) For the cumulative values, find the first derivative of the energy (vector of the residues) and its gradient (Hessian matrix) and then solve the problem as above. This computational implementation for the numerical formulation can be summarized in Fig. 2. The numerical formulation was written in four different languages: Fortran, gFortran, MatLab and Python. Details regarding the used languages are presented in Table 2. Begin

Hessian Matrixg(X0)

Boundary conditions application

External Forces vector {F}

Initial geometry

Inital data entry

Vector of residues g(X0)

Nodal Positions vector (X)

System of equations solution ΔX

Finite Elements forces N⨛ σdA

normal

Residues norm ||g(X0)||

No

Norm > Tolerance

Actual Step = Total number of steps

Normal Forces Displacements Nodal Positions

Yes

No

Yes

End

Figure 2. Flowchart of the used numerical formulation

Table 2. Details about used programming languages Language

Version

Copyright Owner

Type

Year

Fortran®

Visual Fortran Composer XE 2011 Update 11

Intel®

Compiled

2012

GFortran

v4.3

GNUFortran compiler

Compiled

2013

Matlab®

R2013a

Mathworks®

Interpreted

2013

Python

v3.3.2

Python Software Foundation

Interpreted

2013

All analyses were performed running on the same computer, using an Intel ®CoreTM 2 Duo CPU with 3GHz and 2GB of RAM. The gFortran code was executed through an executable file. To improve processing performance all comments and screen information were removed from the codes.

CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

Comparative assessment between three programming languages

It should be noted that no numerical package, such as NumPy or SciPy, was used in the Python programmed code, aiming to improve computational speed. Figures 3 to 5 presents the same subroutine/function used for the Hessian matrix calculation of the j-th finite element, implemented in three different languages (Fortran, MatLab and Python). The codes presented in these figures are commented. The total lines of programming, without comments, were equal to 508 for the Fortran code, 441 for the MatLab code and 365 for the Python code. Due to its syntax, the Python code is more economic in terms of programming lines.

Figure 3. Fortran subroutine used for the Hessian matrix calculation of the j-th finite element

Figure 4. Matlab function used for the Hessian matrix calculation of the j-th finite element

CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

J. S. Becho, W. S. Fernandes, M. Greco.

Figure 5. Python function used for the Hessian matrix calculation of the j-th finite element

4

NUMERICAL EXAMPLES

The computational performance of three numerical examples, for four different code implementations, were analyzed in this paper. Initially the intention is to validate the implemented codes. Thus, the first numerical examples are simpler and have analytical solutions. The second and third numerical examples are more expensive, in terms of CPU time processing. For all analyses it was adopted a tolerance of 10-8 for norm of the vector of residues. For speed analyses, three rounds of executions were performed aiming to obtain average values with standard deviations. Four result files were generated in each analysis, named as: “Result”, “Sai”, “Normal” and “Process”. The “Result” file presents a forceposition report for a specific degree of freedom, the “Sai” file presents the positions of all nodes, the “Normal” file presents finite elements normal forces of all finite elements and the “Process” file presents time of processing and residues evolution. All these files are generated for prescribed steps and, in the case of this work, all steps were printed.

4.1

Two-member plane truss

The first numerical example is presented to validate the implemented codes for plane truss analysis. Initial geometry, resultant load and support conditions are presented at Fig. 6. For the initial position, y0 = 10cm and L = 150cm. To run this example, two finite elements are used and 10 increment steps of force equal to -3kN were applied downwards at the central node. Thus, P represents the resultant load after each step. The adopted constants for each member are equal to E = 205GPa and A = 6.53cm2.

Figure 6. Two-member plane truss general diagram

CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

Comparative assessment between three programming languages

The analytical solution for this example can be found in Greco et al. (2006) and can be evaluated prescribing, in Eq. (24), the vertical position (yi) of central node based on the numérical response for a considered step, as follows: ( )

(24) (

( )

( ))

( )

(25)

where β is the angle among the horizontal plane and the structural member and PANALYTICAL is the load that makes the central node go to prescribed position (yi) in each step on the analytical case. Table 3 presents results obtained from analytical solution and numerical solutions for the implemented codes. These results are related with the central nodes vertical position and have shown good agreement. The numerical responses obtained from the codes are exactly the same. It should be noted that while in the analytical solution the position is prescribed, in the numerical solutions the force is prescribed, i.e. the analytical responses (PANALYTICAL) were obtained from the positions (yi) obtained from numerical solutions in each step. Figure 7 presents the evolution of the residues, in terms of displacements (∆X), for the implemented codes. Table 3. Comparison between results obtained from the implemented numerical codes for two-member plane truss. P [kN]

PANALYTICAL [cm]

y FORTRAN [cm]

y MATLAB [cm]

y PYTHON [cm]

y GFORTRAN [cm]

3

3.112298

9.595142031

9.595142031

9.595142031

9.595142031

6

6.106835

9.128362712

9.128362712

9.128362712

9.128362712

9

9.100238

8.564651425

8.564651425

8.564651425

8.564651425

12

12.09147

7.815427068

7.815427068

7.815427068

7.815427068

15

15.07374

6.300603875

6.300603875

6.300603875

6.300603875

18

17.8621

-11.782341951

-11.782341951

-11.782341951

-11.782341951

21

20.85935

-12.017348075

-12.017348075

-12.017348075

-12.017348075

24

23.85674

-12.241045941

-12.241045941

-12.241045941

-12.241045941

27

26.85423

-12.454760447

-12.454760447

-12.454760447

-12.454760447

30

29.85184

-12.659580758

-12.659580758

-12.659580758

-12.659580758

CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

Norm of the vector of residues (cm)

J. S. Becho, W. S. Fernandes, M. Greco.

Fortran response MatLab response Python response gFortran response

0.1 0.01 1E-3 1E-4 1E-5 1E-6 1E-7 1E-8 1E-9 1E-10 1E-11 1E-12 1E-13 1E-14 1E-15 1E-16 1E-17 0

5

10

15

20

25

30

35

40

45

50

55

60

Accumulated iteration

Figure 7. Evolution of the residues for the two-member plane truss

4.2

Lattice beam

The second numerical example is presented to compare performances of the implemented codes for more accentuated nonlinear behavior, with a high number of force steps. Initial geometry, load and support conditions are presented at Fig. 8. To run this example, seventy six finite elements are used and 5000 force steps equal to P  50 N were applied downwards at four superior nodes. The adopted cross-sectional areas for each member are presented at Table 4. The Young’s modulus for each member is assumed equal to E  71.7GPa . The responses presented in Fig. 8 are related with the displacements obtained from node 1.

Figure 8. Lattice beam general diagram

Table 4. Cross-sectional areas of structural members. Member

Area [m2]

Longitudinal members Transversal members Diagonal members

0.8·10-4 0.6·10-4 0.4·10-4

CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

Comparative assessment between three programming languages

Two different boundary conditions were analyzed: with lateral bracing, to obtain the fundamental solution, and without lateral bracing, to obtain secondary solution. For the condition with lateral bracing, it is assumed that all nodes in the direction of the Z coordinate are supported. It should be noted that the graph presented in Fig. 9 is plotted skipping points. At the vicinity of force 100kN it is observed a critical point related with a response bifurcation. The full analysis of this structure can be found in Noor and Peters (1980) and Greco et al. (2012). Figures 10 and 11 present the evolution of the residues, in terms of displacements (∆X), for the implemented codes. Fundamental Solution Fortran response MatLab response Python response gFortran response Secondary Solution Fortran response MatLab response Python response gFortran response

250 225

Force (kN)

200 175 150 125 100 75 50 25 0 0.0

0.2

0.4

0.6

0.8

1.0

1.2

1.4

1.6

1.8

Vertical displacement of node 1 (m)

Figure 9. Comparison between results obtained from the implemented numerical codes for the lattice beam Fortran response MatLab response

1E-5

Python response gFortran response

Norm of the vector of residues (cm)

1E-6 1E-7 1E-8 1E-9 1E-10 1E-11 1E-12 1E-13 1E-14 1E-15 1E-16 1E-17 1E-18 6080

6100

6120

6500

6520

6540

6560

6580

Accumulated iteration

Figure 10. Evolution of the residues for the lattice beam in fundamental solution

CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

J. S. Becho, W. S. Fernandes, M. Greco.

Fortran response MatLab response

1E-4

Python response gFortran response

Norm of the vector of residues (cm)

1E-5 1E-6 1E-7 1E-8 1E-9 1E-10 1E-11 1E-12 1E-13 1E-14 1E-15 1E-16 1E-17 1E-18 6080

6100

6120

6500

6520

6540

6560

6580

Accumulated iteration

Figure 11. Evolution of the residues for the lattice beam in secondary solution

4.3

Reticulated shell truss

The third numerical example is presented to compare performances of the implemented codes for accentuated nonlinear behavior and with a high number of elements. The geometry and loading are presented in Fig. 12; values are given in cm. To run this example, 73 nodes and 168 elements are used and 1000 steps of 0.1cm are applied to the central node at the top of the crown. The axial stiffness for each member is EA = 10000N. This example is available in Papadrakakis (1981) and Greco and Ferreira (2009).

Figure 12. Reticulated shell truss front view and top view input data

CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

Comparative assessment between three programming languages

Figure 13 show the numerical response obtained from the implemented numerical codes. The vertical displacements are positive for downwards. The numerical results obtained from the ANSYS® software are also presented and this are very close to the results obtained from the implemented numerical codes. In the Fig. 13 it is possible to observe the reversal of direction of the applied force F as a function of displacements, characteristic of the snapthrough behavior. Figure 14 presents the evolution of the residues, in terms of displacements (∆X), for the implemented codes.

Figure 13. Comparison between results obtained from the implemented numerical codes for the reticulated shell truss

Fortran response MatLab response

1

Python response gFortran response

Norm of the vector of residues (cm)

0,1 0,01 1E-3 1E-4 1E-5 1E-6 1E-7 1E-8 1E-9 1E-10 1E-11 1E-12 1E-13 1E-14 1E-15 600

610

620

630

640

750

760

770

780

790

800

Accumulated iteration

Figure 14. Evolution of the residues for the reticulated shell truss CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

J. S. Becho, W. S. Fernandes, M. Greco.

4.4

Result discussions

The main results regarding this paper are presented in Table 5. These results are related with the time of processing averages (in seconds) and the standard deviations for numerical examples obtained from different implemented codes. It is observed that Fortran presents the best performance, even relatively better for computationally heavier applications. The free gFortran presents slightly worst performance for all analyzed applications. MatLab presents intermediate performance and Python presents the worse performance for heavier analysis circumstances. Despite the poor performance of Python, there are studies on the use of wrappers PyCUDA to access the GPU (Graphics Processing Unit) for parallel processing which can greatly improve its performace. Buriol and Argenta (2009) make an analysis between a code written only in Python and a code in Python that uses CUDA kernels in a small part. In the small part where they used parallel computing, they obtained a gain of 22 times in processing time. However, it should be noted that the gain in processing time was obtained in only one part of the total processing time and a liner analysis was done, unlike the present paper that performs a nonlinear analysis. Furthermore, the use of parallel processing requires an advanced knowledge of the computer GPU properties and memory access. Table 5. Time of processing (t) and standard deviations for the analyzed numerical examples in different implemented codes.

̅ Two-member plane truss

( ) ̅

Lattice beam

( )

(fundamental solution) ̅

Lattice beam (secondary solution)

( ) ̅

Reticulated shell truss

( )

Fortran

gFortran

Matlab

Python

0.0133

0.0771

0.15633

0.09314

0.0047

0.0869

0.02532

0.00673

10.990

29.448

255.30

1934.8

0.02828

0.0849

1.0064

21.4530

11.100

29.922

256.26

1926.4

0.06377

0.02552

0.21690

4.5635

14.077

43.057

210.18

3756.1

0.1320

0.0195

2.1384

23.5659

In terms of number of iterations, all implemented codes have presented the same values. In terms of norm of the vector of residues, the results presented in Figs. 7, 10, 11 and 14, are very close. Small divergences should be observed due to truncation procedure and mathematical operations performed by different programming languages.

5

CONCLUSION

The implemented numerical formulation presented in this paper presents good results for analyses. Among the implemented programming languages, Fortran was far away the speediest and Python was the slowest. Despite the bad Python performance for heavier numerical calculation, when compared to Fortran and MatLab, its use is considerably CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

Comparative assessment between three programming languages

important in engineering applications (especially thinking on the use of Python-scripting associated with other engineering analysis softwares). The fact of Fortran is a compiled language, while Python and MatLab are interpreted languages, is determinant in the time of processing analyses. On the other hand, Python is more economically in terms of lines of programming while Fortran is more expensive. MatLab is also another interesting friendlysoftware with interesting resources that motivate engineering students in the hard task of programming. gFortran presented good performance and appears as an excellent option, once its license is free. In terms of numerical methods, the Fortran (and gFortran) programming language stills present high performance for engineering calculations (that should not be despised). Nowadays, among alive high-level programming languages, Fortran is probably the fastest available. Perhaps, as prophesied in Kupferschmid (2009), Fortran will still be used in sciences and engineering applications for a long period of time.

ACKNOWLEDGEMENTS The authors would like to acknowledge CNPq (National Council of Scientific and Technological Development), CAPES (Coordination of Improvement of Higher Education Personnel), FAPEMIG (Minas Gerais State Research Foundation) and PROPEEs-UFMG (Graduate program in structural engineering of Federal University of Minas Gerais) for financial support, under grants numbers 301487/2010-3 and TEC-PPM-00026-13.

REFERENCES Alam, N., Upadhyay, N.K., Anas, M., 2012. Efficient finite element model for dynamic analysis of laminated composite beam, Structural Engineering and Mechanic, vol. 42, n. 4, pp. 471-488. Buriol, T. M., Argenta, M. A., 2009. Acelerando o Desenvolvimento e o Processamento de Análises Numéricas Computacionais Utilizando Python e CUDA, 30º CILAMCE (Ibero-Latin American Congress on Computational Methods in Engineering), Búzios, Rio de Janeiro, Brazil. Cétkovic, M., Vuksanovic, Dj., 2009. Bending, free vibrations and buckling of laminated composite and sandwich plates using a layerwise displacement model, Composite Structures, vol. 88, n. 2, pp. 219-227. Chapman, S. J., 2012. MATLAB Programming with applications for engineers, 1ª Ed, Cengage Learning. Greco, M., Menin, R.C.G., Ferreira, I.P., Barros. F.B., 2012. Comparison between two geometrical nonlinear methods for truss analyses, Structural Engineering and Mechanics, vol. 41, n. 6, pp. 735-750. Greco, M., Rocha da Costa, L.J., 2012. Discussion on The logarithmic strain measure applied to the nonlinear positional formulation for space truss analysis [Finite Element in Analysis and Design 45 (2009) pp. 632-639] and Nonlinear positional formulation for space truss analysis [Finite Element in Analysis and Design 42 (2006) pp. 1079-1086], Finite Element in Analysis and Design, vol. 52 pp. 93-95. Greco, M., Ferreira, I.P., 2009. Logarithmic strain measure applied to the nonlinear positional formulation for space truss analysis, Finite Element in Analysis and Design, vol. 45, n. 10, pp. 632-639. CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014

J. S. Becho, W. S. Fernandes, M. Greco.

Greco, M., Gesualdo, F.A.R., Venturini, W. S., Coda, H.B., 2006. Nonlinear positional formulation for space truss analysis, Finite Element in Analysis and Design, vol. 42, n. 12, pp. 1079-1086. Greco, M., Venturini, W.S., 2006. Stability analysis of three-dimensional trusses, Latin American Journal of Solids and Structures, vol. 3, pp. 325-344. Kupferschmid, M., 2009. Classical Fortran: Programming for engineering and scientific applications, 2nd Ed., CRC Press. Kuutti, J., Kolari, K., 2012. A local remeshing procedure to simulate crack propagation in quasi-brittle materials, Engineering Computations, vol. 29, n. 2 pp. 125-143. Newman, M., 2012. Computational Physics, Create Space Independent Publishing Platform, 1ª Ed, Michigan. Niyari, A.H., 2013. Nonlinear finite element modelling investigation of flexural damping behavior of triple core composite sandwich panels, Materials and Design, vol. 46, pp. 842848. Noor, A.K., Peters, J.M., 1980. Nonlinear dynamic analysis of space trusses, Computer Methods in Applied Mechanics and Engineering, vol. 21, pp. 1311-151. Papadrakakis, M., 1981. Post-buckling analysis of spatial structures by vector iteration methods, Computers and Structures, vol. 14, n. 5, pp. 393-402. Perez, R.E., Jansen, P.W., Martins, J.R.R.A., 2012. pyOpt: a Python-based object-oriented framework for nonlinear constrained optimization, Structural and Multidisciplinary Optimization, vol. 45, n. 1, pp. 101-118. Rokhi, M.M., Shariati, M., 2013. Implementation of the extended finite element method for coupled dynamic thermoelastic fracture of a functionally graded cracked layer, Journal of the Brazilian Society of Mechanical Sciences and Engineering, vol. 35, n. 2, pp. 69-81. Rossi, R., Oñate, E., 2010. Analysis of some partitioned algorithms for fluid-structure interaction, Engineering Computations, vol. 27, n. 1, pp. 20-56. Shabana, A.A., Hussein, H.A., Escalona, J.L., 1998. Application of the absolute nodal coordinate formulation to large rotation and large deformation problems, Journal of Mechanical Design, vol. 120, n. 2, pp. 188-195. Španiel, M., Jurenka, J., Kuželka, J., 2009. Verification of FE model of fatigue crack propagation under mixed mode conditions, Meccanica, vol. 44 pp. 189-195. Toklu, Y.C., 2004. Nonlinear analysis of trusses through energy minimization, Computers and Structures, vol. 82, n. 20, pp. 1581-1589. Xia, Q., Wang, M.Y., Shi, T., 2013. A method for shape and topology optimization of trusslike structure, Structural and Multidisciplinary Optimization, vol. 47, n. 5, pp. 687-697.

CILAMCE 2014 Proceedings of the XXXV Iberian Latin-American Congress on Computational Methods in Engineering Evandro Parente Jr (Editor), ABMEC, Fortaleza, CE, Brazil, November 23-26, 2014