Upon completing this tutorial, the user will be familiar with performing an optimal shape design of a 3-D geometry. The initial geometry chosen for the tutorial is a ONERA M6 fixed wing at transonic speed in inviscid fluid. The following SU2 tools will be showcased in this tutorial:
SU2_CFD - performs the direct and the adjoint flow simulations
- SU2_GPC - projects the adjoint surface sensitivities into the design space to obtain the gradient
- SU2_MDC - deforms the geometry and mesh with changes in the design variables during the shape optimization process
- shape_optimization.py - automates the entire shape design process by executing the SU2 tools and optimizer
The resources for this tutorial can be found in the TestCases/euler/oneram6 directory. You will need the configuration file (inv_ONERAM6.cfg) and the mesh file (mesh_ONERAM6_inv.su2), note that the mesh file contains information about the definition of the Free Form Deformation (FFD) used for the definition of 3D design variables.
The following tutorial will walk you through the steps required when performing 3-D shape design using SU2, and FFD tools. It is assumed that you have already obtained and compiled SU2_CFD, SU2_GPC, and SU2_MDC. The design loop is driven by the shape_optimization.py script, and thus Python along with the NumPy and SciPy Python modules are required for this tutorial. If you have yet to complete these requirements, please see the Download and Installation pages.
This example uses a 3-D fix wing geometry (initially the ONERA M6) at transonic speed in air (inviscid calculation). The design variables are defined using the FFD methodology, and at the end of the mesh_ONERAM6_inv.su2, the description of the FFD box is provided:
Note that, only the corners of the box, and the polynomial degree in each direction are provided.
The goal of the design process is to minimize the coefficient of drag (Cd) by changing the shape of the airfoil without any constraints, as design variables we will use the z-coordinate of the control points position. As the shock have is located on the upper side of the wing, only the control points on the upper side will be used as design variables.
Mesh Description and Preprocessing
It consists of a far-field boundary divided in three surfaces (XNORMAL_FACES, ZNORMAL_FACES, YNORMAL_FACES), an Euler wall divided in three surfaces (UPPER_SIDE, LOWER_SIDE, TIP) and a symmetry plane (SYMMETRY_FACE). The specific wing is the ONERA M6, and more information on this simulation can be found in the configuration file. The surface mesh can be seen in Figure (1).
Figure (1): View of the initial surface computational mesh.
Figure (2): View of the initial FFD box, control points and the surface mesh.
As we have noticed, the mesh file only contains information about the limits of the FFD box. As a preprocessing it is necessary to calculate the position of the control points and the parametric coordinates, follow these steps at a terminal command line:
- Move to the SU2/SU2Py/ directory. The SU2_MDC can be found here if SU2 was built using the build_SU2.py script. If not, then compile SU2_MDC individually and make sure that a copy is placed in the SU2/SU2Py/ directory.
- Copy the config file (inv_ONERAM6.cfg) and the mesh file (mesh_ONERAM6_inv.su2) to this directory.
- Check that DV_KIND= NO_DEFORMATION in the configuration file.
- Execute SU2_MDC by entering "./SU2_MDC inv_ONERAM6.cfg" at the command line.
- After a some time, a mesh file called "mesh_out.su2" is now in the directory, rename that file to "mesh_ONERAM6_inv_FFD.su2". Note that this new mesh file contains all the details of the FFD method.
With this preprocessing the position of the control points and the parametric coordinates have been calculated. The FFD box and the control points can be seen in Figure (2).
Configuration File Options
Several of the key configuration file options for this simulation are highlighted here. Please see the configuration file page for a general description of all options.
As the numerical mesh with FFD will be used in the optimization, it is fundamental to change the name of the mesh input file in the configuration file, note that we will use tecplot for the visualization.
Optimal shape design specification:
Here we define the objective function for the optimization as drag with lift constraints. The DEFINITION_DV is the list of design variables. For this problem, we want to minimize the drag by changing the position of the control points. To do so, we define a set of FFD control points. Each design variable is separated by a semicolon. The first value in the parentheses is the variable type which is 7 for control point movement. The second value is the scale of the variable. The name between the vertical bars is the marker tag where the variable deformations will be applied. The final seven values in the parentheses are the particular information about the deformation: identification of the FFD chunk, ijk index of the control point, and xyz movement direction of the control point. Note that other types of design variables have their own specific input format.
A continuous adjoint methodology for obtaining surface sensitivities is implemented for several equation sets within SU2. After solving the direct flow problem, the adjoint problem is also solved which offers an efficient approach for calculating the gradient of an objective function with respect to a large set of design variables. This leads directly to a gradient-based optimization framework. With each design iteration, the direct and adjoint solutions are used to compute the objective function and gradient, and the optimizer drives the shape changes with this information in order to minimize the objective. Two other SU2 tools are used to compute the gradient from the adjoint solution (SU2_GPC) and deform the computational mesh (SU2_MDC) during the process. To run this design case, follow these steps at a terminal command line:
- Move to the SU2/SU2Py/ directory. The shape_optimization.py script can be found here, along with the SU2_CFD (serial version), SU2_GPC, and SU2_MDC if SU2 was built using the build_SU2.py script. If not, then compile each tool individually and make sure that a copy is placed in the SU2/SU2Py/ directory.
- Copy the config file (inv_ONERAM6.cfg) and the mesh file (mesh_ONERAM6_inv_FFD.su2) to this directory.
- Execute the shape optimization script by entering "python shape_optimization.py -f inv_ONERAM6.cfg" at the command line, add "-p 6" in case you want to run the optimization in parallel (6 processors). Again, note that Python, NumPy, and SciPy are all required to run the script.
- The python script will drive the optimization process by executing flow solutions, adjoint solutions, gradient projection, and mesh deformation in order to drive the design toward an optimum. The optimization process will cease when certain tolerances set within the SciPy optimizer are met. Note that is is possible to start the optimization from a pre-converged solution (direct, and adjoint problem), in that case the following change should be done in the configuration file: RESTART_SOL= YES.
- Solution files containing the flow and surface data will be written for each flow solution and adjoint solution and will be numbered in succession. Note that these do not correspond to major optimizer iterations, as the SciPy algorithm chosen may require several flow solutions for each iteration in the gradient-based method. The file named optimization_inv_ONERAM6.plt will contain the functional values of interest resulting from each flow solution during the optimization.
Figure (3): Pressure contours showing transonic shocks on the initial design.
Figure (4): Pressure contours around the final airfoil design.
Figure (5): Optimization history.
Please take a minute and complete a brief survey about your experience with this tutorial. Your feedback is anonymous and goes toward improving your experience with the software.