CFD-Based Optimization of Fluid Flow Product Aided by Artificial Intelligence and Design Space Validation

Computational fluid dynamics (CFD) plays an important role in investigating the flow in products. With the help of optimization algorithms, CFD-based optimization is increasingly applied in product development to improve the product design. Even though this approach is becoming increasinglymature, it is facedwith the problem that theCFD solver is not able to correctly respond to the design changes under the batchmode, leading to incorrect simulation and optimization results. Besides, there is no work dedicated to dealing with the design points which are physically invalid during the optimization process. In this paper, the intelligent CFD solver is employed to analyze the flow at each design point and to set up the solver with the best fit simulation models. Based on correct simulation results, the physically invalid design points are automatically removed from the design space. Metamodeling is used to process the valid design space with simulation results provided by the intelligent solver and derive the optimum. A prototype system is developed incorporating ANSYS, Python, and MATLAB. The design optimization of a steam control valve is used as the case study to demonstrate how the proposed system works. The optimization is conducted based on the metamodel built by response surface model and radial basis function to verify the effectiveness of the proposed method.


Introduction
For the development of product involving fluid flow, computational fluid dynamics (CFD) is extensively applied to analyze the flow field and then guide the design improvement.The conventional CFD-based design approach is based on a trial and error manner [1], which is tedious and timeconsuming.Moreover, the design derived by this method may not be the optimum.
Incorporating optimization algorithms, CFD-based optimization [2] is increasingly employed to find the optimum based on CFD simulation results.However, there are still issues that hinder the application of CFD-based optimization.The input of the optimization algorithm is commonly the simulation results corresponding to the various design points [3].Such simulations are usually conducted in batch mode to eliminate the idle time [4].In the batch mode, the solver configuration is predefined and the same configuration is applied to all the design points.When there are big changes in design, which induces flow regime change, the solver would not be able to respond to the changes.Consequently, wrong simulation results will be generated, leading to an incorrect optimization result.
On the other hand, the determination of the valid modelling region is significant to the optimization efficiency and accuracy for computationally intensive analyses [5], as well as to avoid potentially false optimal results.Efforts have been made to reduce the number of design variables [6] and eliminate unpromising regions [7].However, there is no work dedicated to dealing with the design points which are physically invalid within the framework of automatic optimization.
To enhance the applicability of CFD-based optimization, the intelligent CFD solver is adapted from our previous work [8] to analyze the physics in each design point and then assign appropriate physical models to configure the solver.After several iterations, a robust simulation model with accurate results will be generated for each specific design.Based on these simulation results, the physically invalid design points are removed from the design space to improve the efficiency and accuracy of the optimization.

Mathematical Problems in Engineering
In this paper, the review of the optimization techniques is introduced in the next section.The framework of the proposed method is presented in Section 3. To be specific, the intelligent CFD solver and approximation-based optimization are demonstrated in Sections 4 and 5, respectively.The implementation of the optimization system is shown in Section 6.The effectiveness of this system is illustrated by a case study of a steam control valve in Section 7. The conclusion of the paper comes at last.

Literature Review
Generally, the optimization algorithms used in CFD-based optimization can be categorized as gradient-based algorithms, stochastic algorithms and metamodeling based algorithms [9].The gradient-based algorithms are classical search and optimization techniques in which the first and/or second order derivatives of the objective function and/or constraints are used to guide the search process [10].Comparing to the direct search methods, the gradient-based algorithms are more efficient and, so far, the gradient-based approach has been applied to all size, shape, and topological design of mechanical parts [11,12].However, it will be problematic if non-differentiable [13] or discontinuous functions are involved, or the underlying physics is too complex [14].
There are various tools, such as genetic algorithms, differential evolution, simulated annealing, etc., for stochastic algorithms to optimize a system where the relationship between the independent variables and the objective function is not known in advance [10].Stochastic algorithms can solve complex optimization problems.Nevertheless, many function evaluations are usually needed to converge to the solution, making the whole process very time-consuming, especially when computer-aided engineering (CAE) is used to measure the performance of a configuration [15].
The metamodel is a simple model that approximates computation-intensive functions in complex systems.Optimization can be conducted based on a metamodel to search for the optimum [3].Among those introduced optimization techniques, metamodeling based algorithms show advantages of high efficiency compared to stochastic algorithms and more general applicability, given problems where the gradient information is nontrivial to calculate [16].Metamodeling has a broad application in simulation-based optimization, where the simulation is treated as numerical experiments [1,17,18].Meanwhile, the computational cost may be reduced dramatically [19].Because the metamodel provides an approximated view of the entire design space, it can detect the errors in simulation [3].Therefore, the metamodeling techniques can be well fitted in the CFD-based optimization where design and simulation are associated seamlessly.
In the development of metamodeling techniques, efforts have been made to investigate the design space to enhance the optimization efficiency.Wang et al. [20] developed the adaptive response surface method (ARSM) to obtain the optimum by gradually reducing the design space.Later, Wang and Simpson [21] proposed a fuzzy clustering method to reduce the number of sample points while increase the optimization accuracy.Younis and Dong [22] put forward the Space Exploration and Unimodal Region Elimination (SEUMRE) algorithm to divide the design space into several unimodal regions, identify the promising region, and find the optimum in each region.This process continues until all promising regions are processed.Thus, the global optimum can be obtained at last.Despite all those efforts, less attention has been paid to the evaluation of design points considering physical validity.Actually, in product design, some specific combinations of design variables will induce inadequate performance which needs to be avoided.In design optimization, such kind of design points will affect the accuracy and efficiency of optimization.As a result, the identification and removal of the invalid design points are significant to the quality of design optimization and product performance.

Framework of the Proposed Method
The overall structure of the proposed method is shown in Figure 1.There are mainly two modules, namely the intelligent CFD solver and the metamodel based optimization, which will be introduced in Sections 4 and 5, respectively.The system starts with the definition of design variables under constraints.Considering the heavy computational costs, design of experiments (DOE) [23] can be applied to select a reasonable number of sample design points that are used to investigate the whole design space.In practice, central composite design (CCD) [24], D-optimal designs [25], orthogonal arrays (OA) [26], Latin hypercube designs [27], and uniform designs [28] are widely used methods to reduce the total number of simulations.
The intelligent CFD solver analyzes the elaborately selected design points and customizes the best fit physical models to run each simulation and thus evaluate the value of the objective function.Based on the simulation results, the physically invalid design points are automatically removed (red module in Figure 1) to form a feasible design space.By optimization algorithms, the function values at the remaining valid design points can be processed and a potential optimum can be derived.
Finally, the intelligent CFD solver is run again to analyze the derived optimal point and to validate the optimum with correct physical models.Comparing the function values obtained by simulation and optimization, if the approximation error is not acceptable or the optimized design point is not the optimum among the existing design points, this derived design point with the corresponding function value obtained by simulation will be added to the design space as a new design point and a new metamodel will be constructed.If the approximation error is acceptable and this design point delivers the optimum among all the existing design points, one more test is conducted to check if a better point is available.By adding the derived point to the data set, if the newly constructed metamodel does not lead to a better optimal point, the current optimal point is selected as the best point.If the new metamodel leads to a better point, then this process continues until no better point can be found or the maximum number of iterations is reached.

Intelligent CFD Solver
As shown in Figure 2, the intelligent CFD solver is mainly composed of three modules including data processing module, physics model selection module, and post-processing module [8].The fluid attributes are obtained from each design point.The other parameters that are essential to CFD simulation can be derived in the data processing module using equations.Based on the fluid domain created at each design point, the mesh can be generated with boundary conditions attached, creating the fluid flow space which is the input for the CFD solver.
The Reynolds number and Mach number derived by the data processing module are the input of the physics model selection module.If the Reynolds number of the flow in a pipe exceeds 4,000 [29], then a turbulence model will be selected.If the Mach number is bigger than 0.3, the compressibility effects are not negligible, and the total energy model will be selected.Meanwhile, the reference pressure, as well as proper boundary conditions, is configured to activate the compressible flow simulation.In the initial stage of simulation, when the index i (iteration) is small or at the time when the simulation has convergence issues, lower-order discretization schemes, like upwind differencing scheme (UDS) [30] and the commonly used k- turbulence model for turbulent flow, are preferred to facilitate convergence.
The index i is updated after each simulation and the rootmean-square (RMS) of normalized residuals is used as the convergence criteria for the simulation at each design point.If a simulation converged, post-processing can be conducted to check if the solution meets the flow regime assumption and expected accuracy.If a simulation diverged, the solver configuration needs to be updated to achieve convergence.It should be noted that only one change is allowed in the solver configuration each time, when a new iteration starts.This procedure corresponds to best practices in CFD modelling [31].
For the simulations at each design point, as i increases, higher-order advection schemes, as well as advanced turbulence models, like - and Reynolds stress models, can be applied to improve the simulation quality.The accuracy of the simulation result can be obtained by comparing with the validation data, which is the criterion for stopping the postprocessing module.Then the program can be restarted for the next design point.If there is no external validation data available, the results obtained by higher order models will be the simulation results used as the input of the optimization algorithm.

Metamodeling and Approximation-Based Optimization
Metamodeling is developed to approximate the complex relationships between system inputs and outputs [32].In design optimization, the system inputs are design variables which can be denoted as  = ( 1 , . . .,   ).Simulations are conducted at only  distinct values of  known as design points [33].The outputs are the responses  corresponding to those design points [34].Thus, the relationship between the input and output can be formulated by metamodeling as follows:

Mathematical Problems in Engineering
where f(⋅) is the approximation model,  is the vector of coefficients and  is the approximation error.Various approximation models, like response surface model (RSM), radial basis function (RBF), kriging method, and neural network method, are available in the application of metamodeling.Among these models, RSM and RBF are introduced in detail because of their maturity and simplicity in engineering design [16].
. .Response Surface Model.Firstly introduced by Box and Wilson in 1951, RSM has been extensively applied to formulate objective functions by using simple approximation functions [26].In practice, low-order polynomials are widely used as approximation functions [5].For example, the firstand second-order polynomials are shown as ( 2) and (3) in which  is the number of design variables and  is the index of a design point [21].
In order to obtain the coefficients in Equation (3), the design matrix  is defined as Then, the coefficients can be obtained by least squares regression using RSM is especially suitable for design problems with a small number of design variables and less nonlinear response [16].
. .Radial Basis Function.In metamodeling, RBF is applied to interpolate the scattered multivariate data [35].Mathematically, RBF is a linear combination of basis functions with a general expression as where  i is the knot of a basis function,  is the vector of coefficients in RBF,  is the number of knots, and (⋅) is the basis function.For example, the frequently employed Gaussian function [36] is shown below: where z is the distance measure ‖ −   ‖, and  [37] is determined by where  max is the maximal distance among the data.Then, the radial basis function can be expressed as Similar to the design matrix, a new matrix  is defined as Afterwards,  can be derived as RBF has been employed successfully in various applications [38] and showed great capability in simulation-based design, especially when the number of design variables is relatively large [16].
. .Mathematical Model of Optimization.The metamodel is an approximation of the relationship between the system inputs and outputs which are generally nontrivial to obtain.
With the metamodel established, the optimization of the system can be conducted based on approximation, which can be described as min f (, ) Subjected to ĝ () ≤ 0,  = 1, . . .,  ĥ () = 0 ,  = 1, . . .,   ∈  (12) where f(, ) is the approximated objective function obtained by metamodeling, ĝ () and ĥ () are constraints, and S represents the valid design space.Subsequently, the gradient method can be applied to conduct the optimization.After the optimization is processed, the performance of the metamodel-predicted optimum should be checked by experiment or simulation to verify the effectiveness of the metamodel [39].

Implementation of the System
To implement the functions of the proposed intelligent CFDbased optimization system, a prototype has been developed using ANSYS, Python, and MATLAB.Figure 3 shows the pseudocode of the main function of the proposed system.The initial design points are created by a specific DOE method and stored in a comma-separated values (CSV) file.The system reads the design points data from the CSV file, iterates through different design points, calculates the Reynolds number and Mach number, updates ANSYS Workbench setup scripts with proper physical models, executes the updated scripts by calling the ANSYS run command, records the simulation results, removes the invalid design points, and conducts design optimization based on the valid design space using MATLAB.
It should be highlighted that the settings of the tool are separated from the main function, which contain physical models and the rules to select the appropriate models, values of design variables, and threshold of approximation error, etc.Such kind of arrangement makes this prototype easily extendable, if any of those values needs to be changed in the future development.

Case Study
. .Problem Statement.Steam control valves are widely used in piping systems to control the pressure drop through the system.A Venturi-type valve, as shown in Figure 4(a), is frequently used for this purpose due to its simple mechanisms and small pressure losses at large valve openings [40].Such kinds of valves are expected to operate under wide ranges of valve openings and pressure ratios [41].The aim of this case study is to apply the proposed system to find the design that produces the minimal pressure drop through the valve and thus provide a wide pressure adjusting range.Figure 4(b) shows that the valve geometry used in this study is similar to the test valve found in the experiment of flow-induced  vibration of a steam control valve [40].The length of the inlet and outlet is intentionally elongated to avoid the flow domain effect.
As can be seen from Figure 4(b), there are 4 design variables, namely, the axial distance between the reference and the valve chamber bottom  a , the height of the circumferential bank  h , the radius of the bank  r , and the deviation of valve plug center to the reference plane  c .The addition of the circumferential bank is expected to make the flow attach to the valve seat surface [42].As shown in Table 1, those 4 design variables are coded into 5 levels with their lower and upper bound of the dimensional constraint assigned to the lowest and highest levels, correspondingly.
. .Function Evaluation by the Intelligent CFD Solver.CCD is selected to design the numerical experiments, and it generates 26 design points initially.For all the design points, dry steam at 100 ∘ C flows through the inlet at 80 m/s.The steam pressure at the outlet is 101325 Pa.The combinations of design variables are stored in a CSV file.The system reads the file to extract the design data and calculates the Reynolds number and Mach number accordingly.Then, appropriate physical models are assigned in the intelligent CFD solver.After the simulations are converged, the functions, namely, the pressure drop in this case study, can be evaluated correctly.Besides, the actual Mach numbers are also monitored and collected, as shown in Table 2.
Seen from Table 2, it can be noticed that the Mach number at design point 17 exceeds 0.3, which is marked in bold.As depicted in Figure 5, the Mach number contour at this design point is plotted to obtain an insight into the flow.Obviously, the maximum Mach number occurs in the area between the valve plug and valve seat, because of the small valve opening.This situation usually occurs during the startup and shutdown of the valve.The literature [43] reports that noise and vibration will be generated when Mach number exceeds 0.3.This is because flow fluctuations exist in this circumstance, and large static and dynamic fluid forces act on the valve, which will result in damage of the valve plug and seat [40].As the objective of the optimization is to minimize the pressure drop to provide a large range of pressure control, this design point definitely does not belong to the valid design space.A corresponding rule is included in the system script.Consequently, this design point is removed from the data set before the start of optimization.
. .Optimization Based on RSM.Based on the 25 valid design points, RSM is applied firstly to approximate the relationship between pressure drop and design variables, because the number of design variables is relatively small.Specifically, the second-order polynomials are used as the approximation  Mathematical Problems in Engineering 9  function.According to the constructed response surface, the estimated pressure drop at the derived optimum point has a value of 1,558.1 Pa.The intelligent solver tests this point and finds the pressure drop to be 2,280.05Pa, leading to a relative error of 31.7%, which is not acceptable.Thus, this point with its validated response is added to the data set as a new design point, which is shown as design point 27 in Table 3.After a few additional iterations, there are 3 more design points added as shown in Table 3.All the new design points conform with the rule for the Mach number and are included in the valid design space.Based on all 29 valid design points, the response function is derived, which is expressed as Using the response function, the optimal point is found at Figure 6 shows the influence of each design variable, where the green line shows the contour of the response surface against a single variable, while all the other variables remain fixed at the optimal point.Clearly, the pressure drop is very sensitive to the height of the circumferential bank,  h .
The values of design variables at each valid design point and the final optimum are shown in Figure 7.It can be noticed that the axial distance between the reference plane and the valve chamber bottom ( a ) converges to the optimal value very fast.This is expected because a large valve opening position usually leads to a small pressure drop.
The pressure contour on the cross-section plane at the optimum derived by RSM is shown in Figure 8.The highest pressure occurs in the area between the circumferential bank and the end of inlet tube.The velocity vectors at the optimum are plotted in Figure 9.It can be seen that several recirculation zones form adjacent to the circumferential bank.These findings indicate the reason why the pressure drop is very sensitive to the height of the circumferential bank.To verify the availability of a better point, this point is added to the data set and the newly derived optimal point is at 99.The influence of each design variable is shown in Figure 10 in which all the parameters are scaled.The green lines show the contour of the RBF against a single variable, while all the other variables remain fixed at the optimal point (0.84, 0.88, 0.89, and 0.82).Compared with Figure 6, the pressure drop is also very sensitive to the height of the circumferential bank,  h .The RBF approximated pressure drop at the optimum derived by RSM is 2,235.09Pa, leading to a relative error of 1.8%, which is smaller than that of RSM.In addition, as can be seen from Figure 10, the approximation made by RBF can capture more features of the design space, which is probably the reason for the smaller optimal pressure drop than that obtained by RSM.
The pressure contour on the cross-section plane at the optimum derived by RBF is also plotted and shown in Figure 11.Intentionally, the legend is made the same as the legend in Figure 8 for better comparison.Obviously, the pressure between the valve plug and the valve chamber bottom is smaller than that in Figure 8.And as shown in Figure 12, the recirculation zone in this area is also smaller than that in Figure 9, which will induce less pressure loss.

Conclusions
An intelligent CFD-based optimization system is proposed in this paper to conduct design optimization with automatic invalid design points removal.This system is able to analyze various design points defined by DOE and to configure the CFD solver with appropriate simulation models, accordingly.Based on correct simulation results, the physically invalid design points are removed from the design space.Metamodeling is selected to approximate the complex relationships between design variables and product performance.Based on the metamodel, the optimization is conducted using the gradient method.After an optimum is found with an acceptable error, more metamodels are constructed with the derived optimums added to the data set until no better point can be found or the maximum number of iterations is reached.A prototype system is developed in Python, which invokes ANSYS Workbench to run the customized scripts, removes invalid design points automatically and calls MAT-LAB to conduct the optimization.The system is featured with separated logics and settings, making it easily extendable.
The design optimization of a steam control valve is used to verify the effectiveness of the proposed system.Based on RSM, the system reaches an optimum with the physically invalid design point removed from the design space.The value of axial distance between the reference plane and the valve chamber bottom converges to the optimal value very fast.The pressure drop through the valve is very sensitive to the height of the circumferential bank.This may be due to the fact that the highest pressure and recirculation zones form adjacent to the circumferential bank.The optimization is also conducted based on RBF for comparison.It is found that the metamodel established by RBF can better describe local features of the design space, which results in a better optimum.
In the case study, the number of design variables is relatively small.High-dimensional problems will be investigated in the future to verify the applicability of the system.

Figure 1 :
Figure 1: Flowchart of the proposed method.

Figure 2 :
Figure 2: Structure of the intelligent CFD solver.

Figure 5 :
Figure 5: Mach number contour on the cross-section plane at the invalid design point.

Figure 6 :
Figure 6: Influence of the design variables.

Figure 7 :
Figure 7: Values of design variables corresponding to the valid design points and the optimum.

Figure 8 :
Figure 8: Pressure contour on the cross-section plane at the optimum derived by RSM.

Figure 9 :Figure 10 :
Figure 9: Plot of velocity vectors on the cross-section plane at the optimum derived by RSM.

Figure 11 :Figure 12 :
Figure 11: Pressure contour on the cross-section plane at the optimum derived by RBF.

Table 1 :
Levels of design variables.

Table 2 :
Initial design points with pressure drop and Mach number calculated by the intelligent CFD solver.

Table 3 :
Added design points derived by response function with invalid design point removal.
110, 46, 60, and 22.6 with the estimated pressure drop to be 2,363.53Pa.The simulation value at this point is 2,276.58Pa, resulting in a relative error of 3.8%.This point has the minimum pressure drop value among all other design points.In order to check if there is a better point, this derived optimal