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 revision Both sides next revision
repository:satellite_orbit [2020/02/27 20:58]
porcaro1 [Answer Key]
repository:satellite_orbit [2020/02/27 21:05]
porcaro1 [Activity]
Line 25: Line 25:
 ==Satellite Orbit== ==Satellite Orbit==
 **Part 1**\\ **Part 1**\\
 +{{ :​repository:​satellite_orbit.png?​nolink&​600|}}
 Copy and paste the following [[https://​www.glowscript.org/#/​user/​nrosenmund/​folder/​Public/​program/​Newton'​sLawOfGravitationandEnergyConservationSTUDENT | GlowScript code]] into your own GlowScript account. Read through the code and predict what might happen during the simulation Copy and paste the following [[https://​www.glowscript.org/#/​user/​nrosenmund/​folder/​Public/​program/​Newton'​sLawOfGravitationandEnergyConservationSTUDENT | GlowScript code]] into your own GlowScript account. Read through the code and predict what might happen during the simulation
   - Run the program, observe and describe what happened and how it differed from your predictions   - Run the program, observe and describe what happened and how it differed from your predictions
Line 200: Line 200:
           - Evidence: This has already be thoroughly discussed in Part a of this problem           - Evidence: This has already be thoroughly discussed in Part a of this problem
    
 +===Code===
 +[[https://​www.glowscript.org/#/​user/​nrosenmund/​folder/​Public/​program/​Newton'​sLawOfGravitationandEnergyConservationTEACHER | Link]]
 +<code Python [enable_line_numbers="​true",​ highlight_lines_extra="​18,​24,​34,​56,​66,​69"​]>​
 +GlowScript 2.7 VPython
 +get_library('​https://​rawgit.com/​perlatmsu/​physutil/​master/​js/​physutil.js'​)
 +rom __future__ import division
 +from visual import *                                        ​
 +from visual.graph import *                                  ​
 +                                                            ​
 +#Window setup                                              ​
 +scene.range = 7e7                                          ​
 +scene.width = 1024                                         
 +scene.height = 760                                     
 +
 +#Objects
 +Earth = sphere(pos=vector(0,​0,​0),​ radius=6.4e6,​ texture=textures.earth)
 +Satellite = sphere(pos=vector(6.6*Earth.radius,​ 0,0), radius=1e6, color=color.orange,​ make_trail=True)
 +
 +#Parameters and Initial Conditions
 +mSatellite = 1000
 +pSatellite = vector(-1500*mSatellite,​2598*mSatellite,​0)
 +G = 6.67e-11
 +mEarth = 5.98e24
 +r = (Earth.pos - Satellite.pos)
 +g1 = gcurve(color=color.cyan,​label="​kinetic energy"​)
 +g2 = gcurve(color=color.red,​label="​gravitational energy"​)
 +g3 = gcurve(color=color.green,​label="​total mechanical energy"​)
 +
 +#Time and time step
 +t = 0
 +tf = 60*60*24*10
 +dt = 1
 +
 +graphv = gdisplay(xmin=-0.25,​ xmax=1.25, ymin=-12e10,​ ymax=12e10, ytitle="​Energy"​)
 +g4 = gvbars(gdisplay = graphv, color = color.red, delta = 0.2, label = "​Kinetic Energy"​)
 +g5 = gvbars(gdisplay = graphv, color = color.blue, delta = 0.2, label = "​Potential Energy"​)
 +g6 = gvbars(gdisplay = graphv, color = color.green,​ delta = 0.2, label = "Total Energy"​)
 +
 +#​MotionMap/​Graph
 +FSatelliteMotionMap = MotionMap(Satellite,​ tf, 200, markerScale=4000,​ labelMarkerOrder=False)
 +pSatelliteMotionMap = MotionMap(Satellite,​ tf, 200, markerScale=0.2,​ markerColor=color.blue,​ labelMarkerOrder=False)
 +
 +
 +#​Calculation Loop
 +ev = scene.waitfor('​click'​)
 +while t < tf:
 +    rate(6000)
 +    g4.delete()
 +    g5.delete()
 +    g6.delete()
 +    Fnet = vector(0,​0,​0)
 +    r = (Earth.pos - Satellite.pos)
 +    Fnet = vector(G*mEarth*mSatellite/​(mag(r)**2)*(r/​mag(r)))
 +    pSatellite = pSatellite + Fnet*dt
 +    Satellite.pos = Satellite.pos + (pSatellite/​mSatellite)*dt
 +    if mag(Satellite.pos) < Earth.radius:​
 +        text(text='​You Crashed!!',​ pos=vec(0, 4e7, 0), color = color.red, depth=1, height= 7e6)
 +        break
 +    FSatelliteMotionMap.update(t,​ Fnet)
 +    pSatelliteMotionMap.update(t,​ pSatellite)
 +    t = t + dt
 +    ​
 +    KE = 1/​2*mSatellite*mag(pSatellite/​mSatellite)**2
 +    ​
 +    PE = G*mSatellite*mEarth/​mag(r)
 +    ​
 +    g1.plot(t, KE)
 +    g2.plot(t, PE)
 +    g3.plot(t, KE+PE)
 +    g4.plot(0, KE)
 +    g5.plot(0.5,​ PE)
 +    g6.plot(1.0,​ KE+PE)
 +    ​
 +    #Earth Rotation (IGNORE)
 +    theta = 7.29e-5*dt
 +    Earth.rotate(angle=theta,​ axis=vector(0,​0,​1),​ origin=Earth.pos)</​code>​
 +    ​
 +----
 +====See Also===
 +
  • repository/satellite_orbit.txt
  • Last modified: 2020/05/04 20:58
  • by tallpaul