PrincetonUniversity / athena

Athena++ radiation GRMHD code and adaptive mesh refinement (AMR) framework
https://www.athena-astro.app
BSD 3-Clause "New" or "Revised" License
226 stars 122 forks source link

Fixing divergence error with AMR (Issue #617) #625

Open tomidakn opened 2 days ago

tomidakn commented 2 days ago

This is to fix the divergence error with AMR reported in #617.

When a MeshBlock contacting a finer MeshBlock is refined, the original code refined normal B-fields on the shared face by interpolating the coarser fields, but they do not exactly match the existing finer fields on the already refined neighbor MeshBlock. With this commit, the shared face fields are copied from the finer MeshBlock, hence enforcing the divergence B constraint.

Prerequisite checklist

changgoo commented 15 hours ago

failure from the pgen_compile test:

src/mesh/amr_loadbalance.cpp:1223:47: error: implicit conversion loses integer precision: 'std::vector::size_type' (aka 'unsigned long') to 'const int' [-Werror,-Wshorten-64-to-32]
  const int nf = my_blocks(0)->pmr->pvars_fc_.size();
            ~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
1 error generated.