Espritmodel.com Telemetry Radio
Reply
Thread Tools
Old Jun 13, 2010, 09:59 PM
Sink stinks
Montag DP's Avatar
United States, GA, Atlanta
Joined Apr 2005
4,513 Posts
Quote:
Originally Posted by markschaffin View Post
I had a similar problem with my method. I pipe my Xfoil output to a file and then read the file. Not the most efficient way, but it works. Anyway, for some reason I kept getting unrealistic cl/cd's like yours. Turned out that my script to read the file was reading values from the first iteration, not the last.

You can always reset the boundary layer using the "init" command. Also, if convergence is a problem, you can set the default number of iterations using the "iter" command. If I don't get a converged solution in 200 iterations I take it as a bad sign and that airfoil gets eliminated from the gene pool. You are checking for cases that don't converge, right?

Optimization methods will always seek out any weakness you leave in your problem definition. ALWAYS. If you don't thin you have a weakness, just run it and find out. Forming proper constraints is half the battle.

Mark
I think I need to explain my problem a little bit more. I am using the "init" command. Here's in general how it's done, after the preliminary commands setting up the problem:

ALFA ~
INIT
ALFA ~ <--- Initializes BLs at ALFA ~ (whatever angle I choose)
PACC
optfoil.pol

ASEQ 1.5 6.5 2.5 <--- Sequence of angles of attack
PACC

QUIT

Initially I was using 1.5 as ~ (initializing BLs at 1.5 degrees). This normally works fine, but the optimizer found a case where this produced unreliable results. If I took the optimized airfoil and used the same command sequence but replaced ~ with 0 instead of 1.5, the average L/D would only be in the 60s instead of over 100. So the optimizer must be exploiting a case where XFoil does not initialize the boundary layer solution correctly and gets anomalous results.

I do increase the iteration limit to 100 by default, and I also check for non-convergence. Any non-converged design point gets assigned a Cl of 0, a Cd of 1, and a Cm of -0.5 to penalize it.
Montag DP is online now Find More Posts by Montag DP
Reply With Quote
Sign up now
to remove ads between posts
Old Jun 13, 2010, 11:23 PM
Sink stinks
Montag DP's Avatar
United States, GA, Atlanta
Joined Apr 2005
4,513 Posts
Also, you don't happen to know a good way to force XFoil to close, do you? Sometimes when XFoil doesn't converge, instead of simply closing it just gets stuck. The last line is always:

VISCAL: Convergence failed

I don't know why it does this sometimes instead of just closing like it does most times, but it forces me to start over. I wish I could just force it to close.

EDIT: I just found this on a webpage where it looks like someone did something similar to what I'm doing:

Quote:
Originally Posted by Dude
Oh, sometimes XFoil gets stuck on a really bad "mutant" airfoil the code comes up with, if this happens, you should end the XFoil from task manager, and the code should skip that iteration and keep running.
The good-ol' manual termination. Why didn't I think of that?
Montag DP is online now Find More Posts by Montag DP
Last edited by Montag DP; Jun 14, 2010 at 12:22 AM.
Reply With Quote
Old Jun 14, 2010, 07:29 PM
Registered User
United States, KS, Andover
Joined Oct 2005
539 Posts
It sounds like XFoil isn't completely converging, maybe on just one case. Can you look at the output and make sure it is doing what you think?

Are you saying that if you enter "a 1.5", then "a 0", then "a 1.5" you get three different converged results, rather than just two? XFoil's boundary layer is coupled with the flow solver, and I'm not sure it matters what the current alpha is when you enter "iter". I'd bet it always sets the BL parameters to the same thing, regardless of the alpha. Admittedly, I'm just guessing there.

One thing I would try is to use a smaller increment in your "aseq". 2.5 may be too big. I usually use something like 0.2 as an increment, not that it always works.

I also don't compute a polar to get my objective terms, not that there is anything wrong with that. I find that sometimes polars can just hang and refuse to converge on what should be a benign condition.

As far as having XFoil just hang, I can't say I've had that problem, except when it really has trouble and hits NaNs (Not a Number), but even then it will die eventually. I run on a Linux box. Sorry, can't stand Windows for things like this. This hasn't been a problem for me.
markschaffin is offline Find More Posts by markschaffin
Reply With Quote
Old Jun 14, 2010, 08:06 PM
Sink stinks
Montag DP's Avatar
United States, GA, Atlanta
Joined Apr 2005
4,513 Posts
Quote:
Originally Posted by markschaffin View Post
It sounds like XFoil isn't completely converging, maybe on just one case. Can you look at the output and make sure it is doing what you think?

Are you saying that if you enter "a 1.5", then "a 0", then "a 1.5" you get three different converged results, rather than just two? XFoil's boundary layer is coupled with the flow solver, and I'm not sure it matters what the current alpha is when you enter "iter". I'd bet it always sets the BL parameters to the same thing, regardless of the alpha. Admittedly, I'm just guessing there.

One thing I would try is to use a smaller increment in your "aseq". 2.5 may be too big. I usually use something like 0.2 as an increment, not that it always works.
I usually do "0" then "init", then "0" before computing a polar (or some other angle if I choose). I'm pretty sure that XFoil then uses that alpha 0 point as the starting guess for the next point. To be honest, I copied the sequence from an input file in my Profili folder. After playing with it for some time, I'm not so sure that typing "alfa 0" then "init" then "alfa 0" is really any different that just typing "alfa 0" once, and then moving on with the sequence.

When the optimizer does reach an unrealistic solution, here's what I've found:
-The geometry has always been sort of weird and bumpy.
-The point from which BL initialization took place converges, but just barely. Usually within 10 iterations of the limit.
-If I modify the script file to initialize at a different point for the same airfoil, I usually get reasonable results.

This leads me to believe that accurate BL initialization is key to ensuring reliable results. The particle swarm optimizer tends to exploit cases where the initialization is poor. The coarse angle of attack spacing might have something to do with it too.

Next, I'm going to try initializing from two different starting points and have the optimizer take the worst of the two cases, and hope that fixes the problem. I know Dr. Drela steps in on this forum every once in awhile...I kind of wish he would do that now to shed some light. Maybe if I put XFoil in the title he will be lured in.

Dan

P.S. If you don't get the data from a polar, where does it come from? The only other thing I can think of is specifying an output file and taking it from that, but that seems like a huge pain and not really any different in terms of results.
Montag DP is online now Find More Posts by Montag DP
Reply With Quote
Old Jun 15, 2010, 07:02 AM
Registered User
United States, KS, Andover
Joined Oct 2005
539 Posts
Dan,

It sounds like you are at the stage where you need to start putting some geometric constraints into your problem. Optimization tools will always take the easy way out. It's uncanny how good they are at finding holes. Surface curvature is fairly easy to code up. XFOIL will actually give you the local curvature and that's what I use to keep my LE from going nuts.

If you are getting multiple solutions for a single set of conditions, that is a good sign that you are at the limits of the code. XFoil is great, but ANYTIME you see a lot of separation, or multiple separation bubbles, start questioning things. Better to have a robust design with higher drag than one that just barely converges but has low drag. Maybe if you put some design points out past your current limits. Those can be the ones XFoil will just barely converge on and maybe the rest will be healthy? Just a thought.

I just looked through the code a bit to try to understand what "init" does, but the code is not well commented and I'm short on time. I'll try to find my documentation.

All my runs are done at individual points, and yes I redirect the output to a file. My code then reads that file to get the information. It would be better to modify XFoil to simply pass that data back to my Python code, but it's that pesky time thing.

Mark
markschaffin is offline Find More Posts by markschaffin
Reply With Quote
Old Jun 15, 2010, 11:14 PM
Sink stinks
Montag DP's Avatar
United States, GA, Atlanta
Joined Apr 2005
4,513 Posts
I was finally able to get good results with the new design variables. There are 22 in total right now - some points can move in x and y and some just in y, and the leading and trailing edge points are fixed. It seems that initializing the BLs from two different alphas had the desired effect. It actually has the extra benefit of giving airfoils an extra chance to not converge, and since I give unconverged airfoils bad objective function values, this helps the optimizer steer away from these poor cases.

I ended up using 1 degrees, 4, and 7 instead of 1.5, 4, and 7 in the objective function. It still got a very good average Cl/Cd of 71.38 for the three points. The thickness and Cm constraints are met, in fact they are met exactly, as you would expect from an optimized solution.

Interestingly enough, the final shape is pretty close to the naca-like profiles I was generating earlier. The nose radius on the lower surface is just about as small as I would let it go in the constraints. The bottom surface is a little wavy, likely due to the coarse alpha spacing in the objective function.

I think the next task is to try more useful optimization using a finer alpha range or perhaps using a Cl-based approach instead.
Montag DP is online now Find More Posts by Montag DP
Reply With Quote
Old Jun 16, 2010, 06:55 AM
Registered User
United States, KS, Andover
Joined Oct 2005
539 Posts
Cool stuff. I'd ask for you seed airfoil and design conditions so that I could see what my tools would do, but I'm not going to have time to look at it until next week.

Another thing to consider is including other things in you objective function, such as pressure coefficient and boundary layer parameters. Consider what might happen if you add a penalty based on how close the BL comes to separating....
markschaffin is offline Find More Posts by markschaffin
Reply With Quote
Old Jun 16, 2010, 07:36 AM
Sink stinks
Montag DP's Avatar
United States, GA, Atlanta
Joined Apr 2005
4,513 Posts
Quote:
Originally Posted by markschaffin View Post
Cool stuff. I'd ask for you seed airfoil and design conditions so that I could see what my tools would do, but I'm not going to have time to look at it until next week.

Another thing to consider is including other things in you objective function, such as pressure coefficient and boundary layer parameters. Consider what might happen if you add a penalty based on how close the BL comes to separating....
Actually, PSO doesn't use a seed design at all. I simply populate the design space with 25 random designs and let them fly to the optimum. You can see that after one iteration the best design only had an average L/D of about 25.

Those other terms are good ideas. Pressure coefficient would be easy since it's in the polar, but separation would not be so easy.
Montag DP is online now Find More Posts by Montag DP
Reply With Quote
Old Jun 16, 2010, 12:13 PM
Registered User
United States, KS, Andover
Joined Oct 2005
539 Posts
Actually, you can write out the boundary layer parameters. I don't recall exactly what terms XFoil writes out, but you could use them to give you a sense of how healthy the BL is.

What's your Re, ncrit, thickness constraints and objective function? I'll see if I can find time early next week to play with this. Oh, and if you attach your current design, I can do some comparisons.
markschaffin is offline Find More Posts by markschaffin
Reply With Quote
Old Jun 16, 2010, 01:41 PM
Sink stinks
Montag DP's Avatar
United States, GA, Atlanta
Joined Apr 2005
4,513 Posts
Quote:
Originally Posted by markschaffin View Post
Actually, you can write out the boundary layer parameters. I don't recall exactly what terms XFoil writes out, but you could use them to give you a sense of how healthy the BL is.

What's your Re, ncrit, thickness constraints and objective function? I'll see if I can find time early next week to play with this. Oh, and if you attach your current design, I can do some comparisons.
I was running at Re=2e5 and ncrit=9. The thickness constraint is >=9%, and I also have a Cm constraint as >= -0.1. The objective function is:

max(mean(Cl/Cd)) for alpha = 1, 4, 7

You might also want to check out this one I just did. Using the same parameters and constraints, this one had the objective function:

min(mean(Cd)) for Cl = 0.1, 0.2, 0.3, 0.4, and 0.5

I've attached the two airfoil files. The results for the low-Cl optimization are in the next post.

Dan
Montag DP is online now Find More Posts by Montag DP
Reply With Quote
Old Jun 16, 2010, 02:01 PM
Sink stinks
Montag DP's Avatar
United States, GA, Atlanta
Joined Apr 2005
4,513 Posts
Low-Cl optimization

This one is for BMatthews, because I know he likes that high-speed, low-Cl performance. For this one I did a drag minimization at Cl = 0.1, 0.2, 0.3, 0.4, and 0.5, again at Re=200,000 and with a minimum thickness constraint. The final airfoil has an interesting trailing portion shape, but you can't argue with the results at low Cl.

Maybe it's time to start increasing the design variables?
Montag DP is online now Find More Posts by Montag DP
Reply With Quote
Old Jun 18, 2010, 12:04 PM
B for Bruce
BMatthews's Avatar
The 'Wack, BC, Canada
Joined Oct 2002
11,152 Posts
Now THAT just looks plain WRONG! ! ! !

It's interesting and I'm guessing that the optimization created that bump to fill in a bad low pressure peak?

Either that or your computer was smoking something really good....
BMatthews is offline Find More Posts by BMatthews
Reply With Quote
Old Jun 18, 2010, 01:35 PM
Sink stinks
Montag DP's Avatar
United States, GA, Atlanta
Joined Apr 2005
4,513 Posts
Quote:
Originally Posted by BMatthews View Post
Now THAT just looks plain WRONG! ! ! !

It's interesting and I'm guessing that the optimization created that bump to fill in a bad low pressure peak?

Either that or your computer was smoking something really good....
Well here's a nicer looking one. I think the Cl range on that last one was too low. This one is optimized from Cl = 0.3 to 0.9. The only puzzling thing is, I thought I put in a max thickness constraint of 12% and it doesn't seem to have honored it. I'll have to check the code over.

EDIT: I know what I did. Made part of my code "input-proof" and then forgot that I had done that and changed something else in it later, which was no longer the right format because of the "input-proofing."
Montag DP is online now Find More Posts by Montag DP
Last edited by Montag DP; Jun 18, 2010 at 01:40 PM.
Reply With Quote
Old Jun 19, 2010, 12:20 PM
Sink stinks
Montag DP's Avatar
United States, GA, Atlanta
Joined Apr 2005
4,513 Posts
This is probably the best one I've made so far. This time the maximum thickness constraint actually worked.

Interestingly enough, I am getting better results when I tighten the constraints to make thinner airfoils. I'm guessing this is because thinner airfoils often have more trouble converging, and my code penalizes nonconvergence so much.

I may actually use this airfoil in the future. It compares well with the MH 32 for the low-mid Cl range.

I think it's time to add another control point to the top and bottom surfaces, then I will attempt to optimize an airfoil for higher Cls for the AP plane.
Montag DP is online now Find More Posts by Montag DP
Reply With Quote
Old Jun 19, 2010, 12:34 PM
The Great Filter
kcaldwel's Avatar
Joined Jan 2007
3,519 Posts
...
kcaldwel is offline Find More Posts by kcaldwel
Last edited by kcaldwel; Jul 01, 2010 at 08:32 PM.
Reply With Quote
Reply


Thread Tools