Skip to content

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions