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 2818 for branches/2011/UKMO_MERCATOR_obc_bdy_merge/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

Ignore:
Timestamp:
2011-08-08T10:16:41+02:00 (13 years ago)
Author:
davestorkey
Message:

Bug fixes for the dynspg_ts case.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2011/UKMO_MERCATOR_obc_bdy_merge/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90

    r2814 r2818  
    131131      LOGICAL  ::   llnxtmth   ! open next month file? 
    132132      LOGICAL  ::   llstop     ! stop is the file does not exist 
     133      LOGICAL  ::   ll_firstcall ! true if this is the first call to fld_read for this set of fields 
    133134      REAL(wp) ::   ztinta     ! ratio applied to after  records when doing time interpolation 
    134135      REAL(wp) ::   ztintb     ! ratio applied to before records when doing time interpolation 
    135136      CHARACTER(LEN=1000) ::   clfmt   ! write format 
    136137      !!--------------------------------------------------------------------- 
     138      ll_firstcall = .false. 
     139      IF( PRESENT(jit) ) THEN 
     140         IF(kt == nit000 .and. jit == 1) ll_firstcall = .true. 
     141      ELSE 
     142         IF(kt == nit000) ll_firstcall = .true. 
     143      ENDIF 
     144 
    137145      ! Note that shifting time to be centrered in the middle of sbc time step impacts only nsec_* variables of the calendar  
    138146      IF( present(jit) ) THEN  
     
    146154      imf = SIZE( sd ) 
    147155      ! 
    148       IF( kt == nit000 ) THEN                      ! initialization 
     156      IF( ll_firstcall ) THEN                      ! initialization 
    149157         IF( PRESENT(map) ) THEN 
    150158            DO jf = 1, imf  
     
    165173         DO jf = 1, imf                            ! ---   loop over field   --- ! 
    166174             
    167             IF( isecsbc > sd(jf)%nrec_a(2) .OR. kt == nit000 ) THEN  ! read/update the after data? 
     175            IF( isecsbc > sd(jf)%nrec_a(2) .OR. ll_firstcall ) THEN  ! read/update the after data? 
    168176 
    169177               IF( sd(jf)%ln_tint ) THEN                             ! swap before record field and informations 
     
    173181               ENDIF 
    174182 
    175                CALL fld_rec( kn_fsbc, sd(jf) )                       ! update record informations 
     183               IF( PRESENT(jit) ) THEN 
     184                  CALL fld_rec( kn_fsbc, sd(jf), jit=jit )              ! update record informations 
     185               ELSE 
     186                  CALL fld_rec( kn_fsbc, sd(jf) )                       ! update record informations 
     187               ENDIF 
    176188 
    177189               ! do we have to change the year/month/week/day of the forcing field??  
     
    256268               ! temporal interpolation weights 
    257269               ztinta =  REAL( isecsbc - sd(jf)%nrec_b(2), wp ) / REAL( sd(jf)%nrec_a(2) - sd(jf)%nrec_b(2), wp ) 
    258                IF( PRESENT(map) ) THEN  
    259                   IF(lwp) WRITE(numout,*) '============================================' 
    260                   IF(lwp) WRITE(numout,*) 'Output from fld_read(map) on timestep ',kt 
    261                   IF(lwp) WRITE(numout,*) '============================================' 
    262                   IF(lwp) WRITE(numout,*) 'sd(jf)%nrec_b(2), sd(jf)%nrec_a(2), isecsbc, ztinta, ztintb : ',sd(jf)%nrec_b(2),sd(jf)%nrec_a(2),isecsbc,ztinta,ztintb 
    263                ENDIF 
    264270               ztintb =  1. - ztinta 
    265271!CDIR COLLAPSE 
     
    433439 
    434440 
    435    SUBROUTINE fld_rec( kn_fsbc, sdjf, ldbefore ) 
     441   SUBROUTINE fld_rec( kn_fsbc, sdjf, ldbefore, jit ) 
    436442      !!--------------------------------------------------------------------- 
    437443      !!                    ***  ROUTINE fld_rec  *** 
     
    447453      TYPE(FLD), INTENT(inout)           ::   sdjf      ! input field related variables 
    448454      LOGICAL  , INTENT(in   ), OPTIONAL ::   ldbefore  ! sent back before record values (default = .FALSE.) 
     455      INTEGER  , INTENT(in   ), OPTIONAL ::   jit       ! index of barotropic subcycle 
    449456                                                        ! used only if sdjf%ln_tint = .TRUE. 
    450457      !! 
     
    480487            !                             
    481488            ztmp = REAL( nday, wp ) / REAL( nyear_len(1), wp ) + 0.5 
     489            IF( PRESENT(jit) ) ztmp = ztmp + jit*rdt/REAL(nn_baro,wp) 
    482490            sdjf%nrec_a(1) = 1 + INT( ztmp ) - COUNT((/llbefore/)) 
    483491            ! swap at the middle of the year 
     
    508516            !                             
    509517            ztmp = REAL( nday, wp ) / REAL( nmonth_len(nmonth), wp ) + 0.5 
     518            IF( PRESENT(jit) ) ztmp = ztmp + jit*rdt/REAL(nn_baro,wp) 
    510519            imth = nmonth + INT( ztmp ) - COUNT((/llbefore/)) 
    511520            IF( sdjf%cltype == 'monthly' ) THEN   ;   sdjf%nrec_a(1) = 1 + INT( ztmp ) - COUNT((/llbefore/)) 
     
    535544         ztmp = ztmp + 0.5 * REAL(kn_fsbc - 1, wp) * rdttra(1)   ! shift time to be centrered in the middle of sbc time step 
    536545         ztmp = ztmp + 0.01 * rdttra(1)                          ! add 0.01 time step to avoid truncation error  
     546         IF( PRESENT(jit) ) ztmp = ztmp + jit*rdt/REAL(nn_baro,wp) 
    537547         IF( sdjf%ln_tint ) THEN                ! time interpolation, shift by 1/2 record 
    538548            ! 
     
    687697      !!---------------------------------------------------------------------- 
    688698      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 
    689       USE wrk_nemo, ONLY: utmp => wrk_2d_4, vtmp => wrk_2d_5      ! 2D workspace 
     699      USE wrk_nemo, ONLY: utmp => wrk_2d_24, vtmp => wrk_2d_25      ! 2D workspace 
    690700      !! 
    691701      INTEGER  , INTENT(in   )               ::   kt        ! ocean time step 
     
    699709      !!--------------------------------------------------------------------- 
    700710 
    701       IF(wrk_in_use(2, 4,5) ) THEN 
     711      IF(wrk_in_use(2, 24,25) ) THEN 
    702712         CALL ctl_stop('fld_rot: ERROR: requested workspace arrays are unavailable.')   ;   RETURN 
    703713      END IF 
     
    736746       END DO 
    737747      ! 
    738       IF(wrk_not_released(2, 4,5) )    CALL ctl_stop('fld_rot: ERROR: failed to release workspace arrays.') 
     748      IF(wrk_not_released(2, 24,25) )    CALL ctl_stop('fld_rot: ERROR: failed to release workspace arrays.') 
    739749      ! 
    740750   END SUBROUTINE fld_rot 
Note: See TracChangeset for help on using the changeset viewer.