Skip to content

Non-scalar Matrix Field bugs #1983

Open
@dennisYatunin

Description

@dennisYatunin

Describe the bug

In the process of working the RosSSP timestepper, @Sbozzolo has uncovered 4 bugs in the Field/FieldMatrix broadcasting machinery:

  • Division (not multiplication) of a Field of BandMatrixRows of non-scalars by a scalar throws an error [fixed in Remove unnecessary method specializations for Numbers #2014]
  • Multiplciation/division of a FieldMatrix by a scalar throws an error
  • Base.one of a FieldMatrix with non-scalar subblocks generates a FieldMatrix with scalar subblocks, which then throws an error when combined with a FieldMatrix similar to the original
  • LinearAlgebra.ldiv! generates NaNs when using a FieldMatrix with a single UniformScaling block.

Steps to Reproduce

Using W to denote the ImplicitEquationJacobian used in ClimaAtmos, the bugs can be reproduced as follows:

  • For the first bug, running W.matrix[@name(f.u₃), @name(f.u₃)] ./ 2 reproduces the error
  • For the second bug, running W.matrix .* 2 reproduces the error
  • For the third bug, running one(W.matrix) generates the incorrect result, and running W.matrix .+ one(W.matrix) reproduces the error
  • For the fourth bug, ldiv!(x, W.matrix, b) with a matrix that contains a single UniformScaling block and a FieldVector x that is full of ones generates the incorrect result

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions