Skip to content

Fix velocity exchanges across tripolar seam #4487

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BoundaryConditions/fill_halo_regions_zipper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ end

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

return nothing
end

Expand Down
19 changes: 13 additions & 6 deletions test/test_zstar_coordinate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const C = Center
const F = Face

@testset "ZStar coordinate scaling tests" begin
@info "testing the ZStar coordinate scalings"
@info "Testing ZStar coordinate scalings..."

z = MutableVerticalDiscretization((-20, 0))

Expand Down Expand Up @@ -103,7 +103,7 @@ const F = Face
end

@testset "MutableVerticalDiscretization tests" begin
@info "testing the MutableVerticalDiscretization in ZCoordinate mode"
@info "Testing the MutableVerticalDiscretization in ZCoordinate mode..."

z = MutableVerticalDiscretization((-20, 0))

Expand Down Expand Up @@ -195,7 +195,7 @@ end

info_msg = info_message(grid, free_surface)
@testset "$info_msg" begin
@info " Testing a $info_msg"
@info " Testing a $info_msg..."
model = HydrostaticFreeSurfaceModel(; grid,
free_surface,
tracers = (:b, :c),
Expand All @@ -213,7 +213,7 @@ end
end
end

@info " Testing a ZStar and Runge Kutta 3rd order time stepping"
@info " Testing a ZStar and Runge Kutta 3rd order time stepping..."

topology = topologies[2]
rtg = RectilinearGrid(arch; size=(10, 10, 20), x=(0, 100kilometers), y=(-10kilometers, 10kilometers), topology, z=z_stretched)
Expand Down Expand Up @@ -277,8 +277,15 @@ end

# Instead of initializing with random velocities, infer them from a random initial streamfunction
# to ensure the velocity field is divergence-free at initialization.
ψ = Field{Center, Center, Center}(grid)
set!(ψ, rand(size(ψ)...))
ψ = Field{Face, Face, Center}(grid)

mean_xspacing = mean(xspacings(grid, Face(), Face(), Center()))
mean_yspacing = mean(yspacings(grid, Face(), Face(), Center()))
Δ = mean((mean_xspacing, mean_yspacing))
U = 1

# Set streamfunction amplitude to Δ * U to yield velocities of order U.
set!(ψ, U * Δ * rand(size(ψ)...))
uᵢ = ∂y(ψ)
vᵢ = -∂x(ψ)

Expand Down