Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
summer_2018:gravitation [2018/06/19 03:33] tallpaul [Part B] |
summer_2018:gravitation [2018/06/19 03:52] (current) tallpaul [Part B] |
||
|---|---|---|---|
| Line 19: | Line 19: | ||
| Carver is impressed with your work, but remains unconvinced by your predictions. He has asked you to write a simulation that models the orbit of the satellite. To truly convince Carver, the simulation should include representations of the net force acting on the spacecraft, which has a mass of $15\times10^3$ kg. Your simulation should be generalized enough to model other types of orbits including elliptical ones. | Carver is impressed with your work, but remains unconvinced by your predictions. He has asked you to write a simulation that models the orbit of the satellite. To truly convince Carver, the simulation should include representations of the net force acting on the spacecraft, which has a mass of $15\times10^3$ kg. Your simulation should be generalized enough to model other types of orbits including elliptical ones. | ||
| + | |||
| + | To begin, copy the code below into a glowscript file. | ||
| <code> | <code> | ||
| - | from __future__ import division | + | get_library('https://rawgit.com/perlatmsu/physutil/master/js/physutil.js') |
| + | rom __future__ import division | ||
| from visual import * | from visual import * | ||
| from visual.graph import * | from visual.graph import * | ||
| - | from physutil import * | ||
| #Window setup | #Window setup | ||
| Line 32: | Line 34: | ||
| #Objects | #Objects | ||
| - | Earth = sphere(pos=vector(0,0,0), radius=6.4e6, material=materials.BlueMarble) | + | Earth = sphere(pos=vector(0,0,0), radius=6.4e6, texture=textures.earth) |
| Satellite = sphere(pos=vector(7*Earth.radius, 0,0), radius=1e6, color=color.red, make_trail=True) | Satellite = sphere(pos=vector(7*Earth.radius, 0,0), radius=1e6, color=color.red, make_trail=True) | ||
| Line 49: | Line 51: | ||
| #Calculation Loop | #Calculation Loop | ||
| while t < tf: | while t < tf: | ||
| - | rate(10000) | + | rate(10000) |
| - | Fnet = vector(0,0,0) | + | Fnet = vector(0,0,0) |
| - | 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) |
| - | 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> | ||
| - | |||
| - | [[:183_notes:learning goals:week 3|Learning Goals Week 3]] | ||