@@ -50,7 +50,7 @@ previous step is provided to the coupler to be used in computing fluxes.
5050Specific details about the default model configuration
5151can be found in the documentation for `ClimaOcean.ocean_simulation`.
5252"""
53- function ClimaSeaIceSimulation (land_fraction, ocean; output_dir)
53+ function ClimaSeaIceSimulation (land_fraction, ocean; output_dir, start_date = nothing )
5454 # Initialize the sea ice with the same grid as the ocean
5555 grid = ocean. ocean. model. grid
5656 arch = OC. Architectures. architecture (grid)
@@ -59,6 +59,23 @@ function ClimaSeaIceSimulation(land_fraction, ocean; output_dir)
5959
6060 ice = CO. sea_ice_simulation (grid, ocean. ocean; advection, top_heat_boundary_condition)
6161
62+ # Initialize nonzero sea ice if start date provided
63+ if ! isnothing (start_date)
64+ sic_metadata = CO. DataWrangling. Metadatum (
65+ :sea_ice_concentration ,
66+ dataset = CO. DataWrangling. ECCO. ECCO4Monthly (),
67+ date = start_date,
68+ )
69+ h_metadata = CO. DataWrangling. Metadatum (
70+ :sea_ice_thickness ,
71+ dataset = CO. DataWrangling. ECCO. ECCO4Monthly (),
72+ date = start_date,
73+ )
74+
75+ OC. set! (ice. model. ice_concentration, sic_metadata)
76+ OC. set! (ice. model. ice_thickness, h_metadata)
77+ end
78+
6279 melting_speed = 1e-4
6380
6481 # Since ocean and sea ice share the same grid, we can also share the remapping objects
@@ -168,6 +185,7 @@ function FluxCalculator.update_turbulent_fluxes!(sim::ClimaSeaIceSimulation, fie
168185
169186 (; F_lh, F_sh, F_turb_ρτxz, F_turb_ρτyz, F_turb_moisture) = fields
170187 grid = sim. ice. model. grid
188+ ice_concentration = sim. ice. model. ice_concentration
171189
172190 # Remap momentum fluxes onto reduced 2D Center, Center fields using scratch arrays and fields
173191 CC. Remapping. interpolate! (
@@ -208,8 +226,8 @@ function FluxCalculator.update_turbulent_fluxes!(sim::ClimaSeaIceSimulation, fie
208226
209227 # Update the sea ice only where the concentration is greater than zero.
210228 si_flux_heat = sim. ice. model. external_heat_fluxes. top
211- OC. interior (si_flux_heat, :, :, 1 ) .=
212- OC. interior (si_flux_heat , :, :, 1 ) .+ (remapped_F_lh .+ remapped_F_sh)
229+ OC. interior (si_flux_heat, :, :, 1 ) .+ =
230+ ( OC. interior (ice_concentration , :, :, 1 ) .> 0 ) .* (remapped_F_lh .+ remapped_F_sh)
213231
214232 return nothing
215233end
@@ -220,7 +238,7 @@ function Interfacer.update_field!(sim::ClimaSeaIceSimulation, ::Val{:area_fracti
220238end
221239
222240"""
223- FieldExchanger.update_sim!(sim::ClimaSeaIceSimulation, csf, area_fraction )
241+ FieldExchanger.update_sim!(sim::ClimaSeaIceSimulation, csf)
224242
225243Update the sea ice simulation with the provided fields, which have been filled in
226244by the coupler.
@@ -238,20 +256,47 @@ ClimaAtmos provides precipitation as a negative flux at the surface, and
238256ClimaSeaIce represents precipitation as a positive salinity flux,
239257so a sign change is needed when we convert from precipitation to salinity flux.
240258"""
241- function FieldExchanger. update_sim! (sim:: ClimaSeaIceSimulation , csf, area_fraction)
259+ function FieldExchanger. update_sim! (sim:: ClimaSeaIceSimulation , csf)
260+ ice_concentration = sim. ice. model. ice_concentration
261+
242262 # Remap radiative flux onto scratch array; rename for clarity
243263 CC. Remapping. interpolate! (
244264 sim. remapping. scratch_arr1,
245265 sim. remapping. remapper_cc,
246- csf. F_radiative ,
266+ csf. SW_d ,
247267 )
248- remapped_F_radiative = sim. remapping. scratch_arr1
268+ remapped_SW_d = sim. remapping. scratch_arr1
269+
270+ CC. Remapping. interpolate! (
271+ sim. remapping. scratch_arr2,
272+ sim. remapping. remapper_cc,
273+ csf. LW_d,
274+ )
275+ remapped_LW_d = sim. remapping. scratch_arr2
249276
250277 # Update only the part due to radiative fluxes. For the full update, the component due
251278 # to latent and sensible heat is missing and will be updated in update_turbulent_fluxes.
252279 si_flux_heat = sim. ice. model. external_heat_fluxes. top
253- OC. interior (si_flux_heat, :, :, 1 ) .= remapped_F_radiative
280+ # TODO : get sigma from parameters
281+ σ = 5.67e-8
282+ α = Interfacer. get_field (sim, Val (:surface_direct_albedo )) # scalar
283+ ϵ = Interfacer. get_field (sim, Val (:emissivity )) # scalar
254284
285+ # Update only where ice concentration is greater than zero.
286+ OC. interior (si_flux_heat, :, :, 1 ) .=
287+ (OC. interior (ice_concentration, :, :, 1 ) .> 0 ) .* .- (1 .- α) .* remapped_SW_d .-
288+ ϵ .* (
289+ remapped_LW_d .-
290+ σ .*
291+ (
292+ 273.15 .+ OC. interior (
293+ sim. ice. model. ice_thermodynamics. top_surface_temperature,
294+ :,
295+ :,
296+ 1 ,
297+ )
298+ ) .^ 4
299+ )
255300 return nothing
256301end
257302
352397 i, j = @index (Global, NTuple)
353398
354399 # ℑxᶠᵃᵃ: interpolate faces to centers
355- oc_flux_u +=
400+ oc_flux_u[i, j, 1 ] +=
356401 ρτxio[i, j, 1 ] * ρₒ⁻¹ * OC. Operators. ℑxᶠᵃᵃ (i, j, 1 , grid, ice_concentration)
357- oc_flux_v +=
402+ oc_flux_v[i, j, 1 ] +=
358403 ρτyio[i, j, 1 ] * ρₒ⁻¹ * OC. Operators. ℑyᵃᶠᵃ (i, j, 1 , grid, ice_concentration)
359404end
360405
0 commit comments