Skip to content
Draft
2 changes: 1 addition & 1 deletion .buildkite/examples_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ steps:
TMPDIR: "$TARTARUS_HOME/tmp"
command:
- "echo '--- Instantiate project'"
- "$TARTARUS_HOME/julia-$JULIA_VERSION/bin/julia --color=yes -O0 --project -e 'using Pkg; Pkg.instantiate(; verbose=true); Pkg.precompile(; strict=true)'"
- "$TARTARUS_HOME/julia-$JULIA_VERSION/bin/julia --color=yes -O0 --project -e 'using Pkg; Pkg.add(url=\"https://github.com/CliMA/ClimaSeaIce.jl\", rev=\"ss/b-grid-dynamics\"); Pkg.instantiate(; verbose=true); Pkg.precompile(; strict=true)'"
# force the initialization of the CUDA runtime as it is lazily loaded by default
- "$TARTARUS_HOME/julia-$JULIA_VERSION/bin/julia --color=yes -O0 --project -e 'using CUDA; CUDA.precompile_runtime()'"
agents:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Printf
using Oceananigans.Operators: ℑxᶠᵃᵃ, ℑyᵃᶠᵃ
using Oceananigans.Operators: ℑxᶠᵃᵃ, ℑyᵃᶠᵃ, ℑxyᶠᶠᵃ
using Oceananigans.Forcings: MultipleForcings

using ClimaOcean.OceanSeaIceModels: sea_ice_concentration
Expand Down Expand Up @@ -176,8 +176,8 @@ end

τxao = ℑxᶠᵃᵃ(i, j, 1, grid, τᶜᶜᶜ, ρₒ⁻¹, ℵ, ρτxao)
τyao = ℑyᵃᶠᵃ(i, j, 1, grid, τᶜᶜᶜ, ρₒ⁻¹, ℵ, ρτyao)
τxio = ρτxio[i, j, 1] * ρₒ⁻¹ * ℑxᶠᵃᵃ(i, j, 1, grid, ℵ)
τyio = ρτyio[i, j, 1] * ρₒ⁻¹ * ℑyᵃᶠᵃ(i, j, 1, grid, ℵ)
τxio = ℑyᵃᶜᵃ(i, j, 1, grid, ρτxio) * ρₒ⁻¹ * ℑxᶠᵃᵃ(i, j, 1, grid, ℵ)
τyio = ℑxᶜᵃᵃ(i, j, 1, grid, ρτyio) * ρₒ⁻¹ * ℑyᵃᶠᵃ(i, j, 1, grid, ℵ)

# Stresses
τx[i, j, 1] = τxao + τxio
Expand Down Expand Up @@ -289,7 +289,7 @@ end
inactive = inactive_node(i, j, kᴺ, grid, c, c, c)

@inbounds top_fluxes.heat[i, j, 1] = ifelse(inactive, zero(grid), ΣQt)
@inbounds top_fluxes.u[i, j, 1] = ifelse(inactive, zero(grid), ℑxᶠᵃᵃ(i, j, 1, grid, ρτx))
@inbounds top_fluxes.v[i, j, 1] = ifelse(inactive, zero(grid), ℑyᵃᶠᵃ(i, j, 1, grid, ρτy))
@inbounds top_fluxes.u[i, j, 1] = ifelse(inactive, zero(grid), ℑxyᶠᶠᵃ(i, j, 1, grid, ρτx))
@inbounds top_fluxes.v[i, j, 1] = ifelse(inactive, zero(grid), ℑxyᶠᶠᵃ(i, j, 1, grid, ρτy))
@inbounds bottom_heat_flux[i, j, 1] = ifelse(inactive, zero(grid), ΣQb)
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Oceananigans.Operators: intrinsic_vector
using Oceananigans.Operators: intrinsic_vector, ℑxyᶜᶜᵃ
using Oceananigans.Grids: inactive_node
using Oceananigans.Fields: ZeroField

Expand Down Expand Up @@ -94,8 +94,8 @@ end
Sᵢ = interior_state.Sₒ[i, j, kᴺ]

# Sea ice properties
uᵢ = zero(FT) # ℑxᶜᵃᵃ(i, j, 1, grid, interior_state.u)
vᵢ = zero(FT) # ℑyᵃᶜᵃ(i, j, 1, grid, interior_state.v)
uᵢ = ℑxyᶜᶜᵃ(i, j, 1, grid, interior_state.u)
vᵢ = ℑxyᶜᶜᵃ(i, j, 1, grid, interior_state.v)
hᵢ = interior_state.h[i, j, 1]
ℵᵢ = interior_state.ℵ[i, j, 1]
Tₛ = interface_temperature[i, j, 1]
Expand Down
12 changes: 7 additions & 5 deletions src/OceanSeaIceModels/InterfaceComputations/roughness_lengths.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,25 @@ Base.show(io::IO, ::ScalarRoughnessLength{FT}) where FT = print(io, "ScalarRough

struct WindDependentWaveFormulation{FT}
Umax :: FT
αmin :: FT
ℂ₁ :: FT
ℂ₂ :: FT
end

"""
WindDependentWaveFormulation(FT = Oceananigans.defaults.FloatType;
Umax = 19, ℂ₁ = 0.0017, ℂ₂ = -0.005)
Umax = 19, αmin = 0.011, ℂ₁ = 0.0017, ℂ₂ = -0.005)
Copy link
Member

Choose a reason for hiding this comment

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

what's "alpha"? you may just want to use a more verbose name.


A gravity wave parameter based on the wind speed `ΔU` with the formula `ℂ₁ * max(ΔU, Umax) + ℂ₂`.
A gravity wave parameter based on the wind speed `ΔU` with the formula `max(αmin, ℂ₁ * min(ΔU, Umax) + ℂ₂`).
"""
WindDependentWaveFormulation(FT=Oceananigans.defaults.FloatType; Umax = 19, ℂ₁ = 0.0017, ℂ₂ = -0.005) =
WindDependentWaveFormulation(FT=Oceananigans.defaults.FloatType; Umax = 19, αmin = 0.011, ℂ₁ = 0.0017, ℂ₂ = -0.005) =
WindDependentWaveFormulation(convert(FT, Umax),
convert(FT, αmin),
convert(FT, ℂ₁),
convert(FT, ℂ₂))

gravity_wave_parameter(α::Number, args...) = α
gravity_wave_parameter(α::WindDependentWaveFormulation, ΔU) = α.ℂ₁ * max(ΔU, α.Umax) + α.ℂ₂
gravity_wave_parameter(α::WindDependentWaveFormulation, ΔU) = max(α.αmin, α.ℂ₁ * min(ΔU, α.Umax) + α.ℂ₂)

"""
ScalarRoughnessLength(FT = Float64;
Expand Down Expand Up @@ -88,7 +90,7 @@ function MomentumRoughnessLength(FT=Oceananigans.defaults.FloatType;
gravitational_acceleration = default_gravitational_acceleration,
maximum_roughness_length = 1,
air_kinematic_viscosity = 1.5e-5,
wave_formulation = 0.02,
wave_formulation = WindDependentWaveFormulation(FT),
smooth_wall_parameter = 0.11)

if wave_formulation isa Number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ end
Jˢ[i, j, 1] = thermodynamic_tendency[i, j, 1] * (Sᵢ[i, j, 1] - Sₒ[i, j, Nz])

# Momentum stresses
τx[i, j, 1] = x_momentum_stress(i, j, Nz, grid, τₒᵢ, clock, sea_ice_fields)
τy[i, j, 1] = y_momentum_stress(i, j, Nz, grid, τₒᵢ, clock, sea_ice_fields)
τx[i, j, 1] = ℑyᵃᶜᵃ(i, j, Nz, grid, x_momentum_stress, τₒᵢ, clock, sea_ice_fields)
τy[i, j, 1] = ℑxᶜᵃᵃ(i, j, Nz, grid, y_momentum_stress, τₒᵢ, clock, sea_ice_fields)
end
end
4 changes: 2 additions & 2 deletions src/SeaIceSimulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ function sea_ice_dynamics(grid, ocean=nothing;
sea_ice_ocean_drag_coefficient = convert(eltype(grid), sea_ice_ocean_drag_coefficient)

τo = SemiImplicitStress(uₑ=SSU, vₑ=SSV, Cᴰ=sea_ice_ocean_drag_coefficient)
τua = Field{Face, Center, Nothing}(grid)
τva = Field{Center, Face, Nothing}(grid)
τua = Field{Face, Face, Nothing}(grid)
τva = Field{Face, Face, Nothing}(grid)

if isnothing(free_drift)
free_drift = StressBalanceFreeDrift((u=τua, v=τva), τo)
Expand Down
Loading