SCALE-RM
mod_admin_time.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
10 #include "scalelib.h"
12  !-----------------------------------------------------------------------------
13  !
14  !++ used modules
15  !
16  use scale_precision
17  use scale_io
18  use scale_prof
19  !-----------------------------------------------------------------------------
20  implicit none
21  private
22  !-----------------------------------------------------------------------------
23  !
24  !++ Public procedure
25  !
26  public :: admin_time_setup
27  public :: admin_time_checkstate
28  public :: admin_time_advance
29 
30  !-----------------------------------------------------------------------------
31  !
32  !++ Public parameters & variables
33  !
34  real(dp), public :: time_dtsec_atmos_restart
35  real(dp), public :: time_dtsec_ocean_restart
36  real(dp), public :: time_dtsec_land_restart
37  real(dp), public :: time_dtsec_urban_restart
38  real(dp), public :: time_dtsec_resume
39 
40  integer, public :: time_dstep_atmos_restart
41  integer, public :: time_dstep_ocean_restart
42  integer, public :: time_dstep_land_restart
43  integer, public :: time_dstep_urban_restart
44  integer, public :: time_dstep_resume
45 
46  logical, public :: time_doatmos_step
47  logical, public :: time_doatmos_dyn
48  logical, public :: time_doatmos_phy_cp
49  logical, public :: time_doatmos_phy_mp
50  logical, public :: time_doatmos_phy_rd
51  logical, public :: time_doatmos_phy_sf
52  logical, public :: time_doatmos_phy_tb
53  logical, public :: time_doatmos_phy_bl
54  logical, public :: time_doatmos_phy_ch
55  logical, public :: time_doatmos_phy_ae
56  logical, public :: time_doatmos_phy_lt
57  logical, public :: time_doatmos_restart
58  logical, public :: time_doocean_step
59  logical, public :: time_doocean_restart
60  logical, public :: time_doland_step
61  logical, public :: time_doland_restart
62  logical, public :: time_dourban_step
63  logical, public :: time_dourban_restart
64  logical, public :: time_doda_step
65  logical, public :: time_doresume
66  logical, public :: time_doend
67 
68  !-----------------------------------------------------------------------------
69  !
70  !++ Private procedure
71  !
72  !-----------------------------------------------------------------------------
73  !
74  !++ Private parameters & variables
75  !
76  integer, private :: time_startdate(6) = (/ -999, 1, 1, 0, 0, 0 /)
77  real(dp), private :: time_startms = 0.0_dp
78  real(dp), private :: time_startsubsec
79  integer, private :: time_startday
80  real(dp), private :: time_startsec
81 
82  integer, private :: time_enddate(6)
83  real(dp), private :: time_endsubsec
84  integer, private :: time_endday
85  real(dp), private :: time_endsec
86 
87  integer, private :: time_res_atmos_dyn
88  integer, private :: time_res_atmos_phy_cp
89  integer, private :: time_res_atmos_phy_mp
90  integer, private :: time_res_atmos_phy_rd
91  integer, private :: time_res_atmos_phy_sf
92  integer, private :: time_res_atmos_phy_tb
93  integer, private :: time_res_atmos_phy_bl
94  integer, private :: time_res_atmos_phy_ch
95  integer, private :: time_res_atmos_phy_ae
96  integer, private :: time_res_atmos_phy_lt
97  integer, private :: time_res_atmos_restart
98  integer, private :: time_res_ocean
99  integer, private :: time_res_ocean_restart
100  integer, private :: time_res_land
101  integer, private :: time_res_land_restart
102  integer, private :: time_res_urban
103  integer, private :: time_res_urban_restart
104  integer, private :: time_res_da
105  integer, private :: time_res_resume
106 
107  real(dp), private :: time_wallclock_start ! Start time of wall clock [sec]
108  real(dp), private :: time_wallclock_limit = -1.0_dp ! Elapse time limit of wall clock time [sec]
109  real(dp), private :: time_wallclock_safe = 0.9_dp ! Safety coefficient for elapse time limit
110  real(dp), private :: time_wallclock_safelim ! TIME_WALLCLOCK_LIMIT * TIME_WALLCLOCK_SAFE
111 
112  logical, private :: debug = .false.
113 
114  real(dp), private, parameter :: eps = 1.e-6_dp
115 
116  !-----------------------------------------------------------------------------
117 contains
118  !-----------------------------------------------------------------------------
120  subroutine admin_time_setup( &
121  setup_TimeIntegration )
122  use scale_file, only: &
123  file_get_attribute
124  use scale_prc, only: &
125  prc_myrank, &
126  prc_abort, &
128  use scale_const, only: &
129  undef8 => const_undef8
130  use scale_calendar, only: &
138  use scale_time, only: &
139  time_dtsec, &
140  time_nowdate, &
141  time_nowsubsec, &
142  time_nowday, &
143  time_nowsec, &
144  time_nowdaysec, &
145  time_nowstep, &
146  time_nstep, &
148  nstep_dyn => time_nstep_atmos_dyn, &
159  time_dtsec_land, &
161  time_dtsec_da, &
174  time_dstep_land, &
176  time_dstep_da, &
180  use mod_atmos_vars, only: &
181  restart_in_basename => atmos_restart_in_basename
182  implicit none
183 
184  logical, intent(in) :: setup_timeintegration
185 
186  real(dp) :: time_duration
187  character(len=H_SHORT) :: time_duration_unit
188  real(dp) :: time_dt
189  character(len=H_SHORT) :: time_dt_unit
190 
191  real(dp) :: time_dt_atmos_dyn
192  character(len=H_SHORT) :: time_dt_atmos_dyn_unit
193  integer :: time_nstep_atmos_dyn
194  real(dp) :: time_dt_atmos_phy_cp
195  character(len=H_SHORT) :: time_dt_atmos_phy_cp_unit
196  real(dp) :: time_dt_atmos_phy_mp
197  character(len=H_SHORT) :: time_dt_atmos_phy_mp_unit
198  real(dp) :: time_dt_atmos_phy_rd
199  character(len=H_SHORT) :: time_dt_atmos_phy_rd_unit
200  real(dp) :: time_dt_atmos_phy_sf
201  character(len=H_SHORT) :: time_dt_atmos_phy_sf_unit
202  real(dp) :: time_dt_atmos_phy_tb
203  character(len=H_SHORT) :: time_dt_atmos_phy_tb_unit
204  real(dp) :: time_dt_atmos_phy_bl
205  character(len=H_SHORT) :: time_dt_atmos_phy_bl_unit
206  real(dp) :: time_dt_atmos_phy_ch
207  character(len=H_SHORT) :: time_dt_atmos_phy_ch_unit
208  real(dp) :: time_dt_atmos_phy_ae
209  character(len=H_SHORT) :: time_dt_atmos_phy_ae_unit
210  real(dp) :: time_dt_atmos_phy_lt
211  character(len=H_SHORT) :: time_dt_atmos_phy_lt_unit
212  real(dp) :: time_dt_atmos_restart
213  character(len=H_SHORT) :: time_dt_atmos_restart_unit
214 
215  real(dp) :: time_dt_ocean
216  character(len=H_SHORT) :: time_dt_ocean_unit
217  real(dp) :: time_dt_ocean_restart
218  character(len=H_SHORT) :: time_dt_ocean_restart_unit
219 
220  real(dp) :: time_dt_land
221  character(len=H_SHORT) :: time_dt_land_unit
222  real(dp) :: time_dt_land_restart
223  character(len=H_SHORT) :: time_dt_land_restart_unit
224 
225  real(dp) :: time_dt_urban
226  character(len=H_SHORT) :: time_dt_urban_unit
227  real(dp) :: time_dt_urban_restart
228  character(len=H_SHORT) :: time_dt_urban_restart_unit
229 
230  real(dp) :: time_dt_da
231  character(len=H_SHORT) :: time_dt_da_unit
232 
233  real(dp) :: time_dt_resume
234  character(len=H_SHORT) :: time_dt_resume_unit
235 
236  real(dp) :: time_dt_wallclock_check
237  character(len=H_SHORT) :: time_dt_wallclock_check_unit
238 
239  namelist / param_time / &
240  time_startdate, &
241  time_startms, &
242  time_duration, &
243  time_duration_unit, &
244  time_dt, &
245  time_dt_unit, &
246  time_dt_atmos_dyn, &
247  time_dt_atmos_dyn_unit, &
249  time_dt_atmos_phy_cp, &
250  time_dt_atmos_phy_cp_unit, &
251  time_dt_atmos_phy_mp, &
252  time_dt_atmos_phy_mp_unit, &
253  time_dt_atmos_phy_rd, &
254  time_dt_atmos_phy_rd_unit, &
255  time_dt_atmos_phy_sf, &
256  time_dt_atmos_phy_sf_unit, &
257  time_dt_atmos_phy_tb, &
258  time_dt_atmos_phy_tb_unit, &
259  time_dt_atmos_phy_bl, &
260  time_dt_atmos_phy_bl_unit, &
261  time_dt_atmos_phy_ch, &
262  time_dt_atmos_phy_ch_unit, &
263  time_dt_atmos_phy_ae, &
264  time_dt_atmos_phy_ae_unit, &
265  time_dt_atmos_phy_lt, &
266  time_dt_atmos_phy_lt_unit, &
267  time_dt_atmos_restart, &
268  time_dt_atmos_restart_unit, &
269  time_dt_ocean, &
270  time_dt_ocean_unit, &
271  time_dt_ocean_restart, &
272  time_dt_ocean_restart_unit, &
273  time_dt_land, &
274  time_dt_land_unit, &
275  time_dt_land_restart, &
276  time_dt_land_restart_unit, &
277  time_dt_urban, &
278  time_dt_urban_unit, &
279  time_dt_urban_restart, &
280  time_dt_urban_restart_unit, &
281  time_dt_da, &
282  time_dt_da_unit, &
283  time_dt_wallclock_check, &
284  time_dt_wallclock_check_unit, &
285  time_dt_resume, &
286  time_dt_resume_unit, &
287  time_wallclock_limit, &
288  time_wallclock_safe, &
289  debug
290 
291  integer :: dateday
292  real(dp) :: datesec
293  real(dp) :: cftime(1)
294  character(len=H_MID) :: cfunits
295 
296  real(dp) :: time_durationsec
297  character(len=27) :: startchardate
298  character(len=27) :: endchardate
299 
300  integer :: ierr
301  !---------------------------------------------------------------------------
302 
303  log_newline
304  log_info("ADMIN_TIME_setup",*) 'Setup'
305 
307 
308  time_duration = undef8
309  time_duration_unit = "SEC"
310  time_dt = undef8
311  time_dt_unit = "SEC"
312 
313  time_dt_atmos_dyn = undef8
314  time_dt_atmos_dyn_unit = "SEC"
316  time_dt_atmos_phy_cp = undef8
317  time_dt_atmos_phy_cp_unit = ""
318  time_dt_atmos_phy_mp = undef8
319  time_dt_atmos_phy_mp_unit = ""
320  time_dt_atmos_phy_rd = undef8
321  time_dt_atmos_phy_rd_unit = ""
322  time_dt_atmos_phy_sf = undef8
323  time_dt_atmos_phy_sf_unit = ""
324  time_dt_atmos_phy_tb = undef8
325  time_dt_atmos_phy_tb_unit = ""
326  time_dt_atmos_phy_bl = undef8
327  time_dt_atmos_phy_bl_unit = ""
328  time_dt_atmos_phy_ch = undef8
329  time_dt_atmos_phy_ch_unit = ""
330  time_dt_atmos_phy_ae = undef8
331  time_dt_atmos_phy_ae_unit = ""
332  time_dt_atmos_phy_lt = undef8
333  time_dt_atmos_phy_lt_unit = ""
334  time_dt_atmos_restart = undef8
335  time_dt_atmos_restart_unit = ""
336 
337  time_dt_ocean = undef8
338  time_dt_ocean_unit = ""
339  time_dt_ocean_restart = undef8
340  time_dt_ocean_restart_unit = ""
341 
342  time_dt_land = undef8
343  time_dt_land_unit = ""
344  time_dt_land_restart = undef8
345  time_dt_land_restart_unit = ""
346 
347  time_dt_urban = undef8
348  time_dt_urban_unit = ""
349  time_dt_urban_restart = undef8
350  time_dt_urban_restart_unit = ""
351 
352  time_dt_da = undef8
353  time_dt_da_unit = ""
354 
355  time_dt_resume = undef8
356  time_dt_resume_unit = ""
357 
358  time_dt_wallclock_check = undef8
359  time_dt_wallclock_check_unit = ""
360 
361 
362  !--- read namelist
363  rewind(io_fid_conf)
364  read(io_fid_conf,nml=param_time,iostat=ierr)
365  if( ierr < 0 ) then !--- missing
366  log_info("ADMIN_TIME_setup",*) 'Not found namelist. Default used.'
367  elseif( ierr > 0 ) then !--- fatal error
368  log_error("ADMIN_TIME_setup",*) 'Not appropriate names in namelist PARAM_TIME. Check!'
369  call prc_abort
370  endif
371  log_nml(param_time)
372 
373  ! check time setting
374  if ( setup_timeintegration ) then
375 
376  log_newline
377  log_info("ADMIN_TIME_setup",*) 'Check time interval and unit for each component '
378 
379  if ( time_dt == undef8 ) then
380  log_error("ADMIN_TIME_setup",*) 'Not found TIME_DT. STOP.'
381  call prc_abort
382  endif
383  if ( time_duration == undef8 ) then
384  log_error("ADMIN_TIME_setup",*) 'Not found TIME_DURATION. STOP.'
385  call prc_abort
386  endif
387 
388  ! DYN
389  if ( time_dt_atmos_dyn == undef8 ) then
390  if ( time_nstep_atmos_dyn < 0 ) then
391  log_info_cont(*) 'Not found TIME_DT_ATMOS_DYN. TIME_DT is used.'
392  time_dt_atmos_dyn = time_dt
393  endif
394  endif
395  if ( time_dt_atmos_dyn_unit == '' ) then
396  log_info_cont(*) 'Not found TIME_DT_ATMOS_DYN_UNIT. TIME_DT_UNIT is used.'
397  time_dt_atmos_dyn_unit = time_dt_unit
398  endif
399  ! PHY_CP
400  if ( time_dt_atmos_phy_cp == undef8 ) then
401  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_CP. TIME_DT is used.'
402  time_dt_atmos_phy_cp = time_dt
403  endif
404  if ( time_dt_atmos_phy_cp_unit == '' ) then
405  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_CP_UNIT. TIME_DT_UNIT is used.'
406  time_dt_atmos_phy_cp_unit = time_dt_unit
407  endif
408  ! PHY_MP
409  if ( time_dt_atmos_phy_mp == undef8 ) then
410  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_MP. TIME_DT is used.'
411  time_dt_atmos_phy_mp = time_dt
412  endif
413  if ( time_dt_atmos_phy_mp_unit == '' ) then
414  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_MP_UNIT. TIME_DT_UNIT is used.'
415  time_dt_atmos_phy_mp_unit = time_dt_unit
416  endif
417  ! PHY_RD
418  if ( time_dt_atmos_phy_rd == undef8 ) then
419  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_RD. TIME_DT is used.'
420  time_dt_atmos_phy_rd = time_dt
421  endif
422  if ( time_dt_atmos_phy_rd_unit == '' ) then
423  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_RD_UNIT. TIME_DT_UNIT is used.'
424  time_dt_atmos_phy_rd_unit = time_dt_unit
425  endif
426  ! PHY_SF
427  if ( time_dt_atmos_phy_sf == undef8 ) then
428  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_SF. TIME_DT is used.'
429  time_dt_atmos_phy_sf = time_dt
430  endif
431  if ( time_dt_atmos_phy_sf_unit == '' ) then
432  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_SF_UNIT. TIME_DT_UNIT is used.'
433  time_dt_atmos_phy_sf_unit = time_dt_unit
434  endif
435  ! PHY_TB
436  if ( time_dt_atmos_phy_tb == undef8 ) then
437  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_TB. TIME_DT is used.'
438  time_dt_atmos_phy_tb = time_dt
439  endif
440  if ( time_dt_atmos_phy_tb_unit == '' ) then
441  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_TB_UNIT. TIME_DT_UNIT is used.'
442  time_dt_atmos_phy_tb_unit = time_dt_unit
443  endif
444  ! PHY_BL
445  if ( time_dt_atmos_phy_bl == undef8 ) then
446  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_BL. TIME_DT is used.'
447  time_dt_atmos_phy_bl = time_dt
448  endif
449  if ( time_dt_atmos_phy_bl_unit == '' ) then
450  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_BL_UNIT. TIME_DT_UNIT is used.'
451  time_dt_atmos_phy_bl_unit = time_dt_unit
452  endif
453  ! PHY_CH
454  if ( time_dt_atmos_phy_ch == undef8 ) then
455  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_CH. TIME_DT is used.'
456  time_dt_atmos_phy_ch = time_dt
457  endif
458  if ( time_dt_atmos_phy_ch_unit == '' ) then
459  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_CH_UNIT. TIME_DT_UNIT is used.'
460  time_dt_atmos_phy_ch_unit = time_dt_unit
461  endif
462  ! PHY_AE
463  if ( time_dt_atmos_phy_ae == undef8 ) then
464  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_AE. TIME_DT is used.'
465  time_dt_atmos_phy_ae = time_dt
466  endif
467  if ( time_dt_atmos_phy_ae_unit == '' ) then
468  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_AE_UNIT. TIME_DT_UNIT is used.'
469  time_dt_atmos_phy_ae_unit = time_dt_unit
470  endif
471  ! PHY_LT
472  if ( time_dt_atmos_phy_lt == undef8 ) then
473  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_LT. TIME_DT is used.'
474  time_dt_atmos_phy_lt = time_dt
475  endif
476  if ( time_dt_atmos_phy_lt_unit == '' ) then
477  log_info_cont(*) 'Not found TIME_DT_ATMOS_PHY_LT_UNIT. TIME_DT_UNIT is used.'
478  time_dt_atmos_phy_lt_unit = time_dt_unit
479  endif
480  ! ATMOS RESTART
481  if ( time_dt_atmos_restart == undef8 ) then
482  log_info_cont(*) 'Not found TIME_DT_ATMOS_RESTART. TIME_DURATION is used.'
483  time_dt_atmos_restart = time_duration
484  endif
485  if ( time_dt_atmos_restart_unit == '' ) then
486  log_info_cont(*) 'Not found TIME_DT_ATMOS_RESTART_UNIT. TIME_DURATION_UNIT is used.'
487  time_dt_atmos_restart_unit = time_duration_unit
488  endif
489  ! OCEAN
490  if ( time_dt_ocean == undef8 ) then
491  log_info_cont(*) 'Not found TIME_DT_OCEAN. TIME_DT is used.'
492  time_dt_ocean = time_dt
493  endif
494  if ( time_dt_ocean_unit == '' ) then
495  log_info_cont(*) 'Not found TIME_DT_OCEAN_UNIT. TIME_DT_UNIT is used.'
496  time_dt_ocean_unit = time_dt_unit
497  endif
498  ! OCEAN RESTART
499  if ( time_dt_ocean_restart == undef8 ) then
500  log_info_cont(*) 'Not found TIME_DT_OCEAN_RESTART. TIME_DURATION is used.'
501  time_dt_ocean_restart = time_duration
502  endif
503  if ( time_dt_ocean_restart_unit == '' ) then
504  log_info_cont(*) 'Not found TIME_DT_OCEAN_RESTART_UNIT. TIME_DURATION_UNIT is used.'
505  time_dt_ocean_restart_unit = time_duration_unit
506  endif
507  ! LAND
508  if ( time_dt_land == undef8 ) then
509  log_info_cont(*) 'Not found TIME_DT_LAND. TIME_DT is used.'
510  time_dt_land = time_dt
511  endif
512  if ( time_dt_land_unit == '' ) then
513  log_info_cont(*) 'Not found TIME_DT_LAND_UNIT. TIME_DT_UNIT is used.'
514  time_dt_land_unit = time_dt_unit
515  endif
516  ! LAND RESTART
517  if ( time_dt_land_restart == undef8 ) then
518  log_info_cont(*) 'Not found TIME_DT_LAND_RESTART. TIME_DURATION is used.'
519  time_dt_land_restart = time_duration
520  endif
521  if ( time_dt_land_restart_unit == '' ) then
522  log_info_cont(*) 'Not found TIME_DT_LAND_RESTART_UNIT. TIME_DURATION_UNIT is used.'
523  time_dt_land_restart_unit = time_duration_unit
524  endif
525  ! URBAN
526  if ( time_dt_urban == undef8 ) then
527  log_info_cont(*) 'Not found TIME_DT_URBAN. TIME_DT is used.'
528  time_dt_urban = time_dt
529  endif
530  if ( time_dt_urban_unit == '' ) then
531  log_info_cont(*) 'Not found TIME_DT_URBAN_UNIT. TIME_DT_UNIT is used.'
532  time_dt_urban_unit = time_dt_unit
533  endif
534  ! URBAN RESTART
535  if ( time_dt_urban_restart == undef8 ) then
536  log_info_cont(*) 'Not found TIME_DT_URBAN_RESTART. TIME_DURATION is used.'
537  time_dt_urban_restart = time_duration
538  endif
539  if ( time_dt_urban_restart_unit == '' ) then
540  log_info_cont(*) 'Not found TIME_DT_URBAN_RESTART_UNIT. TIME_DURATION_UNIT is used.'
541  time_dt_urban_restart_unit = time_duration_unit
542  endif
543  ! Data Assimilation
544  if ( time_dt_da == undef8 ) then
545  log_info_cont(*) 'Not found TIME_DT_DA. TIME_DT is used.'
546  time_dt_da = time_dt
547  endif
548  if ( time_dt_da_unit == '' ) then
549  log_info_cont(*) 'Not found TIME_DT_DA_UNIT. TIME_DT_UNIT is used.'
550  time_dt_da_unit = time_dt_unit
551  endif
552  ! Resume
553  if ( time_dt_resume == undef8 ) then
554  time_dt_resume = time_duration
555  endif
556  if ( time_dt_resume_unit == '' ) then
557  log_info_cont(*) 'Not found TIME_DT_RESUME_UNIT. TIME_DURATION_UNIT is used.'
558  time_dt_resume_unit = time_duration_unit
559  endif
560  endif
561 
562  !--- calculate time
563  if ( time_startdate(1) == -999 ) then
564  if ( restart_in_basename /= '' ) then ! read start time from the restart data
565  call file_get_attribute( restart_in_basename, & ! [IN]
566  "global", & ! [IN]
567  'time_start', & ! [IN]
568  cftime(:), & ! [OUT]
569  rankid = prc_myrank, & ! [IN]
570  single = .false. ) ! [IN]
571 
572  call file_get_attribute( restart_in_basename, & ! [IN]
573  "global", & ! [IN]
574  'time_units', & ! [IN]
575  cfunits, & ! [OUT]
576  rankid = prc_myrank, & ! [IN]
577  single = .false. ) ! [IN]
578 
579  dateday = 0
580  datesec = calendar_cfunits2sec( cftime(1), cfunits, 0 )
581 
582  call calendar_adjust_daysec( dateday, datesec )
583 
584  call calendar_daysec2date( time_startdate, & ! [OUT]
585  time_startsubsec, & ! [OUT]
586  dateday, & ! [IN]
587  datesec, & ! [IN]
588  0 ) ! [IN]
589  else
590  time_startdate = (/ 0, 1, 1, 0, 0, 0 /)
591  time_startsubsec = 0.0_dp
592  endif
593  else
594  time_startsubsec = time_startms * 1.e-3_dp
595  endif
596 
597  time_offset_year = time_startdate(1)
598 
599  call calendar_date2daysec( time_startday, & ! [OUT]
600  time_startsec, & ! [OUT]
601  time_startdate(:), & ! [IN]
602  time_startsubsec, & ! [IN]
603  time_offset_year ) ! [IN]
604 
605  call calendar_date2char( startchardate, & ! [OUT]
606  time_startdate(:), & ! [IN]
607  time_startsubsec ) ! [IN]
608 
609  time_startdaysec = calendar_combine_daysec( time_startday, time_startsec )
610 
611  time_nowdate(:) = time_startdate(:)
612  time_nowsubsec = time_startsubsec
613  time_nowday = time_startday
614  time_nowsec = time_startsec
616 
617  time_endday = time_startday
618 
619  if ( setup_timeintegration ) then
620  call calendar_unit2sec( time_durationsec, time_duration, time_duration_unit )
621  time_endsec = time_startsec + time_durationsec
622  else
623  time_endsec = time_startsec
624  endif
625 
626  call calendar_adjust_daysec( time_endday, time_endsec ) ! [INOUT]
627 
628  call calendar_daysec2date( time_enddate(:), & ! [OUT]
629  time_endsubsec, & ! [OUT]
630  time_endday, & ! [IN]
631  time_endsec, & ! [IN]
632  time_offset_year ) ! [IN]
633 
634  call calendar_date2char( endchardate, & ! [OUT]
635  time_enddate(:), & ! [IN]
636  time_endsubsec ) ! [IN]
637 
638  log_newline
639  log_info("ADMIN_TIME_setup",*) 'Global date / time setting '
640  log_info_cont('(1x,A,A)') 'START Date : ', startchardate
641  log_info_cont('(1x,A,A)') 'END Date : ', endchardate
642 
643  if ( setup_timeintegration ) then
644 
645  call calendar_unit2sec( time_dtsec, time_dt, time_dt_unit )
646 
647  time_nstep = int( time_durationsec / time_dtsec )
648  time_nowstep = 1
649 
650  log_info_cont('(1x,A,F12.3)') 'delta t (sec.) :', time_dtsec
651  log_info_cont('(1x,A,I12)' ) 'No. of steps :', time_nstep
652 
653  !--- calculate intervals for atmosphere
654  if ( time_dt_atmos_dyn /= undef8 ) then
655  call calendar_unit2sec( time_dtsec_atmos_dyn, time_dt_atmos_dyn, time_dt_atmos_dyn_unit )
656  else
658  endif
659  call calendar_unit2sec( time_dtsec_atmos_phy_cp, time_dt_atmos_phy_cp, time_dt_atmos_phy_cp_unit )
660  call calendar_unit2sec( time_dtsec_atmos_phy_mp, time_dt_atmos_phy_mp, time_dt_atmos_phy_mp_unit )
661  call calendar_unit2sec( time_dtsec_atmos_phy_rd, time_dt_atmos_phy_rd, time_dt_atmos_phy_rd_unit )
662  call calendar_unit2sec( time_dtsec_atmos_phy_sf, time_dt_atmos_phy_sf, time_dt_atmos_phy_sf_unit )
663  call calendar_unit2sec( time_dtsec_atmos_phy_tb, time_dt_atmos_phy_tb, time_dt_atmos_phy_tb_unit )
664  call calendar_unit2sec( time_dtsec_atmos_phy_bl, time_dt_atmos_phy_bl, time_dt_atmos_phy_bl_unit )
665  call calendar_unit2sec( time_dtsec_atmos_phy_ch, time_dt_atmos_phy_ch, time_dt_atmos_phy_ch_unit )
666  call calendar_unit2sec( time_dtsec_atmos_phy_ae, time_dt_atmos_phy_ae, time_dt_atmos_phy_ae_unit )
667  call calendar_unit2sec( time_dtsec_atmos_phy_lt, time_dt_atmos_phy_lt, time_dt_atmos_phy_lt_unit )
668  call calendar_unit2sec( time_dtsec_atmos_restart, time_dt_atmos_restart, time_dt_atmos_restart_unit )
669  call calendar_unit2sec( time_dtsec_ocean, time_dt_ocean, time_dt_ocean_unit )
670  call calendar_unit2sec( time_dtsec_ocean_restart, time_dt_ocean_restart, time_dt_ocean_restart_unit )
671  call calendar_unit2sec( time_dtsec_land, time_dt_land, time_dt_land_unit )
672  call calendar_unit2sec( time_dtsec_land_restart, time_dt_land_restart, time_dt_land_restart_unit )
673  call calendar_unit2sec( time_dtsec_urban, time_dt_urban, time_dt_urban_unit )
674  call calendar_unit2sec( time_dtsec_urban_restart, time_dt_urban_restart, time_dt_urban_restart_unit )
675  call calendar_unit2sec( time_dtsec_da, time_dt_da, time_dt_da_unit )
676  call calendar_unit2sec( time_dtsec_resume, time_dt_resume, time_dt_resume_unit )
677 
679  nstep_dyn = time_nstep_atmos_dyn
680 
700 
720 
721  time_res_atmos_dyn = 0
722  time_res_atmos_phy_cp = 0
723  time_res_atmos_phy_mp = 0
724  time_res_atmos_phy_rd = 0
725  time_res_atmos_phy_sf = 0
726  time_res_atmos_phy_tb = 0
727  time_res_atmos_phy_bl = 0
728  time_res_atmos_phy_ch = 0
729  time_res_atmos_phy_ae = 0
730  time_res_atmos_phy_lt = 0
731  time_res_atmos_restart = 0
732  time_res_ocean = 0
733  time_res_ocean_restart = 0
734  time_res_land = 0
735  time_res_land_restart = 0
736  time_res_urban = 0
737  time_res_urban_restart = 0
738  time_res_da = 0
739 
740  time_res_resume = time_dstep_resume - 1
741 
742  if ( abs( real(time_nstep_atmos_dyn,kind=dp)*time_dtsec_atmos_dyn &
743  - real(time_dstep_atmos_dyn,kind=dp)*time_dtsec ) > eps ) then
744  log_error("ADMIN_TIME_setup",*) 'delta t(ATMOS_DYN) must be a multiple of delta t ', &
746  call prc_abort
747  endif
748  if ( abs(time_dtsec_atmos_phy_cp-real(time_dstep_atmos_phy_cp,kind=dp)*time_dtsec) > eps ) then
749  log_error("ADMIN_TIME_setup",*) 'delta t(ATMOS_PHY_CP) must be a multiple of delta t ', &
751  call prc_abort
752  endif
753  if ( abs(time_dtsec_atmos_phy_mp-real(time_dstep_atmos_phy_mp,kind=dp)*time_dtsec) > eps ) then
754  log_error("ADMIN_TIME_setup",*) 'delta t(ATMOS_PHY_MP) must be a multiple of delta t ', &
756  call prc_abort
757  endif
758  if ( abs(time_dtsec_atmos_phy_rd-real(time_dstep_atmos_phy_rd,kind=dp)*time_dtsec) > eps ) then
759  log_error("ADMIN_TIME_setup",*) 'delta t(ATMOS_PHY_RD) must be a multiple of delta t ', &
761  call prc_abort
762  endif
763  if ( abs(time_dtsec_atmos_phy_sf-real(time_dstep_atmos_phy_sf,kind=dp)*time_dtsec) > eps ) then
764  log_error("ADMIN_TIME_setup",*) 'delta t(ATMOS_PHY_SF) must be a multiple of delta t ', &
766  call prc_abort
767  endif
768  if ( abs(time_dtsec_atmos_phy_tb-real(time_dstep_atmos_phy_tb,kind=dp)*time_dtsec) > eps ) then
769  log_error("ADMIN_TIME_setup",*) 'delta t(ATMOS_PHY_TB) must be a multiple of delta t ', &
771  call prc_abort
772  endif
773  if ( abs(time_dtsec_atmos_phy_bl-real(time_dstep_atmos_phy_bl,kind=dp)*time_dtsec) > eps ) then
774  log_error("ADMIN_TIME_setup",*) 'delta t(ATMOS_PHY_BL) must be a multiple of delta t ', &
776  call prc_abort
777  endif
778  if ( abs(time_dtsec_atmos_phy_ch-real(time_dstep_atmos_phy_ch,kind=dp)*time_dtsec) > eps ) then
779  log_error("ADMIN_TIME_setup",*) 'delta t(ATMOS_PHY_CH) must be a multiple of delta t ', &
781  call prc_abort
782  endif
783  if ( abs(time_dtsec_atmos_phy_ae-real(time_dstep_atmos_phy_ae,kind=dp)*time_dtsec) > eps ) then
784  log_error("ADMIN_TIME_setup",*) 'delta t(ATMOS_PHY_AE) must be a multiple of delta t ', &
786  call prc_abort
787  endif
788  if ( abs(time_dtsec_atmos_phy_lt-real(time_dstep_atmos_phy_lt,kind=dp)*time_dtsec) > eps ) then
789  log_error("ADMIN_TIME_setup",*) 'delta t(ATMOS_PHY_LT) must be a multiple of delta t ', &
791  call prc_abort
792  endif
793  if ( abs(time_dtsec_ocean-real(time_dstep_ocean,kind=dp)*time_dtsec) > eps ) then
794  log_error("ADMIN_TIME_setup",*) 'delta t(OCEAN) must be a multiple of delta t ', &
796  call prc_abort
797  endif
798  if ( abs(time_dtsec_land-real(time_dstep_land,kind=dp)*time_dtsec) > eps ) then
799  log_error("ADMIN_TIME_setup",*) 'delta t(LAND) must be a multiple of delta t ', &
801  call prc_abort
802  endif
803  if ( abs(time_dtsec_urban-real(time_dstep_urban,kind=dp)*time_dtsec) > eps ) then
804  log_error("ADMIN_TIME_setup",*) 'delta t(URBAN) must be a multiple of delta t ', &
806  call prc_abort
807  endif
808  if ( abs(time_dtsec_atmos_restart-real(time_dstep_atmos_restart,kind=dp)*time_dtsec) > eps ) then
809  log_error("ADMIN_TIME_setup",*) 'delta t(ATMOS_RESTART) must be a multiple of delta t ', &
811  call prc_abort
812  endif
813  if ( abs(time_dtsec_ocean_restart-real(time_dstep_ocean_restart,kind=dp)*time_dtsec) > eps ) then
814  log_error("ADMIN_TIME_setup",*) 'delta t(OCEAN_RESTART) must be a multiple of delta t ', &
816  call prc_abort
817  endif
818  if ( abs(time_dtsec_land_restart-real(time_dstep_land_restart,kind=dp)*time_dtsec) > eps ) then
819  log_error("ADMIN_TIME_setup",*) 'delta t(LAND_RESTART) must be a multiple of delta t ', &
821  call prc_abort
822  endif
823  if ( abs(time_dtsec_urban_restart-real(time_dstep_urban_restart,kind=dp)*time_dtsec) > eps ) then
824  log_error("ADMIN_TIME_setup",*) 'delta t(URBAN_RESTART) must be a multiple of delta t ', &
826  call prc_abort
827  endif
828  if ( abs(time_dtsec_urban_restart-real(time_dstep_urban_restart,kind=dp)*time_dtsec) > eps ) then
829  log_error("ADMIN_TIME_setup",*) 'delta t(URBAN_RESTART) must be a multiple of delta t ', &
831  call prc_abort
832  endif
833  if ( abs(time_dtsec_da-real(time_dstep_da,kind=dp)*time_dtsec) > eps ) then
834  log_error("ADMIN_TIME_setup",*) 'delta t(DA) must be a multiple of delta t ', &
836  call prc_abort
837  endif
838  if ( abs(time_dtsec_resume-real(time_dstep_resume,kind=dp)*time_dtsec) > eps ) then
839  log_error("ADMIN_TIME_setup",*) 'delta t(RESUME) must be a multiple of delta t ', &
841  call prc_abort
842  endif
843 
844  log_newline
845  log_info("ADMIN_TIME_setup",*) 'Time interval for each component (sec.)'
846  log_info_cont(*) 'Atmosphere'
847  log_info_cont('(1x,A,F10.3)') 'Dynamics (time) : ', time_dtsec_atmos_dyn
848  log_info_cont('(1x,A,I10,A,I8,A)') '(step) : ', time_nstep_atmos_dyn, &
849  ' (step interval=', time_dstep_atmos_dyn, ')'
850  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Physics, Cumulus : ', time_dtsec_atmos_phy_cp, &
851  ' (step interval=', time_dstep_atmos_phy_cp, ')'
852  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Physics, Cloud Microphysics : ', time_dtsec_atmos_phy_mp, &
853  ' (step interval=', time_dstep_atmos_phy_mp, ')'
854  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Physics, Radiation : ', time_dtsec_atmos_phy_rd, &
855  ' (step interval=', time_dstep_atmos_phy_rd, ')'
856  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Physics, Surface Flux : ', time_dtsec_atmos_phy_sf, &
857  ' (step interval=', time_dstep_atmos_phy_sf, ')'
858  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Physics, Turbulence : ', time_dtsec_atmos_phy_tb, &
859  ' (step interval=', time_dstep_atmos_phy_tb, ')'
860  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Physics, Boundary layer : ', time_dtsec_atmos_phy_bl, &
861  ' (step interval=', time_dstep_atmos_phy_bl, ')'
862  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Physics, Chemistry : ', time_dtsec_atmos_phy_ch, &
863  ' (step interval=', time_dstep_atmos_phy_ch, ')'
864  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Physics, Aerosol : ', time_dtsec_atmos_phy_ae, &
865  ' (step interval=', time_dstep_atmos_phy_ae, ')'
866  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Physics, Lightning : ', time_dtsec_atmos_phy_lt, &
867  ' (step interval=', time_dstep_atmos_phy_lt, ')'
868  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Ocean : ', time_dtsec_ocean, &
869  ' (step interval=', time_dstep_ocean, ')'
870  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Land : ', time_dtsec_land, &
871  ' (step interval=', time_dstep_land, ')'
872  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Urban : ', time_dtsec_urban, &
873  ' (step interval=', time_dstep_urban, ')'
874  log_newline
875  log_info_cont(*) 'Time interval for restart (sec.)'
876  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Atmospheric Variables : ', time_dtsec_atmos_restart, &
877  ' (step interval=', time_dstep_atmos_restart, ')'
878  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Ocean Variables : ', time_dtsec_ocean_restart, &
879  ' (step interval=', time_dstep_ocean_restart, ')'
880  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Land Variables : ', time_dtsec_land_restart, &
881  ' (step interval=', time_dstep_land_restart, ')'
882  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Urban Variables : ', time_dtsec_urban_restart, &
883  ' (step interval=', time_dstep_urban_restart, ')'
884  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Data Assimilation : ', time_dtsec_da, &
885  ' (step interval=', time_dstep_da, ')'
886  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Resume : ', time_dtsec_resume, &
887  ' (step interval=', time_dstep_resume, ')'
888  else
889  time_dtsec = 1.0_rp
890  endif
891 
892  time_wallclock_start = prc_mpitime()
893 
894  ! WALLCLOCK TERMINATOR SETUP
895  if ( time_wallclock_limit > 0.0_dp ) then
896  log_newline
897  log_info("ADMIN_TIME_setup",*) 'Wall clock time limit of execution is specified.'
898 
899  if ( time_dt_wallclock_check == undef8 ) then
900  log_info_cont(*) 'Not found TIME_DT_WALLCLOCK_CHECK. largest time step interval is used.'
912  time_dtsec_land, &
914  else
915  if ( time_dt_wallclock_check_unit == '' ) then
916  log_info_cont(*) 'Not found TIME_DT_WALLCLOCK_CHECK_UNIT. TIME_DURATION_UNIT is used.'
917  time_dt_wallclock_check_unit = time_duration_unit
918  endif
919  call calendar_unit2sec( time_dtsec_wallclock_check, time_dt_wallclock_check, time_dt_wallclock_check_unit )
921  endif
922 
924 
925  time_wallclock_safe = max( min( time_wallclock_safe, 1.0_dp ), 0.0_dp )
926  time_wallclock_safelim = time_wallclock_limit * time_wallclock_safe
927 
928  log_info_cont('(1x,A,F10.1,A)') 'This job stops after ', time_wallclock_safelim, ' seconds.'
929  log_info_cont('(1x,A,F10.3,A,I8,A)') 'Time interval for check : ', time_dtsec_wallclock_check, &
930  ' (step interval=', time_dstep_wallclock_check, ')'
931  endif
932 
933  if ( debug ) then
934  log_info("ADMIN_TIME_setup",*) time_nowday, time_nowsec, time_nowdate(:), time_nowsubsec
935  endif
936 
937  return
938  end subroutine admin_time_setup
939 
940  !-----------------------------------------------------------------------------
942  subroutine admin_time_checkstate
943  use scale_prc, only: &
946  use scale_calendar, only: &
948  use scale_time, only: &
949  time_nowdate, &
950  time_nowsubsec, &
951  time_nowstep, &
952  time_nstep, &
964  time_dstep_land, &
967  implicit none
968 
969  real(dp) :: wallclock_elapse
970  character(len=27) :: nowchardate
971  logical :: to_stdout
972  !---------------------------------------------------------------------------
973 
974  time_doatmos_step = .false.
975  time_doatmos_dyn = .false.
976  time_doatmos_phy_cp = .false.
977  time_doatmos_phy_mp = .false.
978  time_doatmos_phy_rd = .false.
979  time_doatmos_phy_sf = .false.
980  time_doatmos_phy_tb = .false.
981  time_doatmos_phy_bl = .false.
982  time_doatmos_phy_ch = .false.
983  time_doatmos_phy_ae = .false.
984  time_doatmos_phy_lt = .false.
985  time_doocean_step = .false.
986  time_doland_step = .false.
987  time_dourban_step = .false.
988  time_doda_step = .false.
989  time_doresume = .false.
990 
991  time_res_atmos_dyn = time_res_atmos_dyn + 1
992  time_res_atmos_phy_cp = time_res_atmos_phy_cp + 1
993  time_res_atmos_phy_mp = time_res_atmos_phy_mp + 1
994  time_res_atmos_phy_rd = time_res_atmos_phy_rd + 1
995  time_res_atmos_phy_sf = time_res_atmos_phy_sf + 1
996  time_res_atmos_phy_tb = time_res_atmos_phy_tb + 1
997  time_res_atmos_phy_bl = time_res_atmos_phy_bl + 1
998  time_res_atmos_phy_ch = time_res_atmos_phy_ch + 1
999  time_res_atmos_phy_ae = time_res_atmos_phy_ae + 1
1000  time_res_atmos_phy_lt = time_res_atmos_phy_lt + 1
1001  time_res_ocean = time_res_ocean + 1
1002  time_res_land = time_res_land + 1
1003  time_res_urban = time_res_urban + 1
1004  time_res_da = time_res_da + 1
1005  time_res_resume = time_res_resume + 1
1006 
1007  if ( time_res_atmos_dyn == time_dstep_atmos_dyn ) then
1008  time_doatmos_step = .true.
1009  time_doatmos_dyn = .true.
1010  time_res_atmos_dyn = 0
1011  endif
1012  if ( time_res_atmos_phy_cp == time_dstep_atmos_phy_cp ) then
1013  time_doatmos_step = .true.
1014  time_doatmos_phy_cp = .true.
1015  time_res_atmos_phy_cp = 0
1016  endif
1017  if ( time_res_atmos_phy_mp == time_dstep_atmos_phy_mp ) then
1018  time_doatmos_step = .true.
1019  time_doatmos_phy_mp = .true.
1020  time_res_atmos_phy_mp = 0
1021  endif
1022  if ( time_res_atmos_phy_rd == time_dstep_atmos_phy_rd ) then
1023  time_doatmos_step = .true.
1024  time_doatmos_phy_rd = .true.
1025  time_res_atmos_phy_rd = 0
1026  endif
1027  if ( time_res_atmos_phy_sf == time_dstep_atmos_phy_sf ) then
1028  time_doatmos_step = .true.
1029  time_doatmos_phy_sf = .true.
1030  time_res_atmos_phy_sf = 0
1031  endif
1032  if ( time_res_atmos_phy_tb == time_dstep_atmos_phy_tb ) then
1033  time_doatmos_step = .true.
1034  time_doatmos_phy_tb = .true.
1035  time_res_atmos_phy_tb = 0
1036  endif
1037  if ( time_res_atmos_phy_bl == time_dstep_atmos_phy_bl ) then
1038  time_doatmos_step = .true.
1039  time_doatmos_phy_bl = .true.
1040  time_res_atmos_phy_bl = 0
1041  endif
1042  if ( time_res_atmos_phy_ch == time_dstep_atmos_phy_ch ) then
1043  time_doatmos_step = .true.
1044  time_doatmos_phy_ch = .true.
1045  time_res_atmos_phy_ch = 0
1046  endif
1047  if ( time_res_atmos_phy_ae == time_dstep_atmos_phy_ae ) then
1048  time_doatmos_step = .true.
1049  time_doatmos_phy_ae = .true.
1050  time_res_atmos_phy_ae = 0
1051  endif
1052  if ( time_res_atmos_phy_lt == time_dstep_atmos_phy_lt ) then
1053  time_doatmos_step = .true.
1054  time_doatmos_phy_lt = .true.
1055  time_res_atmos_phy_lt = 0
1056  endif
1057 
1058  if ( time_res_ocean == time_dstep_ocean ) then
1059  time_doocean_step = .true.
1060  time_res_ocean = 0
1061  endif
1062  if ( time_res_land == time_dstep_land ) then
1063  time_doland_step = .true.
1064  time_res_land = 0
1065  endif
1066  if ( time_res_urban == time_dstep_urban ) then
1067  time_dourban_step = .true.
1068  time_res_urban = 0
1069  endif
1070  if ( time_res_da == time_dstep_da ) then
1071  time_doda_step = .true.
1072  time_res_da = 0
1073  endif
1074  if ( time_res_resume == time_dstep_resume ) then
1075  time_doresume = .true.
1076  time_res_resume = 0
1077  endif
1078 
1079  to_stdout = .false.
1080  if ( io_step_to_stdout > 0 ) then
1081  if( mod(time_nowstep-1,io_step_to_stdout) == 0 ) to_stdout = .true.
1082  endif
1083 
1084  call calendar_date2char( nowchardate, & ! [OUT]
1085  time_nowdate(:), & ! [IN]
1086  time_nowsubsec ) ! [IN]
1087 
1088  wallclock_elapse = prc_mpitime() - time_wallclock_start
1089 
1090  log_newline
1091  if ( time_wallclock_limit > 0.0_dp ) then
1092  log_progress('(1x,2A,2(A,I7),2(A,F10.1))') 'TIME: ', nowchardate,' STEP:',time_nowstep, '/', time_nstep, &
1093  ' WCLOCK:', wallclock_elapse, '/', time_wallclock_safelim
1094  if ( prc_universal_ismaster .AND. to_stdout ) then ! universal master node
1095  write(*,'(1x,2A,2(A,I7),2(A,F10.1))') 'TIME: ', nowchardate,' STEP:',time_nowstep, '/', time_nstep, &
1096  ' WCLOCK:', wallclock_elapse, '/', time_wallclock_safelim
1097  endif
1098  else
1099  log_progress('(1x,2A,2(A,I7),A,F10.1)') 'TIME: ', nowchardate,' STEP:',time_nowstep, '/', time_nstep, &
1100  ' WCLOCK:', wallclock_elapse
1101  if ( prc_universal_ismaster .AND. to_stdout ) then ! universal master node
1102  write(*,'(1x,2A,2(A,I7),A,F10.1)') 'TIME: ', nowchardate,' STEP:',time_nowstep, '/', time_nstep, &
1103  ' WCLOCK:', wallclock_elapse
1104  endif
1105  endif
1106 
1107  return
1108  end subroutine admin_time_checkstate
1109 
1110  !-----------------------------------------------------------------------------
1112  subroutine admin_time_advance
1113  use scale_prc, only: &
1114  prc_ismaster, &
1115  prc_mpitime
1116  use scale_calendar, only: &
1120  use scale_comm_cartesc, only: &
1121  comm_bcast
1122  use scale_time, only: &
1123  time_dtsec, &
1124  time_nowdate, &
1125  time_nowsubsec, &
1126  time_nowday, &
1127  time_nowsec, &
1128  time_nowdaysec, &
1129  time_nowstep, &
1130  time_nstep, &
1131  time_offset_year, &
1133  implicit none
1134 
1135  real(dp) :: wallclock_elapse
1136  logical :: wallclock_doend
1137  !---------------------------------------------------------------------------
1138 
1139  time_doend = .false.
1140 
1142  time_nowday = time_startday
1143  time_nowsec = time_startsec + real(time_nowstep-1,kind=dp) * time_dtsec
1144 
1145  ! reallocate day & sub-day
1147 
1148  call calendar_daysec2date( time_nowdate(:), & ! [OUT]
1149  time_nowsubsec, & ! [OUT]
1150  time_nowday, & ! [IN]
1151  time_nowsec, & ! [IN]
1152  time_offset_year ) ! [IN]
1153 
1155 
1156  if ( debug ) then
1157  log_info("ADMIN_TIME_advance",*) time_nowday, time_nowsec, time_nowdate(:), time_nowsubsec
1158  endif
1159 
1160  if ( time_nowstep > time_nstep ) then
1161  time_doend = .true.
1162  endif
1163 
1164  if ( time_wallclock_limit > 0.0_dp ) then ! use wallclock limiter
1165  wallclock_doend = .false.
1166 
1167  if ( prc_ismaster & ! master node
1168  .AND. mod(time_nowstep-1,time_dstep_wallclock_check) == 0 ) then ! step to check
1169 
1170  wallclock_elapse = prc_mpitime() - time_wallclock_start
1171 
1172  if( wallclock_elapse > time_wallclock_safelim ) wallclock_doend = .true.
1173 
1174  endif
1175 
1176  call comm_bcast( wallclock_doend ) ! [INOUT]
1177 
1178  if ( wallclock_doend ) then
1179  log_newline
1180  log_info("ADMIN_TIME_advance",*) '**************************************************************'
1181  log_info("ADMIN_TIME_advance",*) 'Elapse time limit is detected. Termination operation starts. '
1182  log_info("ADMIN_TIME_advance",*) '**************************************************************'
1183  log_newline
1184  time_doend = .true.
1185  endif
1186  endif
1187 
1188  time_doatmos_restart = .false.
1189  time_doocean_restart = .false.
1190  time_doland_restart = .false.
1191  time_dourban_restart = .false.
1192 
1193  time_res_atmos_restart = time_res_atmos_restart + 1
1194  time_res_ocean_restart = time_res_ocean_restart + 1
1195  time_res_land_restart = time_res_land_restart + 1
1196  time_res_urban_restart = time_res_urban_restart + 1
1197 
1198  if ( time_res_atmos_restart == time_dstep_atmos_restart ) then
1199  time_doatmos_restart = .true.
1200  time_res_atmos_restart = 0
1201  elseif( time_doend ) then
1202  time_doatmos_restart = .true.
1203  endif
1204 
1205  if ( time_res_ocean_restart == time_dstep_ocean_restart ) then
1206  time_doocean_restart = .true.
1207  time_res_ocean_restart = 0
1208  elseif( time_doend ) then
1209  time_doocean_restart = .true.
1210  endif
1211 
1212  if ( time_res_land_restart == time_dstep_land_restart ) then
1213  time_doland_restart = .true.
1214  time_res_land_restart = 0
1215  elseif( time_doend ) then
1216  time_doland_restart = .true.
1217  endif
1218 
1219  if ( time_res_urban_restart == time_dstep_urban_restart ) then
1220  time_dourban_restart = .true.
1221  time_res_urban_restart = 0
1222  elseif( time_doend ) then
1223  time_dourban_restart = .true.
1224  endif
1225 
1226  return
1227  end subroutine admin_time_advance
1228 
1229 end module mod_admin_time
mod_admin_time::time_doatmos_phy_mp
logical, public time_doatmos_phy_mp
execute physics in this step? (microphysics)
Definition: mod_admin_time.F90:49
scale_prc::prc_universal_ismaster
logical, public prc_universal_ismaster
master process in universal communicator?
Definition: scale_prc.F90:75
scale_time::time_dtsec_atmos_phy_tb
real(dp), public time_dtsec_atmos_phy_tb
time interval of physics(turbulence ) [sec]
Definition: scale_time.F90:41
scale_time::time_nowdaysec
real(dp), public time_nowdaysec
second of current time [sec]
Definition: scale_time.F90:72
mod_admin_time::time_dstep_land_restart
integer, public time_dstep_land_restart
interval of land restart [step]
Definition: mod_admin_time.F90:42
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:350
mod_admin_time::time_dstep_ocean_restart
integer, public time_dstep_ocean_restart
interval of ocean restart [step]
Definition: mod_admin_time.F90:41
mod_admin_time::time_doatmos_phy_ch
logical, public time_doatmos_phy_ch
execute physics in this step? (chemistry )
Definition: mod_admin_time.F90:54
mod_admin_time::time_dstep_resume
integer, public time_dstep_resume
interval for resume [step]
Definition: mod_admin_time.F90:44
scale_calendar::calendar_daysec2date
subroutine, public calendar_daysec2date(ymdhms, subsec, absday, abssec, offset_year)
Convert from gregorian date to absolute day/second.
Definition: scale_calendar.F90:255
scale_time::time_dstep_atmos_phy_cp
integer, public time_dstep_atmos_phy_cp
step interval of physics(cumulus )
Definition: scale_time.F90:53
mod_admin_time::time_dourban_restart
logical, public time_dourban_restart
execute urban restart output in this step?
Definition: mod_admin_time.F90:63
scale_calendar::calendar_combine_daysec
real(dp) function, public calendar_combine_daysec(absday, abssec)
Combine day and second.
Definition: scale_calendar.F90:467
scale_const::const_undef8
real(dp), parameter, public const_undef8
undefined value (REAL8)
Definition: scale_const.F90:42
scale_precision
module PRECISION
Definition: scale_precision.F90:14
scale_time::time_dstep_atmos_phy_ae
integer, public time_dstep_atmos_phy_ae
step interval of physics(aerosol )
Definition: scale_time.F90:60
scale_time::time_dstep_ocean
integer, public time_dstep_ocean
step interval of ocean step
Definition: scale_time.F90:62
scale_time::time_dtsec_atmos_phy_mp
real(dp), public time_dtsec_atmos_phy_mp
time interval of physics(microphysics) [sec]
Definition: scale_time.F90:38
mod_admin_time::time_doland_step
logical, public time_doland_step
execute land component in this step?
Definition: mod_admin_time.F90:60
scale_time::time_dtsec_atmos_phy_bl
real(dp), public time_dtsec_atmos_phy_bl
time interval of physics(pbl ) [sec]
Definition: scale_time.F90:42
mod_admin_time::time_dstep_urban_restart
integer, public time_dstep_urban_restart
interval of urban restart [step]
Definition: mod_admin_time.F90:43
mod_admin_time::time_doatmos_dyn
logical, public time_doatmos_dyn
execute dynamics in this step?
Definition: mod_admin_time.F90:47
scale_time::time_dstep_atmos_phy_tb
integer, public time_dstep_atmos_phy_tb
step interval of physics(turbulence )
Definition: scale_time.F90:57
scale_time::time_nowsubsec
real(dp), public time_nowsubsec
subsecond part of current time [sec]
Definition: scale_time.F90:71
scale_time::time_dstep_atmos_phy_lt
integer, public time_dstep_atmos_phy_lt
step interval of physics(lightning )
Definition: scale_time.F90:61
mod_admin_time::time_doatmos_phy_tb
logical, public time_doatmos_phy_tb
execute physics in this step? (turbulence )
Definition: mod_admin_time.F90:52
scale_prc::prc_myrank
integer, public prc_myrank
process num in local communicator
Definition: scale_prc.F90:91
scale_io::io_step_to_stdout
integer, public io_step_to_stdout
interval for output current step to STDOUT (negative is off)
Definition: scale_io.F90:68
scale_time::time_dtsec_atmos_phy_ch
real(dp), public time_dtsec_atmos_phy_ch
time interval of physics(chemistry ) [sec]
Definition: scale_time.F90:43
scale_calendar
module CALENDAR
Definition: scale_calendar.F90:13
mod_admin_time::admin_time_setup
subroutine, public admin_time_setup(setup_TimeIntegration)
Setup.
Definition: mod_admin_time.F90:122
mod_admin_time::time_doatmos_phy_cp
logical, public time_doatmos_phy_cp
execute physics in this step? (cumulus )
Definition: mod_admin_time.F90:48
mod_admin_time::time_doatmos_phy_ae
logical, public time_doatmos_phy_ae
execute physics in this step? (aerosol )
Definition: mod_admin_time.F90:55
scale_file
module file
Definition: scale_file.F90:15
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_time::time_dtsec_atmos_phy_cp
real(dp), public time_dtsec_atmos_phy_cp
time interval of physics(cumulus ) [sec]
Definition: scale_time.F90:37
scale_time::time_nowsec
real(dp), public time_nowsec
subday part of current time [sec]
Definition: scale_time.F90:70
scale_time::time_dtsec_atmos_phy_rd
real(dp), public time_dtsec_atmos_phy_rd
time interval of physics(radiation ) [sec]
Definition: scale_time.F90:39
mod_admin_time::time_doatmos_phy_sf
logical, public time_doatmos_phy_sf
execute physics in this step? (surface flux)
Definition: mod_admin_time.F90:51
scale_time::time_dstep_wallclock_check
integer, public time_dstep_wallclock_check
step interval of wallclock terminator
Definition: scale_time.F90:66
scale_io
module STDIO
Definition: scale_io.F90:10
scale_const
module CONSTANT
Definition: scale_const.F90:11
scale_time::time_dtsec_da
real(dp), public time_dtsec_da
time interval of data-assim. step [sec]
Definition: scale_time.F90:49
scale_time::time_dtsec_atmos_phy_sf
real(dp), public time_dtsec_atmos_phy_sf
time interval of physics(surface flux) [sec]
Definition: scale_time.F90:40
mod_admin_time::time_doend
logical, public time_doend
finish program in this step?
Definition: mod_admin_time.F90:66
scale_time::time_dtsec_wallclock_check
real(dp), public time_dtsec_wallclock_check
time interval of wallclock terminator [sec]
Definition: scale_time.F90:50
mod_admin_time::time_doatmos_phy_rd
logical, public time_doatmos_phy_rd
execute physics in this step? (radiation )
Definition: mod_admin_time.F90:50
mod_admin_time::time_doocean_restart
logical, public time_doocean_restart
execute ocean restart output in this step?
Definition: mod_admin_time.F90:59
scale_calendar::calendar_date2daysec
subroutine, public calendar_date2daysec(absday, abssec, ymdhms, subsec, offset_year)
Convert from gregorian date to absolute day/second.
Definition: scale_calendar.F90:192
mod_admin_time::time_doatmos_step
logical, public time_doatmos_step
execute atmosphere component in this step?
Definition: mod_admin_time.F90:46
scale_time::time_nowstep
integer, public time_nowstep
current step [number]
Definition: scale_time.F90:73
scale_prof
module profiler
Definition: scale_prof.F90:11
scale_calendar::calendar_adjust_daysec
subroutine, public calendar_adjust_daysec(absday, abssec)
Adjust day and second.
Definition: scale_calendar.F90:442
scale_time::time_dtsec_ocean
real(dp), public time_dtsec_ocean
time interval of ocean step [sec]
Definition: scale_time.F90:46
scale_precision::dp
integer, parameter, public dp
Definition: scale_precision.F90:32
scale_time::time_dtsec_atmos_dyn
real(dp), public time_dtsec_atmos_dyn
time interval of dynamics [sec]
Definition: scale_time.F90:35
scale_time
module TIME
Definition: scale_time.F90:11
scale_calendar::calendar_cfunits2sec
real(dp) function, public calendar_cfunits2sec(cftime, cfunits, offset_year, startdaysec)
Convert time in units of the CF convention to second.
Definition: scale_calendar.F90:550
mod_admin_time::admin_time_advance
subroutine, public admin_time_advance
Advance the time & evaluate restart & stop.
Definition: mod_admin_time.F90:1113
mod_admin_time::time_doresume
logical, public time_doresume
resume in this step?
Definition: mod_admin_time.F90:65
mod_admin_time::time_doatmos_restart
logical, public time_doatmos_restart
execute atmosphere restart output in this step?
Definition: mod_admin_time.F90:57
scale_time::time_dtsec_atmos_phy_ae
real(dp), public time_dtsec_atmos_phy_ae
time interval of physics(aerosol ) [sec]
Definition: scale_time.F90:44
mod_admin_time::admin_time_checkstate
subroutine, public admin_time_checkstate
Evaluate component execution.
Definition: mod_admin_time.F90:943
scale_time::time_dtsec_urban
real(dp), public time_dtsec_urban
time interval of urban step [sec]
Definition: scale_time.F90:48
scale_time::time_dstep_atmos_phy_bl
integer, public time_dstep_atmos_phy_bl
step interval of physics(pbl )
Definition: scale_time.F90:58
scale_time::time_dstep_da
integer, public time_dstep_da
step interval of data-assim. step
Definition: scale_time.F90:65
mod_admin_time::time_dtsec_atmos_restart
real(dp), public time_dtsec_atmos_restart
time interval of atmosphere restart [sec]
Definition: mod_admin_time.F90:34
mod_admin_time
module ADMIN TIME
Definition: mod_admin_time.F90:11
mod_admin_time::time_dtsec_resume
real(dp), public time_dtsec_resume
time interval for resume [sec]
Definition: mod_admin_time.F90:38
scale_time::time_dstep_atmos_phy_rd
integer, public time_dstep_atmos_phy_rd
step interval of physics(radiation )
Definition: scale_time.F90:55
scale_time::time_dtsec
real(dp), public time_dtsec
time interval of model [sec]
Definition: scale_time.F90:33
scale_comm_cartesc
module COMMUNICATION
Definition: scale_comm_cartesC.F90:11
scale_time::time_dstep_atmos_dyn
integer, public time_dstep_atmos_dyn
step interval of dynamics
Definition: scale_time.F90:52
mod_atmos_vars
module ATMOSPHERIC Variables
Definition: mod_atmos_vars.F90:12
scale_time::time_dstep_atmos_phy_sf
integer, public time_dstep_atmos_phy_sf
step interval of physics(surface flux)
Definition: scale_time.F90:56
scale_time::time_nowdate
integer, dimension(6), public time_nowdate
current time [YYYY MM DD HH MM SS]
Definition: scale_time.F90:68
scale_time::time_dtsec_land
real(dp), public time_dtsec_land
time interval of land step [sec]
Definition: scale_time.F90:47
scale_time::time_dstep_land
integer, public time_dstep_land
step interval of land step
Definition: scale_time.F90:63
mod_admin_time::time_dtsec_ocean_restart
real(dp), public time_dtsec_ocean_restart
time interval of ocean restart [sec]
Definition: mod_admin_time.F90:35
mod_admin_time::time_dtsec_land_restart
real(dp), public time_dtsec_land_restart
time interval of land restart [sec]
Definition: mod_admin_time.F90:36
mod_admin_time::time_doatmos_phy_bl
logical, public time_doatmos_phy_bl
execute physics in this step? (boudary layer )
Definition: mod_admin_time.F90:53
mod_admin_time::time_doland_restart
logical, public time_doland_restart
execute land restart output in this step?
Definition: mod_admin_time.F90:61
mod_admin_time::time_doatmos_phy_lt
logical, public time_doatmos_phy_lt
execute physics in this step? (lightning )
Definition: mod_admin_time.F90:56
scale_time::time_nstep_atmos_dyn
integer, public time_nstep_atmos_dyn
small step of dynamics
Definition: scale_time.F90:36
mod_admin_time::time_dtsec_urban_restart
real(dp), public time_dtsec_urban_restart
time interval of urban restart [sec]
Definition: mod_admin_time.F90:37
mod_admin_time::time_dourban_step
logical, public time_dourban_step
execute urban component in this step?
Definition: mod_admin_time.F90:62
scale_time::time_dtsec_atmos_phy_lt
real(dp), public time_dtsec_atmos_phy_lt
time interval of physics(lightning ) [sec]
Definition: scale_time.F90:45
scale_time::time_nstep
integer, public time_nstep
total steps [number]
Definition: scale_time.F90:74
scale_prc::prc_mpitime
real(dp) function, public prc_mpitime()
Get MPI time.
Definition: scale_prc.F90:843
mod_admin_time::time_dstep_atmos_restart
integer, public time_dstep_atmos_restart
interval of atmosphere restart [step]
Definition: mod_admin_time.F90:40
scale_time::time_dstep_atmos_phy_ch
integer, public time_dstep_atmos_phy_ch
step interval of physics(chemistry )
Definition: scale_time.F90:59
mod_admin_time::time_doda_step
logical, public time_doda_step
execute DA component in this step?
Definition: mod_admin_time.F90:64
mod_admin_time::time_doocean_step
logical, public time_doocean_step
execute ocean component in this step?
Definition: mod_admin_time.F90:58
scale_time::time_dstep_atmos_phy_mp
integer, public time_dstep_atmos_phy_mp
step interval of physics(microphysics)
Definition: scale_time.F90:54
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:57
scale_time::time_startdaysec
real(dp), public time_startdaysec
second of start time [sec]
Definition: scale_time.F90:77
mod_atmos_vars::atmos_restart_in_basename
character(len=h_long), public atmos_restart_in_basename
Basename of the input file.
Definition: mod_atmos_vars.F90:62
scale_time::time_offset_year
integer, public time_offset_year
time offset [year]
Definition: scale_time.F90:76
scale_prc::prc_ismaster
logical, public prc_ismaster
master process in local communicator?
Definition: scale_prc.F90:92
scale_time::time_nowday
integer, public time_nowday
absolute day of current time [day]
Definition: scale_time.F90:69
scale_calendar::calendar_date2char
subroutine, public calendar_date2char(chardate, ymdhms, subsec)
Convert from gregorian date to absolute day/second.
Definition: scale_calendar.F90:665
scale_calendar::calendar_unit2sec
subroutine, public calendar_unit2sec(second, value, unit)
Convert several units to second.
Definition: scale_calendar.F90:486
scale_time::time_dstep_urban
integer, public time_dstep_urban
step interval of urban step
Definition: scale_time.F90:64