quokka-astro / quokka

Two-moment AMR radiation hydrodynamics (with self-gravity, particles, and chemistry) on CPUs/GPUs for astrophysics
https://quokka-astro.github.io/quokka/
MIT License
46 stars 12 forks source link

call `WeightedSync` on emf before computing rhs #526

Open BenWibking opened 9 months ago

BenWibking commented 9 months ago

Describe the proposal It appears necessary to ensure that the emf values are identical on edges shared between multiple boxes before computing the magnetic induction equation right-hand-side (rhs).

This can be done with either the OverrideSync or WeightedSync MultiFab functions: https://amrex-codes.github.io/amrex/docs_html/Basics.html#owner-mask.

Describe alternatives you've considered If this is not done, there will be roundoff level differences in the emf on edges that should have identical emfs, which will make the simulation dependent on the grid layout used. This can cause spurious (but small) magnetic field divergence errors.

Additional context This is done in Athena++ (although it may be of greater importance there due to their use of curvilinear coordinates, see section 2.1.4: https://ui.adsabs.harvard.edu/abs/2020ApJS..249....4S/abstract):

BenWibking commented 9 months ago

@AstroKriel I wanted to check if you were already doing this in your code. If not, I think it should be done. This does require creating temporary MultiFabs for the emfs (but not for anything else).