Physics 222/322 Assignment 11

Due May 2

Directions

Please turn in this assignment by emailing them to me . Please use the subject of "Physics 222 HW11" for this assignment (if you use the link above, the subject will be added automatically). Please attach the source code to any programs that you write for this assignment. If you write more than one program, attach each separately. When answering the questions themselves feel free to answer directly in the body of your message (or attach your answers).

  1. Terminal Velocity

    Write an object oriented program to look at terminal velocity. The physics here is much like the rocket problem, except that there is no changing mass or thrust.

    The drag force has the form:
    FD = -0.5 Cd ρ Av2
    and
    vt = (2mg/(ρ ACd))0.5
    where vt, m is the mass of the object, g = 9.8 m/s2, A is the cross-sectional area of the object, drag coefficient Cd, and the density of the fluid ρ.

    Your program will read input files that have the name of the object, time step size, the mass of the object in kg, the cross-sectional area in m2, the drag coefficient, the density of the fluid in kg/m3, the initial height of the object, and the initial velocity of the object. Your program should run till the object hits the ground.

    Your program should have a projectile object. It should have private data: a string for the name and time step, current time, time, position, velocity, mass, cross-sectional area, drag coefficient, fluid density, terminal velocity which are all doubles. Time, position, and velocity should all be arrays that hold data for throughout the run

    It should have private methods: calculate velocity (which calculates velocity at the current time), calculate position (which calculate the position at the current time), and calculate terminal velocity.

    It should have public methods: set_input_file (which reads file and initializes object), update (calls calculate methods), output (which sends data to file), plot velocity (which plots the velocity as a function of time).

    The first input file is ping_pong_ball.txt.