Skip to content

Commit

Permalink
(0.1.9) Ensure consistency in the last row. (#58)
Browse files Browse the repository at this point in the history
* fix last row

* update

* add a test

* Update zipper_boundary_condition.jl

* Update test_zipper_boundary_conditions.jl

* fix test

* correct tests
  • Loading branch information
simone-silvestri authored Nov 22, 2024
1 parent 1361a08 commit 107ec2f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OrthogonalSphericalShellGrids"
uuid = "c2be9673-fb75-4747-82dc-aa2bb9f4aed0"
authors = ["Climate Modeling Alliance and contributors"]
version = "0.1.8"
version = "0.1.9"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
7 changes: 7 additions & 0 deletions src/zipper_boundary_condition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ c₂ == c₃
```
This is not the case for the v-velocity (or any field on the j-faces) where the last grid point is not repeated.
Because of this redundancy, we ensure consistency by substituting the redundant part of fields Centered in x, in the last row.
"""
ZipperBoundaryCondition(sign = 1) = BoundaryCondition(Zipper(), sign)

Expand Down Expand Up @@ -96,6 +97,9 @@ end
end
end

# We substitute the redundant part of the last row to ensure consistency
@inbounds c[i, Ny, k] = ifelse(i > Nx ÷ 2, c[i′, Ny, k], c[i, Ny, k])

return nothing
end

Expand Down Expand Up @@ -126,6 +130,9 @@ end
end
end

# We substitute the redundant part of the last row to ensure consistency
@inbounds c[i, Ny, k] = ifelse(i > Nx ÷ 2, c[i′, Ny, k], c[i, Ny, k])

return nothing
end

Expand Down
11 changes: 10 additions & 1 deletion test/test_zipper_boundary_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,13 @@ using OrthogonalSphericalShellGrids: Zipper
north_boundary_u_right = view(u.data, Nx+1, Ny+1:Ny+Hy, 1)
@test all(north_boundary_u_left .== 1)
@test all(north_boundary_u_right .== 1)
end

bottom(x, y) = rand()

grid = TripolarGrid(size = (10, 10, 1))
grid = ImmersedBoundaryGrid(grid, GridFittedBottom(bottom))

bottom_height = grid.immersed_boundary.bottom_height

@test interior(bottom_height, :, 10, 1) == interior(bottom_height, 10:-1:1, 10, 1)
end

2 comments on commit 107ec2f

@simone-silvestri
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/120013

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.9 -m "<description of version>" 107ec2f009c26b8699ea2d5f90a96ed8965377a6
git push origin v0.1.9

Please sign in to comment.