Jump to content

How does drag work these days, anyway?


Recommended Posts

By and large, I know how to build a low-drag vessel. I know abut the radial s stack attach issues.  I'm aware that people have done tests to compare the actual drag of parts, I've done enough of these myself.

What I don't know, though, is how the game arrives at it's drag values. It seems as if part stats written down in the configuration files hardly matter, if at all.

Has there ever been a good writeup of the post-1.0 drag model? Would anyone happen to have a link handy?

Link to comment
Share on other sites

Drag basically works the way it does in real life.  KSP uses the drag equation,

F_{D}\,=\,{\tfrac  12}\,\rho \,u^{2}\,C_{D}\,A

The atmospheric density, ρ, is computed from the air pressure, temperature, and molecular weight.  KSP uses reasonably realistic atmospheric models.  The flow velocity, u, is, as far as I know, the surface speed of the vehicle.  The drag coefficient, CD, and reference area, A, are more of a mystery.  I don't fully understand it, but it works something like this:

Each part in KSP is represented by a drag cube, with each face having an area and drag coefficient.  This information is found in the file PartDatabase.cfg.  Somehow KSP figures out how much each part contributes to the drag and sums the results, but I really don't know exactly how it's done.  I'm pretty sure that one part of the operation is to determine the exposure of each face of the drag cube relative to the flow, taking into account occlusion.  The game's Aero GUI readout (found in the cheat menu) gives the total drag and drag coefficient, but I'm uncertain how those numbers are arrived at.  The game could sum the areas and compute a total vehicle CD, from which the drag is computed in a single operation.  Or it could compute the drag for each part individually and then sum the individual drag values to arrive at a total.  There are also a bunch of drag multipliers in the file Physics.cfg, but I don't know how all that comes into play.

I've attempted to perform some computer simulations outside of the game, but I've never been able to figure out exactly how KSP computes drag.  I generally just set the reference area to the projected area of the vessel, and then estimate the drag coefficient empirically, back calculating it from the total drag and dynamic pressure readouts in the Aero GUI.  It's such a pain to do that I've pretty much given up on it.  I wish it were simpler, but it's not.

(edit)  Correction, the Aero GUI does not give the drag coefficient, it just gives the total drag.  It also gives the dynamic pressure.  Dividing drag by dynamic pressure gives the product CDA.

I suspect that the drag of each part is computed individually and then those numbers summed to give the total.  But your guess is as good as mine.
 

Edited by OhioBob
Link to comment
Share on other sites

59 minutes ago, OhioBob said:

This information is found in the file PartDatabase.cfg

...which holds the data I was most interested in when I posted the question. Thanks for pointing it out, I never really noticed the file, certainly never bother to check it's content. Apparently it is rebuilt at every game start, at any rate it's recent for me and has entries for mod parts.

I'm not really wiser now, e.g. I don't really know how the game computes those figures. Presumably it's some "basically reasonable" algorithm looking at shape, pointy being better and so on. At first glance, it seems that size (surface area) is already taken into account.

After a few experiments I should be able to make sense of these numbers, this has the potential to make part tests unnecessary. Thanks again!

Link to comment
Share on other sites

  • Parts attached inline are occluded when in the airflow (they obviously produce drag if you pancake your way through the air).
  • Open or mismatched (1.25m attached on a 2.5m part) nodes create a lot of drag (even empty nodes at the back of an aircraft).
  • Radially attached parts are not occluded at all (save in fairings and cargo bay) no matter how clipped or blended in they are.
  • "Physicsless" parts add their drag to the parent part and are not occluded.
  • Wing shape doesn't matter: a glider will go supersonic as well as a delta wing for the same amount of engines.
  • Rotating parts out of the airflow (pitch or yaw axis rotation) increase their drag, rolling doesn't.
  • Fairing shape does change drag: a blunt fairing will have more drag than a pointy one.
  • Drag for individual parts is not calculated but is a hard-coded value set by Squad that may not depend on the actual aerodynamic properties of that shape (this is why Mk2 is so draggy).

These are general rules on drag that the game includes in its calculations. It determines what drag cubes are exposed to airflow and at what angle, and deduces drag for individual parts this way. Stock aero never uses the craft in its entirety to calculate drag, it adds the contributions for individual parts.

Link to comment
Share on other sites

On ‎12‎/‎16‎/‎2017 at 11:35 AM, Laie said:

After a few experiments I should be able to make sense of these numbers, this has the potential to make part tests unnecessary. Thanks again!

What I can tell you is that the first 18 numbers are Area/CD/Depth for the six faces of the drag cube.  The faces are X+, X-, Y+, Y-, Z+, and Z-.  I believe the Y axis parallels the longitudinal axis of the vessel, with the Y+ surface being the one facing forward (in default orientation - axes rotate with part).  I don't know what the last 6 numbers are, but I don't think that have anything to do with drag.  Here's an example:

PART
{
	url = Squad/Parts/Command/mk1pod/mk1Pod/mk1pod
	DRAG_CUBE
	{
		cube = Default, 1.016,0.6655,0.7373, 1.016,0.6768,0.7316, 1.251,0.4785,1.097, 1.251,0.9474,0.3449, 1.013,0.662,0.7326, 1.013,0.6605,0.7441, 0,0.1044,-0.001006, 1.269,1.133,1.271
	}
}

Arranging the data in a more useful form, we have

Surface Area CD Depth
X+ 1.016 0.6655 0.7373
X- 1.016 0.6768 0.7316
Y+ 1.251 0.4785 1.0970
Y- 1.251 0.9474 0.3449
Z+ 1.013 0.6620 0.7326
Z- 1.013 0.6605 0.7441

As you can see, the pointy end has the lowest CD (Y+) and the blunt end has the highest CD (Y-).

These CD values are apparently further modified by the multipliers found in Physics.cfg.  These modifiers adjust for the orientation of the face relative to the flow (tip, side or tail), and the Mach number.  If the face is at an angle to the flow, e.g. partly facing forward and partly facing sideways, I think the face is prorated in some way between the two types.
 

Edited by OhioBob
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...