peterdsharpe / AeroSandbox

Aircraft design optimization made fast through modern automatic differentiation. Composable analysis tools for aerodynamics, propulsion, structures, trajectory design, and much more.
https://peterdsharpe.github.io/AeroSandbox/
MIT License
690 stars 111 forks source link

Wing with a winglet #18

Closed KikeM closed 4 years ago

KikeM commented 4 years ago

Dear @peterdsharpe,

I am planning on using your library to finish some assignments for an aerodynamical course.

Do you reckon it would be possible to simulate a wing with a winglet, to compute it's induced drag?

If the code does not support it yet, would you have an idea on how to do it, so I can implement it, use it and then merge it to your master branch?

Thank you.

peterdsharpe commented 4 years ago

Yes, it's absolutely possible to already model a winglet with AeroSandbox!

I'd recommend using AeroSandbox v0.3.0 for this instead of AeroSandbox v1.0.0-beta, as the latter is still under heavy modification (hence the beta suffix).

To use v0.3.0, you have two options:

  1. Install v1.0.0 by using pip install aerosandbox at terminal. Then, import legacy AeroSandbox into python using import aerosandbox_legacy_v0 as asb, and use the definitions there. (Documentation in the associated files within the library).
  2. Install v0.3.0 directly by using pip install aerosandbox==0.3.0 at terminal. Then, import normally: import aerosandbox as asb.

Both should be identical - please let me know if you run into problems with either!

To model a winglet, you'll want to just add a wing section that bends the wing upwards as desired - easy as that!

peterdsharpe commented 4 years ago

And please keep me posted if you have issues - more than happy to help as time allows!

KikeM commented 4 years ago

Awesome!

I'll keep you updated then.

To get my feet wet, I'll probably follow option number 2, but I'll then check I get the same results with option number 1, to ensure the transition took place correctly.

peterdsharpe commented 4 years ago

Closing this issue for now, but please open a new one or reopen this if you run into any issues!

KikeM commented 4 years ago

Hello @peterdsharpe,

I hope you are doing well within the current coronavirus situation.

Reading through the issues of the repo, I have ruined into #17 , which mentions problems with moment estimations.

I need to get the wing root bending moment for my calculations, so I should change those lines of code mentioned in the issue, right?

Thx!

peterdsharpe commented 4 years ago

Hi @KikeM ,

Thank you, you too! Things are crazy here in the United States - last week I was evacuated from my usual workplace at MIT due to the pandemic, and I'm now staying with family in Missouri. It looks like you're in Spain, yes? (Spain will always have a special place in my heart - many years ago I used to live in Salamanca.) Good luck and stay safe out there - we'll all get through this together!

Yes, it's probably a good idea to change the lines of code mentioned in #17! However, the moments we were discussing in #17 refer to overall moments on the airplane (i.e. for stability calculation) rather than internal moments that one would use for structural calculation. To get something like the root bending moment, you probably want to add up the individual moment contributions of each individual panel on the wing. To do that, you'll likely want to use:

Both of these quantities (location and force) are expressed in aircraft "geometry axes" (x is backward, y is right, and z is up).

To get the root bending moment, I imagine you'll want to do some kind of

np.cross(vlm3.vortex_centers - wing_root_location, vlm3.Fi_geometry, axis = 1)

-type operation, though isolating which panels came from which wing might be tricky...

peterdsharpe commented 4 years ago

You also might consider what the goal of your optimization is - if you're trying to do spanload optimization where you get minimum induced drag for a given root bending moment, I believe there's a closed-form solution for that in a 1933 paper by Prandtl!

KikeM commented 4 years ago

Hi @peterdsharpe,

Good to know you are in good health. Keep it that way ;) I am writing from Madrid, Spain. I am glad you had the chance to live in Spain, specially in Salamanca (beautiful city).

For the moment I am only trying to asses the effects of adding the winglets to the wing, no optimization needed for the moment.

If the line of code you gave me will add up all the contributions (wing + winglet), it is good enough. I don't need to separate them for the moment either.

peterdsharpe commented 4 years ago

Yes, it should do that (as long as you have just one wing + winglet in your simulation)! I would also check that code, as I haven't actually run and tested that - that's just pseudocode for a basic r-cross-f-like moment calculation!

KikeM commented 4 years ago

Okey, I see.

I was modeling the winglet with two separate Wings, like a vertical stabilizer. But by the looks of your comment, I should perhaps add an extra WingXSec at the end of my wing, right?

peterdsharpe commented 4 years ago

Either one should be fine - those should generate identical results!

Sorry - I should have worded my comment better. Basically, that pseudocode that I wrote above will assume that all panels on the airplane (from all Wings and all WingXSecs) are exerting a moment on the main wing's root. For a flying wing, this is the case. However, for a conventional-configuration airplane (i.e. with a tail), this is not the case (the forces on the tail do not contribute to the main wing's root bending moment).

KikeM commented 4 years ago

Great!

Another question, since you seem to be available now. I've notice that for the vertical stabilizer you have put a small gap between the HTP and the VTP. Should I do the same with my winglet?

That is, is there any problem if the bodies "collide"?

Thank you.

peterdsharpe commented 4 years ago

Sure!

From a theoretical standpoint, there shouldn't be a problem with making them coincident - my hunch is that that'll be fine. I especially think you'll be fine if you're using CasLL1, though I think you should still be fine if you're using one of the many VLM-like methods.

However, you might run into numerical issues if you have any extreme wing twists at that intersection? Again, I don't think there would be a problem, but this might be something to play around with! Any problems will likely be immediately obvious, as the issue you might face is that a vortex filament gets too close to a collocation point and causes a singularity (i.e. lift and drag values will shoot off to infinity and be very obviously incorrect).

KikeM commented 4 years ago

What is the difference between CasLL1 and the VLM methods? I guess the first one is not a lattice vortex method?

I think I might be running into those issues you mention, I'll have a look at it tomorrow.

Thanks!

peterdsharpe commented 4 years ago

Great question! CasLL1 is a modern implementation of a nonlinear lifting-line method. It's similar to the method this paper describes, but I actually hadn't read this paper at the time of coding CasLL1 so there are some implementation differences my code and the paper: https://arc.aiaa.org/doi/abs/10.2514/2.2649

Compared to one of the many VLM methods, there are pros and cons:

Pros:

Cons:

Notes: If you use CasLL1, beware that you should specify the input arguments CL_function, CDp_function, and Cm_function to any Airfoil-class objects that you create. In the future, this will be automated, but for now, you need to specify this. The Airfoil constructor has instructions on how to do this, and aerosandbox/library/airfoils.py has examples.