# Simulating a water rocket motion using a computer programme

1. Feb 4, 2014

### rocketstudent

1. The problem statement, all variables and given/known data
I am trying to model a water rockets motion using a computer programme in order to compare it to my experimental data. I am studying physics at degree level but I have no knowledge of programming and am finding this particularly difficult. I have thought about using mathematica to solve a set of differential equations that could predict a force time graph for my rocket, however I do not know how to use this and I am finding it difficult to find the right set of equations.

The simulation needs to be able to predict a force time graph for a given set of variables such as volume of fuel, pressure inside the rocket etc.

I need to know what is the best way of going about this as I am not sure if mathematica is the best programme to use. If there is a solution I will also most likely need help in writing this.

Would anyone be able to assist me with this as is it of high priority for me!

Also this is my first post so if I have missed anything out please comment so I can explain!

Thank you

2. Feb 4, 2014

### .Scott

Let's see if I can give you direction without giving you answers.

Would it be acceptable for your model to step through time changing the a description of the state of the rocket as it proceeded? If so, please start by listing (and posting to this thread) the time-dependent variables that would describe the state of the water rocket.

3. Feb 4, 2014

### rocketstudent

I'm not quite sure what you're asking, if you are asking for a qualitative description I can give you that, and the variables it depends on, but the model has to be able to predict the force-time graph

4. Feb 4, 2014

### .Scott

There are different forms of mathematical models. The simplest (involving a minimum of calculus) is simply to step through time.

But no matter what form of model you are using, you're going to need a list of the parameters that will be modeled.
To get you started, here is an example of a time-dependent variable:
* The mass of water contained in rocket, expressed in grams.

Now come up with at least four more parameters that will describe this rocket during its flight. I say "at least four", but there are probably going to be six or seven.

5. Feb 4, 2014

### .Scott

As I read through your posts more carefully, it looks at though this is a "captured" rocket that has been tied down. So we aren't going to need to keep track of the rockets overall velocity and acceleration. Is that right?

On the other hand, how is the "pressure inside the rocket" determined? Is it a constant?

6. Feb 4, 2014

### rocketstudent

OK of course.
Constants in the experiment are:
The rocket is a 1.5 litre PET bottle.
The pressure inside the rocket is pumped up to 40 PSI

Variables:
Mass of the water (fuel) - [kg]
Force of the rocket - [N] (rocket is measured by a force sensor directed slightly above the rocket)
Pressure within the rocket during time of flight - [PSI]
Velocity of rocket - [m/s]
Volume of water during each launch - [ml]

Assumptions:
The rocket launches directly upwards. Motion is in the vertical direction only.
The mass loss rate of the rockets fuel (water) is constant.
Air resistance is negligible.

Of course some of these assumptions are not practical but I want to start at the basic level, then introduce the assumed things as variables once I build upon this model.

The way I am testing the rocket at the moment is launching it into a force sensor which is above the rocket, this measures the force so I can produce experimental graphs of force vs time. The launch mechanism for the rocket is a release valve attached to a pump that only releases the water at 40psi. So the pressure inside the rocket initially is going to be the same throughout the experiment. The acceleration could be determined experimentally from a force vs time graph I believe, then from this also the velocity.

My aim is to compare my experimental data with my model and show that it fits, and explain any discrepancies.

7. Feb 4, 2014

### .Scott

The critical formulas will be:
* the rate at which water is ejected given a certain pressure
* the water pressure as a function of the volume of water

I don't know what you're favorite programming language is, but assuming you stick to simply stepping through time, your basic model is going to look something like this:
Code (Text):

dTimeStep  = 0.1;   // seconds
dWaterMass = 1.65;   // Kgrams
dPressure  = 40.0;   // psi
dVelocity  = 0.0;   // m/s
for(dTime=0.0; dTime<30.0; dTime+=dTimeStep) {
{ ... output current rocket state ... }
dRate = ...;   // Kgrams/second
dWaterLoss = dRate*dTimeStep;   // Kgrams
...
dWaterMass -= dWaterLoss;
...
}

Get the picture?

8. Feb 4, 2014

### rocketstudent

Ok thanks for your help. Unfortunately I haven't got a clue what that means as I don't have programming experience! I am not quite sure how to tackle it.

9. Feb 4, 2014

### .Scott

* the rate at which water is ejected given a certain pressure
* the water pressure as a function of the volume of water

Do you have any ideas as to what those formulas should be?

10. Feb 4, 2014

### .Scott

What potential model programming tools do you have experience with?
Mathematica? Excel? Any programming language?

11. Feb 4, 2014

### rocketstudent

Excel I have experience with. I have been advised that I could use Mathematica although I do not have experience with this.

12. Feb 4, 2014

### .Scott

OK, let's stick with Excel.
Set up column A1 through B2 as follows:
"Time Step (seconds)", 0.1
"Bottle Mass (Kg)", 0.02

We will keep rows 3 to 6 for other global parameters we may need later.

Set up A8 to I8: "Time", "Water Mass", "Total Mass", "Pressure", "Eject Rate", "Eject Mass", "Velocity", "Force","Acceleration"

Set up A9 to G9 with initial conditions: 0.0, 1.70, A9+$B$2, 200*(B9-1.5), 0.4*D9, $A$2*E9, 0.0, ...
You do H9 and I9 (force and acceleration)

Copy row 9 to row 10.
Set A10 to: A9+$A$2
Set B10 to: B9-F9
Set G10 to: G9+($A$2*I9)
Copy row 10 to 11, 12, 13, ...

13. Feb 4, 2014

### rocketstudent

Ok thank you I have laid it out as you have said, couple of questions -
what is the bottle mass, 0.02 step for?
Water mass 1.7 - is this an arbitrary value that I can input or is it 1.7 for a reason?
Why is the multiplier for eject rate 0.4?

Also Acceleration values most likely will not be able to measure directly however this isn't too much of a problem.

This is a good start I appreciate it a lot. How would I then go on to predict a force time graph without having to input values for the force?

14. Feb 4, 2014

### .Scott

The bottle itself will have mass - which will affect the total mass - which will, in turn, affect the acceleration.
The mass of the water will be something over 1.5 (the capacity of the bottle) - otherwise there will be no pressure.
So you pressure formula will be based on (water mass - 1.5). Select your initial value for water mass so that your formula (whatever that will be) gives you 40psi.

I have no idea what the formula for the ejection rate is. You'll have to come up with that yourself. I made it proportional to pressure. Whatever it is, you should check for a negative value and use 0.0 if need be (MAX(...)).

Once you pick you psi formula and your ejection rate formula, columns A and H will give you your predicted time/force graph.

15. Feb 4, 2014

### .Scott

If you know the ejection rate and the aperture size (diameter of bottle opening), then you should be able to compute the velocity of the ejected water and from that the force being generated.

16. Feb 5, 2014

### Bill Simpson

I don't want to distract you from trying to understand the numerical approximation method.

It might help you understand parts of this if you develop at the same time the differential equations that this is based on.

There are a couple of differential equations that you might think of how to write down. The first would be m'(t), the derivative of the mass. That should be simple for you to write down and even to solve in your head. The second would be y''(t), the second derivative of the altitude, which is also the acceleration. That is perhaps a little trickier to write down, but if you think very carefully about all the components of your system you might be able to write that down.

All these equations are only during the time from launch until the tank is empty, before and after that different equations will be involved.

With those equations you might be able to solve this directly. And you might be able to compare these with the approximation you are trying to understand. Both those might help you verify what you are doing.

17. Feb 6, 2014

### RTW69

There is a lot of information related to this problem on the net just Google "Water Rocket Differential equations". This is a very common undergraduate engineering lab

18. Feb 6, 2014

### rocketstudent

Thank you Bill. I have been told that the differential equations involved cannot be solved analytically and hence why I have to model it. I do have some equation s to do with the mass loss rate and the acceleration however there are too many variables to solve it.

RTW9
I will search tha term and see what I can find thank you.

19. Feb 6, 2014

### .Scott

RocketStudent: Have you gotten the Excel to work? If not, what's the problem?

20. Feb 6, 2014

### rocketstudent

I have got what you have told me down on the spreadsheet, now I am trying to find out formula for the ejection rate of the water, and also the velocity of the rocket, in order to gain a velocity time graph and then a force time graph.