New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 4772 for branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90 – NEMO

Ignore:
Timestamp:
2014-09-17T19:19:59+02:00 (10 years ago)
Author:
djlea
Message:

Changes to allow hour start time. First version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90

    r4162 r4772  
    8484      IF( .NOT. lk_offline ) CALL day_rst( nit000, 'READ' ) 
    8585 
     86      ! If we are starting at 00Z then need to wind back to previous day for calendar initialisation  
     87      IF( nn_time0 .eq. 0 ) ndastp = ndastp - 1  
     88 
    8689      ! set the calandar from ndastp (read in restart file and namelist) 
    8790 
     
    9093      nday    =   ndastp - (nyear * 10000) - ( nmonth * 100 ) 
    9194 
    92       CALL ymds2ju( nyear, nmonth, nday, 0.0, fjulday )  ! we assume that we start run at 00:00 
     95      CALL ymds2ju( nyear, nmonth, nday, nn_time0*3600._wp, fjulday )  ! we assume that we start run at 00:00 
    9396      IF( ABS(fjulday - REAL(NINT(fjulday),wp)) < 0.1 / rday )   fjulday = REAL(NINT(fjulday),wp)   ! avoid truncation error 
    94       fjulday = fjulday + 1.                             ! move back to the day at nit000 (and not at nit000 - 1) 
     97      IF( nn_time0 == 0 ) fjulday = fjulday + 1.                       ! move back to the day at nit000 (and not at nit000 - 1) 
    9598 
    9699      nsec1jan000 = 0 
     
    117120 
    118121      ! number of seconds since the beginning of current year/month/week/day at the middle of the time-step 
    119       nsec_year  = nday_year * nsecd - ndt05   ! 1 time step before the middle of the first time step 
    120       nsec_month = nday      * nsecd - ndt05   ! because day will be called at the beginning of step 
    121       nsec_week  = idweek    * nsecd - ndt05 
    122       nsec_day   =             nsecd - ndt05 
    123  
     122      nsec_year  = nday_year * nsecd + nn_time0*3600._wp - ndt05   ! 1 time step before the middle of the first time step 
     123      nsec_month = nday      * nsecd + nn_time0*3600._wp - ndt05   ! because day will be called at the beginning of step 
     124      nsec_week  = idweek    * nsecd + nn_time0*3600._wp - ndt05 
     125      nsec_day   =             nsecd + nn_time0*3600._wp - ndt05 
     126      IF( nsec_day .lt. 0 ) nsec_day = nsec_day + nsecd 
     127       
    124128      ! control print 
    125129      IF(lwp) WRITE(numout,'(a,i6,a,i2,a,i2,a,i6)')' ==============>> 1/2 time step before the start of the run DATE Y/M/D = ',   & 
     
    327331            ! define ndastp and adatrj 
    328332            IF ( nrstdt == 2 ) THEN 
    329                ! read the parameters correspondting to nit000 - 1 (last time step of previous run) 
     333               ! read the parameters corresponding to nit000 - 1 (last time step of previous run) 
    330334               CALL iom_get( numror, 'ndastp', zndastp ) 
    331335               ndastp = NINT( zndastp ) 
    332336               CALL iom_get( numror, 'adatrj', adatrj  ) 
    333337            ELSE 
    334                ! parameters correspondting to nit000 - 1 (as we start the step loop with a call to day) 
    335                ndastp = ndate0 - 1     ! ndate0 read in the namelist in dom_nam, we assume that we start run at 00:00 
     338               ! parameters corresponding to nit000 - 1 (as we start the step loop with a call to day) 
     339               ndastp = ndate0        ! ndate0 read in the namelist in dom_nam 
    336340               adatrj = ( REAL( nit000-1, wp ) * rdttra(1) ) / rday 
    337341               ! note this is wrong if time step has changed during run 
    338342            ENDIF 
    339343         ELSE 
    340             ! parameters correspondting to nit000 - 1 (as we start the step loop with a call to day) 
    341             ndastp = ndate0 - 1        ! ndate0 read in the namelist in dom_nam, we assume that we start run at 00:00 
     344            ! parameters corresponding to nit000 - 1 (as we start the step loop with a call to day) 
     345            ndastp = ndate0           ! ndate0 read in the namelist in dom_nam 
    342346            adatrj = ( REAL( nit000-1, wp ) * rdttra(1) ) / rday 
    343347         ENDIF 
Note: See TracChangeset for help on using the changeset viewer.