Jump to content

Stock Aero Drag Curves: How do they work?


Recommended Posts

I'm trying to figure out the new drag system, specifically for simulation and trajectory plotting. The simulation part is why I can't just pull the info I want right off the parts, I need to simulate a future vessel/part state. (I think.)

So Physics.cfg defines four drag curves, among other things, which get put into PhysicsGlobals in KSP.

The four float curves I'm interested in are:

DragCurveMultiplier

DragCurveSurface

DragCurveTail

DragCurveTip

You can look at the curves in the aero debug menu.

The four of which get evaluated against mach and combined somehow to get a multiplier on area from a part's dragcubes. Anybody know what it is doing?

Well, someone does, the mechjeb source reads that you normalize the dot product of the cube face direction and the drag vector like so: (dragdot+1)*0.5, which I don't know why it does that. Trig identify?

Mechjeb then does two different interpolations on the tip or tail drag depending on that normalization.

Anyone have any clues for me?

Link to comment
Share on other sites

Great to see a thread specifically about this. I remember seeing at least a qualitative explanation about the drag cube calculations on the forums. I'll poke around to try to find it... here is the main thread I remembered. On page 5 OhioBob, Claw, and Gfurst start to get into more rigorous mathematical detail.

Edited by cybersol
Link to comment
Share on other sites

Well, someone does, the mechjeb source reads that you normalize the dot product of the cube face direction and the drag vector like so: (dragdot+1)*0.5, which I don't know why it does that. Trig identify?

The normalized dot is in the -1 +1 range so by doing that you get a value in the 0 1 range that you can use for the curve. With a value lower than 0.5 the drag in the same direction as the back of the face and with more than 0.5 it is in the front.

What the code do in layman term is for each face :

- if the air come from the front interpolate from the tipDrag (full frontal) to surfaceDrag (fully parallel)

- if the air come from the front interpolate from the tailDrag (full reverse) to surfaceDrag (fully parallel)

- multiply the result by the multiplierCurve

What do you need the info for ?

Link to comment
Share on other sites

I want to point out that the DragCube class has method that do that easily. I implemented those in MJ because the stock method is not thread safe.

Also I am not sure the MJ implementation is fine since it seems to underestimate the drag/lift a bit. It may be that the vector I input are not correctly oriented or something else.

Link to comment
Share on other sites

I want to point out that the DragCube class has method that do that easily. I implemented those in MJ because the stock method is not thread safe.

Also I am not sure the MJ implementation is fine since it seems to underestimate the drag/lift a bit. It may be that the vector I input are not correctly oriented or something else.

Which method in DragCube? Or is it in DragCubeList?

I had pulled out your code (MJ 2.5.0) and implemented it in a test plugin and I've been compared to readouts from NathanKell's AeroGUI. I'm seeing more drag and less lift than stock, but part of that could me porting to code over to a tiny plugin.

Link to comment
Share on other sites

yes, it is DragCubeList. sorry. The relevant call is AddSurfaceDragDirection and the GetCubeXXXX calls are also useful.

Make sure you use the code from the dev branch (master uses the same code since yesterday)

I'll have to redo some comparaison check myself. At one point the result was good by I made so much change to that code that I am not sure it is working.

But I won't do that now. I already spent far too much time on that and I need to work on my other projects and deal with some RL time sink.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...