Skip to content
Snippets Groups Projects
Commit d5fb0813 authored by Stefan Hagemann's avatar Stefan Hagemann :soccer:
Browse files

Correct date/time metatinfo in restart file at simulation end

parent 3ceade9a
No related branches found
No related tags found
No related merge requests found
...@@ -361,7 +361,11 @@ write(nout,*) 'OTBhd_init_io' ...@@ -361,7 +361,11 @@ write(nout,*) 'OTBhd_init_io'
! write restart file ! write restart file
IF (step == istep+nstep) THEN ! End of simulation restart IF (step == istep+nstep) THEN ! End of simulation restart
CALL hydrology_restart IF (LEN_TRIM(date_rest).GT.0 .AND. step == istep+nstep_rest) THEN
CALL hydrology_restart(date_rest, time_rest)
ELSE
CALL hydrology_restart
ENDIF
ELSE IF (step == istep+nstep_rest) THEN ! Dedicated or regular restart ELSE IF (step == istep+nstep_rest) THEN ! Dedicated or regular restart
CALL hydrology_restart(date_rest, time_rest) CALL hydrology_restart(date_rest, time_rest)
IF (irest_regular.GT.0) CALL update_regular_restart(irest_regular, nstep_rest, date_rest) IF (irest_regular.GT.0) CALL update_regular_restart(irest_regular, nstep_rest, date_rest)
......
...@@ -57,7 +57,7 @@ MODULE mo_hydrology ...@@ -57,7 +57,7 @@ MODULE mo_hydrology
delta_time, ev_puthd, get_interval_seconds, & delta_time, ev_puthd, get_interval_seconds, &
io_time_event, & io_time_event, &
initial_date, start_date, out_convert_date, inp_convert_date, & initial_date, start_date, out_convert_date, inp_convert_date, &
current_date, cdate2ymd, ctime2hms current_date, cdate2ymd, ctime2hms, calc_current_end_date
USE mo_array_utils, ONLY: dec_monotonic_closest_midpoint, & USE mo_array_utils, ONLY: dec_monotonic_closest_midpoint, &
inc_monotonic_closest_midpoint inc_monotonic_closest_midpoint
USE mo_coupling, ONLY: set_grid_dimensions, set_local_partition, & USE mo_coupling, ONLY: set_grid_dimensions, set_local_partition, &
...@@ -661,10 +661,10 @@ CONTAINS ...@@ -661,10 +661,10 @@ CONTAINS
CALL IO_put_att_text (fileID, NF_GLOBAL, 'restart_date', date_rest) CALL IO_put_att_text (fileID, NF_GLOBAL, 'restart_date', date_rest)
CALL IO_put_att_text (fileID, NF_GLOBAL, 'restart_time', time_rest) CALL IO_put_att_text (fileID, NF_GLOBAL, 'restart_time', time_rest)
ELSE ELSE
CALL out_convert_date (current_date, yyyymmdd, hhmmss) CALL calc_current_end_date (yyyymmdd, hhmmss)
CALL IO_put_att_int (fileID, NF_GLOBAL, 'current_date', yyyymmdd) CALL IO_put_att_int (fileID, NF_GLOBAL, 'restart_date', yyyymmdd)
WRITE(chms, '(I6.6)') hhmmss WRITE(chms, '(I6.6)') hhmmss
CALL IO_put_att_text (fileID, NF_GLOBAL, 'current_time', chms) CALL IO_put_att_text (fileID, NF_GLOBAL, 'restart_time', chms)
ENDIF ENDIF
CALL IO_def_dim (fileID, 'lon', grid_hd%nlon, xdimid) CALL IO_def_dim (fileID, 'lon', grid_hd%nlon, xdimid)
......
...@@ -405,6 +405,7 @@ MODULE mo_time_control ...@@ -405,6 +405,7 @@ MODULE mo_time_control
PUBLIC :: calc_nstep ! Calculate the number of time steps between two ISO dates & times PUBLIC :: calc_nstep ! Calculate the number of time steps between two ISO dates & times
PUBLIC :: update_regular_restart ! Updates the time step number nstep_rest PUBLIC :: update_regular_restart ! Updates the time step number nstep_rest
! when the next regular restart file shall be written ! when the next regular restart file shall be written
PUBLIC :: calc_current_end_date ! Calculate the date/time at the end of the current time step
CONTAINS CONTAINS
!+ !+
...@@ -2473,6 +2474,26 @@ CONTAINS ...@@ -2473,6 +2474,26 @@ CONTAINS
END SUBROUTINE update_regular_restart END SUBROUTINE update_regular_restart
!*****************************************************************************
SUBROUTINE calc_current_end_date(ymd_end, hms_end)
!*****************************************************************************
! Calculate the date ymd_end and time hms_end at the end current date time step
INTEGER, INTENT(out) :: ymd_end, hms_end
TYPE(time_days) :: date1
INTEGER :: i0 = 0
INTEGER :: idt
idt = NINT(delta_time)
date1 = current_date
CALL add_date(i0, idt, date1)
CALL out_convert_date (date1, ymd_end, hms_end)
END SUBROUTINE calc_current_end_date
!+ !+
! ------------------------------------------------------------------------------ ! ------------------------------------------------------------------------------
! !
......
...@@ -49,7 +49,7 @@ IWORK=1 # Run time: 1=1 year, 2=1 month, 3=year with 30 day months ...@@ -49,7 +49,7 @@ IWORK=1 # Run time: 1=1 year, 2=1 month, 3=year with 30 day months
nday_final=212 # Jan-July: 90+91+31 nday_final=212 # Jan-July: 90+91+31
ndate_end=20210731 # end date of run for IWORK=4 ndate_end=20210731 # end date of run for IWORK=4
irest_regular=2 # Regular writing of restart file (0=no, 1=annual, 2=monthly) #irest_regular=2 # Regular writing of restart file (0=no, 1=annual, 2=monthly)
MM=01 # Start month MM=01 # Start month
# BIAS CORRECTION # BIAS CORRECTION
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment