Skip to content

Commit fa88a47

Browse files
(0.4.6) Remove thermodynamics step from ClimaOcean and use new ClimaSeaIce version (#383)
* change * update to new syntax * update to new syntax * reference heat capactity * bump patch
1 parent cdd545e commit fa88a47

File tree

4 files changed

+7
-130
lines changed

4 files changed

+7
-130
lines changed

Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "ClimaOcean"
22
uuid = "0376089a-ecfe-4b0e-a64f-9c555d74d754"
33
license = "MIT"
44
authors = ["Climate Modeling Alliance and contributors"]
5-
version = "0.4.5"
5+
version = "0.4.6"
66

77
[deps]
88
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
@@ -33,7 +33,7 @@ Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"
3333
Adapt = "4"
3434
CFTime = "0.1"
3535
CUDA = "4, 5"
36-
ClimaSeaIce = "0.2.1"
36+
ClimaSeaIce = "0.2.3"
3737
CubicSplines = "0.2"
3838
DataDeps = "0.7"
3939
Downloads = "1.6"

src/OceanSeaIceModels/InterfaceComputations/sea_ice_ocean_fluxes.jl

+4-7
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,19 @@ end
9494
Sᴺ = Sₒ[i, j, Nz]
9595
end
9696

97-
# Adjust temperature
98-
Tₘ = melting_temperature(liquidus, Sᴺ)
99-
ΔT =* (Tₘ - Tᴺ)
100-
10197
# Compute total heat associated with temperature adjustment
102-
δE_ice_bath = ρₒ * cₒ * ΔT
98+
Tₘ = melting_temperature(liquidus, Sᴺ)
99+
δE_ice_bath = ρₒ * cₒ * (Tₘ - Tᴺ)
103100

104101
# Compute the heat flux from ocean into ice due to sea ice melting.
105102
# A positive value δQ_melting > 0 corresponds to ocean cooling; ie
106103
# is fluxing upwards, into the ice. This occurs when applying the
107104
# ice bath equilibrium condition to cool down a warm ocean (δEₒ < 0).
108-
δQ_melting = - δE_ice_bath * uₘ★
105+
δQ_melting = - δE_ice_bath * uₘ★
109106

110107
# Store column-integrated ice-ocean heat flux
111108
@inbounds Qᶠₒ[i, j, 1] = δQ_frazil
112-
@inbounds Qᵢₒ[i, j, 1] = δQ_melting
109+
@inbounds Qᵢₒ[i, j, 1] = δQ_melting *# Melting depends on concentration
113110
end
114111

115112
function compute_sea_ice_ocean_salinity_flux!(coupled_model)

src/OceanSeaIceModels/OceanSeaIceModels.jl

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ compute_atmosphere_ocean_fluxes!(::NoAtmosphereModel) = nothing
7878
compute_atmosphere_sea_ice_fluxes!(::NoAtmosphereModel) = nothing
7979

8080
const PrescribedAtmosphereModel = OceanSeaIceModel{<:Any, <:PrescribedAtmosphere}
81+
8182
compute_net_atmosphere_fluxes!(::PrescribedAtmosphereModel) = nothing
8283

8384
# "No sea ice" implementation

src/OceanSeaIceModels/time_step_ocean_sea_ice_model.jl

-121
Original file line numberDiff line numberDiff line change
@@ -68,124 +68,3 @@ function update_state!(coupled_model::OceanSeaIceModel, callbacks=[]; compute_te
6868

6969
return nothing
7070
end
71-
72-
function thermodynamic_sea_ice_time_step!(coupled_model)
73-
sea_ice = coupled_model.sea_ice
74-
model = sea_ice.model
75-
Δt = sea_ice.Δt
76-
grid = coupled_model.sea_ice.model.grid
77-
arch = architecture(grid)
78-
clock = model.clock
79-
thermodynamics = model.ice_thermodynamics
80-
ice_thickness = model.ice_thickness
81-
ice_concentration = model.ice_concentration
82-
ice_consolidation_thickness = model.ice_consolidation_thickness
83-
top_external_heat_flux = model.external_heat_fluxes.top
84-
bottom_external_heat_flux = model.external_heat_fluxes.bottom
85-
ocean_salinity = coupled_model.ocean.model.tracers.S
86-
87-
launch!(arch, grid, :xy, update_thickness!,
88-
ice_thickness,
89-
grid, Δt,
90-
ice_concentration,
91-
ice_consolidation_thickness,
92-
ocean_salinity,
93-
thermodynamics,
94-
top_external_heat_flux,
95-
bottom_external_heat_flux,
96-
clock)
97-
98-
return nothing
99-
end
100-
101-
@inline function conservative_adjustment(ℵ, h, hᶜ)
102-
V =* h # = ℵ⁺ * (h + dh)
103-
dh = max(zero(h), hᶜ - h)
104-
ℵ⁺ = V / (h + dh)
105-
return ℵ⁺, h + dh
106-
end
107-
108-
@kernel function update_thickness!(ice_thickness,
109-
grid, Δt,
110-
ice_concentration,
111-
ice_consolidation_thickness,
112-
ocean_salinity,
113-
thermodynamics,
114-
top_external_heat_flux,
115-
bottom_external_heat_flux,
116-
clock)
117-
118-
i, j = @index(Global, NTuple)
119-
kᴺ = size(grid, 3)
120-
121-
phase_transitions = thermodynamics.phase_transitions
122-
top_heat_bc = thermodynamics.heat_boundary_conditions.top
123-
bottom_heat_bc = thermodynamics.heat_boundary_conditions.bottom
124-
liquidus = phase_transitions.liquidus
125-
126-
Qi = thermodynamics.internal_heat_flux
127-
Qu = top_external_heat_flux
128-
Qb = bottom_external_heat_flux
129-
Tu = thermodynamics.top_surface_temperature
130-
131-
@inbounds begin
132-
hᶜ = ice_consolidation_thickness[i, j, kᴺ]
133-
hᵢ = ice_thickness[i, j, kᴺ]
134-
ℵᵢ = ice_concentration[i, j, kᴺ]
135-
end
136-
137-
# Volume conserving adjustment to respect minimum thickness
138-
ℵᵢ, hᵢ = conservative_adjustment(ℵᵢ, hᵢ, hᶜ)
139-
140-
# Consolidation criteria
141-
@inbounds Tuᵢ = Tu[i, j, 1]
142-
143-
# Bottom temperature at the melting temperature
144-
Sₒ = @inbounds ocean_salinity[i, j, kᴺ]
145-
Tbᵢ = SeaIceThermodynamics.melting_temperature(liquidus, Sₒ)
146-
ℰb = SeaIceThermodynamics.latent_heat(phase_transitions, Tbᵢ)
147-
ℰu = SeaIceThermodynamics.latent_heat(phase_transitions, Tuᵢ)
148-
149-
# Retrieve fluxes
150-
@inbounds begin
151-
Quᵢ = Qu[i, j, 1]
152-
Qbᵢ = Qb[i, j, 1]
153-
end
154-
155-
# If ice is consolidated, compute tendency for an ice slab; otherwise
156-
# just add ocean fluxes from frazil ice formation or melting
157-
# wb = - Qbᵢ / ℰb
158-
159-
𝓀 = Qi.parameters.flux.conductivity
160-
Qiᵢ = - 𝓀 * (Tuᵢ - Tbᵢ) / hᵢ * (hᵢ > hᶜ) # getflux(Qi, i, j, grid, Tuᵢ, clock, model_fields)
161-
162-
# Upper (top) and bottom interface velocities
163-
w_top = (Quᵢ - Qiᵢ) / ℰu # < 0 => melting
164-
w_bot = +Qiᵢ / ℰb # < 0 => freezing
165-
w_frz = -Qbᵢ / ℰb # < 0 => freezing
166-
167-
Δh_top = w_top * Δt * ℵᵢ
168-
Δh_bot = w_bot * Δt * ℵᵢ
169-
ΔV_frz = w_frz * Δt # frazil flux contributes from entire cell
170-
171-
# Compute frazil growth: lateral first, then vertical
172-
# dV = dh * ℵ + h * dℵ
173-
dℵ = min(1 - ℵᵢ, ΔV_frz / hᵢ)
174-
dℵ = max(dℵ, zero(dℵ))
175-
ℵ⁺ = ℵᵢ + dℵ
176-
Δh_frz = ΔV_frz - hᵢ * ℵ⁺
177-
178-
Δh = Δh_frz + Δh_bot + Δh_top
179-
180-
h⁺ = hᵢ + Δh / ℵ⁺ * (Δh > 0)
181-
h⁺ = max(zero(h⁺), h⁺)
182-
183-
# Adjust again to be paranoid?
184-
ℵ⁺, h⁺ = conservative_adjustment(ℵ⁺, h⁺, hᶜ)
185-
186-
@inbounds begin
187-
ice_thickness[i, j, kᴺ] = h⁺
188-
ice_concentration[i, j, kᴺ] = ℵ⁺
189-
end
190-
end
191-

0 commit comments

Comments
 (0)