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/ASM/asminc.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/ASM/asminc.F90

    r4624 r4772  
    1717   !!---------------------------------------------------------------------- 
    1818   !!   asm_inc_init   : Initialize the increment arrays and IAU weights 
    19    !!   calc_date      : Compute the calendar date YYYYMMDD on a given step 
     19   !!   calc_date      : Compute the calendar date YYYYMMDDHH on a given step 
    2020   !!   tra_asm_inc    : Apply the tracer (T and S) increments 
    2121   !!   dyn_asm_inc    : Apply the dynamic (u and v) increments 
     
    4545    
    4646   PUBLIC   asm_inc_init   !: Initialize the increment arrays and IAU weights 
    47    PUBLIC   calc_date      !: Compute the calendar date YYYYMMDD on a given step 
     47   PUBLIC   calc_date      !: Compute the calendar date YYYYMMDDHH on a given step 
    4848   PUBLIC   tra_asm_inc    !: Apply the tracer (T and S) increments 
    4949   PUBLIC   dyn_asm_inc    !: Apply the dynamic (u and v) increments 
     
    115115      INTEGER :: iiauper         ! Number of time steps in the IAU period 
    116116      INTEGER :: icycper         ! Number of time steps in the cycle 
    117       INTEGER :: iitend_date     ! Date YYYYMMDD of final time step 
    118       INTEGER :: iitbkg_date     ! Date YYYYMMDD of background time step for Jb term 
    119       INTEGER :: iitdin_date     ! Date YYYYMMDD of background time step for DI 
    120       INTEGER :: iitiaustr_date  ! Date YYYYMMDD of IAU interval start time step 
    121       INTEGER :: iitiaufin_date  ! Date YYYYMMDD of IAU interval final time step 
     117      INTEGER :: iitend_date     ! Date YYYYMMDDHH of final time step 
     118      INTEGER :: iitbkg_date     ! Date YYYYMMDDHH of background time step for Jb term 
     119      INTEGER :: iitdin_date     ! Date YYYYMMDDHH of background time step for DI 
     120      INTEGER :: iitiaustr_date  ! Date YYYYMMDDHH of IAU interval start time step 
     121      INTEGER :: iitiaufin_date  ! Date YYYYMMDDHH of IAU interval final time step 
    122122      INTEGER :: ios             ! Local integer output status for namelist read 
    123123 
     
    556556      !!                    ***  ROUTINE calc_date  *** 
    557557      !!           
    558       !! ** Purpose : Compute the calendar date YYYYMMDD at a given time step. 
    559       !! 
    560       !! ** Method  : Compute the calendar date YYYYMMDD at a given time step. 
     558      !! ** Purpose : Compute the calendar date YYYYMMDDHH at a given time step. 
     559      !! 
     560      !! ** Method  : Compute the calendar date YYYYMMDDHH at a given time step. 
    561561      !! 
    562562      !! ** Action  :  
     
    570570      INTEGER :: imon0    ! Initial month 
    571571      INTEGER :: iday0    ! Initial day 
     572      INTEGER :: ihou0    ! Initial hour 
    572573      INTEGER :: iyea     ! Current year 
    573574      INTEGER :: imon     ! Current month 
    574575      INTEGER :: iday     ! Current day 
     576      INTEGER :: ihou     ! Current hour 
    575577      INTEGER :: idaystp  ! Number of days between initial and current date 
     578      INTEGER :: ihoustp  ! Number of hours 
    576579      INTEGER :: idaycnt  ! Day counter 
    577580 
     
    579582 
    580583      !----------------------------------------------------------------------- 
    581       ! Compute the calendar date YYYYMMDD 
     584      ! Compute the calendar date YYYYMMDDHH 
    582585      !----------------------------------------------------------------------- 
    583586 
     
    585588      iyea0 =   kdate0 / 10000 
    586589      imon0 = ( kdate0 - ( iyea0 * 10000 ) ) / 100 
    587       iday0 =   kdate0 - ( iyea0 * 10000 ) - ( imon0 * 100 )  
     590      iday0 =   kdate0 - ( iyea0 * 10000 ) - ( imon0 * 100 ) 
     591      ihou0 = nn_time0  
    588592 
    589593      ! Check that kt >= kit000 - 1 
    590594      IF ( kt < kit000 - 1 ) CALL ctl_stop( ' kt must be >= kit000 - 1') 
    591595 
    592       ! If kt = kit000 - 1 then set the date to the restart date 
    593       IF ( kt == kit000 - 1 ) THEN 
    594  
    595          kdate = ndastp 
    596          RETURN 
    597  
    598       ENDIF 
    599  
    600596      ! Compute the number of days from the initial date 
    601597      idaystp = INT( REAL( kt - kit000 ) * rdt / 86400. ) 
    602     
     598      ihoustp = INT( REAL( kt - kit000 ) * rdt / 3600. ) - ( idaystp * 24 ) 
     599 
    603600      iday    = iday0 
    604601      imon    = imon0 
    605602      iyea    = iyea0 
     603      ihou    = ihou0 
    606604      idaycnt = 0 
     605 
     606      ! Increment hours 
     607      ihou = ihou + ihoustp 
     608      IF ( ihou >= 24 ) THEN 
     609         ihou = ihou - 24 
     610         iday = iday + 1 
     611      ENDIF 
    607612 
    608613      CALL calc_month_len( iyea, imonth_len ) 
     
    611616         iday = iday + 1 
    612617         IF ( iday > imonth_len(imon) )  THEN 
    613             iday = 1 
     618            iday = iday - imonth_len(imon) 
    614619            imon = imon + 1 
    615620         ENDIF 
     
    622627      END DO 
    623628      ! 
    624       kdate = iyea * 10000 + imon * 100 + iday 
     629      kdate = iyea * 1000000 + imon * 10000 + iday * 100 + ihou 
    625630      ! 
    626631   END SUBROUTINE 
Note: See TracChangeset for help on using the changeset viewer.