### The water rocket: Numerical calculations

So now we're ready to put all the calculations together: launch tube, water thrust, air thrust, and ballistic flight. The launch tube calculation is more like an initialization for the water thrust phase; we just have one time step of the duration of launch tube traversal. Get the initial pressure $$P_0$$ for water thrust from (L1), and the velocity $$v_0$$ from (L4), and use these values in the first water thrust time step. You may also want to initialize the altitude achieved as the height of the tube.

### Water thrust calculation

For the water thrust phase, we do the following calculations at each time interval, which should be 1 millisecond or less in duration:

• At the beginning of time interval $$i$$:
1. Get the pressure $$P_1$$ from (W4), using the change in water volume from the previous time interval.
2. From the water volume, calculate the height of the water in the bottle — needed for $$H$$ in equation (W1). This can be approximated by calculating the height of the water in a cylinder having the average diameter of the bottle, or you can get more complicated and use an approximation of the actual bottle geometry, such as a cylinder on top of a cone.
3. Get the total mass $$m_i$$ of the rocket (water, ballast, bottle weight, etc.), which changes at each new time interval until the water is gone. Note that the final time interval needed to reach zero water volume may be less than the time increment you have chosen for these calculations. You want to be careful with this, lest you end up with a negative volume and too much contribution from water thrust in that final time interval.
4. Calcucate the water nozzle velocity $$v_i$$ from equation (W1).
5. From the water velocity, calculate the volume flow rate, which is simply the velocity multiplied by the bottle nozzle area.
6. From the volume flow rate, multiply by the density of water to get the mass flow rate per equation (W2).
7. Calculate the net force $$F_i$$ on the rocket. This is the force from the water thrust in equation (W3) minus the force of gravity $$m_i g$$ minus the air resistance calculated from (B2) in the previous time interval. Remember, drag direction (upward or downward) depends on the sign of the rocket's velocity.
8. Calculate the acceleration, $$a_i = F_i / m_i$$, the net force divided by the mass of the rocket. Like force, acceleration will be positive (upward) or negative (downward) depending on its direction.
• At the end of time interval $$i$$:
1. Calculate the new velocity $$v_i = v_{i-1} + a_i t_i$$, which is the acceleration multiplied by the time interval, added to the previous velocity.
2. Calculate the new altitude $$d_i = v_{i-1} t_i + \frac{1}{2}a_i t_i^2$$.
3. Calculate the drag from (B1).
4. Get the remaining water at the end of the time interval, for the next iteration, which is the previous volume minus the volume flowed during the time interval.

### Air thrust calculation

Begin the air thrust phase with the pressure $$P_e$$ from (W5), and initial mass of air $$m_{a0}$$ available for thrust, from (A4). The first time step of air thrust will use this pressure to calculate the mass flow rate from (A6).

The "empty" (water-free) bottle pressure $$P_e$$ will be recalculated from (A12) at the beginning of each subsequent time interval so that the new mass of air $$m$$ can be recalculated for each time interval.

For subsequent time steps, we do the following calculations. The time interval should be 1 millisecond or less in duration.

• At the beginning of time interval $$i$$:
1. Get the air density $$\rho_{a~i}$$ from (A11) using the prior step's mass flow rate.
2. From this density, get the new pressure $$P_{e~i}$$ from (A12) and mass $$m$$ of the air in the bottle from (A10).
3. Get the air temperature from (W6) and from this, calculate the new speed of sound from (A2).
4. Is $$P_a / P_e < \alpha_c$$ where $$\alpha_c = 0.455$$ ?
• If yes, then calculate the choked mass flow rate from (A6).
• If no, then we have normal subsonic unchoked airflow.
1. Using (A8), setting $$p_e = P_a / \alpha_c - P_a$$, solve for $$C_v$$ in (A8).
2. Calculate the air velocity from (A8) using the new value of $$C_v$$.
3. Calculate the un-choked mass flow rate from (A9)
• Get the thrust from subsonic airflow from (A10).
5. Calculate the net force $$F_i$$ on the rocket. This is the force from the air thrust from (A7) or (A10) minus the force of gravity $$m_i g$$ minus the air resistance calculated from (B2) in the previous time interval. We're using the convention that upward force is positive, and downward force is negative. As before, thrust is a positive (upward) force, gravity is always a negative (downward) force, but drag is negative while the rocket is ascending and positive while the rocket is descending, so it depends on the sign of the rocket's velocity.
6. Calculate the acceleration, $$a_i = F_i / m_i$$, the net force divided by the mass of the rocket. Like force, acceleration will be positive (upward) or negative (downward) depending on its direction.
• At the end of time interval $$i$$:
1. Calculate the new velocity $$v_i = v_{i-1} + a_i t_i$$, which is the acceleration multiplied by the time interval, added to the previous velocity.
2. Calculate the new altitude $$d_i = v_{i-1} t_i + \frac{1}{2}a_i t_i^2$$.
3. Calculate the drag force from (B2).
4. Get the remaining air mass at the end of the time interval, for the next iteration, which is the previous mass minus the mass flowed out during the time interval.

### Ballistic flight

At this point we can increase the duration of the time steps by a couple orders of magnitude. If 0.5 millisecond is the time step duration for the thrust calculations, then using 50 milliseconds for ballistic flight is sufficient. The rocket is empty, the water and air pressure are exhausted, nothing is changing rapidly anymore.

• At the beginning of time interval $$i$$:
1. Calculate the net force $$F_i$$ on the rocket from (B3) — just gravity and drag.
2. Calculate the acceleration, $$a_i = F_i / m_i$$, the net force divided by the mass of the rocket.
• At the end of time interval $$i$$:
1. Calculate the new velocity $$v_i = v_{i-1} + a_i t_i$$, which is the acceleration multiplied by the time interval, added to the previous velocity.
2. Calculate the new altitude $$d_i = v_{i-1} t_i + \frac{1}{2}a_i t_i^2$$.
3. Calculate the drag force from (B2).

### Putting it all together

I built a spreadsheet that does all these calculations, available on my water rocketry resource page.