- Timestamp:
- 2010-10-27T16:26:04+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMO/OPA_SRC/SBC/fldread.F90
r1955 r2323 123 123 INTEGER :: ireclast ! last record to be read in the current year file 124 124 INTEGER :: isecend ! number of second since Jan. 1st 00h of nit000 year at nitend 125 INTEGER :: isecsbc ! number of seconds between Jan. 1st 00h of nit000 year and the middle of sbc time step 125 126 LOGICAL :: llnxtyr ! open next year file? 126 127 LOGICAL :: llnxtmth ! open next month file? … … 132 133 ! 133 134 imf = SIZE( sd ) 135 isecsbc = nsec_year + nsec1jan000 + NINT(0.5 * REAL(kn_fsbc - 1,wp) * rdttra(1)) ! centrered in the middle of sbc time step 136 ! 134 137 ! ! ===================== ! 135 138 DO jf = 1, imf ! LOOP OVER FIELD ! 136 139 ! ! ===================== ! 137 140 ! 138 IF( kt == nit000 ) CALL fld_init( sd(jf) )141 IF( kt == nit000 ) CALL fld_init( kn_fsbc, sd(jf) ) 139 142 ! 140 143 ! read/update the after data? 141 IF( nsec_year + nsec1jan000> sd(jf)%nswap_sec ) THEN144 IF( isecsbc > sd(jf)%nswap_sec ) THEN 142 145 143 146 IF( sd(jf)%ln_tint ) THEN ! time interpolation: swap before record field … … 148 151 149 152 ! update record informations 150 CALL fld_rec( sd(jf) )153 CALL fld_rec( kn_fsbc, sd(jf) ) 151 154 152 155 ! do we have to change the year/month/day of the forcing field?? … … 277 280 ENDIF 278 281 ! 279 ztinta = REAL( nsec_year + nsec1jan000- sd(jf)%nrec_b(2), wp ) / REAL( sd(jf)%nrec_a(2) - sd(jf)%nrec_b(2), wp )282 ztinta = REAL( isecsbc - sd(jf)%nrec_b(2), wp ) / REAL( sd(jf)%nrec_a(2) - sd(jf)%nrec_b(2), wp ) 280 283 ztintb = 1. - ztinta 281 284 !CDIR COLLAPSE … … 302 305 303 306 304 SUBROUTINE fld_init( sdjf )307 SUBROUTINE fld_init( kn_fsbc, sdjf ) 305 308 !!--------------------------------------------------------------------- 306 309 !! *** ROUTINE fld_init *** … … 311 314 !! ** Method : 312 315 !!---------------------------------------------------------------------- 316 INTEGER , INTENT(in ) :: kn_fsbc ! sbc computation period (in time step) 313 317 TYPE(FLD), INTENT(inout) :: sdjf ! input field related variables 314 318 !! … … 331 335 332 336 ! define record informations 333 CALL fld_rec( sdjf ) 337 CALL fld_rec( kn_fsbc, sdjf ) 338 339 ! Note: shifting time to be centrered in the middle of sbc time step impacts only nsec_* variables of the calendar 334 340 335 341 IF( sdjf%ln_tint ) THEN ! we need to read the previous record and we will put it in the current record structure … … 406 412 407 413 408 SUBROUTINE fld_rec( sdjf )414 SUBROUTINE fld_rec( kn_fsbc, sdjf ) 409 415 !!--------------------------------------------------------------------- 410 416 !! *** ROUTINE fld_rec *** … … 414 420 !! ** Method : 415 421 !!---------------------------------------------------------------------- 422 INTEGER , INTENT(in ) :: kn_fsbc ! sbc computation period (in time step) 416 423 TYPE(FLD), INTENT(inout) :: sdjf ! input field related variables 417 424 !! … … 421 428 INTEGER :: ifreq_sec ! frequency mean (in seconds) 422 429 !!---------------------------------------------------------------------- 430 ! 431 ! Note: shifting time to be centrered in the middle of sbc time step impacts only nsec_* variables of the calendar 423 432 ! 424 433 IF( sdjf%nfreqh == -1 ) THEN ! monthly mean … … 458 467 ELSE ; ztmp = REAL(nsec_year ,wp) ! since 00h on Jan 1 of the current year 459 468 ENDIF 469 ztmp = ztmp + 0.5 * REAL(kn_fsbc - 1, wp) * rdttra(1) ! shift time to be centrered in the middle of sbc time step 470 ztmp = ztmp + 0.01 * rdttra(1) ! add 0.01 time step to avoid truncation error 460 471 IF( sdjf%ln_tint ) THEN ! time interpolation, shift by 1/2 record 461 472 ! … … 471 482 ! forcing record : 1 2 3 472 483 ! 473 ztmp = ztmp / ifreq_sec+ 0.5484 ztmp = ztmp / REAL(ifreq_sec, wp) + 0.5 474 485 ELSE 475 486 ! … … 485 496 ! forcing record : 1 2 3 486 497 ! 487 ztmp = ztmp / ifreq_sec498 ztmp = ztmp / REAL(ifreq_sec, wp) 488 499 ENDIF 489 500 irec = 1 + INT( ztmp )
Note: See TracChangeset
for help on using the changeset viewer.