program sat11
!--------------------------------------------------------------------------------Declare
implicit none
real*4 :: Period, mecorrect, satmass, satmass1, satmass2, diff, orbit1, orbit2, catch, centmass, suncorrect, vel
real*4 :: earthdist, jupiterdist
real*4 :: G, catch4, fin, years, Msun, Mjupiter, Mearth, Mmoon, twopi, Rad, days, circ, moondist
parameter (twopi = 6.2831853071795864, G = 6.674d-11, Msun = 1.9891d30, Mearth = 5.9723d24, Mmoon = 7.34767d22)
10 parameter (Mjupiter = 1.8933d27, moondist = 384404000, earthdist = 1.4959787d11, jupiterdist = 7.785d11, years = 0)
rad = 0 ; centmass = 0 ; fin = 0
print*, "-------------"
print*, "V 0710161600"
print*, "-------------"
print*, "This program calculates the orbital velocity of two satellites in the same"
print*, "orbit around a central body, and gives the velocity difference and the"
print*, "time to collide - assuming they started off 180 degrees around from each"
print*, "other."
20 print*
print*, "The masses of the moon, earth, jupiter and the sun are given for you to"
print*, "work with."
print*
print*, "The moon's orbital radius is 384,404,000 meters, earth's is 1.4959787e11"
print*, "meters, and Jupiter's is 7.785e11 meters"
print*
print*, "The mass of the moon is 7.34767e22 Kg, earth is 5.97219e24 Kg,"
print*, "Jupiter is 1.89817e27 Kg and the sun is 1.9891e30 Kg. "
print*
30 print*, "Use the earth moon system to start with, and you will see that a man made"
print*, "satellite of eg 1000 Kg at the moon's distance is over 6 meters per second"
print*, "slower in its orbit than the moon."
print*
print*, "For input, use actual masses and distances in Kilograms and meters or"
print*, "moon = 0, earth = 1, Jupiter = 2, sun = 3"
! -----------------------------------------------------------------------------------Input
37 print*
print*, "----------------------------------------------------------------------"
print*, "Choose the central mass (or enter 0 for moon mass, 1 for earth, 2 for"
40 print*, "jupiter, 3 for the sun.) "
read*, centmass
if (centmass==0) then
centmass = Mmoon
else if (centmass==1) then
centmass = Mearth
else if (centmass==2) then
centmass = Mjupiter
else if (centmass==3) then
centmass = Msun
50 end if
print*, "Orbital radius is (or enter 0 for moon's orbit, 1 for the earth, or 2 for "
print*, "jupiter )"
read*, Rad
if (rad==0) then
rad = moondist ! moon orbit
else if (rad == 1) then
Rad = earthdist ! earth orbit
else if (rad==2) then
rad = jupiterdist ! Jupiter orbit
60 end if
circ = twopi * Rad
print*, "Orbital radius is ", rad," meters"
print*, "Central mass is ", centmass," Kg"
print*,"Orbit circumference is ",circ," meters"
print*," "
print*, "Lighter satellite first or the result will be negative: ie the lighter"
print*, "satellite being slower will be caught up by the heavier one. "
print*
print*, "Enter the mass of satellite 1 in Kg (or 0 for the moon, 1 for earth, 2 for"
70 print*, "jupiter, 3 for the sun)."
read*, satmass1
if (satmass1==0) then
satmass1 = Mmoon
else if (satmass1 ==1) then
satmass1 = Mearth
else if (satmass1 ==2) then
satmass1 = Mjupiter
else if (satmass1 ==3) then
satmass1 = Msun
80 end if
print*
print*, "central mass ", centmass
print*, "satellite 1 mass is ", satmass1," Kg"
!---------------------------------------------------------------------- calculations
satmass = satmass1
call calculate(Period,twopi,Rad,G,centmass,satmass,vel,circ,years)
90 print*, "----- satellite 1 -----"
print*
print*, "-----------------------------------------------------------------"
orbit1 = vel
print*
print*, "Enter the mass of satellite 2 in Kg (or 0 for the moon, 1 for the earth,"
print*, "2 for jupiter, 3 for the sun)."
read*, satmass2
if (satmass2==0) then
satmass2 = Mmoon
100 else if (satmass2==1) then
satmass2 = Mearth
else if (satmass2==2) then
satmass2 = Mjupiter
else if (satmass2==3) then
satmass2 = 1.9891q30
end if
print*, "satellite 2 mass is ", satmass2," Kg"
satmass = satmass2
call calculate(Period,twopi,Rad,G,centmass,satmass,vel,circ,years)
110 print*, "----- satellite 2 -----"
print*
print*, "----------------------------------------------------------------"
orbit2 = vel
diff=orbit2-orbit1
print*, "The orbital velocity difference is ",diff, " m/s"
print*, "Assuming the 2 satellites started opposite to each other,"
print*,"the catch up time is :- "
catch = ((circ / 2) / diff) /60/60/24/365.25
120 print*, catch," years"
print*, "Press 0 to finish, or 1 to restart."
read*, fin
if (fin==0) then
goto 128
else if (fin>0) then
goto 37
end if
128 end program sat11
!----------------------------------------------------------------------- subroutine
130 subroutine calculate(Period,twopi,Rad,G,centmass,satmass,vel,circ,years)
implicit none
real*4 :: Period, centmass, satmass, vel, twopi, Rad, days, circ, G, years
print*, "circ = ", circ," meters"
Period = twopi * sqrt((Rad * Rad * Rad) / (G * ( centmass + satmass)))
vel = circ / Period
print*, "The orbital velocity is ", vel," m/s"
print*, "The period of orbit is ", Period, " seconds"
days = Period/86400
years = days / 365.25
140 print*
print*, "orbit time is ",days," days"
print*, "or ",years," years"
print*, "satmass is ",satmass," Kg"
print*
end subroutine calculate