# Aerodynamic Shape Optimization - The Adjoint CFD Method #### Aerodynamic Shape Optimization - The Adjoint CFD Method

For more information, visit https://www.airshaper.com or email [email protected] ---------------------------------------------------------------------------------------- In this video, we'll discuss Aerodynamic Shape Optimization using the adjoint technique. General optimization problems Imagine we want to maximize a certain output value Y (like airfoil lif) by changing the input variable X (like the angle of attack). The relationship between both can be expressed through a mathematical function, which we'll call the objective function. To find the maximum lift value, we can pick a random angle of attack value on the X-axis and then calculate the corresponding lift value on the Y-axis. We can then pick a second point close to it and do the same thing. With these two data points known, we can calculate the local gradient, which indicates the direction in which we need to march to get closer to the maximum. After enough steps, you will have reached the maximum. The downsides of this technique are that you can miss the peak or get stuck on a local peak, but this is the general procedure used in gradient-based optimization techniques. Aerodynamic Optimization In aerodynamic simulations, the airflow around an object is chopped up in small pieces called cells within a mesh. The surface of the object is also chopped up into small pieces called surface cells with nodes on the corners. To obtain the total drag or lift of the object, we need to integrate the pressure & friction forces on all these local surface cells to get the total value. This indicates that the position of each individual node has an influence on the final drag & lift on the object. The objective function, therefore, has thousands if not millions of input variables: the X, Y and Z coordinate of each individual node. To obtain the local gradient, you would need to move one node individually and then re-run the entire calculation to calculate the local gradient. With that information, you know whether to push the node inward or outward to increase or decrease the objective function. Once you have obtained all these local gradients, you can put them together into what is called a surface sensitivity map. As you can imagine, re-running the entire simulation for each node displacement can become very expensive. Luckily, there is something called the adjoint technique. Adjoint The adjoint technique allows you to calculate all of these local gradients, or sensitivities, in one single simulation. Here's how this works: - Normal aerodynamic simulation (primal or forward simulation): After the computational mesh has been generated, the flow field is typically initialized using a fixed value (zero or something else). Then, the properties defined at the boundary conditions (like an inlet flow velocity for a virtual wind tunnel) propagate through the domain. After enough small time steps, the solution will have converged to a stable flow field. - Adjoint simulation (dual or backward simulation) Starting from the aerodynamic simulation data, the adjoint simulation will take small "time" steps. It calculates backward from the objective function to see how each node position affects this objective function. Based on these results, we can then calculate all the local gradients and construct the sensitivity map. So instead of running a full aerodynamic simulation for each local gradient calculation, which would be prohibitively expensive, we can now calculate all the gradients with just two simulations: the normal (primal) and the adjoint (dual) simulation. Morphing The next step is to use the input of the sensitivity map and start implementing it: move the surface inward or outward based on what the map tells you. Once you have morphed the 3D object, you can re-run the aerodynamic simulation to see how much the objective value has changed. You can then also re-run the adjoint simulation to create a new sensitivity map and to the morphing again. With each cycle, you will get closer to the most optimal shape for your object. You can do this for the entire object or you can define a design space in which the algorithm can operate. Porsche Taycan Interestingly enough, the adjoint optimization technique - when asked to increase downforce - starts to create the iconic ducktail spoiler that Porsche has been applying for years. For more information or to run your own optimization project, just contact AirShaper at [email protected] ----------------------------------------------------- The adjoint code used is part of OpenFOAM v2012 and was developed by the Parallel CFD & Optimization Unit of the National Technical University of Athens (http://velos0.ltt.mech.ntua.gr/research/index.html). Details about the theoretical background of the adjoint method can be found in the publications listed here: http://velos0.ltt.mech.ntua.gr/research/pubs.html