Skip to content

Commit

Permalink
move update_firstdayofmonth! to Interfacer
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Sep 10, 2024
1 parent 22b23a6 commit 5593b08
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/run_amip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ checkpoint_cb = CallbackManager.HourlyCallback(
) # 20 days
update_firstdayofmonth!_cb = CallbackManager.MonthlyCallback(
dt = FT(1),
func = CallbackManager.update_firstdayofmonth!,
func = Interfacer.update_firstdayofmonth!,
ref_date = [dates.first_day_of_month[1]],
active = true,
)
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/run_cloudless_aquaplanet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ checkpoint_cb = CallbackManager.HourlyCallback(
) # 20 days
update_firstdayofmonth!_cb = CallbackManager.MonthlyCallback(
dt = FT(1),
func = CallbackManager.update_firstdayofmonth!,
func = Interfacer.update_firstdayofmonth!,
ref_date = [dates.first_day_of_month[1]],
active = true,
)
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/run_cloudy_aquaplanet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ checkpoint_cb = CallbackManager.HourlyCallback(
) # 20 days
update_firstdayofmonth!_cb = CallbackManager.MonthlyCallback(
dt = FT(1),
func = CallbackManager.update_firstdayofmonth!,
func = Interfacer.update_firstdayofmonth!,
ref_date = [dates.first_day_of_month[1]],
active = true,
)
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/run_cloudy_slabplanet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ checkpoint_cb = CallbackManager.HourlyCallback(
) # 20 days
update_firstdayofmonth!_cb = CallbackManager.MonthlyCallback(
dt = FT(1),
func = CallbackManager.update_firstdayofmonth!,
func = Interfacer.update_firstdayofmonth!,
ref_date = [dates.first_day_of_month[1]],
active = true,
)
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/run_dry_held_suarez.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ checkpoint_cb = CallbackManager.HourlyCallback(
) # 20 days TODO: not GPU friendly
update_firstdayofmonth!_cb = CallbackManager.MonthlyCallback(
dt = FT(1),
func = CallbackManager.update_firstdayofmonth!,
func = Interfacer.update_firstdayofmonth!,
ref_date = [dates.first_day_of_month[1]],
active = true,
)
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/run_moist_held_suarez.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ checkpoint_cb = CallbackManager.HourlyCallback(
)
update_firstdayofmonth!_cb = CallbackManager.MonthlyCallback(
dt = FT(1),
func = CallbackManager.update_firstdayofmonth!,
func = Interfacer.update_firstdayofmonth!,
ref_date = [dates.first_day_of_month[1]],
active = true,
)
Expand Down
10 changes: 10 additions & 0 deletions src/Interfacer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ Return the model date at the current timestep.
"""
current_date(cs::CoupledSimulation, t) = cs.dates.date0[1] + Dates.Second(t)

"""
update_firstdayofmonth!(cs::Interfacer.CoupledSimulation, _)
This function updates the first of the month reference date.
"""
function update_firstdayofmonth!(cs, _)
cs.dates.first_day_of_month[1] = cs.dates.first_day_of_month[1] + Dates.Month(1)
@info("update_firstdayofmonth! at $(cs.dates.date)")
end

"""
ComponentModelSimulation
Expand Down

0 comments on commit 5593b08

Please sign in to comment.