[941] | 1 | MODULE trcdmp |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE trcdmp *** |
---|
| 4 | !! Ocean physics: internal restoring trend on passive tracers |
---|
| 5 | !!====================================================================== |
---|
[2528] | 6 | !! History : OPA ! 1991-03 (O. Marti, G. Madec) Original code |
---|
| 7 | !! ! 1996-01 (G. Madec) statement function for e3 |
---|
| 8 | !! ! 1997-05 (H. Loukos) adapted for passive tracers |
---|
| 9 | !! NEMO 9.0 ! 2004-03 (C. Ethe) free form + modules |
---|
| 10 | !! 3.2 ! 2007-02 (C. Deltel) Diagnose ML trends for passive tracers |
---|
| 11 | !! 3.3 ! 2010-06 (C. Ethe, G. Madec) merge TRA-TRC |
---|
[941] | 12 | !!---------------------------------------------------------------------- |
---|
[4148] | 13 | #if defined key_top |
---|
[941] | 14 | !!---------------------------------------------------------------------- |
---|
| 15 | !! trc_dmp : update the tracer trend with the internal damping |
---|
| 16 | !! trc_dmp_init : initialization, namlist read, parameters control |
---|
| 17 | !!---------------------------------------------------------------------- |
---|
| 18 | USE oce_trc ! ocean dynamics and tracers variables |
---|
[1175] | 19 | USE trc ! ocean passive tracers variables |
---|
[2528] | 20 | USE trcnam_trp ! passive tracers transport namelist variables |
---|
[941] | 21 | USE trcdta |
---|
[2528] | 22 | USE tradmp |
---|
[941] | 23 | USE prtctl_trc ! Print control for debbuging |
---|
[2528] | 24 | USE trdtra |
---|
[4990] | 25 | USE trd_oce |
---|
[5682] | 26 | USE iom |
---|
[941] | 27 | |
---|
| 28 | IMPLICIT NONE |
---|
| 29 | PRIVATE |
---|
| 30 | |
---|
[2715] | 31 | PUBLIC trc_dmp ! routine called by step.F90 |
---|
[4148] | 32 | PUBLIC trc_dmp_clo ! routine called by step.F90 |
---|
[2715] | 33 | PUBLIC trc_dmp_alloc ! routine called by nemogcm.F90 |
---|
[941] | 34 | |
---|
[4148] | 35 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: restotr ! restoring coeff. on tracers (s-1) |
---|
[2715] | 36 | |
---|
[4148] | 37 | INTEGER, PARAMETER :: npncts = 5 ! number of closed sea |
---|
| 38 | INTEGER, DIMENSION(npncts) :: nctsi1, nctsj1 ! south-west closed sea limits (i,j) |
---|
| 39 | INTEGER, DIMENSION(npncts) :: nctsi2, nctsj2 ! north-east closed sea limits (i,j) |
---|
[941] | 40 | |
---|
| 41 | !! * Substitutions |
---|
| 42 | # include "top_substitute.h90" |
---|
| 43 | !!---------------------------------------------------------------------- |
---|
[2528] | 44 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[7776] | 45 | !! $Id$ |
---|
[2715] | 46 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[941] | 47 | !!---------------------------------------------------------------------- |
---|
| 48 | CONTAINS |
---|
| 49 | |
---|
[2715] | 50 | INTEGER FUNCTION trc_dmp_alloc() |
---|
| 51 | !!---------------------------------------------------------------------- |
---|
| 52 | !! *** ROUTINE trc_dmp_alloc *** |
---|
| 53 | !!---------------------------------------------------------------------- |
---|
| 54 | ALLOCATE( restotr(jpi,jpj,jpk) , STAT=trc_dmp_alloc ) |
---|
| 55 | ! |
---|
| 56 | IF( trc_dmp_alloc /= 0 ) CALL ctl_warn('trc_dmp_alloc: failed to allocate array') |
---|
| 57 | ! |
---|
| 58 | END FUNCTION trc_dmp_alloc |
---|
| 59 | |
---|
| 60 | |
---|
[941] | 61 | SUBROUTINE trc_dmp( kt ) |
---|
| 62 | !!---------------------------------------------------------------------- |
---|
| 63 | !! *** ROUTINE trc_dmp *** |
---|
| 64 | !! |
---|
| 65 | !! ** Purpose : Compute the passive tracer trend due to a newtonian damping |
---|
| 66 | !! of the tracer field towards given data field and add it to the |
---|
| 67 | !! general tracer trends. |
---|
| 68 | !! |
---|
| 69 | !! ** Method : Newtonian damping towards trdta computed |
---|
| 70 | !! and add to the general tracer trends: |
---|
| 71 | !! trn = tra + restotr * (trdta - trb) |
---|
| 72 | !! The trend is computed either throughout the water column |
---|
| 73 | !! (nlmdmptr=0) or in area of weak vertical mixing (nlmdmptr=1) or |
---|
| 74 | !! below the well mixed layer (nlmdmptr=2) |
---|
| 75 | !! |
---|
| 76 | !! ** Action : - update the tracer trends tra with the newtonian |
---|
| 77 | !! damping trends. |
---|
[4990] | 78 | !! - save the trends ('key_trdmxl_trc') |
---|
[1175] | 79 | !!---------------------------------------------------------------------- |
---|
[941] | 80 | !! |
---|
| 81 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[2528] | 82 | !! |
---|
[4148] | 83 | INTEGER :: ji, jj, jk, jn, jl ! dummy loop indices |
---|
[2528] | 84 | REAL(wp) :: ztra ! temporary scalars |
---|
[941] | 85 | CHARACTER (len=22) :: charout |
---|
[3294] | 86 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd |
---|
[4230] | 87 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrcdta ! 3D workspace |
---|
[941] | 88 | !!---------------------------------------------------------------------- |
---|
[3294] | 89 | ! |
---|
| 90 | IF( nn_timing == 1 ) CALL timing_start('trc_dmp') |
---|
| 91 | ! |
---|
[941] | 92 | ! 0. Initialization (first time-step only) |
---|
| 93 | ! -------------- |
---|
[3294] | 94 | IF( kt == nittrc000 ) CALL trc_dmp_init |
---|
[941] | 95 | |
---|
[3294] | 96 | IF( l_trdtrc ) CALL wrk_alloc( jpi, jpj, jpk, ztrtrd ) ! temporary save of trends |
---|
[4148] | 97 | ! |
---|
| 98 | IF( nb_trcdta > 0 ) THEN ! Initialisation of tracer from a file that may also be used for damping |
---|
| 99 | ! |
---|
[4230] | 100 | CALL wrk_alloc( jpi, jpj, jpk, ztrcdta ) ! Memory allocation |
---|
[4148] | 101 | ! ! =========== |
---|
| 102 | DO jn = 1, jptra ! tracer loop |
---|
| 103 | ! ! =========== |
---|
| 104 | IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn) ! save trends |
---|
| 105 | ! |
---|
| 106 | IF( ln_trc_ini(jn) ) THEN ! update passive tracers arrays with input data read from file |
---|
| 107 | |
---|
| 108 | jl = n_trc_index(jn) |
---|
[4230] | 109 | CALL trc_dta( kt, sf_trcdta(jl),rf_trfac(jl) ) ! read tracer data at nit000 |
---|
| 110 | ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:) |
---|
[1175] | 111 | |
---|
[4148] | 112 | SELECT CASE ( nn_zdmp_tr ) |
---|
| 113 | ! |
---|
| 114 | CASE( 0 ) !== newtonian damping throughout the water column ==! |
---|
| 115 | DO jk = 1, jpkm1 |
---|
| 116 | DO jj = 2, jpjm1 |
---|
| 117 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[4230] | 118 | ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) |
---|
[4148] | 119 | tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra |
---|
| 120 | END DO |
---|
[941] | 121 | END DO |
---|
| 122 | END DO |
---|
[4148] | 123 | ! |
---|
| 124 | CASE ( 1 ) !== no damping in the turbocline (avt > 5 cm2/s) ==! |
---|
| 125 | DO jk = 1, jpkm1 |
---|
| 126 | DO jj = 2, jpjm1 |
---|
| 127 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[5682] | 128 | IF( avt(ji,jj,jk) <= 5.e-4_wp ) THEN |
---|
[4230] | 129 | ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) |
---|
[4148] | 130 | tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra |
---|
| 131 | ENDIF |
---|
| 132 | END DO |
---|
[941] | 133 | END DO |
---|
| 134 | END DO |
---|
[4148] | 135 | ! |
---|
| 136 | CASE ( 2 ) !== no damping in the mixed layer ==! |
---|
| 137 | DO jk = 1, jpkm1 |
---|
| 138 | DO jj = 2, jpjm1 |
---|
| 139 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
| 140 | IF( fsdept(ji,jj,jk) >= hmlp (ji,jj) ) THEN |
---|
[4230] | 141 | ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) |
---|
[4148] | 142 | tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra |
---|
| 143 | END IF |
---|
| 144 | END DO |
---|
[941] | 145 | END DO |
---|
| 146 | END DO |
---|
[4148] | 147 | ! |
---|
| 148 | END SELECT |
---|
| 149 | ! |
---|
| 150 | ENDIF |
---|
| 151 | ! |
---|
| 152 | IF( l_trdtrc ) THEN |
---|
| 153 | ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:) |
---|
[4990] | 154 | CALL trd_tra( kt, 'TRC', jn, jptra_dmp, ztrtrd ) |
---|
[4148] | 155 | END IF |
---|
| 156 | ! ! =========== |
---|
| 157 | END DO ! tracer loop |
---|
| 158 | ! ! =========== |
---|
[4230] | 159 | CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta ) |
---|
[4148] | 160 | ENDIF |
---|
| 161 | ! |
---|
[3294] | 162 | IF( l_trdtrc ) CALL wrk_dealloc( jpi, jpj, jpk, ztrtrd ) |
---|
[2528] | 163 | ! ! print mean trends (used for debugging) |
---|
| 164 | IF( ln_ctl ) THEN |
---|
| 165 | WRITE(charout, FMT="('dmp ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 166 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[941] | 167 | ENDIF |
---|
[2528] | 168 | ! |
---|
[3294] | 169 | IF( nn_timing == 1 ) CALL timing_stop('trc_dmp') |
---|
| 170 | ! |
---|
[941] | 171 | END SUBROUTINE trc_dmp |
---|
| 172 | |
---|
[4148] | 173 | SUBROUTINE trc_dmp_clo( kt ) |
---|
| 174 | !!--------------------------------------------------------------------- |
---|
| 175 | !! *** ROUTINE trc_dmp_clo *** |
---|
| 176 | !! |
---|
| 177 | !! ** Purpose : Closed sea domain initialization |
---|
| 178 | !! |
---|
| 179 | !! ** Method : if a closed sea is located only in a model grid point |
---|
| 180 | !! we restore to initial data |
---|
| 181 | !! |
---|
| 182 | !! ** Action : nctsi1(), nctsj1() : south-west closed sea limits (i,j) |
---|
| 183 | !! nctsi2(), nctsj2() : north-east Closed sea limits (i,j) |
---|
| 184 | !!---------------------------------------------------------------------- |
---|
| 185 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 186 | ! |
---|
[5682] | 187 | INTEGER :: ji , jj, jk, jn, jl, jc ! dummy loop indicesa |
---|
| 188 | INTEGER :: isrow ! local index |
---|
[4230] | 189 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrcdta ! 3D workspace |
---|
[941] | 190 | |
---|
[4148] | 191 | !!---------------------------------------------------------------------- |
---|
| 192 | |
---|
| 193 | IF( kt == nit000 ) THEN |
---|
| 194 | ! initial values |
---|
| 195 | nctsi1(:) = 1 ; nctsi2(:) = 1 |
---|
| 196 | nctsj1(:) = 1 ; nctsj2(:) = 1 |
---|
| 197 | |
---|
| 198 | ! set the closed seas (in data domain indices) |
---|
| 199 | ! ------------------- |
---|
| 200 | |
---|
| 201 | IF( cp_cfg == "orca" ) THEN |
---|
| 202 | ! |
---|
| 203 | SELECT CASE ( jp_cfg ) |
---|
| 204 | ! ! ======================= |
---|
[5682] | 205 | CASE ( 1 ) ! eORCA_R1 configuration |
---|
| 206 | ! ! ======================= |
---|
| 207 | isrow = 332 - jpjglo |
---|
| 208 | ! |
---|
| 209 | ! Caspian Sea |
---|
| 210 | nctsi1(1) = 332 ; nctsj1(1) = 243 - isrow |
---|
| 211 | nctsi2(1) = 344 ; nctsj2(1) = 275 - isrow |
---|
| 212 | ! |
---|
| 213 | ! ! ======================= |
---|
[4148] | 214 | CASE ( 2 ) ! ORCA_R2 configuration |
---|
| 215 | ! ! ======================= |
---|
| 216 | ! ! Caspian Sea |
---|
| 217 | nctsi1(1) = 11 ; nctsj1(1) = 103 |
---|
| 218 | nctsi2(1) = 17 ; nctsj2(1) = 112 |
---|
| 219 | ! ! Great North American Lakes |
---|
| 220 | nctsi1(2) = 97 ; nctsj1(2) = 107 |
---|
| 221 | nctsi2(2) = 103 ; nctsj2(2) = 111 |
---|
| 222 | ! ! Black Sea 1 : west part of the Black Sea |
---|
| 223 | nctsi1(3) = 174 ; nctsj1(3) = 107 |
---|
| 224 | nctsi2(3) = 181 ; nctsj2(3) = 112 |
---|
| 225 | ! ! Black Sea 2 : est part of the Black Sea |
---|
| 226 | nctsi1(4) = 2 ; nctsj1(4) = 107 |
---|
| 227 | nctsi2(4) = 6 ; nctsj2(4) = 112 |
---|
| 228 | ! ! Baltic Sea |
---|
| 229 | nctsi1(5) = 145 ; nctsj1(5) = 116 |
---|
| 230 | nctsi2(5) = 150 ; nctsj2(5) = 126 |
---|
| 231 | ! ! ======================= |
---|
| 232 | CASE ( 4 ) ! ORCA_R4 configuration |
---|
| 233 | ! ! ======================= |
---|
| 234 | ! ! Caspian Sea |
---|
| 235 | nctsi1(1) = 4 ; nctsj1(1) = 53 |
---|
| 236 | nctsi2(1) = 4 ; nctsj2(1) = 56 |
---|
| 237 | ! ! Great North American Lakes |
---|
| 238 | nctsi1(2) = 49 ; nctsj1(2) = 55 |
---|
| 239 | nctsi2(2) = 51 ; nctsj2(2) = 56 |
---|
| 240 | ! ! Black Sea |
---|
| 241 | nctsi1(3) = 88 ; nctsj1(3) = 55 |
---|
| 242 | nctsi2(3) = 91 ; nctsj2(3) = 56 |
---|
| 243 | ! ! Baltic Sea |
---|
| 244 | nctsi1(4) = 75 ; nctsj1(4) = 59 |
---|
| 245 | nctsi2(4) = 76 ; nctsj2(4) = 61 |
---|
| 246 | ! ! ======================= |
---|
| 247 | CASE ( 025 ) ! ORCA_R025 configuration |
---|
| 248 | ! ! ======================= |
---|
| 249 | ! Caspian + Aral sea |
---|
| 250 | nctsi1(1) = 1330 ; nctsj1(1) = 645 |
---|
| 251 | nctsi2(1) = 1400 ; nctsj2(1) = 795 |
---|
| 252 | ! ! Azov Sea |
---|
| 253 | nctsi1(2) = 1284 ; nctsj1(2) = 722 |
---|
| 254 | nctsi2(2) = 1304 ; nctsj2(2) = 747 |
---|
| 255 | ! |
---|
| 256 | END SELECT |
---|
| 257 | ! |
---|
| 258 | ENDIF |
---|
| 259 | ! |
---|
| 260 | |
---|
| 261 | ! convert the position in local domain indices |
---|
| 262 | ! -------------------------------------------- |
---|
| 263 | DO jc = 1, npncts |
---|
| 264 | nctsi1(jc) = mi0( nctsi1(jc) ) |
---|
| 265 | nctsj1(jc) = mj0( nctsj1(jc) ) |
---|
| 266 | |
---|
| 267 | nctsi2(jc) = mi1( nctsi2(jc) ) |
---|
| 268 | nctsj2(jc) = mj1( nctsj2(jc) ) |
---|
| 269 | END DO |
---|
| 270 | ! |
---|
| 271 | ENDIF |
---|
| 272 | |
---|
| 273 | ! Restore close seas values to initial data |
---|
| 274 | IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN ! Initialisation of tracer from a file that may also be used for damping |
---|
| 275 | ! |
---|
| 276 | IF(lwp) WRITE(numout,*) |
---|
| 277 | IF(lwp) WRITE(numout,*) ' trc_dmp_clo : Restoring of nutrients on close seas at time-step kt = ', kt |
---|
| 278 | IF(lwp) WRITE(numout,*) |
---|
| 279 | ! |
---|
[4230] | 280 | CALL wrk_alloc( jpi, jpj, jpk, ztrcdta ) ! Memory allocation |
---|
[4148] | 281 | ! |
---|
| 282 | DO jn = 1, jptra |
---|
| 283 | IF( ln_trc_ini(jn) ) THEN ! update passive tracers arrays with input data read from file |
---|
| 284 | jl = n_trc_index(jn) |
---|
[4230] | 285 | CALL trc_dta( kt, sf_trcdta(jl),rf_trfac(jl) ) ! read tracer data at nit000 |
---|
| 286 | ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:) |
---|
[4148] | 287 | DO jc = 1, npncts |
---|
| 288 | DO jk = 1, jpkm1 |
---|
| 289 | DO jj = nctsj1(jc), nctsj2(jc) |
---|
| 290 | DO ji = nctsi1(jc), nctsi2(jc) |
---|
[4230] | 291 | trn(ji,jj,jk,jn) = ztrcdta(ji,jj,jk) * tmask(ji,jj,jk) |
---|
[4148] | 292 | trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn) |
---|
| 293 | ENDDO |
---|
| 294 | ENDDO |
---|
| 295 | ENDDO |
---|
| 296 | ENDDO |
---|
| 297 | ENDIF |
---|
| 298 | ENDDO |
---|
[4230] | 299 | CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta ) |
---|
[4148] | 300 | ENDIF |
---|
| 301 | ! |
---|
| 302 | END SUBROUTINE trc_dmp_clo |
---|
| 303 | |
---|
| 304 | |
---|
[941] | 305 | SUBROUTINE trc_dmp_init |
---|
| 306 | !!---------------------------------------------------------------------- |
---|
| 307 | !! *** ROUTINE trc_dmp_init *** |
---|
| 308 | !! |
---|
| 309 | !! ** Purpose : Initialization for the newtonian damping |
---|
| 310 | !! |
---|
| 311 | !! ** Method : read the nammbf namelist and check the parameters |
---|
[3294] | 312 | !! called by trc_dmp at the first timestep (nittrc000) |
---|
[941] | 313 | !!---------------------------------------------------------------------- |
---|
[3294] | 314 | ! |
---|
[5682] | 315 | INTEGER :: imask !local file handle |
---|
| 316 | |
---|
[3294] | 317 | IF( nn_timing == 1 ) CALL timing_start('trc_dmp_init') |
---|
| 318 | ! |
---|
[941] | 319 | |
---|
[4359] | 320 | IF( lzoom ) nn_zdmp_tr = 0 ! restoring to climatology at closed north or south boundaries |
---|
[2528] | 321 | SELECT CASE ( nn_zdmp_tr ) |
---|
| 322 | CASE ( 0 ) ; IF(lwp) WRITE(numout,*) ' tracer damping throughout the water column' |
---|
| 323 | CASE ( 1 ) ; IF(lwp) WRITE(numout,*) ' no tracer damping in the turbocline (avt > 5 cm2/s)' |
---|
| 324 | CASE ( 2 ) ; IF(lwp) WRITE(numout,*) ' no tracer damping in the mixed layer' |
---|
[941] | 325 | CASE DEFAULT |
---|
[2528] | 326 | WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr |
---|
[941] | 327 | CALL ctl_stop(ctmp1) |
---|
| 328 | END SELECT |
---|
| 329 | |
---|
[4148] | 330 | IF( .NOT. ln_tradmp ) & |
---|
[2528] | 331 | & CALL ctl_stop( 'passive trace damping need key_tradmp to compute damping coef.' ) |
---|
| 332 | ! |
---|
[5682] | 333 | ! ! Read damping coefficients from file |
---|
| 334 | !Read in mask from file |
---|
| 335 | CALL iom_open ( cn_resto_tr, imask) |
---|
| 336 | CALL iom_get ( imask, jpdom_autoglo, 'resto', restotr) |
---|
| 337 | CALL iom_close( imask ) |
---|
[2528] | 338 | ! |
---|
[3294] | 339 | IF( nn_timing == 1 ) CALL timing_stop('trc_dmp_init') |
---|
| 340 | ! |
---|
[941] | 341 | END SUBROUTINE trc_dmp_init |
---|
[4148] | 342 | |
---|
[941] | 343 | #else |
---|
| 344 | !!---------------------------------------------------------------------- |
---|
[4148] | 345 | !! Dummy module : No passive tracer |
---|
[941] | 346 | !!---------------------------------------------------------------------- |
---|
| 347 | CONTAINS |
---|
| 348 | SUBROUTINE trc_dmp( kt ) ! Empty routine |
---|
| 349 | INTEGER, INTENT(in) :: kt |
---|
| 350 | WRITE(*,*) 'trc_dmp: You should not have seen this print! error?', kt |
---|
| 351 | END SUBROUTINE trc_dmp |
---|
| 352 | #endif |
---|
[4148] | 353 | |
---|
| 354 | |
---|
[941] | 355 | !!====================================================================== |
---|
| 356 | END MODULE trcdmp |
---|