Repository navigation
Fix issue #259: EB body near a pressure outflow face - #266
Merged
Merged
Conversation
Two separate problems made a run abort when an EB body sat within a few cells of a pressure outflow face. 1. Covered-cell values poisoning the nodal rhs. The nodal solver's rhs is EB-aware level by level, but the contribution of a fine level to the rhs of the level below is not: for cells on the boundary of a fine grid, MLNodeLaplacian::compRHS recomputes the divergence from the raw fine velocity (mlndlap_divu_fine_contrib -> mlndlap_sum_Df) with no volume-fraction weighting. IAMR holds COVERED_VAL (1e40) in covered cells, so that landed in the coarse rhs: in the reproducer, max(abs(rhs)) on level 0 was 2e41 instead of 781, which gave velocities of order 1e39, dt of order 1e-42 and an MLMG abort during the initial iterations. doMLMGNodalProjection now zeroes the velocity in covered cells before the solve. Nothing reads velocity there -- estTimeStep ignores covered cells and the plotfile code sets them itself -- so this only affects paths that should not have been looking at them. 2. Refinement sliced through the body at the outflow. do_derefine_outflow (on by default) clears refinement tags within Nbuf_outflow cells of an outflow face. For a body near that face this cuts the tagged region through the middle of the body, and a two-level nodal solve diverges when the coarse/fine boundary crosses a body: with the body spanning fine cells 174-190, a fine grid ending at 173 or covering through 191 converges, while every boundary in between diverges. That is an AMReX MLNodeLaplacian problem, not an IAMR one -- it reproduces with no IAMR, no outflow BC (Neumann does it too) and a mid-domain body -- and it is reported upstream. manual_tags_placement now keeps the tags on cells a body cuts when that body carries on past the inward edge of the cleared region, so refinement reaches the outflow face instead of stopping inside the body. A body lying wholly inside the cleared region is not refined today and is not refined now either, so no configuration that currently runs changes its grids. With both fixes, flow_past_cylinder-x with the cylinder moved to eb2.sphere_center = 0.50 0.0 0.0 -- the reproducer in the issue, a 4-cell gap -- runs its 10 steps. At 0.54 and 0.58 the body is within one cell of the face, or cuts it; those run with gravity off, and with gravity they stop on the existing, explicit "level 1 only partially covers an outflow face" abort from set_outflow_bcs rather than on a solver failure. All eight EB regression tests (2D bubble, double_shear_layer, flow_past_cylinder-x, flow_past_cylinder-y, hotspot; 3D double_shear_layer, flow_past_cylinder-x, hotspot) agree bit-for-bit with the previous code. regtest.2d.shock_past_cylinder aborts in MLMG both before and after this commit; that is a pre-existing failure. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The ParallelFor kernel added in the previous commit uses i,j,k, which shadowed the outflow-face loop index i. Rename that loop index to iface, which also matches how it is used (outFaces[iface]). Caught by the GCC EB 2D CI job, which builds with WARN_ALL=TRUE WARN_ERROR=TRUE. Co-Authored-By: Claude Opus 5 (1M context) <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.
Fixes #259.
The reported configuration turned out to hit two separate problems. Both are fixed here.
1. Covered-cell values poisoning the nodal rhs
The nodal solver's rhs is EB-aware level by level, but the contribution of a fine level to the rhs of the level below is not: for cells on the boundary of a fine grid,
MLNodeLaplacian::compRHSrecomputes the divergence from the raw fine velocity (mlndlap_divu_fine_contrib→mlndlap_sum_Df) with no volume-fraction weighting. IAMR holdsCOVERED_VAL(1e40) in covered cells, so that landed in the coarse rhs —max(abs(rhs))on level 0 was 2e41 instead of 781 — which is where the 1e39 velocities and the 1e-42dtin the issue came from.doMLMGNodalProjectionnow zeroes the velocity in covered cells before the solve. Nothing reads velocity there:estTimeStepignores covered cells (norm0(..., ignore_covered=true)) and the plotfile code sets them itself.2. Refinement slicing through the body at the outflow
do_derefine_outflow(on by default) clears refinement tags withinNbuf_outflowcells of an outflow face. For a body near that face this cuts the tagged region through the middle of the body — IAMR's own grid log, with the body spanning fine cells 168–184:and a two-level nodal solve diverges when the coarse/fine boundary crosses a body. That is an AMReX problem, not an IAMR one: it reproduces in ~150 lines calling
MLNodeLaplacian/MLMGdirectly, with no IAMR, with Neumann instead of Dirichlet on the face, and with a mid-domain body. Reported upstream as AMReX-Codes/amrex#6069, which has the reproducer and the sweep table.manual_tags_placementnow keeps the tags on cells a body cuts when that body carries on past the inward edge of the cleared region, so refinement reaches the outflow face instead of stopping inside the body. A body lying wholly inside the cleared region is not refined today and is not refined now either, so no configuration that currently runs changes its grids.Result
regtest.2d.flow_past_cylinder-xwith the cylinder moved toward the outflow, 2 MPI ranks, 10 steps:eb2.sphere_centerxns.gravity = -9.8ns.gravity=0; with gravity, stops on the existing explicitProjection::set_outflow_bcs: level 1 only partially covers an outflow faceguardVerification
fcompare: PLOTFILE AGREE): 2Dbubble,double_shear_layer,flow_past_cylinder-x,flow_past_cylinder-y,hotspot; 3Ddouble_shear_layer,flow_past_cylinder-x,hotspot.Exec/run2d,Exec/run3d,Exec/eb_run2d,Exec/eb_run3dall build clean;NavierStokesBase.cppis also clean under-Wall -Wextrawith asserts enabled. Both changes are inside#ifdef AMREX_USE_EB, so non-EB builds are untouched.regtest.2d.shock_past_cylinderaborts in MLMG on unmodifieddevelopmentas well.🤖 Generated with Claude Code