Rocket Simulation

Hello, I did this a while ago but is this correct lol?

https://fullnitrous.com/posts/YtPm3jR8HvNhvg4kQoKQ/

I will make a webassembly version of this program available soon :tm:. Also as a library so you can use it for experiments ect.

2 Likes

For the physics, the function of mass will always have time as a dependence in a rocket.

I can see why disregarding this is a good idea since the math really goes downhill and would be way over my head with additional dependence.
What this enables you to do though is define the value of the thrust by the velocity of the ejected mass.

Furthermore, I made the assumption that the rocket is already in space and the drag of air can be disregarded.

What I am also confused about is why you have a derivation of m in the equations of motion… i assume that in your aproach the mass is constant and therefore the derivation would be 0.

If i stick to this, the solutions for the linear equations of motion look correct if the derivation of m is 0. The only force that moves the rocket on the x axis is the thrust vector of the engine. Same goes for z axis.
On the y axis you have gravity as an additional force which also makes sense.

No, mass can vary. Hence the m dot terms. I consider it a function of time, not constant.

Well then your first equation where you solve for the mass via 3 integrals is missing its correlation to time since there is no t in it.

For example if you multiply the term 2/(2-t) to your density where t ranges from 0 to 1 (<-maximum burn duration) you get a chaning mass over time where the fuel makes up 50% of the rockets mass.
Also 1/(1-t) with t from 0 to 1/2 works, whatever you prefer.

Ps: I kinda struggle with maths and the correct terminology in english, if something is not clear feel free to ask.

Right, but that doesn’t change anything in the simulation. Assuming the density function can just vary and the mass is calculated for every discrete simulation step then mass being a function of time in the later equations of motions should be enough right?

Basically just because it isn’t stated doesn’t mean it wouldn’t work if the mass would change over time because it’s accounted for in the EOM.

Or am I wrong?

It depends how far you want to go.
If you want to adress the change of mass over time by adjusting the density function, the only thing that i can think of that will change is the relationship of mass to thrust. So the longer the rocket flies, the better its thrust to weight ratio will get. -> Acceleration will increase over time.
The neat thing about changing the mass over time is that you can directly calculate how much thrust the rocket has if you introduce a variable for the velocity of the expelled combustion products v.

Equation for Thrust F
F = m dot * v

You can further go into detail about the thrust if you also include the pressure difference between the exhaust pressure at the end of the nozzle, the area of the end of the nozzle and the ambient pressure.

Check out this NASA link for the thrust equation.

Now for “the next step”, you can also simulate the changing handling characteristics of the rocket that occur by the loss of fuel.
If you think of the hull of the rocket as a empty cylinder with a cone on top and the fuel as a full cylinder filling the hull, your center of gravity will be changing over time (going slightly up since more % of the mass will be on top because of the increased relevance of the cone as the overall mass decreases), as well as changing your moment of inertia.
Because of this…

… as you would have a centre of gravity and a moment of inertia depending on time, which propably will be rather difficult to solve and implement since this effects basically all your equations, atleast its

Anyway, I wanted to say that your simulation looks very good so far and I dont want that you feel that I am just bashing your project. I just wanted to give some additional input if you want to take it “the next step” in terms of “realism”, maybe this wasnt my place/and or right to do so.