Skip to content

Conversation

@qianglbl
Copy link
Member

@qianglbl qianglbl commented Sep 5, 2025

add SC kicks from a 3D Gaussian density distribution.

Checklist

  • implementation
  • documented test
    • inputs
    • python
    • finish analysis script
  • user-facing docs of new options
  • GPU support (fuse loops, avoid temporary arrays)
  • assert the input option in unsupported modes (e.g., envelope & reference particle tracking)

Follow-Up PRs

  • expose the nint parameter and pick a good (fast and precise enough) default (e.g., 50? 100?)
  • potentially revisit numerics if we can evaluate this set of equations more efficiently than Simpson integration (@cemitch99 had some ideas)
  • add a Gauss 2.5D model (@qianglbl's idea to do next)
  • add another example (similar to existing Kurth channel or FODO+RF examples)

@qianglbl qianglbl requested review from ax3l and cemitch99 September 5, 2025 21:36
@ax3l ax3l changed the title Topic gauss3d Gauss 3D Space Charge Pusher Sep 5, 2025
@ax3l ax3l added component: space charge Space charge & potential solver tracking: particles labels Sep 8, 2025
@ax3l ax3l mentioned this pull request Sep 15, 2025
amrex::ParticleReal & AMREX_RESTRICT pz = part_pz[i];

//field integrals from a 3D Gaussian bunch
int const nint = 401;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the integration, do you want to make the integration steps nint user configurable or is 401 a generally good number for everything?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and its a bit slow. We probably want to relax the default value a bit and expose it to the user.

* ``"Gauss3D"`: Calculate 3D space charge forces as if the beam was a Gaussian distribution.
This model is supported only in particle tracking mode (when ``algo.track = "particles"``).
Ref.: J. Qiang et al., "Two-and-a-half dimensional symplectic space-charge solver", LBNL Report Number: LBNL-2001674 (2025).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you already have a link / DOI for the paper? I cannot find it on google scholar yet.

- avoid temporary arrays
- integrate in one go
Only used for particles.
Ref orbit asserts well, too.
Copy link
Member

@cemitch99 cemitch99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks.

@cemitch99
Copy link
Member

This looks ready to me. I will do a follow-up adding another example or two.

@cemitch99 cemitch99 enabled auto-merge (squash) September 18, 2025 22:45
@cemitch99 cemitch99 merged commit fa4c54d into BLAST-ImpactX:development Sep 18, 2025
16 checks passed
Comment on lines +97 to +99
pintex = sum0ex / 3_prt;
pintey = sum0ey / 3_prt;
pintez = sum0ez / 3_prt;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs an end-point correction. Fixed in #1168

Comment on lines +134 to +136
amrex::ParticleReal const push_consts = dt * charge * inv_gamma2 / pz_ref_SI
* 2_prt * asp * (sigx * sigx * sigz * std::sqrt(2_prt * pi))
* bchchg * rfpiepslon;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need a separate constant per x,y,z, which I accidentally removed when refactoring.

Fixed in #1168

This was referenced Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: space charge Space charge & potential solver tracking: particles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants