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

single_field_solve! / bycolumn bug #1749

Closed
juliasloan25 opened this issue May 22, 2024 · 1 comment
Closed

single_field_solve! / bycolumn bug #1749

juliasloan25 opened this issue May 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@juliasloan25
Copy link
Member

juliasloan25 commented May 22, 2024

Describe the bug

In ClimaLand's RichardsModel implicit solver, I encountered a bug in the MatrixFields solver upon upgrading to ClimaCore v0.14. See this build for a stacktrace.

This was introduced in #1653, perhaps in this line. It is not an issue when using the commit just before this PR (ClimaCore#033e5b0), and is an issue in all subsequent commits (starting with ClimaCore#31e69ef).

PR to add unit test for reproducer: #1750

To Reproduce

import ClimaComms
import ClimaCore: Spaces, MatrixFields, Fields, Domains, Meshes, Topologies, Geometry
import ClimaCore.MatrixFields: @name

FT = Float32
zmax = FT(0)
zmin = FT(-0.35)
nelems = 5

# Make FiniteDifferenceSpace
context = ClimaComms.context()
z_domain = Domains.IntervalDomain(
    Geometry.ZPoint(zmin),
    Geometry.ZPoint(zmax);
    boundary_names = (:bottom, :top),
)
z_mesh = Meshes.IntervalMesh(z_domain, nelems = nelems)
z_topology = Topologies.IntervalTopology(context, z_mesh)

space = Spaces.CenterFiniteDifferenceSpace(z_topology)

tridiag_type = MatrixFields.TridiagonalMatrixRow{FT}
# Create a field containing a `TridiagonalMatrixRow` at each point
tridiag_field = Fields.Field(tridiag_type, space)

A = MatrixFields.FieldMatrix((@name(_), @name(_)) => tridiag_field)
field = Fields.ones(space)
b = Fields.FieldVector(; _ = field)
x = similar(b)

solver = MatrixFields.FieldMatrixSolver(MatrixFields.BlockDiagonalSolve(), A, b)

# this passes with ClimaCore#033e5b0 and fails with ClimaCore#31e69ef
MatrixFields.field_matrix_solve!(solver, x, A, b)
Project

If not using the `examples` project: ``` paste your Project.toml here. ``` ``` paste your Manifest.toml here. ```

System details

Any relevant system information:

  • Julia version
  • operating system
  • modules loaded on cluster (module list)

Related issues / PRs

Please add any relevant links.

@juliasloan25 juliasloan25 added the bug Something isn't working label May 22, 2024
@charleskawczynski
Copy link
Member

Closed by #1750

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants