75 integer,
private :: time_startdate(6) = (/ -999, 1, 1, 0, 0, 0 /)
76 real(
dp),
private :: time_startms = 0.0_dp
77 real(
dp),
private :: time_startsubsec
78 integer,
private :: time_startday
79 real(
dp),
private :: time_startsec
81 integer,
private :: time_enddate(6)
82 real(
dp),
private :: time_endsubsec
83 integer,
private :: time_endday
84 real(
dp),
private :: time_endsec
86 integer,
private :: time_res_atmos_dyn = 0
87 integer,
private :: time_res_atmos_phy_cp = 0
88 integer,
private :: time_res_atmos_phy_mp = 0
89 integer,
private :: time_res_atmos_phy_rd = 0
90 integer,
private :: time_res_atmos_phy_sf = 0
91 integer,
private :: time_res_atmos_phy_tb = 0
92 integer,
private :: time_res_atmos_phy_bl = 0
93 integer,
private :: time_res_atmos_phy_ch = 0
94 integer,
private :: time_res_atmos_phy_ae = 0
95 integer,
private :: time_res_atmos_phy_lt = 0
96 integer,
private :: time_res_atmos_restart = 0
97 integer,
private :: time_res_ocean = 0
98 integer,
private :: time_res_ocean_restart = 0
99 integer,
private :: time_res_land = 0
100 integer,
private :: time_res_land_restart = 0
101 integer,
private :: time_res_urban = 0
102 integer,
private :: time_res_urban_restart = 0
103 integer,
private :: time_res_resume
105 real(
dp),
private :: time_wallclock_start
106 real(
dp),
private :: time_wallclock_limit = -1.0_dp
107 real(
dp),
private :: time_wallclock_safe = 0.9_dp
108 real(
dp),
private :: time_wallclock_safelim
110 logical,
private :: debug = .false.
112 real(
dp),
private,
parameter :: eps = 1.e-6_dp
119 setup_TimeIntegration )
180 logical,
intent(in) :: setup_timeintegration
182 real(
dp) :: time_duration = undef8
183 character(len=H_SHORT) :: time_duration_unit =
"SEC"
184 real(
dp) :: time_dt = undef8
185 character(len=H_SHORT) :: time_dt_unit =
"SEC"
187 real(
dp) :: time_dt_atmos_dyn = undef8
188 character(len=H_SHORT) :: time_dt_atmos_dyn_unit =
"SEC"
190 real(
dp) :: time_dt_atmos_phy_cp = undef8
191 character(len=H_SHORT) :: time_dt_atmos_phy_cp_unit =
""
192 real(
dp) :: time_dt_atmos_phy_mp = undef8
193 character(len=H_SHORT) :: time_dt_atmos_phy_mp_unit =
""
194 real(
dp) :: time_dt_atmos_phy_rd = undef8
195 character(len=H_SHORT) :: time_dt_atmos_phy_rd_unit =
""
196 real(
dp) :: time_dt_atmos_phy_sf = undef8
197 character(len=H_SHORT) :: time_dt_atmos_phy_sf_unit =
""
198 real(
dp) :: time_dt_atmos_phy_tb = undef8
199 character(len=H_SHORT) :: time_dt_atmos_phy_tb_unit =
""
200 real(
dp) :: time_dt_atmos_phy_bl = undef8
201 character(len=H_SHORT) :: time_dt_atmos_phy_bl_unit =
""
202 real(
dp) :: time_dt_atmos_phy_ch = undef8
203 character(len=H_SHORT) :: time_dt_atmos_phy_ch_unit =
""
204 real(
dp) :: time_dt_atmos_phy_ae = undef8
205 character(len=H_SHORT) :: time_dt_atmos_phy_ae_unit =
""
206 real(
dp) :: time_dt_atmos_phy_lt = undef8
207 character(len=H_SHORT) :: time_dt_atmos_phy_lt_unit =
""
208 real(
dp) :: time_dt_atmos_restart = undef8
209 character(len=H_SHORT) :: time_dt_atmos_restart_unit =
""
211 real(
dp) :: time_dt_ocean = undef8
212 character(len=H_SHORT) :: time_dt_ocean_unit =
""
213 real(
dp) :: time_dt_ocean_restart = undef8
214 character(len=H_SHORT) :: time_dt_ocean_restart_unit =
""
216 real(
dp) :: time_dt_land = undef8
217 character(len=H_SHORT) :: time_dt_land_unit =
""
218 real(
dp) :: time_dt_land_restart = undef8
219 character(len=H_SHORT) :: time_dt_land_restart_unit =
""
221 real(
dp) :: time_dt_urban = undef8
222 character(len=H_SHORT) :: time_dt_urban_unit =
""
223 real(
dp) :: time_dt_urban_restart = undef8
224 character(len=H_SHORT) :: time_dt_urban_restart_unit =
""
226 real(
dp) :: time_dt_resume = undef8
227 character(len=H_SHORT) :: time_dt_resume_unit =
""
229 real(
dp) :: time_dt_wallclock_check = undef8
230 character(len=H_SHORT) :: time_dt_wallclock_check_unit =
""
232 namelist / param_time / &
236 time_duration_unit, &
240 time_dt_atmos_dyn_unit, &
242 time_dt_atmos_phy_cp, &
243 time_dt_atmos_phy_cp_unit, &
244 time_dt_atmos_phy_mp, &
245 time_dt_atmos_phy_mp_unit, &
246 time_dt_atmos_phy_rd, &
247 time_dt_atmos_phy_rd_unit, &
248 time_dt_atmos_phy_sf, &
249 time_dt_atmos_phy_sf_unit, &
250 time_dt_atmos_phy_tb, &
251 time_dt_atmos_phy_tb_unit, &
252 time_dt_atmos_phy_bl, &
253 time_dt_atmos_phy_bl_unit, &
254 time_dt_atmos_phy_ch, &
255 time_dt_atmos_phy_ch_unit, &
256 time_dt_atmos_phy_ae, &
257 time_dt_atmos_phy_ae_unit, &
258 time_dt_atmos_phy_lt, &
259 time_dt_atmos_phy_lt_unit, &
260 time_dt_atmos_restart, &
261 time_dt_atmos_restart_unit, &
263 time_dt_ocean_unit, &
264 time_dt_ocean_restart, &
265 time_dt_ocean_restart_unit, &
268 time_dt_land_restart, &
269 time_dt_land_restart_unit, &
271 time_dt_urban_unit, &
272 time_dt_urban_restart, &
273 time_dt_urban_restart_unit, &
274 time_dt_wallclock_check, &
275 time_dt_wallclock_check_unit, &
277 time_dt_resume_unit, &
278 time_wallclock_limit, &
279 time_wallclock_safe, &
284 real(
dp) :: cftime(1)
285 character(len=H_MID) :: cfunits
287 real(
dp) :: time_durationsec
288 character(len=27) :: startchardate
289 character(len=27) :: endchardate
295 log_info(
"ADMIN_TIME_setup",*)
'Setup'
303 log_info(
"ADMIN_TIME_setup",*)
'Not found namelist. Default used.'
304 elseif( ierr > 0 )
then
305 log_error(
"ADMIN_TIME_setup",*)
'Not appropriate names in namelist PARAM_TIME. Check!'
311 if ( setup_timeintegration )
then
314 log_info(
"ADMIN_TIME_setup",*)
'Check time interval and unit for each component '
316 if ( time_dt == undef8 )
then
317 log_error(
"ADMIN_TIME_setup",*)
'Not found TIME_DT. STOP.'
320 if ( time_duration == undef8 )
then
321 log_error(
"ADMIN_TIME_setup",*)
'Not found TIME_DURATION. STOP.'
326 if ( time_dt_atmos_dyn == undef8 )
then
328 log_info_cont(*)
'Not found TIME_DT_ATMOS_DYN. TIME_DT is used.'
329 time_dt_atmos_dyn = time_dt
332 if ( time_dt_atmos_dyn_unit ==
'' )
then
333 log_info_cont(*)
'Not found TIME_DT_ATMOS_DYN_UNIT. TIME_DT_UNIT is used.'
334 time_dt_atmos_dyn_unit = time_dt_unit
337 if ( time_dt_atmos_phy_cp == undef8 )
then
338 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_CP. TIME_DT is used.'
339 time_dt_atmos_phy_cp = time_dt
341 if ( time_dt_atmos_phy_cp_unit ==
'' )
then
342 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_CP_UNIT. TIME_DT_UNIT is used.'
343 time_dt_atmos_phy_cp_unit = time_dt_unit
346 if ( time_dt_atmos_phy_mp == undef8 )
then
347 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_MP. TIME_DT is used.'
348 time_dt_atmos_phy_mp = time_dt
350 if ( time_dt_atmos_phy_mp_unit ==
'' )
then
351 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_MP_UNIT. TIME_DT_UNIT is used.'
352 time_dt_atmos_phy_mp_unit = time_dt_unit
355 if ( time_dt_atmos_phy_rd == undef8 )
then
356 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_RD. TIME_DT is used.'
357 time_dt_atmos_phy_rd = time_dt
359 if ( time_dt_atmos_phy_rd_unit ==
'' )
then
360 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_RD_UNIT. TIME_DT_UNIT is used.'
361 time_dt_atmos_phy_rd_unit = time_dt_unit
364 if ( time_dt_atmos_phy_sf == undef8 )
then
365 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_SF. TIME_DT is used.'
366 time_dt_atmos_phy_sf = time_dt
368 if ( time_dt_atmos_phy_sf_unit ==
'' )
then
369 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_SF_UNIT. TIME_DT_UNIT is used.'
370 time_dt_atmos_phy_sf_unit = time_dt_unit
373 if ( time_dt_atmos_phy_tb == undef8 )
then
374 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_TB. TIME_DT is used.'
375 time_dt_atmos_phy_tb = time_dt
377 if ( time_dt_atmos_phy_tb_unit ==
'' )
then
378 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_TB_UNIT. TIME_DT_UNIT is used.'
379 time_dt_atmos_phy_tb_unit = time_dt_unit
382 if ( time_dt_atmos_phy_bl == undef8 )
then
383 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_BL. TIME_DT is used.'
384 time_dt_atmos_phy_bl = time_dt
386 if ( time_dt_atmos_phy_bl_unit ==
'' )
then
387 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_BL_UNIT. TIME_DT_UNIT is used.'
388 time_dt_atmos_phy_bl_unit = time_dt_unit
391 if ( time_dt_atmos_phy_ch == undef8 )
then
392 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_CH. TIME_DT is used.'
393 time_dt_atmos_phy_ch = time_dt
395 if ( time_dt_atmos_phy_ch_unit ==
'' )
then
396 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_CH_UNIT. TIME_DT_UNIT is used.'
397 time_dt_atmos_phy_ch_unit = time_dt_unit
400 if ( time_dt_atmos_phy_ae == undef8 )
then
401 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_AE. TIME_DT is used.'
402 time_dt_atmos_phy_ae = time_dt
404 if ( time_dt_atmos_phy_ae_unit ==
'' )
then
405 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_AE_UNIT. TIME_DT_UNIT is used.'
406 time_dt_atmos_phy_ae_unit = time_dt_unit
409 if ( time_dt_atmos_phy_lt == undef8 )
then
410 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_LT. TIME_DT is used.'
411 time_dt_atmos_phy_lt = time_dt
413 if ( time_dt_atmos_phy_lt_unit ==
'' )
then
414 log_info_cont(*)
'Not found TIME_DT_ATMOS_PHY_LT_UNIT. TIME_DT_UNIT is used.'
415 time_dt_atmos_phy_lt_unit = time_dt_unit
418 if ( time_dt_atmos_restart == undef8 )
then
419 log_info_cont(*)
'Not found TIME_DT_ATMOS_RESTART. TIME_DURATION is used.'
420 time_dt_atmos_restart = time_duration
422 if ( time_dt_atmos_restart_unit ==
'' )
then
423 log_info_cont(*)
'Not found TIME_DT_ATMOS_RESTART_UNIT. TIME_DURATION_UNIT is used.'
424 time_dt_atmos_restart_unit = time_duration_unit
427 if ( time_dt_ocean == undef8 )
then
428 log_info_cont(*)
'Not found TIME_DT_OCEAN. TIME_DT is used.'
429 time_dt_ocean = time_dt
431 if ( time_dt_ocean_unit ==
'' )
then
432 log_info_cont(*)
'Not found TIME_DT_OCEAN_UNIT. TIME_DT_UNIT is used.'
433 time_dt_ocean_unit = time_dt_unit
436 if ( time_dt_ocean_restart == undef8 )
then
437 log_info_cont(*)
'Not found TIME_DT_OCEAN_RESTART. TIME_DURATION is used.'
438 time_dt_ocean_restart = time_duration
440 if ( time_dt_ocean_restart_unit ==
'' )
then
441 log_info_cont(*)
'Not found TIME_DT_OCEAN_RESTART_UNIT. TIME_DURATION_UNIT is used.'
442 time_dt_ocean_restart_unit = time_duration_unit
445 if ( time_dt_land == undef8 )
then
446 log_info_cont(*)
'Not found TIME_DT_LAND. TIME_DT is used.'
447 time_dt_land = time_dt
449 if ( time_dt_land_unit ==
'' )
then
450 log_info_cont(*)
'Not found TIME_DT_LAND_UNIT. TIME_DT_UNIT is used.'
451 time_dt_land_unit = time_dt_unit
454 if ( time_dt_land_restart == undef8 )
then
455 log_info_cont(*)
'Not found TIME_DT_LAND_RESTART. TIME_DURATION is used.'
456 time_dt_land_restart = time_duration
458 if ( time_dt_land_restart_unit ==
'' )
then
459 log_info_cont(*)
'Not found TIME_DT_LAND_RESTART_UNIT. TIME_DURATION_UNIT is used.'
460 time_dt_land_restart_unit = time_duration_unit
463 if ( time_dt_urban == undef8 )
then
464 log_info_cont(*)
'Not found TIME_DT_URBAN. TIME_DT is used.'
465 time_dt_urban = time_dt
467 if ( time_dt_urban_unit ==
'' )
then
468 log_info_cont(*)
'Not found TIME_DT_URBAN_UNIT. TIME_DT_UNIT is used.'
469 time_dt_urban_unit = time_dt_unit
472 if ( time_dt_urban_restart == undef8 )
then
473 log_info_cont(*)
'Not found TIME_DT_URBAN_RESTART. TIME_DURATION is used.'
474 time_dt_urban_restart = time_duration
476 if ( time_dt_urban_restart_unit ==
'' )
then
477 log_info_cont(*)
'Not found TIME_DT_URBAN_RESTART_UNIT. TIME_DURATION_UNIT is used.'
478 time_dt_urban_restart_unit = time_duration_unit
481 if ( time_dt_resume == undef8 )
then
482 time_dt_resume = time_duration
484 if ( time_dt_resume_unit ==
'' )
then
485 log_info_cont(*)
'Not found TIME_DT_RESUME_UNIT. TIME_DURATION_UNIT is used.'
486 time_dt_resume_unit = time_duration_unit
491 if ( time_startdate(1) == -999 )
then
492 if ( restart_in_basename /=
'' )
then
493 call file_get_attribute( restart_in_basename, &
500 call file_get_attribute( restart_in_basename, &
518 time_startdate = (/ 0, 1, 1, 0, 0, 0 /)
519 time_startsubsec = 0.0_dp
522 time_startsubsec = time_startms * 1.e-3_dp
545 time_endday = time_startday
547 if ( setup_timeintegration )
then
549 time_endsec = time_startsec + time_durationsec
551 time_endsec = time_startsec
567 log_info(
"ADMIN_TIME_setup",*)
'Global date / time setting '
568 log_info_cont(
'(1x,A,A)')
'START Date : ', startchardate
569 log_info_cont(
'(1x,A,A)')
'END Date : ', endchardate
571 if ( setup_timeintegration )
then
578 log_info_cont(
'(1x,A,F12.3)')
'delta t (sec.) :',
time_dtsec
579 log_info_cont(
'(1x,A,I12)' )
'No. of steps :',
time_nstep
582 if ( time_dt_atmos_dyn /= undef8 )
then
650 log_error(
"ADMIN_TIME_setup",*)
'delta t(ATMOS_DYN) must be a multiple of delta t ', &
655 log_error(
"ADMIN_TIME_setup",*)
'delta t(ATMOS_PHY_CP) must be a multiple of delta t ', &
660 log_error(
"ADMIN_TIME_setup",*)
'delta t(ATMOS_PHY_MP) must be a multiple of delta t ', &
665 log_error(
"ADMIN_TIME_setup",*)
'delta t(ATMOS_PHY_RD) must be a multiple of delta t ', &
670 log_error(
"ADMIN_TIME_setup",*)
'delta t(ATMOS_PHY_SF) must be a multiple of delta t ', &
675 log_error(
"ADMIN_TIME_setup",*)
'delta t(ATMOS_PHY_TB) must be a multiple of delta t ', &
680 log_error(
"ADMIN_TIME_setup",*)
'delta t(ATMOS_PHY_BL) must be a multiple of delta t ', &
685 log_error(
"ADMIN_TIME_setup",*)
'delta t(ATMOS_PHY_CH) must be a multiple of delta t ', &
690 log_error(
"ADMIN_TIME_setup",*)
'delta t(ATMOS_PHY_AE) must be a multiple of delta t ', &
695 log_error(
"ADMIN_TIME_setup",*)
'delta t(ATMOS_PHY_LT) must be a multiple of delta t ', &
700 log_error(
"ADMIN_TIME_setup",*)
'delta t(OCEAN) must be a multiple of delta t ', &
705 log_error(
"ADMIN_TIME_setup",*)
'delta t(LAND) must be a multiple of delta t ', &
710 log_error(
"ADMIN_TIME_setup",*)
'delta t(URBAN) must be a multiple of delta t ', &
715 log_error(
"ADMIN_TIME_setup",*)
'delta t(ATMOS_RESTART) must be a multiple of delta t ', &
720 log_error(
"ADMIN_TIME_setup",*)
'delta t(OCEAN_RESTART) must be a multiple of delta t ', &
725 log_error(
"ADMIN_TIME_setup",*)
'delta t(LAND_RESTART) must be a multiple of delta t ', &
730 log_error(
"ADMIN_TIME_setup",*)
'delta t(URBAN_RESTART) must be a multiple of delta t ', &
735 log_error(
"ADMIN_TIME_setup",*)
'delta t(URBAN_RESTART) must be a multiple of delta t ', &
740 log_error(
"ADMIN_TIME_setup",*)
'delta t(RESUME) must be a multiple of delta t ', &
746 log_info(
"ADMIN_TIME_setup",*)
'Time interval for each component (sec.)'
747 log_info_cont(*)
'Atmosphere'
776 log_info_cont(*)
'Time interval for restart (sec.)'
794 if ( time_wallclock_limit > 0.0_dp )
then
796 log_info(
"ADMIN_TIME_setup",*)
'Wall clock time limit of execution is specified.'
798 if ( time_dt_wallclock_check == undef8 )
then
799 log_info_cont(*)
'Not found TIME_DT_WALLCLOCK_CHECK. largest time step interval is used.'
814 if ( time_dt_wallclock_check_unit ==
'' )
then
815 log_info_cont(*)
'Not found TIME_DT_WALLCLOCK_CHECK_UNIT. TIME_DURATION_UNIT is used.'
816 time_dt_wallclock_check_unit = time_duration_unit
824 time_wallclock_safe = max( min( time_wallclock_safe, 1.0_dp ), 0.0_dp )
825 time_wallclock_safelim = time_wallclock_limit * time_wallclock_safe
827 log_info_cont(
'(1x,A,F10.1,A)')
'This job stops after ', time_wallclock_safelim,
' seconds.'
867 real(
dp) :: wallclock_elapse
868 character(len=27) :: nowchardate
888 time_res_atmos_dyn = time_res_atmos_dyn + 1
889 time_res_atmos_phy_cp = time_res_atmos_phy_cp + 1
890 time_res_atmos_phy_mp = time_res_atmos_phy_mp + 1
891 time_res_atmos_phy_rd = time_res_atmos_phy_rd + 1
892 time_res_atmos_phy_sf = time_res_atmos_phy_sf + 1
893 time_res_atmos_phy_tb = time_res_atmos_phy_tb + 1
894 time_res_atmos_phy_bl = time_res_atmos_phy_bl + 1
895 time_res_atmos_phy_ch = time_res_atmos_phy_ch + 1
896 time_res_atmos_phy_ae = time_res_atmos_phy_ae + 1
897 time_res_atmos_phy_lt = time_res_atmos_phy_lt + 1
898 time_res_ocean = time_res_ocean + 1
899 time_res_land = time_res_land + 1
900 time_res_urban = time_res_urban + 1
901 time_res_resume = time_res_resume + 1
906 time_res_atmos_dyn = 0
911 time_res_atmos_phy_cp = 0
916 time_res_atmos_phy_mp = 0
921 time_res_atmos_phy_rd = 0
926 time_res_atmos_phy_sf = 0
931 time_res_atmos_phy_tb = 0
936 time_res_atmos_phy_bl = 0
941 time_res_atmos_phy_ch = 0
946 time_res_atmos_phy_ae = 0
951 time_res_atmos_phy_lt = 0
980 wallclock_elapse =
prc_mpitime() - time_wallclock_start
983 if ( time_wallclock_limit > 0.0_dp )
then
984 log_progress(
'(1x,2A,2(A,I7),2(A,F10.1))')
'TIME: ', nowchardate,
' STEP:',
time_nowstep,
'/',
time_nstep, &
985 ' WCLOCK:', wallclock_elapse,
'/', time_wallclock_safelim
987 write(*,
'(1x,2A,2(A,I7),2(A,F10.1))')
'TIME: ', nowchardate,
' STEP:',
time_nowstep,
'/',
time_nstep, &
988 ' WCLOCK:', wallclock_elapse,
'/', time_wallclock_safelim
991 log_progress(
'(1x,2A,2(A,I7),A,F10.1)')
'TIME: ', nowchardate,
' STEP:',
time_nowstep,
'/',
time_nstep, &
992 ' WCLOCK:', wallclock_elapse
994 write(*,
'(1x,2A,2(A,I7),A,F10.1)')
'TIME: ', nowchardate,
' STEP:',
time_nowstep,
'/',
time_nstep, &
995 ' WCLOCK:', wallclock_elapse
1027 real(
dp) :: wallclock_elapse
1028 logical :: wallclock_doend
1056 if ( time_wallclock_limit > 0.0_dp )
then
1057 wallclock_doend = .false.
1062 wallclock_elapse =
prc_mpitime() - time_wallclock_start
1064 if( wallclock_elapse > time_wallclock_safelim ) wallclock_doend = .true.
1068 call comm_bcast( wallclock_doend )
1070 if ( wallclock_doend )
then
1072 log_info(
"ADMIN_TIME_advance",*)
'**************************************************************'
1073 log_info(
"ADMIN_TIME_advance",*)
'Elapse time limit is detected. Termination operation starts. '
1074 log_info(
"ADMIN_TIME_advance",*)
'**************************************************************'
1085 time_res_atmos_restart = time_res_atmos_restart + 1
1086 time_res_ocean_restart = time_res_ocean_restart + 1
1087 time_res_land_restart = time_res_land_restart + 1
1088 time_res_urban_restart = time_res_urban_restart + 1
1092 time_res_atmos_restart = 0
1099 time_res_ocean_restart = 0
1106 time_res_land_restart = 0
1113 time_res_urban_restart = 0