-
Notifications
You must be signed in to change notification settings - Fork 218
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
transition radiation plugin produces NaNs #3090
Comments
The issue I have encountered was probably caused by a |
I do not have a good idea about the plugin, but since |
@sbastrakov's idea sounds good.I will try to add an assertion and add a comment to the param files. The same should happen if you just detect in a single azimuth direction |
I think I'll do it without an assert and just program border cases, if |
Sure, this looks reasonable. |
I ran a test based on the default transition radiation example. |
@PrometheusPi is this issue (the latter one, with gamma filter not working properly) connected to #3105 ? |
@PrometheusPi thanks. And what about this issue? Sorry, I later edited my previous message. |
@sbastrakov Yes - this issue (= #3090) documented NaN production in the CTR plugin.
The question is, whether there are still more causes for NaNs, since NaNs should be captured in the plugin itself. I have the impression, that the filter will not entirely prevent NaNs - but this feeling is just based on the simulation on taurus, where the filter was not working and the CTR plugin generated NaNs. |
So please leave it open for now. |
Yes, I couldn't create NaNs with #3105 and the default LWFA setup and a gammafilter which is equal to |
@PrometheusPi Is this issue already solved? |
No, it is not solved. But it is quite hard to find a suitable test case. For all users that use this plugin: just apply a gamma filter to the particles. This prevents the NaN creation and usually should be fine when computing transition radiation from high energy electrons. |
@PrometheusPi perhaps this should be clarified in the |
@sbastrakov I agree. (I hoped to find the bug sooner.) |
I moved this PR tp the next release |
I moved this issue again to the next release. @PrometheusPi is this issue still existing? |
Good question! @finnolec could you please comment on your plugin? |
It's been a while since I used this plugin and I don't really remember this error... But from what I gathered by reading through all the messages here, this error only occurs when you try to calculate the transition radiation without any valid, radiating electrons (valid means that their velocity is larger than So the plugin does not catch NaN's by itself to my knowledge. But I think it's usually the user's fault if it even generates NaN's... If the issue is just, that there is no comment like "Don't remove the gamma filter! Still standing electrons generate NaN's in the output of the plugin and transition radiation is scaling by \propto \gamma^2" in the |
Activating the gamma filter will not solve the problem if it is a division by zero. The filter is activating tracking, if the particle is slowing down for any reason and stop then it will still be activated and create NaNs. |
@psychocoderHPC thanks for the input - does that mean that if a particle once exceeds the gamma filter, it will remain active. Because gamma=1 is equivalent to a zero velocity (at that instance). |
It depends on how the filter is written but the default filter is only enabling radiation for a particle. It mechanism we use in the radiation plugin, I assume this way is used to avoid that a particle is one step active and the next not, this could produce noise in the output. |
Yes, this is how we have to do it for the radiation plugin, since it performs a time integration and missing steps in a time integration messes up the Nyquist criteria. |
Yes there is no time integration. The plugin is called once in every timestep it's used and then it calculates the whole transition radiation spectrum in this timestep. I'm not sure what you mean by "instantaneous filter". I compared the filters from the radiation and the transition radiaton plugin right now and they look very similar to me (transitionRadiation.param and radiation.param, respectively transition radiation ExecuteParticleFilter and radiation ExecuteParticleFilter). So the implementation looks quite similar to me in both radiation plugins, but I didn't compare it to other plugins yet.
I think the idea for the filter in the |
Okay - due to the not required time integration, using an approach as the radiation plugin is using is not really needed for the transition radiation. A common filter without explicit particle flag attributes that tracks the result of the filter should be fine. |
Currently the transition radiation plugin introduces with #3003 produces NaNs for example in the LWFA simulations for @OmidZar. This is most likely caused by a division by zero as documented in the gamma filter section of the read the docs documentation.
This (hopefully) can be avoided in the LWFA case by increasing the gamma value of the filter (I will try
5
->20
) but this is not a general solution.As discussed offline with @psychocoderHPC, such divisions by zero should be stopped in the kernel (if case is fine, as long as no extra code is executed and only contribution to summation is stopped).
The text was updated successfully, but these errors were encountered: