-
Notifications
You must be signed in to change notification settings - Fork 17
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
Plasma in-situ diags #968
Plasma in-situ diags #968
Conversation
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.
Thanks for this PR! See suggestions & comments below.
tools/read_insitu_diagnostics.py
Outdated
def temperature_in_ev_x(all_data, per_slice=True): | ||
if per_slice: | ||
if all_data["is_normalized_units"][0]: | ||
return (constants.m_e * constants.c**2 / constants.e) * normalized_momentum_std_x(all_data)**2 * np.atleast_2d(all_data["mass"]).T | ||
else: | ||
return (constants.c**2 / constants.e) * normalized_momentum_std_x(all_data)**2 * np.atleast_2d(all_data["mass"]).T | ||
else: | ||
if all_data["is_normalized_units"][0]: | ||
return (constants.m_e * constants.c**2 / constants.e) * normalized_momentum_std_x(all_data["average"])**2 * all_data["mass"] | ||
else: | ||
return (constants.c**2 / constants.e) * normalized_momentum_std_x(all_data["average"])**2 * all_data["mass"] | ||
|
||
def temperature_in_ev_y(all_data, per_slice=True): | ||
if per_slice: | ||
if all_data["is_normalized_units"][0]: | ||
return (constants.m_e * constants.c**2 / constants.e) * normalized_momentum_std_y(all_data)**2 * np.atleast_2d(all_data["mass"]).T | ||
else: | ||
return (constants.c**2 / constants.e) * normalized_momentum_std_y(all_data)**2 * np.atleast_2d(all_data["mass"]).T | ||
else: | ||
if all_data["is_normalized_units"][0]: | ||
return (constants.m_e * constants.c**2 / constants.e) * normalized_momentum_std_y(all_data["average"])**2 * all_data["mass"] | ||
else: | ||
return (constants.c**2 / constants.e) * normalized_momentum_std_y(all_data["average"])**2 * all_data["mass"] | ||
|
||
def temperature_in_ev_z(all_data, per_slice=True): | ||
if per_slice: | ||
if all_data["is_normalized_units"][0]: | ||
return (constants.m_e * constants.c**2 / constants.e) * normalized_momentum_std_z(all_data)**2 * np.atleast_2d(all_data["mass"]).T | ||
else: | ||
return (constants.c**2 / constants.e) * normalized_momentum_std_z(all_data)**2 * np.atleast_2d(all_data["mass"]).T | ||
else: | ||
if all_data["is_normalized_units"][0]: | ||
return (constants.m_e * constants.c**2 / constants.e) * normalized_momentum_std_z(all_data["average"])**2 * all_data["mass"] | ||
else: | ||
return (constants.c**2 / constants.e) * normalized_momentum_std_z(all_data["average"])**2 * all_data["mass"] | ||
|
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.
Could you merge these 3 with a new mandatory input parameter? Maybe define a function normalized_momentum_std
that is a copy of _x
or _y
etc. depending on the direction, and then have the cumbersome piece of code only once?
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.
Tried to clean it, please have a look (best use split screen, otherwise it is awful to look at)
Co-authored-by: Maxence Thévenet <[email protected]>
#ifdef HIPACE_USE_OPENPMD | ||
// create subdirectory | ||
openPMD::auxiliary::create_directories(m_insitu_file_prefix); | ||
#endif |
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 we need openPMD::auxiliary
|
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.
Looks great, thanks!
This PR adds plasma in-situ diagnostics. They can be used to calculate e.g., the temperature evolution of the plasma.
I also refactored the documentation on in-situ diagnostics a little bit.
const
isconst
)