Repository navigation
Refuse an essential condition on a fault that carries a law (#940) - #1285
Conversation
The interface law (add_fault_bc) reads the slip and the normal traction at the fault's pair nodes from pooled local vectors filled by globalToLocal, which does not write a DOF an essential condition constrains. With a side of the fault pinned, those reads returned whatever the pool last held, and the solve then crashed. A law and conditions on the sides are the two ways to drive a split fault, and they are exclusive on one fault. refuse_essential_conditions_on_law_faults (fault_contact) raises a ValueError naming the fault, the condition's boundary and both ways to drive the fault, when a fault with a law has an essential condition on its label or either side. It reads only the solver's registrations, the same on every rank, so every rank refuses together. It runs at the start of the Stokes, thin-sheet and fault-contact solves, beside the free-side warning. Natural conditions, and conditions on the sides of a fault without a law, are unchanged. The 09xx test decade gets a batch line (shard 6). Underworld development team with AI support from Claude Code
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) Verdict at d9cf206: ready to merge on green from this review. The refusal works on every route the PR names. Each rank raises the same The head has since moved to 5b957ab, a merge of development. The PR's own diff against development is the same six files, unchanged. The runs below are at d9cf206. Method
ResultsThe PR's tests
The sweep probe of #940 (viscous law,
|
| np | development | this branch |
|---|---|---|
| 1 | SEGV | the ValueError |
| 2 | PETSc error 63, "Out of range index value -354", exit 142 | the same ValueError on both ranks |
| 3 | error 63 on rank 2, exit 142 | the same on all 3 |
| 3, empty rank | error 63, then a hang (killed) | the same on all 3 |
A partial pin, (None, 0.0) on FltMinus, on development:
- 3 of 4 serial runs died with heap corruption;
- the survivor read the pool at all 11 pair nodes: sigma_nn -1.5e-9 against +9.4e3, slip 0.082 against -242, for pool contents 0 and 1e3.
So a partial pin needs refusing as much as a full one, and the branch refuses it.
Registration paths and naming (case probe; np 1 on both sides, and np 2, 3 and 3 with an empty rank on the branch)
On the branch, every row was identical on every rank at every rank count run.
| case | development np 1 | this branch |
|---|---|---|
add_dirichlet_bc((0,0), "FltMinus") + viscous law |
solved, but the answer equals the lawless one-side-pinned solve (sum|u| 79.0833185) | refused, names 'FltMinus' and 'Flt' |
the same on FltPlus |
solved, law lost | refused |
on the fault label Flt |
heap corruption, exit 134 | refused |
add_essential_bc on FltMinus |
heap corruption | refused |
(None, 0.0) on FltMinus |
heap corruption | refused |
(None, None) on FltMinus |
IndexError from the read |
refused (Low 3) |
the condition added before add_fault_bc |
solved, law lost | refused |
| the condition added after a first solve | the first solve passes, the second aborts | the first solve passes, the second is refused |
frictionless law (add_fault_bc(0, …)) + FltMinus pin |
solved, law lost (sum|u| equals the lawless solve) | refused |
| Coulomb law + pin | heap corruption | refused |
fault_contact.add_frictionless_fault_bc + solve_with_fault + pin |
solved, law lost | refused |
thin sheet, viscous law + FltMinus pin |
solved | refused |
add_rotated_freeslip_bc on FltMinus + law |
refused by the existing "shares a node with a rotated free-slip boundary" | the same |
add_nitsche_bc on FltMinus + law |
solved | solved, bit-identical to development |
add_natural_bc on FltMinus + law |
solved | solved, identical |
| both sides pinned, no law | solved | solved, identical |
faults Flt (law) and Flt2 (both sides pinned, no law) |
solved | solved, identical |
Flt (law), only Flt2Minus pinned |
solved, warns 'Flt2' (nothing on 'Flt2Plus') |
the same answer and the same warning |
Flt (no law, both sides pinned), Flt2 (law) with Flt2Minus pinned |
abort | refused, names 'Flt2Minus' and 'Flt2' |
| two law faults, three clashes | SEGV | refused; the message lists the first and "(2 more: 'FltMinus' on 'Flt', 'Flt2Plus' on 'Flt2')" |
pressure Dirichlet on FltMinus |
refused by the pressure-nullspace check | refused by the #940 check (Low 2) |
law only, or thin sheet with law only, or solve_with_fault with no pin |
solved | solved, identical |
What the table shows:
- Side labels are matched by exact name (
name,f"{name}Plus",f"{name}Minus") against the faults inmesh._fault_point_pairs. The prefix-sharing namesFltandFlt2are attributed correctly. - Side names are always
<name>Plus/<name>Minusin the code (fault_split,fault_network,extrude). No API sets custom side names. fault_splitrefuses a touching junction, so the two faults' sides share no nodes.- Development gives evidence that refusing every law, frictionless included, is right. Wherever a pinned law fault survived the solve, its answer equals the solve with no law and that side pinned (79.083318529 against 79.083318531). The law was silently dropped, and nothing was said.
Legitimate models, head against base
| set | head | base | solutions |
|---|---|---|---|
serial: 24 files calling add_fault_bc / add_*_fault_bc / solve_with_fault, plus test_0845; 207 tests, 4 workers |
206 passed, 1 failed | 203 passed, 4 failed (the 3 new #940 tests, plus the same failure as head) | 420 solves, the same iteration counts; largest relative difference 1.1e-10 (test_0847, rotated iterative solve), every other file at or below 3.2e-14 |
test_1174 again without the recording plugin |
28 passed | 28 passed | |
np 2: 22 files under tests/parallel/ that call the fault laws |
19 completed and passed (2 of them, test_1089 and test_1095, passed after a 60 s silence flag) |
the same | 101 solves, the same iteration counts, 198 of 202 rank records bit-identical, largest difference 2.2e-16 |
About the failures and the unfinished files:
- The one
test_1174failure on both sides came from the recording plugin. The test asserts that the free-side warning is attributed to the caller's file, and the plugin's wrapper became the caller. Without the plugin, both sides pass. The warning fires where it did before. - Three parallel files did not finish on either side under the 60 s silence rule:
test_1174_second_add_fault_3d,test_1152andtest_1097. All ranks were still moving in the same rotated solve when they were killed. I don't count that against the branch.
CI
batch 6 tests/test_09*pyruns the new serial file. The 09xx decade had no line before this PR.- The parallel file is under the
tests/parallel/test_*.pyglob of the--p Nphase. scripts/check_test_coverage.pyreports OK (502 files reachable).
Reading the diff
refuse_essential_conditions_on_law_faultsreads onlysolver.mesh._fault_point_pairsandsolver._constraint_mechanisms(). Neither is rank-dependent, and the function makes no collective call, so there is no rank-local branch ahead of a collective.- Stokes: it runs after
_reject_mixed_constraint_mechanisms("solve")and before the homotopy check,_buildand anything else collective. - Thin sheet: it runs before
_refresh_facet_normal. solve_with_fault: it runs beforesolve_rotated_freeslip.- It raises before
warn_unpaired_split_faults, so the warning's "said once" state is not touched by a refused solve.
Findings
- Medium: the generic vector solve reaches the same read unguarded.
- The gap:
SNES_Vector.solvesends any vector solver with a registered fault into the rotated path through_solve_rotated_if_registered. That path builds the_InterfaceAssemblerwhen a law is registered.add_fault_bcis defined onSolverBaseClass, so every solver has it. The check is called only fromSNES_Stokes_SaddlePt.solve,SNES_ThinSheet.solveandsolve_with_fault. - The repro: a
Vector_Projectionon the same faulted box withadd_fault_bc(1.0, "Flt")and(0, 0)onFltMinus:- on the branch at np 2, PETSc error 63 ("Out of range index value -329") in
VecSetValuesunderresidual_add, then a hang: rank 0 left the solve and rank 1 waited in an allreduce. Killed by the supervisor; - development behaves the same;
- serially it solves, but 1 of 6 runs differed from the other 5 in the 8th digit (sum|u| 77.191728 against 77.191759), so the answer follows the pool.
- on the branch at np 2, PETSc error 63 ("Out of range index value -329") in
- The control: the same projection without the pin solves identically on both sides and at np 2.
- The fix: a law on a projection is not a documented use, but the fix is one line. Call
refuse_essential_conditions_on_law_faults(self)at the top of_solve_rotated_if_registered, after its earlyreturn False. Every solver's rotated path passes through it, and the check is rank-independent, so it is safe at that point. Keep the call insolve_with_fault, which does not go through it. A one-case test (a projection with a law and a pinned side) would hold it.
- The gap:
- Low: a pressure condition on a fault side is refused with the fault_contact reads the interface traction and slip from an unzeroed pooled vector at a pair node an essential wall constrains #940 message.
add_condition(1, "dirichlet", (0.0,), "FltMinus")is refused as "constrains the pair nodes of fault 'Flt'". It constrains no velocity pair DOF, and the law reads only velocity slip and the velocity reaction.- On development the same setup is refused by the pressure-nullspace check, so nothing that worked now fails. The check could filter on
bc.f_id == 0, or the message could say which field it means.
- Low: an all-free condition is refused.
(None, None)onFltMinushas an empty component list and constrains nothing, yet it is refused as "constrains the pair nodes".- On development it raised an
IndexErrorfrom inside the read, so a clear refusal is an improvement. Skipping entries with an emptycomponentswould make the message true.
- Low: the message gives the reason for a law that reads the pair nodes.
- For a frictionless law, the message's reason ("The law reads the slip and the normal traction at those nodes") is not what happens: no interface assembler runs.
- What happens on development is that the law is dropped and the solve equals the lawless one-side-pinned solve, as measured above. Refusing it is right. A clause such as "and a frictionless law is lost there" would make the message accurate for every law.
- Low (read, not probed): the check matches label names, not points.
- An essential condition on a hand-made label that happens to contain a fault's pair points would not be seen.
- No built-in label can do that: faults are strictly interior, and a touching junction is refused. I mention it only as a limit of the approach.
Run and not run
Run:
- the PR's serial file (head and base) and parallel file (np 2, 3, and 3 with an empty rank, head and base);
- the sweep probe at np 1, 2, 3 and 3 with an empty rank, head and base, plus a partial-pin variant on base;
- the 27-case probe at np 1 on head and base, and 16 of its cases at np 2, 3 and 3 with an empty rank on head;
- the projection cases at np 1 (head ×5, base) and np 2 (head ×2, base);
- the serial fault-law regression (24 files, 4 workers) and the np 2 parallel regression (22 files), head against base, with solution comparison;
check_test_coverage.py.
Not run:
- the parallel regression at np 3 or more;
- the
ptest_*files that use faults (ptest_0845,ptest_0852,ptest_1094); - tier C;
- three parallel files to completion under the 60 s silence rule (above);
- 3-D faults through the refusal. The 3-D side naming is the same code path, read only.
All runs were confined to 4 cores while other jobs on the machine were running. Logs kept by the reviewer.
Underworld development team with AI support from Claude Code
From the review of d9cf206: - refuse_essential_conditions_on_law_faults now runs at the top of _solve_rotated_if_registered, after its early return, so every solver's rotated path checks it: a Vector_Projection with a law and a pinned side reached the pooled read (PETSc error 63, then a hang, at np 2). solve_with_fault keeps its own call. - Only a condition on the velocity field that constrains a component is counted: a pressure Dirichlet on a side is left to the pressure-nullspace check (as on development), and (None, None) is not said to constrain. - The message says what happens for a frictionless law: it is lost. New cases: the vector solve (serial, and the same error on every rank at np 2 and 3), the frictionless reason, the pressure condition and the all-free condition. Underworld development team with AI support from Claude Code
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) Verdict at a54bab4: ready to merge on green from this review. The generic vector solve is now refused on every rank with the same message, with no hang. The three message and scope changes do what they say. Every model that solved at d9cf206 still solves, with the same answer to all printed digits. This is a narrow re-check of the one commit since 5b957ab ( Earlier findings, then and now
Reading the diff
RunsEach run printed
New findingsNone. Not run
All runs were confined to 4 cores while other jobs on the machine were running. Logs kept by the reviewer. Underworld development team with AI support from Claude Code |
Fixes #940. 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 problem
The interface law (
add_fault_bc) reads the slip and the normal traction at the fault's pair nodes from pooled local vectors filled byglobalToLocal(_nodal_slip,nodal_normal_traction).globalToLocaldoes not write a DOF that an essential condition constrains. With a fault side pinned, for exampleadd_dirichlet_bc((0, 0), "FltMinus")besideadd_fault_bc(1.0, "Flt"), those reads return whatever the pool last held.H1's probe of development showed the effect:
The issue's original route, a fault meeting a Dirichlet wall, is already closed, because
add_faultrefuses boundary faults. A condition on the fault's own sides still reaches the bad read.The change
A law and conditions on the sides are the two documented ways to drive a split fault (
fault_split.split_fault's docstring, test_1174). They are exclusive on one fault, so the mixture is refused rather than patched:fault_contact.refuse_essential_conditions_on_law_faults(solver)raises aValueErrorwhen a fault with a law has an essential condition on its own label, on<name>Plusor on<name>Minus.add_fault_bcand put a condition on each side._constraint_mechanisms), which are the same on every rank, so every rank refuses together with no communication.warn_unpaired_split_faults).Making the pooled read correct instead would mean deciding what slip and traction mean at a constrained pair node. Those quantities are not defined there, so the straight answer is to refuse.
Tests
tests/test_0940_essential_condition_on_a_fault_with_a_law.pyuses H1's setup: an interior fault in a sheared box with a viscous law.FltMinus'Flt'and'FltMinus'FltPlusFltFltMinusbeside the lawtests/parallel/test_0940_..._parallel.py: the sameValueError, identical on every rank, for a condition onFltMinusand onFlt. It passes at np 2 and 3, and at np 3 with the last rank empty (a test-only shell partition).The 09xx test decade had no batch line in
scripts/test.sh. It gets one on shard 6, not shard 3, which is the longest since #1245.Regression
add_fault_bcoradd_frictionless_fault_bc:scripts/check_test_coverage.py: OK.--print-shards: unchanged.Review fixes (a54bab4; development merged at 5b957ab)
From the review of d9cf206:
_solve_rotated_if_registered, after its early return. Every solver's rotated path passes there, including a vector projection with a law.solve_with_faultkeeps its own call, since it does not go through it.Vector_Projectionwithadd_fault_bc(1.0, "Flt")and(0, 0)onFltMinusis refused, serially and with the same error on every rank at np 2 and 3, and at np 3 with an empty rank.(None, None)constrains no component and is not counted.IndexErrorinSNES_Stokes_SaddlePt._setup_discretisation. The same happens for(None, None)on a plain wall (Left) with no fault, so that failure is not fault_contact reads the interface traction and slip from an unzeroed pooled vector at a pair node an essential wall constrains #940's; it is reported separately.Runs at this head:
tests/test_0940_…: 9 passed. The parallel file: 3 passed at np 2 and 3, and at np 3 with an empty rank.solve_with_faultoradd_rotated_freeslip_bc: 535 passed, 2 skipped. One skip needs MPI; one is a host gmsh difference.Underworld development team with AI support from Claude Code