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
Parameters
New Mass 50
Gravity Constant G 1.0
Grid Density 28
Actions
Presets
Display
Show Grid
Particle Trail
Force Vectors
Statistics
0
Masses
0
Particles
0
Total KE
60
FPS

Newton's Law of Universal Gravitation

The attractive force between two masses M and m:

F = G·M·m / r²

This simulator computes acceleration a = G·M/r² at each timestep and updates position and velocity via Verlet integration. A softening parameter ε prevents divergence as r→0.

Rubber-Sheet Analogy

Grid displacement:

Δy = Σ -M_i / (r_i + ε)

Einstein described general relativity as "massive objects warping spacetime like a rubber sheet." The 2D grid deformation in this simulator is that analogy made visible. Real spacetime is 4-dimensional, but this visualization is highly effective for intuitive understanding.

Orbital Mechanics & Escape Velocity

Escape velocity:

v_e = √(2GM/r)

If a particle's initial speed is below the escape velocity it follows an elliptical orbit; above it, a hyperbolic trajectory. In CAE, orbital computation techniques are applied to rocket trajectory design and satellite perturbation analysis.

Connection to CAE

The gravitational potential ∇²φ = 4πGρ is Poisson's equation, mathematically identical to FEM formulations for heat conduction, electrostatics, and structural potential problems. N-body integration is the foundation of MD (Molecular Dynamics), and grid deformation uses the same concept as mesh deformation analysis.

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.

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.

Related Engineering Fields

The core of this simulator—"calculating the motion of point masses in a gravitational field"—is remarkably similar in numerical methods to Molecular Dynamics (MD). In MD, you calculate intermolecular forces between atoms (e.g., Lennard-Jones potential) and similarly use Verlet integration to track atomic trajectories. Although the force laws differ (gravity's $1/r^2$ vs. intermolecular forces like $1/r^{12}$), the concepts of cutoffs and softening to prevent divergence are common.

Another major application is trajectory planning for robot arms and manipulators. Try thinking of the gravitational well as a "potential toward a target location" and the particle as the "robot's end effector (tip)." By setting obstacles as repulsive potentials, you can generate paths where the robot is naturally attracted to the target while avoiding obstacles, using the same mechanical calculations as this simulator. This is a classic yet powerful technique called the artificial potential field method.

Furthermore, in particle-based fluid simulation (like SPH methods), a smoothing technique similar to this "softening" (using kernel functions) is essential when calculating interactions between nearby particles. This fundamental engineering technique of smoothing forces to prevent computational divergence is widely used across different fields.

For Further Learning

The first next step is to solidify your foundations in "numerical computation" and "classical mechanics." To understand the Verlet integration in this simulator, it's helpful to compare it with other numerical integration methods like Euler's method or Runge-Kutta methods. For instance, using Euler's method with the same initial conditions lets you experience "divergence" firsthand, where energy isn't conserved and orbits continuously expand. A textbook like 'The Next Step After Euler's Method: Fundamentals of Numerical Computation' would be a useful introductory resource.

Regarding mathematical background, differential equations (especially initial value problems for ordinary differential equations) and vector calculus are key. Particle motion is described by Newton's equation of motion $m\ddot{\vec{r}} = \vec{F}$, a second-order ordinary differential equation. Solving this on a computer is the essence of the simulation. Also, learning to express the force $\vec{F}$ as the gradient ($-\nabla U$) of a potential energy $U$ deepens your understanding of conservative forces. Think of it as a ball rolling in a potential valley (a gravity well).

Once you're comfortable with this tool, the next topics to challenge yourself with are "the n-body problem" and "relativistic effects." Currently, this is close to a "restricted three-body problem" where the gravity source is fixed and only the particle moves. However, when multiple gravity sources also move (e.g., a planet around a binary star), chaotic orbits can appear. Furthermore, to understand subtle phenomena unexplained by Newtonian mechanics, like the precession of Mercury's perihelion, you would need to move to the next step, such as the post-Newtonian approximation of general relativity. First, tinkering extensively with this simulator's parameters to develop your "intuition" will form the foundation for all of that.