Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The MatrixFields module has no user documentation #1985

Open
Tracked by #1995
Sbozzolo opened this issue Sep 12, 2024 · 1 comment
Open
Tracked by #1995

The MatrixFields module has no user documentation #1985

Sbozzolo opened this issue Sep 12, 2024 · 1 comment
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@Sbozzolo
Copy link
Member

Sbozzolo commented Sep 12, 2024

The documentation for MatrixFields gives a high-level description of what the module is about, but does not provide guidance on how to use these objects.

For example, the question I am currently trying to answer is "do I have any NaN in my MatrixFields"? I find myself unable to tackle this question.

I still don't have a mental model of FieldMatrixs are supposed to represent and there are several levels of abstractions to go through.

Another example, I (think) I have a FieldMatrixs that represent an identity. When I print it, I see

myJ[@name(c.ρ), @name(c.ρ)] = ClimaCore.MatrixFields.DiagonalMatrixRow{Float32}-valued Field whose first column corresponds to the Square matrix
 0.0   ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅ 
  ⋅   0.0   ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅ 
  ⋅    ⋅   0.0   ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅ 
  ⋅    ⋅    ⋅   0.0   ⋅    ⋅    ⋅    ⋅    ⋅    ⋅ 
  ⋅    ⋅    ⋅    ⋅   0.0   ⋅    ⋅    ⋅    ⋅    ⋅ 
  ⋅    ⋅    ⋅    ⋅    ⋅   0.0   ⋅    ⋅    ⋅    ⋅ 
  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅   0.0   ⋅    ⋅    ⋅ 
  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅   0.0   ⋅    ⋅ 
  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅   0.0   ⋅ 

What does this mean? Is "first column" referring to the space? Why a "first column" corresponds to a square matrix?

Osmosys with @dennisYatunin helped me making progress in understanding these objects since I started working with them. One of the misconception I had until a couple of days ago was that they didn't include space information. This misconception was informed by examples like

@. W.matrix[@name(my_var), @name(my_var)] = dtγ * div_matrix() ⋅ grad_matrix() - (LinearAlgebra.I,)

where there is no space information on the right-hand side. (Now, I see how the space comes to be: it is in pre-defining W)

EDIT: The matrix field I thought being an identity was, in fact, not an identity. Now, when I print it, I get

LinearAlgebra.UniformScaling{Bool}
true*I
@Sbozzolo Sbozzolo added the bug Something isn't working label Sep 12, 2024
@Sbozzolo
Copy link
Member Author

This is how I find if there's NaNs in myJ

map(v -> any(isnan, parent(v.entries)), values(myJ))

with myJ being a FieldMatrix.

@Sbozzolo Sbozzolo added the documentation Improvements or additions to documentation label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant