1 Introduction

High-fidelity modeling and simulation has been widely used in nowadays engineering design. In vehicle engineering, for example, detailed computational fluid dynamics (CFD) simulation is routinely applied to evaluate the aerodynamic performance of the vehicles. However, simulation based shape optimization is still a challenging task even the computational power is increasingly available because more complex and accurate models quickly use up the computational resources.

High-fidelity modeling techniques such as the finite element method (FEM) and the finite volume method (FVM) adopt finely resolved meshes which inevitably form big-sized algebra equations. Preparation of the detailed meshes as well as formation and solution of the algebra equations are the most time consuming steps in a simulation. For a non-trial industrial case, preparation of the mesh may take several or tens of hours even automatic mesh generation techniques are applied. Then formation and solution of the algebra equations may take O(10–102) CPU-hours. As a consequence, the total computational cost of the simulation-based optimization is prohibitively high considering O(102–103) simulations have to be run in the optimization procedure.

To make the simulation based optimization acceptable in the practice of engineering design, new methodologies should be developed to overcome the bottleneck of mesh generation and field solution. It is interesting to note that in typical shape optimization problems, the geometric configurations often change smoothly and series of geometries can be quickly generated by morphing the original geometry. To avoid the time-consuming and error-prone process of geometry discretization, the mesh of the morphed geometry can be generated by deforming the original mesh through the same morphing procedure (Fig. 1). Efficient methodologies can also be developed to speed up the procedure of field solution (more specifically, formation and solution of the algebra equations) by exploiting a small set of pre-computed solution snapshots defined on well-chosen geometric configurations. This is the basic idea of reduced order modeling (ROM) (Lassila et al. 2014). Although construction of the pre-computed solutions (i.e., the offline stage) is time-consuming, this step needs to be performed only once. Then solution of a new configuration (i.e., the online stage) can be sought very quickly by using a reduced order model built upon the pre-computed solution snapshots. The small-sized reduced order model is fast-running and therefore repeated calls to the ROM within an optimization procedure is acceptable.

Fig. 1
figure 1

Schematic of mesh morphing of a two-dimension airfoil. The left is the original mesh and the right is the morphed mesh. The white hollow circles denote the control lattice

In the present paper, we combine the two techniques, i.e., the mesh morphing and the reduced order modeling, to formulate an automatic non-intrusive procedure for efficient aerodynamic shape optimization based on CFD simulations. The idea has been well demonstrated in the pioneering work of Filomeno Coelho et al. (2008, 2009), Xiao et al. (2010). The non-intrusive feature of the present method allows it to be integrated with different high fidelity solvers, either commercial, open-sourced or in-house developed, with great ease. The paper is organized as follows. The mesh morphing algorithm and a non-intrusive method for constructing reduced order CFD models are explained in Sects. 2 and 3 respectively. In Sect. 4, implementation of the two technical ingredients is presented. Then the optimization of a motorbike by using the present method is illustrated in Sect. 5.

2 Mesh morphing by free form deformation

Free form deformation (FFD) is a morphing technique widely used both in academia and in industry. The basic idea of FFD is to embed the part of the mesh (or the geometry) to be morphed in a control lattice and to deform it by following the deformation of the lattice (Sederberg and Parry 1986). By controlling the lattice points, a continuous and smooth deformation can be achieved (Fig. 1). A typical FFD procedure usually consists of three steps (Fig. 2). First, a physical domain \(\varOmega\) enclosing the object O is mapped to the reference domain \(\hat{\varOmega }\) (a unit square for the two-dimensional case and a unit cube for the three-dimensional case) through an affine map \(\uppsi\). Then, some control points defined on the reference domain are adjusted to get the desired deformation using the map \({\hat{\text{T}}}\). At last the inverse mapping from the deformed reference domain, i.e. \(\uppsi^{ - 1}\), is sought and applied to deform the physical domain \(\varOmega\).

Fig. 2
figure 2

Schematic of the free-form deformation (only the internal control points are moved)

The FFD-based morphing actually changes only the coordinates of the vertices enclosed in the control box. It is independent of the topology of the object and thus suitable to parametrize many types of geometric entities, including volume meshes, surface triangulations and complex CAD representations. In the present study, it is applied directly to deform the volumetric mesh by changing the positions of the influenced nodes. The topology of the mesh remains the same. To avoid the affected elements overlap the unaffected ones, it is suggested to fix the border points and move only the internal points of the control lattice (Fig. 2). In the case of shape optimization, mesh morphing by FFD allows to skip the time-consuming procedure of geometry discretization for every new geometric configuration, contributing to a significant time saving. Considering the geometry morphing and the mesh morphing can be fully described by the displacements of the control points, the problem of shape optimization can thus be represented by an equivalent problem of parameter optimization of which the variables are the displacements of the control points.

3 Reduced order CFD modeling

The present study focuses on the aerodynamic performance of vehicles and the full order model is described by the Navier–Stokes (NS) equations. In vehicle engineering, the velocity of vehicles is high and turbulent flow often occurs which is characterized by significant fluctuations in space and time. To model the complex turbulent flow, the Reynolds-averaged Navier–Stokes (RANS) equations are formulated to describe the time-averaged properties of the flow for most engineering applications. To provide closure to the RANS equations, turbulence models (e.g., Spalart–Allmaras, kε, kω (Versteeg and Malalasekera 2007)) are needed to compute the unknown term which accounts for the fluctuations contribution, i.e., the Reynolds stress.

The full order model can be solved by the several well developed techniques such as the finite element method, the finite volume method and the finite difference method. Among the various numerical techniques, the FV method is the most widely used for its versatility in convective terms and the most majority CFD codes, either commercial or open-sourced (Iaccarino 2001; Weller et al. 1998), are based on FV discretization. Non-trivial industrial applications may contain millions of even billions of computational cells, making high-fidelity CFD simulation unaffordable to many-query or real time control applications. Reduced order CFD models are then proposed to overcome the computational burden of large-scale systems.

3.1 Model order reduction by proper orthogonal decomposition

The main assumption of reduced order modeling is that the behavior of the system with respect to the physical or the geometric parameters can be represented by a small number of dominant modes, i.e., the most energetic modes. Within the CFD domain, the Proper Orthogonal Decomposition (POD) is probably the most widely used technique to construct the reduced order model (Filomeno Coelho et al. 2008, 2009; Xiao et al. 2010; Holmes et al. 1996; Sirovich 1987; Aubry et al. 1988; Berkooz et al. 1993; Lumley 1967; Cazemier et al. 1998; Kunisch and Volkwein 2003; Weller et al. 2010; Wang et al. 2012; Dolci and Arina 2016).

POD in the context of CFD modeling usually is based on the state solutions computed at different instants in time and/or different parameter values, i.e., the so-called snapshots. Consider a set of ns snapshots, u1, u2, , uns. Here \(\varvec{u}_{j} = \varvec{u}\left( {t_{j} ;\varvec{\mu}_{j} } \right) \in {\mathcal{R}}^{n}\) represents the jth snapshot. tj and µj are respectively the time and the parameter values for the jth snapshot. Define the snapshot matrix \({\mathbf{U}} \in {\mathcal{R}}^{{n \times n_{s} }}\) of which the jth column contains the snapshot uj. The left singular value decomposition of U can be written as,

$$\varvec{U} = \varvec{X}{\mathbf{\varSigma Y}}^{\varvec{T}}$$
(1)

where the left and right singular vectors of U are respectively stored by the columns of the matrices \({\mathbf{X}} \in {\mathcal{R}}^{{n \times n_{s} }}\) and \({\mathbf{Y}} \in {\mathcal{R}}^{{n_{s} \times n_{s} }}\). The singular values of U, also referred as the POD singular values, are stored by \({\varvec{\Sigma}} \in {\mathcal{R}}^{{n_{s} \times n_{s} }} = diag\left( {\sigma_{1} ,\sigma_{2} , \ldots ,\sigma_{ns} } \right)\) where \(\sigma_{1} \ge \sigma_{2} \ge \cdots \ge \sigma_{ns}\). The POD basis, i.e. \(\varvec{\psi}= \left[ {\psi_{1} ,\psi_{2} , \ldots ,\psi_{N} } \right]\), can thus be constructed by choosing the N left singular vectors of U which correspond to the N largest POD singular values.

Once the POD modes are obtained, the full order solution can be expressed as a linear combination of the POD basis,

$$u_{n} \approx \sum\limits_{i = 0}^{N} {\alpha_{i} \psi_{i} }$$
(2)

The sum of the squares of the discarded singular values gives an upper limit to the square of the reconstruction error by the POD basis. For each new parameter, the solution is sought by determining the coefficients before the modes. A rigorous way is to project the RANS equations to the subspace spanned by the POD basis and turn the coupled partial differential equations into coupled ordinary differential equations (for unsteady case) or linear equations (for steady case) with the coefficients as unknowns (Lassila et al. 2014). Another popular way is to estimate the coefficients through some surrogate models usually built by interpolation techniques. In the present study, we choose the second approach for its versatility and applicability in non-orthogonal projection.

3.2 Solution of reduced order model by using surrogate models

The task of solution of the reduced model is to find the coefficients before the POD modes. A simple way is to construct a surrogate model which takes the new parameters as input and returns the new coefficients as output. Essentially, the surrogate models, usually represented by polynomial response surfaces or Kriging response surfaces (Filomeno Coelho et al. 2008, 2009; Xiao et al. 2010), compute the new coefficients through interpolating the already computed coefficients for the parameter samples \(\varvec{\mu}_{k} \in {\varvec{\Xi}}\). So, the method sometimes is called Proper Orthogonal Decomposition with Interpolation (PODI) (Bui-Thanh 2003). For the parameter samples, the full order solutions have been obtained and the POD coefficients for each of the sample can be obtained by projecting the full order solutions onto the low order POD space,

$$\forall\varvec{\mu}_{k} \in {\varvec{\Xi}}:\varvec{u}\left( {\varvec{\mu}_{k} } \right) = \varvec{u}^{\varvec{N}} \left( {\varvec{\mu}_{k} } \right) = \mathop \sum \limits_{i = 0}^{N} \alpha_{i} \left( {\varvec{\mu}_{k} } \right)\psi_{i}$$
(3)

For each new value of the parameter \(\varvec{\mu}_{new}\), the new coefficients \(\alpha_{i} \left( {\varvec{\mu}_{new} } \right)\) can be obtained by the surrogate models. Once the new coefficients are known, the reduced order solution can be readily reconstructed by using the POD basis,

$$\varvec{u}_{new}^{N} = \mathop \sum \limits_{i = 0}^{N} \alpha_{i} \left( {\varvec{\mu}_{new} } \right)\psi_{i}$$
(4)

In the present study, the surrogate model is constructed through a simple N-th dimensional interpolation based on the radial basis function (RBF) (Broomhead and Lowe 1988). The RBF interpolation is well suitable for the data points irregularly distributed (Fig. 3). In its basic form, the RBF interpolation can be written as,

$${\text{y}}\left( {\vec{x}} \right) = \sum w_{i} \varphi \left( {\left| {\vec{x} - \vec{x}_{i} } \right|} \right)$$
(5)

where the approximating function \({\text{y}}\left( {\vec{x}} \right)\) is represented as a sum of N radial basis functions φ, each defined on a different center \(\vec{x}_{i}\), and weighted by a coefficient wi. || denotes the distance between any point \(\vec{x}\) and the center \(\vec{x}_{i}\). Considering the values at the centers, i.e., y(\(\vec{x}_{i}\)) are known, the weights wi can be determined by solving simple linear equations. There are many forms of radial basis functions, for example, the multiquadratic function, the inverse multiquadratic function and the Gaussian function (Broomhead and Lowe 1988). In the present study, the most widely used multiquadratic form is chosen,

$$\phi \left( r \right) = \left( {r^{2} + r_{0}^{2} } \right)^{{{\raise0.7ex\hbox{$1$} \!\mathord{\left/ {\vphantom {1 2}}\right.\kern-0pt} \!\lower0.7ex\hbox{$2$}}}}$$
(6)

where r0 is a scale factor which can mediate the size of the influence domain.

Fig. 3
figure 3

Schematic of the RBF interpolation

3.3 Truncated POD with evolutionary enrichment

The classical POD needs a large set of samples, i.e., the full order solution snapshots, to extract the most energetic modes. However, for non-trivial industrial cases, generation of even a single sample is computationally expensive. Constrained by the budget of computation, it is often difficult to collect enough samples to perform the regular POD in order to obtain the optimal modes. The truncated POD defined on a set of samples, say, generated by a design of experiments, definitely leads to non-negligible truncation error. To limit the error induced by the low-order projection, the truncated POD basis should be further enriched until a well-defined error estimator is below the specified tolerance.

In the present study, the error is estimated by an leave-one-out way. For each of the sample snapshot, an truncated auxiliary POD space can be defined by using the left snapshots. Then an approximate solution can be reconstructed for the left-out sample and the error of the reconstructed solution with respect to the original solution can be chosen as the error estimator. If the error estimator exceeds the specified tolerance, a new parameter should be proposed and the corresponding full order solution should be supplemented to the sample snapshots in order to enrich the POD basis. In the present work, the new parameter is estimated by interpolating the existing parameter samples with the weights defined by the normalized reconstruction errors (Salmoiraghi et al. 2018). A more rigorous way is to construct a surrogate model which relates the parameters with the corresponding reconstruction errors and the new parameter is sought by an optimization procedure to maximize the reconstruction error (Chapman et al. 2017). In other words, the new parameter is sought by a greedy-like approach. Besides the enrichment during the offline stage, the POD basis can also be enriched during the optimization process by adding the sub-optimal solution snapshots (Weller et al. 2010). The idea of enriching the POD basis in an evolutionary way is not new and has been discussed and applied in other researches (Filomeno Coelho et al. 2008, 2009; Xiao et al. 2010). Very recently, an on-the-fly strategy has been proposed to adaptively enrich and update the POD basis according to an error residual (Xiao et al. 2019).

4 Implementation

In the present study, the open-sourced CFD solver, i.e., OpenFOAM, is chosen to generate the full order solution snapshots. OpenFOAM solves the NS equations using the finite volume discretization of which the coordinates of the vertices, the elemental connectivity as well as other information of the mesh are respectively defined by files. Considering the mesh morphing operates on vertices, only the file defining the vertices (i.e., the file named ‘points’) is parsed during the free form mesh morphing. A python script is developed to read the coordinates of the vertices and do the mesh morphing according to the displacements of the user defined control lattice. The file defining the vertices is then overwritten with the new vertices.

The key step of the proposed method is to build the ROM parameterized with the external shape of the vehicle. With free form morphing, the parametric external shape is in fact defined in terms of the displacements of the control points within the lattice. To evaluate the drag force, the velocity, the pressure as well as the eddy viscosity should be reconstructed. Therefore, it is necessary to build the POD basis for the velocity (in fact, the components of the velocity), the pressure as well as the turbulence viscosity. In the present study, the two-equations kω model is chosen for the turbulence modeling. All the POD basis for each of the solution fields are computed on the same initial snapshot matrix which are enriched until a specified error tolerance is reached. Once the ROM is built, the velocity, the pressure and the turbulent viscosity can be quickly evaluated for new shapes (i.e., new displacements of the control points). Then the drag and the lift coefficients can be computed by calling the post-processing utility of OpenFOAM.

A python package, i.e., pyOpt, is used to minimize the objective function which accepts the displacements of the control points as inputs and returns the drag coefficient as output.

5 Numerical tests

In the present study, the aerodynamic performance of a motorbike (Fig. 4) is analyzed and optimized. The length, the width and the height of the motorbike are 2.0 m, 0.6 m and 1.35 m, respectively. The box of the control lattice encloses the windshield which has a noticeable influence on the aerodynamic performance. To avoid any overlapping of the elements in the deformed mesh, only the eight internal points (hollow dots as shown in Fig. 4) are free to move.

Fig. 4
figure 4

Schematic of the motorbike and the box of the control lattice

The mesh of the whole computation domain is illustrated in Fig. 5. The mesh is refined around the motorbike and a boundary layers is defined. Totally around 0.4 million points, 0.35 million cells and 1.1 million faces are generated. The inlet velocity is fixed at 20 m/s.

Fig. 5
figure 5

Illustration of the mesh of the computational domain

The steady-state solver for the incompressible, turbulent flow, i.e., the ‘simpleFoam’ solver, is chosen for the full order solutions. The time step is set to be 1 s and the total steps are 500. The residual tolerance for all the solutions is set to be 10−8. It is checked that a steady state solution is ensured.

5.1 Construction of the ROM

Considering the symmetry of the model, the control points are also symmetrically positioned. Only one half of the internal points are needed to be considered. The width of the windshield (i.e., the size in the Y direction) is keep fixed and there are totally 8 parameters which control the shape of the windshield (Table 1). The Latin hypercube sampling method is used to generate the initial 16 parameter vectors.

Table 1 Parameters of the model

For each of the parameter vector, the solutions at the final time step are collected. All the computations are performed in parallel on a HP Z400 workstation with 12 CPU cores. The error limit for enriching the samples is set to be 10−2 and finally additional 13 full order solutions are supplemented to the snapshot matrix. It takes around 4 h to complete one full order solution and the total CPU time for constructing the ROM is 121 h which include the solution of the 29 snapshots and the operation of POD. There are 8 parameters in the problem and for the classical POD method, a large set of full order solutions (O(102–103)) should be collected during the offline stage. As an improvement, the present method begins with a small set of full order solutions and then gradually enriches the solution matrix. The enrichment process is guided by an error estimator and therefore more efficient in selecting the most representative solutions. As for the test problem, constructions of the ROM by the present method is at least 10 times faster than that by the conventional POD procedure.

5.2 Optimization by exploiting the ROM

Considering the fields of the velocity, the pressure, the turbulent kinetic energy and the turbulence frequency can be reconstructed in nearly real time, the genetic algorithm (GA) is chosen to do the optimization although it is not the most efficient method. The size of the population is set to be 20 and 40 generations of evolution, i.e., totally 800 evaluations, are performed. It takes around 10 s to complete one evaluation and totally it takes around 2.2 h to complete the optimization procedure thanks to the fast-running ROM. The change of the drag coefficient during the evolution is shown in Fig. 6. It is seen that 40 generations of evolution is enough to achieve the stabilization. A 8% reduction of the drag coefficient is achieved and the optimized shape is shown in Fig. 7.

Fig. 6
figure 6

Decrease of the drag coefficient with the number of evolution

Fig. 7
figure 7

Optimized profile of the windshield compared with the original profile

To check the accuracy of the ROM, the full order solution defined on the optimized shape is also performed and compared with the low-order solution reconstructed by the ROM (Fig. 8). It is seen that the full order solution can be well reconstructed by the ROM.

Fig. 8
figure 8

Comparison between the order solution (left column) and the reconstructed low order solution (right column). Top row: magnitude of velocity; Middle row: pressure; Bottom row: turbulent viscosity

6 Summary

The present improves a chain of techniques for aerodynamic shape optimization by integrating free form mesh morphing and POD with evolutionary enrichment. The method is tested on a non-trivial industrial model. The key advantage of the method is its considerable speed-up by using ROMs with acceptable errors. Another advantage is that the method does not rely on a particular discretization method. In fact, the approach treats the high-fidelity solver completely as a black box. Thus the user can exploit any preferred software, even commercial ones. Therefore, the method is also applicable to other industrial fields. One improvement to be made is to replace the conventional POD with the incremental POD in order to lower the memory usage of building ROM. And another is to build a more rigorous surrogate model for error estimation in order to sample the new parameter more effectively.