115115# #### A prescribed ocean...
116116# ####
117117
118+ struct PrescribedOcean{A, G, C, U, T, F} <: AbstractModel{Nothing}
119+ architecture :: A
120+ grid :: G
121+ clock :: Clock{C}
122+ velocities :: U
123+ tracers :: T
124+ timeseries :: F
125+ end
126+
127+ function PrescribedOcean (timeseries;
128+ grid,
129+ clock= Clock {Float64} (time = 0 ))
130+
131+ τx = Field {Face, Center, Nothing} (grid)
132+ τy = Field {Center, Face, Nothing} (grid)
133+ Jᵀ = Field {Center, Center, Nothing} (grid)
134+ Jˢ = Field {Center, Center, Nothing} (grid)
135+
136+ u = XFaceField (grid, boundary_conditions= FieldBoundaryConditions (grid, (Face, Center, Center), top = FluxBoundaryCondition (τx)))
137+ v = YFaceField (grid, boundary_conditions= FieldBoundaryConditions (grid, (Center, Face, Center), top = FluxBoundaryCondition (τy)))
138+ T = CenterField (grid, boundary_conditions= FieldBoundaryConditions (grid, (Center, Center, Center), top = FluxBoundaryCondition (Jᵀ)))
139+ S = CenterField (grid, boundary_conditions= FieldBoundaryConditions (grid, (Center, Center, Center), top = FluxBoundaryCondition (Jˢ)))
140+
141+ PrescribedOcean (architecture (grid), grid, clock, (; u, v, w= ZeroField ()), (; T, S), timeseries)
142+ end
143+
118144# ...with prescribed velocity and tracer fields
119145version = ECCO4Monthly ()
120146dates = all_ECCO_dates (version)[1 : 24 ]
@@ -131,6 +157,35 @@ grid = ECCO.ECCO_immersed_grid(arch)
131157ocean_model = PrescribedOcean ((; u, v, T, S); grid)
132158ocean = Simulation (ocean_model, Δt= 3 hour, stop_time= 365 days)
133159
160+ # ####
161+ # #### Need to extend a couple of methods
162+ # ####
163+
164+ function time_step! (model:: PrescribedOcean , Δt; callbacks= [], euler= true )
165+ tick! (model. clock, Δt)
166+ time = Time (model. clock. time)
167+
168+ possible_fts = merge (model. velocities, model. tracers)
169+ time_series_tuple = extract_field_time_series (possible_fts)
170+
171+ for fts in time_series_tuple
172+ update_field_time_series! (fts, time)
173+ end
174+
175+ parent (model. velocities. u) .= parent (model. timeseries. u[time])
176+ parent (model. velocities. v) .= parent (model. timeseries. v[time])
177+ parent (model. tracers. T) .= parent (model. timeseries. T[time])
178+ parent (model. tracers. S) .= parent (model. timeseries. S[time])
179+
180+ return nothing
181+ end
182+
183+ update_state! (:: PrescribedOcean ) = nothing
184+ timestepper (:: PrescribedOcean ) = nothing
185+
186+ reference_density (ocean:: Simulation{<:PrescribedOcean} ) = 1025.6
187+ heat_capacity (ocean:: Simulation{<:PrescribedOcean} ) = 3995.6
188+
134189# ####
135190# #### A prescribed atmosphere...
136191# ####
0 commit comments