Evolve: use finest_level instead of max_level to gate RedistributeLocal#6727
Merged
ax3l merged 1 commit intoBLAST-WarpX:developmentfrom Mar 31, 2026
Merged
Conversation
RedistributeLocal is safe when all particles fit within a single AMR level. The guard was checking `max_level == 0` (the configured maximum depth), but the relevant quantity is `finest_level` (the number of currently active levels). When a user enables AMR with `amr.max_level > 0` but the hierarchy has not yet refined, the cheap local redistribute was always bypassed even though it would have been correct and faster. Fixes BLAST-WarpX#6653 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HandleParticlesAtBoundarieswas usingmax_level == 0to decide whether to use the cheapRedistributeLocalpath. Butmax_levelis the configured maximum AMR depth, whilefinest_levelis the number of currently active levels. Whenever a user setsamr.max_level > 0to allow future refinement, the local redistribute was bypassed unconditionally — even when the hierarchy currently had only one level and the optimization would have been valid and faster.Fix
Replace
max_level == 0withfinest_level == 0.Fixes #6653
🤖 Generated with Claude Code