Jump to content

Engines, launches and Maths


LN400

Recommended Posts

I am on a quest: To find the maths that describes, for a given rocket with a given engine:

The TWR profile during a launch through the atmosphere.

To calculate pre-launch the necessary double derivative of decreasing throttle to maintain a pre-set TWR

To find a mathematical function of time and/or altitude that will give me the necessary throttle setting to maintain the set TWR.

To be able to have a detailed picture of the entire launch in terms of

Acceleration at any moment in time during the launch.

Thrust at any given time whether it's for a fixed TWR or floating TWR profile.

 

There are several complications:

The "constant" g is not constant. I know the formula for a given height above the planet's CoM, it is

glocal = g0 / (h / R)2

where (for Kerbin) g0 = 9.80665 m/s2, h is the height above the center of Kerbin and R is the radius of Kerbin = 600km. This change of g affects the local TWR.

 

The thrust of an engine increases with increasing altitude to a maximum. This thrust function of altitude is one of my unknowns.

 

The Isp increases with increasing altitude to a maximum. This function is also an unknown.

 

The mass is changing so Newton's 2nd law can not be applied without modifications (N2 as described in most school text books, F = ma only applies to constant mass problems, not to varying mass problems). This is not entirely unknown but for this topic, regard the correct expression as an unknown to me.

 

The mass of the rocket is constantly changing but the rate of change is not constant because of:

Increasing thrust means higher TWR which means thrust must be lowered continuosly to maintain a set TWR.

Decreasing thrust means a decreasing fuel mass loss per second.

g is decreasing with altitude which will increase the TWR.

Luckily, the rate of fuel mass change is only depending on thrust, or one can say the throttle setting for a given engine with a known thrust. Isp translates to velocity but I am only after the TWR.

 

The trajectory will affect how much time is spent in low, dense atmosphere with lower thrust and higher fuel consumption. Precicely how the trajectory affects time I can not explain mathematically.

 

What I hope to see here, unless some bright soul solved this problem with pre-calculated thrust profiles, is a discussion on how to tackle this. Where to start? What did I not think of? and finally and hopefully a conclusion with the equations one would need.

This topic is meant as a maths and physics topic, not a discussion on how mods and spreadsheets can make life easier in KSP. It is the maths behind it, and the physics that is the topic.

Link to comment
Share on other sites

Well to start you're going to be looking at differential equations and -  unless I'm wrong - ones that can't be solved analytically once you start looking at motion in two or three dimensions including drag and such

Link to comment
Share on other sites

55 minutes ago, Steel said:

Well to start you're going to be looking at differential equations and -  unless I'm wrong - ones that can't be solved analytically once you start looking at motion in two or three dimensions including drag and such

Yeah but where even to begin formulating those equations?

EDIT: One of my former physics teachers once mentioned that each engine of a particular kind was controlled by computers running and solving more than 30 differential equations, several times per second. I don't want to punish my laptop trying to do the same but then again, theory is a lot less costly than actually sending a rocket anywhere.

Edited by LN400
Link to comment
Share on other sites

So, TWR is given by: TWR = F / (Mg) with F the thrust, M the mass of the rocket and g the gravitational acceleration.

M is a function of time with M(t) = M0 - mf *t; here mf = dm/dt is the mass flow rate and M0 is the wet mass of the rocket.

F is both a function of time and position. F(h,t) = Isp(vac) * g* mf -- A*p(h). Isp(vac) is the vacuum Isp of your engine (in s), A the area of the nozzle and p(h) the ambient pressure.

g is a function of position: g = g0 / (h / R)2 as you wrote it.

 

A can be found using the equation for thrust: A = Isp(vac) * g0 * mf * (1 - Fasl/Fvac) / p0.
Fasl and Fvac are the thrusts of your engine at sea level and in vacuum, and p0 is the pressure at sea level.

p is annoying because it is a function of temperature and height. Since we have neither temperature nor pressure numerical data, you need to either: bring a barometer on your rocket and measure, assume constant temperature, or solve stupid integrals.
P=P_{0}e^{{-\int _{{0}}^{{z}}{Mgdz/R^{*}T}}}\, is the formula you need for this (replace z with h). If everything is constant (temp, molar mass of the atmosphere and g) this simplifies to p = p0 * exp(-Mgh / RT). Note that here M is the molar mass of the atmosphere and not the mass of the rocket.

 

This is the easy part. To precalculate the throttle needed to keep a constant TWR in a specific profile, you'd have to know your trajectory exactly and express the TWR function as a function of time only: you need to express position (height is enough) as a function of time, hence you need to know your trajectory, then you'll get h(t). Now replace h by h(t) in the equations above and you'll get your TWR.

Once you have your TWR, know that the throttle changes the mass flow rate dm/dt (Throttle is proportional to d2m/dt2), so that: mf = dm/dt = Throttle * mfmax (throttle is between 0 and 1), and change your throttle function so that your TWR stays constant.

It's not mathematically complicated, just tedious. Make a spreadsheet calculating the different values (one at a time) and combine them to get TWR.

 

If you want acceleration, then you'll have to consider not only height but 2d movement, heading of the craft, of the thrust and of the trajectory, and drag. Good luck on that.

Link to comment
Share on other sites

6 hours ago, Matuchkin said:

Two most important equations for beginners- the Vis-Viva equation and the Tsiolkovsky equation. Start from there.

I'm sorry but how does the Vis-viva equation relate to a launching rocket? Isn't that equation more appropriate for a spaceship already in orbit?

As for the rocket equation as we see it here often, that is related to dv more than rate of change of mass. Isp however does relate to rate of change of mass since it relates to the exhaust gas velocity.

Link to comment
Share on other sites

8 hours ago, Gaarst said:

[entire post but in particular]

F is both a function of time and position. F(h,t) = Isp(vac) * g* mf -- A*p(h). Isp(vac)

Thank you for your input. Would it be reasonable to assume that before one can get down to business with TWR, one should have a mathematical model of the trajectory?

A proper gravity turn is of course going to play a huge part in this and here is where the entire rocket design comes in. How quickly will it rotate at a given speed at a given altitude with a given TWR when the initial rotation was a given angle? This links the TWR and fuel flow directly to the trajectory. I don't think rocket scientists are overpaid :D

 

Edit: The bit about A being the area of the nozzle, that part has me wondering. Isn't the area of a nozzle on a given engine fixed or is this nozzle a mathematical nozzle different from the physical part of the engine? Or is this the actual physical part but with an equation to figure out the area which I will need in the calculations, seeing KSP doesn't mention A anywhere but for a real rocket scientist, every detail of that engine would be on a technical paper?

You model F here as a function of h and t but the expression on the right hand side involves mf which itself is depending on F which is what we try to solve for. How does one go about this?

 

EDIT 2: Another thing that has me wondering. On a multi stage rocket, the first stage starts with velocity being zero. The next stages do not. The dv doesn't change (I think) but the increase in kinetic energy would depend on that initial velocity and how would that affect the launch profile? (or am I running around in the wrong field here?)

Edited by LN400
Adding
Link to comment
Share on other sites

9 hours ago, LN400 said:

Thank you for your input. Would it be reasonable to assume that before one can get down to business with TWR, one should have a mathematical model of the trajectory?

Since you have functions of both time and position, you need to find a way to relate the two. The easiest would be to calculate h(t) which is just an integration of your vertical velocity during the launch. So you do need to know your trajectory to some extent.

Quote

A proper gravity turn is of course going to play a huge part in this and here is where the entire rocket design comes in. How quickly will it rotate at a given speed at a given altitude with a given TWR when the initial rotation was a given angle? This links the TWR and fuel flow directly to the trajectory. I don't think rocket scientists are overpaid :D

To get the rotation speed is hard and annoying.

You first need to work out the torque created by your engines gimbal. T = rxF (vector form) or T = r*F*sin(G); here T is the torque, r is the distance from your engine to the centre of rotation of the rocket and G is the gimballed thrust angle.
To get the exact position of the centre of rotation, you would need to do stuff with your aerodynamic centre and CoM (which calculations I don't know). Note that this assumes a single engine inline with the centre of mass.

Once you have the torque created by the engine, you need to calculate the torque created by the drag by integrating the drag at each point of your rocket over its entire length. This will depend on your speed, the air pressure around you, the angle of your rocket relative to airflow.

This is for gimballed rotation. For gravity turn you would need to again integrate stuff; this time gravitational pull and drag over the length of your rocket (knowing where the CoM of your rocket is to obtain a torque), add this to the thrust of your rocket to obtain a resultant torque and thrust. Finally you would need to integrate this thrust and torque with respect to your trajectory (time or position) and you will get your gravity turn.

Quote

Edit: The bit about A being the area of the nozzle, that part has me wondering. Isn't the area of a nozzle on a given engine fixed or is this nozzle a mathematical nozzle different from the physical part of the engine? Or is this the actual physical part but with an equation to figure out the area which I will need in the calculations, seeing KSP doesn't mention A anywhere but for a real rocket scientist, every detail of that engine would be on a technical paper?

That would be an ideal area. In real rocketry, the nozzle has a given expansion. If the engine is optimised for atmospheric use then the exhaust will be over-expanded in lower pressures; and if it is optimised for vacuum use then the exhaust will be under-expanded in higher pressures. In both cases you will lose efficiency.

Now KSP's engines properties are completely independent of its architecture (note how the Poodle, a vacuum engine, has a ridiculously small nozzle), so the actual area you can measure in game and the one you'll get by calculations will be different.

Thing is KSP's model is simplified, and as Isp curve with pressure is programmed into the part itself, using the "ideal" area you can calculate using the asl and vacuum Isps (or thrust) should give you accurate results.

Quote

You model F here as a function of h and t but the expression on the right hand side involves mf which itself is depending on F which is what we try to solve for. How does one go about this?

 I expressed mf as a function of throttle after I wrote down the equation for F, so I kinda forgot to include it. F is a function of h, t and mf (or throttle).

Of course, you can reverse mf and F the equation and express mf as a function of h, t and F.

Just remember that F is dependent on external conditions (h and t) while mf is only dependent on throttle that you directly control.

Quote

EDIT 2: Another thing that has me wondering. On a multi stage rocket, the first stage starts with velocity being zero. The next stages do not. The dv doesn't change (I think) but the increase in kinetic energy would depend on that initial velocity and how would that affect the launch profile? (or am I running around in the wrong field here?)

That's the Oberth effect. This doesn't change the dV of your stage but how efficiently this dV can be used. So in the end it does influence your trajectory.

The Oberth effect depends on your velocity relative to the gravitational speed you are in.

Link to comment
Share on other sites

I have dotted down a few more equations but had to fiddle a bit with scale height and got to roughly 5400.

For fixed thrust as a function of height ASL I have:

Fvac - FASL = FVA

F(h) = Fvac - FVA e-h / 5400

For variable thrust, then the total thrust is

F(h) = T *(Fvac - FVA e-h / 5400) [1]

where T is a function value ranging from 0 to 1 and is represents the throttle.

 

For Isp

Isp vac - Isp ASL = Isp VA

Isp(h) = Isp vac - Isp VA e-h / 5400 [2]

 

d/dt mfuel(t, T) = T * Fvac / (Isp vac* g0) [3]

 

... I think....

 

From [3] it seems to me that over a very short time period dt, the mass loss

d mfuel(t, T) = T * Fvac / (Isp vac* g0) dt

and the fuel mass

mfuel (t, T) =  m0 - integral [T * Fvac / (Isp vac* g0)] dt from t = 0 to burnout time t[4]

Since both F and Isp in [4] are constants, then the equation can be rewritten to

mfuel (t, T) =  m0 - Fvac / (Isp vac* g0) * integral [T] dt from t = 0 to burnout time t[5]

 

If TWR = R is constant then d/dt R = 0

 

/end of brainwork for now, back to it when I regain my senses.

 

 

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