Skip to content

Commit 4110aca

Browse files
committed
extend set!(model::OSIM,...) instead of set!(sim:OSIMSIM,...)
1 parent 9f811df commit 4110aca

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

src/OceanSeaIceModels/ocean_sea_ice_model.jl

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Oceananigans
2-
using Oceananigans.OutputWriters: checkpoint_path
32
using Oceananigans.TimeSteppers: Clock
43
using Oceananigans: SeawaterBuoyancy
54
using ClimaSeaIce.SeaIceThermodynamics: melting_temperature
@@ -78,29 +77,25 @@ initialize_jld2_file!(filepath, init, jld2_kw, including, outputs, model::OSIM)
7877

7978
write_output!(c::Checkpointer, model::OSIM) = write_output!(c, model.ocean.model)
8079

81-
"""
82-
set_clock!(sim, clock)
83-
84-
Set the clock of `sim`ulation to match the values of `clock`.
85-
"""
86-
function set_clock!(sim::OSIMSIM, clock)
87-
sim.model.clock.time = clock.time
88-
sim.model.clock.iteration = clock.iteration
89-
sim.model.clock.last_Δt = clock.last_Δt
90-
sim.model.clock.last_stage_Δt = clock.last_stage_Δt
91-
sim.model.clock.stage = clock.stage
80+
function set_clock!(model::OSIM, clock)
81+
model.clock.time = clock.time
82+
model.clock.iteration = clock.iteration
83+
model.clock.last_Δt = clock.last_Δt
84+
model.clock.last_stage_Δt = clock.last_stage_Δt
85+
model.clock.stage = clock.stage
9286
return nothing
9387
end
9488

95-
function set!(sim::OSIMSIMPA, pickup::Union{Bool, Integer, String})
96-
checkpoint_file_path = checkpoint_path(pickup, sim.output_writers)
89+
function set!(model::OSIM, checkpoint_file_path::AbstractString)
90+
atmosphere = model.atmosphere
91+
ocean = model.ocean.model
9792

98-
set!(sim.model.ocean.model, checkpoint_file_path)
93+
set!(ocean, checkpoint_file_path)
9994

100-
clock = sim.model.ocean.model.clock
101-
102-
set_clock!(sim, clock)
103-
set_clock!(sim.model.atmosphere, clock)
95+
# ensure all clocks follow the ocean model clock
96+
clock = ocean.clock
97+
set_clock!(model, clock)
98+
set_clock!(atmosphere, clock)
10499

105100
return nothing
106101
end

0 commit comments

Comments
 (0)