From dab745ce210b16a61d3501bd7753a346275337dd Mon Sep 17 00:00:00 2001 From: Nic Hannah Date: Thu, 16 Apr 2020 09:32:40 +1000 Subject: [PATCH] Fix to repeat forcing day when exp is on leap day. #22 --- libcouple/src/accessom2.F90 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libcouple/src/accessom2.F90 b/libcouple/src/accessom2.F90 index 1a2dcfd..9374cf9 100644 --- a/libcouple/src/accessom2.F90 +++ b/libcouple/src/accessom2.F90 @@ -50,6 +50,8 @@ module accessom2_mod type(datetime) :: exp_cur_date, forcing_cur_date type(datetime) :: run_start_date, run_end_date + integer, dimension(3) :: skip_date_mismatch_date + contains private procedure, pass(self), public :: init => accessom2_init @@ -554,7 +556,19 @@ subroutine accessom2_progress_date(self, timestep) self%forcing_cur_date%getDay() == 1)) then self%forcing_cur_date = self%forcing_cur_date - timedelta(days=1) - check_for_date_mismatch = .false. + ! Skip the date mismatch checking for the whole day + self%skip_date_mismatch_date(1) = self%exp_cur_date%getYear() + self%skip_date_mismatch_date(2) = self%exp_cur_date%getMonth() + self%skip_date_mismatch_date(3) = self%exp_cur_date%getDay() + endif + + ! Don't check for date mismatch if we are replaying the forcing day + if (self%exp_cur_date%getYear() == self%skip_date_mismatch_date(1) .and. & + self%exp_cur_date%getMonth() == self%skip_date_mismatch_date(2) .and. & + self%exp_cur_date%getDay() == self%skip_date_mismatch_date(3)) then + return + else + self%skip_date_mismatch_date(:) = 0 endif ! Expect the forcing date and experiment date to only differ on the year.