Skip to content

Commit 5f4a20e

Browse files
committed
clipping sea ice tendencies
1 parent f1be93f commit 5f4a20e

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

experiments/ClimaEarth/components/ocean/prescr_seaice.jl

+6-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ include("../slab_utils.jl")
1414
1515
Ice concentration is prescribed, and we solve the following energy equation:
1616
17-
(h * ρ * c) d T_sfc dt = -(F_turb_energy + F_radiativead) + F_conductive
17+
(h * ρ * c) d T_sfc dt = -(F_turb_energy + F_radiative) + F_conductive
1818
1919
with
2020
F_conductive = k_ice (T_base - T_sfc) / (h)
@@ -24,9 +24,7 @@ Ice concentration is prescribed, and we solve the following energy equation:
2424
as well as a conductive flux that depends on the temperature difference
2525
across the ice layer (with `T_base` being prescribed).
2626
27-
In the current version, the sea ice has a prescribed thickness, and we assume that it is not
28-
sublimating. That contribution has been zeroed out in the atmos fluxes.
29-
27+
In the current version, the sea ice has a prescribed thickness.
3028
"""
3129
struct PrescribedIceSimulation{P, Y, D, I} <: Interfacer.SeaIceModelSimulation
3230
params::P
@@ -174,12 +172,11 @@ function ice_rhs!(du, u, p, _)
174172

175173
F_conductive = @. params.k_ice / (params.h) * (params.T_base - Y.T_sfc) # fluxes are defined to be positive when upward
176174
rhs = @. (-F_turb_energy - F_radiative + F_conductive) / (params.h * params.ρ * params.c)
177-
178-
# do not count tendencies that lead to temperatures above freezing, and mask out no-ice areas
175+
# If tendencies lead to temperature above freezing, set temperature to freezing
176+
@. rhs = min(rhs, (T_freeze - Y.T_sfc) / p.dt)
177+
# mask out no-ice areas
179178
area_mask = Regridder.binary_mask.(area_fraction)
180-
threshold = zero(FT)
181-
unphysical = @. Regridder.binary_mask.(T_freeze - (Y.T_sfc + FT(rhs) * FT(p.dt)), threshold) .* area_mask
182-
parent(dY.T_sfc) .= parent(rhs .* unphysical)
179+
dY.T_sfc .= rhs .* area_mask
183180

184181
@. p.q_sfc = TD.q_vap_saturation_generic.(p.thermo_params, Y.T_sfc, p.ρ_sfc, TD.Ice())
185182
end

test/component_model_tests/prescr_seaice_tests.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ for FT in (Float32, Float64)
4848
dT_expected = -1.0 / (p.params.h * p.params.ρ * p.params.c)
4949
@test sum([i for i in extrema(dY)] .≈ [FT(dT_expected), FT(dT_expected)]) == 2
5050

51-
# check that tendency not added if T of ice would have done above freezing
51+
# check that tendency will not result in above freezing T
5252
dY, Y, p = test_sea_ice_rhs(F_radiative = 0.0, T_base = 330.0) # Float32 requires a large number here!
53-
@test sum([i for i in extrema(dY)] .≈ [FT(0.0), FT(0.0)]) == 2
53+
dT_maximum = @. (p.params.T_freeze - Y.T_sfc) / p.dt
54+
@test minimum(dT_maximum .- dY.T_sfc) >= FT(0.0)
5455

5556
# check that the correct tendency was added due to basal flux
5657
dY, Y, p = test_sea_ice_rhs(F_radiative = 0.0, T_base = 269.2, global_mask = 1.0)

0 commit comments

Comments
 (0)