Skip to content

Commit

Permalink
another bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
simone-silvestri committed Aug 29, 2024
1 parent ffca52b commit 0fd3986
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions examples/internal_tide.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

using Oceananigans
using Oceananigans.Units
using Oceananigans.ImmersedBoundaries: PartialCellBottom

# ## Grid

Expand Down Expand Up @@ -46,15 +47,15 @@ width = 20kilometers
hill(x) = h₀ * exp(-x^2 / 2width^2)
bottom(x) = - H + hill(x)

grid = ImmersedBoundaryGrid(underlying_grid, GridFittedBottom(bottom))
grid = ImmersedBoundaryGrid(underlying_grid, PartialCellBottom(bottom))

# Let's see how the domain with the bathymetry is.

x = xnodes(grid, Center())
bottom_boundary = interior(grid.immersed_boundary.bottom_height, :, 1, 1)
top_boundary = 0 * x

using CairoMakie
using GLMakie

fig = Figure(size = (700, 200))
ax = Axis(fig[1, 1],
Expand Down Expand Up @@ -132,7 +133,7 @@ bᵢ(x, z) = Nᵢ² * z

set!(model, u=uᵢ, b=bᵢ)

# Now let's built a `Simulation`.
# Now let's build a `Simulation`.

Δt = 5minutes
stop_time = 4days
Expand Down Expand Up @@ -234,9 +235,9 @@ n = Observable(1)
title = @lift @sprintf("t = %1.2f days = %1.2f T₂",
round(times[$n] / day, digits=2) , round(times[$n] / T₂, digits=2))

u′ₙ = @lift u′_t[$n]
wₙ = @lift w_t[$n]
N²ₙ = @lift N²_t[$n]
u′ₙ = @lift interior(u′_t[$n], :, 1, :)
wₙ = @lift interior( w_t[$n], :, 1, :)
N²ₙ = @lift interior(N²_t[$n], :, 1, :)

axis_kwargs = (xlabel = "x [km]",
ylabel = "z [km]",
Expand Down
2 changes: 1 addition & 1 deletion src/ImmersedBoundaries/partial_cell_bottom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Criterion is h ≥ z - ϵ Δz
ϵ = ib.minimum_fractional_cell_height
# z + Δz is equal to the face above the current cell
Δz = Δzᶜᶜᶜ(i, j, k, underlying_grid)
return z + Δz * ϵ h
return z + Δz * (1 - ϵ) h
end

@inline bottom_cell(i, j, k, ibg::PCBIBG) = !immersed_cell(i, j, k, ibg.underlying_grid, ibg.immersed_boundary) &
Expand Down

0 comments on commit 0fd3986

Please sign in to comment.