Skip to content

Rotated-BC analytic-normal guard false-positive when a second mesh exists at reaction read-out (multi-mesh unwrap identity) #445

Closed

Description

@lmoresi

The new analytic-normal validation in _boundary_velocity_nodes (development, 2026-07)
raises

ValueError: analytic normal for boundary 'Upper' contains symbols ['N.x', 'N.y']
that are not mesh coordinates

on a NORMAL that was correctly built from the solver's own mesh.X — but only when a
SECOND mesh has been created before the recovery call. Reproduce: build mesh A + Stokes

  • add_rotated_freeslip_bc(normal = X/|X| from mesh A) + solve (passes — guard OK at
    solve time); build mesh B (a second annulus); then call
    solverA.boundary_normal_traction(...) -> guard fires. Same call BEFORE mesh B exists:
    fine.

Mechanism (suspected): the guard unwraps the stored normal at read-out time
(unwrap(normal[0,k], keep_constants=False)) and compares free symbols against
set(solver.mesh.X) by identity; with two meshes alive the expression-registry
cross-talk returns coordinate BaseScalars that are not identical to mesh A's — the
multi-mesh symbol-identity class (see SYMBOL_DISAMBIGUATION design note).

Impact: any workflow that solves on one mesh and reads the reaction after constructing
another mesh (comparison studies, A/B harnesses) hard-fails. Workaround: read
reactions before constructing the next mesh. Fix direction: compare by symbol NAME
within the solver's coordinate system, or unwrap against the solver's own registry
scope rather than the global one.

Found while running the #438 TI pre-test (results in that thread).

Underworld development team with AI support from Claude Code

Activity

  1. lmoresi commented on Aug 13, 2026

    @lmoresi
    MemberAuthor

    Consolidating into #501 — same defect, same line. Both reports land on the stray
    check in _boundary_velocity_nodes, src/underworld3/utilities/rotated_bc.py:152:

    stray = set().union(*[c.free_symbols for c in comps]) - set(solver.mesh.X)

    which still has no name-retag at development @ e475246f. unwrap canonicalises
    coordinate BaseScalars onto the first mesh's frame, so on a later mesh the
    unwrapped x is not mesh.X[0] by identity even though it prints identically, and
    the check raises on a normal correctly written in that mesh's own mesh.X.

    #501 is the better-written record: it carries the minimal reproducer, the exact
    patch (retag by name onto solver.mesh.X before both the stray check and the
    lambdify), the note that the same fix is already applied to the fault-side twin
    fault_contact._compiled_normal_override, and the observation that genuine strays
    are still caught afterwards. We have copied this issue's impact framing across —
    the workflows that hit it are the comparison/A-B harnesses that solve on one mesh
    and read the reaction after building another.

    One measurement worth carrying over, recorded on #501: at current head the
    unwrap-layer symptom reproduces (second annulus, unit_e_0 normal →
    stray=['N.x','N.y']; first annulus → stray=[]), but two solver-level
    reproductions did not raise. The trigger is narrower and more
    registry-state-dependent than either filing implies, so whoever fixes this should
    tighten the reproducer first — otherwise the regression test will pass for the
    wrong reason.

    Tracking continues on #501.

    Underworld development team with AI support from Claude Code


    Suggested edits to issues we are keeping (not closing)

    These are not closures — they are corrections the main session may want to post so
    the issue text matches what we measured.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions