[5883] | 1 | MODULE traldf_lap_blp |
---|
[3] | 2 | !!============================================================================== |
---|
[5883] | 3 | !! *** MODULE traldf_lap_blp *** |
---|
[5836] | 4 | !! Ocean tracers: lateral diffusivity trend (laplacian and bilaplacian) |
---|
[3] | 5 | !!============================================================================== |
---|
[14072] | 6 | !! History : 3.7 ! 2014-01 (G. Madec, S. Masson) Original code, re-entrant laplacian |
---|
[2528] | 7 | !!---------------------------------------------------------------------- |
---|
[3] | 8 | |
---|
| 9 | !!---------------------------------------------------------------------- |
---|
[5883] | 10 | !! tra_ldf_lap : tracer trend update with iso-level laplacian diffusive operator |
---|
| 11 | !! tra_ldf_blp : tracer trend update with iso-level or iso-neutral bilaplacian operator |
---|
[3] | 12 | !!---------------------------------------------------------------------- |
---|
[5883] | 13 | USE oce ! ocean dynamics and active tracers |
---|
| 14 | USE dom_oce ! ocean space and time domain |
---|
[13982] | 15 | USE domutl, ONLY : is_tile |
---|
[5883] | 16 | USE ldftra ! lateral physics: eddy diffusivity |
---|
| 17 | USE traldf_iso ! iso-neutral lateral diffusion (standard operator) (tra_ldf_iso routine) |
---|
| 18 | USE traldf_triad ! iso-neutral lateral diffusion (triad operator) (tra_ldf_triad routine) |
---|
| 19 | USE diaptr ! poleward transport diagnostics |
---|
[7646] | 20 | USE diaar5 ! AR5 diagnostics |
---|
[5883] | 21 | USE trc_oce ! share passive tracers/Ocean variables |
---|
| 22 | USE zpshde ! partial step: hor. derivative (zps_hde routine) |
---|
[5836] | 23 | ! |
---|
[5883] | 24 | USE in_out_manager ! I/O manager |
---|
[9019] | 25 | USE iom ! I/O library |
---|
[5883] | 26 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
| 27 | USE lib_mpp ! distribued memory computing library |
---|
| 28 | USE timing ! Timing |
---|
[3] | 29 | |
---|
| 30 | IMPLICIT NONE |
---|
| 31 | PRIVATE |
---|
| 32 | |
---|
[5883] | 33 | PUBLIC tra_ldf_lap ! called by traldf.F90 |
---|
| 34 | PUBLIC tra_ldf_blp ! called by traldf.F90 |
---|
[3] | 35 | |
---|
[7646] | 36 | LOGICAL :: l_ptr ! flag to compute poleward transport |
---|
| 37 | LOGICAL :: l_hst ! flag to compute heat transport |
---|
| 38 | |
---|
[3] | 39 | !! * Substitutions |
---|
[12377] | 40 | # include "do_loop_substitute.h90" |
---|
[13237] | 41 | # include "domzgr_substitute.h90" |
---|
[3] | 42 | !!---------------------------------------------------------------------- |
---|
[9598] | 43 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[2528] | 44 | !! $Id$ |
---|
[10068] | 45 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[3] | 46 | !!---------------------------------------------------------------------- |
---|
| 47 | CONTAINS |
---|
| 48 | |
---|
[13982] | 49 | SUBROUTINE tra_ldf_lap( kt, Kmm, kit000, cdtype, pahu, pahv, & |
---|
| 50 | & pgu , pgv , pgui, pgvi, & |
---|
| 51 | & pt, pt_rhs, kjpt, kpass ) |
---|
| 52 | !! |
---|
| 53 | INTEGER , INTENT(in ) :: kt ! ocean time-step index |
---|
| 54 | INTEGER , INTENT(in ) :: kit000 ! first time step index |
---|
| 55 | CHARACTER(len=3) , INTENT(in ) :: cdtype ! =TRA or TRC (tracer indicator) |
---|
| 56 | INTEGER , INTENT(in ) :: kjpt ! number of tracers |
---|
| 57 | INTEGER , INTENT(in ) :: kpass ! =1/2 first or second passage |
---|
| 58 | INTEGER , INTENT(in ) :: Kmm ! ocean time level index |
---|
| 59 | REAL(wp), DIMENSION(:,:,:) , INTENT(in ) :: pahu, pahv ! eddy diffusivity at u- and v-points [m2/s] |
---|
| 60 | REAL(wp), DIMENSION(:,:,:) , INTENT(in ) :: pgu, pgv ! tracer gradient at pstep levels |
---|
| 61 | REAL(wp), DIMENSION(:,:,:) , INTENT(in ) :: pgui, pgvi ! tracer gradient at top levels |
---|
| 62 | REAL(wp), DIMENSION(:,:,:,:), INTENT(in ) :: pt ! before tracer fields |
---|
| 63 | REAL(wp), DIMENSION(:,:,:,:), INTENT(inout) :: pt_rhs ! tracer trend |
---|
| 64 | !! |
---|
| 65 | CALL tra_ldf_lap_t( kt, Kmm, kit000, cdtype, pahu, pahv, is_tile(pahu), & |
---|
| 66 | & pgu , pgv , is_tile(pgu) , pgui, pgvi, is_tile(pgui), & |
---|
| 67 | & pt, is_tile(pt), pt_rhs, is_tile(pt_rhs), kjpt, kpass ) |
---|
| 68 | END SUBROUTINE tra_ldf_lap |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | SUBROUTINE tra_ldf_lap_t( kt, Kmm, kit000, cdtype, pahu, pahv, ktah, & |
---|
| 72 | & pgu , pgv , ktg , pgui, pgvi, ktgi, & |
---|
| 73 | & pt, ktt, pt_rhs, ktt_rhs, kjpt, kpass ) |
---|
[3] | 74 | !!---------------------------------------------------------------------- |
---|
| 75 | !! *** ROUTINE tra_ldf_lap *** |
---|
[14072] | 76 | !! |
---|
| 77 | !! ** Purpose : Compute the before horizontal tracer (t & s) diffusive |
---|
[3] | 78 | !! trend and add it to the general trend of tracer equation. |
---|
| 79 | !! |
---|
| 80 | !! ** Method : Second order diffusive operator evaluated using before |
---|
[14072] | 81 | !! fields (forward time scheme). The horizontal diffusive trends of |
---|
[2528] | 82 | !! the tracer is given by: |
---|
[5836] | 83 | !! difft = 1/(e1e2t*e3t) { di-1[ pahu e2u*e3u/e1u di(tb) ] |
---|
| 84 | !! + dj-1[ pahv e1v*e3v/e2v dj(tb) ] } |
---|
[12377] | 85 | !! Add this trend to the general tracer trend pt_rhs : |
---|
| 86 | !! pt_rhs = pt_rhs + difft |
---|
[3] | 87 | !! |
---|
[14072] | 88 | !! ** Action : - Update pt_rhs arrays with the before iso-level |
---|
[3] | 89 | !! harmonic mixing trend. |
---|
[2528] | 90 | !!---------------------------------------------------------------------- |
---|
| 91 | INTEGER , INTENT(in ) :: kt ! ocean time-step index |
---|
[5836] | 92 | INTEGER , INTENT(in ) :: kit000 ! first time step index |
---|
[2528] | 93 | CHARACTER(len=3) , INTENT(in ) :: cdtype ! =TRA or TRC (tracer indicator) |
---|
| 94 | INTEGER , INTENT(in ) :: kjpt ! number of tracers |
---|
[5836] | 95 | INTEGER , INTENT(in ) :: kpass ! =1/2 first or second passage |
---|
[12377] | 96 | INTEGER , INTENT(in ) :: Kmm ! ocean time level index |
---|
[13982] | 97 | INTEGER , INTENT(in ) :: ktah, ktg, ktgi, ktt, ktt_rhs |
---|
| 98 | REAL(wp), DIMENSION(A2D_T(ktah), JPK) , INTENT(in ) :: pahu, pahv ! eddy diffusivity at u- and v-points [m2/s] |
---|
| 99 | REAL(wp), DIMENSION(A2D_T(ktg), KJPT), INTENT(in ) :: pgu, pgv ! tracer gradient at pstep levels |
---|
| 100 | REAL(wp), DIMENSION(A2D_T(ktgi), KJPT), INTENT(in ) :: pgui, pgvi ! tracer gradient at top levels |
---|
| 101 | REAL(wp), DIMENSION(A2D_T(ktt), JPK,KJPT), INTENT(in ) :: pt ! before tracer fields |
---|
| 102 | REAL(wp), DIMENSION(A2D_T(ktt_rhs),JPK,KJPT), INTENT(inout) :: pt_rhs ! tracer trend |
---|
[2715] | 103 | ! |
---|
[13982] | 104 | INTEGER :: ji, jj, jk, jn ! dummy loop indices |
---|
[14834] | 105 | INTEGER :: iij |
---|
[13982] | 106 | REAL(wp) :: zsign ! local scalars |
---|
| 107 | REAL(wp), DIMENSION(A2D(nn_hls),jpk) :: ztu, ztv, zaheeu, zaheev |
---|
[3] | 108 | !!---------------------------------------------------------------------- |
---|
[3294] | 109 | ! |
---|
[14834] | 110 | IF( .NOT. l_istiled .OR. ntile == 1 ) THEN ! Do only on the first tile |
---|
[13982] | 111 | IF( kt == nit000 .AND. lwp ) THEN |
---|
| 112 | WRITE(numout,*) |
---|
| 113 | WRITE(numout,*) 'tra_ldf_lap : iso-level laplacian diffusion on ', cdtype, ', pass=', kpass |
---|
| 114 | WRITE(numout,*) '~~~~~~~~~~~ ' |
---|
| 115 | ENDIF |
---|
| 116 | ! |
---|
| 117 | l_hst = .FALSE. |
---|
| 118 | l_ptr = .FALSE. |
---|
| 119 | IF( cdtype == 'TRA' .AND. ( iom_use( 'sophtldf' ) .OR. iom_use( 'sopstldf' ) ) ) l_ptr = .TRUE. |
---|
| 120 | IF( cdtype == 'TRA' .AND. ( iom_use("uadv_heattr") .OR. iom_use("vadv_heattr") .OR. & |
---|
| 121 | & iom_use("uadv_salttr") .OR. iom_use("vadv_salttr") ) ) l_hst = .TRUE. |
---|
[3] | 122 | ENDIF |
---|
[5836] | 123 | ! |
---|
[14834] | 124 | ! Define pt_rhs halo points for multi-point haloes in bilaplacian case |
---|
| 125 | IF( nldf_tra == np_blp .AND. kpass == 1 ) THEN ; iij = nn_hls |
---|
| 126 | ELSE ; iij = 1 |
---|
| 127 | ENDIF |
---|
| 128 | |
---|
[5836] | 129 | ! !== Initialization of metric arrays used for all tracers ==! |
---|
| 130 | IF( kpass == 1 ) THEN ; zsign = 1._wp ! bilaplacian operator require a minus sign (eddy diffusivity >0) |
---|
| 131 | ELSE ; zsign = -1._wp |
---|
| 132 | ENDIF |
---|
[13982] | 133 | |
---|
[14834] | 134 | DO_3D( iij, iij-1, iij, iij-1, 1, jpkm1 ) !== First derivative (gradient) ==! |
---|
[12377] | 135 | zaheeu(ji,jj,jk) = zsign * pahu(ji,jj,jk) * e2_e1u(ji,jj) * e3u(ji,jj,jk,Kmm) !!gm * umask(ji,jj,jk) pah masked! |
---|
| 136 | zaheev(ji,jj,jk) = zsign * pahv(ji,jj,jk) * e1_e2v(ji,jj) * e3v(ji,jj,jk,Kmm) !!gm * vmask(ji,jj,jk) |
---|
| 137 | END_3D |
---|
[5836] | 138 | ! |
---|
| 139 | ! ! =========== ! |
---|
| 140 | DO jn = 1, kjpt ! tracer loop ! |
---|
[14072] | 141 | ! ! =========== ! |
---|
| 142 | ! |
---|
[14834] | 143 | DO_3D( iij, iij-1, iij, iij-1, 1, jpkm1 ) !== First derivative (gradient) ==! |
---|
[12377] | 144 | ztu(ji,jj,jk) = zaheeu(ji,jj,jk) * ( pt(ji+1,jj ,jk,jn) - pt(ji,jj,jk,jn) ) |
---|
| 145 | ztv(ji,jj,jk) = zaheev(ji,jj,jk) * ( pt(ji ,jj+1,jk,jn) - pt(ji,jj,jk,jn) ) |
---|
| 146 | END_3D |
---|
[13497] | 147 | IF( ln_zps ) THEN ! set gradient at bottom/top ocean level |
---|
[14834] | 148 | DO_2D( iij, iij-1, iij, iij-1 ) ! bottom |
---|
[12377] | 149 | ztu(ji,jj,mbku(ji,jj)) = zaheeu(ji,jj,mbku(ji,jj)) * pgu(ji,jj,jn) |
---|
| 150 | ztv(ji,jj,mbkv(ji,jj)) = zaheev(ji,jj,mbkv(ji,jj)) * pgv(ji,jj,jn) |
---|
| 151 | END_2D |
---|
[13497] | 152 | IF( ln_isfcav ) THEN ! top in ocean cavities only |
---|
[14834] | 153 | DO_2D( iij, iij-1, iij, iij-1 ) |
---|
[14072] | 154 | IF( miku(ji,jj) > 1 ) ztu(ji,jj,miku(ji,jj)) = zaheeu(ji,jj,miku(ji,jj)) * pgui(ji,jj,jn) |
---|
| 155 | IF( mikv(ji,jj) > 1 ) ztv(ji,jj,mikv(ji,jj)) = zaheev(ji,jj,mikv(ji,jj)) * pgvi(ji,jj,jn) |
---|
[12377] | 156 | END_2D |
---|
[2528] | 157 | ENDIF |
---|
[5836] | 158 | ENDIF |
---|
| 159 | ! |
---|
[14834] | 160 | DO_3D( iij-1, iij-1, iij-1, iij-1, 1, jpkm1 ) !== Second derivative (divergence) added to the general tracer trends ==! |
---|
[14820] | 161 | ! round brackets added to fix the order of floating point operations |
---|
| 162 | ! needed to ensure halo 1 - halo 2 compatibility |
---|
| 163 | pt_rhs(ji,jj,jk,jn) = pt_rhs(ji,jj,jk,jn) + ( ( ztu(ji,jj,jk) - ztu(ji-1,jj,jk) & |
---|
| 164 | & ) & ! bracket for halo 1 - halo 2 compatibility |
---|
| 165 | & + ( ztv(ji,jj,jk) - ztv(ji,jj-1,jk) & |
---|
| 166 | & ) & ! bracket for halo 1 - halo 2 compatibility |
---|
| 167 | & ) / ( e1e2t(ji,jj) * e3t(ji,jj,jk,Kmm) ) |
---|
[12377] | 168 | END_3D |
---|
[2528] | 169 | ! |
---|
[5836] | 170 | ! !== "Poleward" diffusive heat or salt transports ==! |
---|
| 171 | IF( ( kpass == 1 .AND. .NOT.ln_traldf_blp ) .OR. & !== first pass only ( laplacian) ==! |
---|
| 172 | ( kpass == 2 .AND. ln_traldf_blp ) ) THEN !== 2nd pass only (bilaplacian) ==! |
---|
[7646] | 173 | |
---|
| 174 | IF( l_ptr ) CALL dia_ptr_hst( jn, 'ldf', -ztv(:,:,:) ) |
---|
| 175 | IF( l_hst ) CALL dia_ar5_hst( jn, 'ldf', -ztu(:,:,:), -ztv(:,:,:) ) |
---|
[457] | 176 | ENDIF |
---|
[5836] | 177 | ! ! ================== |
---|
| 178 | END DO ! end of tracer loop |
---|
| 179 | ! ! ================== |
---|
[3294] | 180 | ! |
---|
[13982] | 181 | END SUBROUTINE tra_ldf_lap_t |
---|
[5883] | 182 | |
---|
[14072] | 183 | |
---|
[12377] | 184 | SUBROUTINE tra_ldf_blp( kt, Kmm, kit000, cdtype, pahu, pahv , & |
---|
| 185 | & pgu , pgv , pgui, pgvi, & |
---|
| 186 | & pt , pt_rhs, kjpt, kldf ) |
---|
[5883] | 187 | !!---------------------------------------------------------------------- |
---|
| 188 | !! *** ROUTINE tra_ldf_blp *** |
---|
[14072] | 189 | !! |
---|
| 190 | !! ** Purpose : Compute the before lateral tracer diffusive |
---|
[5883] | 191 | !! trend and add it to the general trend of tracer equation. |
---|
| 192 | !! |
---|
| 193 | !! ** Method : The lateral diffusive trends is provided by a bilaplacian |
---|
| 194 | !! operator applied to before field (forward in time). |
---|
| 195 | !! It is computed by two successive calls to laplacian routine |
---|
| 196 | !! |
---|
| 197 | !! ** Action : pta updated with the before rotated bilaplacian diffusion |
---|
| 198 | !!---------------------------------------------------------------------- |
---|
| 199 | INTEGER , INTENT(in ) :: kt ! ocean time-step index |
---|
| 200 | INTEGER , INTENT(in ) :: kit000 ! first time step index |
---|
| 201 | CHARACTER(len=3) , INTENT(in ) :: cdtype ! =TRA or TRC (tracer indicator) |
---|
| 202 | INTEGER , INTENT(in ) :: kjpt ! number of tracers |
---|
| 203 | INTEGER , INTENT(in ) :: kldf ! type of operator used |
---|
[12377] | 204 | INTEGER , INTENT(in ) :: Kmm ! ocean time level indices |
---|
[5883] | 205 | REAL(wp), DIMENSION(jpi,jpj,jpk) , INTENT(in ) :: pahu, pahv ! eddy diffusivity at u- and v-points [m2/s] |
---|
| 206 | REAL(wp), DIMENSION(jpi,jpj ,kjpt), INTENT(in ) :: pgu, pgv ! tracer gradient at pstep levels |
---|
| 207 | REAL(wp), DIMENSION(jpi,jpj, kjpt), INTENT(in ) :: pgui, pgvi ! tracer gradient at top levels |
---|
[12377] | 208 | REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in ) :: pt ! before and now tracer fields |
---|
| 209 | REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) :: pt_rhs ! tracer trend |
---|
[5883] | 210 | ! |
---|
| 211 | INTEGER :: ji, jj, jk, jn ! dummy loop indices |
---|
[13982] | 212 | REAL(wp), DIMENSION(A2D(nn_hls),jpk,kjpt) :: zlap ! laplacian at t-point |
---|
| 213 | REAL(wp), DIMENSION(A2D(nn_hls), kjpt) :: zglu, zglv ! bottom GRADh of the laplacian (u- and v-points) |
---|
| 214 | REAL(wp), DIMENSION(A2D(nn_hls), kjpt) :: zgui, zgvi ! top GRADh of the laplacian (u- and v-points) |
---|
[5883] | 215 | !!--------------------------------------------------------------------- |
---|
| 216 | ! |
---|
[14834] | 217 | IF( .NOT. l_istiled .OR. ntile == 1 ) THEN ! Do only on the first tile |
---|
[13982] | 218 | IF( kt == kit000 .AND. lwp ) THEN |
---|
| 219 | WRITE(numout,*) |
---|
| 220 | SELECT CASE ( kldf ) |
---|
| 221 | CASE ( np_blp ) ; WRITE(numout,*) 'tra_ldf_blp : iso-level bilaplacian operator on ', cdtype |
---|
| 222 | CASE ( np_blp_i ) ; WRITE(numout,*) 'tra_ldf_blp : iso-neutral bilaplacian operator on ', cdtype, ' (Standard)' |
---|
| 223 | CASE ( np_blp_it ) ; WRITE(numout,*) 'tra_ldf_blp : iso-neutral bilaplacian operator on ', cdtype, ' (triad)' |
---|
| 224 | END SELECT |
---|
| 225 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 226 | ENDIF |
---|
[5883] | 227 | ENDIF |
---|
| 228 | |
---|
| 229 | zlap(:,:,:,:) = 0._wp |
---|
| 230 | ! |
---|
[12377] | 231 | SELECT CASE ( kldf ) !== 1st laplacian applied to pt (output in zlap) ==! |
---|
[5883] | 232 | ! |
---|
| 233 | CASE ( np_blp ) ! iso-level bilaplacian |
---|
[12377] | 234 | CALL tra_ldf_lap ( kt, Kmm, kit000, cdtype, pahu, pahv, pgu, pgv, pgui, pgvi, pt, zlap, kjpt, 1 ) |
---|
[5883] | 235 | CASE ( np_blp_i ) ! rotated bilaplacian : standard operator (Madec) |
---|
[12377] | 236 | CALL tra_ldf_iso ( kt, Kmm, kit000, cdtype, pahu, pahv, pgu, pgv, pgui, pgvi, pt, pt, zlap, kjpt, 1 ) |
---|
[5883] | 237 | CASE ( np_blp_it ) ! rotated bilaplacian : triad operator (griffies) |
---|
[12377] | 238 | CALL tra_ldf_triad( kt, Kmm, kit000, cdtype, pahu, pahv, pgu, pgv, pgui, pgvi, pt, pt, zlap, kjpt, 1 ) |
---|
[5883] | 239 | END SELECT |
---|
| 240 | ! |
---|
[14834] | 241 | IF (nn_hls==1) CALL lbc_lnk( 'traldf_lap_blp', zlap(:,:,:,:) , 'T', 1.0_wp ) ! Lateral boundary conditions (unchanged sign) |
---|
[14072] | 242 | ! ! Partial top/bottom cell: GRADh( zlap ) |
---|
[12377] | 243 | IF( ln_isfcav .AND. ln_zps ) THEN ; CALL zps_hde_isf( kt, Kmm, kjpt, zlap, zglu, zglv, zgui, zgvi ) ! both top & bottom |
---|
[14072] | 244 | ELSEIF( ln_zps ) THEN ; CALL zps_hde ( kt, Kmm, kjpt, zlap, zglu, zglv ) ! only bottom |
---|
[5883] | 245 | ENDIF |
---|
| 246 | ! |
---|
[12377] | 247 | SELECT CASE ( kldf ) !== 2nd laplacian applied to zlap (output in pt_rhs) ==! |
---|
[5883] | 248 | ! |
---|
| 249 | CASE ( np_blp ) ! iso-level bilaplacian |
---|
[12377] | 250 | CALL tra_ldf_lap ( kt, Kmm, kit000, cdtype, pahu, pahv, zglu, zglv, zgui, zgvi, zlap, pt_rhs, kjpt, 2 ) |
---|
[5883] | 251 | CASE ( np_blp_i ) ! rotated bilaplacian : standard operator (Madec) |
---|
[12377] | 252 | CALL tra_ldf_iso ( kt, Kmm, kit000, cdtype, pahu, pahv, zglu, zglv, zgui, zgvi, zlap, pt , pt_rhs, kjpt, 2 ) |
---|
[5883] | 253 | CASE ( np_blp_it ) ! rotated bilaplacian : triad operator (griffies) |
---|
[12377] | 254 | CALL tra_ldf_triad( kt, Kmm, kit000, cdtype, pahu, pahv, zglu, zglv, zgui, zgvi, zlap, pt , pt_rhs, kjpt, 2 ) |
---|
[5883] | 255 | END SELECT |
---|
| 256 | ! |
---|
| 257 | END SUBROUTINE tra_ldf_blp |
---|
| 258 | |
---|
[3] | 259 | !!============================================================================== |
---|
[5883] | 260 | END MODULE traldf_lap_blp |
---|