From d30ff7c94e42f542475639817792de31f9f1feb2 Mon Sep 17 00:00:00 2001 From: Aidan Heerdegen Date: Fri, 24 Aug 2018 18:06:48 +1000 Subject: [PATCH] Fix reds gulf bay timing fix, make time absolute (#240) * Use aboslute model time to determine redsea gulf bay fix * Added sfix timing changes to ACCESS-CM --- .gitignore | 2 ++ src/accesscm_coupler/ocean_solo.F90 | 19 ++++++++++++++----- src/accessom_coupler/ocean_solo.F90 | 19 ++++++++++++++----- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index eecb28b0c0..c49e1794ee 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ src/shared/version/version.F90 *.pyc tags data/archives +src/shared/mpp/null_mpp_io_test.mod +*.mod \ No newline at end of file diff --git a/src/accesscm_coupler/ocean_solo.F90 b/src/accesscm_coupler/ocean_solo.F90 index ca287af480..c8d0783e8b 100644 --- a/src/accesscm_coupler/ocean_solo.F90 +++ b/src/accesscm_coupler/ocean_solo.F90 @@ -175,6 +175,7 @@ program main #ifdef ACCESS type(time_type) :: Time_last_sfix type(time_type) :: Time_sfix + integer :: sfix_seconds #endif character(len=17) :: calendar = 'julian' @@ -310,10 +311,6 @@ program main Time_step_coupled = set_time(dt_cpld, 0) num_cpld_calls = Run_len / Time_step_coupled Time = Time_start -#ifdef ACCESS - Time_last_sfix = Time_start - Time_sfix = set_time(seconds=int(sfix_hours*SECONDS_PER_HOUR)) -#endif Time_restart_init = set_date(date_restart(1), date_restart(2), date_restart(3), & date_restart(4), date_restart(5), date_restart(6) ) @@ -369,6 +366,18 @@ program main call ocean_model_init(Ocean_sfc, Ocean_state, Time_init, Time) +#ifdef ACCESS + ! This must be called after ocean_model_init so sfix_hours is read in from namelist + sfix_seconds = sfix_hours * SECONDS_PER_HOUR + ! Get current model time from Time_init in seconds (must be done like this otherwise + ! can get an overflow in seconds) + call get_time(Time-Time_init,seconds) + ! The last sfix time has to be determined from absolute model time, to ensure reproducibility + ! across restarts + Time_last_sfix = set_time(seconds=int(seconds/sfix_seconds)*sfix_seconds) + Time_init + Time_sfix = set_time(seconds=int(sfix_seconds)) +#endif + call data_override_init(Ocean_domain_in = Ocean_sfc%domain) override_clock = mpp_clock_id('Override', flags=flags,grain=CLOCK_COMPONENT) @@ -489,7 +498,7 @@ program main call external_coupler_mpi_exit(mpi_comm_mom, external_initialization) - print *, 'MOM4: --- completed ---' + print *, 'MOM5: --- completed ---' contains diff --git a/src/accessom_coupler/ocean_solo.F90 b/src/accessom_coupler/ocean_solo.F90 index 2522c3a7db..2522095575 100644 --- a/src/accessom_coupler/ocean_solo.F90 +++ b/src/accessom_coupler/ocean_solo.F90 @@ -94,7 +94,7 @@ program main use mpp_mod, only: mpp_broadcast use time_interp_external_mod, only: time_interp_external_init use time_manager_mod, only: set_calendar_type, time_type, increment_date - use time_manager_mod, only: set_time, set_date, get_time, get_date, month_name + use time_manager_mod, only: set_time, set_date, get_time, get_date, month_name, print_time use time_manager_mod, only: GREGORIAN, JULIAN, NOLEAP, THIRTY_DAY_MONTHS, NO_CALENDAR use time_manager_mod, only: operator( <= ), operator( < ), operator( >= ) use time_manager_mod, only: operator( + ), operator( - ), operator( / ) @@ -133,6 +133,7 @@ program main #ifdef ACCESS type(time_type) :: Time_last_sfix type(time_type) :: Time_sfix + integer :: sfix_seconds #endif character(len=17) :: calendar = 'julian' @@ -291,10 +292,6 @@ program main Time_step_coupled = set_time(dt_cpld, 0) num_cpld_calls = Run_len / Time_step_coupled Time = Time_start -#ifdef ACCESS - Time_last_sfix = Time_start - Time_sfix = set_time(seconds=int(sfix_hours*SECONDS_PER_HOUR)) -#endif Time_restart_init = set_date(date_restart(1), date_restart(2), date_restart(3), & date_restart(4), date_restart(5), date_restart(6) ) @@ -351,6 +348,18 @@ program main call ocean_model_init(Ocean_sfc, Ocean_state, Time_init, Time, & accessom2%get_ice_ocean_timestep()) +#ifdef ACCESS + ! This must be called after ocean_model_init so sfix_hours is read in from namelist + sfix_seconds = sfix_hours * SECONDS_PER_HOUR + ! Get current model time from Time_init in seconds (must be done like this otherwise + ! can get an overflow in seconds) + call get_time(Time-Time_init,seconds) + ! The last sfix time has to be determined from absolute model time, to ensure reproducibility + ! across restarts + Time_last_sfix = set_time(seconds=int(seconds/sfix_seconds)*sfix_seconds) + Time_init + Time_sfix = set_time(seconds=int(sfix_seconds)) +#endif + call data_override_init(Ocean_domain_in = Ocean_sfc%domain) override_clock = mpp_clock_id('Override', flags=flags,grain=CLOCK_COMPONENT)