Keywords

1 Introduction

The finite element analyses (FEAs) are required to verify the suitability of an engineering design before actual manufacturing. There are two big challenges, one is to build a sufficiently accurate model and other is to carry out its analysis, in the available time. Meshing is the essential component of any analysis or simulation and obtaining useful meshes is an important issue. All commercial FEA softwares are based on interpolation methods which produce approximate results and the error needs to be minimum. There are various techniques of mesh generation which are either automatic or manual [1]. Automatic mesh generators often generate meshes that are not well-shaped, and hence, a mesh smoothing technique is essential for mesh quality improvement.

Smoothing or r refinement method is a technique of correcting the poorly shaped elements. No one smoothing technique works all of the time [2]. Mesh smoothing provides a high quality of mesh and increases reliability of the solution. The most popular technique is Laplacian smoothing which uses internal nodes of the element and its connected nodes for relocation of nodes at desired place via centroid approach [3].

Knupp [4] has described the mesh quality metrics in the algebraic form which can be used as the objective functions for optimization-based smoothing. Element quality is a function of invertibility, size, and shape. Invertibility gives the measure of the positive local volume of given mesh. The quality of a mesh is defined in terms of these mesh metrics [4]. Knupp [5] proved that mesh element shape can be defined by using condition number parameter and can be improved by aspect ratio improvement and element skew reduction [5]. The mesh metrics generally used are inverse mean-ratio metric [6], aspect ratio metric [7], condition number [8], and distortion metric [9] etc.

In the present work, we discuss the application of cohort intelligence (CI) algorithm for developing a new efficient mesh smoothing technique. Objective function for individual qualities of hexahedral elements in the mesh based on the condition number is used as a quality measure. CI is based on natural tendency of the individuals or candidates, to improve its behaviour by observing and implementing behaviour of peers in the group known as cohort. This helps in the growth of overall cohort behaviour as every candidate absorbs certain qualities from one another [10].

2 Literature Review

Finite element analysis is a very powerful tool and a necessity of mechanical engineering applications like structural analyses and fluid dynamics but its usefulness is controlled by mesh quality. Meshing is a critical step in FEA and is generally carried out in two stages—point placement and mesh improvement. It is an iterative process. Kovalev [11] has shown that auto-generation of good-quality quadrilateral/hexahedral meshes is difficult [11]. Various methods have been developed for improvement of triangular, quadrilateral, tetrahedral, or hexahedral meshes. Laplace smoothing is suitable only for 2D meshes but does not guarantee good element quality 3D meshes. It produces slivered tetrahedron for 3D elements [12].

Mesh smoothing algorithms also apply optimization techniques for movement of nodes [13]. Knupp [4] explained how the quality of mesh is an important aspect in mesh smoothing algorithms and can be improved by numerical optimization of the mesh metric [4]. The optimization methods are better than Laplacian smoothing methods as they remove inverted elements on mesh improvement but are more expensive and time-consuming than Laplacian smoothing [14]. Hence, combinations of both result in effective tools for mesh improvement [8].

Both classical and heuristic techniques have been used in the literature for optimization-based smoothing. Freitag and Ollivier [15] proposed a technique which used minimum angle metric and iterative steepest descent for optimization [15]. Other classical optimization algorithms used are Newton’s method, Hessian method [7], steepest gradient method [16], and linear programming [17]. Holder et al. (1998) have employed genetic algorithm for mesh optimization using distortion mesh criteria [18]. Acikgoz et al. [19] used simulated annealing technique for optimization [19]. Dittmer et al. [20] used optimization to control mesh creation parameters. [20]. Sastry and Shontz [7, 17] discussed the performance of nonlinear optimization methods for mesh quality improvement and showed that optimization solver behaviour can be improved by varying mesh size and accuracy level [7, 17].

Knupp [5] discussed condition number as a shape quality measure for hexahedral elements designed using a set of Jacobian matrices related to the particular element [5]. Yilmaz and Kuzuoglu [8] used particle swarm optimization technique for hexahedral mesh smoothing using condition number. The shape quality of all hexahedral elements is taken into account to design objective function which is modified in order to get the minimum value of objective function as zero [8].

The proposed work aims to apply condition number optimization for solving mesh smoothing using CI algorithm. The CI algorithm was proposed by Kulkarni et al. [10] and is inspired from the self-supervised learning behaviour of the candidates in a cohort [10]. All of them have the same target, and to achieve it, every candidate tries to study the behaviour of peers and improve by following a certain candidate’s behaviour. Several parameters like sampling interval and reduction factor govern CI. The algorithm has been successfully applied in the areas of healthcare and logistics [21], knapsack problem [22], and mechanical design problems [23], and the present work investigates the application of CI for mesh smoothing. Throughout the journey, it will help to explore and validate various characteristics of CI [24].

3 Mesh Smoothing Algorithm Using Cohort Intelligence (CI)

Consider an objective function for hexahedral mesh smoothing (in the minimization sense) as described in Eq. 3.1. Here, k denotes the condition number of individual element and \( T_{n,i} \) is the transformation matrix defined for the ith node of the nth hexahedral element. N denotes total number of elements in the problem. The attributes of the candidates are considered as the three coordinates of the eight vertices of the cube, i.e. \( x,y,z = \left( {x_{1} ,y_{1} ,z_{1} , \ldots ,x_{k} ,y_{k} ,z_{k} , \ldots ,x_{8} ,y_{8} ,z_{8} } \right) \). Similarly \( f\left( {x^{c} y^{c} ,z^{c} } \right) \) denotes the behaviour of individual candidate \( c\left( {c = 1\,{\text{to}}\,C} \right) \).

$$ {\text{Minimize}}\,F = f\left( {x,y,z} \right) = \frac{1}{8N}\sum\limits_{n} {\sum\limits_{i} {\left( {k\left( {T_{n,i} } \right)/3} \right)^{2} - 1} } $$
(3.1)

3.1 Procedure

The geometry of cube is generated using ANSYS and chosen for the preliminary analysis of the new algorithm proposed in this paper. The cube is discretized into 27 elements, 64 elements, and 729 elements, respectively. 27 elements and 64 elements have been chosen to investigate the applicability of the algorithm while 729 elements have been chosen for the comparison with previously published results. Creation of geometry file and auto-generated mesh using ANSYS APDL is the preliminary step. The analysis steps are as follows:

  • Step 1: (Conversion of data from ANSYS into a text file): Nodal connection data is obtained using nlist command and element data is obtained using elist command from hexahedral mesh.

  • Step 2: Extract node and element data: The data in this file is in complex form consisting of spaces, and alphanumeric characters. It contains data about element connectivity, real constants, and material assignment. Geometric coordinates of the nodes and elements need to be extracted from this huge piece of information. This data is initially stored in an excel file which is then extracted using textscan command. Then, the mesh data is read line by line for the removal of entries like NaN and zero values from the file. Then, the element connectivity in all directions (i.e. x, y, z) is used to define solution space.

  • Step 3: Develop the boundary of the object in MATLAB by edge and surface identification: The boundary of the object is required to be defined. So from the set of nodes extracted, the nodes lying on the surfaces, edges, and corners are identified. The equations of the planes for the surfaces of the cubes are developed using the three-point form of the equation of the plane. Redundant planes are excluded using the perpendicularity condition. Edges of the cube are identified as the intersection of the planes. This helps us to define external boundary of object.

  • Step 4: Identify the mesh metric for optimization which is the condition number: Let \( \left( {x_{i} ,y_{i} ,z_{i} } \right) \) be the vertices of the adjacent corners of a vertex \( \left( {x,y,z} \right) \), then its condition number (Eq. 3.2) is given by

$$ k\left( T \right) = {\text{cond}}\left[ {\begin{array}{*{20}c} {x_{1} - x} & {x_{2} - x} & {x_{3} - x} \\ {y_{1} - y} & {y_{2} - y} & {y_{3} - y} \\ {z_{1} - z} & {z_{2} - z} & {z_{3} - z} \\ \end{array} } \right] $$
(3.2)

Condition number is calculated for each corner. The maximum value represents the condition number of the element which needs to be minimized. Store the minimum condition number candidate as global best.

  • Step 5: Check for bad-quality element: The element is said to have good quality if condition number lies between 1 and 3 [5]. The candidates C (number of bad elements in auto-generated mesh data) are initialized. The bounds of the variables are given by Eq. 3.3

$$ \begin{array}{*{20}l} {x_{i} \left( {{\text{solution}}\,{\text{space}}} \right)_{\text{lower}} < x_{i} < x_{i} \left( {{\text{solution}}\,{\text{space}}} \right)_{\text{upper}} } \hfill \\ {y_{i} \left( {{\text{solution}}\,{\text{space}}} \right)_{\text{lower}} < y_{i} < y_{i} \left( {{\text{solution}}\,{\text{space}}} \right)_{\text{upper}} } \hfill \\ {z_{i} \left( {{\text{solution}}\,{\text{space}}} \right)_{\text{lower}} < z_{i} < z_{i} \left( {{\text{solution}}\,{\text{space}}} \right)_{\text{upper}} } \hfill \\ \end{array} $$
(3.3)
  • Step 6: The behaviour selection probability \( p_{c} \) is calculated using Eq. 3.4. The behaviour of every associated candidate \( c\left( {c = 1, \ldots ,C} \right) \) to be followed is given by \( f^{*} \left( {x^{c} y^{c} ,z^{c} } \right) \), thus

$$p_{c} = \frac{{1/f^{*} \left( {x^c,y^c,z^c} \right)}}{{\mathop \sum \nolimits_{c} 1/f^{*} \left( {x^c,y^c,z^c} \right)}},\left( {c = 1 \ldots C} \right) $$
(3.4)

The roulette wheel approach is used by every candidate \( c\left( {c = 1\,{\text{to}}\,C} \right) \) to generate random number to follow corresponding behaviour \( f(x^{c[f]} ,y^{c[f]} ,z^{c[f]} ) \) and associated qualities \( x^{c[f]}, y^{c[f]}, z^{c[f]} = \left( {x^{c[f]} ,y^{c[f]} ,z^{c[f]} = x_{1}^{c\left[ f \right]} ,y_{1}^{c\left[ f \right]} ,z_{1}^{c\left[ f \right]} ,x_{2}^{c\left[ f \right]} ,y_{2}^{c\left[ f \right]} ,z_{2}^{c\left[ f \right]} \ldots x_{8}^{c\left[ f \right]} ,y_{8}^{c\left[ f \right]} ,z_{8}^{c\left[ f \right]} } \right)\)

  • Step 7: Every candidate shrinks or expands attributes depending on element edge length of candidate to be followed. The relations in Eq. 3.5 are obtained using condition number criteria. Specific nodes are not permitted to move to preserve the shape of volume mesh. Corner nodes are fixed. Surface nodes are allowed to move along surface only. Edge nodes are allowed to move along edges only.

$$ \begin{array}{*{20}l} {x_{i} = x_{1}^{c\left[ f \right]} - x_{{i\left( {\text{edge}} \right)^{c\left[ f \right]} }} + x_{{i - 1\left( {\text{edge}} \right)^{c\left[ f \right]} }} } \hfill \\ {y_{i} = y_{1}^{c\left[ f \right]} - y_{{i\left( {\text{edge}} \right)^{c\left[ f \right]} }} + y_{{i - 1\left( {\text{edge}} \right)^{c\left[ f \right]} }} } \hfill \\ {z_{i} = z_{1}^{c\left[ f \right]} - z_{{i\left( {\text{edge}} \right)^{c\left[ f \right]} }} + z_{{i - 1\left( {\text{edge}} \right)^{c\left[ f \right]} }} } \hfill \\ \end{array} $$
(3.5)
  • Step 8: Decide cohort behaviour to be followed by candidates and improve the quality of mesh using CI. Each candidate \( c\left( {c = 1, \ldots ,C} \right) \) tries to enrich its behaviour by following the other candidates having better behaviour associated with modified attributes xc[f], yc[f], zc[f]. This makes the cohort available with C updated behaviours represented as \( F^{C} = \left( {f\left( {x^1,y^1,z^1} \right), \ldots ,f\left( {x^c,y^c,z^c} \right)} \right) \). After few learning attempts, all candidates follow global best behaviour from available behaviours which are helpful for internal mesh smoothing of hexahedral elements.

  • Step 9: Recheck mesh quality: The results using surface mesh plots before and after mesh improvement are compared. The objective function for global mesh quality improvement is evaluated. The cohort behaviour could be considered to be saturated if there is no significant improvement in \( f^{*} \left( {x^{c} y^{c} ,z^{c} } \right) \) of every candidate \( c\left( {c = 1, \ldots ,C} \right) \) in the cohort, and the difference between individual behaviours is not very significant for a large number of iterative learning attempts, then the convergence is achieved.

  • Step 10: Import the improved mesh to ANSYS. The complete flow is summarized in flowchart 1.

    Fig. 1
    figure 1

    Flow chart for condition number optimization using CI

4 Results and Discussions

The problem was coded in MATLAB R2016a on Windows Platform with Intel Core processor with 4 GB RAM and plot mesh function developed by [25]. Mesh improvement can be validated by checking the condition number improvement within range 1–3 for number of nodes of modified mesh data.

4.1 Stage-Wise Improvements

Mesh Improvement in stage I: In the proposed work, stage 1 is 3D mesh improvement using roulette wheel approach for deciding following behaviour of candidates in the cohort. Table 1 shows the condition number analysis for the Mesh with 27 elements. Several nodes do not lie within the range of 1–3 after improvement, so current scheme needs more refinement in further stages.

Table 1 Comparison based on condition number count

Mesh Improvement in stage II: Stage 2 is 3D or overall mesh improvement using global best behaviour to be followed by all candidates in the cohort. As shown in Table 2, the maximum number of nodes lies within 1–3 after mesh improvement. It proves that current optimization-based smoothing; that is, cohort algorithm gives promising results. The positive values show that elements are not inverted.

Table 2 Condition number reduction

4.2 Graphical and Statistical Analysis

As shown in surface mesh plot followed by convergence plot in Figs. 2 and 3, the irregular mesh having 27 and 64 elements is smoothened using CI in two stages.

Fig. 2
figure 2

Surface mesh plot and convergence plot: 27 elements, 64 nodes

Fig. 3
figure 3

Surface mesh plot and convergence plot: 64 elements, 125 nodes

The graphical plot gives an idea about condition number optimization. Y axis gives a measure of objective function value and X axis refers to the learning attempts needed. Results are plotted for a various number of element data and all shows fine refinement after several learning attempts. The plots are also obtained for 729 elements. As results stated above shows about 95% improvement in the noisy version of mesh, we can say that CI can be used for hexahedral mesh smoothing.

The mean solution, worst solution, best solution, and standard deviation (Std. Dev.), mean run time (in seconds) over the 30 runs of the algorithm for three cases of mesh improvement problems are represented in Tables 2 and 3, respectively. Condition number is a node-based quality measure for hexahedral elements while the objective function shows the overall mesh improvement. If the value of condition number lies between 1 and 8, it is considered as acceptable range for meshing, but value between 1 and 3 is the good-quality measure for the same. Since the value of the highest condition number is close to 1 and standard deviation (σ) of the objective function is closer to 0, we can say that CI can be applied for mesh smoothing if objective function and condition number are taken into account.

Table 3 Condition number-based robustness check

5 Conclusions and Future Directions

A method for mesh improvement based on condition number optimization by using CI is validated in this work. Hexahedral meshes of 3D for a cubical model of various element sizes can be smoothed with this technique. This work needs to be updated to handle complex geometries such as prismatic elements with hexahedral mesh, meshing of geometry with stress concentration regions, and enhancement in convergence time by means of adjustments in the candidate behaviour.