Skip to content

SNES_Scalar default u_Field is created with num_components=mesh.dim (scalar should be 1?) #367

Closed

Description

@lmoresi

Found during the D-pyx-safe readability pass (PR #366, D-15); TODO(BUG) marker at the constructor default in petsc_generic_snes_solvers.pyx. Preserved as-is per the wave's behaviour-identical rule.

When SNES_Scalar auto-creates its unknown (u_Field=None), the default MeshVariable is constructed with num_components=mesh.dim — a vector-sized allocation for a scalar solver. Either this is a real bug (should be 1), or there is a non-obvious reason (e.g. shared code path with the vector case) that deserves a comment where the default is built. Needs a check of what the DS/discretisation actually registers for the auto-created field vs an explicitly passed scalar variable, and whether any downstream assumes the over-sized allocation.

Underworld development team with AI support from Claude Code

Activity

  1. lmoresi commented on Jul 23, 2026

    @lmoresi
    MemberAuthor

    Fixed by PR #396, merged to development on 2026-07-23. (Manual close — PRs target development, so GitHub auto-close does not fire.)

    Underworld development team with AI support from Claude Code

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