Skip to main content
Sandbox Physics
Galactic bars, resonances and stellar migration

Galactic bar orbits · L3

Recalculate a bar orbit from saved states

Open the rotating-bar Lab

You can recompute the trajectories, shoot the periodic parents and draw the three figures without the website. Extract the independent scientific reader into a new directory and choose an output path that does not yet exist. Then use its saved arrays to check how the torque changes angular momentum.

Open the small package before running it

The scientific ZIP contains only own Python producers, numerical inputs, provenance and explanatory text. Its manifest identifies every member except itself. The replay checks that inventory before calculation and refuses a changed byte or an existing output directory.

The field is Φ=ln⁡R+Af(R)cos⁡[2(ϕ−Ωpt)]\Phi=\ln R+Af(R)\cos[2(\phi-\Omega_pt)], with A=0.01A=0.01, Ωp=1\Omega_p=1 and Rb=0.5R_b=0.5. Population coordinates are inertial. Periodic-parent coordinates rotate with the bar. Energy and angular momentum are specific quantities; no physical Milky Way length or mass has been fitted.

To compare with the interactive experiment, select either parent preset, which uses this same field. Its main default has a stronger amplitude of 0.04 and is a different release.

python3 -W error replay.py --output /absolute/new/empty/run

Reading: Sandbox Physics independent galactic-bar scientific reader v1 · Dehnen (1999v1/2000), The Effect of the Outer Lindblad Resonance of the Galactic Bar on the Local Stellar Velocity Distribution

Follow the six fresh commands

The first producer integrates 256 tracers at 5120 and 10240 steps, then saves the fine result. The second compares ten original test states with a polar-force DOP853 integrator, measures an exact circle and small epicycle, and integrates prescribed amplitude growth. The next two commands solve the inner and outer parent roots and complete their periods.

The fifth command reads the completed files and calculates diagnostics. The sixth draws the figures from those same saved arrays. None of the numerical results is shipped inside the package. Every command runs serially with a 120-second ceiling.

On the author's first cold run, the six commands took 23.37 s23.37\,\mathrm{s} including first-time plotting/font work and wrote about 1.90 MB1.90\,\mathrm{MB}. That is a local timing, not a promise for every computer. The receipts report each command separately.

Reading: Sandbox Physics independent galactic-bar scientific reader v1

Read the saved angular momentum and torque together

Open population/population-record.npz. Its arrays contain times, four-component inertial states, equal sampling weights and the fine-step torque integral. For each saved state calculate Lz=xvy−yvxL_z=xv_y-yv_x. Subtract the initial value and compare with the saved time integral of torque.

The plotted selected tracer has final ΔLz≃−0.0596448\Delta L_z\simeq-0.0596448. Its axisymmetric reference guiding radius falls by the same numerical amount because v0=1v_0=1. This does not identify its instantaneous radius or establish a permanent migration endpoint.

The saved torque discrepancy is around 4.7×10−144.7\times10^{-14}. KDK kicks and the matched torque quadrature share a discrete angular-momentum identity, so this near-roundoff agreement is an internal consistency check. The independent ten-state trajectory comparison gives a much larger and more relevant error, about 2.44×10−52.44\times10^{-5} in the registered scaled norm.

Angular-momentum change and torque integral from one newly saved population record.
Own new saved-record analysis. Solid blue is the selected star's angular-momentum change; dashed orange integrates torque over all fine steps. Their agreement is not by itself an independent trajectory validation.

Reading: Sandbox Physics independent galactic-bar scientific reader v1

Inspect errors over the whole history

For the entire population the largest middle/fine difference, divided by three, is 2.53×10−52.53\times10^{-5}, below the registered 2×10−42\times10^{-4} threshold. Its minimum radius over every fine drift is about 0.78140.7814. Neither statement is inferred from 257 saved frames alone.

The six newly shot parents return within about 1.3×10−141.3\times10^{-14} in the reference scaled norm. Separate KDK integrations at three steps test complete trajectories against those references. The tiny shooting residual should not be confused with the larger discretisation error of a different integrator.

The population statistic Q2Q_2 averages the complex double azimuth with equal weights. Its amplitude describes this sample's angular anisotropy. It does not weight surface area, mass, stellar ages or luminosity, and it cannot serve as a galaxy brightness map.

Q2(t)=∑i=12561256e2i[ϕi(t)−Ωpt]Q_2(t)=\sum_{i=1}^{256}\frac{1}{256}e^{2\mathrm{i}[\phi_i(t)-\Omega_pt]}
The complex average combines mean cosine and mean sine of twice the relative azimuth. Its magnitude measures this equal-weight sample's angular anisotropy.

Reading: Sandbox Physics independent galactic-bar scientific reader v1

Keep the examples that fail

The wide bracket at starting radius 1.45 has negative return velocities at both endpoints. Replay reports the actual residuals and keeps the failed bracket. The six successful parents use their separately declared narrow brackets.

The fast warm release A=0.04,Ωp=1.4,σR=0.08A=0.04,\Omega_p=1.4,\sigma_R=0.08 crosses the admitted radius R=0.5R=0.5. This reader stops at its first invalid drift and retains that state. It does not complete a scientifically admitted trajectory by ignoring the crossing.

The growth example retains a failed constant-Jacobi hypothesis, then tests the correct amplitude-work relation. These expected failures remain scientifically failed even when the wrapper successfully reproduces them.

Reading: Sandbox Physics independent galactic-bar scientific reader v1

Carry the method to a new calculation

Write down the frame, units, initial sampling and complete time history before interpreting a curve. Use a quantity's actual sampling weights. Compare full trajectories with an independent solver or analytic limit as well as checking invariants.

Change one physical condition only after registering its error and domain tests. If a new orbit crosses the excluded inner branch, preserve the failed input. If a perturbation grows or fades, include its explicit work before judging conservation. A saved endpoint is a point in that history, not a substitute for it.

Reading: Sandbox Physics independent galactic-bar scientific reader v1 · Sellwood & Binney (2002), Radial mixing in galactic discs, astro-ph/0203510v2

Exercises and explanations

  1. Why can a near-roundoff torque discrepancy coexist with a trajectory difference of a few parts in one hundred thousand?

    Read the explanation

    The integrator and its matched torque sum share a discrete identity. They can agree extremely well while both follow a slightly displaced orbit. Comparing with the independent DOP853 solution tests the actual trajectory.

  2. Could you infer the bar's stellar mass from this sample's Q2Q_2?

    Read the explanation

    No. The sample has equal angle weights and no stellar mass-to-light model or self-consistent Poisson solve. Q2Q_2 describes its angular distribution in a prescribed potential.

Try the prediction

Match the reader's physical input

  1. Select one of the two parent presets and keep strength 0.01 and pattern speed 1.
  2. Export an accepted population and identify its inertial coordinates, units and generation before calculating a diagnostic.
  3. Compare with the independent reader's field and sampling. Expect numerical agreement at the registered precision, not bitwise equality between different solvers.

Standalone scientific materials

Download the scientific ZIP · Read the setup and calculation scope

The standalone ZIP integrates a new tracer population, independent limits and six periodic parents with zero network. Three figures read the saved outputs. Original papers, observations and application code are excluded.

Sources and calculation scope

  1. Dehnen (1999v1/2000), The Effect of the Outer Lindblad Resonance of the Galactic Bar on the Local Stellar Velocity Distribution

    Fixed 14-page astro-ph/9911161v1, all text read in parameter preflight; equation 3, section 3 and original orbital figures. The own model uses a fixed bar radius 0.5 and counterclockwise convention. The paper's historical Milky Way inference is not treated as a current measurement.

  2. Sellwood & Binney (2002), Radial mixing in galactic discs, astro-ph/0203510v2

    Fixed 13-page v2, complete original read; section 2 specific energy/action exchange and sections 3–4 transient self-gravitating waves. The paper's live-disk simulations are distinct from our prescribed external-bar release.

  3. Sandbox Physics independent galactic-bar scientific reader v1

    Own zero-network Python integration and saved-record analysis: one full 256-tracer population, ten independent DOP853 controls, exact circle/epicycle, prescribed-growth work, six fresh periodic roots and three own synthetic figures. No App, completed orbit input, original paper or observed data.

FeedbackSomething broken, confusing, or missing on this page?Tell us
What kind of feedback?

Sent with this page’s address, its Lab ID, the site language and your device type. Please leave out personal details. Feedback is kept for up to 12 months.Privacy policy