Week 10 ASE 201
Nov 19, 2004_____________________________________________
Due
Topic:
Functions
Programming Assignment:
Consider
a rocket with
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Create a Table of time, height and
velocities a) ignoring gravity and drag, b) including only gravity and c)
including both gravity and drag.
Plot the three values of velocity as a
function of time.
Plot the three values of height as a
function of time.
Your code will contain al least the
following functions. Comments must be
included in your main code and in your functions. Turn in flow charts for the main program and
the functions.
1. Calculate v(t) with only gravity (equation 1.3) You can use this function to calculate v(t)
without gravity by setting g=0.
Functions for when
drag is included:
2. Calculate the initial time step (3.1-3.3)
3. Calculate
(3.4)
4. Calculate ![]()
(3.5)
5. Calculate
(3.6)
6. Calculate
(3.7) Note that this function can call the function
you wrote in part 1.
7. Note that you will be saving h and v in arrays for
plotting. You will have velocity & height
without gravity and drag (v and h); with only gravity (vg and hg) and with both
gravity and drag (vgd and hgd)
You must choose a time step. Run your program three time steps
= 1, .5, .1
Questions: ANSWER IN COMPLETE ENGLISH SENTENCES AD REFER
TO YOUR RESULTS
1. How do the results change as the time
step get smaller? WHY?
2.
Discuss the results without gravity and drag ( v & h), including
only gravity (vg & hg) and with both gravity and drag (vgd & hgd). How do they compare? WHY?
1. Background Material:
A rocket has 4 forces acting on it. The thrust from the burning fuel, T, gravity, g, inertial force, I, and atmospheric drag, D. Thrust acts in the direction of motion and the other three forces act opposite to the direction of motion. In space, there is no gravity and no atmosphere, so the equation for velocity as a function of time is very simple and can be solved by hand, Near the earth, gravity is a constant force, and the velocity equations are still solvable by hand. When a realistic model of drag is included, the equation for velocity becomes nonlinear and is no longer easy to solve by hand. We will develop a computer algorithm for solving this nonlinear equation.
A. Flight in Free Space: In free space, there is no gravity and no
atmosphere. the only forces are the inertial force and the thrust.
If we assume that fuel is burned at a rate of b
units per second then the equation for the velocity as a function of time is
(1.1)
where
is the escape velocity
of the hot gas as it leaves the nozzle of the rocket, b is the
rate at which the fuel is burned and
and
are the mass of the
rocket and the payload, and
is the initial mass of
the fuel. The total time of the burn, tb, is
and the velocity at
the time of burn out, when all of the fuel has been burned), is
(1.2)
In free space, this is the final velocity that the rocket would obtain.
B. Flight near Earth Considering Gravity: Near the earth, we can assume that gravity is a constant, g, which acts throughout the time of flight. During the burn, velocity is given by
(1.3)
where g=9.81 m/s2
or g= 32.2 ft/s2. The time to burnout,tb, is
and the final velocity
at burn out is
(1.4)
These equations can be easily
solved if the rate at which the fuel is burned is known.
C.
Flight Near the Earth Considering Gravity and Drag: Drag is not a constant force. It typically depends on the geometry of the
rocket and the velocity of the rocket. A
reasonable model for the instantaneous drag force is
(1.5)
where CD is a drag
coefficient that depends on the geometry of the rocket and is usually
determined in wind tunnel tests, A is the cross sectional area of the rocket, r is
the density of the atmosphere which depends on the height of the rocket and v
is the velocity of the rocket which depends on time. A reasonable model for density as a function
of height is ![]()
(1.6)
where r0
is the density of the air at the surface of the earth, r0
= 1.204 kg/m3 or .0625 lb/ft3, and a
is a
scaling parameter, a = 7,700 m or 25,000 ft. The velocity at time, t, is
(1.7)
These equations are
nonlinear and cannot be easily solved by hand.
The following is procedure for taking steps in time and calculating the
height, density and velocity at each time step and substituting these values
into equation (1.5) to get an updated value for the velocity. The algorithm can be implemented in a MATLAB
code.
2. Procedure for Integrating Equations:
Assume that
are given. The time of
the burn is
. if a time increment,
, is chosen, then time
from 0 to
can be broken up into
increments and at each time step the height, density and velocity can be
calculated approximately.
Height: Height is the integral of velocity from time
equal to 0 to the current time. This can
be calculated by keeping a running total for the height. The change in height during the current time
step is ![]()
(2.1)
(2.2)
(2.3)
Density: Density can now be updated based on this new
value for height.
(2.4)
Drag: Drag is the integral involving density and
velocity from time =0 to the current time.
This can be calculated by keeping a running total of the drag. The change in total drag during the current
time step is ![]()
(2.5)
(2.6)
(2.7)
Velocity: The velocity at time, t, is a result of the forces
from the thrust, gravity and drag
(2.8)
(2.9)
(2.10)
3.
Computational Procedure: It is common that a time stepping procedure
has two parts, one for the initial time step and the second which is done for
each subsequent step.
Initial step:
will be given. Start
with
and calculate the
first height and velocity
(3.1)
(3.2)
(3.3)
Subsequent Steps: In all future steps, the values
at the new time step will be calculated
and at the end of the calculations, the new values will become the old values
in order to advance to the next step
(3.4)
(3.5)
(3.6)
(3.7)
(3.8)
(3.9)
(3.10)
(3.11)
Repeat equations (3.4) to (3.11) until all of the fuel has
been burned,
.
![]()