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 6060 for branches/2015/dev_merge_2015/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90 – NEMO

Ignore:
Timestamp:
2015-12-16T10:25:22+01:00 (8 years ago)
Author:
timgraham
Message:

Merged dev_r5836_noc2_VVL_BY_DEFAULT into branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_merge_2015/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90

    r5930 r6060  
    1515   !!   'key_bdy'     Open Boundary Condition 
    1616   !!---------------------------------------------------------------------- 
    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 
    3534 
    3635   IMPLICIT NONE 
     
    4241 
    4342   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.) 
    5047   END TYPE TIDES_DATA 
    5148 
     
    9188      NAMELIST/nambdy_tide/filtide, ln_bdytide_2ddta, ln_bdytide_conj 
    9289      !!---------------------------------------------------------------------- 
    93  
    94       IF( nn_timing == 1 ) CALL timing_start('bdytide_init') 
    95  
     90      ! 
     91      IF( nn_timing == 1 )   CALL timing_start('bdytide_init') 
     92      ! 
    9693      IF (nb_bdy>0) THEN 
    9794         IF(lwp) WRITE(numout,*) 
     
    263260            ENDIF ! ln_bdytide_2ddta=.true. 
    264261            ! 
    265             IF ( ln_bdytide_conj ) THEN ! assume complex conjugate in data files 
     262            IF( ln_bdytide_conj ) THEN    ! assume complex conjugate in data files 
    266263               td%ssh0(:,:,2) = - td%ssh0(:,:,2) 
    267264               td%u0  (:,:,2) = - td%u0  (:,:,2) 
     
    274271            ALLOCATE( dta_bdy_s(ib_bdy)%u2d ( ilen0(2) ) ) 
    275272            ALLOCATE( dta_bdy_s(ib_bdy)%v2d ( ilen0(3) ) ) 
    276             dta_bdy_s(ib_bdy)%ssh(:) = 0.e0 
    277             dta_bdy_s(ib_bdy)%u2d(:) = 0.e0 
    278             dta_bdy_s(ib_bdy)%v2d(:) = 0.e0 
     273            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 
    279276            ! 
    280277         ENDIF ! nn_dyn2d_dta(ib_bdy) .ge. 2 
    281278         ! 
    282279      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      ! 
    286283   END SUBROUTINE bdytide_init 
    287284 
    288    SUBROUTINE bdytide_update ( kt, idx, dta, td, jit, time_offset ) 
     285 
     286   SUBROUTINE bdytide_update( kt, idx, dta, td, jit, time_offset ) 
    289287      !!---------------------------------------------------------------------- 
    290288      !!                 ***  SUBROUTINE bdytide_update  *** 
     
    293291      !!                 
    294292      !!---------------------------------------------------------------------- 
    295       INTEGER, INTENT( in )            ::   kt          ! Main timestep counter 
    296       TYPE(OBC_INDEX), INTENT( in )    ::   idx         ! OBC indices 
    297       TYPE(OBC_DATA),  INTENT(inout)  ::   dta         ! OBC external data 
    298       TYPE(TIDES_DATA),INTENT( inout ) ::   td          ! tidal harmonics data 
    299       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 jit 
    301                                                         ! is present then units = subcycle timesteps. 
    302                                                         ! time_offset = 0  => get data at "now"    time level 
    303                                                         ! time_offset = -1 => get data at "before" time level 
    304                                                         ! time_offset = +1 => get data at "after"  time level 
    305                                                         ! etc. 
    306       !! 
    307       INTEGER, DIMENSION(3)            ::   ilen0       !: length of boundary data (from OBC arrays) 
    308       INTEGER                          :: itide, igrd, ib   ! dummy loop indices 
    309       INTEGER                          :: time_add          ! time offset in units of timesteps 
    310       REAL(wp)                         :: z_arg, z_sarg, zflag, zramp       
     293      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     
    311309      REAL(wp), DIMENSION(jpmax_harmo) :: z_sist, z_cost 
    312310      !!---------------------------------------------------------------------- 
    313  
    314       IF( nn_timing == 1 ) CALL timing_start('bdytide_update') 
    315  
     311      ! 
     312      IF( nn_timing == 1 )   CALL timing_start('bdytide_update') 
     313      ! 
    316314      ilen0(1) =  SIZE(td%ssh(:,1,1)) 
    317315      ilen0(2) =  SIZE(td%u(:,1,1)) 
     
    374372      END DO 
    375373      ! 
    376       IF( nn_timing == 1 ) CALL timing_stop('bdytide_update') 
     374      IF( nn_timing == 1 )   CALL timing_stop('bdytide_update') 
    377375      ! 
    378376   END SUBROUTINE bdytide_update 
     377 
    379378 
    380379   SUBROUTINE bdy_dta_tides( kt, kit, time_offset ) 
     
    385384      !!                 
    386385      !!---------------------------------------------------------------------- 
    387       INTEGER, INTENT( in )            ::   kt          ! Main timestep counter 
    388       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 kit 
    390                                                         ! is present then units = subcycle timesteps. 
    391                                                         ! time_offset = 0  => get data at "now"    time level 
    392                                                         ! time_offset = -1 => get data at "before" time level 
    393                                                         ! time_offset = +1 => get data at "after"  time level 
    394                                                         ! etc. 
    395       !! 
    396       LOGICAL  :: lk_first_btstp  ! =.TRUE. if time splitting and first barotropic step 
    397       INTEGER, DIMENSION(jpbgrd) :: ilen0  
    398       INTEGER, DIMENSION(1:jpbgrd) :: nblen, nblenrim  ! short cuts 
    399       INTEGER  :: itide, ib_bdy, ib, igrd                     ! loop indices 
    400       INTEGER  :: time_add                                    ! time offset in units of timesteps 
    401       REAL(wp) :: z_arg, z_sarg, zramp, zoff, z_cost, z_sist       
    402       !!---------------------------------------------------------------------- 
    403  
    404       IF( nn_timing == 1 ) CALL timing_start('bdy_dta_tides') 
    405  
     386      INTEGER,           INTENT(in) ::   kt          ! Main timestep counter 
     387      INTEGER, OPTIONAL, INTENT(in) ::   kit         ! Barotropic timestep counter (for timesplitting option) 
     388      INTEGER, OPTIONAL, INTENT(in) ::   time_offset ! time offset in units of timesteps. NB. if kit 
     389      !                                              ! is present then units = subcycle timesteps. 
     390      !                                              ! time_offset = 0  => get data at "now"    time level 
     391      !                                              ! time_offset = -1 => get data at "before" time level 
     392      !                                              ! time_offset = +1 => get data at "after"  time level 
     393      !                                              ! etc. 
     394      ! 
     395      LOGICAL  ::   lk_first_btstp            ! =.TRUE. if time splitting and first barotropic step 
     396      INTEGER  ::   itide, ib_bdy, ib, igrd   ! loop indices 
     397      INTEGER  ::   time_add                  ! time offset in units of timesteps 
     398      INTEGER, DIMENSION(jpbgrd)   ::   ilen0  
     399      INTEGER, DIMENSION(1:jpbgrd) ::   nblen, nblenrim  ! short cuts 
     400      REAL(wp) ::   z_arg, z_sarg, zramp, zoff, z_cost, z_sist       
     401      !!---------------------------------------------------------------------- 
     402      ! 
     403      IF( nn_timing == 1 )   CALL timing_start('bdy_dta_tides') 
     404      ! 
    406405      lk_first_btstp=.TRUE. 
    407406      IF ( PRESENT(kit).AND.( kit /= 1 ) ) THEN ; lk_first_btstp=.FALSE. ; ENDIF 
     
    502501   END SUBROUTINE bdy_dta_tides 
    503502 
     503 
    504504   SUBROUTINE tide_init_elevation( idx, td ) 
    505505      !!---------------------------------------------------------------------- 
    506506      !!                 ***  ROUTINE tide_init_elevation  *** 
    507507      !!---------------------------------------------------------------------- 
    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) 
     508      TYPE(OBC_INDEX) , INTENT(in   ) ::   idx   ! OBC indices 
     509      TYPE(TIDES_DATA), INTENT(inout) ::   td    ! tidal harmonics data 
     510      ! 
     511      INTEGER ::   itide, igrd, ib       ! dummy loop indices 
     512      INTEGER, DIMENSION(1) ::   ilen0   ! length of boundary data (from OBC arrays) 
    512513      REAL(wp),ALLOCATABLE, DIMENSION(:) ::   mod_tide, phi_tide 
    513       INTEGER                            ::   itide, igrd, ib      ! dummy loop indices 
    514  
     514      !!---------------------------------------------------------------------- 
     515      ! 
    515516      igrd=1    
    516517                              ! SSH on tracer grid. 
    517     
    518518      ilen0(1) =  SIZE(td%ssh0(:,1,1)) 
    519  
    520       ALLOCATE(mod_tide(ilen0(igrd)),phi_tide(ilen0(igrd))) 
    521  
     519      ! 
     520      ALLOCATE( mod_tide(ilen0(igrd)), phi_tide(ilen0(igrd)) ) 
     521      ! 
    522522      DO itide = 1, nb_harmo 
    523523         DO ib = 1, ilen0(igrd) 
     
    534534         ENDDO 
    535535      END DO 
    536  
    537       DEALLOCATE(mod_tide,phi_tide) 
    538  
     536      ! 
     537      DEALLOCATE( mod_tide, phi_tide ) 
     538      ! 
    539539   END SUBROUTINE tide_init_elevation 
    540540 
     541 
    541542   SUBROUTINE tide_init_velocities( idx, td ) 
    542543      !!---------------------------------------------------------------------- 
    543544      !!                 ***  ROUTINE tide_init_elevation  *** 
    544545      !!---------------------------------------------------------------------- 
    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) 
     546      TYPE(OBC_INDEX) , INTENT(in   ) ::   idx   ! OBC indices 
     547      TYPE(TIDES_DATA), INTENT(inout) ::   td    ! tidal harmonics data 
     548      ! 
     549      INTEGER ::   itide, igrd, ib       ! dummy loop indices 
     550      INTEGER, DIMENSION(3) ::   ilen0   ! length of boundary data (from OBC arrays) 
    549551      REAL(wp),ALLOCATABLE, DIMENSION(:) ::   mod_tide, phi_tide 
    550       INTEGER                            ::   itide, igrd, ib      ! dummy loop indices 
    551  
     552      !!---------------------------------------------------------------------- 
     553      ! 
    552554      ilen0(2) =  SIZE(td%u0(:,1,1)) 
    553555      ilen0(3) =  SIZE(td%v0(:,1,1)) 
    554  
     556      ! 
    555557      igrd=2                                 ! U grid. 
    556  
    557       ALLOCATE(mod_tide(ilen0(igrd)),phi_tide(ilen0(igrd))) 
    558  
     558      ! 
     559      ALLOCATE( mod_tide(ilen0(igrd)) , phi_tide(ilen0(igrd)) ) 
     560      ! 
    559561      DO itide = 1, nb_harmo 
    560562         DO ib = 1, ilen0(igrd) 
     
    571573         ENDDO 
    572574      END DO 
    573  
    574       DEALLOCATE(mod_tide,phi_tide) 
    575  
     575      ! 
     576      DEALLOCATE( mod_tide , phi_tide ) 
     577      ! 
    576578      igrd=3                                 ! V grid. 
    577  
    578       ALLOCATE(mod_tide(ilen0(igrd)),phi_tide(ilen0(igrd))) 
     579      ! 
     580      ALLOCATE( mod_tide(ilen0(igrd)) , phi_tide(ilen0(igrd)) ) 
    579581 
    580582      DO itide = 1, nb_harmo 
     
    592594         ENDDO 
    593595      END DO 
    594  
    595       DEALLOCATE(mod_tide,phi_tide) 
    596  
     596      ! 
     597      DEALLOCATE( mod_tide, phi_tide ) 
     598      ! 
    597599  END SUBROUTINE tide_init_velocities 
     600 
    598601#else 
    599602   !!---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.