Skip to content

Commit 1d27912

Browse files
committed
use JLD2Writer
1 parent f451ac8 commit 1d27912

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

experiments/ClimaEarth/components/ocean/oceananigans.jl

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -134,23 +134,18 @@ function OceananigansSimulation(
134134
ocean_fresh_water_density = 999.8,
135135
)
136136

137-
# Before version 0.96.22, the NetCDFWriter was broken on GPU
138-
if arch isa OC.CPU || pkgversion(OC) >= v"0.96.22"
139-
# TODO: Add more diagnostics, make them dependent on simulation duration, take
140-
# monthly averages
141-
# Save all tracers and velocities to a NetCDF file at daily frequency
142-
outputs = merge(ocean.model.tracers, ocean.model.velocities)
143-
netcdf_writer = OC.NetCDFWriter(
144-
ocean.model,
145-
outputs;
146-
schedule = OC.TimeInterval(86400), # Daily output
147-
filename = joinpath(output_dir, "ocean_diagnostics.nc"),
148-
indices = (:, :, grid.Nz),
149-
overwrite_existing = true,
150-
array_type = Array{Float32},
151-
)
152-
ocean.output_writers[:diagnostics] = netcdf_writer
153-
end
137+
# Save all tracers and velocities to a JLD2 file at daily frequency
138+
outputs = merge(ocean.model.tracers, ocean.model.velocities)
139+
jld2_writer = OC.JLD2Writer(
140+
ocean.model,
141+
outputs;
142+
schedule = OC.TimeInterval(86400), # Daily output
143+
filename = joinpath(output_dir, "ocean_diagnostics"),
144+
indices = (:, :, grid.Nz),
145+
overwrite_existing = true,
146+
array_type = Array{Float32},
147+
)
148+
ocean.output_writers[:diagnostics] = jld2_writer
154149

155150
sim = OceananigansSimulation(ocean, area_fraction, ocean_properties, remapping)
156151
return sim

0 commit comments

Comments
 (0)