[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 | !!---------------------------------------------------------------------- |
---|
[1175] | 13 | #if defined key_top && defined key_trcdmp |
---|
[941] | 14 | !!---------------------------------------------------------------------- |
---|
[1175] | 15 | !! key_trcdmp internal damping |
---|
| 16 | !!---------------------------------------------------------------------- |
---|
[941] | 17 | !! trc_dmp : update the tracer trend with the internal damping |
---|
| 18 | !! trc_dmp_init : initialization, namlist read, parameters control |
---|
| 19 | !!---------------------------------------------------------------------- |
---|
| 20 | USE oce_trc ! ocean dynamics and tracers variables |
---|
[1175] | 21 | USE trc ! ocean passive tracers variables |
---|
[2528] | 22 | USE trcnam_trp ! passive tracers transport namelist variables |
---|
[941] | 23 | USE trcdta |
---|
[2528] | 24 | USE tradmp |
---|
[941] | 25 | USE prtctl_trc ! Print control for debbuging |
---|
[2528] | 26 | USE trdtra |
---|
[941] | 27 | |
---|
| 28 | IMPLICIT NONE |
---|
| 29 | PRIVATE |
---|
| 30 | |
---|
[2715] | 31 | PUBLIC trc_dmp ! routine called by step.F90 |
---|
| 32 | PUBLIC trc_dmp_alloc ! routine called by nemogcm.F90 |
---|
[941] | 33 | |
---|
[1175] | 34 | LOGICAL , PUBLIC, PARAMETER :: lk_trcdmp = .TRUE. !: internal damping flag |
---|
[2715] | 35 | |
---|
| 36 | ! !!* Namelist namtrc_dmp : passive tracer newtonian damping * |
---|
[2528] | 37 | INTEGER :: nn_hdmp_tr = -1 ! = 0/-1/'latitude' for damping over passive tracer |
---|
| 38 | INTEGER :: nn_zdmp_tr = 0 ! = 0/1/2 flag for damping in the mixed layer |
---|
| 39 | REAL(wp) :: rn_surf_tr = 50. ! surface time scale for internal damping [days] |
---|
| 40 | REAL(wp) :: rn_bot_tr = 360. ! bottom time scale for internal damping [days] |
---|
| 41 | REAL(wp) :: rn_dep_tr = 800. ! depth of transition between rn_surf and rn_bot [meters] |
---|
| 42 | INTEGER :: nn_file_tr = 2 ! = 1 create a damping.coeff NetCDF file |
---|
[941] | 43 | |
---|
[2715] | 44 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: restotr ! restoring coeff. on tracers (s-1) |
---|
[2528] | 45 | |
---|
[941] | 46 | !! * Substitutions |
---|
| 47 | # include "top_substitute.h90" |
---|
| 48 | !!---------------------------------------------------------------------- |
---|
[2528] | 49 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[1175] | 50 | !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/TRP/trcdmp.F90,v 1.11 2006/09/01 14:03:49 opalod Exp $ |
---|
[2715] | 51 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[941] | 52 | !!---------------------------------------------------------------------- |
---|
| 53 | CONTAINS |
---|
| 54 | |
---|
[2715] | 55 | INTEGER FUNCTION trc_dmp_alloc() |
---|
| 56 | !!---------------------------------------------------------------------- |
---|
| 57 | !! *** ROUTINE trc_dmp_alloc *** |
---|
| 58 | !!---------------------------------------------------------------------- |
---|
| 59 | ALLOCATE( restotr(jpi,jpj,jpk) , STAT=trc_dmp_alloc ) |
---|
| 60 | ! |
---|
| 61 | IF( trc_dmp_alloc /= 0 ) CALL ctl_warn('trc_dmp_alloc: failed to allocate array') |
---|
| 62 | ! |
---|
| 63 | END FUNCTION trc_dmp_alloc |
---|
| 64 | |
---|
| 65 | |
---|
[941] | 66 | SUBROUTINE trc_dmp( kt ) |
---|
| 67 | !!---------------------------------------------------------------------- |
---|
| 68 | !! *** ROUTINE trc_dmp *** |
---|
| 69 | !! |
---|
| 70 | !! ** Purpose : Compute the passive tracer trend due to a newtonian damping |
---|
| 71 | !! of the tracer field towards given data field and add it to the |
---|
| 72 | !! general tracer trends. |
---|
| 73 | !! |
---|
| 74 | !! ** Method : Newtonian damping towards trdta computed |
---|
| 75 | !! and add to the general tracer trends: |
---|
| 76 | !! trn = tra + restotr * (trdta - trb) |
---|
| 77 | !! The trend is computed either throughout the water column |
---|
| 78 | !! (nlmdmptr=0) or in area of weak vertical mixing (nlmdmptr=1) or |
---|
| 79 | !! below the well mixed layer (nlmdmptr=2) |
---|
| 80 | !! |
---|
| 81 | !! ** Action : - update the tracer trends tra with the newtonian |
---|
| 82 | !! damping trends. |
---|
[1175] | 83 | !! - save the trends ('key_trdmld_trc') |
---|
| 84 | !!---------------------------------------------------------------------- |
---|
[941] | 85 | !! |
---|
| 86 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[2528] | 87 | !! |
---|
[1175] | 88 | INTEGER :: ji, jj, jk, jn ! dummy loop indices |
---|
[2528] | 89 | REAL(wp) :: ztra ! temporary scalars |
---|
[941] | 90 | CHARACTER (len=22) :: charout |
---|
[2528] | 91 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ztrtrd |
---|
[941] | 92 | !!---------------------------------------------------------------------- |
---|
| 93 | |
---|
| 94 | ! 0. Initialization (first time-step only) |
---|
| 95 | ! -------------- |
---|
[2528] | 96 | IF( kt == nit000 ) CALL trc_dmp_init |
---|
[941] | 97 | |
---|
[2528] | 98 | IF( l_trdtrc ) ALLOCATE( ztrtrd(jpi,jpj,jpk) ) ! temporary save of trends |
---|
[1175] | 99 | |
---|
[941] | 100 | ! 1. Newtonian damping trends on tracer fields |
---|
| 101 | ! -------------------------------------------- |
---|
| 102 | ! Initialize the input fields for newtonian damping |
---|
[2528] | 103 | CALL trc_dta( kt ) |
---|
[1175] | 104 | ! ! =========== |
---|
| 105 | DO jn = 1, jptra ! tracer loop |
---|
| 106 | ! ! =========== |
---|
| 107 | IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn) ! save trends |
---|
[941] | 108 | |
---|
| 109 | IF( lutini(jn) ) THEN |
---|
[2528] | 110 | ! |
---|
| 111 | SELECT CASE ( nn_zdmp_trc ) |
---|
| 112 | ! |
---|
| 113 | CASE( 0 ) !== newtonian damping throughout the water column ==! |
---|
[941] | 114 | DO jk = 1, jpkm1 |
---|
| 115 | DO jj = 2, jpjm1 |
---|
| 116 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[2528] | 117 | ztra = restotr(ji,jj,jk) * ( trdta(ji,jj,jk,jn) - trb(ji,jj,jk,jn) ) |
---|
[941] | 118 | tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra |
---|
| 119 | END DO |
---|
| 120 | END DO |
---|
| 121 | END DO |
---|
[2528] | 122 | ! |
---|
| 123 | CASE ( 1 ) !== no damping in the turbocline (avt > 5 cm2/s) ==! |
---|
[941] | 124 | DO jk = 1, jpkm1 |
---|
| 125 | DO jj = 2, jpjm1 |
---|
| 126 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[2528] | 127 | IF( avt(ji,jj,jk) <= 5.e-4 ) THEN |
---|
| 128 | ztra = restotr(ji,jj,jk) * ( trdta(ji,jj,jk,jn) - trb(ji,jj,jk,jn) ) |
---|
| 129 | tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra |
---|
[941] | 130 | ENDIF |
---|
| 131 | END DO |
---|
| 132 | END DO |
---|
| 133 | END DO |
---|
[2528] | 134 | ! |
---|
| 135 | CASE ( 2 ) !== no damping in the mixed layer ==! |
---|
[941] | 136 | DO jk = 1, jpkm1 |
---|
| 137 | DO jj = 2, jpjm1 |
---|
| 138 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
| 139 | IF( fsdept(ji,jj,jk) >= hmlp (ji,jj) ) THEN |
---|
| 140 | ztra = restotr(ji,jj,jk,jn) * ( trdta(ji,jj,jk,jn) - trb(ji,jj,jk,jn) ) |
---|
[2528] | 141 | tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra |
---|
| 142 | END IF |
---|
[941] | 143 | END DO |
---|
| 144 | END DO |
---|
| 145 | END DO |
---|
[2528] | 146 | ! |
---|
[941] | 147 | END SELECT |
---|
[2528] | 148 | ! |
---|
[941] | 149 | ENDIF |
---|
[2528] | 150 | ! |
---|
[1175] | 151 | IF( l_trdtrc ) THEN |
---|
| 152 | ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:) |
---|
[2528] | 153 | CALL trd_tra( kt, 'TRC', jn, jptra_trd_dmp, ztrtrd ) |
---|
[1175] | 154 | END IF |
---|
| 155 | ! ! =========== |
---|
| 156 | END DO ! tracer loop |
---|
| 157 | ! ! =========== |
---|
[2528] | 158 | IF( l_trdtrc ) DEALLOCATE( ztrtrd ) |
---|
| 159 | ! ! print mean trends (used for debugging) |
---|
| 160 | IF( ln_ctl ) THEN |
---|
| 161 | WRITE(charout, FMT="('dmp ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 162 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[941] | 163 | ENDIF |
---|
[2528] | 164 | ! |
---|
[941] | 165 | END SUBROUTINE trc_dmp |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | SUBROUTINE trc_dmp_init |
---|
| 169 | !!---------------------------------------------------------------------- |
---|
| 170 | !! *** ROUTINE trc_dmp_init *** |
---|
| 171 | !! |
---|
| 172 | !! ** Purpose : Initialization for the newtonian damping |
---|
| 173 | !! |
---|
| 174 | !! ** Method : read the nammbf namelist and check the parameters |
---|
[2715] | 175 | !! called by trc_dmp at the first timestep (nit000) |
---|
[941] | 176 | !!---------------------------------------------------------------------- |
---|
| 177 | |
---|
[2528] | 178 | SELECT CASE ( nn_hdmp_tr ) |
---|
| 179 | CASE ( -1 ) ; IF(lwp) WRITE(numout,*) ' tracer damping in the Med & Red seas only' |
---|
| 180 | CASE ( 1:90 ) ; IF(lwp) WRITE(numout,*) ' tracer damping poleward of', nn_hdmp_tr, ' degrees' |
---|
[941] | 181 | CASE DEFAULT |
---|
[2528] | 182 | WRITE(ctmp1,*) ' bad flag value for nn_hdmp_tr = ', nn_hdmp_tr |
---|
[941] | 183 | CALL ctl_stop(ctmp1) |
---|
| 184 | END SELECT |
---|
| 185 | |
---|
[2528] | 186 | SELECT CASE ( nn_zdmp_tr ) |
---|
| 187 | CASE ( 0 ) ; IF(lwp) WRITE(numout,*) ' tracer damping throughout the water column' |
---|
| 188 | CASE ( 1 ) ; IF(lwp) WRITE(numout,*) ' no tracer damping in the turbocline (avt > 5 cm2/s)' |
---|
| 189 | CASE ( 2 ) ; IF(lwp) WRITE(numout,*) ' no tracer damping in the mixed layer' |
---|
[941] | 190 | CASE DEFAULT |
---|
[2528] | 191 | WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr |
---|
[941] | 192 | CALL ctl_stop(ctmp1) |
---|
| 193 | END SELECT |
---|
| 194 | |
---|
[2528] | 195 | IF( .NOT. lk_dtatrc ) & |
---|
| 196 | & CALL ctl_stop( 'no passive tracer data define key_dtatrc' ) |
---|
| 197 | |
---|
| 198 | IF( .NOT. lk_tradmp ) & |
---|
| 199 | & CALL ctl_stop( 'passive trace damping need key_tradmp to compute damping coef.' ) |
---|
| 200 | ! |
---|
| 201 | ! ! Damping coefficients initialization |
---|
| 202 | IF( lzoom ) THEN ; CALL dtacof_zoom( restotr ) |
---|
| 203 | ELSE ; CALL dtacof( nn_hdmp_tr, rn_surf_tr, rn_bot_tr, rn_dep_tr, & |
---|
| 204 | & nn_file_tr, 'TRC' , restotr ) |
---|
[1175] | 205 | ENDIF |
---|
[2528] | 206 | ! |
---|
[941] | 207 | END SUBROUTINE trc_dmp_init |
---|
| 208 | #else |
---|
| 209 | !!---------------------------------------------------------------------- |
---|
| 210 | !! Default key NO internal damping |
---|
| 211 | !!---------------------------------------------------------------------- |
---|
| 212 | LOGICAL , PUBLIC, PARAMETER :: lk_trcdmp = .FALSE. !: internal damping flag |
---|
| 213 | CONTAINS |
---|
| 214 | SUBROUTINE trc_dmp( kt ) ! Empty routine |
---|
| 215 | INTEGER, INTENT(in) :: kt |
---|
| 216 | WRITE(*,*) 'trc_dmp: You should not have seen this print! error?', kt |
---|
| 217 | END SUBROUTINE trc_dmp |
---|
| 218 | #endif |
---|
| 219 | !!====================================================================== |
---|
| 220 | END MODULE trcdmp |
---|