Skip to content

Wind-forced constricted channel example#5702

Draft
dkytezab wants to merge 1 commit into
mainfrom
abernathy
Draft

Wind-forced constricted channel example#5702
dkytezab wants to merge 1 commit into
mainfrom
abernathy

Conversation

@dkytezab

Copy link
Copy Markdown
Collaborator

cc @emmomp @glwagner @jlk9, see #5700. Ported from GB. Pared down some pieces, feel free to change text

@dkytezab

dkytezab commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

Hitting this at model construction:

Invalid operands for select instruction!
  %1310 = select <2 x i1> %1297, double %1308, double %1309
Invalid operands for select instruction!
  %1314 = select <2 x i1> %1297, double %1312, double %1313
Invalid operands for select instruction!
  %1320 = select <2 x i1> %1297, double %1318, double %1319
Invalid operands for select instruction!
  %1404 = select <2 x i1> %1297, double %1402, double %1403
Invalid operands for select instruction!
  %1535 = select <2 x i1> %1528, double %1402, double %1534
Invalid operands for select instruction!
  %1538 = select <2 x i1> %1528, double %1537, double %1319
Invalid operands for select instruction!
  %1543 = select <2 x i1> %1528, double %1312, double %1542
Invalid operands for select instruction!
  %1626 = select <2 x i1> %1528, double %1625, double %1309

@navidcy navidcy Jun 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No disrespect to Ryan, but were they really the first that set up a reentrant channel to deserve naming after therm? I think it's much better if we call this example reentrant_channel or something along those lines? Of course, cite Ryan's et al. paper that this was inspired from. What do you think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is also quite a bit different than the channel in Ryan's paper due to the bathymetry 😂 . I propose navid_channel.jl

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't like navid_channel.jl either :D

Comment on lines +60 to +66
## Geometrically stretched vertical spacing: thin cells at the surface, thick at depth
k_center = collect(1:Nz)
Δz_center = @. 10 * 1.104^(Nz - k_center)
Lz = sum(Δz_center)

z_faces = vcat([-Lz], -Lz .+ cumsum(Δz_center))
z_faces[Nz + 1] = 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can do this (or something very close to this) with ReferenceToStretchedDiscretization, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

julia> using Oceananigans

julia> z = ReferenceToStretchedDiscretization(extent=2000, stretching = PowerLawStretching(1.029), constant_spacing=10, constant_spacing_extent=10); z.faces
33-element Vector{Float64}:
 -2108.88
 -1842.41
 -1614.75
 -1419.38
 -1251.0
 -1105.27
  -978.63
  -868.14
     
   -87.29
   -71.9
   -57.65
   -44.43
   -32.14
   -20.69
   -10.0
     0.0

Which is very similar?

Comment on lines +68 to +74
underlying_grid = RectilinearGrid(architecture,
topology = (Periodic, Bounded, Bounded),
size = (Nx, Ny, Nz),
halo = (4, 4, 4),
x = (0, Lx),
y = (0, Ly),
z = z_faces)

@navidcy navidcy Jun 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suggest

Suggested change
underlying_grid = RectilinearGrid(architecture,
topology = (Periodic, Bounded, Bounded),
size = (Nx, Ny, Nz),
halo = (4, 4, 4),
x = (0, Lx),
y = (0, Ly),
z = z_faces)
## We construct a vertical discretization for a domain of depth around 2000 meters via `ReferenceToStretchedDiscretization`. We use a 10-meter vertical spacing at the surface and increase the spacing at depth via a power law.
z = ReferenceToStretchedDiscretization(extent=2000,
stretching = PowerLawStretching(1.029),
constant_spacing = 10,
constant_spacing_extent = 10)
Nz = length(z)
Lz = abs(z.faces[1]) # if this is used elsewhere
underlying_grid = RectilinearGrid(architecture;
topology = (Periodic, Bounded, Bounded),
size = (Nx, Ny, Nz),
halo = (4, 4, 4),
x = (0, Lx),
y = (0, Ly),
z)

and remove the definition of Lz and Nz above along with the geometric spacing construction.

# boundary-condition and forcing functions below.

α = 2e-4 # [K⁻¹] thermal expansion coefficient
g = 9.8061 # [m s⁻²] gravitational acceleration

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
g = 9.8061 # [m s⁻²] gravitational acceleration
g = Oceananigans.defaults.gravitational_acceleration

y_shutoff = 5/6 * Ly, # latitude north of which the buoyancy flux vanishes [m]
τ = 0.2 / ρ, # peak kinematic wind stress [m² s⁻²]
μ = 1 / 30days, # bottom-drag damping rate [s⁻¹]
ΔB = 8 * α * g, # surface buoyancy contrast [m s⁻²]

@navidcy navidcy Jun 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
ΔB = 8 * α * g, # surface buoyancy contrast [m s⁻²]
ΔT = 8, # surface temperature contrast [K]
ΔB = α * g * ΔT, # surface buoyancy contrast [m s⁻²]

ρ = 999.8 # [kg m⁻³] reference density

parameters = (; Ly, Lz,
Qᵇ = 10 / (ρ * cᵖ) * α * g, # buoyancy flux magnitude [m² s⁻³]

@navidcy navidcy Jun 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If I'm not mistaken, that 10 in Qᵇ = 10 / (ρ * cᵖ) * α * g is a heat flux. May I suggest:

Suggested change
Qᵇ = 10 /* cᵖ) * α * g, # buoyancy flux magnitude [m² s⁻³]
Q = 10, # heat flux magnitude [W m⁻²]
Qᵇ = Q /* cᵖ) * α * g, # buoyancy flux magnitude [m² s⁻³]

Comment on lines +95 to +96
cᵖ = 3994.0 # [J K⁻¹] heat capacity
ρ = 999.8 # [kg m⁻³] reference density

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
cᵖ = 3994.0 # [J K⁻¹] heat capacity
ρ = 999.8 # [kg m⁻³] reference density
cᵖ = 3994.0 # specific heat capacity [J K⁻¹ kg⁻¹]
ρ = 999.8 # reference density [kg m⁻³]

@glwagner glwagner changed the title Rabernathy channel example Wind-forced constricted channel example Jun 19, 2026
# A southern-hemisphere β-plane gives the planetary vorticity gradient that supports
# the Rossby waves and the asymmetry between the eastward and westward jets.

coriolis = BetaPlane(f₀ = -1e-4, β = 1e-11)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
coriolis = BetaPlane(f₀ = -1e-4, β = 1e-11)
coriolis = BetaPlane(latitude = -60)

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