Changeset 4783


Ignore:
Timestamp:
2014-09-24T10:42:30+02:00 (6 years ago)
Author:
jamesharle
Message:

Correction to monthly and yearly interpolation in fld_rec subroutine (see ticket #1201 for details)

Location:
branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPA_SRC
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90

    r4104 r4783  
    153153         IF ( nleapy == 1 ) THEN   ! we are using calandar with leap years 
    154154            IF ( MOD(nyear-1, 4) == 0 .AND. ( MOD(nyear-1, 400) == 0 .OR. MOD(nyear-1, 100) /= 0 ) ) THEN 
    155                nyear_len(0) = 366 
    156             ENDIF 
    157             IF ( MOD(nyear, 4) == 0 .AND. ( MOD(nyear, 400) == 0 .OR. MOD(nyear, 100) /= 0 ) ) THEN 
     155               nyear_len(0)  = 366 
     156            ENDIF 
     157            IF ( MOD(nyear  , 4) == 0 .AND. ( MOD(nyear  , 400) == 0 .OR. MOD(nyear  , 100) /= 0 ) ) THEN 
    158158               nmonth_len(2) = 29 
    159                nyear_len(1) = 366 
     159               nyear_len(1)  = 366 
     160            ENDIF 
     161            IF ( MOD(nyear+1, 4) == 0 .AND. ( MOD(nyear+1, 400) == 0 .OR. MOD(nyear+1, 100) /= 0 ) ) THEN 
     162               nyear_len(2)  = 366 
    160163            ENDIF 
    161164         ENDIF 
  • branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90

    r3421 r4783  
    210210   REAL(wp), PUBLIC ::   adatrj        !: number of elapsed days since the begining of the whole simulation 
    211211   !                                   !: (cumulative duration of previous runs that may have used different time-step size) 
    212    INTEGER , PUBLIC, DIMENSION(0: 1) ::   nyear_len     !: length in days of the previous/current year 
     212   INTEGER , PUBLIC, DIMENSION(0: 2) ::   nyear_len     !: length in days of the previous/current year 
    213213   INTEGER , PUBLIC, DIMENSION(0:13) ::   nmonth_len    !: length in days of the months of the current year 
    214214   INTEGER , PUBLIC, DIMENSION(0:13) ::   nmonth_half   !: second since Jan 1st 0h of the current year and the half of the months 
  • branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90

    r3578 r4783  
    499499            !       forcing record :    1  
    500500            !                             
    501             ztmp = REAL( nday, wp ) / REAL( nyear_len(1), wp ) + 0.5 
     501            ztmp = REAL( nsec_year, wp ) / ( REAL( nyear_len(1), wp ) * rday ) + 0.5 
    502502            IF( PRESENT(jit) ) THEN  
    503                ztmp = ztmp + (jit+itime_add)*rdt/REAL(nn_baro,wp) 
     503               ztmp = ztmp + (jit+itime_add)*rdt/REAL(nn_baro,wp) / ( REAL( nyear_len(1), wp ) * rday ) 
    504504            ELSE 
    505                ztmp = ztmp + itime_add*rdttra(1) 
     505               ztmp = ztmp + itime_add*rdttra(1) / ( REAL( nyear_len(1), wp ) * rday ) 
    506506            ENDIF 
    507507            sdjf%nrec_a(1) = 1 + INT( ztmp ) - COUNT((/llbefore/)) 
    508508            ! swap at the middle of the year 
    509             IF( llbefore ) THEN   ;   sdjf%nrec_a(2) = nsec1jan000 - NINT(0.5 * rday) * nyear_len(0) 
    510             ELSE                  ;   sdjf%nrec_a(2) = nsec1jan000 + NINT(0.5 * rday) * nyear_len(1)    
     509            IF( llbefore ) THEN   ;   sdjf%nrec_a(2) = nsec1jan000 - (1 - INT(ztmp)) * NINT(0.5 * rday) * nyear_len(0) + & 
     510                                    & INT(ztmp) * NINT( 0.5 * rday) * nyear_len(1)  
     511            ELSE                  ;   sdjf%nrec_a(2) = nsec1jan000 + (1 - INT(ztmp)) * NINT(0.5 * rday) * nyear_len(1) + & 
     512                                    & INT(ztmp) * INT(rday) * nyear_len(1) + INT(ztmp) * NINT( 0.5 * rday) * nyear_len(2)  
    511513            ENDIF 
    512514         ELSE                                    ! no time interpolation 
     
    532534            !       forcing record :  nmonth  
    533535            !                             
    534             ztmp = REAL( nday, wp ) / REAL( nmonth_len(nmonth), wp ) + 0.5 
    535             IF( PRESENT(jit) ) THEN  
    536                ztmp = ztmp + (jit+itime_add)*rdt/REAL(nn_baro,wp) 
     536            ztmp = REAL( nsec_month, wp ) / ( REAL( nmonth_len(nmonth), wp ) * rday ) + 0.5 
     537            IF( PRESENT(jit) ) THEN 
     538               ztmp = ztmp + (jit+itime_add)*rdt/REAL(nn_baro,wp)  / ( REAL( nmonth_len(nmonth), wp ) * rday ) 
    537539            ELSE 
    538                ztmp = ztmp + itime_add*rdttra(1) 
     540               ztmp = ztmp + itime_add*rdttra(1) / ( REAL( nmonth_len(nmonth), wp ) * rday ) 
    539541            ENDIF 
    540542            imth = nmonth + INT( ztmp ) - COUNT((/llbefore/)) 
Note: See TracChangeset for help on using the changeset viewer.