@@ -17,18 +17,18 @@ This type is used by the coupler to indicate that this simulation
1717is an surface/ocean simulation for dispatch.
1818
1919It contains the following objects:
20- - `sea_ice ::SIM`: The ClimaSeaIce simulation object.
20+ - `ice ::SIM`: The ClimaSeaIce simulation object.
2121- `area_fraction::A`: A ClimaCore Field representing the surface area fraction of this component model on the exchange grid.
2222- `melting_speed::MS`: An constant characteristic speed for melting/freezing.
2323- `remapping::REMAP`: Objects needed to remap from the exchange (spectral) grid to Oceananigans spaces.
24- - `ocean_sea_ice_fluxes ::NT`: A NamedTuple of fluxes between the ocean and sea ice, computed at each coupling step.
24+ - `ocean_ice_fluxes ::NT`: A NamedTuple of fluxes between the ocean and sea ice, computed at each coupling step.
2525"""
2626struct ClimaSeaIceSimulation{SIM, A, MS, REMAP, NT} <: Interfacer.SeaIceModelSimulation
27- sea_ice :: SIM
27+ ice :: SIM
2828 area_fraction:: A
2929 melting_speed:: MS
3030 remapping:: REMAP
31- ocean_sea_ice_fluxes :: NT
31+ ocean_ice_fluxes :: NT
3232end
3333
3434"""
@@ -51,14 +51,13 @@ can be found in the documentation for `ClimaOcean.ocean_simulation`.
5151"""
5252function ClimaSeaIceSimulation (land_fraction, ocean; output_dir)
5353 # Initialize the sea ice with the same grid as the ocean
54- grid = ocean. ocean. model. grid
54+ grid = ocean. ocean. model. grid # TODO can't use lat/lon grid at poles for ice
5555 arch = grid. architecture
5656 advection = ocean. ocean. model. advection. T
5757 top_heat_boundary_condition = CO. MeltingConstrainedFluxBalance ()
5858
5959 # TODO use branch ss-js/top-heat-bc for this constructor
60- sea_ice =
61- CO. sea_ice_simulation (grid, ocean. ocean; advection, top_heat_boundary_condition)
60+ ice = CO. sea_ice_simulation (grid, ocean. ocean; advection, top_heat_boundary_condition)
6261
6362 melting_speed = 1e-4
6463
@@ -68,24 +67,24 @@ function ClimaSeaIceSimulation(land_fraction, ocean; output_dir)
6867 # Before version 0.96.22, the NetCDFWriter was broken on GPU
6968 if arch isa OC. CPU || pkgversion (OC) >= v " 0.96.22"
7069 # Save all tracers and velocities to a NetCDF file at daily frequency
71- outputs = OC. prognostic_fields (sea_ice . model)
70+ outputs = OC. prognostic_fields (ice . model)
7271 jld_writer = OC. JLDWriter (
73- sea_ice . model,
72+ ice . model,
7473 outputs;
7574 schedule = OC. TimeInterval (86400 ), # Daily output
7675 filename = joinpath (output_dir, " seaice_diagnostics.jld2" ),
7776 overwrite_existing = true ,
7877 array_type = Array{Float32},
7978 )
80- sea_ice . output_writers[:diagnostics ] = jld_writer
79+ ice . output_writers[:diagnostics ] = jld_writer
8180 end
8281
8382 # Allocate space for the sea ice-ocean (io) fluxes
84- ocean_sea_ice_fluxes = ocean. ocean_sea_ice_fluxes
83+ ocean_ice_fluxes = ocean. ocean_ice_fluxes
8584
8685 # TODO clean this up
87- # Get the area fraction from the fractional sea ice concentration
88- area_fraction = sea_ice . model. ice_concentration
86+ # Get the initial area fraction from the fractional ice concentration
87+ area_fraction = ice . model. ice_concentration
8988
9089 # Overwrite ice fraction with the static land area fraction anywhere we have nonzero land area
9190 # max needed to avoid Float32 errors (see issue #271; Heisenbug on HPC)
@@ -97,16 +96,16 @@ function ClimaSeaIceSimulation(land_fraction, ocean; output_dir)
9796 max (min (area_fraction_boundary_space, FT (1 ) - land_fraction), FT (0 ))
9897
9998 sim = ClimaSeaIceSimulation (
100- sea_ice ,
99+ ice ,
101100 area_fraction_boundary_space,
102101 melting_speed,
103102 remapping,
104- ocean_sea_ice_fluxes ,
103+ ocean_ice_fluxes ,
105104 )
106105 return sim
107106end
108107
109- function update_sic! (area_fraction, sea_ice )
108+ function update_sic! (area_fraction, ice )
110109 # TODO
111110end
112111
@@ -116,11 +115,11 @@ end
116115
117116# Timestep the simulation forward to time `t`
118117Interfacer. step! (sim:: ClimaSeaIceSimulation , t) =
119- OC. time_step! (sim. sea_ice , float (t) - sim. sea_ice . model. clock. time)
118+ OC. time_step! (sim. ice , float (t) - sim. ice . model. clock. time)
120119
121120Interfacer. get_field (sim:: ClimaSeaIceSimulation , :: Val{:area_fraction} ) = sim. area_fraction
122- Interfacer. get_field (sim:: ClimaSeaIceSimulation , Val (:sea_ice_concentration )) =
123- sim. sea_ice . model. ice_concentration
121+ Interfacer. get_field (sim:: ClimaSeaIceSimulation , :: Val (:ice_concentration )) =
122+ sim. ice . model. ice_concentration
124123
125124# At the moment, we return always Float32. This is because we always want to run
126125# Oceananingans with Float64, so we have no way to know the float type here. Sticking with
@@ -139,8 +138,7 @@ Interfacer.get_field(sim::ClimaSeaIceSimulation, ::Val{:surface_diffuse_albedo})
139138# Approximate the sea ice surface temperature as the temperature computed from the
140139# fluxes at the previous timestep.
141140Interfacer. get_field (sim:: ClimaSeaIceSimulation , :: Val{:surface_temperature} ) =
142- 273.15 .+
143- OC. interior (sim. sea_ice. model. ice_thermodynamics. top_surface_temperature, :, :, 1 )
141+ 273.15 .+ OC. interior (sim. ice. model. ice_thermodynamics. top_surface_temperature, :, :, 1 )
144142
145143"""
146144 FluxCalculator.update_turbulent_fluxes!(sim::ClimaSeaIceSimulation, fields)
@@ -162,7 +160,7 @@ function FluxCalculator.update_turbulent_fluxes!(sim::ClimaSeaIceSimulation, fie
162160 # Only LatitudeLongitudeGrid are supported because otherwise we have to rotate the vectors
163161
164162 (; F_lh, F_sh, F_turb_ρτxz, F_turb_ρτyz, F_turb_moisture) = fields
165- grid = sim. sea_ice . model. grid
163+ grid = sim. ice . model. grid
166164
167165 # Remap momentum fluxes onto reduced 2D Center, Center fields using scratch arrays and fields
168166 CC. Remapping. interpolate! (
@@ -184,8 +182,8 @@ function FluxCalculator.update_turbulent_fluxes!(sim::ClimaSeaIceSimulation, fie
184182
185183 # Set the momentum flux BCs at the correct locations using the remapped scratch fields
186184 # Note that this requires the sea ice model to always be run with dynamics turned on
187- si_flux_u = sim. sea_ice . model. dynamics. external_stresses. top. u
188- si_flux_v = sim. sea_ice . model. dynamics. external_stresses. top. v
185+ si_flux_u = sim. ice . model. dynamics. external_stresses. top. u
186+ si_flux_v = sim. ice . model. dynamics. external_stresses. top. v
189187 set_from_extrinsic_vectors! (
190188 (; u = si_flux_u, v = si_flux_v),
191189 grid,
@@ -202,10 +200,10 @@ function FluxCalculator.update_turbulent_fluxes!(sim::ClimaSeaIceSimulation, fie
202200 remapped_F_sh = sim. remapping. scratch_arr2
203201
204202 # Update the sea ice only where the concentration is greater than zero.
205- si_flux_heat = ice_sim. sea_ice . model. external_heat_fluxes. top
203+ si_flux_heat = ice_sim. ice . model. external_heat_fluxes. top
206204 OC. interior (si_flux_heat, :, :, 1 ) .=
207205 OC. interior (si_flux_heat, :, :, 1 ) .+ (
208- (OC. interior (sim. sea_ice . model. ice_concentration, :, :, 1 ) .> 0 ) .*
206+ (OC. interior (sim. ice . model. ice_concentration, :, :, 1 ) .> 0 ) .*
209207 (remapped_F_lh .+ remapped_F_sh)
210208 )
211209
@@ -248,52 +246,50 @@ function FieldExchanger.update_sim!(sim::ClimaSeaIceSimulation, csf, area_fracti
248246 # Update only the part due to radiative fluxes. For the full update, the component due
249247 # to latent and sensible heat is missing and will be updated in update_turbulent_fluxes.
250248 # Update the sea ice only where the concentration is greater than zero.
251- si_flux_heat = sim. sea_ice . model. external_heat_fluxes. top
249+ si_flux_heat = sim. ice . model. external_heat_fluxes. top
252250 OC. interior (si_flux_heat, :, :, 1 ) .=
253- (OC. interior (sim. sea_ice. model. ice_concentration, :, :, 1 ) .> 0 ) .*
254- remapped_F_radiative
251+ (OC. interior (sim. ice. model. ice_concentration, :, :, 1 ) .> 0 ) .* remapped_F_radiative
255252
256253 return nothing
257254end
258255
259256"""
260257 ocean_seaice_fluxes!(ocean_sim, ice_sim)
261258
262- Compute the fluxes between the ocean and sea ice, storing them in the `ocean_sea_ice_fluxes `
259+ Compute the fluxes between the ocean and sea ice, storing them in the `ocean_ice_fluxes `
263260fields of the ocean and sea ice simulations.
264261"""
265262function FluxCalculator. ocean_seaice_fluxes! (
266263 ocean_sim:: OceananigansSimulation ,
267264 ice_sim:: ClimaSeaIceSimulation ,
268265)
269- # TODO unify sea_ice vs ice naming convention in this file
270266 melting_speed = ice_sim. melting_speed
271267 ocean_properties = ocean_sim. ocean_properties
272268
273269 # Compute the fluxes and store them in the both simulations
274270 CO. compute_sea_ice_ocean_fluxes! (
275- ice_sim. ocean_sea_ice_fluxes ,
271+ ice_sim. ocean_ice_fluxes ,
276272 ocean_sim. ocean,
277- ice_sim. sea_ice ,
273+ ice_sim. ice ,
278274 melting_speed,
279275 ocean_properties,
280276 )
281- ocean_sim. ocean_sea_ice_fluxes = ice_sim. ocean_sea_ice_fluxes
277+ ocean_sim. ocean_ice_fluxes = ice_sim. ocean_ice_fluxes
282278
283279 # # Update the internals of the sea ice model
284280 # Set the bottom heat flux to the sum of the frazil and interface heat fluxes
285- bottom_heat_flux = ice_sim. sea_ice . model. external_heat_fluxes. bottom
281+ bottom_heat_flux = ice_sim. ice . model. external_heat_fluxes. bottom
286282
287- Qf = sea_ice_ocean_fluxes . frazil_heat # frazil heat flux
288- Qi = sea_ice_ocean_fluxes . interface_heat # interfacial heat flux
283+ Qf = ice_sim . ocean_ice_fluxes . frazil_heat # frazil heat flux
284+ Qi = ice_sim . ocean_ice_fluxes . interface_heat # interfacial heat flux
289285 bottom_heat_flux .= Qf .+ Qi
290286
291287 # # Update the internals of the ocean model
292288 ρₒ⁻¹ = 1 / ocean_sim. ocean_properties. reference_density
293289 cₒ = ocean_sim. ocean_properties. heat_capacity
294290
295291 Jᵀio = Qio * ρₒ⁻¹ / cₒ
296- Jˢio = sea_ice_ocean_fluxes . salt[i, j, 1 ] * ℵᵢ
292+ Jˢio = ice_sim . ocean_ice_fluxes . salt[i, j, 1 ] * ℵᵢ
297293
298294 # ℑxᶠᵃᵃ: interpolate faces to centers
299295 τxio = ρτxio[i, j, 1 ] * ρₒ⁻¹ * ℑxᶠᵃᵃ (i, j, 1 , grid, ℵ)
0 commit comments