# Final velocity of a rocket launching to space

1. Sep 29, 2014

### ellipsis

Background
This is for a video game, "Kerbal Space Program"... I'm sure some of you here have heard of it. It's the type of game you guys would be interested in.

I have built a program to design rockets, but I'm not sure what the optimal thrust-to-weight ratio is. That is, how much fuel I should tack on before the cost of getting it into space exceeds the benefit of having more fuel. I've already figured out how to analytically find the optimal TWR given an environment of constant -9.81 m/s^2 gravity, but... gravity changes via the inverse square law.

Question
I need to solve the following differential equation for $\frac{dx}{dt}$. I can solve either one of the two RHS components separately, but not both of them at once.
$$\frac{d^2x}{dt^2} = \frac{-S}{x^2}+\frac{F_T}{m_i-\dot{m}t}$$

S, F_T, m_i, and m_dot are constants relating to the specifications of the rocket. All of them are positive.

2. Sep 29, 2014

### dawin

Is there a reason you can't make assumptions for the one of the terms on the right hand side? For one, it wouldn't be unreasonable to assume $F_T$ is a function of $\dot{m}$. But not sure if how you laid it out is just how you wanted to approach the problem.

3. Sep 30, 2014

### ellipsis

That sounds like a reasonable assumption, but I don't know how I would formalize that. I know that this DE is unsolvable in terms of x. But I only want an equation for the velocity at a given point... the derivative of x, really. When I try to get MATLAB to symbolically solve it, it tries to completely solve it and fails. Is there a way to convince MATLAB to only partially solve it?

4. Oct 1, 2014

### dawin

Well it looks like you have just the force balance there. Have you considered looking at conservation of momentum too?

You have an $\dot{m}$ term in there... if the "rocket" starts out with mass m, and loses a bit of propellant going in the opposite direction (staying consistent with your model's 1-Dness) then the momentum of that system is:
$$(m-dm)(v+dv) + dm(v-v_p) = mv + mdv - vdm - dmdv + vdm - v_pdm \\ = mv + mdv - v_pdm$$
where $v_p$ is just the velocity of the propellant (you can define this with blanket rocket parameters I would think, big hole low velocity, little hole higher velocity). So the change in momentum is:
$$dp = mdv - v_pdm$$
Using your force balance equation, you know the total forces on the system are just:
$$\sum{F} = -S/x^2 + F_T$$
The change in momentum can be equated to the impulse imparted by these two forces:
$$Fdt = (\frac{-S}{x^2} + F_T)dt = mdv - v_pdm; dm = \dot{m}dt \\(\frac{-S}{x^2} + F_T + v_p\dot{m})dt = mdv \\\frac{\frac{-S}{x^2} + F_T + v_p\dot{m}}{m}dt = dv$$
Doesn't seem crazy to define $F_T, \dot{m}, v_p$ (assuming you have knowledge of propellant & nozzle parameters in your model). This help at all? Not sure if it's right but eh...

edit: seriously struggling with [tex], don't mind me.

Last edited: Oct 1, 2014
5. Oct 2, 2014

### ellipsis

Dawin, thanks for the reply. I learned how to apply momentum and kinetic/potential energy in lower-division physics, but that was never my first vector of attack because it always involves so many variables and terms. I suspect the problem of final velocity (when the fuel runs out) is solvable by kinetic/potential analysis if you neglect drag (on the moon, for example).

I've mostly resigned myself to a numerical solution now, since I've discovered the in-game model is even _more_ complex than I thought. The fuel flow rate (m_dot) decreases linearly with respect to atmospheric pressure (i.e. height). This means as the rocket gets higher, it will expend less fuel per second.

I've got a working one, but I'm not sure how to efficiently find the optimal solution. That is, all of my rocket parameters are constant /except/ for the thrust-to-weight ratio. To find the thrust-to-weight ratio that ends up giving me the highest delta-v, must I just continually run ode45? I'm doing it in MATLAB at the moment. Oh yeah, I didn't even include drag in the above equation. It varies with respect to height as well.

I'm mathematically emulating the physics engine so I can shoot off a thousands rockets a second and see which one is best. My subgoal right now is to predict the outcomes of launches really well in advance, using a numerical solution to this DE.

If I want to make it 2d, I'll have to read up on vector calculus and rocket ascent profiles. The question "How much fuel will this craft have after it reaches a 100km orbit" is both alluring and practical.

6. Oct 2, 2014

### dawin

I've never played the game, so I can't really speak to how it works out. Where did you see the physics engine?

Why not identify some parameters and come up with an empirical solution from some mini design of experiments!