course_planning:183_projects:s23_week_3_geostationary_orbit

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
course_planning:183_projects:s23_week_3_geostationary_orbit [2023/01/25 17:42] hallsteincourse_planning:183_projects:s23_week_3_geostationary_orbit [2023/01/25 19:34] hallstein
Line 192: Line 192:
   * **Question:**  How can you prove that the orbit is actually circular?   * **Question:**  How can you prove that the orbit is actually circular?
   * **Expected Answer:**     * **Expected Answer:**  
-Aside from just eyeballing it, we can add in a graph of the distance from the center of Earth!+Aside from just eyeballing it, we can add in a graph of the distance from the center of Earth! (Moved to separate part C of the problem)
 <code python> <code python>
 #MotionMap/Graph #MotionMap/Graph
Line 232: Line 232:
 </WRAP> </WRAP>
  
-<code python satellite.sol.py>+Working code for part B: 
 +<code>
 GlowScript 2.9 VPython GlowScript 2.9 VPython
 + 
 get_library('https://cdn.rawgit.com/PERLMSU/physutil/master/js/physutil.js') get_library('https://cdn.rawgit.com/PERLMSU/physutil/master/js/physutil.js')
 + 
 #Window setup #Window setup
 scene.range=7e7 scene.range=7e7
 scene.width = 1024 scene.width = 1024
 scene.height = 760 scene.height = 760
 + 
 #Objects #Objects
 Earth = sphere(pos=vector(0,0,0), radius=6.4e6, color=color.blue) Earth = sphere(pos=vector(0,0,0), radius=6.4e6, color=color.blue)
-Satellite = sphere(pos=vector(42164e3, 0,0), radius=1e6, color=color.red, make_trail=True) +Satellite = sphere(pos=vector(42164e3, 0,0), radius=1e6, color=color.red, make_trail=True)   #modify position of satellite 
 + 
 #Parameters and Initial Conditions #Parameters and Initial Conditions
-mSatellite = 15e3 +mSatellite = 15e3   # edit mass of the satellite 
-pSatellite = mSatellite*vector(0,3073,0) +pSatellite = mSatellite*vector(0,3073,0) #edit momentum of the satellite 
-G = 6.67e-11 +G = 6.67e-11   # add universal gravitational constant 
-mEarth = 5.97e24 +mEarth = 5.97e24  # add mass of Earth 
 + 
 #Time and time step #Time and time step
 t = 0 t = 0
 tf = 60*60*24 tf = 60*60*24
 dt = 1 dt = 1
 + 
 +#MotionMap/Graph
 +SatelliteMotionMap = MotionMap(Satellite, tf, 20, markerScale=2000, labelMarkerOrder=False)
 +FnetMotionMap = MotionMap(Satellite, tf, 20, markerScale=2000, labelMarkerOrder=False)   # add Fnet force arrows - also need to add in loop)
 + 
 + 
 +#Calculation Loop
 +while t < tf:
 +    rate(10000)
 + 
 +    Fgrav = -G*mSatellite*mEarth*Satellite.pos/(mag(Satellite.pos)**3) # Add Fgrav change Fnet
 +    Fnet = Fgrav                                                       # change Fnet from zero
 + 
 +    pSatellite = pSatellite + Fnet*dt
 +    Satellite.pos = Satellite.pos + (pSatellite/mSatellite)*dt
 + 
 +    SatelliteMotionMap.update(t, pSatellite/mSatellite)
 + 
 +    FnetMotionMap.update(t, Fnet)  # Add Fnet vector arrows
 +    t = t + dt
 + 
 +    #Earth Rotation (IGNORE)
 +    theta = 7.29e-5*dt
 +    Earth.rotate(angle=theta, axis=vector(0,0,1), origin=Earth.pos)
 +</code>
  
 +Changes made to the given code:
 +
 +====== Project 3: Part C: Geostationary orbit ======
 +
 +While you have continued to impress Carver, he remains unsure about the size of the force acting on the satellite and its distance from Earth.    He seems particularly concerned the distance of the satellite from Earth not very more than $\pm$ 1%.  Graphs of its distance from Earth and the magnitude of the net force acting on it may convince him.
 +
 +The syntax you need to work with in order to include a graph involves two lines of code(mass of Earth vs time is given as an example).  One outside the while loop and the second inside as the variable being plotted on the vertical axis changes with time:
 +
 +Outside the while loop, add: graphExample = PhysGraph(numPlots=1)
 +
 +Inside the while loop, add: graphExample.plot(t, mEarth)
 +
 +====== Project 3: Part D: Geostationary orbit ======
 +
 +On a single graph, plot both the x-component of the satellite's momentum and the x-component of the net force acting on the satellite.
 +
 +
 +Solution code for parts C and D
 +
 +<code>
 +GlowScript 2.9 VPython
 + 
 +get_library('https://cdn.rawgit.com/PERLMSU/physutil/master/js/physutil.js')
 + 
 +#Window setup
 +scene.range=7e7
 +scene.width = 1024
 +scene.height = 760
 + 
 +#Objects
 +Earth = sphere(pos=vector(0,0,0), radius=6.4e6, color=color.blue)
 +Satellite = sphere(pos=vector(42164e3, 0,0), radius=1e6, color=color.red, make_trail=True)   #modify position of satellite
 + 
 +#Parameters and Initial Conditions
 +mSatellite = 15e3   # edit mass of the satellite
 +pSatellite = mSatellite*vector(0,3073,0) #edit momentum of the satellite
 +G = 6.67e-11   # add universal gravitational constant
 +mEarth = 5.97e24  # add mass of Earth
 + 
 +#Time and time step
 +t = 0
 +tf = 60*60*24
 +dt = 1
 + 
 #MotionMap/Graph #MotionMap/Graph
 SatelliteMotionMap = MotionMap(Satellite, tf, 20, markerScale=2000, labelMarkerOrder=False) SatelliteMotionMap = MotionMap(Satellite, tf, 20, markerScale=2000, labelMarkerOrder=False)
-FnetMotionMap = MotionMap(Satellite, tf, 20, markerScale=2000, labelMarkerOrder=False)+FnetMotionMap = MotionMap(Satellite, tf, 20, markerScale=2000, labelMarkerOrder=False)   # add Fnet force arrows - also need to add in loop)
 #separationGraph = PhysGraph(numPlots=1) #separationGraph = PhysGraph(numPlots=1)
-f1=series()+graphSatellite PhysGraph(numPlot=1) 
 +graphFnet = PhysGraph(numPlots=1)
  
 +graphpF = PhysGraph(numPlots=2)
  
 + 
 + 
 #Calculation Loop #Calculation Loop
 while t < tf: while t < tf:
     rate(10000)     rate(10000)
- +  
-    Fgrav = -G*mSatellite*mEarth*Satellite.pos/(mag(Satellite.pos)**3) +    Fgrav = -G*mSatellite*mEarth*Satellite.pos/(mag(Satellite.pos)**3) # Add Fgrav change Fnet 
-    Fnet = Fgrav +    Fnet = Fgrav                                                       # change Fnet from zero 
 + 
     pSatellite = pSatellite + Fnet*dt     pSatellite = pSatellite + Fnet*dt
     Satellite.pos = Satellite.pos + (pSatellite/mSatellite)*dt     Satellite.pos = Satellite.pos + (pSatellite/mSatellite)*dt
 + 
     SatelliteMotionMap.update(t, pSatellite/mSatellite)     SatelliteMotionMap.update(t, pSatellite/mSatellite)
-     +  
-    FnetMotionMap.update(t, Fnet)+    FnetMotionMap.update(t, Fnet)  # Add Fnet vector arrows
     #separationGraph.plot(t,mag(mSatellite))     #separationGraph.plot(t,mag(mSatellite))
-    f1.plot(t,mag(Satellite.pos)) +    graphSatellite.plot(t,mag(Satellite.pos)
 +    graphFnet.plot(t,mag(Fnet)) 
 +    scale=1.0E4   # add scale to make fluctuations in Fx visible (units of 10^-4 N) 
 +    graphpF.plot(t,pSatellite.x,scale*Fnet.x
 + 
     t = t + dt     t = t + dt
 + 
     #Earth Rotation (IGNORE)     #Earth Rotation (IGNORE)
     theta = 7.29e-5*dt     theta = 7.29e-5*dt
     Earth.rotate(angle=theta, axis=vector(0,0,1), origin=Earth.pos)     Earth.rotate(angle=theta, axis=vector(0,0,1), origin=Earth.pos)
 </code> </code>
 +
 +Modification of solution to part B to get |r| vs t, |Fnet| vs t and Fnet,x and P,x vs t:
 +
 +
  • course_planning/183_projects/s23_week_3_geostationary_orbit.txt
  • Last modified: 2023/10/18 01:20
  • by hallstein