Changeset 9807


Ignore:
Timestamp:
2018-06-16T00:51:16+02:00 (2 years ago)
Author:
lovato
Message:

trunk: apply bugfix to BDY indexing and fldread file advancement - #2103

Location:
NEMO/trunk/src/OCE
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/BDY/bdyini.F90

    r9657 r9807  
    11601160      ! For the flagu/flagv calculation below we require a version of fmask without 
    11611161      ! the land boundary condition (shlat) included: 
     1162      zfmask(:,:) = 0 
    11621163      DO ij = 2, jpjm1 
    11631164         DO ii = 2, jpim1 
  • NEMO/trunk/src/OCE/SBC/fldread.F90

    r9598 r9807  
    247247                     sd(jf)%nrec_a(1) = sd(jf)%nrec_a(1) + 1       ! move back to after record 
    248248                  ENDIF 
    249  
    250                   ! do we have to change the year/month/week/day of the forcing field??  
    251                   ! if we do time interpolation we will need to open next year/month/week/day file before the end of the current 
    252                   ! one. If so, we are still before the end of the year/month/week/day when calling fld_rec so sd(jf)%nrec_a(1) 
    253                   ! will be larger than the record number that should be read for current year/month/week/day 
    254                   ! do we need next file data? 
    255                   IF( sd(jf)%nrec_a(1) > sd(jf)%nreclast ) THEN 
     249               ENDIF ! temporal interpolation? 
     250 
     251               ! do we have to change the year/month/week/day of the forcing field??  
     252               ! if we do time interpolation we will need to open next year/month/week/day file before the end of the current 
     253               ! one. If so, we are still before the end of the year/month/week/day when calling fld_rec so sd(jf)%nrec_a(1) 
     254               ! will be larger than the record number that should be read for current year/month/week/day 
     255               ! do we need next file data? 
     256               ! This applies to both cases with or without time interpolation 
     257               IF( sd(jf)%nrec_a(1) > sd(jf)%nreclast ) THEN 
     258                   
     259                  sd(jf)%nrec_a(1) = sd(jf)%nrec_a(1) - sd(jf)%nreclast   !  
     260                   
     261                  IF( .NOT. ( sd(jf)%ln_clim .AND. sd(jf)%cltype == 'yearly' ) ) THEN   ! close/open the current/new file 
    256262                      
    257                      sd(jf)%nrec_a(1) = sd(jf)%nrec_a(1) - sd(jf)%nreclast   !  
     263                     llnxtmth = sd(jf)%cltype == 'monthly' .OR. nday == nmonth_len(nmonth)      ! open next month file? 
     264                     llnxtyr  = sd(jf)%cltype == 'yearly'  .OR. (nmonth == 12 .AND. llnxtmth)   ! open next year  file? 
     265 
     266                     ! if the run finishes at the end of the current year/month/week/day, we will allow next 
     267                     ! year/month/week/day file to be not present. If the run continue further than the current 
     268                     ! year/month/week/day, next year/month/week/day file must exist 
     269                     isecend = nsec_year + nsec1jan000 + (nitend - kt) * NINT(rdt)   ! second at the end of the run 
     270                     llstop = isecend > sd(jf)%nrec_a(2)                                   ! read more than 1 record of next year 
     271                     ! we suppose that the date of next file is next day (should be ok even for weekly files...) 
     272                     CALL fld_clopn( sd(jf), nyear  + COUNT((/llnxtyr /))                                           ,         & 
     273                        &                    nmonth + COUNT((/llnxtmth/)) - 12                 * COUNT((/llnxtyr /)),         & 
     274                        &                    nday   + 1                   - nmonth_len(nmonth) * COUNT((/llnxtmth/)), llstop ) 
     275 
     276                     IF( sd(jf)%num <= 0 .AND. .NOT. llstop ) THEN    ! next year file does not exist 
     277                        CALL ctl_warn('next year/month/week/day file: '//TRIM(sd(jf)%clname)//     & 
     278                           &     ' not present -> back to current year/month/day') 
     279                        CALL fld_clopn( sd(jf) )       ! back to the current year/month/day 
     280                        sd(jf)%nrec_a(1) = sd(jf)%nreclast     ! force to read the last record in the current year file 
     281                     ENDIF 
    258282                      
    259                      IF( .NOT. ( sd(jf)%ln_clim .AND. sd(jf)%cltype == 'yearly' ) ) THEN   ! close/open the current/new file 
    260                          
    261                         llnxtmth = sd(jf)%cltype == 'monthly' .OR. nday == nmonth_len(nmonth)      ! open next month file? 
    262                         llnxtyr  = sd(jf)%cltype == 'yearly'  .OR. (nmonth == 12 .AND. llnxtmth)   ! open next year  file? 
    263  
    264                         ! if the run finishes at the end of the current year/month/week/day, we will allow next 
    265                         ! year/month/week/day file to be not present. If the run continue further than the current 
    266                         ! year/month/week/day, next year/month/week/day file must exist 
    267                         isecend = nsec_year + nsec1jan000 + (nitend - kt) * NINT(rdt)   ! second at the end of the run 
    268                         llstop = isecend > sd(jf)%nrec_a(2)                                   ! read more than 1 record of next year 
    269                         ! we suppose that the date of next file is next day (should be ok even for weekly files...) 
    270                         CALL fld_clopn( sd(jf), nyear  + COUNT((/llnxtyr /))                                           ,         & 
    271                            &                    nmonth + COUNT((/llnxtmth/)) - 12                 * COUNT((/llnxtyr /)),         & 
    272                            &                    nday   + 1                   - nmonth_len(nmonth) * COUNT((/llnxtmth/)), llstop ) 
    273  
    274                         IF( sd(jf)%num <= 0 .AND. .NOT. llstop ) THEN    ! next year file does not exist 
    275                            CALL ctl_warn('next year/month/week/day file: '//TRIM(sd(jf)%clname)//     & 
    276                               &     ' not present -> back to current year/month/day') 
    277                            CALL fld_clopn( sd(jf) )       ! back to the current year/month/day 
    278                            sd(jf)%nrec_a(1) = sd(jf)%nreclast     ! force to read the last record in the current year file 
    279                         ENDIF 
    280                          
    281                      ENDIF 
    282                   ENDIF   ! open need next file? 
     283                  ENDIF 
     284               ENDIF   ! open need next file? 
    283285                   
    284                ENDIF   ! temporal interpolation? 
    285  
    286286               ! read after data 
    287287               IF( PRESENT(jpk_bdy) ) THEN 
Note: See TracChangeset for help on using the changeset viewer.