Gravity Well Simulator Back
Interactive Simulator

Gravity Well Simulator

Click to place gravitational sources and watch the grid warp like a spacetime rubber sheet. Observe test particles tracing orbits and build an intuitive grasp of general relativity.

Click to place mass Right-click to remove Newtonian gravity + Verlet integration
Gravity Potential Well
Parameters
New Mass
Gravity Constant G
Grid Density
Actions
Presets
Display
Show Grid
Particle Trail
Force Vectors
Statistics
Results
0
Masses
0
Particles
0
Total KE
60
FPS
50
New Mass

What is a Gravity Well?

🙋
What exactly is a "gravity well"? I've heard it used for planets and black holes, but what does it actually mean?
🎓
Basically, it's a way to visualize gravity as a dip or curve in the fabric of spacetime. Imagine a stretched rubber sheet. A heavy object like a star creates a deep "well." In practice, objects like planets "roll" around in this well, which we see as orbits. Try moving the "Central Mass" slider above—you'll see the well get deeper and steeper.
🙋
Wait, really? So the planet's speed isn't just random? What decides if it goes into a stable orbit or just falls in?
🎓
Great question! It's a balance between the planet's sideways speed and the pull of the well. Too slow, and it spirals in. Too fast, and it escapes. A common case is a satellite launch—engineers calculate the precise "orbital velocity." In the simulator, adjust the "Initial Tangential Velocity" slider. See how a small change flips the orbit from elliptical to a runaway escape trajectory?
🙋
That makes sense! But what about the "Warp Factor"? That sounds like sci-fi. Is that related to Einstein's relativity?
🎓
Exactly! In Newtonian physics, gravity is just a force. But General Relativity says mass actually warps spacetime itself. The "Warp Factor" control lets you exaggerate that effect. For instance, near a neutron star, this warping is extreme and causes measurable effects like time dilation. Slide it up and watch how the well's shape changes from a simple bowl to a deep, funnel-like curve.

Physical Model & Key Equations

The simulator primarily uses Newton's Law of Universal Gravitation to calculate the force between two masses. This force is always attractive and depends on the product of the masses and the inverse square of the distance between them.

$$F = G \frac{m_1 m_2}{r^2}$$

F is the gravitational force. G is the gravitational constant. m₁ and m₂ are the masses (e.g., the central star and a planet). r is the distance between their centers.

For orbital motion, this central force is balanced by the required centripetal force for circular motion. This gives us the equation for orbital velocity.

$$v = \sqrt{\frac{GM}{r}}$$

v is the orbital speed. M is the central mass. r is the orbital radius. This shows why increasing the central mass (with the slider) requires a higher speed for a stable orbit at the same distance.

Frequently Asked Questions

When multiple gravity sources are present, particles move under the vector sum of gravitational attraction from each source. The trajectories are not simple ellipses but can become complex and chaotic. For example, you can observe figure-eight orbits between two gravity sources, or swing-by phenomena where a particle is captured by one source and then ejected.
The height (deformation depth) of each grid vertex visualizes the total gravitational potential at that position. The larger the mass of the gravity source, and the closer to the source, the deeper the depression. This is an intuitive representation of spacetime distortion in general relativity, using the rubber sheet analogy.
In the current version, you can click and drag a particle, then release it to give it an initial velocity in the direction and speed of the release. The longer the drag distance, the higher the initial speed. You can also directly input the initial velocity vector (x, y components) numerically from the settings panel.
Too many gravity sources or particles can increase computational load. First, right-click to delete unnecessary gravity sources. Also, in the settings menu, lowering the 'grid resolution' (e.g., from high to medium) can reduce rendering load. If it remains heavy, reload the browser tab to reset to the initial state.

Real-World Applications

Satellite Orbit Planning: Every communications or GPS satellite must be placed in a precise orbit. Engineers use these exact equations to calculate the required launch velocity and orbital altitude, ensuring the satellite doesn't drift away or fall back to Earth.

Space Mission Trajectories: Missions like the Voyager probes or the Parker Solar Probe use "gravity assists." They carefully aim their trajectory to "slingshot" around a planet, using its gravity well to gain speed without using fuel, a direct application of orbital mechanics.

Understanding Black Holes: A black hole is an infinitely deep gravity well. The concepts here—like the escape velocity becoming greater than the speed of light at the event horizon—are extreme versions of the physics you're simulating.

CAE & Astrophysics Simulations: In Computer-Aided Engineering, sophisticated versions of this simulator are used to model galaxy formations, predict asteroid paths, and plan complex multi-planet space missions, testing millions of orbital scenarios before launch.

Common Misconceptions and Points to Note

First, understand that this simulator is a 2D analogy. Actual spacetime curvature occurs in four dimensions (3D space + time), and this "rubber sheet" image is merely an aid for understanding. Crucially, particles don't "fall" in a "downward" direction relative to the sheet; the essence is that they move as a result of traveling through the distorted geometry itself.

Next, the setting of the "softening" parameter. Setting this to small values like 0.1 or 0.01 makes it easy for particles to collide violently with the gravity source, causing the calculation to diverge. In practice, you adjust it according to the scale of your simulation. For example, in galaxy collision simulations, the distances between stars are vast, so a relatively large softening value is used to stabilize the calculation. Conversely, for precise calculations of small systems, you use a smaller value, but you must correspondingly reduce the timestep (the increment of time). The erratic orbits you see in this simulator when you increase the "particle's initial velocity" occur because the timestep is fixed, which is another point to watch for in practical applications.

Finally, the characteristics of "Verlet integration". While this method has good energy conservation properties, it does not calculate velocity directly (it's derived from the difference in positions). Therefore, if you later need to add velocity-dependent forces (like air resistance), some extra consideration is needed. This simulator uses it simply because it deals with pure gravity, but keep this in mind when applying it elsewhere.

How to Use

  1. Set gravitational source mass using the sl-mass slider (range: 1–1000 solar masses)
  2. Adjust gravitational constant scaling with sl-g to modify spacetime curvature intensity
  3. Use gridGWNum and sl-grid to control grid resolution (8–64 divisions)
  4. Click on the canvas to place massive objects; enable tog-trail to visualize particle trajectories
  5. Toggle tog-grid to show or hide the warped coordinate mesh

Worked Example

Place a 10 solar mass neutron star at canvas center with sl-mass=10 and sl-g=1.0. Set grid resolution to 32 divisions. A test particle released 50 pixels away experiences geodesic acceleration toward the mass well. With tog-trail enabled, the particle traces a spiraling infall path over ~15 seconds before crossing the event horizon approximation. Increasing sl-g to 2.5 steepens the metric curvature, reducing orbital decay time to ~6 seconds and demonstrating how gravitational strength scales nonlinearly with source mass.

Practical Notes