Abstract
GPUs no longer only support graphical applications and gaming. These are becoming cheap and powerful tools for scientific and general-purpose computations. They provide a massively parallel environment with the support of a single instruction multiple data (SIMD) programming model. Making finite element calculations is also a time-consuming process in some cases due to many elements or a large degree of freedom. The FEM simulation is essential to check the analytical or measured mechanical stresses, deformations, etc. In making structural optimisation, one needs several iterations and combining the optimisation with FEM, increasing the calculation time. GPU programming is a good solution for this. In the article, we show the applicability of the combination of GPU, optimisation, and FEM simulation.
Access provided by Autonomous University of Puebla. Download conference paper PDF
Similar content being viewed by others
Keywords
1 Introduction
Nowadays, graphic cards (video cards, GPU) are cheap and efficient hardware for general-purpose parallel computation. They are used for scientific computations, for topology optimisation [1] or structural optimisation [2], and for manufacturing technologies. They provide a massively parallel environment with the support of a single instruction multiple data (SIMD) programming model. Nowadays, larger software vendors – such as MathWorks – are increasingly developing frameworks based on the CUDA API (application programming interface) that offer more convenient and user-friendly tools than the original CUDA Runtime API.
Nature-inspired, population-based, iterative, evolutionary algorithms – such as flower pollination algorithm [3], particle swarm optimisation [4], firefly algorithm [5], etc. – are powerful numerical optimisation methods. Their importance and effectiveness are underlined by the fact that they are used in several places in vehicle research to design optimal aerodynamics for UAVs (unmanned aerial vehicles) [6], for performance optimisation of formula vehicles [7], for optimising the manufacturing of vehicles [8] etc.
The finite element method (FEM) is a universal tool for analysing structures and determines mechanical stress and deformations inside the structure. In this paper, we connect an evolutionary algorithm – differential evolution – with FEM. The method is presented through the optimisation of the truss structure. Computational capacity is demanded by both the evolutionary method and FEM. Therefore, we present a possible parallelisation using MATLAB software and the obtained results.
2 Differential Evolution
Stron and Price introduced original differential evolution (DE) in [1]. DE improves the \({n}_{D}\) dimensional \({\varvec{x}}\) individuals of \({n}_{p}\) element population through a series of iteration steps
where \(S\) is searching space. Ideally, the initial population randomly covers the entire search space. Each variable in an individual is a uniformly distributed random number in the search space.
DE generates the new entity in each iteration step by performing three operations repeatedly. These are called mutation, crossover, and selection operations [9].
During the mutation operation, a \({}^{G}{{\varvec{v}}}_{i}\) mutant is generated for each \({}^{G}{{\varvec{x}}}_{i}\) individual of \(G\) generation using one of the following five strategies [10]:
-
DE/rand/1:
$${}^{G}{{\varvec{v}}}_{i}={}{}^{G}{{\varvec{x}}}_{{r}_{1}}+F\left({}{}^{G}{{\varvec{x}}}_{{r}_{2}}-{}{}^{G}{{\varvec{x}}}_{{r}_{3}}\right)$$(2) -
DE/best/1:
$${}^{G}{{\varvec{v}}}_{i}={}_{ }{}^{G}{{\varvec{x}}}_{b}+F\left({}_{ }{}^{G}{{\varvec{x}}}_{{r}_{1}}-{}_{ }{}^{G}{{\varvec{x}}}_{{r}_{2}}\right)$$(3) -
DE/current to best/2:
$${}^{G}{{\varvec{v}}}_{i}={}{}^{G}{{\varvec{x}}}_{i}+F\left({}{}^{G}{{\varvec{x}}}_{b}-{}{}^{G}{{\varvec{x}}}_{i}\right)+F\left({}{}^{G}{{\varvec{x}}}_{{r}_{1}}-{}{}^{G}{{\varvec{x}}}_{{r}_{2}}\right)$$(4) -
DE/best/2:
$${}^{G}{{\varvec{v}}}_{i}={}{}^{G}{{\varvec{x}}}_{b}+F\left({}{}^{G}{{\varvec{x}}}_{{r}_{1}}-{}{}^{G}{{\varvec{x}}}_{{r}_{2}}\right)+F\left({}{}^{G}{{\varvec{x}}}_{{r}_{3}}-{}{}^{G}{{\varvec{x}}}_{{r}_{4}}\right)$$(5) -
DE/rand/2:
$${}^{G}{{\varvec{v}}}_{i}={}{}^{G}{{\varvec{x}}}_{{r}_{1}}+F\left({}{}^{G}{{\varvec{x}}}_{{r}_{2}}-{}{}^{G}{{\varvec{x}}}_{{r}_{3}}\right)+F\left({}{}^{G}{{\varvec{x}}}_{{r}_{4}}-{}{}^{G}{{\varvec{x}}}_{{r}_{5}}\right)$$(6)where \({r}_{1}\ne {r}_{2}\ne {r}_{3}\ne {r}_{4}\ne {r}_{5}\in \left[1,{n}_{p}\right]\) are random indices, \(F\in [\mathrm{0,2})\) is the scaling factor, and \({}^{G}{{\varvec{x}}}_{b}\) is individual with the best fitness value in each \(G\) generation.
The mutation is followed by a “binomial” crossover operation that combines the newly created \({}^{G}{{\varvec{v}}}_{i}\) mutant with the \({}^{G}{{\varvec{x}}}_{i}\) individual
where \({U}_{j}(\mathrm{0,1})\in [\mathrm{0,1})\) is uniformly distributed random number, \({C}_{R}\in [\mathrm{0,1})\) is the crossover rate, and \({j}_{R}\in [1,{n}_{D}]\) is a random index.
During selection, if the fitness value of the newly generated \({}^{G}{{\varvec{u}}}_{i}\) is better than that of the \({}^{G}{{\varvec{x}}}_{i}\), it will be included in the new generation; if not, the algorithm drops it
The operation of differential evolution, and hence the success of the optimisation, is greatly influenced by the mutation strategy chosen, the value of the scaling factor \(F\), and the \({C}_{R}\) crossing ratio.
3 Finite Element Model of Truss Structure
The connection between members of tubular trusses is frequently modelled as pin connection inelastic analysis. The preferred value of eccentricities of the intersection of member’s center lines is [1, 12].
where \(e\) is eccentricity, \(D\) is the outside diameter of a circular hollow section, and \({H}_{0}\) is a typical size of rectangular hollow section. In this case, primary bending moments are produced by these eccentricities. Excessive moments are generated in brace members when rigid connections are considered. Usage of these is not recommended also for welded joints [1, 12]. The axial force distribution in a rigid joint is like pinned joint.
The structure could be analysed with the pushed-pulled element model (shortly in the following rod or truss model) with finite element methods (FEM) if the condition of inequality (9) is met. In most cases, it is sufficient to examine the structure in a plane relevant to the load. If this was insufficient and the spatial analysis had to be performed, the presented method could be easily adapted to a spatial case. In this paper, we will only discuss planar problems.
The model of the truss element is shown in Fig. 1. An approximation of the displacement within the rod element with a kinematically admissible function [13]
where \({}^{e}L\) is the length of the rod element, \({}^{e}{\varvec{N}}\) is the matrix of shape functions, and \({}^{e}{{\varvec{u}}}^{^{\prime}}\) is the vector of nodal displacement interpreted in element connected \(\xi\) coordinate system. In the global \(x-y\) coordinate system, nodal displacements could be described in the following form
The transformation between the two-coordinate system could be made with the transformation matrix
where
Elongation of truss element is
and stress in the axial direction is
where \(E\) is elastic modulus. The strain energy of truss element with \({}^{e}A\) cross-sectional area is
where \({}^{e}{{\varvec{K}}}^{^{\prime}}\) is the stiffness matrix of the element. The work of external forces is
where \({}^{e}{{\varvec{f}}}^{^{\prime}}\) is the vector of external forces reduced to nodes. The total potential energy of one element could be written in the following form
It could be rewritten with quantities, which are introduced in the global coordinate system
where
Introducing the \({\varvec{u}}\) all node displacement vectors and the \({\varvec{f}}\) all node load vectors as the total potential energy of the whole structure is
where \({\varvec{K}}\) stiffness matrix of the complete structure according to the rules of element alignment, which is detailed described in [13, 14].
Many truss structures are built from different rods with different cross-sectional properties. These rods could be grouped by \(AE\) product. From the stiffens \({\varvec{K}}\) matrix introduced initially in (22), these \(AE\) product can be extracted by cross-sectional groups
where \({n}_{G}\) is the number of cross-sectional groups, and \({{\varvec{K}}}_{{\varvec{i}}}\) is stiffness matrix of \({i}^{th}\) group. If the unknown quantities of the optimisation are typical cross-section dimensions (for example, D outside diameter and t wall thickness for circular hollow section), pre-processing of FEM is enough to do it once before the first iteration step of optimisation.
According to the principle of minimum total potential energy [15, 16], the \(\delta\Pi\) first variation of \(\Pi\) total potential energy is zero. After applying boundary conditions, we get an algebraic equation system of FEM
Post-processing of the result of Eq. (25) is necessary for further calculations. Axial stress of elements could be determined by
4 The Optimisation Problem
Optimisation of truss structures are constrained optimisation problem
where \({\varvec{x}}\) is the vector of unknowns – in this paper, vector of typical dimensions of cross-section –, \(f({\varvec{x}})\) is the objective function to be optimised, \({g}_{i}({\varvec{x}})\) are inequality constraints, \({h}_{j}\left({\varvec{x}}\right)\) are equality constraints, \(q\) and \(r\) are the numbers of constraints.
In this paper, the target function of optimisation is the weight of the structure
where \({n}_{e}\) is the number of truss elements, where \(\rho\) is the density of steel.
The structure must meet strength and stability requirements. In the present case, three criteria have been analysed. In the case of pulled rods, the resistance to tensile stress, and in the case of pushed rods, the buckling and finally the local buckling. The cross-sectional utilisation factor can well characterise these characteristics.
A definition of an inequality condition can interpret the tensile and compressive strength of pushed-pulled rods if the stress from the load is interpreted as a sign. Negative tension means pressure, while positive means tension.
where \({f}_{y}\) is yield strength, \({\gamma }_{M0}\) is a safety factor according to [17], and \(\chi\) is buckling factor also according to [17]
where \(\phi\) is a factor
\(\lambda\) is a slenderness factor
where \({I}_{x}\) is the second-order moment of the used cross-section, \(k\) is the deflection length factor, which is \(k=1\) for intermediate bars and \(k=0.7\) for the gripped bars.
The limit of local buckling depends on the shape of the cross-section. A different formula should be used for a different shape [11]. Currently, we use local buckling of circular hollow section
This formula is valid only if the unit of \({f}_{y}\) yield stress is in \(\mathrm{MPa},\) and the unit of \(\mathrm{D}\) diameter and unit of \(t\) wall thickness is \(\mathrm{mm}\).
Using Eqs. (28), (29) and (33), the fitness function to be optimised
where \(p\) is the static penalty function
and \({\varvec{x}}\) is the vector of unknowns (vector of independent variables). For example, in the case of a circular tube, un-knowns are characteristic dimensions of the cross-section
5 Parallelisation with CUDA and MATLAB
Nvidia corporation offers CUDA Driver API [18] and CUDA Runtime API [19] to program their graphics cards for general-purpose computation. There are many types of graphics cards on the market, with different computation capabilities and performance. The codec containing our unique calculation must be scalable [20], and it should automatically detect the used hardware capabilities [21]. Implementing this feature is sometimes more challenging than implementing our custom calculation. As an intermediate layer between CUDA and our code, MATLAB offers much simpler possibilities for implementing our parallel computation [22]. However, this ease of use comes at a price, so the computation speed increase will never be as great as using only native CUDA.
MATLAB gives a reach toolset and many features to make operations with vectors and matrices. It offers many possible ways to rewrite original loop-based, scalar oriented operations to vector-matrix operations. This process is called “vectorisation”.
To illustrate the differences between the two types of operations, let the population be given as follows for circular hollow section tubes
where \({D}_{i,j}\) is diameter of \({i}^{th}\) cross-sectional group for \({j}^{th}\) the individual in the population, \({t}_{i,j}\) is the wall thickness of \({i}^{th}\) cross-sectional group for \({j}^{th}\) the individual in the population. For example, the loop-based, scalar oriented implementation of Eq. (33) could be seen in Listing 1.
In contrast, the implementation in Listing 2 of the same equation covers a vectorised form.
The striking difference between the two code snippets is that the latter is much shorter and more transparent. Sometimes, scalar-oriented operation vectorisation may not be formulated with element-wise operations (such as.*,./,.^, etc.). In such cases, arrayfun() could be a good tool. The point is that the scalar operation inside the loop core must be organised into a separate function (see in Listing 3). arrayfun() will call this function one at a time as many times as many elements in the vector or matrix passed as a parameter.
Provide tools for vectorising operations performed on multidimensional matrices using “page-wised” functions and operations. These detailed descriptions could be found in [22] for length reasons; these are not detailed in this paper.
MATLAB can always start the loop-based approach on only one thread, as illustrated in Listing 1. The situation is different with vectorised operations. It can automatically detect repetitive operations where only the data to be processed changes and automatically discover the capabilities of the runtime environment to perform them on multiple threads. In the simplest case, when using multi-core processors, it automatically – unless the opposite is set – takes advantage of the possibility of running on multiple cores in parallel. This automation also works for GPUs if the type of all variables in the expression is gpuarray. It automatically creates the required kernel functions based on the expressions and starts them on the required and possible number of threads, considering the capabilities of the GPU.
All the expressions and functions presented in previous chapters are easy to vectorise. This allows complete optimisation – evolutionary algorithm, FEM solver and fitness function calculation – to be calculated using GPU in parallel. If all steps and operations are calculated with a GPU, the host machine only manages them; it is enough to move data between the host and GPU at the beginning and end of the optimisation.
6 Comparison of Sequential and Parallel Optimisation
The dimensionless computation speed up between sequential and parallel processing is defined as follows
where \({t}_{seq}\) is the average computation time of iteration steps using only sequential processing, \({t}_{par}\) is the average computation time of iteration steps using only sequential processing. For measuring \({t}_{seq}\) computation time, we used 1 pcs CPU thread, and for measuring \({t}_{par}\) computation we used as many as possible thread on Geforce GTX 1050 Ti type graphics card.
The structure shown in Fig. 2 was optimised to determine the previously defined rate increase. This is a truss structure with deltoid-shaped stiffeners. Applied loads were \({F}_{1}=332.94\,\, kN\), \({F}_{2}=437.46\,\, kN\) and \({F}_{3}=338.08\,\, kN\). Node 1 and 7 were fixed, that means any displacement in these points is not allowed. Cross-section of all rods was a circular tube, where we optimised of outside diameter and wall thickness of tubes according to Eq. (36). Rods of the structure were divided into three cross-sectional groups. The first group contains rods 1–10. Horizontal rods (11–16) are in the second group. Finally, rods in the third group are rods of deltoid shape (17–26).
In our simulation, we have simulated optimisation with different numbers of individuals in the population which are used by SaDE. The dimensionless speed up achieved is illustrated in Fig. 3, with different \({n}_{p}\) population sizes. We did not inspect the quality of optima in this paper; we inspected only the difference in computation time.
7 Conclusion
An evolutionary algorithm is presented in this paper, the differential evolution. This algorithm relates to the finite element method for optimising truss-like structures subject to static stresses, overall buckling and local buckling. This is a powerful approach for optimising any truss structure automatically.
Evolutionary optimisation is a population-based iterative numerical method. That means the fitness function should be calculated many times; meanwhile, that could be a resource-demanding task and take a long time. One way to increase the speed of calculations is parallel computation with GPU. MATLAB offers user-friendly methods and tools for doing it. We have analysed dimensionless speed up of optimisation with tools of MATLAB.
The available speed up depends on the size of the population Speed up increases approximately exponentially in the function of population size (see in Fig. 2). If the population size is small, there is no reason for parallelisation.
In future exploration, it could be interesting to inspect speed up in the function of the number of elements and number of nodes with fixed and varied size populations.
References
Xia, Z., Wang, Y., Wang, Q., Mei, C.: GPU parallel strategy for parameterized LSM-based topology optimization using isogeometric analysis. Struct. Multidiscip. Optim. 56(2), 413–434 (2017). https://doi.org/10.1007/s00158-017-1672-x
Wang, J., Zhang, D., Luo, M., Zhang, Y.: A GPU-based tool parameters optimization and tool orientation control method for four-axis milling with ball-end cutter. Int. J. Adv. Manuf. Technol. 102(5–8), 1107–1125 (2018). https://doi.org/10.1007/s00170-018-2954-1
Yang, X.S.: Flower pollination algorithm for global optimisation. In: Durand-Lose, J., Nataša, J. (eds.) Unconventional Computation and Natural Computation, pp. 240–249. Springer, Berlin, Heidelberg (2012)
Xie, X.F., Zhang, W.J., Yang, Z.L.: Adaptive particle swarm optimisation on individual level. In: Proceedings of the 6th International Conference on Signal Processing, 2002, vol. 2, pp. 1215–1218 (2002). https://doi.org/10.1109/ICOSP.2002.1180009
Yang, X.S.: Nature-Inspired Optimization Algorithms, 2nd (edn). Academic Press, London (2021). https://doi.org/10.1016/C2019-0-03762-4
Lee, D.S., Gonzalez, L.F., Srinivas, K., Periaux, J.: Robust evolutionary algorithms for UAV/UCAV aerodynamic and RCS design optimisation. Comput. Fluids 37(5), 547–564 (2008). https://doi.org/10.1016/j.compfluid.2007.07.008
Tey, J.Y., Rahizar, R.: Handling performance optimisation for formula vehicle using multi-objectives evolutionary algorithms. Veh. Syst. Dyn. 58(12), 1823–1838 (2020). https://doi.org/10.1080/00423114.2019.1645861
Galván-López, E., Curran, T., McDermott, J., Carroll, P.: Design of an autonomous intelligent demand-side management system using stochastic optimisation evolutionary algorithms. Neurocomputing 170, 270–285 (2015). https://doi.org/10.1016/j.neucom.2015.03.093
Storn, R., Price, K.: Differential evolution – a simple and efficient heuristic for global optimisation over continuous spaces. J. Global Optim. 11, 341–359 (1997). https://doi.org/10.1023/A:1008202821328
Qin, A.K., Suganthan, P.N.: Self-adaptive differential evolution algorithm for numerical optimisation. In: Proceedings of the IEEE Congress on Evolutionary Computation, vol. 2, pp. 1785–1791 (2005). https://doi.org/10.1109/CEC.2005.1554904
Wardenier, J., Kurobane, Y., Packer, J.A., van der Vegte, G.J., Zhao, X.-L.: Design Guide for Circular Hollow Section (CHS) Joints Under Predominantly Static Loading, 2nd edn. CIDECT, Zürich (2008)
Wardenier, J., Kurobane, Y., Packer, J.A., van der Vegte, G.J., Zhao, X.-L.: Design guide for rectangular hollow section (RHS) joints under predominantly static loading, 2nd edn. CIDECT, Zürich (2008)
Ferreira, A.J.M., Fantuzzi, N.: MATLAB Codes for Finite Element Analysis. Springer Cham, Heidelberg (2020). https://doi.org/10.1007/978-3-030-47952-7
Smith, I.M., Lee, M.: Programming the Finite Element Method, 5th edn. John Wiley and Sons Ltd, London (2013)
Páczelt, I.: Finite element method in engineering practice (in Hungarian). Miskolci Egyetemi Kiadó, Miskolc (1999)
Páczelt, I., Baksa, A., Szabó, T.: Fundamentals of the finite element method (in Hungarian). HEFOP jegyzet, Miskolc (2007)
EN 1993–1–1: Eurocode 3: Design of steel structures - part 1–1 General rules and rules for buildings. European Committee Standardization, Brussels (2009)
CUDA Drive API documentation. https://docs.nvidia.com/cuda/cuda-driver-api/index.html. Accessed 01 Mar 2022
CUDA Runtime API documentation. https://docs.nvidia.com/cuda/cuda-runtime-api/index.html. Accessed 01 Mar 2022
Cheng, J.: Professional CUDA C Programming. John Wiley & Sons, Hoboken (2014)
Sanders, J., Kandrot, E.: CUDA by Example: An Introduction to General-Purpose GPU Programming. Pearson Education, Boston (2010)
Help center for MATLAB: Simulink and other MathWorks product. https://uk.mathworks.com/help/index.html?s_tid=CRUX_lftnav. Accessed 01 Mar 2022
Acknowledgements
The research was supported by the Hungarian National Research, Development and Innovation Office—NKFIH under the project number K 134358.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Nagy, S., Jármai, K., Baksa, A. (2023). Combination of GPU Programming and FEM Analysis in Structural Optimisation. In: Jármai, K., Cservenák, Á. (eds) Vehicle and Automotive Engineering 4. VAE 2022. Lecture Notes in Mechanical Engineering. Springer, Cham. https://doi.org/10.1007/978-3-031-15211-5_63
Download citation
DOI: https://doi.org/10.1007/978-3-031-15211-5_63
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-15210-8
Online ISBN: 978-3-031-15211-5
eBook Packages: EngineeringEngineering (R0)