Skip to content

545 add cyclotron coasting and accelerating beam - #552

Open
aaadelmann wants to merge 38 commits into
masterfrom
545-add-cyclotron-coasting-beam
Open

545 add cyclotron coasting and accelerating beam#552
aaadelmann wants to merge 38 commits into
masterfrom
545-add-cyclotron-coasting-beam

Conversation

@aaadelmann

@aaadelmann aaadelmann commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

see #548

  • coasting and accelerated beam up to 590 MeV for the PSI Ring
  • match with old OPAL
  • single particle tracking
  • single rank
  • manual update
  • spectral tune calculation
  • [ ]

TUNE calculation PSI Ring

image

Acceleration PSI Ring

image

Expose validated map-only OPTION settings for six perturbation amplitudes, Richardson levels 0..4, and typed ray-integrator dispatch (Boris/LF2). Extrapolate centered segment maps before ordered composition and record effective settings and refinement diagnostics.

Advance host reference and shadow rays directly in metres, integrate signed path from speed, retain compensated position/time/path state through sampling and coordinate differences, and localize start/stop path targets by tracked bisection. Keep the Boris kick, boundary tolerances, production particle pusher and GPU kernels unchanged.

Preserve the full reproducible DBA DT/amplitude/level studies, stdout, input hashes, source snapshots, analytic all-36-entry comparisons, MPI repeats, plots and audit scripts. Across 385 configurations per baseline, small-amplitude robustness improves substantially but peak scaled max-entry accuracy changes from 7.48e-9 to 8.37e-9; this is not an accuracy-floor improvement. Defaults and numerical tolerances are unchanged.

Validation: 87/87 CTests; 20/20 focused tests on one and two MPI ranks; 12/12 Python study tests; four analytic optics regressions; 13 identical MPI map/diagnostic repeats; Doxygen and rendered manual formulas checked. Unrelated user input changes are excluded. Manual updates are committed separately in opalx-manual.
Extend the existing map integrator selector without changing the production particle pusher. Integrate the relativistic Lorentz equations and path length at each RK stage, preserve compensated position/time/path updates, and resolve field-support transitions independently for every ray.

Document the RK tableau, units, stage cost, fixed-DT behavior and lack of a symplecticity guarantee. Cover analytic relativistic helices and convergence order, time-dependent electric fields, reverse stepping, material hits, drift maps, support overlap and option isolation.

Validation: OPALX and TestOrbitThreader build; TestBendFieldModel and TestOrbitThreader CTest targets pass with OMP1. All 25 OrbitThreader cases also pass in a dedicated two-rank MPI run. These integrators are prerequisites for the recorded map-3 DBA comparison.
Publish the map-3 DBA input with HGAP=0.1 m, FINT=0.1, separated fringe supports and the existing unmatched quadrupole seed. Include analytic field profiles, all three single-rank integrator cases with stdout/timing/maps, source and artifact provenance, and the full 6x6 variational reference.

Separate distributed-field numerical errors from the CERN thin-edge approximation and document the current full-gap/half-gap convention mismatch without modifying fringe physics. Retain the original analysis scripts for historical hash verification; default replay uses the published settings without requiring private map-2 campaign paths.

Add the shared field-history parser and configurable map-options helper needed by the study. Keep intermediate experiments, HDF5 output, executables and unrelated sandbox changes out of the commit. Link the authoritative physics manual.

Validation: all 25 Python map-3 tests pass both in the worktree and an isolated export of the staged files, plus 4 SDDS parser tests. Recomputed full-map differences reproduce the recorded comparison; no numerical tolerances changed. Automated OPALX regression integration remains follow-up work.
Keep nominal lattice geometry, fringe-field support and travelled reference
path length distinct. Fringe fields may contribute inside a drift without
extending its nominal length or changing map ownership.

- Add nominal-body containment queries and partition transfer maps by body
  ownership, while retaining summed-field evaluation for all shadow rays.
- Record field contributors separately from map owners, including fringe
  fields in drifts and unowned intervals.
- Populate IndexMap from support-resolved reference steps and coalesce
  adjacent identical support sets without merging separate visits.
- Calculate RING design circumference recursively from nominal occurrence
  arc lengths, including drifts and repeated nested cells.
- Locate the same-direction return to the starting transverse plane using
  a bounded search, rather than stopping at the design circumference.
- Use the measured return length for IndexMap periodicity and reuse the
  entrance axes for the return map.
- Report design circumference, return length, position displacement and
  relative momentum mismatch.
- Resolve short nominal bodies in ray stepping and reject premature
  launch-plane crossings during map construction.
- Update Doxygen descriptions of ownership, field contributions and
  same-section return-map semantics.

Add unit coverage for circumference independence from fringe extent,
fringe contributions inside nominal drifts, cutoff convergence, circular
reference returns, missing-return failures and IndexMap coalescing.

This does not implement closed-orbit finding or change the native FINT
model. The independently observed finite-fringe DBA map discrepancy
remains unresolved.

Refs #546
Remove all 3345 sandbox paths from the repository index. These files were additions on this branch and are not present on master. Keep source, unit tests and other tracked files unchanged.

Ignore /sandbox/ to prevent local study inputs, generated output and exploratory work from being staged accidentally again.

Use index-only removal so local files and uncommitted edits remain intact. Verify the complete local sandbox path inventory and all 8927 file content hashes are unchanged.

This is a normal cleanup commit, not a history rewrite: earlier commits still retain their sandbox snapshots.
Extend RFCAVITY TYPE=SINGLEGAP with a separate radial voltage-profile model,
leaving continuous-field cavity tracking unchanged. Add strict profile loading,
cubic Hermite interpolation using supplied derivatives, and shared host/device
kick formulas for transit-time energy gain and legacy focusing. Document SI
geometry, phase conventions, and the retained legacy extra 2*pi focusing factor.

Add a deliberately scoped one-proton, one-container, one-rank event path in
ParallelTracker. Resolve directed offset-gap crossings with 40 Boris-substep
bisections, apply full impulses in chronological order, and track the remainder.
Use Cartesian element poses and spatial sector support rather than the nominal
closed-orbit index. Transform the particle's moving coordinates to/from the lab
frame and use the same integration routine for particle and reference.

Reject unsupported species/spin/restart/field-solver configurations. This is a
host event path, not a production multi-particle or GPU event implementation;
particle E/B diagnostic arrays are not populated. Keep CyclotronSector concrete
without adding a Rep class, consistent with the planned removal of Rep classes.

Provide isolated old-OPAL and OPALX first-turn generators/comparisons, original
accelerating input and voltage profiles, and compact validation summaries.
Original input uses obsolete inline trim syntax; adaptation follows the named
mirrored coil in cyclotron1.in. Historical trim equivalence remains to be checked
before relying on high-radius TC comparisons.

Validation (OpenMP CPU, one MPI rank; build -j 10):
- 72 -> 73.7423153 MeV with five expected RF kicks at DT/4 (10.283 ps).
- Maximum old-LF2 position difference decreases 0.758 -> 0.507 -> 0.186 um.
- Finest-step final energy difference -1.93 eV; particle/reference <12.1 pm.
- TestCyclotronRF (six cases), TestRFCavity, TestCyclotronSector and
  TestOrbitThreader pass; full coasting study retains 8.53 nm LF2 agreement.
- Kernel Doxygen validation and separately updated manual chapter renders pass.

Energy-target stopping and full acceleration to 590 MeV are the next milestone.
GPU execution, multi-particle event tracking and restart are not validated.

Refs #545
… 590 MeV

Extend TRACK with EKINSTOP in GeV, transferred internally in eV. Stop at
the first complete reference RF kick reaching the requested kinetic energy;
retain the physical overshoot and omit the remaining magnetic drift. Precompute
the reference terminal substep before advancing the bunch clock, then publish
it through the normal reference/frame update. Advance the physical particle
independently rather than substituting the reference state.

Require the non-restarted single-proton SINGLEGAP RING path, one positive DT
segment, a target above launch, and no explicit RUN TURNS. Keep MAXSTEPS a hard
safety budget and reject exhaustion or loss before target. Continue reporting
directed return-plane turns; suppress nominal-circumference progress for gaps.
The default disabled target preserves existing tracking behavior.

Extend reproducible one-rank old-OPAL/OPALX runners for full acceleration,
TC-off/on and matched fixed-step endpoints. Explicitly set old OPAL trim-coil
PHIMIN=0, PHIMAX=360: the installed 2022.1 constructor has no PHIMAX default
despite its help text. Preserve original inputs and do not modify old source.

72 -> 590 MeV results, 949 OPALX gap events in each endpoint comparison:
- No TC, 41.1319513 ps: old 590.325895173, new 590.326824538 MeV;
  +929.365 eV, 55.785 um final position difference.
- No TC, half DT: old 590.296910517, new 590.297352913 MeV;
  +442.396 eV, 26.682 um final position difference.
- Active TC, full DT: old 590.385013924, new 590.386116234 MeV;
  +1102.310 eV, 63.183 um final position difference.
- Particle/reference separation remains below 3.2 nm.

Compare coordinates at matched step endpoints, not the earlier EKINSTOP gap
time. Report empirical inter-code guards (1.5 keV, 100 um) separately from
absolute accuracy: old LF2 itself shifts 29 keV on halving DT. No asymptotic
order or active-TC convergence claim is made. Retain compact summaries and
sampled errors/energies; exclude large raw trajectories and generated plots.

Validation: build -j10; TestCyclotronSector, TestCyclotronRF, TestRFCavity and
TestOrbitThreader all pass; seven energy-stop rejection cases; positive short
and full energy-target runs; first accelerating turn unchanged at 0.758 um;
coasting DT refinement rerun with old-LF2 agreement 8.5256 nm; report guards
pass; RF-kernel Doxygen warnings-as-errors and git diff --check pass.

Expand Doxygen for cavity modes, units, stopping semantics and pending state.
User and physics chapters were also updated in the separate local manual repo,
validated and rendered (not published by this source commit).

Remaining scope: one unpolarized median-plane proton, one rank/container,
no restart or production GPU event path, E/B diagnostic arrays not populated.
No new Rep subclass, upstream dependency changes or numerical tolerance changes
to existing tests. Follow-up: active-TC timestep refinement/generalization.

Refs #545
@aaadelmann
aaadelmann requested a review from pecalvop September 6, 2026 07:01
@aaadelmann aaadelmann self-assigned this Sep 6, 2026
@aaadelmann aaadelmann added the Feature request Used to label a feature request in the issue tracker. label Sep 6, 2026
@aaadelmann aaadelmann linked an issue Sep 6, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature request Used to label a feature request in the issue tracker.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Cyclotron Modelling Capabilities

1 participant