Skip to content

Refuse a condition that leaves every component free (UNFILED 46) - #1309

Open
lmoresi wants to merge 1 commit into
developmentfrom
bugfix/all-free-condition-refused
Open

lmoresi wants to merge 1 commit into
developmentfrom
bugfix/all-free-condition-refused

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 20, 2026

Copy link
Copy Markdown
Member

A fix for a finding with no issue (UNFILED 46 in the dev hub's list; found in the review of #1285). Review: H1, the session that reviews pull requests and runs the parallel tests on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH).

The failure

add_dirichlet_bc((None, None), "Left") names no component to fix. It was accepted, and the solve then failed inside SNES_Stokes_SaddlePt._setup_discretisation with:

IndexError: Out of bounds on buffer access (axis 0)

This happened on any boundary: a plain wall with no fault, and a fault side alike. A natural condition add_natural_bc((None, None), "Left") failed the same way.

The change

add_condition refuses a condition whose component list is empty, as soon as the list is built, for essential and natural conditions alike. Every add_*_bc goes through it. The message names the boundary and the value, and gives the fix:

the essential condition on 'Left' leaves every component free ((None, None)), so it constrains nothing. A condition must set at least one component: give that component a value, e.g. (None, 0.0) to set only the second; or drop the condition to leave 'Left' free.

A condition that sets at least one component, such as (None, 0.0) or (None, None, 0.0) (used in test_1095 and in the 3-D shear example), is unchanged.

Test

tests/test_1301_an_all_free_essential_condition_is_refused.py:

case development this branch
(None, None) as a tuple, essential accepted (the IndexError comes at the solve) refused at add_dirichlet_bc
[None, None] as a list, essential accepted refused
(None, None), natural accepted refused
(None, 0.0) on two walls, with the others fixed solves solves

On development, 2 of the first three tests fail; the natural case was added later. All 4 pass on the branch.

Regression

The 217 serial test files that add a condition (add_dirichlet_bc, add_natural_bc, add_essential_bc or add_condition): 1789 passed, 6 skipped, 1 xpassed, with no failures.

Underworld development team with AI support from Claude Code

add_dirichlet_bc((None, None), "Left") named no component to fix. It was
accepted, then failed at the solve inside SNES_Stokes_SaddlePt's
discretisation set-up with "IndexError: Out of bounds on buffer access",
on any boundary, a plain wall included; a natural (None, None) failed the
same way. add_condition now refuses a condition with no component set, when
it is added, naming the boundary and saying how to set one component or
drop the condition. A condition setting at least one component is unchanged.

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 20, 2026 18:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants