Skip to content

Conversation

@MarkusSQ
Copy link

@MarkusSQ MarkusSQ commented Oct 9, 2025

Description

fix:replace_spacecharge_with_PIC now creates PICCollection with longitudinal kick by default for FFTSolver3D

Added apply_z_kick parameter to replace_spacecharge_with_PIC. Added logic so that if solver is FFTSolver3D and no apply_z_kick parameter value is specified when calling replace_spacecharge_with_PIC, apply_z_kick is set to True when creating PICCollection.

Previously, PICCollection and therefore the line object's SpaceCharge3D elements would always be created with apply_z_kick as False when calling replace_spacecharge_with_PIC even with solver=FFTSolver3D. In other words, no longitudinal kick would be deposited regardless of specified solver. This change aims to fix that.

If the user really wants to use solver=FFTSolver3D with apply_z_kick=False then that is possible by explicitly specifying apply_z_kick=False when calling replace_spacecharge_with_PIC.

Checklist

Mandatory:

  • I have added tests to cover my changes
  • All the tests are passing, including my new ones
  • I described my changes in this PR description

Optional:

  • The code I wrote follows good style practices (see PEP 8 and PEP 20).
  • I have updated the docs in relation to my changes, if applicable
  • I have tested also GPU contexts

…ongitudinal kick for 'FFTSolver3D'

Added 'apply_z_kick' parameter to 'replace_spacecharge_with_PIC'. Added logic so that if solver is 'FFTSolver3D' and no 'apply_z_kick' parameter value is specified, 'apply_z_kick' is set to True when creating 'PICCollection'. Previously, PICCollection would always be created with 'apply_z_kick' as False even when using 'FFTSolver3D', and therefore no longitudinal kick would be deposited.
Copy link
Contributor

@szymonlopaciuk szymonlopaciuk left a comment

Choose a reason for hiding this comment

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

Thanks for the bug fix with a test! Looks good to me

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