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
Found during the D-pyx-safe readability pass (PR #366, D-15);
TODO(BUG)marker at the constructor default inpetsc_generic_snes_solvers.pyx. Preserved as-is per the wave's behaviour-identical rule.When
SNES_Scalarauto-creates its unknown (u_Field=None), the default MeshVariable is constructed withnum_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