Skip to content

Commit 2c01b24

Browse files
committed
rm ice concentration from ocean
1 parent 17278aa commit 2c01b24

File tree

1 file changed

+15
-32
lines changed

1 file changed

+15
-32
lines changed

experiments/ClimaEarth/components/ocean/oceananigans.jl

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -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
"""
2726
struct 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
3533
end
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.
286284
These 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+
288288
A note on sign conventions:
289289
SurfaceFluxes and Oceananigans both use the convention that a positive flux is an upward flux.
290290
No 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
371362
end
372363

373364
function Interfacer.update_field!(sim::OceananigansSimulation, ::Val{:area_fraction}, field)
374365
sim.area_fraction .= field
375366
return nothing
376367
end
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.
394375
Update the portion of the surface_fluxes for T and S that is due to radiation and
395376
precipitation. 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+
397382
A note on sign conventions:
398383
ClimaAtmos and Oceananigans both use the convention that a positive flux is an upward flux.
399384
No 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.
404389
function 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
450433
end
451434

0 commit comments

Comments
 (0)