Fill all halo cells for Flux, Value/Gradient, and Open BCs#5490
Fill all halo cells for Flux, Value/Gradient, and Open BCs#5490
Conversation
Previously, the `_fill_*_halo!` functions for Flux, Value/Gradient/Mixed, and Open boundary conditions only filled the first halo cell (h=1). For high-order schemes that require large halos (e.g. WENO9 with halo=5), the outer halo cells were left unfilled. This fix loops over all halo cells (1:grid.Hx/Hy/Hz) for each BC type: - Flux BCs: call the per-cell flux fill for each halo depth - Value/Gradient/Mixed BCs: linearly extrapolate from the boundary into all halo cells using the computed gradient - Open BCs: set the boundary value, then zero-gradient extrapolate into deeper halo cells Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
I am not sure we can call this a bug. This was a deliberate choice we made long time ago (back in #2035). |
|
I think this might be a nice idea if we want to detangle the "ordering" of the BCs, which now follow a specific order because the corners are filled only by the Periodic and Distributed BCs. |
|
Right just to clarify, the description is wrong -- high-order schemes do not touch halo regions, because they are "stepped down" to lower order schemes approaching the boundary. We call these "buffer schemes" in the struct for I am wary about this because of the cost of filling points that are not used. I don't totally understand the point about boundary condition ordering. |
|
Okay let me verify that the halo “fix” has no effect due to the reduction in order at the boundaries then close this issue |
Summary
_fill_*_halo!functions for Flux, Value/Gradient/Mixed, and Open BCs previously filled only the first halo cell (h=1). High-order schemes requiring large halos (e.g., WENO9 with halo=5) had outer halo cells left unfilled (stale or zero).1:grid.Hx/Hy/Hz) for each BC type:This bug was discovered while debugging NaN crashes with WENO9 (halo=5) on a neutral ABL simulation (see #5485). Diagnostic analysis confirmed that
ρwhalos were all-zero throughout the simulation. While fixing the halos alone did not resolve the NaN crash (which has a separate Float32 precision root cause), the unfilled halos affect correctness of stencil computations near bounded boundaries for any scheme with halo > 1.Test plan
halo=(5,5,5): all 5 halo cells should be properly filled for Flux, Value, Gradient, and Open BCs🤖 Generated with Claude Code