Using Custom Aerodynamics

119 views
Skip to first unread message

umarp...@college.harvard.edu

unread,
Dec 15, 2020, 6:51:09 PM12/15/20
to SUAVE FORUM
I'm working with an aircraft for which I have CL, CD data as a function of Angle of Attack and Mach Number. For this reason, I want to input my own aerodynamic data, rather than use SUAVE's calculations. I have managed to do this by using the SU2_Euler analysis method and inputting a training file with my data. I have played around with the code a lot, and I noticed that the default interpolation of the CL, CD values for different AoA/Mach Numbers uses ExpSineSquared with a Gaussian process (this is in the SU2_inviscid file). I've included the relevant code here: 

gp_kernel_ES = ExpSineSquared(length_scale=1.0, periodicity=1.0, length_scale_bounds=(1e-5,1e5), periodicity_bounds=(1e-5,1e5))
regr_cl = gaussian_process.GaussianProcessRegressor(kernel=gp_kernel_ES)
regr_cd = gaussian_process.GaussianProcessRegressor(kernel=gp_kernel_ES)
cl_surrogate = regr_cl.fit(xy, CL_data)
cd_surrogate = regr_cd.fit(xy, CD_data) 

I am not familiar with this method, but I have found that it does not work well for interpolating my data. The interpolation is inaccurate, and it is generating regions of negative drag between the points where I have input data. This results in the drag going negative and messing up the L/D below. 




For this reason, I rewrote the code using RectBivariateSpline, and the interpolation works a lot better. The problem is that I cannot get the aerodynamic analysis to "interact" properly with this interpolation now, and my code is generating crazy angle of attack values when I try to use this new interpolation. This can be seen in the plot below, since the AoA ranges from -100 to 100 and the L/D fluctuates rapidly.



Is there any easier way to use custom aerodynamics? I wonder if there is a bug with the interpolation method that has been set up, or if I am missing something? Any help would be very much appreciated! I have been working on this for a while, but I can't figure it out. 


Emilio Botero

unread,
Dec 17, 2020, 2:21:52 PM12/17/20
to SUAVE FORUM
Hi,
Hmm, it is possible there is a bug, we have had problems in the past when SciPy or sklearn updates their code. But before you do that I would suggest a couple things first.

First look at your data file, it's possible its very sparse and the fit is just not great. Also check your units, SUAVE is expecting radians for AoA.

Second, when the surrogate is made it should generate a plot. Make sure that plot looks as you would expect.

Your results where it goes to -100 and 100 generally means that the function is not well behaved. The gradient on the interpolation is probably too flat when it finite differences. So the solver thinks the next point has to be extreme (like 100 degrees) and of course the value returned by the surrogate is garbage at that point.
So third, you should manually finite difference your surrogate to check that it will play nice with the solver.

There are other surrogates included. Try those as well.

Unfortunately surrogate modeling is a bit of an art. 

Let us know how it goes.

-Emilio

umarp...@college.harvard.edu

unread,
Jan 2, 2021, 6:31:01 PM1/2/21
to SUAVE FORUM
Thanks so much! I increased the range of data to include negative angles of attack up to -8 degrees, and that seemed to do the trick. Results look reasonable now.
Reply all
Reply to author
Forward
0 new messages