› Gravity Well Simulator Back
Interactive simulator

Gravity Well Simulator

Compare orbit and escape conditions by changing initial velocity, or place fixed sources and explore particle trajectories. Learn from explicit equations, checkable examples and clearly stated model limits.

Explore orbit conditions and source placement Share the selected mode's state Softened force model + RK4 integration
Experiment mode

Single-source links save initial conditions. Sandbox links save the current source and particle states. Switching modes pauses both simulations and preserves their separate states.

Orbit classification
—
Classification
14.1
Circular speed v_c
—
Periapsis r_min
—
Apoapsis r_max
Live results
0.0
Radius r
0.0
Speed |v|
0.0
Escape speed v_esc
0.0
Specific energy ε
—
Orbit
Gravity well and test-particle orbit

Showing initial conditions

Test particle Trail Velocity v Current radius
Drag on the canvas to set the initial velocity (start point = test particle).
Initial conditions
Central parameter GM 40000
Initial radius r 200
Tangential velocity vθ 14.1
Radial velocity vr 0.0
Initial position angle (degrees) 0.0

Drag inputs are rounded to these ranges and increments. Negative tangential velocity reverses direction; angles are 0° right and 90° down. Restart and shared links use the same initial conditions.

Presets
Display
Potential grid
Potential contours
Particle trail
Velocity vector

Fixed-source sandbox: compare trajectories by changing the configuration

Single-source orbit mode explores one particle's trajectory and energy from its initial radius and velocity. The fixed-source sandbox lets you place sources and compare the forces on multiple test particles. Both are planar softened-force models, not simulations of general relativity or of a real solar system, binary star or galaxy.

An example to try first

Select Single-source circular orbits to place a fixed source of mass 200 at the centre and five particles at radii 80, 120, 160, 200 and 250. At the default G=1, their tangential speeds are $v_c=\sqrt{200r/(r^2+100)}$. The particle at radius 200 starts at approximately 0.998752 model speed. Play the simulation and check whether its radius remains nearly constant.

Pause and change G: source positions and particle velocities are retained, but the gravitational force changes. The previous circular-orbit condition therefore no longer applies. Select the preset again to rebuild its initial configuration with circular speeds for the current G. Do not compare energies before and after changing G as the same system's conserved quantity.

In Two fixed sources and Two-source particle groups, only the test particles move. The sources receive no reaction force from particles and do not move relative to one another. Two-source particle groups is not a galaxy-collision calculation.

Controls and interpreting the results

Click or tap an empty position to add a source with the selected mass; drag a source to move it. On a desktop, right-click a source to remove it individually. On mobile, Remove sources clears all sources so you can rebuild the configuration. Add particles adds 30 particles. Grid density changes the drawing only, not the force or integration time step.

Total particle KE is $\sum_i |\mathbf v_i|^2/2$, with each test-particle mass set to one. It excludes potential energy and is not conserved on its own. For a particle moving among fixed sources at constant G, with no capture or display-domain stopping, the conserved quantity is kinetic plus potential energy.

Equations, units and stopping conditions

With distance $r_j$ from source $j$ and outward unit vector $\hat{\mathbf r}_j$, acceleration and potential per unit mass are given below. Particle motion, force vectors and grid depth use the same model. Grid depth is capped for readability; it is not a calculation of spacetime curvature.

$$\mathbf a=-\sum_j\frac{Gm_j}{r_j^2+s^2}\hat{\mathbf r}_j,\qquad \Phi=-\sum_j\frac{Gm_j}{s}\operatorname{atan2}(s,r_j)$$

The softening length is fixed at $s=10$ in sandbox mode and $s=18$ in single-source mode. Although the acceleration has the same form, softening lengths and input definitions differ, so the displayed numbers are not interchangeable without checking these conditions. Distance, speed, mass and time use model units, with no defined conversion to m, km/s or kg. The sandbox uses RK4 with a maximum step of 0.03 model time, reduced further near a source.

Each source has a capture radius of $1.5(4+0.55\sqrt{m_j})$. A captured particle stops being calculated; post-collision motion and mass merging are not simulated. Particles farther than 4000 from the origin stop as a display-domain condition, not an energy-based escape classification. Safety limits are 128 sources and 2048 particles.

The visible domain runs from −360 to 360 on each axis, but particles do not bounce at its edges and their speeds are not capped. They continue to be calculated outside the picture up to the stopping radius. Resizing the display does not change world positions or velocities. Shared links save current sources, active particle states and display settings and restore them paused. Trail history, elapsed time and captured particles are excluded.

Single-source theory and equations

The single-source model uses a fixed softening length s=18 to limit the force near the centre. Distance, velocity and GM use model units, not au or km/s. This is not a calculation of general-relativistic spacetime or geodesics.

$$\mathbf{a} = -\frac{GM}{r^2+s^2}\,\hat{\mathbf{r}}$$

Consistent potential per unit mass, with zero at infinity:

$$\Phi(r) = -\frac{GM}{s}\arctan\left(\frac{s}{r}\right)$$

Circular-orbit speed:

$$v_c = \sqrt{\frac{GM r}{r^2+s^2}}$$

Escape speed at radius r:

$$v_{esc} = \sqrt{-2\Phi(r)}$$

Negative specific energy denotes a bound trajectory; nonnegative energy denotes an unbound one. Some trajectories nevertheless stop near the centre. Noncircular trajectories in this softened model need not be exact Keplerian ellipses or hyperbolas.

$$\varepsilon = \frac{v^2}{2} + \Phi(r)$$

Check: r=200, GM=40000, s=18 gives v_c≈14.0852 and v_esc≈19.9731. Tangential speed 14.1 and radial speed 0 give ε≈−100.0576, a nearly circular bound orbit. Turning radii are calculated from energy and angular momentum; leaving the picture is not classified as escape.

Single-source mode: the relationship between orbit and energy

🙋
Student: What does the distorted grid represent?
🎓
Professor: Grid depth depicts the potential becoming more negative near the source. Increasing GM changes the force and potential magnitudes. Height is an exaggerated visual representation, not a numerical calculation of general-relativistic spacetime curvature.
🙋
Student: Then why does the particle orbit the centre or move inward?
🎓
Professor: The model updates velocity and position using the central acceleration at the particle's location. Sufficient tangential speed produces motion around the centre; nonnegative energy allows escape to infinity in principle. Start by comparing Nearly circular orbit and Escape. Because the force is softened, noncircular trajectories need not be exact Keplerian ellipses.
🙋
Student: What is the fixed length s=18?
🎓
Professor: It is a model softening length that limits the force near the centre. It is fixed at 18 in single-source mode and 10 in sandbox mode; there is no softening slider. The acceleration denominator is r²+s² and the consistent potential is −GM/s arctan(s/r). Since the force direction is undefined at the centre, single-source drawing stops at r<6.

Frequently asked questions

It integrates radial softened accelerations from fixed gravitational sources using RK4. For one source, a=−GM/(r²+s²); with multiple sources, their acceleration vectors are added. The softening length is fixed at s=18 in single-source mode and s=10 in sandbox mode. Distances and times use model units. It does not solve general-relativistic spacetime or geodesics.
The grid depth depicts the magnitude of the consistent negative potential, with a capped display scale. Particles move according to the acceleration equation, not by rolling along the drawn surface. Grid height is not physical spacetime curvature.
It is the energy-threshold speed for reaching infinity with zero remaining speed. In single-source mode, v_esc=√(−2Φ), with Φ=−GM/s arctan(s/r). For r much larger than s, this approaches the Newtonian expression √(2GM/r). Some trajectories stop near the centre; nonnegative energy alone does not guarantee avoiding a collision.
Single-source mode explores one particle using initial radius, velocity and angle; its links save those initial conditions. Sandbox mode places fixed sources and multiple particles; its links save current sources, active particle states and display settings, restoring them paused. Trail history, elapsed time and captured particles are not saved. Switching modes pauses playback while preserving their separate states.
Not necessarily. The display sums particle kinetic energies with each test-particle mass set to one and excludes potential energy. For a particle moving among fixed sources at constant G, without capture or display-domain stopping, kinetic plus potential energy is conserved. Editing sources or G changes the system, so energies before and after the edit are not the same conserved quantity.
Not directly. It is an educational model with model units, fixed sources, artificial softening and a finite display domain. Real design requires an SI-unit mapping, physical body sizes and motion, perturbations and verified integration accuracy appropriate to the application.

What single-source mode teaches, and its scope

Velocity magnitude and direction: At the same speed, changing the tangential and radial components changes angular momentum and therefore the turning radii. Position angle changes the orbit's orientation, but in this centrally symmetric model the same radius and velocity components have the same energy.

Outside the picture is not escape: For GM=40000, r=320, tangential speed 14.1 and radial speed 0, ε≈−25.4634: the orbit is bound. Its formal apoapsis is approximately 1251.30. Leaving a small display does not make apoapsis infinite.

Fixed sources versus gravity assists: The source is fixed and there is no friction or propulsion, so specific energy is conserved. Approaching the source increases speed, but returning to the same radius restores the same speed. Energy changes in another reference frame during an encounter with a moving planet are not included.

Comparison with the ideal Newtonian model: For r much greater than s, the force approaches −GM/r². For unit-based satellite calculations, also check the assumptions and scope of the related orbital-mechanics tools.

Single-source limitations and references

Units and assumptions: Do not reinterpret the displayed values as au, km/s or solar masses. The central source is fixed and the test particle's reaction force is ignored. Drag, propulsion and relativistic effects are excluded.

Turning radii and the finite display domain: Turning radii are intersections of the effective potential Φ+J²/(2r²) with the initial energy; J is angular momentum per unit mass. Since the centre direction is undefined, drawing stops at r<6, even if the formal periapsis lies farther inward. Motion also stops beyond radius 4000 as a display-domain condition. Both stopping rules are separate from the sign of energy.

Numerical integration and preview: RK4 advances the trajectory with a maximum step of 0.03 model time, but does not guarantee exact long-term conservation. The faint line is a finite-time preview and may not show a complete period. Nearly circular conditions are rounded to the velocity input increment of 0.1.

Reference:MIT OpenCourseWare: Central Force Motion: Orbits provides background on central-force energy, angular momentum and ideal Newtonian orbits. The softened potential used here is derived by integrating this page's adopted force; it is not the same model as the reference's Newtonian equations.

Using single-source mode

  1. Set Central parameter GM and Initial radius r. Both use model units.
  2. Set Tangential velocity vθ and Radial velocity vr. Negative tangential velocity reverses direction; positive radial velocity points outward.
  3. Set Initial position angle, or drag on the canvas. Drag inputs are rounded to the control ranges and increments. Pressing near the centre sets the initial radius to its lower limit of 80.
  4. Compare motion using Launch, Play and Restart. Links copied from the share button save initial conditions, not the particle's current displayed position.

Single-source worked checks

Nearly circular: Set GM=40000, r=200, vθ=14.1, vr=0 and angle 0°. With s=18, circular speed≈14.0852, escape speed≈19.9731 and specific energy≈−100.0576. Periapsis is 200 and apoapsis approximately 200.83, giving a nearly circular bound orbit. The Nearly circular orbit button loads these inputs.

Compare the escape condition: Keep the other inputs and change vθ to 20.8: ε≈16.8574 is unbound, with infinite apoapsis. The Escape button loads this case. These are model-unit values, not the speed of a real planet.

Before applying the results

  1. This is an educational softened-force model. Do not treat its results as real orbit-design or black-hole calculations.
  2. Resizing changes only display coordinates. Turning radii and energy classification are not calculated from screen width.
  3. Distinguish centre stopping, display-domain stopping and unbound classification. After changing conditions, check initial values and specific energy before playing.