Skip to content
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

Added examples for 3D space charge benchmarking. #141

Merged
merged 18 commits into from
Dec 22, 2022

Conversation

cemitch99
Copy link
Member

@cemitch99 cemitch99 commented Jun 9, 2022

  • depends on Space Charge Solver #162
  • adjust resolution via amr.n_cell and geometry.prob_relative
  • add Python equivalent inputs

The following examples were added to test 3D space charge:

  1. A constant focusing channel with an intense waterbag (6D) beam - beam is rms-matched and second moments should be well-preserved.
  2. A constant focusing channel with an intense Kurth (6D) beam - beam is rms-matched and distribution should be fully stationary.
  3. A periodic focusing channel with an intense Kurth (6D) beam - beam is rms-matched and distribution should vary with the periodicity of the lattice.

Corresponding to 3), an example was added for the same lattice, but without space charge:

  1. A periodic focusing channel with an zero-charge Kurth (6D) beam - beam is rms-matched and distribution should vary with the periodicity of the lattice.

Follow-ups commits:

  • Add example documentation (partially complete).
  • Add example using a FODO lattice + short rf cavities.

@cemitch99 cemitch99 requested review from ax3l and qianglbl June 9, 2022 00:29
@cemitch99 cemitch99 changed the title Modified the initial beam size in the IOTA lens benchmark example. Added 2 examples for initial 3D space charge benchmarking. Jun 9, 2022
@cemitch99 cemitch99 changed the title Added 2 examples for initial 3D space charge benchmarking. Added examples for initial 3D space charge benchmarking. Jun 14, 2022
@cemitch99 cemitch99 changed the title Added examples for initial 3D space charge benchmarking. Added examples for 3D space charge benchmarking. Jun 14, 2022
@ax3l ax3l added the component: tests examples, tests and benchmarks label Jun 15, 2022
@ax3l
Copy link
Member

ax3l commented Jun 15, 2022

Thanks a lot, @cemitch99 !

Do we need to increase tolerances for these tests? I think they should fail as long as space charge is not enabled, right?

@cemitch99
Copy link
Member Author

Thanks a lot, @cemitch99 !

Do we need to increase tolerances for these tests? I think they should fail as long as space charge is not enabled, right?

Yes, they should fail if space charge is not enabled. I will modify the tolerances now.

@ax3l
Copy link
Member

ax3l commented Jun 16, 2022

Thanks. Looks like we need to be even stricter :)

@ax3l ax3l mentioned this pull request Aug 10, 2022
20 tasks
@ax3l ax3l force-pushed the add_spacecharge_benchmarks branch from 27f79c5 to b73defc Compare August 31, 2022 22:44
@ax3l ax3l force-pushed the add_spacecharge_benchmarks branch 4 times, most recently from 207c193 to 051a4e8 Compare September 16, 2022 00:28
@ax3l
Copy link
Member

ax3l commented Sep 16, 2022

Hi @cemitch99, can you please check if the updates make sense?

I think there is a 4. th test (another Kurth addition) that is not mentioned in the PR description yet. Can you also check all 4 Kurth tests are also described in the README.rst of Kurth? I think that section is not too clear to me yet.

@ax3l ax3l force-pushed the add_spacecharge_benchmarks branch 5 times, most recently from 365b45d to 261f32e Compare September 16, 2022 01:49
@ax3l ax3l added the component: space charge Space charge & potential solver label Sep 19, 2022
@ax3l ax3l force-pushed the add_spacecharge_benchmarks branch 2 times, most recently from b7285a9 to 20b6b65 Compare September 20, 2022 17:07
- Modified the initial beam size in the IOTA lens benchmark example.
- Added 2 benchmarks of 3D space charge for initial testing.
- Add documentation for 2 benchmarks with space charge.
- Add a benchmark example with space charge and periodic s-dependent focusing.
- Added an s-dependent example using a Kurth beam without space charge.
- Modified tolerance for IOTA lens benchmark example.
  Reduced tolerance to account for smaller initial beam size and
  improved preservation of invariants of motion.
- Modified tolerances of space charge examples to allow CI tests to
  pass when space charge is not active.

- Modified tolerance for space charge examples.
  These should fail unless space charge is turned on.
@ax3l ax3l force-pushed the add_spacecharge_benchmarks branch from 20b6b65 to cd84186 Compare September 20, 2022 17:10
Modified tolerance slightly
Selected amr.n_cell, lattice.nslice parameters, and geometry.prob_relative parameters.
Added nonzero charge.  However, this is not a space charge test.  It is, rather, another distribution/lattice test.  It should be run algo.space_charge = false.
Modified tolerance slightly.
Added appropriate numerical parameters for amr.n_cell, lattice.nslice, and geometry.prob_relative.
1) Improved the accuracy of the target values used for analysis, 2) modified the tolerance slightly
Improved the accuracy of the target values.
Selected numerical values for amr.n_cell, lattice.nslice, and geometry.prob_relative.
Modified the tolerance slightly.
@ax3l
Copy link
Member

ax3l commented Dec 20, 2022

Hi @cemitch99,

I prepared the branch so far and we just need to make the tolerances a bit more strict I think.
These tests pass even if space-charge is off

  • cfchannel_spacecharge.analysis
  • kurth_periodic.analysis (update: ah, has no space charge)

The other two are good: fail if space charge is off and pass if turned on :)

Tightened the tolerance.  This test should pass if space charge is OFF, and fail is space charge is ON.
Increased the default charge to match the value in input_kurth_10nC_periodic.in.  This test should be run with space charge OFF.  If it is run with space charge ON, then it will fail with large error.
@@ -35,3 +32,6 @@ constf1.kt = 1.0
###############################################################################
algo.particle_shape = 2
algo.space_charge = false

amr.n_cell = 40 40 32
geometry.prob_relative = 1.0
Copy link
Member Author

@cemitch99 cemitch99 Dec 21, 2022

Choose a reason for hiding this comment

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

The above test, "input_kurth.in", uses only a Kurth distribution and a constant focusing element (without space charge), features that are already tested elsewhere. I suggest that this test can be removed to save time. The two important Kurth tests are "input_kurth_periodic.in" (without space charge) and "input_kurth_10nC_periodic.in" (with space charge).

Copy link
Member

@ax3l ax3l Dec 22, 2022

Choose a reason for hiding this comment

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

I agree - thanks for the update, I will add one more push that removes input_kurth.in :)


amr.n_cell = 48 48 40
#amr.n_cell = 72 72 72 #optional for increased precision
geometry.prob_relative = 1.0
Copy link
Member Author

@cemitch99 cemitch99 Dec 21, 2022

Choose a reason for hiding this comment

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

The above test, "input_kurth_10nC.in", uses only a Kurth distribution and a constant focusing element (with space charge), features that are already tested elsewhere. I suggest that this test can be removed to save time. The two important Kurth tests are "input_kurth_periodic.in" (without space charge) and "input_kurth_10nC_periodic.in" (with space charge).

Copy link
Member

Choose a reason for hiding this comment

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

I agree - thanks for the update, I will add one more push that removes input_kurth_10nC.in :)

Modified documentation of the relevant benchmarks tests using the Kurth distribution, "input_kurth_periodic.in" and "input_kurth_10nC_periodic.in".  (One without space charge, and one with space charge.)

# w/ space charge
add_impactx_test(kurth_10nC
examples/kurth/input_kurth_10nC.in
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggest that the test here, corresponding to "input_kurth_10nC.in", can be removed since the previous test "input_kurth_10nC_periodic.in" is more comprehensive.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks - removed :)

@ax3l ax3l self-assigned this Dec 22, 2022
@ax3l ax3l merged commit 1e7cddc into BLAST-ImpactX:development Dec 22, 2022
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 component: tests examples, tests and benchmarks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants