Arun's Tech Blog


Airfoil analysis by scripts

A common issue encountered in many fields of engineering is the inability to analyze large sets of data due to limitations of skilled man power availability. I in particular have encountered this issue during my time as aerodynamics lead for the UIC AIAA DBF 2014/2015 team. In particular one of the first decisions to be made involving true quantitative analysis was to pick an airfoil for the main wing. While on the surface this issue may seem near trivial -read to find desirable characteristics for the given mission profile and pick an airfoil exhibiting them- the reality is that there are thousands of different airfoils available from just the UIUC database. And, with only a few team members, wading through the excess of choice was quite a problem. However, I have conquered this problem, with what you ask? SCRIPTING!

Now for some quick background on the aerodynamics of airfoils. Airfoils exhibit several different properties based on their geometry, the most prevalent of which, concerning behavior, are: thickness to length, curvature, and camber. Depending on these characteristics, the airfoil will produce different forces and moments (when used in a wing) depending on the speed of the air flowing around them (as well as the wings design). So long as the airflow is fast enough, these forces and moments can be calculated with some relatively simple equations involving unitless coefficients. The most important of these are coefficients of drag, lift, and moment. Out of these the main behavioral characteristics we desired were: negative rate of change of Cm with respect to angle of attack, stall angle ( alpha [angle of attack] for the maximum Cl/Cd), low Cd (generally indicating low stall speed), low Cm (small tail means less drag), and finally a reasonable Cl so the wing area is not too large.

Once we have some well defined desirable characteristics, how do we determine them from any given airfoil? Surprisingly, the first part of the question is quite easy to solve. It is done by using an excellent program written by some MIT aerospace engineers and is known as xfoil. Basically, it is a command line program which, for some reason is in a large number of aptitude and yum repositories, allows you to enter several simulation parameters, chose a simulation method, load an airfoil and do some math I don’t understand to magically obtain the needed airfoil characteristics described above. For those interested in details on using the program, the documentation is quite good.

XFLR5/xfoil screenshot
A screenshot from XFLR5 of a xfoil analysis

Ok, now that we can do everything needed at the command prompt the task is basically done. With a little BASH scripting we don’t need to do much other than assemble our desired commands and run them in xfoil for each airfoil, then we use mat lab to load all the analyses, iterate over them and use some simple if blocks to separate out the desired airfoils and push them to an array. The array is then printed, including the desired characteristics and the team can sort out from the much smaller selection of airfoils the one to be used.

The particular scripts I used to do this have been put on my gitHub. There is a readme explaining the scripts and how to use them but they go like this: the first bash script downloads and formats the files to be used with xfoil. The second bash script writes the needed commands to a file for each airfoil and then runs xfoil with its STDIN hooked up to the file. Finally, the mat lab script loads all the analyses generated by xfoil, uses several mat lab functions to simplify the mathematics to a triviality in code and separates out the desired airfoils. Annnd thats it, a medium/big data analysis thrown together with nothing but scripting! Good luck to anyone else trying to script large tasks to simplify their work, we really are living in the future!

© Copyright 2015, All Rights Reserved