In the previous exercise you used
the 'brute force' method to obtain enough (time,velocity) coordinate
pairs for a suitable plot of the velocity curve. Thus each time
you executed the program you obtained a single coordinate pair.
Furthermore you had to painstakingly plot the velocity curve by
hand, count squares in order to evaluate the cumulative area required
for the height plot, and plot the height curve by hand. This was
a time consuming task however you probably derived a great feeling
of satisfaction in completing it.

In this exercise you will extend your program in two ways. The
function **find_velo** is only
valid for the first phase of the flight from launch until the
"Brennschluss"(burnout) condition of the booster rockets.
For elapsed times greater than Brennschluss we will extend the
function to follow the booster shells which separate from the
Shuttle Vehicle. After separation, gravity forces reduce the velocity
of the booster shells, and they ultimately fall into the sea for
subsequent recovery (splashdown). The equations follow:

Let

where tb is the time to "Brennschluss" of the booster rockets (s) Mfb is the initial total amount of fuel in the booster rockets (kg) qb is the ejection rate of the exhausting fuel in the booster rockets (kg/s)

thus if the elapsed time t is less than tb, the velocity equation applies as in the previous exercise:

where V is the upward velocity (m/s) t is the elapsed time (s). qb is the ejection rate of the exhausting fuel in the booster (kg/s) Mt is the total initial mass of the Space Shuttle Vehicle (including the solid booster fuel) (kg) qo is the ejection rate of the exhausting fuel in the orbiter (kg/s) gm is the effective mean value of gravitational acceleration (m/s/s)log( ) is the natural logarithm function - in the C language it is available in the math library.

However if t is greater than tb, then the velocity equation
becomes:

where Vc is the so-called 'Characteristic Velocity' of the Shuttle
Vehicle at "Brennschluss" (burnout), given by:

With this new set of velocity equations the velocity plot becomes
typically as is shown below. Note that we have arbitrarily chosen
an elapsed time of 380 seconds to illustrate the effect of elapsed
time t >tb. When the velocity becomes zero then the booster
shell has reached its maximum height and starts falling downwards.

After obtaining the velocity curve as shown above, we can now
consider extending the program to evaluate the height attained
by the booster rockets, until splashdown. The height is obtained
by numerically evaluating the area under the upward velocity curve,
using the 'Trapezoidal' method, which you will develop in Lab 5. Note that in Lab 5
we developed the method by integrating the sine function as follows:

In this exercise we wish to integrate the above upward velocity
function in order to evaluate the height reached by the booster
rockets as follows:

Notice the similarity. Once you have mastered the method in Lab
5 you will be able to easily transpose the code to the current
exercise.

There are three parts to this exercise, evaluating a sequence of n upward velocity values of the shuttle from liftoff until a specified elapsed time, using the trapezoidal method to evaluate the cumulative height at each of these points, and modifying the "find_velo" function to follow the booster rockets after "Brennschluss" (burnout). One approach to developing this program is to first copy your "shuttle.cpp" program to a new file "shutloop.cpp", and then modify "shutloop.cpp" using the vi editor as follows:

cp shuttle.cpp shutloop.cppvi shutloop.cpp

The first modification should be within the function **find_velo** to account for "Brennschluss"
(burnout). Once this mod is done it is a
good idea to compile, debug, and test the program over a range
of values of elapsed time before continuing.

Subsequently in the main function introduce a *while* loop
to evaluate upward velocity over a sequence of values, and finally
when this mod has been debugged and tested, do the final mod in
the while loop to evaluate the height over the range of values
using the trapezoidal method. Use the number of points entered
from the keyboard (minus one) to determine the number of intervals
of the Trapezoidal Method.

A typical program execution output follows:

Evaluate upward velocity as function of elapsed time for 20,000kg payload, initial total mass is 2,034,681[kg] enter your initial total mass of shuttle [kg]: |

Notice the various items of data entry to this program are
written in *Italics* script.
In order to enable this program to be graded automatically, this
sequence of data entry should be strictly adhered to.

The source code file **shutloop.cpp**
should be in your home directory by 10:00 a.m. of the due date.