Skip to content

Commit

Permalink
Merge pull request #1010 from CliMA/zs/sea_ice
Browse files Browse the repository at this point in the history
clipping sea ice tendencies
  • Loading branch information
szy21 authored Oct 11, 2024
2 parents 52ab0ef + eab10f8 commit 82ac791
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions config/nightly_configs/amip_coarse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ albedo_model: "CouplerAlbedo"
anim: false
atmos_config_file: "config/longrun_configs/amip_target_diagedmf.yml"
coupler_toml_file: "toml/amip.toml"
dt: "240secs"
dt_cpl: 240
dt: "180secs"
dt_cpl: 180
dt_save_state_to_disk: "30days"
dt_save_to_sol: "30days"
dz_bottom: 100.0
Expand All @@ -22,7 +22,7 @@ rayleigh_sponge: true
smoothing_order: 10
start_date: "20100101"
surface_setup: "PrescribedSurface"
t_end: "732days"
t_end: "549days"
topo_smoothing: true
topography: "Earth"
turb_flux_partition: "CombinedStateFluxesMOST"
Expand Down
15 changes: 6 additions & 9 deletions experiments/ClimaEarth/components/ocean/prescr_seaice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include("../slab_utils.jl")
Ice concentration is prescribed, and we solve the following energy equation:
(h * ρ * c) d T_sfc dt = -(F_turb_energy + F_radiativead) + F_conductive
(h * ρ * c) d T_sfc dt = -(F_turb_energy + F_radiative) + F_conductive
with
F_conductive = k_ice (T_base - T_sfc) / (h)
Expand All @@ -24,9 +24,7 @@ Ice concentration is prescribed, and we solve the following energy equation:
as well as a conductive flux that depends on the temperature difference
across the ice layer (with `T_base` being prescribed).
In the current version, the sea ice has a prescribed thickness, and we assume that it is not
sublimating. That contribution has been zeroed out in the atmos fluxes.
In the current version, the sea ice has a prescribed thickness.
"""
struct PrescribedIceSimulation{P, Y, D, I} <: Interfacer.SeaIceModelSimulation
params::P
Expand Down Expand Up @@ -174,12 +172,11 @@ function ice_rhs!(du, u, p, _)

F_conductive = @. params.k_ice / (params.h) * (params.T_base - Y.T_sfc) # fluxes are defined to be positive when upward
rhs = @. (-F_turb_energy - F_radiative + F_conductive) / (params.h * params.ρ * params.c)

# do not count tendencies that lead to temperatures above freezing, and mask out no-ice areas
# If tendencies lead to temperature above freezing, set temperature to freezing
@. rhs = min(rhs, (T_freeze - Y.T_sfc) / p.dt)
# mask out no-ice areas
area_mask = Regridder.binary_mask.(area_fraction)
threshold = zero(FT)
unphysical = @. Regridder.binary_mask.(T_freeze - (Y.T_sfc + FT(rhs) * FT(p.dt)), threshold) .* area_mask
parent(dY.T_sfc) .= parent(rhs .* unphysical)
dY.T_sfc .= rhs .* area_mask

@. p.q_sfc = TD.q_vap_saturation_generic.(p.thermo_params, Y.T_sfc, p.ρ_sfc, TD.Ice())
end
Expand Down
5 changes: 3 additions & 2 deletions test/component_model_tests/prescr_seaice_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ for FT in (Float32, Float64)
dT_expected = -1.0 / (p.params.h * p.params.ρ * p.params.c)
@test sum([i for i in extrema(dY)] .≈ [FT(dT_expected), FT(dT_expected)]) == 2

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

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

0 comments on commit 82ac791

Please sign in to comment.