Modeling and Optimizing Airfoil Shapes using Generative Adversarial Networks and Computational Fluid Dynamics A Graduate Project Report submitted to Manipal Academy of Higher Education in partial fulfillment of the requirements for the award of the degree of BACHELOR OF TECHNOLOGY in Mechanical Engineering by Abhimanyu Arora Sarvagya Kumar Under the guidance of Dr. Sanjay Singh Professor Department of I & CT Manipal Institute of Technology Bhagyalaxmi S Hegde Assistant Professor (Sr. Scale) Department of M & ME Manipal Institute of Technology July 2021 Manipal 18/06/2021 CERTIFICATE This is to certify that the project titled Modeling and Optimizing Airfoil Shapes using Generative Adversarial Networks and Computational Fluid Dynamics is a record of the bonafide work done by Abhimanyu Arora (170909124) and Sarvagya Kumar (170909548) submitted in partial fulfillment of the requirements for the award of the degree of BACHELOR OF TECHNOLOGY in MECHANICAL ENGINEERING of Manipal Institute of Technology, Manipal, Karnataka (A constituent unit of Manipal Academy of Higher Education) during the year 2020-2021. Dr. Sanjay Singh Professor Department of I & CT Manipal Institute of Technology Bhagyalaxmi S Hegde Assistant Professor (Sr. Scale) Department of M & ME Manipal Institute of Technology Dr. Sathyashankara Sharma Head of Department, Department of Mechanical and Manufacturing Engineering CONTENTS ACKNOWLEDGMENTS i ABSTRACT ii LIST OF NOTATIONS AND ABBREVIATIONS iii LIST OF FIGURES iv LIST OF TABLES vi Chapter-1 INTRODUCTION 1 Chapter-2 LITERATURE REVIEW 16 Chapter-3 OBJECTIVES AND METHODOLOGY 21 Chapter-4 RESULT ANALYSIS 31 Chapter-5 CONCLUSIONS AND SCOPE FOR FUTURE WORK 40 REFERENCES 42 Plagiarism Report 43 ACKNOWLEDGEMENTS We are grateful to our respectable mentor, Dr Sanjay Singh, Professor, Department of Information and Communication Technology, whose insightful leadership and knowledge helped us complete this project successfully. Thank you so much for lending direction and purpose to our project. To Ms. Bhagyalaxmi, Assistant Professor (Senior Scale), Department of Mechanical and Manufacturing Engineering, Manipal Institute of Technology, Manipal, we express our sincere gratitude for her valuable guidance, continuous support and presence whenever needed. We are greatly indebted to all the faculty members of the Department of Mechanical and Manufacturing Engineering, Manipal Institute of Technology, for all their guidance and motivation. We would like also to thank our peers for their constant encouragement and invaluable support. ABSTRACT Airfoils are the cross-sectional shapes of structures, that are designed to generate a desirable lift to drag ratio when passing through a fluid. Airfoils can have different shapes based on the requirements of their applications like aircraft, turbines, ship hulls, race car wings etc. They work on the basic principle of Newton’s second law and are designed to utilize aerodynamics in the most efficient manner possible. Engineering design methodologies have largely been human intensive actvities which have been augmented by tools like AutoCAD, FEA Analysis, Computational Fluid Dynamics etc., but as the next pardigm of Industry 4.0 approaches, tools like Machine Learning and Deep Learning can be leveraged for design and maintainance. One such architecture is a Generative Adversarial Network (GAN), introduced in 2014 by Ian Goodfellow. A well trained GAN can generate new instances of data with inputs from a known distribution, that are almost indistinguishable from real world data. We implement, and modify this architecture to design airfoils which are then extrapolated to 3 dimensions, and analysed for their performance The analysis is done using the Computational Fluid Dynamics (CFD) tool ANSYS Fluent, which utilizes the Navier-Stokes Equation and the Continuity Equation to accurately model how airfoils behave when moved through a fluid. In this project we shall focus on airfoils that are specifically used in aircraft, although the methodology is designed parametrically and allows for the design of airfoils for multiple applications. LIST OF NOTATIONS AND ABBREVIATIONS α: Angle of Attack (AOA) CL: Coefficient of Lift CD: Coefficient of Drag NACA: National Advisory Committee for Aeronautics J(θ): Loss Function D(x): Discriminator Output (real input) G(z): Generator Output ρ: Density of Fluid μ: Dynamic Viscosity of Fluid L: Characteristic Linear Dimension Re: Reynolds Number ∇: Del operator (derivative) ΔU: Change in Velocity GAN: Generative Adversarial Network AAE: Autoencoder Adversarial Network LIST OF FIGURES Figure No. Figure Title Page No. 1.1 Airfoil Applications 1 1.2 Point Clouds 2 1.3 Neural Network 3 1.4 Training: Forward Pass 4 1.5 Training: Backward Pass 5 1.6 Gradient Descent 6 1.7 Kernel 7 1.8 Simplified GAN Structure 10 1.9a Flight: Forces 14 1.9b Flight: Moments 14 1.10 Stall Condition 15 2.1 GAN Generation Pipeline 17 2.2 Sampling Generated Models 18 2.3 Training AAE 20 3.1 Single Iteration of building a 3D Airfoil Point Cloud 22 3.2 3D airfoil sample from database 22 3.3 Subsampled points 23 3.4 Encoder, Generator and Discriminator Architecture 24 3.5 Generated Airfoil Sample 25 3.6 ANSYS Fluent Setup 26 3.7 a/b/c Front/ Top/ Isometric View of Geometry 27 3.8 a/b Boundary Layer, Front View of 3.9 a Type 2 Geometry 29 3.10 b/c Type 2 Mesh 39 4.1 Pressure Contours 32 4.2 Lift/Drag Ratio 33 4.3 Scaled Residuals 34 4.4 Velocity Streamlines 34 4.5 Scaled residuals/ Lift-drag Ratio at 10deg 36 5.1 Internal Structure Concept Figure 41 28 Mesh LIST OF TABLES Table No. 2.1 Figure Title Results for Minimum matching Page No. 20 4.1 CFD Setup 31 4.2 Benchmark (8˚) 35 4.3 Benchmark (10˚) 36 4.4 Benchmark (12˚) 37 4.5 AAE Airfoil (8˚) 38 4.6 AAE Airfoil (10˚) 38 4.7 AAE Airfoil (12˚) 39 CHAPTER 1: INTRODUCTION 1.1 Airfoils Airfoil: a structure of curved surfaces designed to give the most favorable ratio of lift to drag when passing through a fluid, it is the basic form used in aircraft wings, propeller blades, fins, stabilizers, ship hulls, race car spoilers etc. Fig 1.1 Airfoil Applications The airfoil structure is characterized by the dimensional parameters: leading edge, trailing edge, chord length, camber line and maximum thickness. Most real-world applications of airfoils tend to be asymmetric in nature since they perform better, aerodynamically. To maintain international standards, airfoils are designated as NACA notations, which we shall also be adhering to. 1 1.2 Point Clouds Point Cloud: Simply put, a point cloud is a collection of data points in a predominantly 3D space. It is generally arranged in a XYZ co-ordinate format with the dimensions: n x 3 and might have additional attributes that define its nature. Some include: Point cloud density, Color coding in form of RGB etc. Fig 1.2. Point Cloud The point cloud was primarily used in mapping aerial and ground data using laser scanners in the domain of remote sensing. However, recently it has gained foothold in a lot of different domains which require a 3D geometry and scanning. Data from 3D scanners is being used to create 3D CAD models for machine parts, for metrology and quality inspection, and in rendering and animation domains. The versatility of point clouds and ease of creation have been the driving factors behind its adoption. All one needs for creating representative point clouds are 3D scanner and a CAD/CAM conversion software. Additionally, the point cloud preserves a lot of geometric information of a 3D structure that helps in analysis without much loss of information. One drawback of using a point cloud instead of surface points or polygon meshes in 3D modelling is higher loss of surface information and losing the local connection between constituent points. In our project, we use point clouds for generative modelling due to its ease of creation and as an attempt to bridge the gap with polygon meshes and voxels. 2 1.3 Neural Network Machines can’t think or are not intelligent. Here intelligence is defined as a trait that certain living beings possess which helps them adapt to an unseen or trying situation without being explicitly fed the information on how to adapt. Neural networks are an attempt to mimic the working of the human brain, as a whole connection of neurons, a part of whom gets activated in response to a stimulus thereby having a unique neural pathway for different purposes. Fig 1.3. Deep Neural Network Similarly, a neural network is a collection of neurons which consists of node layers: input layer, hidden layers, and an output layer. Each neuron of each layer has a corresponding weight and a bias (a type of activation threshold). There are only specific instances or stimulus to which a neuron will be activated and pass data to the connecting neuron in the next layer. Like human brain, a neural network learns from experiences also called training. That is, we require prior data to train the neural network and nudge the weights and biases towards optimality, thereby changing a desired metric in the right direction. 3 There are 2 phases in which training happens: the forward pass and the backpropagation: Forward pass: Each node is a linear regression model in itself. It is composed of x(input), w(weights), b (bias or y-intercept) and y(output). Note that all operations in a neural network happen in a tensor or matrix form, where each all the parameters are a matrix of values. The weight matrix helps in deciding which value of the input data is given more importance and which one less. Once y is determined for that particular node, it can undergo additional mathematical operations or get passed to the next layer where similar operation happens. Fig 1.4 Forward Pass Backward Pass: Before the backward pass, the results of the forward pass are matched against the ground truth (during training) and the difference or the loss function is calculated. The loss function type is dependent on the type of machine learning problem. For our project, we have taken the chamfer loss, which will be explained below. Afterwards, the loss function is propagated backwards through the nodes, as partial derivative of the weights and biases using chain rule. 4 Fig 1.5. Backpropagation In the above figure, let’s look at the update to the parameter θ11(1). Looking at the 2 paths that data going through this parameter can take (orange and blue), the partial derivative of the loss with respect to θ11(1) is given by: That is, in total 10 partial derivatives were needed for the neural network for update of 1 weight parameter. Note that J(θ) is the loss function that is propagated backwards. The update to the weights happens according to an algorithm called gradient descent which is explained below. 5 1.4 Gradient Descent Gradient Descent is an optimization algorithm that most machine learning models are based on. Here gradient means slope of a function (here the loss or cost function) and descent means updating that derivative to a minimum. The higher the gradient, the steeper the slope and the faster the learning will take place. But if the slope is zero, the model stops learning. In the above equation, the initial value of the parameter θ is updated by the partial derivative of the cost function with respect to the parameter. A learning rate alpha is applied to control how fast or slow the descent happens. Too fast a descent would mean the parameter value jumping around the optimum while slow learning rate means slower convergence and a possibility of a local minima. Fig 1.6. Gradient Descent 6 1.5 Convolutional Layer Convolutional neural networks are the go-to models for spatial analysis and finding hidden patterns in data which has a geometric structure. A convolutional layer makes use of filters to perform mathematical operations on data to convert it to a more discernable form (for the machine). A convolution converts all the pixels in its receptive field into a single value. For example, if you would apply a convolution to an image, you will be decreasing the image size as well as bringing all the information in the field together into a single pixel. The final output of the convolutional layer is a vector. This helps in capturing geometric information and reducing size of the input data for better computation. Fig.1.7 Kernel The convolutional filter (or kernel) strides through the input sample convolving it to extract high level features. A number of convolutional layers can be added together to extract different sorts of feature which will be useful for the model to process the input. In this project, we deal with 2 kinds of convolutional layers: Conv2D layers: Here the convolution operation is performed on 2 dimensions. Conv1D layers: The convolution operation is performed on only 1 dimension. 7 1.6 Chamfer Loss The loss function that we use in our model is chamfer loss, which is basically a distance metric useful for 3D point cloud data. It takes the distance of each points into account. For each point in each cloud, CD finds the nearest point in the other point set, and sums the square of distance up. The formula for this distance metric is: Here S1 and S2 are two 3d point clouds. The first half of the equation implies finding the point in S2 that is nearest to the given point in S1. The second half of the equation implies finding the point in S1 that is nearest to the given point in S2. In 3D generative models, chamfer distance is preferred to other forms of loss functions because of its ability to be fully differentiable everywhere which helps in gradient calculation. In comparison to losses like earth mover distance, chamfer distance is less computationally intensive owing to loss of features like one to one mapping but giving almost negligible decrease in results for a given application. 8 1.7 Generative Adversarial Networks Generative Adversarial Networks, or GANs for short, is a generative model architecture based on deeplearning techniques. GANs architecture is made up of two sub – models: • Generator: This is a neural network that takes noise as input, usually a known distribution like a Gaussian Distribution, and then transforms it into an instance of the required output. In our case, an airfoil. • Discriminator: This is a classifier network that is trained to distinguish between real data and fake data generated by the Generator The Discriminator has two loss functions, i.e., Discriminator loss and Generator loss. During Discriminator training, it ignores generator loss and updates its weights by backpropagating from discriminator loss only. The training of the Generator takes place with the help of the Discriminator, with the following process: a. Use noise as input to generate output b. Use the generated instance as an input for the discriminator c. Calculate the loss from the discriminator d. Build gradients and use them to change generator weights The discriminator and generator are trained alternatively, keeping one constant while the other is trained. The GAN is considered to be successfully trained when the discriminator outputs a probability of 0.5 i.e., the discriminator cannot differentiate between real world data and fake data. 9 Fig 1.8. Simplified GAN Architecture To fully understand the training procedure, we illustrate below the loss functions: • Minimax loss function: The above function is used to train both the generator and the discriminator. The generator is trying to maximize the function whereas the discriminator tries to minimize it. They both technically play a ‘game’ against each other where, the generator tries to build an output that can fool the discriminator whereas the discriminator tries to successfully classify between real data and fake data. • Wasserstein loss: This is a modification to the GAN model, in which the discriminator does not classify the instances (airfoils) instead it assigns a value to each instance which need not lie between 0 and 1. In this scenario the ‘discriminator’ is called a ‘critic’. Critic loss now becomes [D(x) - D(G(z))], and the goal of the discriminator is to maximize this function, effectively increasing the distance between the outputs for real and fake data. 10 Generator loss becomes [D(G(z))], the generator tries to maximize this function, it tries to maximize the output of the discriminator for fake inputs. The Wasserstein loss function GAN has the benefit of not getting as easily stuck as compared to a minimax loss function GAN. 11 1.8 Navier Stokes Equation & Continuity Equation The Navier-Stokes equations are partial differential equations that describe fluid flow. There are two sets of equations for two case applications, compressible flow and incompressible flow. They can be used to describe the flow of air over airfoils, while overcoming the assumption of air being a non-viscous fluid. Eqn. 3D Navier-Stokes Momentum Conservation In simple terms, the Navier-Stokes equations balance the rate of change of the velocity field in time and space multiplied by the mass density; with the pressure, frictional tractions and volumetric forces. As the rate of change of velocity is equal to acceleration the equations boil down to the fundamental conservation of momentum expressed by Newton’s second law. The Continuity Equation is used to mathematically model the conservation of mass of the fluid flowing in the system. Eqn. Continuity Equation For the simulation and analysis of the airfoil, we shall assume the system to have a fixed control volume and hence the mass of the fluid, in our case air, shall remain conserved. 12 1.9 Computational Fluid Dynamics As stated above, for this project we shall be implementing the Navier-Stokes Equations to model and analyze the airfoils performance. But the Navier-Stokes equations are infamously difficult to solve because of their non-linearity. Hence, they are solved using analytical methods, which can get us an empirically approximate solution for the given model and input parameters. This method of analytical approximation of the fluid flow model using numerical methods is known as Computational Fluid Dynamics. With the improvement in hardware, it has gotten easier to run these simulations rather effectively and get reasonably accurate results depending on how far we allow the calculation to run, the longer the analytical calculation, the closer we get to the accurate answer. Using computational tools, we develop a mathematical model that is representative of the physical phenomena, i.e., flow of air over the aircraft wing. To build an accurate model we must take into account all the relevant variables, which include velocity, temperature, viscosity, altitude (atmospheric pressure), angle of attack, each of which must be considered during convergence to the solution. There exist many tools to run CFD simulations, for this project we shall be implementing ANSYS R18.1. The point cloud that is generated by the GAN is built into surfaces in COMSOL. Air is then modeled around the wing. The model is then meshed and sent to FLUENT to converge to a solution. The CFD solution and post – processing is analyzed to understand the performance of the aircraft wing built by GANs. 13 1.10 Flight Dynamics It is the study of flight performance, stability and control. We characterize the forces and moments acting on the aircraft and model the response of flight parameters. The forces that allow for a heavier-than-air aircraft to sustain flight are shown below. Fig 1.8a. Forces • Fig1.9b. Moments Performance: it is the measure of characteristics like maximum and minimum flight speed, maximum range, rate of climb and other long-term parameters which assume the forces and moments to be in a quasi-static equilibrium. • Stability and control: it deals with the short-term perturbations of flight conditions from its dynamic equilibrium. • Navigation and Guidance: it deals with the control inputs required to achieve a given trajectory for the aircraft We shall focus on the performance aspect of flight and how it is affected by the shape of the aircraft wing cross section and structure. The performance of the aircraft is also dependent on several other factors, including temperature, altitude, viscosity, pressure, and other atmospheric conditions. For the purposes of this project, we shall maintain all factors except the airfoil and wing structure, the same in order to allow for a comparative analysis of the LIFT/DRAG ratio and to effectively study the affect of different airfoil shapes on performance. 14 1.11 Reynolds Number and Stall To aid our analyses of aircraft and airfoil performance, Reynolds number is great parameter to utilize. It is a dimensionless quantity, formulated as below, and helps us determine the type of fluid flow, i.e., Laminar, Transitional or Turbulent. Reynolds number can help us predict where the flow changes from laminar to turbulent. A lower Reynolds number, <2000 signifies a Laminar Flow, 2000<R<4000 is Transitional, and >4000 is considered to be Turbulent Flow. Stall: It is the condition in which the flow of air over the wing gets separated due to a high angle of attack, this separation of air flow means that there isn’t sufficient pressure difference between the top and bottom surfaces of the wing, and as a result the aircraft loses lift. The stall angle is heavily dependent on the type of wing that is used on the aircraft, and so for more holistic development of airfoil we shall run CFD simulations at varying angles of attack Fig 1.10. Airflow Separation/ Stall Condition 15 CHAPTER 2: LITERATURE REVIEW 2.1 Bezier GAN The seed paper that we first implemented was Chen et. al. [1]. The authors tweak the existing InfoGANs architecture and adds a new layer in the neural network called the Bezier Layer. Using this BezierGAN, he generates 2D airfoil that conform to Bezier curves. This allows for the synthesized airfoils to be smooth and continuous. The design of airfoils, bottleneck at CFD simulations because of their high computational cost. So, the goal is to find global optima in the design space and reduce the number of simulations. Finding global optima can be done with gradient-based or gradient-free methods, but in this case, it is more feasible to apply gradient-free methods because gradient-based approaches might not generate appropriate results in situations like chaotic flow etc. Since gradient-free methods require more evaluations with increasing dimensionality, dimensionality reduction techniques are performed to accomplish the outcomes. GANs: The study of these lower dimensional spaces can be done with Variational Autoencoders (VAE) or Generative Adversarial Networks GANs) [2]. The underlying concept of GANs is that it can model complex high dimensional space to a known distribution (eg. Normal distribution, Uniform Distribution). Once trained, it can then generate airfoils on its own. To ease the process of training and synthesis, we have split the major and minor variations of the airfoil dimensions. The major variations are captured by the latent space, c and the minor ones are captured by, z noise variable. Optimization: Gradient-free methods are better suited for our optimization problem, and they also improve the likelihood of finding a global optimum. The method we use in this problem is Surrogate based optimization, in particular Bayesian Optimization. This involves two parts, a) a sampling strategy [3] and b) a surrogate modeling method (Gaussian process regression). This method reduces the number of times we need to run CFD simulations which improves run times. Parameterization: To aid the dimensionality reduction it is required to parameterize the airfoil curve. Some of the ways to parameterize are Bezier curves, Free-form deformation (FFD) [4], Class shape transformations (CST) etc. Instead of using manually defined shape parameterization which can have more dimensions than they need to have, Wei Chen demonstrates that learned shape parameterizations can be more compact and efficient. 16 The original plan was to extrude the 2D airfoils in 3D space using Bezier surfaces, however we found that tessellating a Bezier surface led to a loss of lot of information which invalidated the purpose of using parametric curves. 2.2 Point Cloud GANS Shu et. al. conducted experiments to generate 3D models in their native format, and used physics-based validation to include those generated models in their dataset which had the highest inverse of drag coefficient in a CFD solver environment. Then the model was trained on the updated dataset and 3 iterations of the above cycle were performed. The input and output models here were in point cloud format. For training data, they used the ShapeNet repository which contains 51300 unique models. The point clouds were subsampled to 2500 points for each model. Following this, they used a normally distributed latent space vector and a GAN with a network of fully connected layers. The network pipeline till training and generation is given below: Fig 2.1. GAN Generation Pipeline 17 In the model, the authors used FC layers instead of convolution layers because of the assumption that convolution layer won’t be able to extract spatial information (or how close a particular point is to its neighbor). Following this, the generated results were validated in OpenFOAM and the best performing models were infused in the training set. The figure below gives a demonstration of how generated models in Iteration 3 were sampled from three different performance score regions. Fig 2.2. Sampling Generated Models 18 2.3 Adversarial Autoencoders The architecture we modified for our training dataset was taken from Zamorski et. al. In their approach, they developed an end to end solution to 3D reconstruction tasks (take in a 3D input and produce a 3D output). Their paper had a choice between producing binary or continuous latent space that covers the training distribution very well thereby maximizing exploitation of the design space. The probabilistic model suggested by them (3D Adversarial Autoencoder (3dAAE)) represents 3D point clouds in continuous embedding which can be utilized by a generator (or decoder) to reconstruct new point clouds. Conventionally a Variational Autoencoder has been used to build the above-mentioned embeddings. They achieve this by regularizing a prior distribution (which is optimized for) for the embedding space, in this case, a normal distribution. However, as Tomczak et al. found, there are better prior distributions to be optimized for. Moreover, the loss function in VAE is the KL divergence which tends to explode for 2 distributions far apart. As a result, there is always a chance of incomplete training and more importantly, to avoid such situations, VAE allows only for a narrow set of prior distributions. An adversarial auto encoder has a larger range and can be utilized to fit way more distributions in the latent space z thus the assumed prior can be the optimal one based on training. The AAE inherits both from a GAN (has a discriminator which is responsible for distinguishing between fake and true samples, where the true samples are sampled from assumed prior distribution p(z) and fake samples are generated via encoding network q(z | x)) and a VAE (since it has an encoder and a decoder). The equation which is optimized during training is given by: The training process is similar to GANs and is performed by alternating updates of parameters of encoder and discriminator. The parameters of discriminator D are updated by minimizing the loss: -V (E, D) and the parameters of encoder E and generator G are optimized by minimizing the reconstruction error together with V (E, D): LEG = reconstruction + V (E, D). 19 Fig 2.3. Training AAE The loss function used for reconstruction by the authors is Wasserstein loss (also known as Earth Mover Distance) and Chamfer Distance. Following training with the ShapeNet dataset, metrics like Jensen Shanon Divergence (measure of how close q(z|x) and p(z) are) and Minimum Matching Distance (measure similarity between 2-point clouds S1 and S2) were used to evaluate the quality of the generations. The results for minimum matching distance for both the losses with respect to other models are given below: Table 2.1. Results for minimum matching 20 CHAPTER 3: OBJECTIVES AND METHODOLOGY 3.1 Objectives The objective of this study is to 1. Implement Adversarial Networks as a tool in Engineering Design of Airfoils a) Build training dataset of 3D airfoils using Python and Rhino 3D b) Modify existing Adversarial Architectures to be purpose-built for our application c) Train the network and generate novel airfoil shapes and forms 2. Investigate and Analyze Performance of the Airfoils generated by the model a) Analyze existing aircraft wings for their performance, coefficient of lift and drag to set benchmarks using ANSYS Fluent. b) Perform CFD analyses on the airfoils synthesized by GAN and compare it to benchmarked standards. 3.2 Methodology 3.2.1 Rhino 3D and Python The first task is to build a dataset on which the model will be trained. To build the training dataset we used Rhino 3D. Since the training data needs to be large, the process is automated using Python. As shown in the flowchart below, we use NACA airfoils from the UIUC Airfoil dataset as the airfoil cross sections. The 2D point cloud of the NACA airfoil is then modified using randomized parameters. The characteristic parameters such as Span, Chord Length, are randomly sampled from a Uniform Distribution. Then, using the 2D point cloud as the baseline, we build a 3D point cloud of an aircraft wing. This is one iteration of building a wing. 21 Fig 3.1. Single Iteration of building a 3D Airfoil Point Cloud Initially, we experimented with having 2100 points in 1 sample with 21 sections each having 100 points interpolated across the cross section of an airfoil. However due to the sparsity of the model, it was not possible to re-mesh the point cloud which would be required for latter stages of the project pipeline. Which is why, we went with 40 cross sections with 1000 points each. The matrix was able to mesh better and form a watertight surface which was paramount for CFD analysis. The figure below shows the airfoil that we created by taking airfoils from the UIUC airfoil database. Fig3.2. 3D Airfoil sample from database 22 3.2.2 Point Cloud Subsample Having 40000 points with xyz axis in 1 sample led to more than a billion parameters (weights and biases) which meant a lot of computation happening during training. At present, we had a constraint on computation power and did not have a processing unit available that could handle that many computations. Which is why we had to subsample points from each sample such that: 1. The structure of the wing is preserved and one can create cross sections with equal points. 2. The point cloud generated will have the same number of points as the training sample. So the point cloud should have enough points which preserve geometric information to recreate the mesh. 3. The permissible number of points in each sample is the maximum number of points which the GPU at our disposal can handle in batches and across various steps of an epoch. To satisfy all the above constraints, we take a factor of 4 and uniformly subsample points such that 10000 points are preserved with least loss of information. We slice each sample of point cloud to accommodate 40 sections with 250 points each. This way, the sample has each point close to the adjacent point to make the airfoil and reduce the number of parameters required by Fig 3.3. Subsampling points 23 3.2.3 Adversarial Auto Encoder Architecture for Training The AAE design for our model was inspired by Zamosrki et. Al.. The key modifications that we had to do to the model in order to get satisfactory results should consider: As compared to ShapeNet dataset, out model had more sparsity since it was sampled by putting together multiple cross sections of an airfoil with varying thickness and chord line. The dataset was 50 times smaller than the original ShapeNet dataset The number of points in each point cloud (although sparser) were more, 5000 in number. The number of points along a cross section were more but the number of cross sections were lesser lending the training data its sparse nature. The modifications we made to cater to this included: Adding more conv1D layers to the encoder and the generator to sufficiently learn the variability in the high number of point sample. Note that -1 in each dimension here is batch size. Fig. 3.4. Encoder, Generator and Discriminator Architecture 24 Normalizing the dataset is done to ensure that all samples are of the same size along one axis with their geometric center at origin. This to reduce unwanted variability in the dataset and standardize inputs so that positioning is not something that affects reconstruction. The data after reconstruction is made to the size of the original size using the same function. Thus, we had an AAE architecture with 24 million parameters which we train in Microsoft Azure Machine Learning environment with an adequate GPU. 3.2.4 Training results and loss Training took approximately a day for 2000 epochs with a batch size of 16 on 2 K80 GPUs provided by the environment. The number of epochs were taken as 2000 to somewhat counter less training data that we have. At first the discriminator loss was going negative and only after tuning more hyper parameters and normalizing the dataset were we able to proceed. After training for 2000 epochs, we saved the weights and architecture of the Generator in a .pth file which we use in another script to generate point cloud samples by passing random noise of the same dimensions as the encoder output. The generated point clouds are converted to a text file and saved for further processing. A generated sample can be viewed below: Fig 3.5. Generated Airfoil Sample 25 3.2.5 Meshing the generated samples Once the point cloud is generated, we must re-mesh it into a smooth-continuous surface. To do this we use a tool named COMSOL. The algorithm used to re-mesh the point cloud is a type of interpolation. Using the given coordinate data of the point cloud, the tool approximates a polynomial function that best fits the point cloud as a surface. The function is then refined to represent the points as accurately as possible. Once the function is obtained, we apply the boundary conditions. We are finally left with the surface of the airfoil which is then imported into ANSYS for modelling and meshing 3.2.6 CFD Analysis To measure the quality of the AAE generated airfoils we first conducted benchmark tests on state-of-theart existing airfoils. We implement an ANSYS Fluent pipeline for this purpose. The type of model used is a k-epsilon model. This type of turbulence model is capable of solving and capturing phenomena further from the boundary wall. Fig 3.6. ANSYS Fluent Setup The geometry is modeled in a separate system in order to allow for parametric control over the input airfoil. 26 Type 1 Analysis: Fig 3.7a. Front View of Geomtery Fig 3.7b. Top View of Geometry Fig 3.7c. Isometric View of Geometry 27 Fig 3.8a. Boundary Layer Mesh Fig 3.8b. Front View Mesh The above figures show the geometry and setup of the airfoil in fluid. Since we have modeled aircraft wings, we shall be using air as our fluid. In Type 1 Analysis we use rectangular geometry to model the fluid, and the mesh is made of a maximum face size of 0.1m. The edges are meshed to a finer degree, with elements having a maximum length of 0.01m. To accurately model the physics of the fluid flow, we use inflation at the boundary layers, with a maximum thickness of 0.016mm and 12 layers. The results will be calculated for different airfoils and different angles of attack. 28 Type 2 Analysis: Fig 3.9a. Type 2 Geometry Fig 3.9b. Meshed model of Fluid (Air) Fig 3.10. Mesh Wireframe 29 Type 2 Analysis uses a different geometrical model for the analysis of the airfoil. In this case the fluid is not modeled like a rectangle, instead it is modeled with a curved inlet and symmetry. The meshing in this setup has a max. face size of 0.3m. The edges are meshed with 0.01m element size. The surface of the airfoil is meshed with a max. face size of 0.05m. And similar to Type 1, Inflation is used to model the boundary layer for accurate simulation and calculation of the life/drag ratio. 30 CHAPTER 4: RESULTS ANALYSIS The objective of this project was to use deep learning techniques to design airfoils for aircraft wings. The architecture used was and Autoencoder Adversarial Network. In order to measure the performance of the generated airfoils they had to be compared to existing airfoil shapes. The comparison was done on the ratio of Lift/Drag, this would give us a comprehensive understanding of the aerodynamic properties of the airfoil. CFD Setup Angles of Attack 8˚, 10˚, 12˚ Airfoil Material Aluminium Velocity 100 m/s Parameters Lift Coefficient/ Drag Coefficient Fluid Air (1.20 kg/m3) Table 4.1 CFD Setup We ran benchmark tests on 2 NACA Airfoils, 2402, 4412, and Boeing 737 airfoils, Propfan Cruise missile wing. The following results were obtained. 31 Airfoil – NACA 2402 Fig 4.1. Pressure Contours 32 The above figure shows the pressure contours for NACA 2402 airfoil. We can observe that the pressure on the top surface is lower than the pressure on the bottom surface, this result is a confirmation that lift on an airfoil surface is caused due to the pressure difference created between the top and bottom surfaces. This pressure difference arises due to the geometry of the aircraft wing, the fluid particles travel at greater speeds along the top surface leading to a drop in pressure according to Bernoulli’s principles. We can also observe that the greatest pressure difference occurs at the leading edge of the airfoil. Fig 4.2. Lift/Drag Ratio The above figure shows the ratio of the lift coefficient to drag coefficient for the NACA Airfoil which has an angle of attack of 8˚. We can observe that the solver at first struggles to find a solution but eventually finds a steady state. From the graph we find the coefficient of drag is 3.01e-02, and the coefficient of lift is 3.60e-01. From this we can calculate the ratio of lift vs drag to be 11.96. 33 Fig 4.3. Scaled Residuals The above figure shows us the scaled residuals obtained during the calculation while finding the solution. Since Fluent uses a numerical method to arrive at an approximation of the solution, along the way there are certain errors/ residuals obtained. These residuals help us determine whether the solver has converged to a solution or not. In a steady state analysis, the solution is considered converged when the difference between the residuals reaches a constant value. For NACA 2402 the solution was converged to in 103 iterations. Fig 4.4. Velocity Streamlines 34 The above figure shows the paths that the fluid particles take when flowing around the airfoil. We can observe that the velocity of the particles is higher above the airfoil, and lower below the airfoil. This is in agreement with the physical principles of fluid dynamics. Even though the velocity of the fluid was set to 100m/s we find that the maximum velocity reaches 154.6m/s and drops to levels of around 77.5m/s. In certain cases, we can also observe interesting phenomena like Vortex formation at the wing tips. This also allows us to visualize the efficiency of the aircraft wing. 4.1 Benchmark Test Results Angle of Attack = 8˚ Airfoil CL CD Ratio NACA 2402 3.60e-01 3.01e-02 11.96 NACA 4412 3.80e-01 2.90e-02 13.10 Boeing 737 3.20e-01 3.60e-02 8.88 Propfan Cruise Missile 2.80e-01 1.90e-02 15.2 Table 4.2 Benchmark (8˚) The above table highlights the results obtained after conducting CFD simulations on the state-of-the-art airfoils. We can observe that the NACA airfoils have a ratio closer to the average. The cruise missile wing, although having higher lift/drag ratio, doesn’t generate as much lift compared to the other three. 35 Angle of Attack = 10˚ Airfoil CL CD Ratio NACA 2402 4.60e-01 4.10e-02 11.21 NACA 4412 4.80e-01 3.80e-02 12.60 Boeing 737 4.20e-01 4.70e-02 8.93 Propfan Cruise Missile 3.80e-01 2.90e-02 13.10 Table 4.3. Benchmark (10˚) The above table highlights the results obtained after conducting CFD simulations at an angle of 10˚. Fig. 4.5. Scaled residuals/ Lift-Drag Ratio at 10deg 36 Angle of Attack = 12˚ Airfoil CL CD Ratio NACA 2402 2.60e-01 3.90e-02 6.66 NACA 4412 2.80e-01 3.80e-02 7.36 Boeing 737 6.20e-01 4.80e-02 12.90 Propfan Cruise Missile 1.80e-01 2.70e-02 6.70 Table 4.4. Benchmark (12˚) The above table highlights the results obtained after conducting CFD simulations at an angle of 12˚. We can observe that there seems to be flow separation and the amount of lift generated is drastically reduced. Although the Boeing 737 airfoil seems to still perform well even at a higher AOA. 37 4.2 AAE Generated Airfoil Test Result (* The results have been highlighted for those simulations which converged to a solution) AOA: 8˚ Airfoil CL CD Ratio Airfoil 1 2.60e-01 2.80e-02 9.28 Airfoil 2 2.80e-01 2.60e-01 1.07 Airfoil 3 1.20e-01 2.10e-02 5.71 Airfoil 4 1.20e-01 1.70e-02 7.05 Table 4.5 AAE Airfoil (8˚) From the above table we can observe that the best Lift/Drag ratio is obtained in Airfoil 1 at 9.28 whereas the minimum ratio is of Airfoil 2 at only 1.07. Angle of Attack = 10˚ Airfoil CL CD Ratio Airfoil 1 2.80e-01 4.00e-02 7.00 Airfoil 2 2.40e-01 3.80e-01 0.63 Airfoil 3 1.60e-01 2.60e-02 6.15 Airfoil 4 1.30e-01 1.80e-02 7.22 Table 4.6. AAE Airfoil (10˚) Airfoil 1 and Airfoil 2 performed worse at 10˚ compared to 8˚, whereas Airfoil 3 and Airfoil 4 performed better even though the drag was higher. 38 Angle of Attack = 12˚ Airfoil CL CD Ratio Airfoil 1 1.35e-01 0.85e-01 1.58 Airfoil 2 1.20e-01 3.80e-01 0.31 Airfoil 3 3.60e-01 2.60e-01 1.38 Airfoil 4 5.30e-01 1.80e-01 2.94 Table 4.7. AAE Airfoil (12˚) From the above table we can observe that all the airfoil seem to have flow separation at this angle, thereby losing lift and potentially stalling, depending on the loading of the aircraft. Comparative Analysis: 1) Average Benchmark Test Results: a) NACA 2402: 9.94 b) NACA 4412: 11.02 c) Boeing 737: 10.23 d) Propfan Cruise Missile: 11.60 2) Average AAE Generated Airfoil Test Results: a) Airfoil 1: 5.95 b) Airfoil 2: 0.65 c) Airfoil 3: 4.41 d) Airfoil 4: 5.73 Although the existing developed designs clearly outperform the AAE Generated airfoils, the results seem to be promising. 39 CHAPTER 5: CONCLUSIONS AND SCOPE FOR FUTURE WORK 5.1 Conclusion The objective of this project can be summarized as: Study and build deep learning architectures (adversarial networks) which can incorporate point clouds to synthesize airfoil structures Validate the generated designs by comparing numerous metrics to benchmark airfoils. The methodology adopted for the project was implemented from the seed papers [1] and [10]. This was followed by devising a path that was both novel and feasible, in the sense that no prominent research work had been done in this field of application for airfoils. The following conclusions can be drawn: I. By utilizing point clouds in our model, we observed that we can extract a reasonable amount of information from a fairly sparse point cloud with acceptable computational overhead, and point clouds have shown to preserve a lot of information about the surface of the airfoil. Although; deep learning architectures are not yet fully capable of learning patterns in a sparse point cloud. II. The airfoils generated using AAE explore the design space efficiently, but require better training in order to synthesize shapes that can match the performance of benchmark airfoils. III. While building an AAE architecture for complex patterns, there must be a balance between the depth of the model (number of layers) and the update of the gradients. IV. At higher angles of attack the benchmark airfoils perform much better, which ultimately means the safety of the aircraft. We must develop an algorithm for improving the constraints on aerodynamic control surfaces while exploring the design space. V. An efficient pipeline that connects the deep learning architecture to meshing tools and ultimately to CFD simulating software can be built, to offer a complete tool for synthesizing novel airfoil structures using DL VI. Environmental Impact: By implementing this model, and utilizing deep learning techniques to design and generate novel airfoil structures it will be possible to develop designs that can help reduce fuel burn in aircraft or improve the efficiencies of turbines etc. which will have a positive environmental impact. 40 5.2 Future work The work done in this project can be extended to incorporate the internal structure of aircraft wings as shown below. The analysis done on the airfoil can include static structural tests to test the load carrying capacity based on the load paths of different flight patterns and purposes. The AAE architecture built in this project can be enhanced by introducing newer layers that can improve the surface structures by including constraints such as Bezier Surfaces. Additionally, conv2D layers can be used in a manner that local relationships between points in a sample are not lost. Fig 5.1. Internal Structure Concept Figure 41 REFERENCES [1] Chen, W., & Fuge, M. (2019). Synthesizing Designs with Interpart Dependencies Using Hierarchical Generative Adversarial Networks. Journal of Mechanical Design, 141(11). https://doi.org/10.1115/1.4044076 [2] Cinquegrana, D., and Iuliano, E., “Efficient Global Optimization of a Transonic Wing with Geometric Data Reduction,” 35th AIAA Applied Aerodynamics Conference, 2017, p. 3057 [3] Lawrence, Neil. (2004). Gaussian Process Latent Variable Models for Visualisation of High Dimensional Data. Advances in neural information processing systems. 16. NIPS 2003 [4] Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. 2014. Generative adversarial nets. In Proceedings of the 27th International Conference on Neural Information Processing Systems - Volume 2 (NIPS'14).Kerlekar R S, Dhande D.Y., Nigade M.B, Kondhalkar G.E. (2015) Performance Analysis of 3 Lobe Hydrodynamic Journal Bearing. International Journal of Engineering Research and General Science Volume 3, Issue 4. [5] Jeremy Jordan. 2021. “Neural networks: training with backpropagation.”. [online] Available at: https://www.jeremyjordan.me/neural-networks-training/. [6] Built In. 2021. “Gradient Descent: An Introduction to 1 of Machine Learning’s Most Popular Algorithms”. [online] Available at: https://builtin.com/data-science/gradient-descent. [7] GitHub. 2021. GitHub – “UM-ARM-Lab/Chamfer-Distance-API: A python class that calculates chamfer distance between point clouds using tensorflow”. [online] Available at: https://github.com/UM-ARM-Lab/Chamfer-Distance-API. [8] Studio.azureml.net. 2021. “Microsoft Machine Learning Studio (classic).” [online] Available at: https://studio.azureml.net/. [9] Shu, D., Cunningham, J., Stump, G., Miller, S. W., Yukish, M. A., Simpson, T. W., & Tucker, C. S. (2019). 3D Design Using Generative Adversarial Networks and Physics-Based Validation. Journal of Mechanical Design, 142(7). https://doi.org/10.1115/1.4045419. [10] Zamorski, M., Zięba, M., Klukowski, P., Nowak, R., Kurach, K., Stokowiec, W., & Trzciński, T. (2020). Adversarial autoencoders for compact representations of 3D point clouds. Computer Vision and Image Understanding, 193, 102921. https://doi.org/10.1016/j.cviu.2020.102921 [11] J. Tomczak and M. Welling. VAE with a VampPrior. In International Conference on Artificial Intelligence and Statistics, pages 1214–1223, 2018. 42