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
687 stars 111 forks source link

There seems to be a problem with the display of symmetrical wings with dihedral #98

Closed Zcaic closed 11 months ago

Zcaic commented 11 months ago

Hello, problem: I'm defining a symmetrical wing with dihedral, and I draw it , I found it seems to be a little problem, As shown below 微信截图_20230721010623 expect: What I expect should be as shown in the figure below, 屏幕截图 2023-07-21 041856 In aerosandbox, the symmetry of the wing seems to be split, I don't know if this will affect the aerodynamic calculations in aerosandbox.

peterdsharpe commented 11 months ago

Hey @Zcaic!

Will respond in more detail later, but tl;dr is that this is intended behavior (required to make numerical optimization of aircraft configurations smooth and well-behaved - for example, in cases where you're optimizing the dihedral angle of a V-tail or optimizing the right fuselage-wing intersection geometry) and has negligible impact on any of AeroSandbox's aerodynamic solvers.

Zcaic commented 11 months ago

Thank you very much for your reply, I meet this problem because planning to write an aerosandbox to openvsp interface.

peterdsharpe commented 11 months ago

To elaborate on this further, as promised:

In order for wing shape optimization to work well, it's desirable for the wing to change "smoothly" as its critical design variables (e.g., span, inboard location, dihedral angle) change. This is because AeroSandbox uses gradient-based optimization, and so any discontinuities (in shape, or in the derivative of shape) with respect to design variables will cause optimizer instability. More details on this here.

Here are some practical examples where this could come up, in terms of this wing shape quirk described here:

  1. Say you are optimizing an airplane with a V-tail. Assume you are optimizing for minimum drag (say, using asb.AeroBuildup), with constraints on the lateral stability behavior (say, using this AeroSandbox module that estimates aircraft dynamics eigenvalues). One of your design variables might be the dihedral angle of the V-tail. In the limit of that dihedral angle going to 90 degrees, you don't want your airfoil shape at the inboard section to become infinitely stretched.

    As an example, this is a singularity that XFLR5 experiences, which results in airfoils being highly-distorted in this exact scenario. And, at a dihedral angle of 90 degrees, it will ultimately fail. From XFLR5, we see this in a high-dihedral V-tail: image

Because AeroSandbox makes no explicit distinction between a main wing, a horizontal stabilizer, a vertical stabilizer, a canard, etc. (they are all just asb.Wing objects), we need a representation that is general enough to account for all of them and transition between them smoothly. The benefit of this general approach (used by AeroSandbox and OpenVSP, but not XFLR5) is that there are no limits on what aircraft configurations can be modeled.

Because of this, the inboard section representation must not depend on whether the inboard section is exactly on the centerline, nor should behavior change abruptly with respect to dihedral angle (i.e., can't implement logic that "tries to determine" whether the wing is a vertical stabilizer or a horizontal stabilizer). So, the logic you see here in AeroSandbox, which orients the inboard cross section normal to the inner-most wing section, is intended as it satisfies these requirements. If AeroSandbox did not require continuity for design optimization, then the reorient-the-centerline-xsec approach would work. (Alternatively, we could add a boolean flag for this behavior in the asb.Wing constructor, which might be cool contribution!)

Zcaic commented 11 months ago

Thank you for the elaboration, I understand that it is to ensure the smoothness of the dihedral at large angles.