Open
Description
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 originalLinearAlgebra.ldiv!
generatesNaN
s when using a FieldMatrix with a singleUniformScaling
block.
Steps to Reproduce
Using W
to denote the ImplicitEquationJacobian
used in ClimaAtmos, the bugs can be reproduced as follows:
For the first bug, runningW.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 runningW.matrix .+ one(W.matrix)
reproduces the error - For the fourth bug,
ldiv!(x, W.matrix, b)
with amatrix
that contains a singleUniformScaling
block and a FieldVectorx
that is full of ones generates the incorrect result