-
Notifications
You must be signed in to change notification settings - Fork 31
2.5 Space Charge in Particle Tracking #1214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
2.5 Space Charge in Particle Tracking #1214
Conversation
|
I'm reconsidering this approach now. The number of places where we need to replace |
| amrex::Real * beam_profile_slope = nullptr; | ||
| int num_bins = 129; | ||
|
|
||
| [[maybe_unused]] auto const [x_min, y_min, t_min, x_max, y_max, t_max] = |
Check notice
Code scanning / CodeQL
Unused local variable Note
| amrex::Real * beam_profile_slope = nullptr; | ||
| int num_bins = 129; | ||
|
|
||
| [[maybe_unused]] auto const [x_min, y_min, t_min, x_max, y_max, t_max] = |
Check notice
Code scanning / CodeQL
Unused local variable Note
| amrex::Real * beam_profile_slope = nullptr; | ||
| int num_bins = 129; | ||
|
|
||
| [[maybe_unused]] auto const [x_min, y_min, t_min, x_max, y_max, t_max] = |
Check notice
Code scanning / CodeQL
Unused local variable Note
| amrex::Real * beam_profile_slope = nullptr; | ||
| int num_bins = 129; | ||
|
|
||
| [[maybe_unused]] auto const [x_min, y_min, t_min, x_max, y_max, t_max] = |
Check notice
Code scanning / CodeQL
Unused local variable Note
| amrex::Real * beam_profile = nullptr; | ||
| amrex::Real * beam_profile_slope = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allocate the profiles here. Note that _slope is num_bins or so and the charge is num_bins + 1.
| amrex::Real * beam_profile = nullptr; | |
| amrex::Real * beam_profile_slope = nullptr; | |
| amrex::Gpu::DeviceVector<amrex::Real> beam_profile(num_bins + 1, 0.0); | |
| amrex::Gpu::DeviceVector<amrex::Real> beam_profile_slope(num_bins, 0.0); |
|
|
||
| if (space_charge == SpaceChargeAlgo::True_2p5D) { | ||
|
|
||
| Deposit1D ( pc, beam_profile, beam_profile_slope, bin_min, bin_max, num_bins); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Deposit1D ( pc, beam_profile, beam_profile_slope, bin_min, bin_max, num_bins); | |
| Deposit1D( pc, beam_profile, beam_profile_slope, bin_min, bin_max, num_bins); |
| { | ||
| BL_PROFILE("impactx::spacecharge::Deposit1D"); | ||
|
|
||
| using namespace amrex::literals; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's always assert here that beam_profile.size() is +1 of beam_profile_slope.size()
| [[maybe_unused]] amrex::Real * beam_profile, | ||
| [[maybe_unused]] amrex::Real * beam_profile_slope, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's pass a amrex::Gpu::DeviceVector<amrex::Real> by reference & here for each array.
Omit num_bins and take it from beam_profile_slope.size()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better: pass no arrays and just return the profile array and bin_size.
Let's do the one-liner for slope calc afterwards, it is safe and not part of deposit.
| ablastr::particles::doGatherVectorFieldNodal<2>( | ||
| x, y, z, | ||
| scf_arr_x, scf_arr_y, scf_arr_z, | ||
| invdr, | ||
| prob_lo_2D | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After passing also m_phi by reference into GatherAndPush (...):
| ablastr::particles::doGatherVectorFieldNodal<2>( | |
| x, y, z, | |
| scf_arr_x, scf_arr_y, scf_arr_z, | |
| invdr, | |
| prob_lo_2D | |
| ); | |
| ablastr::particles::doGatherScalarFieldNodal<2>( | |
| x, y, z, | |
| phi_arr, | |
| invdr, | |
| prob_lo_2D | |
| ); |
This PR adds a 2.5D Space Charge model for particle tracking, using a 2D Poisson solve (in the transverse variables X,Y) with current weighting along the longitudinal direction within the bunch. This addresses the final part of #401, and is a follow-up to #909 .