Repository navigation
Name the minimum grid size when a boundary stencil does not fit - #714
Merged
Merged
Conversation
A non-periodic axis shorter than derivative order + approx_order points cannot hold the one-sided boundary stencils, and discretization failed with a BoundsError from whichever stencil first indexed past the end. Check it per PDE in construct_var_equation_mapping and throw an ArgumentError naming the derivative, approx_order and the number of points needed. Agent-Harness: Claude Code 2.1.296 Agent-Model: claude-opus-5-5 Agent-Session: 644ed0ff-c8c9-4cc3-b4c6-f326231a4030 Agent-Review: unreviewed Co-authored-by: Claude Code <[email protected]>
Agent-Harness: Claude Code 2.1.296 Agent-Model: claude-opus-5-5 Agent-Session: 644ed0ff-c8c9-4cc3-b4c6-f326231a4030 Agent-Review: unreviewed Co-authored-by: Claude Code <[email protected]>
PseudospectralDiscretization has no approx_order, so the check threw a FieldError on every Pseudospectral system. Other discretizations now skip it. Agent-Harness: Claude Code 2.1.299 Agent-Model: claude-opus-5-5 Agent-Session: 644ed0ff-c8c9-4cc3-b4c6-f326231a4030 Agent-Review: unreviewed Co-authored-by: Claude Code <[email protected]>
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.
A non-periodic axis needs at least
derivative order + approx_orderpoints to hold the one-sided boundary stencils. A shorter axis made discretization fail with aBoundsErrorfrom whichever stencil first indexed past the end. For example, heat atapprox_order = 4on 5 points failed inboundary_value_maps. Failing is the expected outcome; this PR makes the failure anArgumentErrorthat says what is needed:Change
validate_boundary_stencil_lengthruns once per PDE inconstruct_var_equation_mapping, next to the existing "domain is too small" check. For each axis of the PDE's variable it:n ≥ d + approx_order, wheredis the PDE's highest derivative order in that direction.d + approx_orderis theboundary_stencil_lengthofCompleteCenteredDifference. MethodOfLines builds the centered boundary maps for every derivative order at each boundary, even when that order is upwinded in the interior, so the bound applies to odd orders too.Verification
I ran a battery of 124 small-grid systems on master and on this branch:
approx_order2, 4 and 6 with 1 to 8 cells;approx_order4 with 3 to 6 cells.BoundsErrorArgumentErrorBoundsErrorBoundsErrorNo system that discretizes on master is rejected. The 9 remaining
BoundsErrors have two causes:approx_order4 or 6, where the interior stencil wraps around the period more than once. They are not covered here.Test: Components,
interiormap_test.jl, "Test 02". Heat atapprox_order = 4throws theArgumentError, naming 6 needed points against 5, on 4 cells. It discretizes on 5 cells, and a periodic axis with 2 cells is not rejected.Test runs
Local runs on this branch (Julia 1.12.6,
GROUP=<g> julia --project -e 'using Pkg; Pkg.test()'): 10 groups exit 0 — Components (including the new testset), Discretization, Higher_Order, Wave_Eq_Staggered, Complex, Complex_Indexing, Diffusion_NU, Nonlinlap_ADV, Sol_Interface and MOL_Interface2. No test hit the new error. I stopped the local run there; CI covers the remaining groups.🤖 Posted by an AI agent · harness: Claude Code 2.1.296 · model: claude-opus-5-5
Review: unreviewed
Session: 644ed0ff-c8c9-4cc3-b4c6-f326231a4030