@@ -65,29 +65,22 @@ function OceananigansSimulation(
6565 download_dataset (en4_temperature)
6666 download_dataset (en4_salinity)
6767
68- # Set up ocean grid (1 degree)
69- resolution_points = (360 , 160 , 32 )
70- Nz = last (resolution_points)
68+ # Set up tripolar ocean grid (1 degree)
69+ Nx = 360
70+ Ny = 180
71+ Nz = 40
7172 depth = 4000 # meters
7273 z = OC. ExponentialDiscretization (Nz, - depth, 0 ; scale = 0.85 * depth)
7374
7475 # Regular LatLong because we know how to do interpolation there
75- underlying_grid = OC. LatitudeLongitudeGrid (
76- arch;
77- size = resolution_points,
78- longitude = (- 180 , 180 ),
79- latitude = (- 80 , 80 ), # NOTE: Don't goo to high up when using LatLongGrid, or the cells will be too small
80- z,
81- halo = (7 , 7 , 7 ),
82- )
76+ underlying_grid = OC. TripolarGrid (arch; size = (Nx, Ny, Nz), halo = (7 , 7 , 4 ), z)
8377
8478 bottom_height = CO. regrid_bathymetry (
8579 underlying_grid;
8680 minimum_depth = 30 ,
8781 interpolation_passes = 20 ,
8882 major_basins = 1 ,
8983 )
90-
9184 grid = OC. ImmersedBoundaryGrid (
9285 underlying_grid,
9386 OC. GridFittedBottom (bottom_height);
@@ -150,44 +143,44 @@ function OceananigansSimulation(
150143 C_to_K = coupled_param_dict[" temperature_water_freeze" ],
151144 )
152145
153- # Before version 0.96.22, the NetCDFWriter was broken on GPU
154- if arch isa OC. CPU || pkgversion (OC) >= v " 0.96.22"
155- # Save all tracers and velocities to a NetCDF file at daily frequency
156- outputs = merge (ocean. model. tracers, ocean. model. velocities)
157- surface_writer = OC. NetCDFWriter (
158- ocean. model,
159- outputs;
160- schedule = OC. TimeInterval (86400 ), # Daily output
161- filename = joinpath (output_dir, " ocean_diagnostics.nc" ),
162- indices = (:, :, grid. Nz),
163- overwrite_existing = true ,
164- array_type = Array{Float32},
165- )
166- free_surface_writer = OC. NetCDFWriter (
167- ocean. model,
168- (; η = ocean. model. free_surface. η); # The free surface (.η) will change to .displacement after version 0.104.0
169- schedule = OC. TimeInterval (3600 ), # hourly snapshots
170- filename = joinpath (output_dir, " ocean_free_surface.nc" ),
171- overwrite_existing = true ,
172- array_type = Array{Float32},
173- )
174- Tflux = ocean. model. tracers. T. boundary_conditions. top. condition
175- Sflux = ocean. model. tracers. S. boundary_conditions. top. condition
176- uflux = ocean. model. velocities. u. boundary_conditions. top. condition
177- vflux = ocean. model. velocities. v. boundary_conditions. top. condition
178- fluxes_writer = OC. NetCDFWriter (
179- ocean. model,
180- (; Tflux, Sflux, uflux, vflux);
181- schedule = OC. TimeInterval (3600 ), # hourly snapshots
182- filename = joinpath (output_dir, " ocean_fluxes.nc" ),
183- overwrite_existing = true ,
184- array_type = Array{Float32},
185- )
146+ # Save all tracers and velocities to a JLD2 file at daily frequency
147+ outputs = merge (ocean. model. tracers, ocean. model. velocities)
148+ surface_writer = OC. JLD2Writer (
149+ ocean. model,
150+ outputs;
151+ schedule = OC. TimeInterval (86400 ), # Daily output
152+ filename = joinpath (output_dir, " ocean_diagnostics.jld2" ),
153+ indices = (:, :, grid. Nz),
154+ overwrite_existing = true ,
155+ array_type = Array{Float32},
156+ )
186157
187- ocean. output_writers[:surface ] = surface_writer
188- ocean. output_writers[:free_surface ] = free_surface_writer
189- ocean. output_writers[:fluxes ] = fluxes_writer
190- end
158+ # Save free surface to a JLD2 file at hourly frequency
159+ free_surface_writer = OC. JLD2Writer (
160+ ocean. model,
161+ (; η = ocean. model. free_surface. η); # The free surface (.η) will change to .displacement after version 0.104.0
162+ schedule = OC. TimeInterval (3600 ), # hourly snapshots
163+ filename = joinpath (output_dir, " ocean_free_surface.jld2" ),
164+ overwrite_existing = true ,
165+ array_type = Array{Float32},
166+ )
167+
168+ # Save fluxes to a JLD2 file at hourly frequency
169+ Tflux = ocean. model. tracers. T. boundary_conditions. top. condition
170+ Sflux = ocean. model. tracers. S. boundary_conditions. top. condition
171+ uflux = ocean. model. velocities. u. boundary_conditions. top. condition
172+ vflux = ocean. model. velocities. v. boundary_conditions. top. condition
173+ fluxes_writer = OC. JLD2Writer (
174+ ocean. model,
175+ (; Tflux, Sflux, uflux, vflux);
176+ schedule = OC. TimeInterval (3600 ), # hourly snapshots
177+ filename = joinpath (output_dir, " ocean_fluxes.jld2" ),
178+ overwrite_existing = true ,
179+ array_type = Array{Float32},
180+ )
181+ ocean. output_writers[:surface ] = surface_writer
182+ ocean. output_writers[:free_surface ] = free_surface_writer
183+ ocean. output_writers[:fluxes ] = fluxes_writer
191184
192185 # Initialize with 0 ice concentration; this will be updated in `resolve_area_fractions!`
193186 # if the ocean is coupled to a non-prescribed sea ice model.
0 commit comments