- Timestamp:
- 2011-08-08T10:16:41+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2011/UKMO_MERCATOR_obc_bdy_merge/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90
r2814 r2818 131 131 LOGICAL :: llnxtmth ! open next month file? 132 132 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 133 134 REAL(wp) :: ztinta ! ratio applied to after records when doing time interpolation 134 135 REAL(wp) :: ztintb ! ratio applied to before records when doing time interpolation 135 136 CHARACTER(LEN=1000) :: clfmt ! write format 136 137 !!--------------------------------------------------------------------- 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 137 145 ! Note that shifting time to be centrered in the middle of sbc time step impacts only nsec_* variables of the calendar 138 146 IF( present(jit) ) THEN … … 146 154 imf = SIZE( sd ) 147 155 ! 148 IF( kt == nit000) THEN ! initialization156 IF( ll_firstcall ) THEN ! initialization 149 157 IF( PRESENT(map) ) THEN 150 158 DO jf = 1, imf … … 165 173 DO jf = 1, imf ! --- loop over field --- ! 166 174 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? 168 176 169 177 IF( sd(jf)%ln_tint ) THEN ! swap before record field and informations … … 173 181 ENDIF 174 182 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 176 188 177 189 ! do we have to change the year/month/week/day of the forcing field?? … … 256 268 ! temporal interpolation weights 257 269 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) ) THEN259 IF(lwp) WRITE(numout,*) '============================================'260 IF(lwp) WRITE(numout,*) 'Output from fld_read(map) on timestep ',kt261 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,ztintb263 ENDIF264 270 ztintb = 1. - ztinta 265 271 !CDIR COLLAPSE … … 433 439 434 440 435 SUBROUTINE fld_rec( kn_fsbc, sdjf, ldbefore )441 SUBROUTINE fld_rec( kn_fsbc, sdjf, ldbefore, jit ) 436 442 !!--------------------------------------------------------------------- 437 443 !! *** ROUTINE fld_rec *** … … 447 453 TYPE(FLD), INTENT(inout) :: sdjf ! input field related variables 448 454 LOGICAL , INTENT(in ), OPTIONAL :: ldbefore ! sent back before record values (default = .FALSE.) 455 INTEGER , INTENT(in ), OPTIONAL :: jit ! index of barotropic subcycle 449 456 ! used only if sdjf%ln_tint = .TRUE. 450 457 !! … … 480 487 ! 481 488 ztmp = REAL( nday, wp ) / REAL( nyear_len(1), wp ) + 0.5 489 IF( PRESENT(jit) ) ztmp = ztmp + jit*rdt/REAL(nn_baro,wp) 482 490 sdjf%nrec_a(1) = 1 + INT( ztmp ) - COUNT((/llbefore/)) 483 491 ! swap at the middle of the year … … 508 516 ! 509 517 ztmp = REAL( nday, wp ) / REAL( nmonth_len(nmonth), wp ) + 0.5 518 IF( PRESENT(jit) ) ztmp = ztmp + jit*rdt/REAL(nn_baro,wp) 510 519 imth = nmonth + INT( ztmp ) - COUNT((/llbefore/)) 511 520 IF( sdjf%cltype == 'monthly' ) THEN ; sdjf%nrec_a(1) = 1 + INT( ztmp ) - COUNT((/llbefore/)) … … 535 544 ztmp = ztmp + 0.5 * REAL(kn_fsbc - 1, wp) * rdttra(1) ! shift time to be centrered in the middle of sbc time step 536 545 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) 537 547 IF( sdjf%ln_tint ) THEN ! time interpolation, shift by 1/2 record 538 548 ! … … 687 697 !!---------------------------------------------------------------------- 688 698 USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 689 USE wrk_nemo, ONLY: utmp => wrk_2d_ 4, vtmp => wrk_2d_5 ! 2D workspace699 USE wrk_nemo, ONLY: utmp => wrk_2d_24, vtmp => wrk_2d_25 ! 2D workspace 690 700 !! 691 701 INTEGER , INTENT(in ) :: kt ! ocean time step … … 699 709 !!--------------------------------------------------------------------- 700 710 701 IF(wrk_in_use(2, 4,5) ) THEN711 IF(wrk_in_use(2, 24,25) ) THEN 702 712 CALL ctl_stop('fld_rot: ERROR: requested workspace arrays are unavailable.') ; RETURN 703 713 END IF … … 736 746 END DO 737 747 ! 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.') 739 749 ! 740 750 END SUBROUTINE fld_rot
Note: See TracChangeset
for help on using the changeset viewer.