- Timestamp:
- 2014-03-26T12:02:30+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2014/dev_CNRS0_NOC1_LDF/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra.F90
r4147 r4596 2 2 !!====================================================================== 3 3 !! *** MODULE ldftra *** 4 !! Ocean physics: lateral diffusivity coefficient 4 !! Ocean physics: lateral diffusivity coefficients 5 5 !!===================================================================== 6 !! History : ! 1997-07 (G. Madec) from inimix.F split in 2 routines 7 !! NEMO 1.0 ! 2002-09 (G. Madec) F90: Free form and module 8 !! 2.0 ! 2005-11 (G. Madec) 6 !! History : ! 1997-07 (G. Madec) from inimix.F split in 2 routines 7 !! NEMO 1.0 ! 2002-09 (G. Madec) F90: Free form and module 8 !! 2.0 ! 2005-11 (G. Madec) 9 !! 3.7 ! 2013-12 (F. Lemarie, G. Madec) restructuration/simplification of aht/aeiv specification, 10 !! ! add velocity dependent coefficient and optional read in file 9 11 !!---------------------------------------------------------------------- 10 12 11 13 !!---------------------------------------------------------------------- 12 14 !! ldf_tra_init : initialization, namelist read, and parameters control 13 !! ldf_tra_c3d : 3D eddy viscosity coefficient initialization 14 !! ldf_tra_c2d : 2D eddy viscosity coefficient initialization 15 !! ldf_tra_c1d : 1D eddy viscosity coefficient initialization 15 !! ldf_tra : update lateral eddy diffusivity coefficients at each time step 16 !! ldf_eiv_init : initialization of the eiv coeff. from namelist choices 17 !! ldf_eiv : time evolution of the eiv coefficients (function of the growth rate of baroclinic instability) 18 !! ldf_eiv_trp : add to the input ocean transport the contribution of the EIV parametrization 19 !! ldf_eiv_dia : diagnose the eddy induced velocity from the eiv streamfunction 16 20 !!---------------------------------------------------------------------- 17 21 USE oce ! ocean dynamics and tracers 18 22 USE dom_oce ! ocean space and time domain 19 23 USE phycst ! physical constants 20 USE ldftra_oce ! ocean tracer lateral physics 21 USE ldfslp ! ??? 24 USE ldfslp ! lateral diffusion: slope of iso-neutral surfaces 25 USE ldfc1d ! lateral diffusion: 1D case 26 USE ldfc2d ! lateral diffusion: 2D case 27 USE diaar5, ONLY: lk_diaar5 28 ! 22 29 USE in_out_manager ! I/O manager 23 USE io ipsl30 USE iom ! I/O module for ehanced bottom friction file 24 31 USE lib_mpp ! distribued memory computing library 25 32 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 33 USE wrk_nemo ! work arrays 34 USE timing ! timing 26 35 27 36 IMPLICIT NONE 28 37 PRIVATE 29 38 30 PUBLIC ldf_tra_init ! called by opa.F90 39 PUBLIC ldf_tra_init ! called by nemogcm.F90 40 PUBLIC ldf_tra ! called by step.F90 41 PUBLIC ldf_eiv_init ! called by nemogcm.F90 42 PUBLIC ldf_eiv ! called by step.F90 43 PUBLIC ldf_eiv_trp ! called by traadv.F90 44 PUBLIC ldf_eiv_dia ! called by traldf_iso and traldf_iso_triad.F90 45 46 ! !!* Namelist namtra_ldf : lateral mixing on tracers * 47 ! != Operator type =! 48 LOGICAL , PUBLIC :: ln_traldf_lap = .TRUE. !: laplacian operator 49 LOGICAL , PUBLIC :: ln_traldf_blp = .FALSE. !: bilaplacian operator 50 ! != Direction of action =! 51 LOGICAL , PUBLIC :: ln_traldf_lev = .FALSE. !: iso-level direction 52 LOGICAL , PUBLIC :: ln_traldf_hor = .FALSE. !: horizontal (geopotential) direction 53 ! LOGICAL , PUBLIC :: ln_traldf_iso = .TRUE. !: iso-neutral direction (see ldfslp) 54 ! LOGICAL , PUBLIC :: ln_traldf_triad = .FALSE. !: griffies triad scheme (see ldfslp) 55 LOGICAL , PUBLIC :: ln_traldf_msc = .FALSE. !: Method of Stabilizing Correction 56 ! LOGICAL , PUBLIC :: ln_triad_iso = .FALSE. !: pure horizontal mixing in ML (see ldfslp) 57 ! LOGICAL , PUBLIC :: ln_botmix_triad = .FALSE. !: mixing on bottom (see ldfslp) 58 ! REAL(wp), PUBLIC :: rn_slpmax = 0.01_wp !: slope limit (see ldfslp) 59 ! != Coefficients =! 60 INTEGER , PUBLIC :: nn_aht_ijk_t = 0 !: ?????? !!gm 61 REAL(wp), PUBLIC :: rn_aht_0 = 2000._wp !: laplacian lateral eddy diffusivity [m2/s] 62 REAL(wp), PUBLIC :: rn_bht_0 = 5.e+11_wp !: bilaplacian lateral eddy diffusivity [m4/s] 63 64 ! !!* Namelist namtra_ldfeiv : eddy induced velocity param. * 65 ! != Use/diagnose eiv =! 66 LOGICAL , PUBLIC :: ln_ldfeiv = .FALSE. !: eddy induced velocity flag 67 LOGICAL , PUBLIC :: ln_ldfeiv_dia = .FALSE. !: diagnose & output eiv streamfunction and velocity (IOM) 68 ! != Coefficients =! 69 INTEGER , PUBLIC :: nn_aei_ijk_t = 0 !: choice of time/space variation of the eiv coeff. 70 REAL(wp), PUBLIC :: rn_aeiv_0 = 2000._wp !: eddy induced velocity coefficient [m2/s] 71 72 LOGICAL , PUBLIC :: l_ldftra_time = .FALSE. !: flag for time variation of the lateral eddy diffusivity coef. 73 LOGICAL , PUBLIC :: l_ldfeiv_time = .FALSE. ! flag for time variation of the eiv coef. 74 REAL(wp), PUBLIC :: rldf !: multiplicative factor of diffusive coefficient 75 ! Needed to define the ratio between passive and active tracer diffusion coef. 76 77 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ahtu, ahtv !: eddy diffusivity coef. at U- and V-points [m2/s] 78 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: aeiu, aeiv !: eddy induced velocity coeff. [m2/s] 79 80 REAL(wp) :: r1_4 = 0.25_wp ! =1/4 81 REAL(wp) :: r1_12 = 1._wp / 12._wp ! =1/12 31 82 32 83 !! * Substitutions … … 34 85 # include "vectopt_loop_substitute.h90" 35 86 !!---------------------------------------------------------------------- 36 !! NEMO/OPA 3. 3 , NEMO Consortium (2010)87 !! NEMO/OPA 3.7 , NEMO Consortium (2014) 37 88 !! $Id$ 38 89 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 46 97 !! ** Purpose : initializations of the tracer lateral mixing coeff. 47 98 !! 48 !! ** Method : the Eddy diffusivity and eddy induced velocity ceoff. 49 !! are defined as follows: 50 !! default option : constant coef. aht0, aeiv0 (namelist) 51 !! 'key_traldf_c1d': depth dependent coef. defined in 52 !! in ldf_tra_c1d routine 53 !! 'key_traldf_c2d': latitude and longitude dependent coef. 54 !! defined in ldf_tra_c2d routine 55 !! 'key_traldf_c3d': latitude, longitude, depth dependent coef. 56 !! defined in ldf_tra_c3d routine 57 !! 58 !! N.B. User defined include files. By default, 3d and 2d coef. 59 !! are set to a constant value given in the namelist and the 1d 60 !! coefficients are initialized to a hyperbolic tangent vertical 61 !! profile. 62 !!---------------------------------------------------------------------- 63 INTEGER :: ioptio ! temporary integer 64 INTEGER :: ios ! temporary integer 65 LOGICAL :: ll_print = .FALSE. ! =T print eddy coef. in numout 66 !! 67 NAMELIST/namtra_ldf/ ln_traldf_lap , ln_traldf_bilap, & 68 & ln_traldf_level, ln_traldf_hor , ln_traldf_iso, & 69 & ln_traldf_grif , ln_traldf_gdia , & 70 & ln_triad_iso , ln_botmix_grif , & 71 & rn_aht_0 , rn_ahtb_0 , rn_aeiv_0, & 72 & rn_slpmax , rn_chsmag , rn_smsh, & 73 & rn_aht_m 74 !!---------------------------------------------------------------------- 75 76 ! Define the lateral tracer physics parameters 77 ! ============================================= 78 79 99 !! ** Method : * the eddy diffusivity coef. specification depends on: 100 !! 101 !! ln_traldf_lap = T laplacian operator 102 !! ln_traldf_blp = T bilaplacian operator 103 !! 104 !! nn_aht_ijk_t = 0 => = constant 105 !! ! 106 !! = 10 => = F(z) : constant with a reduction of 1/4 with depth 107 !! ! 108 !! =-20 => = F(i,j) = shape read in 'eddy_diffusivity.nc' file 109 !! = 20 = F(i,j) = F(e1,e2) or F(e1^3,e2^3) (lap or bilap case) 110 !! = 21 = F(i,j,t) = F(growth rate of baroclinic instability) 111 !! ! 112 !! =-30 => = F(i,j,k) = shape read in 'eddy_diffusivity.nc' file 113 !! = 30 = F(i,j,k) = 2D (case 20) + decrease with depth (case 10) 114 !! = 31 = F(i,j,k,t) = F(local velocity) ( |u|e /12 laplacian operator 115 !! or |u|e^3/12 bilaplacian operator ) 116 !! * initialisation of the eddy induced velocity coefficient by a call to ldf_eiv_init 117 !! 118 !! ** action : ahtu, ahtv initialized once for all or l_ldftra_time set to true 119 !! aeiu, aeiv initialized once for all or l_ldfeiv_time set to true 120 !!---------------------------------------------------------------------- 121 INTEGER :: jk ! dummy loop indices 122 INTEGER :: ierr, inum, ios ! local integer 123 REAL(wp) :: zah0 ! local scalar 124 ! 125 NAMELIST/namtra_ldf/ ln_traldf_lap, ln_traldf_blp, & ! type of operator 126 & ln_traldf_lev, ln_traldf_hor, ln_traldf_triad, & ! acting direction of the operator 127 & ln_traldf_iso, ln_traldf_msc, & ! option for iso-neutral operator 128 & ln_triad_iso , ln_botmix_triad, rn_slpmax , & ! 129 & rn_aht_0 , rn_bht_0 , nn_aht_ijk_t ! lateral eddy coefficient 130 !!---------------------------------------------------------------------- 131 ! 132 ! Choice of lateral tracer physics 133 ! ================================= 134 ! 80 135 REWIND( numnam_ref ) ! Namelist namtra_ldf in reference namelist : Lateral physics on tracers 81 136 READ ( numnam_ref, namtra_ldf, IOSTAT = ios, ERR = 901) 82 137 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldf in reference namelist', lwp ) 83 138 ! 84 139 REWIND( numnam_cfg ) ! Namelist namtra_ldf in configuration namelist : Lateral physics on tracers 85 140 READ ( numnam_cfg, namtra_ldf, IOSTAT = ios, ERR = 902 ) 86 141 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldf in configuration namelist', lwp ) 87 142 WRITE ( numond, namtra_ldf ) 88 143 ! 89 144 IF(lwp) THEN ! control print 90 145 WRITE(numout,*) … … 92 147 WRITE(numout,*) '~~~~~~~~~~~~ ' 93 148 WRITE(numout,*) ' Namelist namtra_ldf : lateral mixing parameters (type, direction, coefficients)' 94 WRITE(numout,*) ' laplacian operator ln_traldf_lap = ', ln_traldf_lap 95 WRITE(numout,*) ' bilaplacian operator ln_traldf_bilap = ', ln_traldf_bilap 96 WRITE(numout,*) ' iso-level ln_traldf_level = ', ln_traldf_level 97 WRITE(numout,*) ' horizontal (geopotential) ln_traldf_hor = ', ln_traldf_hor 98 WRITE(numout,*) ' iso-neutral ln_traldf_iso = ', ln_traldf_iso 99 WRITE(numout,*) ' iso-neutral (Griffies) ln_traldf_grif = ', ln_traldf_grif 100 WRITE(numout,*) ' Griffies strmfn diagnostics ln_traldf_gdia = ', ln_traldf_gdia 101 WRITE(numout,*) ' lateral eddy diffusivity rn_aht_0 = ', rn_aht_0 102 WRITE(numout,*) ' background hor. diffusivity rn_ahtb_0 = ', rn_ahtb_0 103 WRITE(numout,*) ' eddy induced velocity coef. rn_aeiv_0 = ', rn_aeiv_0 104 WRITE(numout,*) ' maximum isoppycnal slope rn_slpmax = ', rn_slpmax 105 WRITE(numout,*) ' pure lateral mixing in ML ln_triad_iso = ', ln_triad_iso 106 WRITE(numout,*) ' lateral mixing on bottom ln_botmix_grif = ', ln_botmix_grif 149 ! 150 WRITE(numout,*) ' type :' 151 WRITE(numout,*) ' laplacian operator ln_traldf_lap = ', ln_traldf_lap 152 WRITE(numout,*) ' bilaplacian operator ln_traldf_blp = ', ln_traldf_blp 153 ! 154 WRITE(numout,*) ' direction of action :' 155 WRITE(numout,*) ' iso-level ln_traldf_lev = ', ln_traldf_lev 156 WRITE(numout,*) ' horizontal (geopotential) ln_traldf_hor = ', ln_traldf_hor 157 WRITE(numout,*) ' iso-neutral Madec operator ln_traldf_iso = ', ln_traldf_iso 158 WRITE(numout,*) ' iso-neutral triad operator ln_traldf_triad = ', ln_traldf_triad 159 WRITE(numout,*) ' iso-neutral (Method of Stab. Corr.) ln_traldf_msc = ', ln_traldf_msc 160 WRITE(numout,*) ' maximum isoppycnal slope rn_slpmax = ', rn_slpmax 161 WRITE(numout,*) ' pure lateral mixing in ML ln_triad_iso = ', ln_triad_iso 162 WRITE(numout,*) ' lateral mixing on bottom ln_botmix_triad = ', ln_botmix_triad 163 ! 164 WRITE(numout,*) ' coefficients :' 165 WRITE(numout,*) ' lateral eddy diffusivity (lap case) rn_aht_0 = ', rn_aht_0 166 WRITE(numout,*) ' lateral eddy diffusivity (bilap case) rn_bht_0 = ', rn_bht_0 167 WRITE(numout,*) ' type of time-space variation nn_aht_ijk_t = ', nn_aht_ijk_t 168 ENDIF 169 ! 170 ! ! Parameter control 171 ! 172 IF( ln_traldf_blp .AND. ( ln_traldf_iso .OR. ln_traldf_triad) ) THEN ! iso-neutral bilaplacian need MSC 173 IF( .NOT.ln_traldf_msc ) CALL ctl_stop( 'tra_ldf_init: iso-neutral bilaplacian requires ln_traldf_msc=.true.' ) 174 ENDIF 175 ! 176 ! 177 ! Space/time variation of eddy coefficients 178 ! =========================================== 179 ! ! allocate the aht arrays 180 ALLOCATE( ahtu(jpi,jpj,jpk) , ahtv(jpi,jpj,jpk) , STAT=ierr ) 181 IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'ldf_tra_init: failed to allocate arrays') 182 ! 183 ahtu(:,:,jpk) = 0._wp ! last level always 0 184 ahtv(:,:,jpk) = 0._wp 185 ! 186 ! ! value of eddy mixing coef. 187 IF ( ln_traldf_lap ) THEN ; zah0 = rn_aht_0 ! laplacian operator 188 ELSEIF( ln_traldf_blp ) THEN ; zah0 = SQRT( ABS( rn_bht_0 ) ) ! bilaplacian operator 189 ELSE ! NO diffusion/viscosity operator 190 CALL ctl_warn( 'ldf_tra_init: No lateral diffusive operator used ' ) 191 ENDIF 192 ! 193 l_ldftra_time = .FALSE. ! no time variation except in case defined below 194 ! 195 IF( ln_traldf_lap .OR. ln_traldf_blp ) THEN ! only if a lateral diffusion operator is used 196 ! 197 SELECT CASE( nn_aht_ijk_t ) ! Specification of space time variations of ehtu, ahtv 198 ! 199 CASE( 0 ) !== constant ==! 200 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = constant = ', rn_aht_0 201 ahtu(:,:,:) = zah0 * umask(:,:,:) 202 ahtv(:,:,:) = zah0 * vmask(:,:,:) 203 ! 204 CASE( 10 ) !== fixed profile ==! 205 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( depth )' 206 ahtu(:,:,1) = zah0 * umask(:,:,1) ! constant surface value 207 ahtv(:,:,1) = zah0 * vmask(:,:,1) 208 CALL ldf_c1d( 'TRA', r1_4, ahtu(:,:,1), ahtv(:,:,1), ahtu, ahtv ) 209 ! 210 CASE ( -20 ) !== fixed horizontal shape read in file ==! 211 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F(i,j) read in eddy_diffusivity.nc file' 212 CALL iom_open( 'eddy_diffusivity.nc', inum ) 213 CALL iom_get ( inum, jpdom_data, 'ahtu_2D', ahtu(:,:,1) ) 214 CALL iom_get ( inum, jpdom_data, 'ahtv_2D', ahtv(:,:,1) ) 215 CALL iom_close( inum ) 216 DO jk = 2, jpkm1 217 ahtu(:,:,jk) = ahtu(:,:,1) * umask(:,:,jk) 218 ahtv(:,:,jk) = ahtv(:,:,1) * vmask(:,:,jk) 219 END DO 220 ! 221 CASE( 20 ) !== fixed horizontal shape ==! 222 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( e1, e2 ) or F( e1^3, e2^3 ) (lap or blp case)' 223 IF( ln_traldf_lap ) CALL ldf_c2d( 'TRA', 'LAP', zah0, ahtu, ahtv ) ! surface value proportional to scale factor 224 IF( ln_traldf_blp ) CALL ldf_c2d( 'TRA', 'BLP', zah0, ahtu, ahtv ) ! surface value proportional to scale factor 225 ! 226 CASE( 21 ) !== time varying 2D field ==! 227 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( latitude, longitude, time )' 228 IF(lwp) WRITE(numout,*) ' = F( growth rate of baroclinic instability )' 229 IF(lwp) WRITE(numout,*) ' min value = 0.1 * rn_aht_0' 230 IF(lwp) WRITE(numout,*) ' max value = rn_aht_0 (rn_aeiv_0 if nn_aei_ijk_t=21)' 231 IF(lwp) WRITE(numout,*) ' increased to rn_aht_0 within 20N-20S' 232 ! 233 l_ldftra_time = .TRUE. ! will be calculated by call to ldf_tra routine in step.F90 234 ! 235 IF( ln_traldf_blp ) THEN 236 CALL ctl_stop( 'ldf_tra_init: aht=F(growth rate of baroc. insta.) incompatible with bilaplacian operator' ) 237 ENDIF 238 ! 239 CASE( -30 ) !== fixed 3D shape read in file ==! 240 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F(i,j,k) read in eddy_diffusivity.nc file' 241 CALL iom_open( 'eddy_diffusivity.nc', inum ) 242 CALL iom_get ( inum, jpdom_data, 'ahtu_3D', ahtu ) 243 CALL iom_get ( inum, jpdom_data, 'ahtv_3D', ahtv ) 244 CALL iom_close( inum ) 245 DO jk = 1, jpkm1 246 ahtu(:,:,jk) = ahtu(:,:,jk) * umask(:,:,jk) 247 ahtv(:,:,jk) = ahtv(:,:,jk) * vmask(:,:,jk) 248 END DO 249 ! 250 CASE( 30 ) !== fixed 3D shape ==! 251 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( latitude, longitude, depth )' 252 IF( ln_traldf_lap ) CALL ldf_c2d( 'TRA', 'LAP', zah0, ahtu, ahtv ) ! surface value proportional to scale factor 253 IF( ln_traldf_blp ) CALL ldf_c2d( 'TRA', 'BLP', zah0, ahtu, ahtv ) ! surface value proportional to scale factor 254 ! ! reduction with depth 255 CALL ldf_c1d( 'TRA', r1_4, ahtu(:,:,1), ahtv(:,:,1), ahtu, ahtv ) 256 ! 257 CASE( 31 ) !== time varying 3D field ==! 258 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( latitude, longitude, depth , time )' 259 IF(lwp) WRITE(numout,*) ' proportional to the velocity : |u|e/12 or |u|e^3/12' 260 ! 261 l_ldftra_time = .TRUE. ! will be calculated by call to ldf_tra routine in step.F90 262 ! 263 CASE DEFAULT 264 CALL ctl_stop('ldf_tra_init: wrong choice for nn_aht_ijk_t, the type of space-time variation of aht') 265 END SELECT 266 ! 267 ENDIF 268 ! 269 END SUBROUTINE ldf_tra_init 270 271 272 SUBROUTINE ldf_tra( kt ) 273 !!---------------------------------------------------------------------- 274 !! *** ROUTINE ldf_tra *** 275 !! 276 !! ** Purpose : update at kt the tracer lateral mixing coeff. (aht and aeiv) 277 !! 278 !! ** Method : time varying eddy diffusivity coefficients: 279 !! 280 !! nn_aei_ijk_t = 21 aeiu, aeiv = F(i,j,t) = F(growth rate of baroclinic instability) 281 !! with a reduction to 0 in vicinity of the Equator 282 !! nn_aht_ijk_t = 21 ahtu, ahtv = F(i,j,t) = F(growth rate of baroclinic instability) 283 !! 284 !! = 31 ahtu, ahtv = F(i,j,k,t) = F(local velocity) ( |u|e /12 laplacian operator 285 !! or |u|e^3/12 bilaplacian operator ) 286 !! 287 !! ** action : ahtu, ahtv update at each time step 288 !! and/or aeiu, aeiv - - - - 289 !!---------------------------------------------------------------------- 290 INTEGER, INTENT(in) :: kt ! time step 291 ! 292 INTEGER :: ji, jj, jk ! dummy loop indices 293 REAL(wp) :: zaht, zaht_min, z1_f20 ! local scalar 294 !!---------------------------------------------------------------------- 295 ! 296 IF( nn_aei_ijk_t == 21 ) THEN ! eddy induced velocity coefficients 297 ! ! =F(growth rate of baroclinic instability) 298 ! ! max value rn_aeiv_0 ; decreased to 0 within 20N-20S 299 CALL ldf_eiv( kt, rn_aeiv_0, aeiu, aeiv ) 300 IF(lwp .AND. kt<=nit000+20 ) write(numout,*) ' kt , ldf_eiv appel', kt 301 ENDIF 302 ! 303 SELECT CASE( nn_aht_ijk_t ) ! Eddy diffusivity coefficients 304 ! 305 CASE( 21 ) !== time varying 2D field ==! = F( growth rate of baroclinic instability ) 306 ! ! min value rn_aht_0 / 10 307 ! ! max value rn_aht_0 (rn_aeiv_0 if nn_aei_ijk_t=21) 308 ! ! increase to rn_aht_0 within 20N-20S 309 310 311 IF(lwp .AND. kt<=nit000+20 ) write(numout,*) ' kt ,nn_aei_ijk_t, aeiuv max', kt, & 312 & nn_aei_ijk_t, MAXVAL( aeiu(:,:,1) ), MAXVAL( aeiv(:,:,1) ) 313 314 315 IF( nn_aei_ijk_t /= 21 ) THEN 316 CALL ldf_eiv( kt, rn_aht_0, ahtu, ahtv ) 317 IF(lwp .AND. kt<=nit000+20 ) write(numout,*) ' kt , ldf_eiv appel 2', kt 318 ELSE 319 ahtu(:,:,1) = aeiu(:,:,1) 320 ahtv(:,:,1) = aeiv(:,:,1) 321 IF(lwp .AND. kt<=nit000+20 ) write(numout,*) ' kt , ahtu=aeiu', kt 322 ENDIF 323 324 IF(lwp .AND. kt<=nit000+20 ) write(numout,*) ' kt , ahtuv max ', kt, MAXVAL( ahtu(:,:,1) ), MAXVAL( ahtv(:,:,1) ) 325 326 ! 327 z1_f20 = 1._wp / ( 2._wp * omega * SIN( rad * 20._wp ) ) ! 1 / ff(20 degrees) 328 zaht_min = 0.2_wp * rn_aht_0 ! minimum value for aht 329 330 IF(lwp .AND. kt<=nit000+20 ) write(numout,*) ' kt , aht0 et ahtmin', kt, rn_aht_0, zaht_min 331 332 DO jj = 1, jpj 333 DO ji = 1, jpi 334 zaht = ( 1._wp - MIN( 1._wp , ABS( ff(ji,jj) * z1_f20 ) ) ) * ( rn_aht_0 - zaht_min ) 335 !! IF(lwp .AND. kt<=nit000+20 ) write(numout,*) ' avant zaht, ahtuv', zaht, ahtu(ji,jj,1), ahtv(ji,jj,1), zaht_min, ji,jj 336 !! IF(lwp .AND. kt<=nit000+20 ) write(numout,*) ' avant zaht, aeiuv', zaht, aeiu(ji,jj,1), aeiv(ji,jj,1) 337 ahtu(ji,jj,1) = ( MAX( zaht_min, ahtu(ji,jj,1) ) + zaht ) * umask(ji,jj,1) ! min value zaht_min 338 ahtv(ji,jj,1) = ( MAX( zaht_min, ahtv(ji,jj,1) ) + zaht ) * vmask(ji,jj,1) ! increase within 20S-20N 339 !! IF(lwp .AND. kt<=nit000+20 ) write(numout,*) ' zaht et ahtu ahtv', zaht, ahtu(ji,jj,1), ahtv(ji,jj,1) 340 END DO 341 END DO 342 !! IF(lwp ) write(numout,*) ' max ahtu ahtv', MAXVAL( ahtu(:,:,1) ), MAXVAL( ahtv(:,:,1) ) 343 DO jk = 2, jpkm1 ! deeper value = surface value 344 ahtu(:,:,jk) = ahtu(:,:,1) * umask(:,:,jk) 345 ahtv(:,:,jk) = ahtv(:,:,1) * vmask(:,:,jk) 346 END DO 347 ! 348 CASE( 31 ) !== time varying 3D field ==! = F( local velocity ) 349 IF( ln_traldf_lap ) THEN ! laplacian operator 350 DO jk = 1, jpkm1 351 ahtu(:,:,jk) = ABS( ub(:,:,jk) ) * e1u(:,:) * r1_12 352 ahtv(:,:,jk) = ABS( vb(:,:,jk) ) * e2v(:,:) * r1_12 353 END DO 354 ELSEIF( ln_traldf_blp ) THEN ! bilaplacian operator 355 DO jk = 1, jpkm1 356 ahtu(:,:,jk) = SQRT( ABS( ub(:,:,jk) ) * e1u(:,:) * e1u(:,:) * e1u(:,:) * r1_12 ) 357 ahtv(:,:,jk) = SQRT( ABS( vb(:,:,jk) ) * e2v(:,:) * e2v(:,:) * e2v(:,:) * r1_12 ) 358 END DO 359 ENDIF 360 ! 361 END SELECT 362 ! 363 CALL iom_put( "ahtu_2d", ahtu(:,:,1) ) ! surface u-eddy diffusivity coeff. 364 CALL iom_put( "ahtv_2d", ahtv(:,:,1) ) ! surface v-eddy diffusivity coeff. 365 CALL iom_put( "ahtu_3d", ahtu(:,:,:) ) ! 3D u-eddy diffusivity coeff. 366 CALL iom_put( "ahtv_3d", ahtv(:,:,:) ) ! 3D v-eddy diffusivity coeff. 367 ! 368 CALL iom_put( "aeiu_2d", aeiu(:,:,1) ) ! surface u-EIV coeff. 369 CALL iom_put( "aeiv_2d", aeiv(:,:,1) ) ! surface v-EIV coeff. 370 CALL iom_put( "aeiu_3d", aeiu(:,:,:) ) ! 3D u-EIV coeff. 371 CALL iom_put( "aeiv_3d", aeiv(:,:,:) ) ! 3D v-EIV coeff. 372 ! 373 END SUBROUTINE ldf_tra 374 375 376 SUBROUTINE ldf_eiv_init 377 !!---------------------------------------------------------------------- 378 !! *** ROUTINE ldf_eiv_init *** 379 !! 380 !! ** Purpose : initialization of the eiv coeff. from namelist choices. 381 !! 382 !! ** Method : 383 !! 384 !! ** Action : aeiu , aeiv : EIV coeff. at u- & v-points 385 !! l_ldfeiv_time : =T if EIV coefficients vary with time 386 !!---------------------------------------------------------------------- 387 INTEGER :: jk ! dummy loop indices 388 INTEGER :: ierr, inum, ios ! local integer 389 ! 390 NAMELIST/namtra_ldfeiv/ ln_ldfeiv , ln_ldfeiv_dia, & ! eddy induced velocity (eiv) 391 & nn_aei_ijk_t, rn_aeiv_0 ! eiv coefficient 392 !!---------------------------------------------------------------------- 393 ! 394 REWIND( numnam_ref ) ! Namelist namtra_ldfeiv in reference namelist : eddy induced velocity param. 395 READ ( numnam_ref, namtra_ldfeiv, IOSTAT = ios, ERR = 901) 396 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldfeiv in reference namelist', lwp ) 397 ! 398 REWIND( numnam_cfg ) ! Namelist namtra_ldfeiv in configuration namelist : eddy induced velocity param. 399 READ ( numnam_cfg, namtra_ldfeiv, IOSTAT = ios, ERR = 902 ) 400 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldfeiv in configuration namelist', lwp ) 401 WRITE ( numond, namtra_ldfeiv ) 402 403 IF(lwp) THEN ! control print 107 404 WRITE(numout,*) 108 ENDIF 109 110 ! ! convert DOCTOR namelist names into OLD names 111 aht0 = rn_aht_0 112 ahtb0 = rn_ahtb_0 113 aeiv0 = rn_aeiv_0 114 115 ! ! Parameter control 116 117 ! ... Check consistency for type and direction : 118 ! ==> will be done in traldf module 119 120 ! ... Space variation of eddy coefficients 121 ioptio = 0 122 #if defined key_traldf_c3d 123 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( latitude, longitude, depth)' 124 ioptio = ioptio + 1 125 #endif 126 #if defined key_traldf_c2d 127 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( latitude, longitude)' 128 ioptio = ioptio + 1 129 #endif 130 #if defined key_traldf_c1d 131 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( depth )' 132 ioptio = ioptio + 1 133 IF( .NOT. ln_zco ) CALL ctl_stop( 'key_traldf_c1d can only be used in z-coordinate - full step' ) 134 #endif 135 IF( ioptio == 0 ) THEN 136 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = constant (default option)' 137 ELSEIF( ioptio > 1 ) THEN 138 CALL ctl_stop(' use only one of the following keys:', & 139 & ' key_traldf_c3d, key_traldf_c2d, key_traldf_c1d' ) 140 ENDIF 141 142 IF( ln_traldf_bilap ) THEN 143 IF(lwp) WRITE(numout,*) ' biharmonic tracer diffusion' 144 IF( aht0 > 0 .AND. .NOT. lk_esopa ) CALL ctl_stop( 'The horizontal diffusivity coef. aht0 must be negative' ) 405 WRITE(numout,*) 'ldf_eiv_init : eddy induced velocity parametrization' 406 WRITE(numout,*) '~~~~~~~~~~~~ ' 407 WRITE(numout,*) ' Namelist namtra_ldfeiv : ' 408 WRITE(numout,*) ' Eddy Induced Velocity (eiv) param. ln_ldfeiv = ', ln_ldfeiv 409 WRITE(numout,*) ' eiv streamfunction & velocity diag. ln_ldfeiv_dia = ', ln_ldfeiv_dia 410 WRITE(numout,*) ' eddy induced velocity coef. rn_aeiv_0 = ', rn_aeiv_0 411 WRITE(numout,*) ' type of time-space variation nn_aei_ijk_t = ', nn_aei_ijk_t 412 WRITE(numout,*) 413 ENDIF 414 ! 415 IF( ln_traldf_blp ) CALL ctl_stop( 'ldf_eiv_init: bilaplacian and eddy induced velocity are not compatible' ) 416 417 ! ! Parameter control 418 l_ldfeiv_time = .FALSE. 419 ! 420 IF( ln_ldfeiv ) THEN ! allocate the aei arrays 421 ALLOCATE( aeiu(jpi,jpj,jpk), aeiv(jpi,jpj,jpk), STAT=ierr ) 422 IF( ierr /= 0 ) CALL ctl_stop('STOP', 'ldf_eiv: failed to allocate arrays') 423 ! 424 SELECT CASE( nn_aei_ijk_t ) ! Specification of space time variations of eaiu, aeiv 425 ! 426 CASE( 0 ) !== constant ==! 427 IF(lwp) WRITE(numout,*) ' eddy induced velocity coef. = constant = ', rn_aeiv_0 428 aeiu(:,:,:) = rn_aeiv_0 429 aeiv(:,:,:) = rn_aeiv_0 430 ! 431 CASE( 10 ) !== fixed profile ==! 432 IF(lwp) WRITE(numout,*) ' eddy induced velocity coef. = F( depth )' 433 aeiu(:,:,1) = rn_aeiv_0 ! constant surface value 434 aeiv(:,:,1) = rn_aeiv_0 435 CALL ldf_c1d( 'TRA', r1_4, aeiu(:,:,1), aeiv(:,:,1), aeiu, aeiv ) 436 ! 437 CASE ( -20 ) !== fixed horizontal shape read in file ==! 438 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F(i,j) read in eddy_diffusivity_2D.nc file' 439 CALL iom_open ( 'eddy_induced_velocity_2D.nc', inum ) 440 CALL iom_get ( inum, jpdom_data, 'aeiu', aeiu(:,:,1) ) 441 CALL iom_get ( inum, jpdom_data, 'aeiv', aeiv(:,:,1) ) 442 CALL iom_close( inum ) 443 DO jk = 2, jpk 444 aeiu(:,:,jk) = aeiu(:,:,1) 445 aeiv(:,:,jk) = aeiv(:,:,1) 446 END DO 447 ! 448 CASE( 20 ) !== fixed horizontal shape ==! 449 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( e1, e2 ) or F( e1^3, e2^3 ) (lap or bilap case)' 450 CALL ldf_c2d( 'TRA', 'LAP', rn_aeiv_0, aeiu, aeiv ) ! surface value proportional to scale factor 451 ! 452 CASE( 21 ) !== time varying 2D field ==! 453 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( latitude, longitude, time )' 454 IF(lwp) WRITE(numout,*) ' = F( growth rate of baroclinic instability )' 455 ! 456 l_ldfeiv_time = .TRUE. ! will be calculated by call to ldf_tra routine in step.F90 457 ! 458 CASE( -30 ) !== fixed 3D shape read in file ==! 459 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F(i,j,k) read in eddy_diffusivity_3D.nc file' 460 CALL iom_open ( 'eddy_induced_velocity_3D.nc', inum ) 461 CALL iom_get ( inum, jpdom_data, 'aeiu', aeiu ) 462 CALL iom_get ( inum, jpdom_data, 'aeiv', aeiv ) 463 CALL iom_close( inum ) 464 ! 465 CASE( 30 ) !== fixed 3D shape ==! 466 IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( latitude, longitude, depth )' 467 CALL ldf_c2d( 'TRA', 'LAP', rn_aeiv_0, aeiu, aeiv ) ! surface value proportional to scale factor 468 ! ! reduction with depth 469 CALL ldf_c1d( 'TRA', r1_4, aeiu(:,:,1), aeiv(:,:,1), aeiu, aeiv ) 470 ! 471 CASE DEFAULT 472 CALL ctl_stop('ldf_tra_init: wrong choice for nn_aei_ijk_t, the type of space-time variation of aei') 473 END SELECT 474 ! 145 475 ELSE 146 IF(lwp) WRITE(numout,*) ' harmonic tracer diffusion (default)' 147 IF( aht0 < 0 .AND. .NOT. lk_esopa ) CALL ctl_stop('The horizontal diffusivity coef. aht0 must be positive' ) 148 ENDIF 149 150 151 ! Lateral eddy diffusivity and eddy induced velocity coefficients 152 ! ================================================================ 153 #if defined key_traldf_c3d 154 CALL ldf_tra_c3d( ll_print ) ! aht = 3D coef. = F( longitude, latitude, depth ) 155 #elif defined key_traldf_c2d 156 CALL ldf_tra_c2d( ll_print ) ! aht = 2D coef. = F( longitude, latitude ) 157 #elif defined key_traldf_c1d 158 CALL ldf_tra_c1d( ll_print ) ! aht = 1D coef. = F( depth ) 159 #else 160 ! Constant coefficients 161 IF(lwp)WRITE(numout,*) 162 IF(lwp)WRITE(numout,*) ' constant eddy diffusivity coef. ahtu = ahtv = ahtw = aht0 = ', aht0 163 IF( lk_traldf_eiv ) THEN 164 IF(lwp)WRITE(numout,*) ' constant eddy induced velocity coef. aeiu = aeiv = aeiw = aeiv0 = ', aeiv0 476 IF(lwp) WRITE(numout,*) ' eddy induced velocity param is NOT used neither diagnosed' 477 ln_ldfeiv_dia = .FALSE. 478 ENDIF 479 ! 480 END SUBROUTINE ldf_eiv_init 481 482 483 SUBROUTINE ldf_eiv( kt, paei0, paeiu, paeiv ) 484 !!---------------------------------------------------------------------- 485 !! *** ROUTINE ldf_eiv *** 486 !! 487 !! ** Purpose : Compute the eddy induced velocity coefficient from the 488 !! growth rate of baroclinic instability. 489 !! 490 !! ** Method : coefficient function of the growth rate of baroclinic instability 491 !! 492 !! Reference : Treguier et al. JPO 1997 ; Held and Larichev JAS 1996 493 !!---------------------------------------------------------------------- 494 INTEGER , INTENT(in ) :: kt ! ocean time-step index 495 REAL(wp) , INTENT(inout) :: paei0 ! max value [m2/s] 496 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: paeiu, paeiv ! eiv coefficient [m2/s] 497 ! 498 INTEGER :: ji, jj, jk ! dummy loop indices 499 REAL(wp) :: zfw, ze3w, zn2, z1_f20, zaht, zaht_min, zzaei ! local scalars 500 REAL(wp), DIMENSION(:,:), POINTER :: zn, zah, zhw, zross, zaeiw ! 2D workspace 501 !!---------------------------------------------------------------------- 502 ! 503 IF( nn_timing == 1 ) CALL timing_start('ldf_eiv') 504 ! 505 CALL wrk_alloc( jpi,jpj, zn, zah, zhw, zross, zaeiw ) 506 ! 507 zn (:,:) = 0._wp ! Local initialization 508 zhw (:,:) = 5._wp 509 zah (:,:) = 0._wp 510 zross(:,:) = 0._wp 511 ! ! Compute lateral diffusive coefficient at T-point 512 IF( ln_traldf_triad ) THEN 513 DO jk = 1, jpk 514 DO jj = 2, jpjm1 515 DO ji = 2, jpim1 516 ! Take the max of N^2 and zero then take the vertical sum 517 ! of the square root of the resulting N^2 ( required to compute 518 ! internal Rossby radius Ro = .5 * sum_jpk(N) / f 519 zn2 = MAX( rn2b(ji,jj,jk), 0._wp ) 520 zn(ji,jj) = zn(ji,jj) + SQRT( zn2 ) * fse3w(ji,jj,jk) 521 ! Compute elements required for the inverse time scale of baroclinic 522 ! eddies using the isopycnal slopes calculated in ldfslp.F : 523 ! T^-1 = sqrt(m_jpk(N^2*(r1^2+r2^2)*e3w)) 524 ze3w = fse3w(ji,jj,jk) * tmask(ji,jj,jk) 525 zah(ji,jj) = zah(ji,jj) + zn2 * wslp2(ji,jj,jk) * ze3w 526 zhw(ji,jj) = zhw(ji,jj) + ze3w 527 END DO 528 END DO 529 END DO 530 ELSE 531 DO jk = 1, jpk 532 DO jj = 2, jpjm1 533 DO ji = 2, jpim1 534 ! Take the max of N^2 and zero then take the vertical sum 535 ! of the square root of the resulting N^2 ( required to compute 536 ! internal Rossby radius Ro = .5 * sum_jpk(N) / f 537 zn2 = MAX( rn2b(ji,jj,jk), 0._wp ) 538 zn(ji,jj) = zn(ji,jj) + SQRT( zn2 ) * fse3w(ji,jj,jk) 539 ! Compute elements required for the inverse time scale of baroclinic 540 ! eddies using the isopycnal slopes calculated in ldfslp.F : 541 ! T^-1 = sqrt(m_jpk(N^2*(r1^2+r2^2)*e3w)) 542 ze3w = fse3w(ji,jj,jk) * tmask(ji,jj,jk) 543 zah(ji,jj) = zah(ji,jj) + zn2 * ( wslpi(ji,jj,jk) * wslpi(ji,jj,jk) & 544 & + wslpj(ji,jj,jk) * wslpj(ji,jj,jk) ) * ze3w 545 zhw(ji,jj) = zhw(ji,jj) + ze3w 546 END DO 547 END DO 548 END DO 549 END IF 550 551 DO jj = 2, jpjm1 552 DO ji = fs_2, fs_jpim1 ! vector opt. 553 zfw = MAX( ABS( 2. * omega * SIN( rad * gphit(ji,jj) ) ) , 1.e-10 ) 554 ! Rossby radius at w-point taken < 40km and > 2km 555 zross(ji,jj) = MAX( MIN( .4 * zn(ji,jj) / zfw, 40.e3 ), 2.e3 ) 556 ! Compute aeiw by multiplying Ro^2 and T^-1 557 zaeiw(ji,jj) = zross(ji,jj) * zross(ji,jj) * SQRT( zah(ji,jj) / zhw(ji,jj) ) * tmask(ji,jj,1) 558 END DO 559 END DO 560 561 !!gm IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN ! ORCA R2 562 !!gm DO jj = 2, jpjm1 563 !!gm DO ji = fs_2, fs_jpim1 ! vector opt. 564 !!gm ! Take the minimum between aeiw and 1000 m2/s over shelves (depth shallower than 650 m) 565 !!gm IF( mbkt(ji,jj) <= 20 ) zaeiw(ji,jj) = MIN( zaeiw(ji,jj), 1000. ) 566 !!gm END DO 567 !!gm END DO 568 !!gm ENDIF 569 570 ! !== Bound on eiv coeff. ==! 571 z1_f20 = 1._wp / ( 2._wp * omega * sin( rad * 20._wp ) ) 572 DO jj = 2, jpjm1 573 DO ji = fs_2, fs_jpim1 ! vector opt. 574 zzaei = MIN( 1._wp, ABS( ff(ji,jj) * z1_f20 ) ) * zaeiw(ji,jj) ! tropical decrease 575 zaeiw(ji,jj) = MIN( zzaei , paei0 ) ! Max value = paei0 576 END DO 577 END DO 578 CALL lbc_lnk( zaeiw(:,:), 'W', 1. ) ! lateral boundary condition 579 ! 580 DO jj = 2, jpjm1 !== aei at u- and v-points ==! 581 DO ji = fs_2, fs_jpim1 ! vector opt. 582 paeiu(ji,jj,1) = 0.5_wp * ( zaeiw(ji,jj) + zaeiw(ji+1,jj ) ) * umask(ji,jj,1) 583 paeiv(ji,jj,1) = 0.5_wp * ( zaeiw(ji,jj) + zaeiw(ji ,jj+1) ) * vmask(ji,jj,1) 584 END DO 585 END DO 586 CALL lbc_lnk( paeiu(:,:,1), 'U', 1. ) ; CALL lbc_lnk( paeiv(:,:,1), 'V', 1. ) ! lateral boundary condition 587 588 DO jk = 2, jpkm1 !== deeper values equal the surface one ==! 589 paeiu(:,:,jk) = paeiu(:,:,1) * umask(:,:,jk) 590 paeiv(:,:,jk) = paeiv(:,:,1) * vmask(:,:,jk) 591 END DO 592 ! 593 CALL wrk_dealloc( jpi,jpj, zn, zah, zhw, zross, zaeiw ) 594 ! 595 IF( nn_timing == 1 ) CALL timing_stop('ldf_eiv') 596 ! 597 END SUBROUTINE ldf_eiv 598 599 600 SUBROUTINE ldf_eiv_trp( kt, kit000, pun, pvn, pwn, cdtype ) 601 !!---------------------------------------------------------------------- 602 !! *** ROUTINE ldf_eiv_trp *** 603 !! 604 !! ** Purpose : add to the input ocean transport the contribution of 605 !! the eddy induced velocity parametrization. 606 !! 607 !! ** Method : The eddy induced transport is computed from a flux stream- 608 !! function which depends on the slope of iso-neutral surfaces 609 !! (see ldf_slp). For example, in the i-k plan : 610 !! psi_uw = mk(aeiu) e2u mi(wslpi) [in m3/s] 611 !! Utr_eiv = - dk[psi_uw] 612 !! Vtr_eiv = + di[psi_uw] 613 !! ln_traldf_eiv_dia = T : output the associated streamfunction, 614 !! velocity and heat transport (call ldf_eiv_dia) 615 !! 616 !! ** Action : pun, pvn increased by the eiv transport 617 !!---------------------------------------------------------------------- 618 INTEGER , INTENT(in ) :: kt ! ocean time-step index 619 INTEGER , INTENT(in ) :: kit000 ! first time step index 620 CHARACTER(len=3) , INTENT(in ) :: cdtype ! =TRA or TRC (tracer indicator) 621 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pun ! in : 3 ocean transport components [m3/s] 622 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pvn ! out: 3 ocean transport components [m3/s] 623 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pwn ! increased by the eiv [m3/s] 624 !! 625 INTEGER :: ji, jj, jk ! dummy loop indices 626 REAL(wp) :: zuwk, zuwk1, zuwi, zuwi1 ! local scalars 627 REAL(wp) :: zvwk, zvwk1, zvwj, zvwj1 ! - - 628 REAL(wp), POINTER, DIMENSION(:,:,:) :: zpsi_uw, zpsi_vw 629 !!---------------------------------------------------------------------- 630 ! 631 IF( nn_timing == 1 ) CALL timing_start( 'ldf_eiv_trp') 632 ! 633 CALL wrk_alloc( jpi, jpj, jpk, zpsi_uw, zpsi_vw ) 634 635 IF( kt == kit000 ) THEN 636 IF(lwp) WRITE(numout,*) 637 IF(lwp) WRITE(numout,*) 'ldf_eiv_trp : eddy induced advection on ', cdtype,' :' 638 IF(lwp) WRITE(numout,*) '~~~~~~~~~~~ add to velocity fields the eiv component' 639 ENDIF 640 165 641 166 ENDIF 167 #endif 168 169 #if defined key_traldf_smag && ! defined key_traldf_c3d 170 CALL ctl_stop( 'key_traldf_smag can only be used with key_traldf_c3d' ) 171 #endif 172 #if defined key_traldf_smag 173 IF(lwp) WRITE(numout,*)' SMAGORINSKY DIFFUSION' 174 IF(lwp .AND. rn_smsh < 1) WRITE(numout,*)' only shear is used ' 175 IF(lwp.and.ln_traldf_bilap) CALL ctl_stop(' SMAGORINSKY + BILAPLACIAN - UNSTABLE OR NON_CONSERVATIVE' ) 176 #endif 177 178 ! 179 END SUBROUTINE ldf_tra_init 180 181 #if defined key_traldf_c3d 182 # include "ldftra_c3d.h90" 183 #elif defined key_traldf_c2d 184 # include "ldftra_c2d.h90" 185 #elif defined key_traldf_c1d 186 # include "ldftra_c1d.h90" 187 #endif 642 zpsi_uw(:,:, 1 ) = 0._wp ; zpsi_vw(:,:, 1 ) = 0._wp 643 zpsi_uw(:,:,jpk) = 0._wp ; zpsi_vw(:,:,jpk) = 0._wp 644 645 DO jk = 2, jpkm1 646 DO jj = 1, jpjm1 647 DO ji = 1, fs_jpim1 ! vector opt. 648 zpsi_uw(ji,jj,jk) = - 0.25_wp * e2u(ji,jj) * ( wslpi(ji,jj,jk ) + wslpi(ji+1,jj,jk) ) & 649 & * ( aeiu (ji,jj,jk-1) + aeiu (ji ,jj,jk) ) * umask(ji,jj,jk) 650 zpsi_vw(ji,jj,jk) = - 0.25_wp * e1v(ji,jj) * ( wslpj(ji,jj,jk ) + wslpj(ji,jj+1,jk) ) & 651 & * ( aeiv (ji,jj,jk-1) + aeiv (ji,jj ,jk) ) * vmask(ji,jj,jk) 652 END DO 653 END DO 654 END DO 655 656 DO jk = 1, jpkm1 657 DO jj = 1, jpjm1 658 DO ji = 1, fs_jpim1 ! vector opt. 659 pun(ji,jj,jk) = pun(ji,jj,jk) - ( zpsi_uw(ji,jj,jk) - zpsi_uw(ji,jj,jk+1) ) 660 pvn(ji,jj,jk) = pvn(ji,jj,jk) - ( zpsi_vw(ji,jj,jk) - zpsi_vw(ji,jj,jk+1) ) 661 END DO 662 END DO 663 END DO 664 DO jk = 1, jpkm1 665 DO jj = 2, jpjm1 666 DO ji = fs_2, fs_jpim1 ! vector opt. 667 pwn(ji,jj,jk) = pwn(ji,jj,jk) + ( zpsi_uw(ji,jj,jk) - zpsi_uw(ji-1,jj ,jk) & 668 & + zpsi_vw(ji,jj,jk) - zpsi_vw(ji ,jj-1,jk) ) 669 END DO 670 END DO 671 END DO 672 673 ! ! diagnose the eddy induced velocity and associated heat transport 674 IF( ln_ldfeiv_dia .AND. cdtype == 'TRA' ) CALL ldf_eiv_dia( zpsi_uw, zpsi_vw ) 675 ! 676 IF( nn_timing == 1 ) CALL timing_stop( 'ldf_eiv_trp') 677 ! 678 END SUBROUTINE ldf_eiv_trp 679 680 681 SUBROUTINE ldf_eiv_dia( psi_uw, psi_vw ) 682 !!---------------------------------------------------------------------- 683 !! *** ROUTINE ldf_eiv_dia *** 684 !! 685 !! ** Purpose : diagnose the eddy induced velocity and its associated 686 !! vertically integrated heat transport. 687 !! 688 !! ** Method : 689 !! 690 !!---------------------------------------------------------------------- 691 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: psi_uw, psi_vw ! streamfunction [m3/s] 692 ! 693 INTEGER :: ji, jj, jk ! dummy loop indices 694 REAL(wp) :: zztmp ! local scalar 695 REAL(wp), DIMENSION(:,:) , POINTER :: zw2d ! 2D workspace 696 REAL(wp), DIMENSION(:,:,:), POINTER :: zw3d ! 3D workspace 697 !!---------------------------------------------------------------------- 698 ! 699 IF( nn_timing == 1 ) CALL timing_start( 'ldf_eiv_dia') 700 ! 701 ! !== eiv stream function: output ==! 702 CALL lbc_lnk( psi_uw, 'U', -1. ) ! lateral boundary condition 703 CALL lbc_lnk( psi_vw, 'V', -1. ) 704 ! 705 !!gm CALL iom_put( "psi_eiv_uw", psi_uw ) ! output 706 !!gm CALL iom_put( "psi_eiv_vw", psi_vw ) 707 ! 708 ! !== eiv velocities: calculate and output ==! 709 CALL wrk_alloc( jpi, jpj, jpk, zw3d ) 710 ! 711 zw3d(:,:,jpk) = 0._wp ! bottom value always 0 712 ! 713 DO jk = 1, jpkm1 ! e2u e3u u_eiv = -dk[psi_uw] 714 zw3d(:,:,jk) = ( psi_uw(:,:,jk+1) - psi_uw(:,:,jk) ) / ( e2u(:,:) * fse3u(:,:,jk) ) 715 END DO 716 CALL iom_put( "uoce_eiv", zw3d ) 717 ! 718 DO jk = 1, jpkm1 ! e1v e3v v_eiv = -dk[psi_vw] 719 zw3d(:,:,jk) = ( psi_vw(:,:,jk+1) - psi_vw(:,:,jk) ) / ( e1v(:,:) * fse3v(:,:,jk) ) 720 END DO 721 CALL iom_put( "voce_eiv", zw3d ) 722 ! 723 DO jk = 1, jpkm1 ! e1 e2 w_eiv = dk[psix] + dk[psix] 724 DO jj = 2, jpjm1 725 DO ji = fs_2, fs_jpim1 ! vector opt. 726 zw3d(ji,jj,jk) = ( psi_vw(ji,jj,jk) - psi_vw(ji ,jj-1,jk) & 727 & + psi_uw(ji,jj,jk) - psi_uw(ji-1,jj ,jk) ) / e1e2t(ji,jj) 728 END DO 729 END DO 730 END DO 731 CALL lbc_lnk( zw3d, 'T', 1. ) ! lateral boundary condition 732 CALL iom_put( "woce_eiv", zw3d ) 733 ! 734 CALL wrk_dealloc( jpi, jpj, jpk, zw3d ) 735 ! 736 ! 737 IF( lk_diaar5 ) THEN !== eiv heat transport: calculate and output ==! 738 CALL wrk_alloc( jpi, jpj, zw2d ) 739 ! 740 zztmp = 0.5_wp * rau0 * rcp 741 zw2d(:,:) = 0._wp 742 DO jk = 1, jpkm1 743 DO jj = 2, jpjm1 744 DO ji = fs_2, fs_jpim1 ! vector opt. 745 zw2d(ji,jj) = zw2d(ji,jj) + zztmp * ( psi_uw(ji,jj,jk+1) - psi_uw(ji,jj,jk) ) & 746 & * ( tsn (ji,jj,jk,jp_tem) + tsn (ji+1,jj,jk,jp_tem) ) 747 END DO 748 END DO 749 END DO 750 CALL lbc_lnk( zw2d, 'U', -1. ) 751 CALL iom_put( "ueiv_heattr", zw2d ) ! heat transport in i-direction 752 zw2d(:,:) = 0._wp 753 DO jk = 1, jpkm1 754 DO jj = 2, jpjm1 755 DO ji = fs_2, fs_jpim1 ! vector opt. 756 zw2d(ji,jj) = zw2d(ji,jj) + zztmp * ( psi_vw(ji,jj,jk+1) - psi_vw(ji,jj,jk) ) & 757 & * ( tsn (ji,jj,jk,jp_tem) + tsn (ji,jj+1,jk,jp_tem) ) 758 END DO 759 END DO 760 END DO 761 CALL lbc_lnk( zw2d, 'V', -1. ) 762 CALL iom_put( "veiv_heattr", zw2d ) ! heat transport in i-direction 763 ! 764 CALL wrk_dealloc( jpi, jpj, zw2d ) 765 ENDIF 766 ! 767 IF( nn_timing == 1 ) CALL timing_stop( 'ldf_eiv_dia') 768 ! 769 END SUBROUTINE ldf_eiv_dia 188 770 189 771 !!======================================================================
Note: See TracChangeset
for help on using the changeset viewer.