@@ -367,7 +367,7 @@ function FluxCalculator.update_turbulent_fluxes!(sim::OceananigansSimulation, fi
367367 )
368368 moisture_fresh_water_flux = sim. remapping. scratch_arr1 ./ fresh_water_density
369369 oc_flux_S = surface_flux (sim. ocean. model. tracers. S)
370- surface_salinity = OC. interior (sim. ocean. model. tracers. S, :, :, 1 )
370+ surface_salinity = OC. interior (sim. ocean. model. tracers. S, :, :, grid . Nz )
371371 OC. interior (oc_flux_S, :, :, 1 ) .=
372372 OC. interior (oc_flux_S, :, :, 1 ) .-
373373 (1.0 .- ice_concentration) .* surface_salinity .* moisture_fresh_water_flux
@@ -401,6 +401,7 @@ so a sign change is needed when we convert from precipitation to salinity flux.
401401function FieldExchanger. update_sim! (sim:: OceananigansSimulation , csf)
402402 (; reference_density, heat_capacity, fresh_water_density) = sim. ocean_properties
403403 ice_concentration = sim. ice_concentration
404+ Nz = sim. ocean. model. grid. Nz
404405
405406 # Remap radiative flux onto scratch array; rename for clarity
406407 CC. Remapping. interpolate! (
@@ -428,7 +429,7 @@ function FieldExchanger.update_sim!(sim::OceananigansSimulation, csf)
428429 - (1 - α) .* remapped_SW_d .-
429430 ϵ * (
430431 remapped_LW_d .-
431- σ .* (C_to_K .+ OC. interior (sim. ocean. model. tracers. T, :, :, 1 )) .^ 4
432+ σ .* (C_to_K .+ OC. interior (sim. ocean. model. tracers. T, :, :, Nz )) .^ 4
432433 )
433434 ) ./ (reference_density * heat_capacity)
434435
@@ -450,7 +451,7 @@ function FieldExchanger.update_sim!(sim::OceananigansSimulation, csf)
450451 oc_flux_S = surface_flux (sim. ocean. model. tracers. S)
451452 OC. interior (oc_flux_S, :, :, 1 ) .=
452453 OC. interior (oc_flux_S, :, :, 1 ) .-
453- OC. interior (sim. ocean. model. tracers. S, :, :, 1 ) .* (1.0 .- ice_concentration) .*
454+ OC. interior (sim. ocean. model. tracers. S, :, :, Nz ) .* (1.0 .- ice_concentration) .*
454455 (remapped_P_liq .+ remapped_P_snow) ./ fresh_water_density
455456 return nothing
456457end
0 commit comments