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

Adding EPAC2004 space charge benchmarks #422

Merged
merged 97 commits into from
Jan 3, 2024

Conversation

cemitch99
Copy link
Member

@cemitch99 cemitch99 commented Aug 28, 2023

Adding the space charge benchmark problems from:

R. D. Ryne et al, "A Test Suite of Space-Charge Problems for Code Benchmarking," in proceedings of EPAC2004, Lucerne, Switzerland, p. 1942 (2004).

Some of these are already implemented. The following need to be added:

  • Add FODO+RF space charge benchmark.
  • Add Python equivalent.
  • Add generation of a stationary thermal/bi-thermal distribution:
  • Implement numerical integrator for radial CDF
  • Implement phase space particle sampling via CDF
  • Implement exchange of data
  • Add stationary thermal CF benchmark.
  • Add stationary bi-thermal CF benchmark.
  • Add Python equivalents + CI.
  • Update documentation.

Plot for bithermal test (full resolution):
bithermal

cemitch99 and others added 4 commits August 28, 2023 09:28
- 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.
Selected numerical values for amr.n_cell, lattice.nslice, and geometry.prob_relative.
Not part of this PR.
@ax3l ax3l added component: tests examples, tests and benchmarks component: space charge Space charge & potential solver labels Aug 28, 2023
src/particles/distribution/Thermal.H Fixed Show fixed Hide fixed
src/particles/distribution/Thermal.H Fixed Show fixed Hide fixed
src/initialization/InitDistribution.cpp Fixed Show fixed Hide fixed
src/particles/distribution/Thermal.H Fixed Show fixed Hide fixed
Comment on lines +159 to +164
/* comment in for debugging
amrex::PrintToFile("density1.out") << reval << " " << data.f1 << "\n";
amrex::PrintToFile("density2.out") << reval << " " << data.f2 << "\n";
amrex::PrintToFile("phi1.out") << reval << " " << data.phi1 << "\n";
amrex::PrintToFile("phi2.out") << reval << " " << data.phi2 << "\n";
*/

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
amrex::ParticleReal r_scale = matched_scale_radius(data);
amrex::ParticleReal rmin = rin*r_scale;
amrex::ParticleReal rmax = rout*r_scale;
// amrex::PrintToFile("equilibrium_params.out") << r_scale << " " << data.Cintensity << "\n";

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
src/particles/distribution/Thermal.H Fixed Show fixed Hide fixed
amrex::ParticleReal rmin = m_data.rmin;
amrex::ParticleReal rmax = m_data.rmax;
int const nbins = m_data.nbins;
constexpr int length = 2001; // Ideally, int const length = nbins + 1;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Comment on lines +217 to +218
// amrex::ParticleReal Pdensity_tot = (1.0_prt-w)*Pdensity1 + w*Pdensity2;
// amrex::PrintToFile("Pdensity.out") << reval << " " << Pdensity_tot << "\n";

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Avoid GnuPlot dependency.
Comment on lines 246 to 247
* ``beam.kT`` (``float``, dimensionless) temperature of core population
* ``beam.kT_halo`` (``float``, dimensionless, default ``kT``) temperature of halo population
Copy link
Member

Choose a reason for hiding this comment

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

@cemitch99 what is the temperature normalized to? The energy of the reference particle?

Copy link
Member Author

Choose a reason for hiding this comment

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

Here kT = <(px/p0)^2> = <(py/p0)^2>, where p0 is the momentum of the reference particle.

Copy link
Member

Choose a reason for hiding this comment

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

Shall we add this detail to the doc strings?

Comment on lines +248 to +249
* ``beam.normalize`` (``float``, dimensionless) normalizing constant for core population
* ``beam.normalize_halo`` (``float``, dimensionless) normalizing constant for halo population
Copy link
Member

Choose a reason for hiding this comment

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

What is this normalizing constant used for and what is a good default value of this? 1.0?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, a good default value is 1.0. The explanation of this constant is too complex to provide here. I will think about how best to document this.

src/python/distribution.cpp Outdated Show resolved Hide resolved
src/particles/distribution/Thermal.H Outdated Show resolved Hide resolved
src/particles/distribution/Thermal.H Outdated Show resolved Hide resolved
src/particles/distribution/Thermal.H Outdated Show resolved Hide resolved
@ax3l ax3l mentioned this pull request Jan 2, 2024
@ax3l ax3l enabled auto-merge (squash) January 3, 2024 20:00
@ax3l ax3l merged commit effab38 into ECP-WarpX:development Jan 3, 2024
15 checks passed
@ax3l ax3l mentioned this pull request Feb 3, 2024
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