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

usage of plot_filter_function(t,x,y,z,ux,uy,uz) #1574

Closed
hightower8083 opened this issue Dec 15, 2020 · 5 comments · Fixed by #1598
Closed

usage of plot_filter_function(t,x,y,z,ux,uy,uz) #1574

hightower8083 opened this issue Dec 15, 2020 · 5 comments · Fixed by #1598
Assignees
Labels
bug: affects latest release Bug also exists in latest release version bug Something isn't working component: diagnostics all types of outputs

Comments

@hightower8083
Copy link
Contributor

dear devs

I've a problem with the plot_filter_function(t,x,y,z,ux,uy,uz) in a 3D case (multi-GPU) with plotfile diagnostics backend.
By no means I could not make it work for a simple filter (uz>1.5) -- it writes no particles at all..
Here is a piece of the input file

diagnostics.diags_names = diag1
diag1.diag_type = Full
diag1.format = plotfile
diag1.period = 4000
diag1.fields_to_plot = Ex Ez rho
diag1.species = electrons
diag1.electrons.variables = ux uy uz w
diag1.electrons.plot_filter_function(t,x,y,z,ux,uy,uz) = (uz>1.5)

Just in case, i've also tried SI units instead of normalized, i.e. replace (uz>1.5) with (uz>4.0963867961067354e-22), but still no particles were written..

Can someone provide a working case for debugging..?

@ax3l ax3l added the component: diagnostics all types of outputs label Dec 17, 2020
@ax3l
Copy link
Member

ax3l commented Dec 17, 2020

Hm, I thought we had a test on this but I cannot spot it.
Generally, try to escape the function like this:

diag1.electrons.plot_filter_function(t,x,y,z,ux,uy,uz) = "(uz>1.5)"

uz should be in beta*gamma and need to validate, maybe still in SI. I think to remember it works last time I used it - nonetheless, we updated this functionality recently #1384 and it's lacking a test...

@ax3l ax3l added the bug Something isn't working label Dec 17, 2020
@ax3l ax3l added the bug: affects latest release Bug also exists in latest release version label Dec 17, 2020
@atmyers
Copy link
Member

atmyers commented Dec 23, 2020

The issue seems to a units bug in WarpX. What we actually store for the particle momenta is gamma*v. When we write out particles for plotfiles, we convert that to SI units. The filter function gets applied after this conversion; however, for some reason it includes another factor of (1/c), as if we were attempting to convert from gamma*v to normalized units. So the quantity that actually gets passed in to the filter function is mass*gamma*v/c.

@atmyers
Copy link
Member

atmyers commented Dec 23, 2020

I have attempted to fix this in PR #1598

@ax3l
Copy link
Member

ax3l commented Jan 15, 2021

@hightower8083 when you get to it, can you please confirm the latest development, which now includes #1598, fixes your reported issue?

@ax3l
Copy link
Member

ax3l commented Jan 16, 2021

I did some independent tests on the same filter logic on openPMD files in #1632 and can confirm that this works (I filtered electrons over a certain non-zero gamma locally to see if I can spot heated electrons in the right energy range - worked well!)

Please don't hesitate to perform your own tests nonetheless.

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 component: diagnostics all types of outputs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants