Skip to content

Commit

Permalink
(0.95.5) Bugfix in immersed phi-node (#4010)
Browse files Browse the repository at this point in the history
* correct immersed nodes

* added a test
  • Loading branch information
simone-silvestri authored Dec 18, 2024
1 parent ee03410 commit ac86c3a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Oceananigans"
uuid = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
authors = ["Climate Modeling Alliance and contributors"]
version = "0.95.4"
version = "0.95.5"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
2 changes: 1 addition & 1 deletion src/ImmersedBoundaries/immersed_boundary_nodes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const f = Face()
@inline znode(k, ibg::IBG, ℓz) = znode(k, ibg.underlying_grid, ℓz)

@inline λnode(i, ibg::IBG, ℓx) = λnode(i, ibg.underlying_grid, ℓx)
@inline φnode(j, ibg::IBG, ℓy) = φnode(i, ibg.underlying_grid, ℓy)
@inline φnode(j, ibg::IBG, ℓy) = φnode(j, ibg.underlying_grid, ℓy)

@inline xnode(i, j, ibg::IBG, ℓx, ℓy) = xnode(i, j, ibg.underlying_grid, ℓx, ℓy)

Expand Down
13 changes: 9 additions & 4 deletions test/test_grids.jl
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ function test_lat_lon_xyzλφ_node_nodes(FT, arch)
zᵣ = (-10, 0)

grid = LatitudeLongitudeGrid(CPU(), FT, size=grid_size, halo=halo, latitude=lat, longitude=lon, z=zᵣ)
ibg = ImmersedBoundaryGrid(grid, GridFittedBottom((x, y) -> y < 20 && y > -20 ? -50 : -0))

@info " Testing grid utils on LatitudeLongitude grid...."

Expand All @@ -658,15 +659,19 @@ function test_lat_lon_xyzλφ_node_nodes(FT, arch)
@test ynode(2, 1, 2, grid, Face(), Face(), Face()) / grid.radius -FT/3)
@test znode(2, 1, 2, grid, Face(), Face(), Face()) -5

@test λnode(3, 1, 2, ibg, Face(), Face(), Face()) -120
@test φnode(3, 2, 2, ibg, Face(), Face(), Face()) -30
@test xnode(5, 1, 2, ibg, Face(), Face(), Face()) / ibg.radius -FT/6)
@test ynode(2, 1, 2, ibg, Face(), Face(), Face()) / ibg.radius -FT/3)
@test znode(2, 1, 2, ibg, Face(), Face(), Face()) -5

@test minimum_xspacing(grid, Face(), Face(), Face()) / grid.radius FT/6) * cosd(60)
@test minimum_xspacing(grid) / grid.radius FT/6) * cosd(45)
@test minimum_yspacing(grid) / grid.radius FT/6)
@test minimum_zspacing(grid) 5

grid = ImmersedBoundaryGrid(grid, GridFittedBottom((x, y) -> y < 20 && y > -20 ? -50 : -0))

@test minimum_xspacing(grid, Face(), Face(), Face()) / grid.radius FT/6) * cosd(30)
@test minimum_xspacing(grid) / grid.radius FT/6) * cosd(15)
@test minimum_xspacing(ibg, Face(), Face(), Face()) / ibg.radius FT/6) * cosd(30)
@test minimum_xspacing(ibg) / ibg.radius FT/6) * cosd(15)

return nothing
end
Expand Down

0 comments on commit ac86c3a

Please sign in to comment.