Aerodynamics in SFS

Altaïr

Space Stig, Master of gravity
Staff member
Head Moderator
Team Kolibri
Modder
TEAM HAWK
Atlas
Deja Vu
Under Pressure
Forum Legend
#1
Hello guys and girls!

I did a few tests and I finally figured out how aerodynamics work in that game. :D

If you've already had a look at the planet data, you surely noticed that section:
20190114_222233.jpg
This is where the atmospheric data is described. Here is what it means:
- height: that one is clear, that's the height of the atmosphere limit, in meters.
- density: air density at ground level
- curve: a coefficient that tells how fast density decreases with altitude. A greater coefficient means that density decreases faster.

The density formula used by SFS is:
rho(h) = density × exp(-curve × h/height)
With h being height, and rho(h) density at the corresponding height.

That may be useful for modders that want to design a new planet with its own atmosphere.

You can also use this to test if your rocket is aerodynamic or not (highly recommended if you want to come back from Venus :p).
Here is how to proceed:
First, open the Earth.txt file in planet data, and change the atmosphere data like this:
Screenshot_20190114-222320_QuickEdit.jpg
Changing height is not that important, but what really is is setting the curve parameter to 0. This will make density remain always the same; It will neither increase, nor decrease with altitude.

Then, open SFS, and activate the "no gravity" and "infinite fuel" cheats.
Go into the build menu, and build the rocket you want to test. Before launching it, take note about its thrust:
Screenshot_20190114-222525_Spaceflight Simulator.jpg
In this example, I have a single Hawk, so my thrust is 115 tons.

Then, when you're on the launchpad, exit and then resume the game! This is because drag is brok. erm... disabled by default. This allows to enable drag, so that you can test.

Then turn on the engine, and lift-off! Now your rocket only experiences drag, as gravity is disabled, and its mass won't vary because of infinite fuel.
Your rocket will first accelerate, but it will quickly reach a limit speed:
Screenshot_20190114-222648_Spaceflight Simulator.jpg
When speed doesn't vary anymore, it means that drag is exactly compensating for thrust. Note that limit speed, and now you can calculate a coefficient that will tell you how aerodynamic your rocket is:

Aerodynamism = (speed^2)/thrust

The higher the result, the more aerodynamic your rocket is!

That's still messy, and I apologize for that, but I just figured this out and I still want to experiment, but I wanted to share this so that anyone can do his own tests :p
 

Bananas

Mr. Nice Moderator
Registered
#2
I can't take it Altair, stop, your too smart! We can't have so many featured posts with your name with it!:p
 
#4
I cant wait to see how drag will work after the reentry update. Perhaps it won't be disabled by default and the drag for different parts will make sense
 

Altaïr

Space Stig, Master of gravity
Staff member
Head Moderator
Team Kolibri
Modder
TEAM HAWK
Atlas
Deja Vu
Under Pressure
Forum Legend
#5
I can't take it Altair, stop, your too smart! We can't have so many featured posts with your name with it!:p
I'm really sorry, I promise I'll write a few shitposts to compensate :p
Thanks for your comment and for featuring it too ;)
 
#6
Hello guys and girls!

I did a few tests and I finally figured out how aerodynamics work in that game. :D

If you've already had a look at the planet data, you surely noticed that section:
View attachment 12050
This is where the atmospheric data is described. Here is what it means:
- height: that one is clear, that's the height of the atmosphere limit, in meters.
- density: air density at ground level
- curve: a coefficient that tells how fast density decreases with altitude. A greater coefficient means that density decreases faster.

The density formula used by SFS is:
rho(h) = density × exp(-curve × h/height)
With h being height, and rho(h) density at the corresponding height.

That may be useful for modders that want to design a new planet with its own atmosphere.

You can also use this to test if your rocket is aerodynamic or not (highly recommended if you want to come back from Venus :p).
Here is how to proceed:
First, open the Earth.txt file in planet data, and change the atmosphere data like this:
View attachment 12051
Changing height is not that important, but what really is is setting the curve parameter to 0. This will make density remain always the same; It will neither increase, nor decrease with altitude.

Then, open SFS, and activate the "no gravity" and "infinite fuel" cheats.
Go into the build menu, and build the rocket you want to test. Before launching it, take note about its thrust:
View attachment 12052
In this example, I have a single Hawk, so my thrust is 115 tons.

Then, when you're on the launchpad, exit and then resume the game! This is because drag is brok. erm... disabled by default. This allows to enable drag, so that you can test.

Then turn on the engine, and lift-off! Now your rocket only experiences drag, as gravity is disabled, and its mass won't vary because of infinite fuel.
Your rocket will first accelerate, but it will quickly reach a limit speed:
View attachment 12053
When speed doesn't vary anymore, it means that drag is exactly compensating for thrust. Note that limit speed, and now you can calculate a coefficient that will tell you how aerodynamic your rocket is:

Aerodynamism = (speed^2)/thrust

The higher the result, the more aerodynamic your rocket is!

That's still messy, and I apologize for that, but I just figured this out and I still want to experiment, but I wanted to share this so that anyone can do his own tests :p
Thanks for this post! When I saw the title and the author, I knew it would be a good post. Here are my questions for aerodynamics- how much does the geometry really matter? That is, for a given mass, will a rocket with square edges but shaped roughly like a Saturn 5 (tapered) be better than the same mass used in a rectangle? Say I have a long, rectangular ship reentering. Can i use that long side for lift or only additional drag?

I do disagree with your way to calculate aerodynamism, because it doesn't account for mass. Different mass ships have different accelerations.

Here's the equation for drag (a snippet from Wikipedia):

Screenshot_20190115-014728_Wikipedia.jpg


Well, we know the force of drag, since its the same as the engine thrust (note- don't trust the thrust: it's not exactly as advertised. We can account for that in the formula). We know most of the other parameters, too, so I think we can solve for C. That will give a value which is more comparable and thus more useful.

If we solve for C, we get C = thrust*2*(thrust constant)/[(density)*(v^2)*A] where C is the coefficient of drag, which we are solving for, thrust is the thrust of the engines, the thrust constant is something like (10/9.8), density is what you just set in the planet changes for the atmosphere, v is the spacecraft velocity. What should we do about A? Should it be the number of blocks wide, or the number divided in 4, to be the standard width?

I would love to year what you all think!
 

Altaïr

Space Stig, Master of gravity
Staff member
Head Moderator
Team Kolibri
Modder
TEAM HAWK
Atlas
Deja Vu
Under Pressure
Forum Legend
#7
Hi @Johnkurveen :)
Thanks for your return. To begin with, aerodynamics is not my speciality, I've studied that, but it's been long ago. But I'll try to answer as accurately as possible.

Regarding drag, the object's geometry is important of course. This is taken into account in the "Cd" variable. In practice, how much a given profile is efficient is measured by tests in a wind tunnel. The angle at which the wind "hits" the object is important too, especially for a wing: a wing will generate drag (which is generally referred as Cx in this case), but also lift (which is Cz) depending on the angle of incidence.
Of course on such objects, sharp edges must be avoided, as this is likely to cause flow separation, and turbulences. This phenomenon causes massive drag in a chaotic way, so we want to avoid it at all cost! That's why objects optimized for aerodynamics are rather water drop-shaped.

Regarding the aerodynamism calculation, the way you solve the problem is actually similar to mine.
Your reasoning is good, if I take your formula, you have:
A×Cd = 2×thrust/(density×v^2)
I just switched A to the left side, so that I only have one unknown parameter (the product A×Cd, but we don't need more in a first time).
Density is a constant (in this case) and doesn't depend on your rocket, so you can say that A×Cd is proportional to thrust/v^2. So in the end you have to... minimize that factor.
To have a more intuitive coefficient, I chose to reverse that formula, so in the end, you have to maximize v^2/thrust.
I thought that may sound more intuitive for people that didn't make the maths, as you can simply reason by telling "the bigger, the better".
Hey look, that's the coefficient I proposed! :p
So finally I guess we agree ;)
That looks surprising at first, but in the end that doesn't depend on the rocket mass indeed.
I made the experiment to confirm that:
Screenshot_20190115-112817_Spaceflight Simulator.jpg Screenshot_20190115-112918_Spaceflight Simulator.jpg
303 m/s in both cases. In the end, a heavier rocket will just need more time to reach its limit speed.

Just a last word about that thrust problem: you're right indeed, thrust should be corrected by a factor 10/9.8 to be correct, but as long as you just want to compare different rockets between themselves, all coefficients are shifted in the same proportion, so it doesn't change the result. So why not keeping things simple in the end? ;)
 
#8
Hi @Johnkurveen :)
Thanks for your return. To begin with, aerodynamics is not my speciality, I've studied that, but it's been long ago. But I'll try to answer as accurately as possible.

Regarding drag, the object's geometry is important of course. This is taken into account in the "Cd" variable. In practice, how much a given profile is efficient is measured by tests in a wind tunnel. The angle at which the wind "hits" the object is important too, especially for a wing: a wing will generate drag (which is generally referred as Cx in this case), but also lift (which is Cz) depending on the angle of incidence.
Of course on such objects, sharp edges must be avoided, as this is likely to cause flow separation, and turbulences. This phenomenon causes massive drag in a chaotic way, so we want to avoid it at all cost! That's why objects optimized for aerodynamics are rather water drop-shaped.

Regarding the aerodynamism calculation, the way you solve the problem is actually similar to mine.
Your reasoning is good, if I take your formula, you have:
A×Cd = 2×thrust/(density×v^2)
I just switched A to the left side, so that I only have one unknown parameter (the product A×Cd, but we don't need more in a first time).
Density is a constant (in this case) and doesn't depend on your rocket, so you can say that A×Cd is proportional to thrust/v^2. So in the end you have to... minimize that factor.
To have a more intuitive coefficient, I chose to reverse that formula, so in the end, you have to maximize v^2/thrust.
I thought that may sound more intuitive for people that didn't make the maths, as you can simply reason by telling "the bigger, the better".
Hey look, that's the coefficient I proposed! :p
So finally I guess we agree ;)
That looks surprising at first, but in the end that doesn't depend on the rocket mass indeed.
I made the experiment to confirm that:
View attachment 12070 View attachment 12071
303 m/s in both cases. In the end, a heavier rocket will just need more time to reach its limit speed.

Just a last word about that thrust problem: you're right indeed, thrust should be corrected by a factor 10/9.8 to be correct, but as long as you just want to compare different rockets between themselves, all coefficients are shifted in the same proportion, so it doesn't change the result. So why not keeping things simple in the end? ;)
Excellent, thank you for correcting me! That does make more sense now.

I do wonder how the drag is calculated, though, and if it includes calculations of seperation, turbulence, etc, or if it just looks at area or surface area exposed to the air.
 

Altaïr

Space Stig, Master of gravity
Staff member
Head Moderator
Team Kolibri
Modder
TEAM HAWK
Atlas
Deja Vu
Under Pressure
Forum Legend
#9
Excellent, thank you for correcting me! That does make more sense now.

I do wonder how the drag is calculated, though, and if it includes calculations of seperation, turbulence, etc, or if it just looks at area or surface area exposed to the air.
Your reasoning was mostly correct :)

How drag is calculated is a good question indeed. I could check that drag is actually proportionnal to v^2: If you lower your throttle from 100% to 25%, the limit speed will be halved. I made more detailed tests but you get the idea. :)

It's probable that each piece has a reference area based on its dimensions indeed, and a specific drag coefficient.
There's probably a center of drag too, because aerodynamic forces are able to flip a rocket.
I wonder if the drag coefficient could depend on the wind direction (a given side could be more resistive than another one)... I guess we'll have to do a lot of testing!
 

Altaïr

Space Stig, Master of gravity
Staff member
Head Moderator
Team Kolibri
Modder
TEAM HAWK
Atlas
Deja Vu
Under Pressure
Forum Legend
#12
Haha, thanks guys :)
I'm glad you appreciate. This is going to be a lot of roles if I get another one! :p
 
#16
So knowing all this, is there a way to find how much delta v will be lost due to drag?
Great question! I think Altair can go into great depth about that and I would certainly love to see what he says.

From my research, here's what I would say: one must consider two forces of drag- aerodynamic drag and gravitational drag. If you propel off the launch pad with a thrust to weight ratio (TWR) of 1.00, you will stay in place despite your engines being on. At 1.01, you will move upward very slowly (we are assuming no change in mass). Both are examples of gravitational drag. It refers to any time you burn parallel with the force of gravity, not perpendicular. That's part of why launches go into orbit instead of going straight up forever, and it's most noticable at low TWRs.

Ok, aerodynamic drag is more complex. If you go faster, more energy will be consumed by drag. If you go slower, you will spend more time in the atmosphere. That's why it's best to go straight up at first (leave the high-drag lower atmosphere) and then once you have some velocity and height, start going over. That doesn't have to much height at all, and everyone disagrees where that is. It's also super simplified of an explanation!

Did you know the Saturn 5 had a TWR of 1.2? I have heard that the best TWR really depends on your design, but is between 1.2 and 1.7 (For KSP at least). Above that, you face more aerodynamic drag. Below that, gravitational drag is more promenant. Personally, I like to have a TWR at lift off of 1.4 and I will design to that spec.

Now, to actually answer your question: I would recommend building a small, simple ship, and going into orbit with different curves. Find the ship that went into orbit with the most fuel (constant design) and that curve used the least delta-v. Calculate that delta-v. Then, with your new ship design, do the same thing. Take a few different tries to launch it, and whichever one gets the most mass into orbit (constant design) used the least delta-v. Calculate that delta-v, and compare it with the earlier, "ideal" delta-v to orbit. That difference is lost to both gravitational and aerodynamic drag, so if its substantial, redesign accordingly. That's how I do it!
 
#17
Great question! I think Altair can go into great depth about that and I would certainly love to see what he says.

From my research, here's what I would say: one must consider two forces of drag- aerodynamic drag and gravitational drag. If you propel off the launch pad with a thrust to weight ratio (TWR) of 1.00, you will stay in place despite your engines being on. At 1.01, you will move upward very slowly (we are assuming no change in mass). Both are examples of gravitational drag. It refers to any time you burn parallel with the force of gravity, not perpendicular. That's part of why launches go into orbit instead of going straight up forever, and it's most noticable at low TWRs.

Ok, aerodynamic drag is more complex. If you go faster, more energy will be consumed by drag. If you go slower, you will spend more time in the atmosphere. That's why it's best to go straight up at first (leave the high-drag lower atmosphere) and then once you have some velocity and height, start going over. That doesn't have to much height at all, and everyone disagrees where that is. It's also super simplified of an explanation!

Did you know the Saturn 5 had a TWR of 1.2? I have heard that the best TWR really depends on your design, but is between 1.2 and 1.7 (For KSP at least). Above that, you face more aerodynamic drag. Below that, gravitational drag is more promenant. Personally, I like to have a TWR at lift off of 1.4 and I will design to that spec.

Now, to actually answer your question: I would recommend building a small, simple ship, and going into orbit with different curves. Find the ship that went into orbit with the most fuel (constant design) and that curve used the least delta-v. Calculate that delta-v. Then, with your new ship design, do the same thing. Take a few different tries to launch it, and whichever one gets the most mass into orbit (constant design) used the least delta-v. Calculate that delta-v, and compare it with the earlier, "ideal" delta-v to orbit. That difference is lost to both gravitational and aerodynamic drag, so if its substantial, redesign accordingly. That's how I do it!
Wow, thanks! This is really helpful. I am going to try this tomorrow! :D
 
#18
So knowing all this, is there a way to find how much delta v will be lost due to drag?
Use a=v-u/t, a can be found using drag force, v-u is your delta v, t is the time between each flight phase where in this case I used altitude. You might need to use integration to find out the total drag loss in a time range.
 
T

TtTOtW

Guest
#19
Use a=v-u/t, a can be found using drag force, v-u is your delta v, t is the time between each flight phase where in this case I used altitude. You might need to use integration to find out the total drag loss in a time range.
So brilliant in its simplicity it's ridiculous...
 

Altaïr

Space Stig, Master of gravity
Staff member
Head Moderator
Team Kolibri
Modder
TEAM HAWK
Atlas
Deja Vu
Under Pressure
Forum Legend
#21
So knowing all this, is there a way to find how much delta v will be lost due to drag?
The question is simple, the answer is not I'm afraid.

What said @Johnkurveen is a good test indeed.
Mathematically speaking, it's not possible to tell what is the best trajectory for a given launcher because this is way too complex: It depends on thrust, the launcher mass (which varies), the ISP, density varies with altitude, drag is proportional to v^2, making the equation non linear... Even gravity varies slightly with altitude. This is a real nightmare. So to have an idea, we have to either limit ourselves to simple cases, or to use simulations. Trying several trajectories with a launcher and see what's the most efficient is still the best way.

However, I figured out a few things about how to manage the beginning of the flight. Obviously, the best option to escape a dense atmosphere is to go straight up in the beginning of the flight. But which option is better:
- using powerful engines (Hawk/Titan), which will consume a lot of fuel but may help to go faster and escape sooner the high density zone?
- or using efficient engines (Broadsword/Frontier), with which you'll go slower, but consuming less fuel and not feeding drag as much?
The first option may sound as brute force, inefficient and all, but in the end this is by far the best option! This is mostly because actually gravity is still your greatest opponent: when your TWR is 1.5 for example (which is quite good), this means that 66% of your thrust is used just to compensate for gravity, the remaining 33% are used to accelerate the launcher and to "feed" drag. If you consider that achieving high Thrust/Weight ratios will be more difficult with efficient engines, a Hawk or a Titan to lift off from Venus is still the best option.

I could also have an idea about when you should start to curve your trajectory to reach orbit, but I'm still working on it. This is still confused now, but I have an idea to make it understandable. I'll keep you informed guys ;)
 
T

TtTOtW

Guest
#22
I'm actually working on a spreadsheet solution to narrow down the options to a most efficient range of potential trajectories.
 
#23
This is where the atmospheric data is described. Here is what it means:
- height: that one is clear, that's the height of the atmosphere limit, in meters.
- density: air density at ground level
- curve: a coefficient that tells how fast density decreases with altitude. A greater coefficient means that density decreases faster.

The density formula used by SFS is:
rho(h) = density × exp(-curve × h/height)
With h being height, and rho(h) density at the corresponding height.
The formula presentation is a mess, by rho(h) do you mean rho as rho multiplied by h? What the hell is exp? And by h/height do you literally mean h divided by height?

What is this site for anyway? Is it to improve the game's aerodynamics?

I do disagree with your way to calculate aerodynamism, because it doesn't account for mass. Different mass ships have different accelerations.
We do not care about mass when calculating drag force.

Well, we know the force of drag, since its the same as the engine thrust
If the drag force is the same as the thrust, your rocket is going nowhere.
 

Altaïr

Space Stig, Master of gravity
Staff member
Head Moderator
Team Kolibri
Modder
TEAM HAWK
Atlas
Deja Vu
Under Pressure
Forum Legend
#24
I'm actually working on a spreadsheet solution to narrow down the options to a most efficient range of potential trajectories.
That may be interesting.
On my side I made a lot of tests to measure the "surface" of each piece.
I'll make a chart, but the problem is that some data is inconsistent (some larger pieces sometimes generate less drag than small pieces of the same type), so it tends to be messy.
 
#25
Regarding the aerodynamism calculation, the way you solve the problem is actually similar to mine.
Your reasoning is good, if I take your formula, you have:
A×Cd = 2×thrust/(density×v^2)
I just switched A to the left side, so that I only have one unknown parameter (the product A×Cd, but we don't need more in a first time).
Density is a constant (in this case) and doesn't depend on your rocket, so you can say that A×Cd is proportional to thrust/v^2. So in the end you have to... minimize that factor.
To have a more intuitive coefficient, I chose to reverse that formula, so in the end, you have to maximize v^2/thrust.
I thought that may sound more intuitive for people that didn't make the maths, as you can simply reason by telling "the bigger, the better".
Hey look, that's the coefficient I proposed! :p
So finally I guess we agree ;)
That looks surprising at first, but in the end that doesn't depend on the rocket mass indeed.
I made the experiment to confirm that:
What is this? You assume the drag force to be exactly the same as thrust? The drag coefficient you'll get in the end will be wrong.
 
Last edited: