1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Simulating a water rocket motion using a computer programme

  1. Feb 4, 2014 #1
    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. jcsd
  3. Feb 4, 2014 #2
    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.
  4. Feb 4, 2014 #3
    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
  5. Feb 4, 2014 #4
    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.
  6. Feb 4, 2014 #5
    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?
  7. Feb 4, 2014 #6
    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

    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]

    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.
  8. Feb 4, 2014 #7
    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?
  9. Feb 4, 2014 #8
    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.
  10. Feb 4, 2014 #9
    Let's start with those critical formulas:
    * 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?
  11. Feb 4, 2014 #10
    What potential model programming tools do you have experience with?
    Mathematica? Excel? Any programming language?
  12. Feb 4, 2014 #11
    Excel I have experience with. I have been advised that I could use Mathematica although I do not have experience with this.
  13. Feb 4, 2014 #12
    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, ...
  14. Feb 4, 2014 #13
    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?
  15. Feb 4, 2014 #14
    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.
  16. Feb 4, 2014 #15
    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.
  17. Feb 5, 2014 #16
    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.
  18. Feb 6, 2014 #17
    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
  19. Feb 6, 2014 #18
    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.

    I will search tha term and see what I can find thank you.
  20. Feb 6, 2014 #19
    RocketStudent: Have you gotten the Excel to work? If not, what's the problem?
  21. Feb 6, 2014 #20
    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.
  22. Feb 6, 2014 #21
    What are you using for a delta time in Excel? To get the Excel code working, I suggested 0.1 seconds. But now that you're looking for more precise results, you may want to set it lower - perhaps 0.025 or 0.010.
  23. Feb 6, 2014 #22


    Staff: Mentor

    You consider using MATLAB to solve your problem. Its a common tool used in engineering schools. A simple alternative would be freemat which has many of the core features of MATLAB.

    A fancier tool would be open source physics at www.compadre.org/osp which is a collection of java classes for numerically Integrating differential equations. It would require you to learn some java and the eclipse ide.

    One last alternative would be the processing.org ide also java based but very easy to learn and use. You have to implement the differential equation algorithm yourself or find an example that does something similar.
  24. Feb 6, 2014 #23
    We ran through several possibilities, including Mathematica, a couple of days ago. He had experience with Excel - and basically nothing else. So I recommended Excel for him.
    I don't how much time he has for this. He seems to be making progress.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted