Skip to content

Commit 5ca7048

Browse files
committed
fixes
1 parent abac61c commit 5ca7048

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

experiments/ClimaEarth/components/ocean/clima_seaice.jl

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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
@@ -84,7 +85,6 @@ end
8485
Interfacer.step!(sim::ClimaSeaIceSimulation, t) =
8586
OC.time_step!(sim.sea_ice, float(t) - sim.sea_ice.model.clock.time)
8687

87-
8888
Interfacer.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})
102102
Interfacer.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?
107108
Interfacer.get_field(sim::ClimaSeaIceSimulation, ::Val{:surface_temperature}) =
108109
273.15 + sim.ocean.model.tracers.T

experiments/ClimaEarth/setup_run.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ function CoupledSimulation(config_dict::AbstractDict)
371371
sic_path = subseasonal_sic,
372372
)
373373

374-
## ocean model using prescribed data
374+
## ocean model
375375
ice_fraction = Interfacer.get_field(ice_sim, Val(:area_fraction))
376376
ocean_fraction = FT(1) .- ice_fraction .- land_fraction
377377

0 commit comments

Comments
 (0)