@@ -15,30 +15,23 @@ using CUDA
1515
1616import Oceananigans. OutputWriters: checkpointer_address
1717
18- function synch! (clock1:: Clock , clock2)
19- # Synchronize the clocks
20- clock1. time = clock2. time
21- clock1. iteration = clock2. iteration
22- clock1. last_Δt = clock2. last_Δt
23- end
24-
25- synch! (model1, model2) = synch! (model1. clock, model2. clock)
26-
2718arch = GPU ()
2819
2920Nx = 360 # longitudinal direction
3021Ny = 180 # meridional direction
3122Nz = 60
3223
33- r_faces = ClimaOcean. ExponentialCoordinate (Nz, - 6000 )
34- z_faces = MutableVerticalDiscretization (r_faces)
24+ z_faces = ExponentialCoordinate (Nz, - 6000 , 0 )
25+ # z_faces = MutableVerticalDiscretization(z_faces)
26+
27+ const z_surf = z_faces (Nz)
3528
3629grid = TripolarGrid (arch;
3730 size = (Nx, Ny, Nz),
3831 z = z_faces,
3932 halo = (7 , 7 , 7 ))
4033
41- bottom_height = regrid_bathymetry (grid; minimum_depth= 15 , major_basins= 1 , interpolation_passes= 15 )
34+ bottom_height = regrid_bathymetry (grid; minimum_depth= 15 , major_basins= 1 , interpolation_passes= 75 )
4235grid = ImmersedBoundaryGrid (grid, GridFittedBottom (bottom_height); active_cells_map= true )
4336
4437# ####
@@ -51,34 +44,44 @@ using Oceananigans.TurbulenceClosures.TKEBasedVerticalDiffusivities: CATKEVertic
5144momentum_advection = WENOVectorInvariant (order= 5 )
5245tracer_advection = WENO (order= 5 )
5346
54- free_surface = SplitExplicitFreeSurface (grid; cfl= 0.7 , fixed_Δt= 20 minutes )
47+ free_surface = SplitExplicitFreeSurface (grid; cfl= 0.8 , fixed_Δt= 45 minutes )
5548
56- mixing_length = CATKEMixingLength (Cᵇ= 0.01 )
57- turbulent_kinetic_energy_equation = CATKEEquation (Cᵂϵ= 1.0 )
49+ eddy_closure = Oceananigans. TurbulenceClosures. IsopycnalSkewSymmetricDiffusivity (κ_skew= 1e3 , κ_symmetric= 1e3 )
50+ catke_closure = ClimaOcean. OceanSimulations. default_ocean_closure ()
51+ closure = (catke_closure, VerticalScalarDiffusivity (κ= 1e-5 , ν= 1e-4 ), eddy_closure)
5852
59- catke_closure = CATKEVerticalDiffusivity (; mixing_length, turbulent_kinetic_energy_equation)
60- closure = (catke_closure, VerticalScalarDiffusivity (κ= 1e-5 , ν= 1e-5 ))
53+ dataset = EN4Monthly ()
54+ date = DateTime (1958 , 1 , 1 )
55+ @inline mask (x, y, z, t) = z ≥ z_surf - 1
56+ Smetadata = Metadata (:salinity ; dataset)
57+
58+ FS = DatasetRestoring (Smetadata, grid; rate = 1 / 18 days, mask, time_indices_in_memory = 10 )
6159
6260ocean = ocean_simulation (grid; Δt= 1 minutes,
6361 momentum_advection,
6462 tracer_advection,
63+ timestepper = :SplitRungeKutta3 ,
6564 free_surface,
65+ forcing = (; S = FS),
6666 closure)
6767
68- dataset = ECCO4Monthly ()
68+ dataset = EN4Monthly ()
69+ date = DateTime (1958 , 1 , 1 )
70+
71+ set! (ocean. model, T= Metadatum (:temperature ; dataset, date),
72+ S= Metadatum (:salinity ; dataset, date))
6973
70- set! (ocean. model, T= Metadatum (:temperature ; dataset),
71- S= Metadatum (:salinity ; dataset))
74+ @info ocean. model. clock
7275
7376# ####
7477# #### A Prognostic Sea-ice model
7578# ####
7679
7780# Default sea-ice dynamics and salinity coupling are included in the defaults
78- sea_ice = sea_ice_simulation (grid; advection= WENO (order= 7 ))
81+ sea_ice = sea_ice_simulation (grid, ocean ; advection= WENO (order= 7 ))
7982
80- set! (sea_ice. model, h= Metadatum (:sea_ice_thickness ; dataset),
81- ℵ= Metadatum (:sea_ice_concentration ; dataset))
83+ set! (sea_ice. model, h= Metadatum (:sea_ice_thickness ; dataset= ECCO4Monthly () ),
84+ ℵ= Metadatum (:sea_ice_concentration ; dataset= ECCO4Monthly () ))
8285
8386# ####
8487# #### A Prescribed Atmosphere model
@@ -94,21 +97,20 @@ radiation = Radiation()
9497# ####
9598# #### An ocean-sea ice coupled model
9699# ####
97-
100+
98101omip = OceanSeaIceModel (ocean, sea_ice; atmosphere, radiation)
99- omip = Simulation (omip, Δt= 30 , stop_time= 60 days)
102+ omip = Simulation (omip, Δt= 30 minutes , stop_time= 60 days)
100103
101104# Figure out the outputs....
102-
103105checkpointer_address (:: SeaIceModel ) = " SeaIceModel"
104106
105107ocean. output_writers[:checkpointer ] = Checkpointer (ocean. model,
106- schedule = IterationInterval (10000 ),
108+ schedule = IterationInterval (1000 ),
107109 prefix = " ocean_checkpoint_onedegree" ,
108110 overwrite_existing = true )
109111
110112sea_ice. output_writers[:checkpointer ] = Checkpointer (sea_ice. model,
111- schedule = IterationInterval (10000 ),
113+ schedule = IterationInterval (1000 ),
112114 prefix = " sea_ice_checkpoint_onedegree" ,
113115 overwrite_existing = true )
114116
@@ -143,11 +145,11 @@ function progress(sim)
143145end
144146
145147# And add it as a callback to the simulation.
146- add_callback! (omip, progress, IterationInterval (50 ))
148+ add_callback! (omip, progress, IterationInterval (1 ))
147149
148150run! (omip)
149151
150- omip. Δt = 15 minutes
152+ omip. Δt = 40 minutes
151153omip. stop_time = 58 * 365 days
152154
153155run! (omip)
0 commit comments