ITADN

Revisit finest_level == max_level guard for star particle formation

#1979Openchongchonghe 创建于 2026-06-21
enhancement
C
chongchonghecommented
From [PR #1961 discussion](https://github.com/quokka-astro/quokka/pull/1961#discussion_r3447058844): The `finest_level == max_level` guard in `particleMeshInteraction()` (line 2148) prevents `createParticlesFromState` from running until the AMR hierarchy has fully refined to `amr.max_level`. This is correct for sink particles (they must reside on the finest level), but may be too restrictive for star particles. Ben's example: in a cosmological simulation, you may want to refine to a maximum physical resolution and form stars at the current finest level. Due to expansion, the finest level increases at lower redshifts — a cell at the current finest level may already have sufficient resolution for star formation even though `max_level` hasn't been reached yet. ## Current behavior - `particleMeshInteraction()` hardcodes `const int lev = finest_level` — stars always form at the current finest level - The `finest_level == max_level` guard blocks ALL particle creation until the hierarchy is fully built ## What needs solving - Sink particles: still require `finest_level == max_level` (must be at the highest resolution) - Star particles: should be able to form at the current `finest_level` even when `finest_level < max_level`, provided the resolution at that level is sufficient ## Potential approach - Move the guard into the per-particle-type creation logic, rather than guarding `createParticlesFromState` globally - Or add a separate `getRequiresFinestLevel()` / `getRequiresFullRefinement()` trait No action needed now — revisit when cosmological star formation is implemented. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
0 条评论