boutproject / BOUT-dev

BOUT++: Plasma fluid finite-difference simulation code in curvilinear coordinate systems
http://boutproject.github.io/
GNU Lesser General Public License v3.0
179 stars 93 forks source link

Add .zpm for sign-independent coding #2888

Open dschwoerer opened 4 months ago

ZedThree commented 4 months ago

This is a bit of a frustrating situation, I guess we didn't allow zp(-1) as it would involve extra branching to avoid negative numbers in the mod for periodicity. It would be good to know if this is really still a problem performance-wise.

github-actions[bot] commented 4 months ago

clang-tidy review says "All clean, LGTM! :+1:"

dschwoerer commented 4 months ago

I think it is not so bad - if you know the sign of the offset, you can pick a specific one, otherwise the other. Even if it is not an issue right now with a specific compiler, it might become one for a different compiler or architecture (e.g. GPUs)

If we allow z splitting, that anyway changes :sweat_smile: