-
Notifications
You must be signed in to change notification settings - Fork 29
Implement Strang splitting with space charge #920
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?
Changes from 6 commits
a0017d2
6eaf2e3
17bfdf1
2e09182
4ea732d
0dcea99
d1c69a5
dcae328
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,7 +98,7 @@ def read_time_series(file_pattern): | |
| ) | ||
|
|
||
| atol = 0.0 # ignored | ||
| rtol = 2.0e-3 # from random sampling of a smooth distribution | ||
| rtol = 3.5e-3 # from random sampling of a smooth distribution | ||
| print(f" rtol={rtol} (ignored: atol~={atol})") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original tolerance was too tight. |
||
|
|
||
| assert np.allclose( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,7 +137,8 @@ namespace impactx | |
| }, element_variant); | ||
|
|
||
| // sub-steps for space charge within the element | ||
| for (int slice_step = 0; slice_step < nslice; ++slice_step) | ||
| int nsteps = std::floor(nslice/2.0); | ||
cemitch99 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| for (int slice_step = 0; slice_step < nsteps; ++slice_step) | ||
| { | ||
| BL_PROFILE("ImpactX::track_envelope::slice_step"); | ||
| step++; | ||
|
|
@@ -147,14 +148,27 @@ namespace impactx | |
| << " slice_step=" << slice_step << "\n"; | ||
| } | ||
|
|
||
| std::visit([&ref, &cm](auto&& element) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the reference particle pushed twice now? o.0 Happens again in line 176 below There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarified in person:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have to make sure that thin elements, which only go through this loop body once, are still only kicked once though. |
||
| { | ||
| // push reference particle in global coordinates | ||
| { | ||
| BL_PROFILE("impactx::Push::RefPart"); | ||
| element(ref); | ||
| } | ||
|
|
||
| // push Covariance Matrix in external fields | ||
| element(cm, ref); | ||
|
|
||
| }, element_variant); | ||
|
|
||
| if (space_charge == SpaceChargeAlgo::True_2D) | ||
| { | ||
| // push Covariance Matrix in 2D space charge fields | ||
| envelope::spacecharge::space_charge2D_push(ref, cm, intensity, slice_ds); | ||
| envelope::spacecharge::space_charge2D_push(ref, cm, intensity, 2*slice_ds); | ||
| } else if (space_charge == SpaceChargeAlgo::True_3D) | ||
| { | ||
| // push Covariance Matrix in 3D space charge fields | ||
| envelope::spacecharge::space_charge3D_push(ref, cm, intensity, slice_ds); | ||
| envelope::spacecharge::space_charge3D_push(ref, cm, intensity, 2*slice_ds); | ||
| } else { | ||
| amrex::Print() << "Warning: Space charge is off by default." << "\n"; | ||
| } | ||
|
|
||
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.
Here the targets were tuned to analytically-determined values, instead of being set to coincide with a low-resolution run.