Open lucafedeli88 opened 5 years ago
I think the issue here is that photons should be pushed with a velocity, not a momentum... We plan some refactoring on particle handling at some point, this could be included there. Yes I think we can implement the solution you propose. Otherwise we need something general enough to cover all injection types, and both at init and for continuous injection, which would require more changes.
I think a photon momentum is physically also well defined.
We should just define a specific pusher for them, always moving them at c
without respect for the momentum. And we might want to define their momentum properly?
At present the code crashes if photons with zero initial momentum are initialized. I noticed this bug writing a unit test:
This is due to the fact that the photon pusher contains the following line:
which is infinity if normalized momenta are 0. This is not a big issue, since photons with zero momentum won't be generated by the QED modules. However, should we include a check in the pusher to return immediately if
ux*ux + uy*uy + uz*uz ==0
?