Skip to content

FillBoundaryAux never updates the finest level #6658

@WeiqunZhang

Description

@WeiqunZhang

Summary

  • WarpX::FillBoundaryAux(amrex::IntVect) in Parallelization/WarpXComm.cpp:1112-1117 loops with lev <= finest_level-1, so it never runs on the finest AMR level, and it runs zero times when finest_level == 0.
  • As a result, the auxiliary E/B MultiFabs (FieldType::Efield_aux/Bfield_aux) keep whatever stale guard data they had after the last call to UpdateAuxilaryData, even though the evolution loop (Evolve/WarpXEvolve.cpp:127 and 644) expects every level to have freshly exchanged guard cells before field gathering.
  • The omission is a classic copy-paste slip: all other FillBoundary* helpers iterate to finest_level, but this one subtracts one, so the highest-resolution grids (or the only grid in single-level runs) never receive guard updates. This produces uninitialized reads along physical boundaries and during moving-window shifts.

Impact

  • Single-level jobs never fill Efield_aux/Bfield_aux guard cells at all, so guard data near physical boundaries, PML interfaces, or shift regions contain garbage.
  • Multi-level jobs have valid guard exchanges on coarse levels but stale guard cells on the finest level, so particle gathering and diagnostics that rely on the aux fields see discontinuities exactly where resolution is highest.
  • Because the guard cells are left untouched, enabling the safe-guard debugging mode cannot uncover latent guard issues on the finest level.

Suggested patch

--- a/Parallelization/WarpXComm.cpp
+++ b/Parallelization/WarpXComm.cpp
@@
-WarpX::FillBoundaryAux (IntVect ng)
-{
-    for (int lev = 0; lev <= finest_level-1; ++lev)
-    {
-        FillBoundaryAux(lev, ng);
-    }
-}
+WarpX::FillBoundaryAux (IntVect ng)
+{
+    for (int lev = 0; lev <= finest_level; ++lev)
+    {
+        FillBoundaryAux(lev, ng);
+    }
+}

Prepared by Codex

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions