Skip to content

Extend the interior function to MultiRegionFields#4743

Merged
simone-silvestri merged 2 commits intomainfrom
sb/extend-interior-to-mrf
Sep 1, 2025
Merged

Extend the interior function to MultiRegionFields#4743
simone-silvestri merged 2 commits intomainfrom
sb/extend-interior-to-mrf

Conversation

@siddharthabishnu
Copy link
Copy Markdown
Contributor

@siddharthabishnu siddharthabishnu commented Aug 30, 2025

Consider the following MWE:

julia> using Oceananigans
┌ Warning: You are using Julia v1.11 or later!"
│ Oceananigans is currently tested on Julia v1.10."
│ If you find issues with Julia v1.11 or later,"
│ please report at https://github.com/CliMA/Oceananigans.jl/issues/new
└ @ Oceananigans ~/Library/CloudStorage/Dropbox/StudyFolder/PostDocMITDesktop/Codes/Oceananigans/main/src/Oceananigans.jl:124
[ Info: Oceananigans will use 8 threads

julia> arch = CPU()
CPU()

julia> Nx, Ny, Nz = 4, 4, 4
(4, 4, 4)

julia> grid = ConformalCubedSphereGrid(arch; panel_size=(Nx, Ny, Nz), z=(-1, 0), horizontal_direction_halo=2, radius=1)
ConformalCubedSphereGrid{Float64, Oceananigans.Grids.FullyConnected, Oceananigans.Grids.FullyConnected, Bounded} partitioned on CPU():
├── grids: 4×4×4 OrthogonalSphericalShellGrid{Float64, Oceananigans.Grids.FullyConnected, Oceananigans.Grids.FullyConnected, Bounded} on CPU with 2×2×2 halo and with precomputed metrics
├── partitioning: CubedSpherePartition with (1 region in each panel)
├── connectivity: CubedSphereConnectivity
└── devices: (CPU(), CPU(), CPU(), CPU(), CPU(), CPU())

julia> c = CenterField(grid)
CubedSphereField{Center, Center, Center}
├── grid: 4×4×4 ConformalCubedSphereGrid{Float64, Oceananigans.Grids.FullyConnected, Oceananigans.Grids.FullyConnected, Bounded} on CPU with 2×2×2 halo
├── boundary conditions: FieldBoundaryConditions
└── data: MultiRegionObject{NTuple{6, OffsetArrays.OffsetArray{Float64, 3, Array{Float64, 3}}}, NTuple{6, CPU}, KernelAbstractions.CPU}
    └── max=0.0, min=0.0, mean=0.0

julia> set!(c, 1)

Before this PR:

julia> interior(c)
ERROR: MethodError: no method matching interior(::MultiRegionObject{…}, ::Tuple{…}, ::ConformalCubedSphereGrid{…}, ::MultiRegionObject{…})
The function `interior` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  interior(::FieldTimeSeries, ::Any...)
   @ Oceananigans ~/Library/CloudStorage/Dropbox/StudyFolder/PostDocMITDesktop/Codes/Oceananigans/main/src/OutputReaders/field_time_series.jl:720
  interior(::Field, ::Any...)
   @ Oceananigans ~/Library/CloudStorage/Dropbox/StudyFolder/PostDocMITDesktop/Codes/Oceananigans/main/src/Fields/field.jl:424
  interior(::OffsetArrays.OffsetArray, ::Any, ::Any, ::Any)
   @ Oceananigans ~/Library/CloudStorage/Dropbox/StudyFolder/PostDocMITDesktop/Codes/Oceananigans/main/src/Fields/field.jl:423
  ...

Stacktrace:
 [1] interior(f::Field{Center, Center, Center, Nothing, ConformalCubedSphereGrid{…}, MultiRegionObject{…}, MultiRegionObject{…}, Any, MultiRegionObject{…}, Nothing, MultiRegionObject{…}})
   @ Oceananigans.Fields ~/Library/CloudStorage/Dropbox/StudyFolder/PostDocMITDesktop/Codes/Oceananigans/main/src/Fields/field.jl:422
 [2] top-level scope
   @ REPL[8]:1
Some type information was truncated. Use `show(err)` to see complete types.

After this PR,

julia> interior(c)
MultiRegionObject{NTuple{6, SubArray{Float64, 3, Array{Float64, 3}, Tuple{UnitRange{Int64}, UnitRange{Int64}, UnitRange{Int64}}, false}}, NTuple{6, CPU}, KernelAbstractions.CPU}(([1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0;;; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0;;; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0;;; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1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1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0;;; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0], [1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0;;; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0;;; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0;;; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0]), (CPU(), CPU(), CPU(), CPU(), CPU(), CPU()), KernelAbstractions.CPU(false))

siddharthabishnu added a commit that referenced this pull request Aug 30, 2025
siddharthabishnu added a commit that referenced this pull request Aug 30, 2025
@siddharthabishnu siddharthabishnu force-pushed the sb/extend-interior-to-mrf branch from 24dfb4e to f18e825 Compare August 30, 2025 17:18
siddharthabishnu added a commit that referenced this pull request Aug 30, 2025
siddharthabishnu added a commit that referenced this pull request Aug 30, 2025
siddharthabishnu added a commit that referenced this pull request Aug 30, 2025
@siddharthabishnu siddharthabishnu changed the title Extend the interior function to MultiRegionFields Extend interior and minimum spacing functions to MultiRegionFields Aug 30, 2025
@siddharthabishnu siddharthabishnu changed the title Extend interior and minimum spacing functions to MultiRegionFields Extend the interior function to MultiRegionFields Aug 30, 2025
siddharthabishnu added a commit that referenced this pull request Aug 30, 2025
@simone-silvestri simone-silvestri merged commit e3b3c8c into main Sep 1, 2025
37 of 73 checks passed
@simone-silvestri simone-silvestri deleted the sb/extend-interior-to-mrf branch September 1, 2025 10:44
@tomchor
Copy link
Copy Markdown
Member

tomchor commented Sep 1, 2025

I think this PR introduced the following error when building the docs:

image

Seen in #4687

@simone-silvestri
Copy link
Copy Markdown
Collaborator

simone-silvestri commented Sep 1, 2025

I don't think is this one. The show method is not touched here. However, we should correct this issue

siddharthabishnu added a commit that referenced this pull request Dec 20, 2025
* Use alternate formulation for corner vorticity

* Add option to interpolate vorticity to corners

* Fix bugs

* Retain only weighted mean of enclosing vorticities

* Reduce unnecessary spacing

* Insert updates from PRs #4724, #4743 and #4744

* Remove experimental formulation for CCS corner ζ

* Retain only CCSPanel corner ζ computation script

* Remove redundant function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants