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

Inputs: Rename to Kinetic Beam Energy #446

Merged
merged 5 commits into from
Nov 3, 2023

Conversation

ax3l
Copy link
Member

@ax3l ax3l commented Oct 20, 2023

Rename the inputs:

  • AMReX inputs file: beam.energy -> beam.kin_energy
  • Python: set_kin_energy_MeV -> set_kin_energy_MeV

for clarity.

Spotted and fixed an issue in our MAD-X reader, which forgot to add the rest mass. Fixes a few examples.

Follow-up to #444

Close #435

@ax3l ax3l added component: documentation Docs, readme and manual enhancement New feature or request changes input scripts / defaults Changes the syntax or meaning of input scripts and/or defaults labels Oct 20, 2023
@ax3l ax3l requested a review from cemitch99 October 20, 2023 17:14
@ax3l ax3l changed the title Rename set kin energy Inputs: Rename to Kinetic Beam Energy Oct 20, 2023
@ax3l ax3l force-pushed the rename-set-kin-energy branch from dd3e139 to 22d98bc Compare October 20, 2023 17:15
@ax3l ax3l force-pushed the rename-set-kin-energy branch from 22d98bc to 10015d0 Compare October 20, 2023 17:30
@ax3l ax3l requested a review from n01r October 20, 2023 17:31
@ax3l ax3l added component: python Python bindings component: tests examples, tests and benchmarks component: distributions beam distributions labels Oct 20, 2023
@@ -192,6 +192,6 @@ def read_beam(ref: RefPart, madx_file):

ref.set_charge_qe(ref_particle_dict["charge"])
ref.set_mass_MeV(ref_particle_dict["mass"])
ref.set_energy_MeV(ref_particle_dict["energy"])
ref.set_kin_energy_MeV(ref_particle_dict["energy"] - ref_particle_dict["mass"])
Copy link
Member Author

@ax3l ax3l Oct 20, 2023

Choose a reason for hiding this comment

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

This is a bug-fix for low-energy particles in MAD-X files.
MAD-X specifies total particle energy in GeV.

energy_MeV = 1e3 # reference energy
energy_gamma = energy_MeV / 0.510998950
kin_energy_MeV = 1e3 # reference energy
energy_gamma = kin_energy_MeV / 0.510998950 + 1.0
Copy link
Member Author

@ax3l ax3l Oct 20, 2023

Choose a reason for hiding this comment

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

Since this test uses 1 GeV electrons, this is a tiny sub-percentage precision fix and has no big influence for the reference particle energy used here. Mainly added for clarity for readers that might want to use it as a template and might adjust it to lower energies.

@ax3l ax3l requested a review from RTSandberg October 20, 2023 17:33
@ax3l ax3l added bug Something isn't working bug: affects latest release Bug also exists in latest release version labels Oct 20, 2023
Total energy, not kinetic energy.
@ax3l ax3l force-pushed the rename-set-kin-energy branch from 7084579 to 6b403c5 Compare October 20, 2023 17:56
@@ -1,4 +1,4 @@
beam, particle=proton, energy=0.250;
beam, particle=proton, energy=1.188272;
Copy link
Member Author

Choose a reason for hiding this comment

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

Fix: Added proton rest mass to MAD-X file.

Copy link
Member

Choose a reason for hiding this comment

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

I take it this is the bug that you mentioned. Here "energy" was modified to give the total energy in GeV (as required by MAD-X).

Copy link
Member Author

Choose a reason for hiding this comment

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

That's it, yes :)

@ax3l
Copy link
Member Author

ax3l commented Oct 29, 2023

@cemitch99 let me know if you are ok if we merge this. It's a small change, but better explicit than sorry, I think.

Copy link
Member

@cemitch99 cemitch99 left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks.

@ax3l ax3l merged commit 658e5d3 into ECP-WarpX:development Nov 3, 2023
13 checks passed
@ax3l ax3l deleted the rename-set-kin-energy branch November 3, 2023 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: affects latest release Bug also exists in latest release version bug Something isn't working changes input scripts / defaults Changes the syntax or meaning of input scripts and/or defaults component: distributions beam distributions component: documentation Docs, readme and manual component: python Python bindings component: tests examples, tests and benchmarks enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check handling of low-energy beams
2 participants