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 14986 for NEMO/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/OCE/TRA/traadv.F90 – NEMO

Ignore:
Timestamp:
2021-06-14T13:34:08+02:00 (3 years ago)
Author:
sparonuz
Message:

Merge trunk -r14984:HEAD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/OCE/TRA/traadv.F90

    r14648 r14986  
    1818   USE oce            ! ocean dynamics and active tracers 
    1919   USE dom_oce        ! ocean space and time domain 
    20    ! TEMP: [tiling] This change not necessary after extended haloes development 
     20   ! TEMP: [tiling] This change not necessary after all lbc_lnks removed in the nn_hls = 2 case in tra_adv_fct 
    2121   USE domtile 
    2222   USE domvvl         ! variable vertical scale factors 
     
    2525   USE traadv_cen     ! centered scheme            (tra_adv_cen  routine) 
    2626   USE traadv_fct     ! FCT      scheme            (tra_adv_fct  routine) 
    27    USE traadv_fct_lf  ! FCT      scheme            (tra_adv_fct  routine - loop fusion version) 
    2827   USE traadv_mus     ! MUSCL    scheme            (tra_adv_mus  routine) 
    29    USE traadv_mus_lf  ! MUSCL    scheme            (tra_adv_mus  routine - loop fusion version) 
    3028   USE traadv_ubs     ! UBS      scheme            (tra_adv_ubs  routine) 
    3129   USE traadv_qck     ! QUICKEST scheme            (tra_adv_qck  routine) 
     
    6159   LOGICAL ::   ln_traadv_qck    ! QUICKEST scheme flag 
    6260 
    63    INTEGER ::   nadv             ! choice of the type of advection scheme 
     61   INTEGER, PUBLIC ::   nadv             ! choice of the type of advection scheme 
    6462   !                             ! associated indices: 
    65    INTEGER, PARAMETER ::   np_NO_adv  = 0   ! no T-S advection 
    66    INTEGER, PARAMETER ::   np_CEN     = 1   ! 2nd/4th order centered scheme 
    67    INTEGER, PARAMETER ::   np_FCT     = 2   ! 2nd/4th order Flux Corrected Transport scheme 
    68    INTEGER, PARAMETER ::   np_MUS     = 3   ! MUSCL scheme 
    69    INTEGER, PARAMETER ::   np_UBS     = 4   ! 3rd order Upstream Biased Scheme 
    70    INTEGER, PARAMETER ::   np_QCK     = 5   ! QUICK scheme 
     63   INTEGER, PARAMETER, PUBLIC ::   np_NO_adv  = 0   ! no T-S advection 
     64   INTEGER, PARAMETER, PUBLIC ::   np_CEN     = 1   ! 2nd/4th order centered scheme 
     65   INTEGER, PARAMETER, PUBLIC ::   np_FCT     = 2   ! 2nd/4th order Flux Corrected Transport scheme 
     66   INTEGER, PARAMETER, PUBLIC ::   np_MUS     = 3   ! MUSCL scheme 
     67   INTEGER, PARAMETER, PUBLIC ::   np_UBS     = 4   ! 3rd order Upstream Biased Scheme 
     68   INTEGER, PARAMETER, PUBLIC ::   np_QCK     = 5   ! QUICK scheme 
    7169 
    7270   !! * Substitutions 
     
    9492      ! 
    9593      INTEGER ::   ji, jj, jk   ! dummy loop index 
    96       ! TEMP: [tiling] This change not necessary and can be A2D(nn_hls) if using XIOS (subdomain support) 
     94      ! TEMP: [tiling] This change not necessary and can be A2D(nn_hls) after all lbc_lnks removed in the nn_hls = 2 case in tra_adv_fct 
    9795      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, SAVE :: zuu, zvv, zww   ! 3D workspace 
    9896      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ztrdt, ztrds 
    99       ! TEMP: [tiling] This change not necessary after extra haloes development 
     97      ! TEMP: [tiling] This change not necessary after all lbc_lnks removed in the nn_hls = 2 case in tra_adv_fct 
    10098      LOGICAL :: lskip 
    10199      !!---------------------------------------------------------------------- 
     
    105103      lskip = .FALSE. 
    106104 
    107       ! TEMP: [tiling] These changes not necessary if using XIOS (subdomain support) 
    108       IF( ntile == 0 .OR. ntile == 1 )  THEN                       ! Do only on the first tile 
     105      ! TEMP: [tiling] These changes not necessary after all lbc_lnks removed in the nn_hls = 2 case in tra_adv_fct 
     106      IF( .NOT. l_istiled .OR. ntile == 1 )  THEN                       ! Do only on the first tile 
    109107         ALLOCATE( zuu(jpi,jpj,jpk), zvv(jpi,jpj,jpk), zww(jpi,jpj,jpk) ) 
    110108      ENDIF 
    111109 
    112       ! TEMP: [tiling] These changes not necessary after extra haloes development (lbc_lnk removed from tra_adv_*) and if XIOS has subdomain support (ldf_eiv_dia) 
    113       IF( nadv /= np_CEN .OR. (nadv == np_CEN .AND. nn_cen_h == 4) .OR. ln_ldfeiv_dia )  THEN 
    114          IF( ln_tile ) THEN 
    115             IF( ntile == 1 ) THEN 
    116                CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 ) 
    117             ELSE 
    118                lskip = .TRUE. 
    119             ENDIF 
     110      ! TEMP: [tiling] These changes not necessary after all lbc_lnks removed in the nn_hls = 2 case in tra_adv_fct 
     111      IF( ln_tile .AND. nadv == np_FCT )  THEN 
     112         IF( ntile == 1 ) THEN 
     113            CALL dom_tile_stop( ldhold=.TRUE. ) 
     114         ELSE 
     115            lskip = .TRUE. 
    120116         ENDIF 
    121117      ENDIF 
     
    123119         !                                         !==  effective transport  ==! 
    124120         IF( ln_wave .AND. ln_sdw )  THEN 
    125             DO_3D( nn_hls, nn_hls, nn_hls, nn_hls, 1, jpkm1 ) 
     121            DO_3D_OVR( nn_hls, nn_hls-1, nn_hls, nn_hls-1, 1, jpkm1 ) 
    126122               zuu(ji,jj,jk) = e2u  (ji,jj) * e3u(ji,jj,jk,Kmm) * ( uu(ji,jj,jk,Kmm) + usd(ji,jj,jk) ) 
    127123               zvv(ji,jj,jk) = e1v  (ji,jj) * e3v(ji,jj,jk,Kmm) * ( vv(ji,jj,jk,Kmm) + vsd(ji,jj,jk) ) 
     
    129125            END_3D 
    130126         ELSE 
    131             DO_3D( nn_hls, nn_hls, nn_hls, nn_hls, 1, jpkm1 ) 
     127            DO_3D_OVR( nn_hls, nn_hls-1, nn_hls, nn_hls-1, 1, jpkm1 ) 
    132128               zuu(ji,jj,jk) = e2u  (ji,jj) * e3u(ji,jj,jk,Kmm) * uu(ji,jj,jk,Kmm)               ! eulerian transport only 
    133129               zvv(ji,jj,jk) = e1v  (ji,jj) * e3v(ji,jj,jk,Kmm) * vv(ji,jj,jk,Kmm) 
     
    137133         ! 
    138134         IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN                                ! add z-tilde and/or vvl corrections 
    139             DO_3D( nn_hls, nn_hls, nn_hls, nn_hls, 1, jpkm1 ) 
     135            DO_3D_OVR( nn_hls, nn_hls-1, nn_hls, nn_hls-1, 1, jpkm1 ) 
    140136               zuu(ji,jj,jk) = zuu(ji,jj,jk) + un_td(ji,jj,jk) 
    141137               zvv(ji,jj,jk) = zvv(ji,jj,jk) + vn_td(ji,jj,jk) 
     
    143139         ENDIF 
    144140         ! 
    145          DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     141         DO_2D_OVR( nn_hls, nn_hls-1, nn_hls, nn_hls-1 ) 
    146142            zuu(ji,jj,jpk) = 0._wp                                                      ! no transport trough the bottom 
    147143            zvv(ji,jj,jpk) = 0._wp 
     
    149145         END_2D 
    150146         ! 
    151          ! TEMP: [tiling] These changes not necessary if using XIOS (subdomain support) 
    152147         IF( ln_ldfeiv .AND. .NOT. ln_traldf_triad )   & 
    153             &              CALL ldf_eiv_trp( kt, nit000, zuu(A2D(nn_hls),:), zvv(A2D(nn_hls),:), zww(A2D(nn_hls),:), & 
    154             &                                'TRA', Kmm, Krhs )   ! add the eiv transport (if necessary) 
    155          ! 
    156          IF( ln_mle    )   CALL tra_mle_trp( kt, nit000, zuu(A2D(nn_hls),:), zvv(A2D(nn_hls),:), zww(A2D(nn_hls),:), & 
    157             &                                'TRA', Kmm       )   ! add the mle transport (if necessary) 
    158          ! 
    159          ! TEMP: [tiling] This change not necessary if using XIOS (subdomain support) 
    160          IF( ntile == 0 .OR. ntile == nijtile )  THEN                ! Do only on the last tile 
     148            &              CALL ldf_eiv_trp( kt, nit000, zuu, zvv, zww, 'TRA', Kmm, Krhs )   ! add the eiv transport (if necessary) 
     149         ! 
     150         IF( ln_mle    )   CALL tra_mle_trp( kt, nit000, zuu, zvv, zww, 'TRA', Kmm       )   ! add the mle transport (if necessary) 
     151         ! 
     152         ! TEMP: [tiling] This change not necessary after all lbc_lnks removed in the nn_hls = 2 case in tra_adv_fct 
     153         IF( .NOT. l_istiled .OR. ntile == nijtile )  THEN                ! Do only on the last tile 
    161154            CALL iom_put( "uocetr_eff", zuu )                                        ! output effective transport 
    162155            CALL iom_put( "vocetr_eff", zvv ) 
     
    164157         ENDIF 
    165158         ! 
    166    !!gm ??? 
    167          ! TEMP: [tiling] This change not necessary if using XIOS (subdomain support) 
     159!!gm ??? 
     160         ! TEMP: [tiling] This copy-in not necessary after all lbc_lnks removed in the nn_hls = 2 case in tra_adv_fct 
    168161         CALL dia_ptr( kt, Kmm, zvv(A2D(nn_hls),:) )                                    ! diagnose the effective MSF 
    169    !!gm ??? 
     162!!gm ??? 
    170163         ! 
    171164 
     
    179172         ! 
    180173         CASE ( np_CEN )                                 ! Centered scheme : 2nd / 4th order 
    181             IF (nn_hls.EQ.2) CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kmm), 'T', 1._wp ) 
    182174            CALL tra_adv_cen    ( kt, nit000, 'TRA',         zuu, zvv, zww, Kmm, pts, jpts, Krhs, nn_cen_h, nn_cen_v ) 
    183175         CASE ( np_FCT )                                 ! FCT scheme      : 2nd / 4th order 
    184             IF (nn_hls.EQ.2) THEN 
    185                CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1._wp, pts(:,:,:,:,Kmm), 'T', 1._wp) 
    186                CALL lbc_lnk( 'traadv', zuu(:,:,:), 'U', -1._wp, zvv(:,:,:), 'V', -1._wp, zww(:,:,:), 'W', 1._wp) 
    187 #if defined key_loop_fusion 
    188                CALL tra_adv_fct_lf ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs, nn_fct_h, nn_fct_v ) 
    189 #else 
    190176               CALL tra_adv_fct    ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs, nn_fct_h, nn_fct_v ) 
    191 #endif 
    192             ELSE 
    193                CALL tra_adv_fct    ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs, nn_fct_h, nn_fct_v ) 
    194             END IF 
    195177         CASE ( np_MUS )                                 ! MUSCL 
    196             IF (nn_hls.EQ.2) THEN 
    197                 CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1._wp) 
    198 #if defined key_loop_fusion 
    199                 CALL tra_adv_mus_lf ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs, ln_mus_ups ) 
    200 #else 
    201178                CALL tra_adv_mus    ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs, ln_mus_ups ) 
    202 #endif 
    203             ELSE 
    204                 CALL tra_adv_mus    ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs, ln_mus_ups ) 
    205             END IF 
    206179         CASE ( np_UBS )                                 ! UBS 
    207             IF (nn_hls.EQ.2) CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1._wp) 
    208180            CALL tra_adv_ubs    ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs, nn_ubs_v   ) 
    209181         CASE ( np_QCK )                                 ! QUICKEST 
    210             IF (nn_hls.EQ.2) THEN 
    211                CALL lbc_lnk( 'traadv', zuu(:,:,:), 'U', -1._wp, zvv(:,:,:), 'V', -1._wp) 
    212                CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1._wp) 
    213             END IF 
    214182            CALL tra_adv_qck    ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs ) 
    215183         ! 
     
    226194         ENDIF 
    227195 
    228          ! TEMP: [tiling] This change not necessary after extra haloes development (lbc_lnk removed from tra_adv_*) and if XIOS has subdomain support (ldf_eiv_dia) 
    229          IF( ln_tile .AND. ntile == 0 ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 1 ) 
    230  
     196         ! TEMP: [tiling] This change not necessary after all lbc_lnks removed in the nn_hls = 2 case in tra_adv_fct 
     197         IF( ln_tile .AND. .NOT. l_istiled ) CALL dom_tile_start( ldhold=.TRUE. ) 
    231198      ENDIF 
    232199      !                                              ! print mean trends (used for debugging) 
     
    234201         &                                  tab3d_2=CASTWP(pts(:,:,:,jp_sal,Krhs)), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' ) 
    235202 
    236       ! TEMP: [tiling] This change not necessary if using XIOS (subdomain support) 
    237       IF( ntile == 0 .OR. ntile == nijtile )  THEN                ! Do only for the full domain 
     203      ! TEMP: [tiling] This change not necessary after all lbc_lnks removed in the nn_hls = 2 case in tra_adv_fct 
     204      IF( .NOT. l_istiled .OR. ntile == nijtile )  THEN                ! Do only for the full domain 
    238205         DEALLOCATE( zuu, zvv, zww ) 
    239206      ENDIF 
     
    307274        CALL ctl_stop( 'tra_adv_init: FCT scheme, choose 2nd or 4th order' ) 
    308275      ENDIF 
     276      ! TEMP: [tiling] This change not necessary after all lbc_lnks removed in the nn_hls = 2 case in tra_adv_fct 
     277      IF( ln_traadv_fct .AND. ln_tile ) THEN 
     278         CALL ctl_warn( 'tra_adv_init: FCT scheme does not yet work with tiling' ) 
     279      ENDIF 
    309280      IF( ln_traadv_ubs .AND. ( nn_ubs_v /= 2 .AND. nn_ubs_v /= 4 )   ) THEN     ! UBS 
    310281        CALL ctl_stop( 'tra_adv_init: UBS scheme, choose 2nd or 4th order' ) 
Note: See TracChangeset for help on using the changeset viewer.