CliMA / CliMA/ClimaCore.jl

Non-scalar Matrix Field bugs

Open
#1,983 0 comments 0 reactions 1 assignee Claimed by @dennisYatunin View on GitHub
bug
Dominant language
Julia
Stars
117
Forks
19
Avg merge
3d 5h
Merged PRs (30d)
36

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 #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 `NaN`s 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.