@@ -22,7 +22,7 @@ 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"""
25- struct OceananigansSimulation{SIM, A, OPROP, REMAP, SIC } <: Interfacer.OceanModelSimulation
25+ struct OceananigansSimulation{SIM, A, OPROP, REMAP} <: Interfacer.OceanModelSimulation
2626 ocean:: SIM
2727 area_fraction:: A
2828 ocean_properties:: OPROP
@@ -152,8 +152,9 @@ function OceananigansSimulation(
152152 interpolated_values_dim... , _buffer_length = size (remapper_cc. _interpolated_values)
153153 scratch_arr1 = ArrayType (zeros (FT, interpolated_values_dim... ))
154154 scratch_arr2 = ArrayType (zeros (FT, interpolated_values_dim... ))
155+ scratch_arr3 = ArrayType (zeros (FT, interpolated_values_dim... ))
155156
156- remapping = (; remapper_cc, scratch_cc1, scratch_cc2, scratch_arr1, scratch_arr2)
157+ remapping = (; remapper_cc, scratch_cc1, scratch_cc2, scratch_arr1, scratch_arr2, scratch_arr3 )
157158
158159 ocean_properties = (;
159160 ocean_reference_density = 1020 ,
@@ -267,7 +268,14 @@ function FluxCalculator.update_turbulent_fluxes!(sim::OceananigansSimulation, fi
267268 # TODO clarify where we need to add and where we set fluxes directly
268269 (; F_lh, F_sh, F_turb_ρτxz, F_turb_ρτyz, F_turb_moisture) = fields
269270 grid = sim. ocean. model. grid
270- area_fraction = sim. area_fraction
271+
272+ # Remap the area fraction from the boundary space to the Oceananigans grid
273+ CC. Remapping. interpolate! (
274+ sim. remapping. scratch_arr3,
275+ sim. remapping. remapper_cc,
276+ sim. area_fraction,
277+ )
278+ area_fraction = sim. remapping. scratch_arr3
271279
272280 # Remap momentum fluxes onto reduced 2D Center, Center fields using scratch arrays and fields
273281 CC. Remapping. interpolate! (
@@ -361,7 +369,14 @@ so a sign change is needed when we convert from precipitation to salinity flux.
361369function FieldExchanger. update_sim! (sim:: OceananigansSimulation , csf)
362370 (; ocean_reference_density, ocean_heat_capacity, ocean_fresh_water_density) =
363371 sim. ocean_properties
364- area_fraction = sim. area_fraction # TODO use sea ice instead?
372+ # TODO use SIC instead?
373+ # Remap the area fraction from the boundary space to the Oceananigans grid
374+ CC. Remapping. interpolate! (
375+ sim. remapping. scratch_arr3,
376+ sim. remapping. remapper_cc,
377+ sim. area_fraction,
378+ )
379+ area_fraction = sim. remapping. scratch_arr3
365380
366381 # Remap radiative flux onto scratch array; rename for clarity
367382 CC. Remapping. interpolate! (
@@ -398,12 +413,12 @@ function FieldExchanger.update_sim!(sim::OceananigansSimulation, csf)
398413 CC. Remapping. interpolate! (
399414 sim. remapping. scratch_arr1,
400415 sim. remapping. remapper_cc,
401- area_fraction .* csf. P_liq,
416+ sim . area_fraction .* csf. P_liq,
402417 )
403418 CC. Remapping. interpolate! (
404419 sim. remapping. scratch_arr2,
405420 sim. remapping. remapper_cc,
406- area_fraction .* csf. P_snow,
421+ sim . area_fraction .* csf. P_snow,
407422 )
408423 remapped_P_liq = sim. remapping. scratch_arr1
409424 remapped_P_snow = sim. remapping. scratch_arr2
0 commit comments