Skip to content

Add a Helmholtz solver to simulate FEL - #1404

Open
MaxThevenet wants to merge 157 commits into
Hi-PACE:developmentfrom
MaxThevenet:tst9
Open

MaxThevenet wants to merge 157 commits into
Hi-PACE:developmentfrom
MaxThevenet:tst9

Conversation

@MaxThevenet

@MaxThevenet MaxThevenet commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Warning: very early implementation

Adds a Helmholtz solver for the radiation field of a beam in an undulator, plus the beam push in the undulator and radiation fields. Two modes:

  • Envelope: complex slowly varying envelope, undulator-period-averaged beam push (FFT or multigrid solver).
  • FullWave: field resolved at the wavelength scale, electron wiggle resolved in the beam push (FFT solver).

When enabled (helmholtz.use_helmholtz = 1), the plasma/beam current deposition and Poisson solves are skipped.
Beamline elements (undulators, thick/thin quadrupoles, phase shifters) are set per beam and applied by the Helmholtz pusher.

Main changes

  • src/helmholtz/Helmholtz.{H,cpp} (new): field slices and geometry, Envelope/FullWave solvers, initialization, in-situ diagnostics.
  • src/particles/deposition/HelmholtzDeposition.{H,cpp} (new): beam source deposition onto the Helmholtz grid. In envelope mode, arrays jx, jz and rho are hacked and contain refraction and source terms of the Helmholtz envelope.
  • src/particles/pusher/HelmholtzParticleAdvance.{H,cpp} (new): beam push with undulator, quadrupoles, phase shifters and radiation field. Shared pusher helpers moved to BeamParticleAdvance.H.
  • src/particles/beam/{BeamParticleContainer,MultiBeam}.*: parsing of beamline elements, <beam>.output_ids, beams.tstart_push, pusher dispatch.
  • src/Hipace.cpp, src/utils/MultiBuffer.*: integration in the slice loop and MPI transfer of the Helmholtz slices.
  • src/diagnostics/*, src/fields/Fields.cpp: helmholtz_diag field diagnostic.
  • examples/helmholtz, tests/helmholtz.2Rank.sh (new CI test, both modes, compared with Genesis), docs/.../parameters.rst.

Notes

  • The CI test uses lower resolution than recommended (see comments in examples/helmholtz/inputs).
  • Envelope mode currently has no natural vertical (y) undulator focusing in the beam push; to be added in a follow-up.
  • Some open questions are left as comments in HelmholtzParticleAdvance.cpp (e.g. which time level of the field to push with); to be revisited after merge.

@MaxThevenet MaxThevenet changed the title Tst Add a Helmholtz solver to simulate FEL Oct 16, 2026
Comment thread src/particles/beam/BeamParticleContainer.cpp
Comment thread src/particles/beam/BeamParticleContainer.cpp
Comment thread src/helmholtz/Helmholtz.cpp Outdated
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.

2 participants