Changeset 10005 for branches/UKMO/dev_r5518_GO6_package_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90
- Timestamp:
- 2018-07-26T13:07:55+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/dev_r5518_GO6_package_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90
r9321 r10005 95 95 nday = ndastp - (nyear * 10000) - ( nmonth * 100 ) 96 96 97 CALL ymds2ju( nyear, nmonth, nday, 0.0, fjulday ) ! we assume that we start run at 00:00 97 nhour = nn_time0 / 100 98 nminute = ( nn_time0 - nhour * 100 ) 99 100 CALL ymds2ju( nyear, nmonth, nday, nhour*3600._wp+nminute*60._wp, fjulday ) 98 101 IF( ABS(fjulday - REAL(NINT(fjulday),wp)) < 0.1 / rday ) fjulday = REAL(NINT(fjulday),wp) ! avoid truncation error 99 fjulday = fjulday + 1.! move back to the day at nit000 (and not at nit000 - 1)102 IF( nn_time0*3600 - ndt05 .lt. 0 ) fjulday = fjulday + 1. ! move back to the day at nit000 (and not at nit000 - 1) 100 103 101 104 nsec1jan000 = 0 … … 118 121 !compute number of days between last monday and today 119 122 CALL ymds2ju( 1900, 01, 01, 0.0, zjul ) ! compute julian day value of 01.01.1900 (our reference that was a Monday) 120 inbday = NINT(fjulday - zjul) ! compute nb day between 01.01.1900 andcurrent day123 inbday = FLOOR(fjulday - zjul) ! compute nb day between 01.01.1900 and start of current day 121 124 idweek = MOD(inbday, 7) ! compute nb day between last monday and current day 125 IF (idweek .lt. 0) idweek=idweek+7 ! Avoid negative values for dates before 01.01.1900 122 126 123 127 ! number of seconds since the beginning of current year/month/week/day at the middle of the time-step 124 nsec_year = nday_year * nsecd - ndt05 ! 1 time step before the middle of the first time step 125 nsec_month = nday * nsecd - ndt05 ! because day will be called at the beginning of step 126 nsec_week = idweek * nsecd - ndt05 127 nsec_day = nsecd - ndt05 128 IF (nhour*3600+nminute*60-ndt05 .gt. 0) THEN 129 ! 1 timestep before current middle of first time step is still the same day 130 nsec_year = (nday_year-1) * nsecd + nhour*3600+nminute*60 - ndt05 131 nsec_month = (nday-1) * nsecd + nhour*3600+nminute*60 - ndt05 132 ELSE 133 ! 1 time step before the middle of the first time step is the previous day 134 nsec_year = nday_year * nsecd + nhour*3600+nminute*60 - ndt05 135 nsec_month = nday * nsecd + nhour*3600+nminute*60 - ndt05 136 ENDIF 137 nsec_week = idweek * nsecd + nhour*3600+nminute*60 - ndt05 138 nsec_day = nhour*3600+nminute*60 - ndt05 139 IF( nsec_day .lt. 0 ) nsec_day = nsec_day + nsecd 140 IF( nsec_week .lt. 0 ) nsec_week = nsec_week + nsecd*7 128 141 129 142 ! control print 130 IF(lwp) WRITE(numout,'(a,i6,a,i2,a,i2,a,i8,a,i8)')' =======>> 1/2 time step before the start of the run DATE Y/M/D = ', & 131 & nyear, '/', nmonth, '/', nday, ' nsec_day:', nsec_day, ' nsec_week:', nsec_week 143 IF(lwp) WRITE(numout,'(a,i6,a,i2,a,i2,a,i8,a,i8,a,i8,a,i8)')' =======>> 1/2 time step before the start of the run DATE Y/M/D = ', & 144 & nyear, '/', nmonth, '/', nday, ' nsec_day:', nsec_day, ' nsec_week:', nsec_week, ' & 145 & nsec_month:', nsec_month , ' nsec_year:' , nsec_year 132 146 133 147 ! Up to now, calendar parameters are related to the end of previous run (nit000-1) … … 302 316 CHARACTER(len=*), INTENT(in) :: cdrw ! "READ"/"WRITE" flag 303 317 ! 304 REAL(wp) :: zkt, zndastp 318 REAL(wp) :: zkt, zndastp, zdayfrac, ksecs, ktime 319 INTEGER :: ihour, iminute 305 320 !!---------------------------------------------------------------------- 306 321 … … 334 349 ndastp = NINT( zndastp ) 335 350 CALL iom_get( numror, 'adatrj', adatrj ) 351 CALL iom_get( numror, 'ntime', ktime ) 336 352 IF(nn_timing == 2) CALL timing_stop('iom_rstget') 353 nn_time0=INT(ktime) 354 ! calculate start time in hours and minutes 355 zdayfrac=adatrj-INT(adatrj) 356 ksecs = NINT(zdayfrac*86400) ! Nearest second to catch rounding errors in adatrj 357 ihour = INT(ksecs/3600) 358 iminute = ksecs/60-ihour*60 359 360 ! Add to nn_time0 361 nhour = nn_time0 / 100 362 nminute = ( nn_time0 - nhour * 100 ) 363 nminute=nminute+iminute 364 365 IF( nminute >= 60 ) THEN 366 nminute=nminute-60 367 nhour=nhour+1 368 ENDIF 369 nhour=nhour+ihour 370 IF( nhour >= 24 ) THEN 371 nhour=nhour-24 372 adatrj=adatrj+1 373 ENDIF 374 nn_time0 = nhour * 100 + nminute 375 adatrj = INT(adatrj) ! adatrj set to integer as nn_time0 updated 337 376 ELSE 338 ! parameters correspondting to nit000 - 1 (as we start the step loop with a call to day) 339 ndastp = ndate0 - 1 ! ndate0 read in the namelist in dom_nam, we assume that we start run at 00:00 377 ! parameters corresponding to nit000 - 1 (as we start the step loop with a call to day) 378 ndastp = ndate0 ! ndate0 read in the namelist in dom_nam 379 nhour = nn_time0 / 100 380 nminute = ( nn_time0 - nhour * 100 ) 381 IF( nhour*3600+nminute*60-ndt05 .lt. 0 ) ndastp=ndastp-1 ! Start hour is specified in the namelist (default 0) 340 382 adatrj = ( REAL( nit000-1, wp ) * rdttra(1) ) / rday 341 383 ! note this is wrong if time step has changed during run 342 384 ENDIF 343 385 ELSE 344 ! parameters correspondting to nit000 - 1 (as we start the step loop with a call to day) 345 ndastp = ndate0 - 1 ! ndate0 read in the namelist in dom_nam, we assume that we start run at 00:00 386 ! parameters corresponding to nit000 - 1 (as we start the step loop with a call to day) 387 ndastp = ndate0 ! ndate0 read in the namelist in dom_nam 388 nhour = nn_time0 / 100 389 nminute = ( nn_time0 - nhour * 100 ) 390 IF( nhour*3600+nminute*60-ndt05 .lt. 0 ) ndastp=ndastp-1 ! Start hour is specified in the namelist (default 0) 346 391 adatrj = ( REAL( nit000-1, wp ) * rdttra(1) ) / rday 347 392 ENDIF … … 352 397 WRITE(numout,*) ' date ndastp : ', ndastp 353 398 WRITE(numout,*) ' number of elapsed days since the begining of run : ', adatrj 399 WRITE(numout,*) ' nn_time0 : ',nn_time0 354 400 WRITE(numout,*) 355 401 ENDIF … … 368 414 CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj ) ! number of elapsed days since 369 415 ! ! the begining of the run [s] 416 CALL iom_rstput( kt, nitrst, numrow, 'ntime' , REAL( nn_time0, wp) ) ! time 370 417 IF(nn_timing == 2) CALL timing_stop('iom_rstput') 371 418 ENDIF
Note: See TracChangeset
for help on using the changeset viewer.