Consider again the adiabatic
expansion of the compressed air occuring while the water is
being expelled, as shown in the diagram below. This is known as
the thrust phase, and will last until all the water is
expelled (i.e. the volume of the air is equal to the total volume).
In this exercise we would like to determine the duration of
thrust, after which the rocket behaves as a simple projectile
under the influence of frictional drag and gravity forces.

At the conclusion of the previous analysis we developed the differential equation for the volume variation of the compressed air as a function of time t, as follows:
We noted that this equation cannot be solved explicity since the volume V is deeply embedded in a nonlinear manner in the equation, hence following Nielsen we decided to resort to a numerical solution.
where:
t is the elapsed time [s], thus V(t) refers to the volume at elapsed time t
is the time step increment
and P is obtained from equation 5 of the previous analysis, assuming that V remains constant over the interval:
In this exercise we will use this equation
to evaluate the duration of thrust tdur by determining the time required for the volume V to become equal
to (or greater than) the total volume Vtotal. This will be done by "time stepping" time
t
through small increments
( = tmax/1000 ?).
In Chapter 5 of our text we cover Looping,
and we will use the conditional while loop in this exercise.
In order to evaluate the duration of thrust we add a float method
findtime to the Rocket class, which uses a while loop to do a time
stepping evaluation of the volume V. Note that the condition required
in order to stay in the loop is: (vol
< vtotal). As soon as that condition
becomes false then the loop is exited, and the duration of time
is returned to main. The flow diagram for the new method findtime
is shown below:

The structure diagram of the complete program
rockvol.cpp including the new method findtime is shown below.
Note that program variables are usually different from the cryptic
math format that usually includes greek letters and (heavens forbid)
upper case single letters. Notice (for example) that we have made
the following equivalent variable names in the structure diagram,
which will continue into the actual program source code:
= water (density of water) [kg/m3]
= delt (time increment) [seconds]
V = vol (current volume of air in the bottle) [m3]
P = pres (current pressure of the air in the bottle) [Pa]

A typical execution is shown below, with the input data shown in italics. Please be sure to enter your data in the same order as this solution shown below (which is available to test in the programs directory of condor) since the exercises are checked automatically using a data file for input. Your source code solution named rockvol.cpp should be in your home directory before 10:00 am of the due date.
Values to define a new water rocket [Nielsen values]: enter rocket + payload solid mass in grams [120] 43 value entered is 43grams enter total volume in cc [1250] 591 value entered is 591 cc enter diameter of nozzle in cm [0.9] 0.4 value entered is 0.4cm enter fill ratio (water/total volume) [0.35] 0.3 value entered is 0.3 enter charge gage pressure in atm [5] 4 value entered is 4atm enter drag coefficient Cd [0.3] 0.3 value entered is 0.3 enter outside diameter of bottle in cm [11.3] 8 value entered is 8cm Water rocket initialized as follows: Solid mass[gm]: 43, total volume[liters]: 0.591 absolute charge pressure[kPa]: 500 initial air charge volume[liters]: 0.4137 Nozzle free flow area [sq.cm]: 0.125664 Bottle cross sect. area [sq.cm]: 50.2655 Density - water: 1000kg/m^3, outside air: 1.2kg/m^3 Ratio of specific heat capacities for air (k): 1.4 Drag coefficient: 0.3 gravity acceleration: 9.807m/s^2 enter the max time to test (sec) 1 value entered is 1(s) duration of thrust is 0.596996(s) |