Last active
March 12, 2022 11:59
-
-
Save tmiethlinger/a121fc1e2b025a85898d835052fc8da0 to your computer and use it in GitHub Desktop.
Relativistic kinetic energy from Smilei output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ekin(p_r, m_r = 1, to_MeV = True): | |
""" compute relativistic kinetic energy from Smilei momentum and mass | |
Parameters | |
---------- | |
p_r : float | |
particle momentum in reduced units. | |
m_r : float, optional | |
particle mass in reduced units, default value is hydrogen mass. | |
to_MeV : bool, optional | |
computes energy in MeV if true, otherwise in E_r (reduced energy units). | |
Returns | |
------- | |
ekin | |
relativistic kinetic energy, float. | |
""" | |
if to_MeV: | |
return (gamma(p_r, m_r) - 1) * m_r * 0.51122 | |
else: | |
return (gamma(p_r, m_r) - 1) * m_r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment