@@ -22,7 +22,6 @@ It contains the following objects:
2222- `ocean_properties::OPROP`: A NamedTuple of ocean properties and parameters
2323- `remapping::REMAP`: Objects needed to remap from the exchange (spectral) grid to Oceananigans spaces.
2424- `ocean_ice_fluxes::NT`: A NamedTuple of fluxes between the ocean and sea ice, computed at each coupling step.
25- - `ice_concentration::SIC`: A ClimaCore Field representing the sea ice concentration on the ocean/sea ice grid.
2625"""
2726struct OceananigansSimulation{SIM, A, OPROP, REMAP, NT, SIC} < :
2827 Interfacer. OceanModelSimulation
@@ -31,7 +30,6 @@ struct OceananigansSimulation{SIM, A, OPROP, REMAP, NT, SIC} <:
3130 ocean_properties:: OPROP
3231 remapping:: REMAP
3332 ocean_ice_fluxes:: NT
34- ice_concentration:: SIC
3533end
3634
3735"""
@@ -282,9 +280,11 @@ Interfacer.get_field(sim::OceananigansSimulation, ::Val{:surface_temperature}) =
282280"""
283281 FluxCalculator.update_turbulent_fluxes!(sim::OceananigansSimulation, fields)
284282
285- Update the turbulent fluxes in the simulation using the values stored in the coupler fields .
283+ Update the turbulent fluxes in the simulation using the values computed at this time step .
286284These include latent heat flux, sensible heat flux, momentum fluxes, and moisture flux.
287285
286+ The input fields are already area-weighted, so there's no need to weight them again.
287+
288288A note on sign conventions:
289289SurfaceFluxes and Oceananigans both use the convention that a positive flux is an upward flux.
290290No sign change is needed during the exchange, except for moisture/salinity fluxes:
@@ -327,11 +327,6 @@ function FluxCalculator.update_turbulent_fluxes!(sim::OceananigansSimulation, fi
327327 F_turb_ρτyz_cc,
328328 )
329329
330- # Weight the ocean fluxes by (1 - ice concentration)
331- ice_concentration = OC. interior (sim. ice_concentration, :, :, 1 )
332- oc_flux_u .= (1 .- ice_concentration) .* oc_flux_u
333- oc_flux_v .= (1 .- ice_concentration) .* oc_flux_v
334-
335330 (; ocean_reference_density, ocean_heat_capacity, ocean_fresh_water_density) =
336331 sim. ocean_properties
337332
@@ -349,10 +344,7 @@ function FluxCalculator.update_turbulent_fluxes!(sim::OceananigansSimulation, fi
349344 oc_flux_T = surface_flux (sim. ocean. model. tracers. T)
350345 OC. interior (oc_flux_T, :, :, 1 ) .=
351346 OC. interior (oc_flux_T, :, :, 1 ) .+
352- (1 .- ice_concentration) .* (
353- (remapped_F_lh .+ remapped_F_sh) ./
354- (ocean_reference_density * ocean_heat_capacity)
355- )
347+ (remapped_F_lh .+ remapped_F_sh) ./ (ocean_reference_density * ocean_heat_capacity)
356348
357349 # Add the part of the salinity flux that comes from the moisture flux, we also need to
358350 # add the component due to precipitation (that was done with the radiative fluxes)
@@ -365,25 +357,14 @@ function FluxCalculator.update_turbulent_fluxes!(sim::OceananigansSimulation, fi
365357 oc_flux_S = surface_flux (sim. ocean. model. tracers. S)
366358 surface_salinity = OC. interior (sim. ocean. model. tracers. S, :, :, 1 )
367359 OC. interior (oc_flux_S, :, :, 1 ) .=
368- OC. interior (oc_flux_S, :, :, 1 ) .-
369- (1 .- ice_concentration) .* (surface_salinity .* moisture_fresh_water_flux)
360+ OC. interior (oc_flux_S, :, :, 1 ) .- (surface_salinity .* moisture_fresh_water_flux)
370361 return nothing
371362end
372363
373364function Interfacer. update_field! (sim:: OceananigansSimulation , :: Val{:area_fraction} , field)
374365 sim. area_fraction .= field
375366 return nothing
376367end
377- # Note, ice_concentration is on the ocean/sea ice grid. This assumes the ocean and
378- # sea ice are using the same grid.
379- function Interfacer. update_field! (
380- sim:: OceananigansSimulation ,
381- :: Val{:ice_concentration} ,
382- field,
383- )
384- sim. ice_concentration .= field
385- return nothing
386- end
387368
388369"""
389370 FieldExchanger.update_sim!(sim::OceananigansSimulation, csf, area_fraction)
@@ -394,6 +375,10 @@ by the coupler.
394375Update the portion of the surface_fluxes for T and S that is due to radiation and
395376precipitation. The rest will be updated in `update_turbulent_fluxes!`.
396377
378+ Unlike the turbulent fluxes, the radiative and precipitation fluxes need to be
379+ weighted by the ocean area fraction, since they provided from the atmosphere
380+ without any weighting.
381+
397382A note on sign conventions:
398383ClimaAtmos and Oceananigans both use the convention that a positive flux is an upward flux.
399384No sign change is needed during the exchange, except for precipitation/salinity fluxes.
@@ -404,13 +389,13 @@ so a sign change is needed when we convert from precipitation to salinity flux.
404389function FieldExchanger. update_sim! (sim:: OceananigansSimulation , csf, area_fraction)
405390 (; ocean_reference_density, ocean_heat_capacity, ocean_fresh_water_density) =
406391 sim. ocean_properties
407- ice_concentration = OC . interior ( sim. ice_concentration, :, :, 1 )
392+ ocean_fraction = sim. area_fraction
408393
409394 # Remap radiative flux onto scratch array; rename for clarity
410395 CC. Remapping. interpolate! (
411396 sim. remapping. scratch_arr1,
412397 sim. remapping. remapper_cc,
413- csf. F_radiative,
398+ ocean_fraction .* csf. F_radiative,
414399 )
415400 remapped_F_radiative = sim. remapping. scratch_arr1
416401
@@ -420,19 +405,18 @@ function FieldExchanger.update_sim!(sim::OceananigansSimulation, csf, area_fract
420405 # TODO document ordering of flux updates somewhere
421406 OC. interior (oc_flux_T, :, :, 1 ) .=
422407 OC. interior (oc_flux_T, :, :, 1 ) .+
423- (1 .- ice_concentration) .*
424- (remapped_F_radiative ./ (ocean_reference_density * ocean_heat_capacity))
408+ remapped_F_radiative ./ (ocean_reference_density * ocean_heat_capacity)
425409
426410 # Remap precipitation fields onto scratch arrays; rename for clarity
427411 CC. Remapping. interpolate! (
428412 sim. remapping. scratch_arr1,
429413 sim. remapping. remapper_cc,
430- csf. P_liq,
414+ ocean_fraction .* csf. P_liq,
431415 )
432416 CC. Remapping. interpolate! (
433417 sim. remapping. scratch_arr2,
434418 sim. remapping. remapper_cc,
435- csf. P_snow,
419+ ocean_fraction .* csf. P_snow,
436420 )
437421 remapped_P_liq = sim. remapping. scratch_arr1
438422 remapped_P_snow = sim. remapping. scratch_arr2
@@ -444,8 +428,7 @@ function FieldExchanger.update_sim!(sim::OceananigansSimulation, csf, area_fract
444428 surface_salinity_flux =
445429 OC. interior (sim. ocean. model. tracers. S, :, :, 1 ) .* precipitating_fresh_water_flux
446430 OC. interior (oc_flux_S, :, :, 1 ) .=
447- OC. interior (oc_flux_S, :, :, 1 ) .+
448- (1 .- ice_concentration) .* .- surface_salinity_flux
431+ OC. interior (oc_flux_S, :, :, 1 ) .- surface_salinity_flux
449432 return nothing
450433end
451434
0 commit comments