Skip to content

Error when constructing Integral of a field on an immersed rectilinear grid: Azᶜᶜᵃ not defined #3948

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

Closed
ali-ramadhan opened this issue Nov 21, 2024 · 1 comment · Fixed by #3949
Labels
bug 🐞 Even a perfect program still has bugs

Comments

@ali-ramadhan
Copy link
Member

ali-ramadhan commented Nov 21, 2024

Found with @raphael-ouillon. Probably a result of #3143. Should be an easy fix. I'll try to open a PR soon.


Environment: Julia 1.10.6 + Oceananigans main branch.

MWE:

using Oceananigans

Nx, Ny, Nz = 3, 3, 3

underlying_grid = RectilinearGrid(
    topology=(Periodic, Periodic, Periodic),
    size=(Nx, Ny, Nz),
    x=(0, 1), y=(0, 1), z=(0, 1)
)

bottom(x, y) = x + y
grid = ImmersedBoundaryGrid(underlying_grid, GridFittedBottom(bottom))

c = CenterField(grid)
set!(c, (x, y, z) -> x + y + z)

max_c² = Field(Reduction(maximum, c^2, dims=3))
max_c²_integral = Integral(max_c², dims=(1, 2))

Error:

ERROR: UndefVarError: `Azᶜᶜᵃ` not defined
Stacktrace:
 [1] metric_function
   @ ~/atdepth/Oceananigans.jl/src/AbstractOperations/grid_metrics.jl:120 [inlined]
 [2] Oceananigans.AbstractOperations.GridMetricOperation(L::Tuple{DataType, DataType, DataType}, metric::Oceananigans.AbstractOperations.ZAreaMetric, grid::ImmersedBoundaryGrid{Float64, Periodic, Periodic, Periodic, RectilinearGrid{…}, GridFittedBottom{…}, Nothing, Nothing, CPU})
   @ Oceananigans.AbstractOperations ~/atdepth/Oceananigans.jl/src/AbstractOperations/grid_metrics.jl:146
 [3] *(Lc::Tuple{…}, a::Field{…}, m::Oceananigans.AbstractOperations.ZAreaMetric)
   @ Oceananigans.AbstractOperations ~/atdepth/Oceananigans.jl/src/AbstractOperations/binary_operations.jl:120
 [4] *
   @ ~/atdepth/Oceananigans.jl/src/AbstractOperations/binary_operations.jl:124 [inlined]
 [5] (Reduction{…})(field::Field{…}; dims::Tuple{…}, condition::Nothing, mask::Int64)
   @ Oceananigans.AbstractOperations ~/atdepth/Oceananigans.jl/src/AbstractOperations/metric_field_reductions.jl:111
 [6] top-level scope
   @ REPL[9]:1
Some type information was truncated. Use `show(err)` to see complete types.

@ali-ramadhan ali-ramadhan added the bug 🐞 Even a perfect program still has bugs label Nov 21, 2024
@glwagner
Copy link
Member

🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Even a perfect program still has bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants