@@ -47,6 +47,7 @@ function ClimaSeaIceSimulation(area_fraction, ocean; output_dir)
4747 # Initialize the sea ice with the same grid as the ocean
4848 # Initially no sea ice is present
4949 grid = ocean. ocean. model. grid
50+ arch = grid. architecture
5051 advection = ocean. ocean. model. advection. T
5152 sea_ice = CO. sea_ice_simulation (grid, ocean. ocean; advection)
5253
@@ -56,21 +57,21 @@ function ClimaSeaIceSimulation(area_fraction, ocean; output_dir)
5657 remapping = ocean. remapping
5758
5859 # Before version 0.96.22, the NetCDFWriter was broken on GPU
59- if arch isa OC . CPU || pkgversion (OC) >= v " 0.96.22 "
60- # TODO maybe this is broken
61- # Save all tracers and velocities to a NetCDF file at daily frequency
62- outputs = prognostic_fields (sea_ice. model)
63- netcdf_writer = OC. NetCDFWriter (
64- sea_ice. model,
65- outputs;
66- schedule = OC. TimeInterval (86400 ), # Daily output
67- filename = joinpath (output_dir, " seaice_diagnostics.nc" ),
68- indices = (:, :, grid. Nz),
69- overwrite_existing = true ,
70- array_type = Array{Float32},
71- )
72- sea_ice. output_writers[:diagnostics ] = netcdf_writer
73- end
60+ # TODO this fails with OC Field MethodError
61+ # if arch isa OC.CPU || pkgversion(OC) >= v"0.96.22"
62+ # # Save all tracers and velocities to a NetCDF file at daily frequency
63+ # outputs = OC. prognostic_fields(sea_ice.model)
64+ # netcdf_writer = OC.NetCDFWriter(
65+ # sea_ice.model,
66+ # outputs;
67+ # schedule = OC.TimeInterval(86400), # Daily output
68+ # filename = joinpath(output_dir, "seaice_diagnostics.nc"),
69+ # indices = (:, :, grid.Nz),
70+ # overwrite_existing = true,
71+ # array_type = Array{Float32},
72+ # )
73+ # sea_ice.output_writers[:diagnostics] = netcdf_writer
74+ # end
7475
7576 sim = ClimaSeaIceSimulation (sea_ice, area_fraction, melting_speed, remapping)
7677 return sim
8485Interfacer. step! (sim:: ClimaSeaIceSimulation , t) =
8586 OC. time_step! (sim. sea_ice, float (t) - sim. sea_ice. model. clock. time)
8687
87-
8888Interfacer. get_field (sim:: ClimaSeaIceSimulation , :: Val{:area_fraction} ) = sim. area_fraction
8989
9090# TODO : Better values for this
@@ -102,7 +102,8 @@ Interfacer.get_field(sim::ClimaSeaIceSimulation, ::Val{:surface_direct_albedo})
102102Interfacer. get_field (sim:: ClimaSeaIceSimulation , :: Val{:surface_diffuse_albedo} ) =
103103 Float32 (0.069 )
104104
105- # TODO approximate surface temp from bulk temp and ocean surface temp, assuming linear profile in the top layer
105+ # Approximate the sea ice surface temperature from the bulk temperature and ocean surface temperature,
106+ # assuming a linear profile in the top layer
106107# TODO how to get ocean surface temp here? Is it in the sea ice or do we need to pass the ocean sim too?
107108Interfacer. get_field (sim:: ClimaSeaIceSimulation , :: Val{:surface_temperature} ) =
108109 273.15 + sim. ocean. model. tracers. T
0 commit comments