Skip to content

fix: correct higher multipole field components - #194

Open
zhaozhiwen wants to merge 1 commit into
gemc:mainfrom
zhaozhiwen:fix/185-quadrupole-field
Open

zhaozhiwen wants to merge 1 commit into
gemc:mainfrom
zhaozhiwen:fix/185-quadrupole-field

Conversation

@zhaozhiwen

Copy link
Copy Markdown
Collaborator

Fix quadrupole and higher multipole field components

The multipole plugin returned the radial quadrupole field (Gx, Gy, 0), which has nonzero divergence and does not respond to roll. Use the normal higher-multipole component convention so the quadrupole returns (Gy, Gx, 0). Preserve the existing dipole direction, uniform longitudinal mode, unit parsing, and coordinate transforms.

Add a regression that loads the real field plugin and checks independent quadrupole/sextupole reference vectors, X/Y/Z axes, displaced origin, roll, divergence/curl, and dipole/longitudinal compatibility.

Validation:

  • New regression failed on the original code with incorrect vectors and nonzero divergence/curl.
  • All 11 affected field tests pass after the correction, including the existing field random-state test and ASCII map examples/queries.
  • Original GEMC field query now gives Bx=0, By=10 G at (1 mm, 0, 0) for the 1-T-at-1-m quadrupole; a 45-degree roll gives Bx=-10 G.
  • Independent read-only review found no actionable issues.
  • Environment: baseline db22b3c1, AlmaLinux 10.2, GCC 14.3.1, Geant4 11.4.3, Meson 1.12.1.

The broader source-example sweep has a separately recorded baseline of 19/32 passing, including missing geometry/setup failures. This change validates the affected field module and does not claim a clean full-project suite.

Closes #185.

Verification on 2026-11-15: all 44 selected affected regressions passed again on the combined nine-fix source. Each issue also has a separate failing-original/passing-fixed regression. These PR branches each contain only their own fix; shared-file conflicts may need resolving as other fixes merge. No clean full-project-suite claim: the broader source-example baseline remains 19/32, with no newly failing examples in the combined sweep.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quadrupole component convention produces a nonzero magnetic divergence

1 participant