Changeset 12127
- Timestamp:
- 2019-12-09T18:42:54+01:00 (4 years ago)
- Location:
- NEMO/branches/2019/dev_r12114_ticket_2263/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2019/dev_r12114_ticket_2263/src/OCE/BDY/bdydta.F90
r12116 r12127 75 75 CONTAINS 76 76 77 SUBROUTINE bdy_dta( kt, kit, kt_offset )77 SUBROUTINE bdy_dta( kt, kit, pt_offset ) 78 78 !!---------------------------------------------------------------------- 79 79 !! *** SUBROUTINE bdy_dta *** … … 86 86 INTEGER, INTENT(in) :: kt ! ocean time-step index 87 87 INTEGER, INTENT(in), OPTIONAL :: kit ! subcycle time-step index (for timesplitting option) 88 INTEGER, INTENT(in), OPTIONAL :: kt_offset ! time offset in units of timesteps. NB. if kit88 REAL(wp),INTENT(in), OPTIONAL :: pt_offset ! time offset in units of timesteps. NB. if kit 89 89 ! ! is present then units = subcycle timesteps. 90 ! ! kt_offset = 0 => get data at "now" time level91 ! ! kt_offset = -1 => get data at "before" time level92 ! ! kt_offset = +1 => get data at "after" time level93 ! ! etc.94 90 ! 95 91 INTEGER :: jbdy, jfld, jstart, jend, ib, jl ! dummy loop indices … … 216 212 ! read/update all bdy data 217 213 ! ------------------------ 218 CALL fld_read( kt, 1, bf_alias, kit = kit, kt_offset = kt_offset )214 CALL fld_read( kt, 1, bf_alias, kit = kit, pt_offset = pt_offset ) 219 215 220 216 ! apply some corrections in some specific cases... … … 279 275 IF( PRESENT(kit) .AND. nn_dyn2d_dta(jbdy) .GE. 2 ) THEN 280 276 CALL bdytide_update( kt = kt, idx = idx_bdy(jbdy), dta = dta_alias, td = tides(jbdy), & 281 & kit = kit, kt_offset = kt_offset )277 & kit = kit, pt_offset = pt_offset ) 282 278 ENDIF 283 279 … … 343 339 nblen => idx_bdy(jbdy)%nblen 344 340 nblenrim => idx_bdy(jbdy)%nblenrim 345 IF( cn_dyn2d(jbdy) == 'frs' ) THEN ; ilen1(:)=nblen(:) ; ELSE ; ilen1(:)=nblenrim(:) ; ENDIF 346 IF ( dta_bdy(jbdy)%lneed_ssh ) dta_bdy_s(jbdy)%ssh(1:ilen1(1)) = dta_bdy(jbdy)%ssh(1:ilen1(1)) 347 IF ( dta_bdy(jbdy)%lneed_dyn2d ) dta_bdy_s(jbdy)%u2d(1:ilen1(2)) = dta_bdy(jbdy)%u2d(1:ilen1(2)) 348 IF ( dta_bdy(jbdy)%lneed_dyn2d ) dta_bdy_s(jbdy)%v2d(1:ilen1(3)) = dta_bdy(jbdy)%v2d(1:ilen1(3)) 349 ENDIF 350 END DO 351 ELSE ! Add tides if not split-explicit free surface else this is done in ts loop 352 ! 353 CALL bdy_dta_tides( kt=kt, kt_offset=kt_offset ) 354 ENDIF 355 ENDIF 356 ! 357 IF( ln_timing ) CALL timing_stop('bdy_dta') 358 ! 359 END SUBROUTINE bdy_dta 341 IF( cn_dyn2d(jbdy) == 'frs' ) THEN ; ilen1(:)=nblen(:) 342 ELSE ; ilen1(:)=nblenrim(:) 343 ENDIF 344 IF ( dta_bdy(jbdy)%lneed_ssh ) dta_bdy_s(jbdy)%ssh(1:ilen1(1)) = dta_bdy(jbdy)%ssh(1:ilen1(1)) 345 IF ( dta_bdy(jbdy)%lneed_dyn2d ) dta_bdy_s(jbdy)%u2d(1:ilen1(2)) = dta_bdy(jbdy)%u2d(1:ilen1(2)) 346 IF ( dta_bdy(jbdy)%lneed_dyn2d ) dta_bdy_s(jbdy)%v2d(1:ilen1(3)) = dta_bdy(jbdy)%v2d(1:ilen1(3)) 347 ENDIF 348 END DO 349 ELSE ! Add tides if not split-explicit free surface else this is done in ts loop 350 ! 351 CALL bdy_dta_tides( kt=kt, pt_offset=pt_offset ) 352 ENDIF 353 ENDIF 354 ! 355 IF( ln_timing ) CALL timing_stop('bdy_dta') 356 ! 357 END SUBROUTINE bdy_dta 360 358 361 359 -
NEMO/branches/2019/dev_r12114_ticket_2263/src/OCE/BDY/bdytides.F90
r11536 r12127 262 262 263 263 264 SUBROUTINE bdytide_update( kt, idx, dta, td, kit, kt_offset )264 SUBROUTINE bdytide_update( kt, idx, dta, td, kit, pt_offset ) 265 265 !!---------------------------------------------------------------------- 266 266 !! *** SUBROUTINE bdytide_update *** … … 274 274 TYPE(TIDES_DATA) , INTENT(inout) :: td ! tidal harmonics data 275 275 INTEGER, OPTIONAL, INTENT(in ) :: kit ! Barotropic timestep counter (for timesplitting option) 276 INTEGER, OPTIONAL, INTENT(in ) :: kt_offset ! time offset in units of timesteps. NB. if kit276 REAL(wp), OPTIONAL,INTENT(in ) :: pt_offset ! time offset in units of timesteps. NB. if kit 277 277 ! ! is present then units = subcycle timesteps. 278 ! ! kt_offset = 0 => get data at "now" time level279 ! ! kt_offset = -1 => get data at "before" time level280 ! ! kt_offset = +1 => get data at "after" time level281 ! ! etc.282 278 ! 283 279 INTEGER :: itide, igrd, ib ! dummy loop indices 284 INTEGER :: time_add ! time offset in units of timesteps285 280 INTEGER, DIMENSION(3) :: ilen0 ! length of boundary data (from OBC arrays) 286 REAL(wp) :: z_arg, z_sarg, zflag, zramp 281 REAL(wp) :: z_arg, z_sarg, zflag, zramp, zt_offset ! local scalars 287 282 REAL(wp), DIMENSION(jpmax_harmo) :: z_sist, z_cost 288 283 !!---------------------------------------------------------------------- … … 299 294 IF ( (nsec_day == NINT(0.5_wp * rdt) .OR. kt==nit000) .AND. zflag==1 ) THEN 300 295 ! 301 kt_tide = kt - (nsec_day - 0.5_wp * rdt)/rdt296 kt_tide = kt - NINT((REAL(nsec_day,wp) - 0.5_wp * rdt)/rdt) 302 297 ! 303 298 IF(lwp) THEN … … 312 307 ENDIF 313 308 314 time_add = 0 315 IF( PRESENT(kt_offset) ) THEN 316 time_add = kt_offset 317 ENDIF 309 zt_offset = 0._wp 310 IF( PRESENT(pt_offset) ) zt_offset = pt_offset 318 311 319 312 IF( PRESENT(kit) ) THEN 320 z_arg = ((kt-kt_tide) * rdt + (kit+0.5_wp*(time_add-1)) * rdt / REAL(nn_baro,wp))313 z_arg = REAL( kt - kt_tide, wp) * rdt + ( REAL(kit, wp) + 0.5_wp * ( zt_offset - 1._wp ) ) * rdt / REAL(nn_baro, wp) 321 314 ELSE 322 z_arg = ( (kt-kt_tide)+time_add) * rdt315 z_arg = ( REAL( kt - kt_tide, wp) + zt_offset ) * rdt 323 316 ENDIF 324 317 325 318 ! Linear ramp on tidal component at open boundaries 326 319 zramp = 1._wp 327 IF (ln_tide_ramp) zramp = MIN(MAX( (z_arg + (kt_tide-nit000)*rdt)/(rdttideramp*rday),0._wp),1._wp)320 IF (ln_tide_ramp) zramp = MIN(MAX( (z_arg + REAL(kt_tide-nit000,wp)*rdt)/(rdttideramp*rday),0._wp),1._wp) 328 321 329 322 DO itide = 1, nb_harmo … … 351 344 352 345 353 SUBROUTINE bdy_dta_tides( kt, kit, kt_offset )346 SUBROUTINE bdy_dta_tides( kt, kit, pt_offset ) 354 347 !!---------------------------------------------------------------------- 355 348 !! *** SUBROUTINE bdy_dta_tides *** … … 360 353 INTEGER, INTENT(in) :: kt ! Main timestep counter 361 354 INTEGER, OPTIONAL, INTENT(in) :: kit ! Barotropic timestep counter (for timesplitting option) 362 INTEGER, OPTIONAL, INTENT(in) :: kt_offset ! time offset in units of timesteps. NB. if kit355 REAL(wp),OPTIONAL, INTENT(in) :: pt_offset ! time offset in units of timesteps. NB. if kit 363 356 ! ! is present then units = subcycle timesteps. 364 ! ! kt_offset = 0 => get data at "now" time level365 ! ! kt_offset = -1 => get data at "before" time level366 ! ! kt_offset = +1 => get data at "after" time level367 ! ! etc.368 357 ! 369 358 LOGICAL :: lk_first_btstp ! =.TRUE. if time splitting and first barotropic step 370 359 INTEGER :: itide, ib_bdy, ib, igrd ! loop indices 371 INTEGER :: time_add ! time offset in units of timesteps372 360 INTEGER, DIMENSION(jpbgrd) :: ilen0 373 361 INTEGER, DIMENSION(1:jpbgrd) :: nblen, nblenrim ! short cuts 374 REAL(wp) :: z_arg, z_sarg, zramp, zoff, z_cost, z_sist 362 REAL(wp) :: z_arg, z_sarg, zramp, zoff, z_cost, z_sist, zt_offset 375 363 !!---------------------------------------------------------------------- 376 364 ! … … 378 366 IF ( PRESENT(kit).AND.( kit /= 1 ) ) THEN ; lk_first_btstp=.FALSE. ; ENDIF 379 367 380 time_add = 0 381 IF( PRESENT(kt_offset) ) THEN 382 time_add = kt_offset 383 ENDIF 368 zt_offset = 0._wp 369 IF( PRESENT(pt_offset) ) zt_offset = pt_offset 384 370 385 371 ! Absolute time from model initialization: 386 372 IF( PRESENT(kit) ) THEN 387 z_arg = ( kt + (kit+time_add-1) / REAL(nn_baro,wp) ) * rdt373 z_arg = ( REAL(kt, wp) + ( REAL(kit, wp) + zt_offset - 1. ) / REAL(nn_baro, wp) ) * rdt 388 374 ELSE 389 z_arg = ( kt + time_add) * rdt375 z_arg = ( REAL(kt, wp) + zt_offset ) * rdt 390 376 ENDIF 391 377 392 378 ! Linear ramp on tidal component at open boundaries 393 379 zramp = 1. 394 IF (ln_tide_ramp) zramp = MIN(MAX( (z_arg - nit000*rdt)/(rdttideramp*rday),0.),1.)380 IF (ln_tide_ramp) zramp = MIN(MAX( (z_arg - REAL(nit000, wp)*rdt)/(rdttideramp*rday),0.),1.) 395 381 396 382 DO ib_bdy = 1,nb_bdy … … 409 395 IF ( ( nsec_day == NINT(0.5_wp * rdt) .OR. kt==nit000 ) .AND. lk_first_btstp ) THEN 410 396 ! 411 kt_tide = kt - (nsec_day - 0.5_wp * rdt)/rdt397 kt_tide = kt - NINT((REAL(nsec_day,wp) - 0.5_wp * rdt)/rdt) 412 398 ! 413 399 IF(lwp) THEN … … 421 407 ! 422 408 ENDIF 423 zoff = -kt_tide* rdt ! time offset relative to nodal factor computation time409 zoff = REAL(-kt_tide,wp) * rdt ! time offset relative to nodal factor computation time 424 410 ! 425 411 ! If time splitting, initialize arrays from slow varying open boundary data: -
NEMO/branches/2019/dev_r12114_ticket_2263/src/OCE/DYN/dynspg_ts.F90
r12072 r12127 423 423 ! !== Update the forcing ==! (BDY and tides) 424 424 ! 425 IF( ln_bdy .AND. ln_tide ) CALL bdy_dta_tides( kt, kit=jn, kt_offset= noffset+1)426 IF( ln_tide_pot .AND. ln_tide ) CALL upd_tide ( kt, kit=jn, kt_offset= noffset)425 IF( ln_bdy .AND. ln_tide ) CALL bdy_dta_tides( kt, kit=jn, pt_offset= REAL(noffset,wp) + 1._wp ) 426 IF( ln_tide_pot .AND. ln_tide ) CALL upd_tide ( kt, kit=jn, pt_offset= REAL(noffset,wp) ) 427 427 ! 428 428 ! !== extrapolation at mid-step ==! (jn+1/2) -
NEMO/branches/2019/dev_r12114_ticket_2263/src/OCE/SBC/fldread.F90
r12116 r12127 132 132 CONTAINS 133 133 134 SUBROUTINE fld_read( kt, kn_fsbc, sd, kit, kt_offset )134 SUBROUTINE fld_read( kt, kn_fsbc, sd, kit, pt_offset ) 135 135 !!--------------------------------------------------------------------- 136 136 !! *** ROUTINE fld_read *** … … 148 148 TYPE(FLD), INTENT(inout), DIMENSION(:) :: sd ! input field related variables 149 149 INTEGER , INTENT(in ), OPTIONAL :: kit ! subcycle timestep for timesplitting option 150 INTEGER , INTENT(in ), OPTIONAL :: kt_offset ! provide fields at time other than "now" 151 ! ! kt_offset = -1 => fields at "before" time level 152 ! ! kt_offset = +1 => fields at "after" time level 153 ! ! etc. 150 REAL(wp) , INTENT(in ), OPTIONAL :: pt_offset ! provide fields at time other than "now" 154 151 !! 155 152 INTEGER :: imf ! size of the structure sd … … 168 165 ELSE ; zt_offset = 0. 169 166 ENDIF 170 IF( PRESENT( kt_offset) ) zt_offset = REAL( kt_offset, wp )167 IF( PRESENT(pt_offset) ) zt_offset = pt_offset 171 168 172 169 ! Note that all varibles starting by nsec_* are shifted time by +1/2 time step to be centrered -
NEMO/branches/2019/dev_r12114_ticket_2263/src/OCE/SBC/updtide.F90
r11536 r12127 27 27 CONTAINS 28 28 29 SUBROUTINE upd_tide( kt, kit, kt_offset )29 SUBROUTINE upd_tide( kt, kit, pt_offset ) 30 30 !!---------------------------------------------------------------------- 31 31 !! *** ROUTINE upd_tide *** … … 39 39 INTEGER, INTENT(in) :: kt ! ocean time-step index 40 40 INTEGER, INTENT(in), OPTIONAL :: kit ! external mode sub-time-step index (lk_dynspg_ts=T) 41 INTEGER, INTENT(in), OPTIONAL :: kt_offset ! time offset in number41 REAL(wp),INTENT(in), OPTIONAL :: pt_offset ! time offset in number 42 42 ! of internal steps (lk_dynspg_ts=F) 43 43 ! of external steps (lk_dynspg_ts=T) 44 44 ! 45 INTEGER :: ioffset ! local integer46 45 INTEGER :: ji, jj, jk ! dummy loop indices 47 46 REAL(wp) :: zt, zramp ! local scalar 47 REAL(wp) :: zt_offset 48 48 REAL(wp), DIMENSION(nb_harmo) :: zwt 49 49 !!---------------------------------------------------------------------- 50 50 ! 51 51 ! ! tide pulsation at model time step (or sub-time-step) 52 zt = ( kt - kt_tide) * rdt52 zt = REAL( kt - kt_tide, wp ) * rdt 53 53 ! 54 ioffset = 055 IF( PRESENT( kt_offset ) ) ioffset = kt_offset54 zt_offset = 0._wp 55 IF( PRESENT( pt_offset ) ) zt_offset = pt_offset 56 56 ! 57 57 IF( PRESENT( kit ) ) THEN 58 zt = zt + ( kit + ioffset - 1) * rdt / REAL( nn_baro, wp )58 zt = zt + ( REAL( kit, wp ) + zt_offset - 1._wp ) * rdt / REAL( nn_baro, wp ) 59 59 ELSE 60 zt = zt + ioffset * rdt60 zt = zt + zt_offset * rdt 61 61 ENDIF 62 62 ! … … 70 70 IF( ln_tide_ramp ) THEN ! linear increase if asked 71 71 zt = ( kt - nit000 ) * rdt 72 IF( PRESENT( kit ) ) zt = zt + ( kit + ioffset -1) * rdt / REAL( nn_baro, wp )72 IF( PRESENT( kit ) ) zt = zt + ( REAL( kit, wp ) + zt_offset -1._wp ) * rdt / REAL( nn_baro, wp ) 73 73 zramp = MIN( MAX( zt / (rdttideramp*rday) , 0._wp ) , 1._wp ) 74 74 pot_astro(:,:) = zramp * pot_astro(:,:) -
NEMO/branches/2019/dev_r12114_ticket_2263/src/OCE/step.F90
r11993 r12127 112 112 IF( ln_tide ) CALL sbc_tide( kstp ) ! update tide potential 113 113 IF( ln_apr_dyn ) CALL sbc_apr ( kstp ) ! atmospheric pressure (NB: call before bdy_dta which needs ssh_ib) 114 IF( ln_bdy ) CALL bdy_dta ( kstp, kt_offset = +1) ! update dynamic & tracer data at open boundaries114 IF( ln_bdy ) CALL bdy_dta ( kstp, pt_offset = 1. ) ! update dynamic & tracer data at open boundaries 115 115 CALL sbc ( kstp ) ! Sea Boundary Condition (including sea-ice) 116 116 -
NEMO/branches/2019/dev_r12114_ticket_2263/src/SAS/step.F90
r11536 r12127 96 96 ! From SAS: ocean bdy data are wrong (but we do not care) and ice bdy data are OK. 97 97 ! This is not clean and should be changed in the future. 98 IF( ln_bdy ) CALL bdy_dta ( kstp, kt_offset=+1) ! update dynamic & tracer data at open boundaries98 IF( ln_bdy ) CALL bdy_dta ( kstp, pt_offset = 1. ) ! update dynamic & tracer data at open boundaries 99 99 ! ==> 100 100 CALL sbc ( kstp ) ! Sea Boundary Condition (including sea-ice) -
NEMO/branches/2019/dev_r12114_ticket_2263/src/TOP/trcbc.F90
r11536 r12127 368 368 IF( PRESENT(jit) ) THEN 369 369 ! 370 ! OPEN boundary conditions (use kt_offset=+1as they are applied at the end of the step)370 ! OPEN boundary conditions (use pt_offset=1. as they are applied at the end of the step) 371 371 IF( nb_trcobc > 0 ) THEN 372 372 if (lwp) write(numout,'(a,i5,a,i10)') ' reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt 373 CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, kit=jit, kt_offset=+1)373 CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, kit=jit, pt_offset=1.) 374 374 ENDIF 375 375 ! … … 388 388 ELSE 389 389 ! 390 ! OPEN boundary conditions (use kt_offset=+1as they are applied at the end of the step)390 ! OPEN boundary conditions (use pt_offset=1. as they are applied at the end of the step) 391 391 IF( nb_trcobc > 0 ) THEN 392 392 if (lwp) write(numout,'(a,i5,a,i10)') ' reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt 393 CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, kt_offset=+1)393 CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, pt_offset=1.) 394 394 ENDIF 395 395 !
Note: See TracChangeset
for help on using the changeset viewer.