- Timestamp:
- 2016-11-28T17:04:10+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2016/dev_INGV_UKMO_2016/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90
r5930 r7351 15 15 !! 'key_bdy' Open Boundary Condition 16 16 !!---------------------------------------------------------------------- 17 !! PUBLIC 18 !! bdytide_init : read of namelist and initialisation of tidal harmonics data 19 !! tide_update : calculation of tidal forcing at each timestep 20 !!---------------------------------------------------------------------- 21 USE timing ! Timing 22 USE oce ! ocean dynamics and tracers 23 USE dom_oce ! ocean space and time domain 24 USE iom 25 USE in_out_manager ! I/O units 26 USE phycst ! physical constants 27 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 28 USE bdy_par ! Unstructured boundary parameters 29 USE bdy_oce ! ocean open boundary conditions 30 USE daymod ! calendar 31 USE wrk_nemo ! Memory allocation 32 USE tideini 33 ! USE tide_mod ! Useless ?? 34 USE fldread 17 !! bdytide_init : read of namelist and initialisation of tidal harmonics data 18 !! tide_update : calculation of tidal forcing at each timestep 19 !!---------------------------------------------------------------------- 20 USE oce ! ocean dynamics and tracers 21 USE dom_oce ! ocean space and time domain 22 USE phycst ! physical constants 23 USE bdy_par ! Unstructured boundary parameters 24 USE bdy_oce ! ocean open boundary conditions 25 USE tideini ! 26 USE daymod ! calendar 27 ! 28 USE in_out_manager ! I/O units 29 USE iom ! xIO server 30 USE fldread ! 31 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 32 USE wrk_nemo ! Memory allocation 33 USE timing ! timing 35 34 36 35 IMPLICIT NONE … … 42 41 43 42 TYPE, PUBLIC :: TIDES_DATA !: Storage for external tidal harmonics data 44 REAL(wp), POINTER, DIMENSION(:,:,:) :: ssh0 !: Tidal constituents : SSH0 (read in file) 45 REAL(wp), POINTER, DIMENSION(:,:,:) :: u0 !: Tidal constituents : U0 (read in file) 46 REAL(wp), POINTER, DIMENSION(:,:,:) :: v0 !: Tidal constituents : V0 (read in file) 47 REAL(wp), POINTER, DIMENSION(:,:,:) :: ssh !: Tidal constituents : SSH (after nodal cor.) 48 REAL(wp), POINTER, DIMENSION(:,:,:) :: u !: Tidal constituents : U (after nodal cor.) 49 REAL(wp), POINTER, DIMENSION(:,:,:) :: v !: Tidal constituents : V (after nodal cor.) 43 REAL(wp), POINTER, DIMENSION(:,:,:) :: ssh0 !: Tidal constituents : SSH0 (read in file) 44 REAL(wp), POINTER, DIMENSION(:,:,:) :: u0, v0 !: Tidal constituents : U0, V0 (read in file) 45 REAL(wp), POINTER, DIMENSION(:,:,:) :: ssh !: Tidal constituents : SSH (after nodal cor.) 46 REAL(wp), POINTER, DIMENSION(:,:,:) :: u , v !: Tidal constituents : U , V (after nodal cor.) 50 47 END TYPE TIDES_DATA 51 48 … … 57 54 !!---------------------------------------------------------------------- 58 55 !! NEMO/OPA 3.3 , NEMO Consortium (2010) 59 !! $Id$ 56 !! $Id$ 60 57 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 61 58 !!---------------------------------------------------------------------- … … 91 88 NAMELIST/nambdy_tide/filtide, ln_bdytide_2ddta, ln_bdytide_conj 92 89 !!---------------------------------------------------------------------- 93 94 IF( nn_timing == 1 ) CALL timing_start('bdytide_init')95 90 ! 91 IF( nn_timing == 1 ) CALL timing_start('bdytide_init') 92 ! 96 93 IF (nb_bdy>0) THEN 97 94 IF(lwp) WRITE(numout,*) … … 263 260 ENDIF ! ln_bdytide_2ddta=.true. 264 261 ! 265 IF ( ln_bdytide_conj ) THEN! assume complex conjugate in data files262 IF( ln_bdytide_conj ) THEN ! assume complex conjugate in data files 266 263 td%ssh0(:,:,2) = - td%ssh0(:,:,2) 267 264 td%u0 (:,:,2) = - td%u0 (:,:,2) … … 274 271 ALLOCATE( dta_bdy_s(ib_bdy)%u2d ( ilen0(2) ) ) 275 272 ALLOCATE( dta_bdy_s(ib_bdy)%v2d ( ilen0(3) ) ) 276 dta_bdy_s(ib_bdy)%ssh(:) = 0. e0277 dta_bdy_s(ib_bdy)%u2d(:) = 0. e0278 dta_bdy_s(ib_bdy)%v2d(:) = 0. e0273 dta_bdy_s(ib_bdy)%ssh(:) = 0._wp 274 dta_bdy_s(ib_bdy)%u2d(:) = 0._wp 275 dta_bdy_s(ib_bdy)%v2d(:) = 0._wp 279 276 ! 280 277 ENDIF ! nn_dyn2d_dta(ib_bdy) .ge. 2 281 278 ! 282 279 END DO ! loop on ib_bdy 283 284 IF( nn_timing == 1 ) CALL timing_stop('bdytide_init')285 280 ! 281 IF( nn_timing == 1 ) CALL timing_stop('bdytide_init') 282 ! 286 283 END SUBROUTINE bdytide_init 287 284 288 SUBROUTINE bdytide_update ( kt, idx, dta, td, jit, time_offset ) 285 286 SUBROUTINE bdytide_update( kt, idx, dta, td, jit, time_offset ) 289 287 !!---------------------------------------------------------------------- 290 288 !! *** SUBROUTINE bdytide_update *** … … 293 291 !! 294 292 !!---------------------------------------------------------------------- 295 INTEGER , INTENT( in ):: kt ! Main timestep counter296 TYPE(OBC_INDEX) , INTENT( in ):: idx ! OBC indices297 TYPE(OBC_DATA) , INTENT(inout):: dta ! OBC external data298 TYPE(TIDES_DATA) ,INTENT( inout) :: td ! tidal harmonics data299 INTEGER, INTENT(in),OPTIONAL:: jit ! Barotropic timestep counter (for timesplitting option)300 INTEGER, INTENT( in ), OPTIONAL:: time_offset ! time offset in units of timesteps. NB. if jit301 302 303 304 305 306 ! !307 INTEGER , DIMENSION(3) :: ilen0 !: length of boundary data (from OBC arrays)308 INTEGER :: itide, igrd, ib ! dummy loop indices309 INTEGER :: time_add ! time offset in units of timesteps310 REAL(wp) :: z_arg, z_sarg, zflag, zramp293 INTEGER , INTENT(in ) :: kt ! Main timestep counter 294 TYPE(OBC_INDEX) , INTENT(in ) :: idx ! OBC indices 295 TYPE(OBC_DATA) , INTENT(inout) :: dta ! OBC external data 296 TYPE(TIDES_DATA) , INTENT(inout) :: td ! tidal harmonics data 297 INTEGER, OPTIONAL, INTENT(in ) :: jit ! Barotropic timestep counter (for timesplitting option) 298 INTEGER, OPTIONAL, INTENT(in ) :: time_offset ! time offset in units of timesteps. NB. if jit 299 ! ! is present then units = subcycle timesteps. 300 ! ! time_offset = 0 => get data at "now" time level 301 ! ! time_offset = -1 => get data at "before" time level 302 ! ! time_offset = +1 => get data at "after" time level 303 ! ! etc. 304 ! 305 INTEGER :: itide, igrd, ib ! dummy loop indices 306 INTEGER :: time_add ! time offset in units of timesteps 307 INTEGER, DIMENSION(3) :: ilen0 ! length of boundary data (from OBC arrays) 308 REAL(wp) :: z_arg, z_sarg, zflag, zramp ! local scalars 311 309 REAL(wp), DIMENSION(jpmax_harmo) :: z_sist, z_cost 312 310 !!---------------------------------------------------------------------- 313 314 IF( nn_timing == 1 ) CALL timing_start('bdytide_update')315 311 ! 312 IF( nn_timing == 1 ) CALL timing_start('bdytide_update') 313 ! 316 314 ilen0(1) = SIZE(td%ssh(:,1,1)) 317 315 ilen0(2) = SIZE(td%u(:,1,1)) … … 323 321 ENDIF 324 322 325 IF ( nsec_day == NINT(0.5_wp * rdttra(1)) .AND. zflag==1 ) THEN323 IF ( (nsec_day == NINT(0.5_wp * rdt) .OR. kt==nit000) .AND. zflag==1 ) THEN 326 324 ! 327 kt_tide = kt 325 kt_tide = kt - (nsec_day - 0.5_wp * rdt)/rdt 328 326 ! 329 327 IF(lwp) THEN … … 374 372 END DO 375 373 ! 376 IF( nn_timing == 1 ) CALL timing_stop('bdytide_update')374 IF( nn_timing == 1 ) CALL timing_stop('bdytide_update') 377 375 ! 378 376 END SUBROUTINE bdytide_update … … 385 383 !! 386 384 !!---------------------------------------------------------------------- 387 INTEGER, INTENT( in ):: kt ! Main timestep counter388 INTEGER, INTENT( in ),OPTIONAL:: kit ! Barotropic timestep counter (for timesplitting option)389 INTEGER, INTENT( in ),OPTIONAL:: time_offset ! time offset in units of timesteps. NB. if kit390 391 392 393 394 395 ! !396 LOGICAL :: lk_first_btstp! =.TRUE. if time splitting and first barotropic step397 INTEGER , DIMENSION(jpbgrd) :: ilen0398 INTEGER , DIMENSION(1:jpbgrd) :: nblen, nblenrim ! short cuts399 INTEGER :: itide, ib_bdy, ib, igrd ! loop indices400 INTEGER :: time_add ! time offset in units of timesteps401 REAL(wp) :: z_arg, z_sarg, zramp, zoff, z_cost, z_sist402 !!---------------------------------------------------------------------- 403 404 IF( nn_timing == 1 ) CALL timing_start('bdy_dta_tides')405 385 INTEGER, INTENT(in) :: kt ! Main timestep counter 386 INTEGER, OPTIONAL, INTENT(in) :: kit ! Barotropic timestep counter (for timesplitting option) 387 INTEGER, OPTIONAL, INTENT(in) :: time_offset ! time offset in units of timesteps. NB. if kit 388 ! ! is present then units = subcycle timesteps. 389 ! ! time_offset = 0 => get data at "now" time level 390 ! ! time_offset = -1 => get data at "before" time level 391 ! ! time_offset = +1 => get data at "after" time level 392 ! ! etc. 393 ! 394 LOGICAL :: lk_first_btstp ! =.TRUE. if time splitting and first barotropic step 395 INTEGER :: itide, ib_bdy, ib, igrd ! loop indices 396 INTEGER :: time_add ! time offset in units of timesteps 397 INTEGER, DIMENSION(jpbgrd) :: ilen0 398 INTEGER, DIMENSION(1:jpbgrd) :: nblen, nblenrim ! short cuts 399 REAL(wp) :: z_arg, z_sarg, zramp, zoff, z_cost, z_sist 400 !!---------------------------------------------------------------------- 401 ! 402 IF( nn_timing == 1 ) CALL timing_start('bdy_dta_tides') 403 ! 406 404 lk_first_btstp=.TRUE. 407 405 IF ( PRESENT(kit).AND.( kit /= 1 ) ) THEN ; lk_first_btstp=.FALSE. ; ENDIF … … 438 436 ! We refresh nodal factors every day below 439 437 ! This should be done somewhere else 440 IF ( nsec_day == NINT(0.5_wp * rdttra(1)) .AND. lk_first_btstp ) THEN441 ! 442 kt_tide = kt 438 IF ( ( nsec_day == NINT(0.5_wp * rdt) .OR. kt==nit000 ) .AND. lk_first_btstp ) THEN 439 ! 440 kt_tide = kt - (nsec_day - 0.5_wp * rdt)/rdt 443 441 ! 444 442 IF(lwp) THEN … … 502 500 END SUBROUTINE bdy_dta_tides 503 501 502 504 503 SUBROUTINE tide_init_elevation( idx, td ) 505 504 !!---------------------------------------------------------------------- 506 505 !! *** ROUTINE tide_init_elevation *** 507 506 !!---------------------------------------------------------------------- 508 TYPE(OBC_INDEX), INTENT( in ) :: idx ! OBC indices 509 TYPE(TIDES_DATA),INTENT( inout ) :: td ! tidal harmonics data 510 !! * Local declarations 511 INTEGER, DIMENSION(1) :: ilen0 !: length of boundary data (from OBC arrays) 507 TYPE(OBC_INDEX) , INTENT(in ) :: idx ! OBC indices 508 TYPE(TIDES_DATA), INTENT(inout) :: td ! tidal harmonics data 509 ! 510 INTEGER :: itide, igrd, ib ! dummy loop indices 511 INTEGER, DIMENSION(1) :: ilen0 ! length of boundary data (from OBC arrays) 512 512 REAL(wp),ALLOCATABLE, DIMENSION(:) :: mod_tide, phi_tide 513 INTEGER :: itide, igrd, ib ! dummy loop indices514 513 !!---------------------------------------------------------------------- 514 ! 515 515 igrd=1 516 516 ! SSH on tracer grid. 517 518 517 ilen0(1) = SIZE(td%ssh0(:,1,1)) 519 520 ALLOCATE( mod_tide(ilen0(igrd)),phi_tide(ilen0(igrd)))521 518 ! 519 ALLOCATE( mod_tide(ilen0(igrd)), phi_tide(ilen0(igrd)) ) 520 ! 522 521 DO itide = 1, nb_harmo 523 522 DO ib = 1, ilen0(igrd) … … 534 533 ENDDO 535 534 END DO 536 537 DEALLOCATE( mod_tide,phi_tide)538 535 ! 536 DEALLOCATE( mod_tide, phi_tide ) 537 ! 539 538 END SUBROUTINE tide_init_elevation 540 539 540 541 541 SUBROUTINE tide_init_velocities( idx, td ) 542 542 !!---------------------------------------------------------------------- 543 543 !! *** ROUTINE tide_init_elevation *** 544 544 !!---------------------------------------------------------------------- 545 TYPE(OBC_INDEX), INTENT( in ) :: idx ! OBC indices 546 TYPE(TIDES_DATA),INTENT( inout ) :: td ! tidal harmonics data 547 !! * Local declarations 548 INTEGER, DIMENSION(3) :: ilen0 !: length of boundary data (from OBC arrays) 545 TYPE(OBC_INDEX) , INTENT(in ) :: idx ! OBC indices 546 TYPE(TIDES_DATA), INTENT(inout) :: td ! tidal harmonics data 547 ! 548 INTEGER :: itide, igrd, ib ! dummy loop indices 549 INTEGER, DIMENSION(3) :: ilen0 ! length of boundary data (from OBC arrays) 549 550 REAL(wp),ALLOCATABLE, DIMENSION(:) :: mod_tide, phi_tide 550 INTEGER :: itide, igrd, ib ! dummy loop indices551 551 !!---------------------------------------------------------------------- 552 ! 552 553 ilen0(2) = SIZE(td%u0(:,1,1)) 553 554 ilen0(3) = SIZE(td%v0(:,1,1)) 554 555 ! 555 556 igrd=2 ! U grid. 556 557 ALLOCATE( mod_tide(ilen0(igrd)),phi_tide(ilen0(igrd)))558 557 ! 558 ALLOCATE( mod_tide(ilen0(igrd)) , phi_tide(ilen0(igrd)) ) 559 ! 559 560 DO itide = 1, nb_harmo 560 561 DO ib = 1, ilen0(igrd) … … 571 572 ENDDO 572 573 END DO 573 574 DEALLOCATE( mod_tide,phi_tide)575 574 ! 575 DEALLOCATE( mod_tide , phi_tide ) 576 ! 576 577 igrd=3 ! V grid. 577 578 ALLOCATE( mod_tide(ilen0(igrd)),phi_tide(ilen0(igrd)))578 ! 579 ALLOCATE( mod_tide(ilen0(igrd)) , phi_tide(ilen0(igrd)) ) 579 580 580 581 DO itide = 1, nb_harmo … … 592 593 ENDDO 593 594 END DO 594 595 DEALLOCATE( mod_tide,phi_tide)596 595 ! 596 DEALLOCATE( mod_tide, phi_tide ) 597 ! 597 598 END SUBROUTINE tide_init_velocities 599 598 600 #else 599 601 !!----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.