Skip to content

Commit d04aa25

Browse files
committed
use JLD2Writer
1 parent c452c22 commit d04aa25

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
@@ -112,23 +112,18 @@ function OceananigansSimulation(area_fraction, start_date, stop_date; output_dir
112112

113113
ocean_properties = (; ocean_reference_density = 1020, ocean_heat_capacity = 3991, ocean_fresh_water_density = 999.8)
114114

115-
# Before version 0.96.22, the NetCDFWriter was broken on GPU
116-
if arch isa OC.CPU || pkgversion(OC) >= v"0.96.22"
117-
# TODO: Add more diagnostics, make them dependent on simulation duration, take
118-
# monthly averages
119-
# Save all tracers and velocities to a NetCDF file at daily frequency
120-
outputs = merge(ocean.model.tracers, ocean.model.velocities)
121-
netcdf_writer = OC.NetCDFWriter(
122-
ocean.model,
123-
outputs;
124-
schedule = OC.TimeInterval(86400), # Daily output
125-
filename = joinpath(output_dir, "ocean_diagnostics.nc"),
126-
indices = (:, :, grid.Nz),
127-
overwrite_existing = true,
128-
array_type = Array{Float32},
129-
)
130-
ocean.output_writers[:diagnostics] = netcdf_writer
131-
end
115+
# Save all tracers and velocities to a JLD2 file at daily frequency
116+
outputs = merge(ocean.model.tracers, ocean.model.velocities)
117+
jld2_writer = OC.JLD2Writer(
118+
ocean.model,
119+
outputs;
120+
schedule = OC.TimeInterval(86400), # Daily output
121+
filename = joinpath(output_dir, "ocean_diagnostics"),
122+
indices = (:, :, grid.Nz),
123+
overwrite_existing = true,
124+
array_type = Array{Float32},
125+
)
126+
ocean.output_writers[:diagnostics] = jld2_writer
132127

133128
sim = OceananigansSimulation(ocean, area_fraction, ocean_properties, remapping)
134129
return sim

0 commit comments

Comments
 (0)