# Foil Optimization with Geodesic Convolutional Neural Network

École Polytechnique Fédérale de Lausanne Mandles Prize

**Foil Optimization with Geodesic Convolutional Neural Network** Thomas von Tschammer & Grégoire Chomette

EPFL-Mechanical Engineering Department, HydroContest EPFL & Computer Vision Laboratory. Supervisors : Dr.Flavio Noca, Pierre Baqué & Robin Amacher

## Abstract.

In this study, we demonstrate the application of a novel numerical optimization method for Hydrofoil shapes on EPFL’s Hydrocontest race boat. We show that the numerical optimization method based on Geodesic Convolutional Neural Network techniques (Baqué et al, ICML 2018), improves the foil’s design upon previously manually optimized shape. We first demonstrate the potential of this approach on the simpler 2D hydrofoil profile optimization, using the XFoil CFD simulator (Drela, 1998). We then extend this method to the optimization of the full 3D shape, using MachUpPro, (Usu AeroLab, 2017), an advanced non-dimensional lifting surface analysis code. This project was done in collaboration with the Computer Vision Laboratory of EPFL, the HydroContest EPFL association and the Spin-Off Neural Concept.

Optimizing the hydrodynamics properties of hydrofoils is now key to designing their shapes. However, it remains very challenging because actual Computational Fluid Dynamics techniques rely on solving the known Navier Stokes equations and this has to be performed for every different shape. Hence, this has proven over the years to be extremely computationally demanding but also quite restrictive. Indeed, with classical CFD techniques, the changes in geometries are limited, as only a few designs can be tested before reaching a final geometry. Those limitations were the main reasons and motivations for this project. As it will be shown, more complex geometries can now be tested as multiple degrees of freedom can be changed at the same time, and it is possible to fine tune each of the geometrical parameters.

**Keywords.** Neural Network, Aerodynamics, Computational Fluid Dynamics, XFoil, MachUp.

## 1 Introduction

Ecology has become, throughout the years, an inevitable subject in every industrial field. Indeed, reducing energy consumption means a more efficient and a more cost effective company. This is especially true for the transportation industry, which are using large containers and where the fuel consumption is reaching unprecedented levels.

HydroContest EPFL is an association which participates every year to the HydroContest competition. This competition is the first international student competition dedicated to naval energy efficiency. The Hydros Foundation provides each team with the same electric engine. The amount of available energy is imposed respectively to travel a set distance, ranking being made according to the running time, or to travel the most distance in an hour. Hence, students are invited to design, build and pilot the most energy efficient boat. This is why the hydrofoil became very quickly an essential part of every boat design, as it allows a massive reduction on the drag generated. It was with this idea in mind, a more efficient and hence a boat with better performances, that this project was born. While previous projects have been carried out by former team members (Jules Cochard [3] and Raphaël Markwalde [5]) improving the Lift-To-Drag ratio of the boat and the overall stability, the present study will use a completely different methodology to reach a foil optimization. Ultimately, the idea is to provide a new design to the HydroContest association to increase the performances of their boats.

HydroContest EPFL is competing every year with two boats: a light one and a heavy one. This foil optimization is focusing on the light boat design. This boat is a bi-foiler of almost 50 kilograms (48kg), flying at a maximum velocity of 7 m/s. The boat contains two foils which allows to fly once the take-off speed is reached (around 3-4 m/s). The main foil is responsible for about 85% of the total lift while the auxiliary foil has more a function of stabilizer, and the fin maintain the overall direction. As seen with figure 1, the main foil is also made of flaps, to control the boat. The foil optimization will focus on the main foil, where an improved design would show a noticeable increase in performances.

This light boat has already proven to be very efficient and has had very good results in the yearly HydroContest Competition. Indeed, it made third at the 2014’s race and then second at the long distance race of 2016, while winning the innovation and eco-conception prizes. Its design is improved throughout the years and the current version is showed with figure 2 where we can see it traveling (and flying) during the 2016 race.

The first foil that was used for the Hydro Contest’s light boat was called Mach 2. It was a simple NACA profile with a linear reduction of the chord along the span, without sweep, washout, nor dihedral angle. Then two students spent their master semester project optimizing the foil’s shape

using standard CFD packages, such as XFoil (Drela, 1989), JavaFoil or Ansys Fluent (Inc.,2011). This research has been conducted in partnership with Pierre Baqué, from EPFL’s ComputerVision Laboratory, who developed a machine learning program able to predict hydro and aerodynamics performances of foils. This project was born with two very concrete goals: coming up with a new foil design for the light boat but also, with more generality, being able to apply this powerful tool to some other hydrodynamics problems.

## 2 Background

### 2.1 Model Parameters

As it will be shown further, the parameters required for this project are listed in Table 1. First of all, the operating pressure has to be determined. We consider here that our foil is located at a depth of 27 cm in the water :

This leads to the first dimensionless number that is needed to describe the problem: the Reynolds number.

This allows us to find the Mach number to assess the compressibility of the flow:

Hence, the flow will be considered as incompressible as the Mach number is much smaller than the usual limit for compressible flows.

The geometry of a foil is made of some very important parameters that are defining its properties: chord length c, dihedral angle θ, washout angle α and sweep angle φ. Some basics assumptions on the geometry can already be made without any CFD analysis and by using these parameters. The light boat needs to have a very good roll stability as the boat should not tilt during its travel. This can be done by increasing the chord length away from the root of the foil, which would generate more lift far from the center, and hence more rolling moment. Dihedral angle also has a very big influence on the stability in the roll axis. It allows to generate more lift on one side when the boat is tilting, hence bringing it back to its initial position. However, it reduces the overall lift as only the vertical component is taken into account. The washout angle is introduced to change the angle of incidence of the wing along the span (greater at the root and decreases along the span). This ensures that at stall speed, the wing root stalls before the wing tips, which increases the stability but also makes it more resistant to entering a spin.

### 2.2 Theory

As mentioned earlier, Computational Fluid Dynamics (CFD) techniques are very challenging and computationally demanding, as it relies either on solving the Navier-Stokes equations or on Lattice Boltzmann methods. This is where machine learning algorithms have a big role to play. Throughout this project, Geodesic Convolutionnal Neural Networks were used (GCNNs). In a few words, the input given is a set of generic surfaces parametrizes as meshes, then the CGNN is trained to predict their aerodynamics characteristics, as computed by standard CFD packages (here XFoil [4] for the 2D and MachupPro for the 3D), which are then used to write an objective function. Then we use a gradient-based optimization to explore the shape parameters of the studied object. One of the many advantages of such a method is that it makes it possible to perform the CGNN’s computations on GPUs instead of CPUs, as for normal CNNs.

The machine learning algorithm will, for each iteration, generate a shape of foil, and make a simulation with the selected CFD Software to find out the hydrodynamics parameters. These parameters are calculated using an objective function where some weights are inserted for each goal (lift to drag ratio, pitch stability . . . ). The algorithm tries to minimize the difference between its prediction and the «real» values predicted by the software. After each iteration, the weights of the function’s coefficients are modified: the algorithm trains to improve its outputs.

Here the first goal of the objective function is pretty straightforward: increasing the lift to drag ratio, with a lift that allows to keep the boat in the air (here the lift must be equal to 85% of the total weight of the boat). The second and as important goal of this objective function is to increase the pitch stability. This is directly linked to the relation between the pitching moment coefficient and the angle of attack. Indeed, ideally, for the operating angle of incidence and the pitching moment decreases as the angle increases (negative slope). This is a good indicator of stability:when the nose of the boat starts to «dive», the hydrodynamics forces tend to push it back up. Finally, the curve’s slope shows the strength of this stabilizing force. All these goals are used to build the objective function. First of all, at the operating angle (here set to 0◦), the pitching moment has to be exactly compensated by the moment generated by the lift of the elevator located at a certain distance, leading to Cm = 0 (see figure 1). Then, a term in the objective function is introduced to make the slope of the pitching moment against the angle of incidence curve as negative as possible: this means the difference between the moment generated by the main wing and the moment generated by the lift of the elevator must be as high as possible when leaving the operating point (here at 2◦).

Finally, to model the flaps, it was assumed that they appeared at 35% of the total chord, starting from the trailing edge. During the take-off, flaps are used to increase the lift, therefore the difference of when the flaps are inactivated (β = 0◦) and when the flaps are activated (β = 10◦) must be maximized. Finally, to maximize rolling stability, when one flap is up (β = −10◦) and the other one down (β = 10◦), the induced rolling moment of the main foil has to be maximized. All these arguments are valid for the 2D optimization and were developed by Grégoire Chomette[2]. The downside of this method was that it was only partially automatic because, once this 2D optimization was done, the user needed to manually enter the different slices in a 3D software to compute the real performances. The idea is then now to directly perform the optimization using a 3D software.

Regarding the 3D optimization, the optimization is performed on meshes and their shape evolves for every iteration until it reaches an «optimal» form, with respects to the constraints given. The idea is now to train the CNN on the software, which will give 3D coefficients of the wing. Hence, with a 3D model, the objective function developed above will be more comprehensive and will also allow to introduce the rolling and yawing moment coefficient in the analysis. The same arguments that were developed for the pitching moment in 2D will be valid for these other moments, as it is very important to increase as much as possible the stability of the hydrofoil in all directions. These two moments will have a major influence in case of the flow having a sideslip angle, which will then also increase the side force coefficient (CY ).

## 3 Simulation

### 3.1 2D Simulation

#### 3.1.1 Objective of the 2D simulation

Before starting with this brand new project, two studies of the foil had been realized in the Hydrocontest EPFL team. Therefore, the objective of the first step of optimization with the geodesic convolutional neural network was to find a new 2D profile to insert in the global 3D geometry proposed by [5]. With the good set of constraints and an efficient objective function, the neural network can propose a design with better hydrodynamics performances than the current profile.

#### 3.1.2 Final foil profile retained

After several weeks of optimization adjusting the parameters and their weights in the objective function, the computer had sufficient data to improve its predictions and to propose a final profile. The latter is shown in the following figure 3, without flap, and with a flap activated at an angle of 10◦.

#### 3.1.3 Hydrodynamic performance

First, the relation between the pitching moment coefficient and the angle of incidence was computed, as it allows to determine the operating angle of incidence of the foil, and the longitudinal stability of the boat. The graph is presented on the figure 4 below.

While the blue, grey, and orange curves were computed for old configurations of the boat without the use of GCNNs, the yellow one represents the configuration with the new foil proposed. The slope of the yellow curve has increased by around 100 % in absolute value, which corresponds physically to a proportional increase in longitudinal stability of the boat. Then, the operating position of the boat is reached when the pitching moment coefficient is equal to zero. This condition happens for an α of 0,5◦for the new design. At this point, the lift over drag ratio for this operating condition must be analyzed. To this end, the figure 5 is shown below.

The same colours are used in this graph, with a yellow curve showing the hydrodynamic

performance with the new foil. This yellow curve occurs to be higher in comparison to the previous configurations (by around 25%). After finding the intersection between the thrust and the drag of the new foil in another analysis, it has been shown that the new foil would increase the velocity of the boat by around 15% due to drag reduction for the same lift generated.

Thus, with the new technique developed with the GCNNs, a new 2D profile was found, able to replace the existing NACA profile and yielding to improvements in both longitudinal stability and velocity. However, increasing other parameters like the roll stability was not possible with the 2D simulation as it would require to change not only the 2D profile, but also the 3D geometry of the foil.

### 3.2 3D Simulation

Once satisfying results were obtained with the 2D simulations, we wanted to go further in our research by using the GCNNs on 3D shapes. Hence, the initial idea was to use XFLR5, the software that was used to assess the 3D performances of the 2D-optimized wing. It turned out that, by the time of our project, the the GUI and the analysis engine were, and still are, too intricated. It would ask a deep rework of the code and was not possible within the scope of this project. Hence, the idea was then to find another software with the same capabilities. The focus rapidly turned to the USU Aerolab, which has developed during the past years, an advanced non-dimensional lifting surface analysis code : MachUp. It is a very recent algorithm based on a modern numerical lifting-line algorithm developed by Dr. Warren Phillips and Dr. Deryl Snyder (now Director Aerospace and Defense Sector at CD-Adapco). This analysis approach is similar to that taken analytically by Ludwig Prandtl, but uses modern computing strategies to equate the section theory of lift to the 3D vortex theory of lift. This results in an algorithm which is extremely fast and versatile for predicting the aerodynamics of various wing geometries as well as interactions between multiple wings. MachUp also includes viscous effects and has been validated against the code developed by Dr. Warren Phillips, upon which most of his research is based. Additionally, this method has been found to match the accuracy of CFD for wings with aspect ratios greater than about 4.

Schematic of all the different steps of this project is shown with figure 6.

The first step was now to interface the current Python algorithm with MachUp, which was developed in the Fortran language. This software uses 2D airfoil data properties as inputs and it was important to normalize the output of the machine learning code to give as input the necessary information. One of the numerous advantages of MachUp is its versatility. As mentioned, slices of airfoils are used to create a 3D geometry. Here it was possible, for every slice chosen, to fix its root chord, tip chord, span, sweep, dihedral angle and washout. This means that, theoretically, it is possible to create any geometry of wing. The first step was then to get familiar with MachUp as very few documentation is available and this software is fairly new.

### 3.3 3D Airfoils generation

An important part of this project relied on the creation of 3D airfoils using .tmu files. These files are the ones generated by the CNN, they consist in a series of coordinates : first the 11 different profiles, with their respective (x,y,z)

coordinates. Each profile is made of 100 points in every coordinate. As mentioned, there are then 10 different slices for each profile, and then the last profile which corresponds to the tip profile of the airfoil. For each of the slice is provided (in the following order) :

- The chord length of the profile.
- The washout angle of the slice.
- The x-shift of the profile (which will be responsible for the sweep of the foil)
- The z-shift of the profile (which will be responsible for the dihedral angle of the foil).

MachUp software needs a very precise input in order to compute the desired properties. Hence, this .tmu file needed to be converted into a .json file which MachUp would accept. The main goal was then to be able to understand well enough this very new software to be able to recreate any geometry given as input (as a .tmu). Three main steps constituted this project :

- Being able to recreate any wing geometry from an input .tmu file from the geodesic convolutional Neural Network.
- Launch Machup with the correct and normalized input from this .tmu file.
- Create a normalized output from MachUp to assess its performances and train the neural network.

#### 3.3.1 Reading Input files

****First of all, it has to be noticed that MachUp allows many different options in wing configuration. The chosen one was the following. One wing made of 11 different profiles, specified along the span. In order to give all the corresponding parameters to Machup, a chord.txt, washout.txt, sweep.txt and dihedral.txt needed to be created. These files were made of a 2 vectors, where the first column was made of the normalized span (going from 0 to 1) and the second one was made of the specified parameter.

MachUp is able to assign wing parameters along the span of the airfoil, and this for as many points as desired. Here 101 points are used along the span (10 different profiles with 10 different slices insides and the last point corresponding to the last profile “closing” the wing) and hence, 101 different values of chord, washout angle, sweep angle and dihedral angle should be assigned. Using the chord value from the .tmu file, we were able to recreate the chord.txt file needed for MachUp. The chord and washout were explicitly given in the .tmu file. Regarding the washout, the algorithm had to be developed with care because the profiles generated were already having this washout angle within the given coordinates. Hence, in order to simplify the XFoil calculations (as explained later), the profile was shifted back to a 0◦washout using a rotation matrix and then the washout was re-specified to Machup in a .txt file.

Now, the sweep and dihedral angles still needed to be computed. Regarding the sweep angle : as the chord reduces or increases along the span, a natural sweep will appear. The idea was then to “counter” this natural sweep : introducing a sweep opposite to this natural sweep and then adding the sweep angle corresponding the shift in the x-direction given for each slice.

The same computation is made for the dihedral without the correcting term as the chord as no influence on the shift in the z-direction.Then these four files are saved as .txt files and specified to MachUp. Finally, some parameters such as the references values in the longitudinal and lateral area need to be specified. One very important feature of this software and something that is not used for now, is the ability to add many different control surface geometries like ailerons, elevators, flaps and rudder. For the scope of this project, the design remains with a simple wing to first assess the real performances of the software.

MachUp also has the ability to generate .stl files from the input given, corresponding to the wing that will be analyzed. These files were largely used to assess that the algorithm was generated the corresponding wings from the CNN to MachUp. An example is given with figure 7

where is it possible to see many different foils shapes randomly generated by the CNN. The objective was to get to an identical shape for any kind of .tmu file, hence for any kind of geometry generated.

Finally, a .txt file had to be created, which specified the location along the span of each and every profile used for the current design. These eleven profiles were evenly distributed along the span and a linear interpolation was then performed between them, to ensure a smooth evolution of the profile of the hydrofoil.

#### 3.3.2 2D Airfoil Properties

The next step was then to use the 2D software XFoil to compute the 2D properties of the eleven different profiles given as input. The needed parameters are the following:

Hence, for each profile, XFoil is run for a wide range of alpha, starting at -3◦and ending as soon as the stall is caught, with an iteration step of 0.2◦.The benefit of having many data for each profile is that it allows Xfoil to make convergence error for some angle of attacks, without disturbing the final results. XFoil then returns the pressure coefficients along the profile and then the Lift, Drag and Momentum coefficients are computed. From these adimensionnal coefficients given for a range of angle of attack, it is then possible to compute the different parameters needed for each of the 11 profiles. As mentioned these profiles were shifted back to a 0◦washout angle before giving them to XFoil in order to simplify the calculations. Finally, all these parameters are written into the .json input file. This part is the one that takes the most time from the whole algorithm as it needs to call XFoil n number of times (with n = numberprofiles × rangeα). All these calls would take around 5 to 7 minutes with a single processor and this is why it was decided to switch this part to a multi-processing calculation where each of the processor takes care of one profile. Hence, the time of computation has then been reduced to around 40 seconds to 60 seconds.

#### 3.3.3 MachUp and Output files

The input file for MachUp is now ready, and the software can perform its calculation on the given airfoil. The output will be in the form of dimensionless coefficient in the 3 directions, for a viscous and inviscid solution. Pressure distribution along the airfoil is not computed as the software uses advanced lifting-line theory and the airfoil data properties as an input. It also has to be remembered that this theory gives accurate results for aspect ratio superior to 4. Hence this project will not be applicable to any geometry but will be restrained to thin airfoils. For more accurate results, the solver will be specified to “non-linear” even though it increases the computation time by a factor of 7 to 8. Indeed, with a convergence residual limit set to 1 × 10−6, the calculation time gets around 15 to 20 seconds.

The output is then normalized to an exploitable file, where performances will be compared to classical CFD Software as OpenFoam. As mentioned in 2.2 Theory part, 6 output files are generated as there are 6 different configurations tested. First of all, to assess the Pitching moment of the hydrofoil and its slope, three different angle of flow incidence are simulated (from -2◦to 2◦), to observe the behavior of the new design when the angle of attack is changed. Then, the sideslip angle is also changed, for three different configurations (from (-2◦to 2◦), to assess the Yawing and Rolling stability.

## 4 Discussion

****By the time of this report, the first simulations are being computed. Within the next weeks, comparison will be done with classical results from CFD Software to assess the accuracy of this project. If it turns out that it is possible to get a fairly good and reliable accuracy with this method, it will be a very promising and interesting tool as a full simulation take around 1 minute whereas it is within the scale of several hours for classical CFD Software. Another very promising feature is the fact that it is possible to recreate any kind of geometry very easily and it does not require any mesh generation, something which is extremely computationally demanding and lead to some quite difficult problems for complex geometries.

This project will not end with the end of this semester project but work will be carried this summer, the goal is to get to a final and 3D optimized shape for the foil of the HydroContest’s boat before the end of this summer. Hence, a production of it would then be the object of a future project. This is why discussions already started with the student who will be in charge of this design so he will be able to give a list of the pre-defined constraints that will need to be integrated to the algorithm in order to generate a design that matches the requirements. Furthermore, and as mentioned in the previous part, MachUp software allows the introduction of many different airfoil control surfaces, something that would be extremely interesting to compute simulations on full aircrafts and to assess their behavior.

## 5 Conclusion

****This project allowed to explore new ways of optimizing hydrofoils but more generally foils, using Geodesic Convolutional Neural Network. Even though it is still not possible to assess the real performance of the developed algorithm, it is very promising : it allows a calculation time around 1 to 2 minutes for a full simulation, whereas it is within the scale of hours for classical CFD softwares. The versatility and how comprehensive is the algorithm, as it is able to adapt to any kind of geometry, is also a major advantage. The only constrain is the theory used : Lifting Line theory limits itself to design with an aspect ratio bigger than 4. Next steps are now fine tuning the algorithm, optimize it to ensure a maximum precision. Then comparison will be done with OpenFoam to assess its performances, with the hypothesis that the CFD software gives the references values.

## 6 Acknowledgements

I would like to thank Dr.Flavio Noca for helping me with some questions I had throughout this project and Robin Amacher who allowed me to keep in mind the global scope of this project, as this will continue and hopefully end up with a new built design for the next HydroContest edition. But I also would like to thank personally Zach Montgomery from the USU Aero Lab who was very available and helped me to understand the way of using MachUp. Finally, I would like to thank Pierre Baqué from the Computer Vision Laboratory, who was advising me, but also helped me during the whole semester to explore new ideas.

## 7 Authors biography

Thomas von Tschammer is a 20-year-old student from Ecole Polytechnique Federale de Lausanne, currently in his first year of Master. He graduated from a bachelor in Mechanical Engineering and then he specialised his Master in Aerodynamics and Data Science. He worked now for 6 months on this project which counted as a semester project for his Master. This project was the continuation of Gregoire’s work to optimise foils’ shape using machine learning tools.

Grégoire Chomette is a 22 year old student finishing his Master at Ecole Polytechnique Federale de Lausanne. Grégoire is passionate about aerodynamics and renewable energies. He started the optimization of the foil for Hydrocontest’s lightboat in collaboration with EPFL’s CVLab, introducing new techniques of machine learning into the foil optimization. At the end of his project, he was able to propose a brand new design to improve both the velocity and the stability of the boat.

## References

**Baque, P., Remellil, E., Fleuret, F., & Fua, P. (2018).**Geodesic convolutional shape optimization.**Chomette, G. (2017).**Foil optimization with machine learning tools.*Semester project report.***Cochard, J. (2016).**Hydrodynamic optimization of a foil.*Semester Project report.***Drela, M. (2001).**Xfoil 6.9 user primer.**Markwalder, R. (2017).**Hydrodynamic optimization of a foil.*Semester project report.***Phillips, W. (2004).**Lifting-line analysis for twisted wings and washout-optimized wings.*Journal of Aircraft, 37, No. 4.***Phillips, W. & Snyder, D. (2000).**Modern adaptation of prandtl’s classic lifting-line theory.*Journal of Aircraft, 37, No. 4, 662—670.*