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 theprevious 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/m

^{}3]

= delt (time increment) [seconds]

V = vol (current volume of air in the bottle) [m^{}3]

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] |