picongpu icon indicating copy to clipboard operation
picongpu copied to clipboard

Fix of radiation window for moving simulation.

Open Anton-Le opened this issue 2 years ago • 14 comments

This introduces a shift of the radiation window winFkt by globalOffset * cellSize to shift the radiation window to the moving window.

This should fix #4239.

Anton-Le avatar Jul 31 '22 21:07 Anton-Le

I believe global in this comment is wrong https://github.com/ComputationalRadiationPhysics/picongpu/blob/c624c662ea615ed927a9275c4ff3d4786d11dcba/include/picongpu/plugins/radiation/Radiation.kernel#L279-L282 Based on how it's calculated, particle_locationNow is a total position, not global.

globalPos is also called in a misleading way, it is an index of the current cell in total coordinates, not global.

sbastrakov avatar Aug 01 '22 07:08 sbastrakov

However, this fix seems valid. particle_locationNow[d] is in total coordinates and globalOffset[d] * cellSize[d] is a shift of global origin from total origin, so the difference is particle position in the global domain - which seems what we need there.

Imprecise naming as I pointed above made it not very clear, so perhaps could also be improved as a second commit to this PR?

sbastrakov avatar Aug 01 '22 07:08 sbastrakov

My semantic understanding of particle_locationNow, based on the way it's computed, was that it is the global poosition in the entire simulation, i.e. in-cell + in domain offset + domain offset.

Changing nomenclature is, of course, possible. But maybe it's better done in a separate PR, to keep this one focused on the actual problem. I expect some changes to this PR, since in discussion with @PrometheusPi a potential problem came up:

The way the shift is calculated above it may lead to a "jumping" radiation window due to globalOffset sliding over GPUs. Unfortunately I have no set-up that could be used to emphasize and evaluate this potential problem. Skipping the y-axis for the window function was one suggestion, but it would needlessly impact non-movin-window simulations.

Anton-Le avatar Aug 01 '22 07:08 Anton-Le

that it is the global poosition in the entire simulation, i.e. in-cell + in domain offset + domain offset.

This way describes calculating both total and global position. The difference is whether the domain offset in question is local domain to global domain start or local domain to total domain start. In this case I think it's the latter, so it is a total position at the end.

sbastrakov avatar Aug 01 '22 08:08 sbastrakov

Sure, the naming change is optional and your fix as-is seems fine. I would say the naming was part of the problem since the chosen naming hid the issue. But don't insist, and if there are plans for further change maybe it's better to do then.

sbastrakov avatar Aug 01 '22 08:08 sbastrakov

@Anton-Le please rebase against the dev branch to solve the CI issue.

psychocoderHPC avatar Aug 01 '22 08:08 psychocoderHPC

I intend to keep this in draft state for the moment to see whether the undulator set-up will suffice as a test.

Anton-Le avatar Aug 03 '22 08:08 Anton-Le

@Anton-Le What ist the status of this PR?

psychocoderHPC avatar Aug 29 '22 07:08 psychocoderHPC

@Anton-Le Ping!

psychocoderHPC avatar Sep 14 '22 08:09 psychocoderHPC

@psychocoderHPC I will test this PR.

PrometheusPi avatar Nov 03 '22 13:11 PrometheusPi

@PrometheusPi Is this PR working, if so rebase it.

psychocoderHPC avatar Dec 14 '22 09:12 psychocoderHPC

A new year a new ping ^^.

psychocoderHPC avatar Jan 20 '23 14:01 psychocoderHPC

Thanks for the ping @psychocoderHPC - will have a look asap

PrometheusPi avatar Jan 20 '23 16:01 PrometheusPi