Pages

Wednesday, 8 May 2013

Projectile motion in Fortran - just for fun

Projectile motion was interesting for me in grade 11 Physics. Unfortunately at the time we did not have an experimental activity that could prove to me that the calculations work. However, later in grade 12 I used projectile motion calculation to determine the angle for our model rocket to fly the furthest (optimal angle is 45 degrees for furthest displacement). I thought it would be nice to have a Fortran code for the engineers out there involved in designing the parabolic water jets that dance in complicated manners. But I figured a trajectory could be plotted using gnuplot and Fortran. The internet probably has little or no use of this graph but I like its clean and simple look from gnuplot so here goes the graph for an object thrown at 45 degrees with 10 m/s velocity. The x-axis is horizontal distance and y-axis is vertical distance in metres, looks the object did not go that far...


 And the code, of course (credit goes to http://codeformatter.blogspot.ca/ for formatting my code to blog compatible text):

1:  !************************************************  
2:  !This program plots projectile motion of an object.  
3:  !The program requires user input for initial velocity   
4:  !and angle of the object.The algorithm uses a time   
5:  !step of 0.01 second i.e. it calculates object's  
6:  !location in the x and y plane every 0.01 second.  
7:  !**********By: Waleed Ishaque, 2013**************  
8:  program projectile_plot  
9:       implicit none  
10:       !Defining constants:  
11:       real, parameter :: pi = 3.142  
12:       real :: u, a, t  
13:       real, parameter :: g = 9.8  
14:       real:: x(150),y(150)  
15:       !where g is gravity, pi is "pi"  
16:       !u is object's initial velocity  
17:       !a is object's initial angle  
18:       !t is time during the simulation  
19:       !x and y are arrays with 150 rows  
20:       !Seek user input  
21:       write(*,*) 'Enter angle of projectile'  
22:       read*, a  
23:       write(*,*) 'Enter velocity of projectile'  
24:       read*, u  
25:       !Convert angle to radians  
26:       a = a*pi/180.0  
27:       !open .dat file and start writing on it using the algorithm  
28:       open(1, file='proj.dat')  
29:       integer :: i  
30:       do i=1,100  
31:            !displacement of object in x and y direction  
32:            t = (i*0.01)  
33:            x(i) = u*cos(a)*t  
34:            y(i) = u*sin(a)*t - 0.5*g*t*t  
35:            !write output in file "proj.dat" for plotting  
36:            write(1,*) x(i), y(i)  
37:            !kill the loop when the object hits the ground  
38:            if (y(i)<0) exit  
39:       end do  
40:       close(1)  
41:       !close file  
42:  end program projectile_plot  

Wednesday, 3 April 2013

How to size a pressure tank

A pressure tank is used to prevent a pump from cycling (switching on and off frequently) for a system with frequent demand. Such systems are common in small residental or commercial applications for example laundary water supply. A pressure tank simply uses air pressure to keep the pressure in the storage tank at a desirable level for the demand. So, the supply pump will only have to run when the tank is at a minimum level. For the most of the time after the initial pump-up, the pump remains off and the charged (pressurized) air pocket (which is now at a higher pressure than the pre-charge pressure) does the work. I tried to illustrate the idea in the following diagrams:

Now compare the above system to the system with a pressure tank installed between the supply and demand:



By drawing the graph I wanted to show how air pressure maintains water supply preventing the pump to have to cut in frequently. To illustrate how this works, consider the following diagram:




Since this post is titled "how to size a pressure tank", I also illustrated, in the note below, the fundamentals behind the commonly used "acceptance factor" when sizing a commercial pressure tank:



Tuesday, 19 March 2013

How to design a weld

Fillet weld is a common type of weld. In this post I will calculate the length of longitudinal weld of a fillet weld used to connect a tension member to a gusset plate:




Step 1: Analyse the transverse weld


Step 2: Analyse the longitudinal weld



Step 3: Draw and label the weld


Monday, 11 March 2013

How to solve the three reservoir problem

The three reservoir problem is a useful example to solve for common problems faced in a flow system e.g. determining flow diversion from a critical pipeline to a drain line.

Friday, 8 March 2013

How to design a pipe for waterhammer

Just a simple calculation to determine peak head due to waterhammer in a pipeline downstream of a reservoir. The calculation is for a sudden valve closure downstream of the pipeline.

The file can be downloaded for free:

http://www.scribd.com/doc/129330866/design-for-waterhammer