@@ -19,7 +19,8 @@ import Oceananigans.TimeSteppers: time_step!, update_state!, time
1919import Oceananigans. Utils: prettytime
2020import Oceananigans. Models: timestepper, NaNChecker, default_nan_checker
2121
22- struct OceanSeaIceModel{I, A, O, F, C} <: AbstractModel{Nothing}
22+ struct OceanSeaIceModel{I, A, O, F, C, Arch} <: AbstractModel{Nothing, Arch}
23+ architecture :: Arch
2324 clock :: C
2425 atmosphere :: A
2526 sea_ice :: I
@@ -57,7 +58,6 @@ Base.eltype(model::OSIM) = Base.eltype(model.ocean.model)
5758prettytime (model:: OSIM ) = prettytime (model. clock. time)
5859iteration (model:: OSIM ) = model. clock. iteration
5960timestepper (:: OSIM ) = nothing
60- initialize! (:: OSIM ) = nothing
6161default_included_properties (:: OSIM ) = tuple ()
6262prognostic_fields (cm:: OSIM ) = nothing
6363fields (:: OSIM ) = NamedTuple ()
@@ -68,6 +68,11 @@ function reset!(model::OSIM)
6868 return nothing
6969end
7070
71+ function initialize! (model:: OSIM )
72+ initialize! (model. ocean)
73+ return nothing
74+ end
75+
7176reference_density (unsupported) =
7277 throw (ArgumentError (" Cannot extract reference density from $(typeof (unsupported)) " ))
7378
@@ -102,26 +107,21 @@ function OceanSeaIceModel(ocean, sea_ice=FreezingLimitedOceanTemperature(eltype(
102107 sea_ice_heat_capacity = heat_capacity (sea_ice),
103108 interfaces = nothing )
104109
105- # Remove some potentially irksome callbacks from the ocean simulation
106- pop! (ocean. callbacks, :stop_time_exceeded , nothing )
107- pop! (ocean. callbacks, :stop_iteration_exceeded , nothing )
108- pop! (ocean. callbacks, :wall_time_limit_exceeded , nothing )
109- pop! (ocean. callbacks, :nan_checker , nothing )
110-
111- # In case there was any doubt these are meaningless.
112- ocean. stop_time = Inf
113- ocean. stop_iteration = Inf
114- ocean. wall_time_limit = Inf
115-
110+ if ! isnothing (ocean. callbacks)
111+ # Remove some potentially irksome callbacks from the ocean simulation
112+ pop! (ocean. callbacks, :stop_time_exceeded , nothing )
113+ pop! (ocean. callbacks, :stop_iteration_exceeded , nothing )
114+ pop! (ocean. callbacks, :wall_time_limit_exceeded , nothing )
115+ pop! (ocean. callbacks, :nan_checker , nothing )
116+ end
117+
116118 if sea_ice isa SeaIceSimulation
117- pop! (sea_ice. callbacks, :stop_time_exceeded , nothing )
118- pop! (sea_ice. callbacks, :stop_iteration_exceeded , nothing )
119- pop! (sea_ice. callbacks, :wall_time_limit_exceeded , nothing )
120- pop! (sea_ice. callbacks, :nan_checker , nothing )
121-
122- sea_ice. stop_time = Inf
123- sea_ice. stop_iteration = Inf
124- sea_ice. wall_time_limit = Inf
119+ if ! isnothing (sea_ice. callbacks)
120+ pop! (sea_ice. callbacks, :stop_time_exceeded , nothing )
121+ pop! (sea_ice. callbacks, :stop_iteration_exceeded , nothing )
122+ pop! (sea_ice. callbacks, :wall_time_limit_exceeded , nothing )
123+ pop! (sea_ice. callbacks, :nan_checker , nothing )
124+ end
125125 end
126126
127127 # Contains information about flux contributions: bulk formula, prescribed fluxes, etc.
@@ -134,7 +134,10 @@ function OceanSeaIceModel(ocean, sea_ice=FreezingLimitedOceanTemperature(eltype(
134134 radiation)
135135 end
136136
137- ocean_sea_ice_model = OceanSeaIceModel (clock,
137+ arch = architecture (ocean. model. grid)
138+
139+ ocean_sea_ice_model = OceanSeaIceModel (arch,
140+ clock,
138141 atmosphere,
139142 sea_ice,
140143 ocean,
0 commit comments