[2030] | 1 | MODULE trcldf |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE trcldf *** |
---|
[3294] | 4 | !! Ocean Passive tracers : lateral diffusive trends |
---|
[2030] | 5 | !!===================================================================== |
---|
[5836] | 6 | !! History : 1.0 ! 2005-11 (G. Madec) Original code |
---|
| 7 | !! 3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA |
---|
| 8 | !! 3.7 ! 2014-03 (G. Madec) LDF simplification |
---|
[2030] | 9 | !!---------------------------------------------------------------------- |
---|
| 10 | #if defined key_top |
---|
| 11 | !!---------------------------------------------------------------------- |
---|
| 12 | !! 'key_top' TOP models |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
[6140] | 14 | !! trc_ldf : update the tracer trend with the lateral diffusion |
---|
| 15 | !! trc_ldf_ini : initialization, namelist read, and parameters control |
---|
[2030] | 16 | !!---------------------------------------------------------------------- |
---|
[6140] | 17 | USE trc ! ocean passive tracers variables |
---|
| 18 | USE oce_trc ! ocean dynamics and active tracers |
---|
| 19 | USE ldfslp ! lateral diffusion: iso-neutral slope |
---|
| 20 | USE traldf_lap_blp ! lateral diffusion: lap/bilaplacian iso-level operator (tra_ldf_lap/_blp routine) |
---|
| 21 | USE traldf_iso ! lateral diffusion: laplacian iso-neutral standard operator (tra_ldf_iso routine) |
---|
| 22 | USE traldf_triad ! lateral diffusion: laplacian iso-neutral triad operator (tra_ldf_ triad routine) |
---|
| 23 | USE trd_oce ! trends: ocean variables |
---|
| 24 | USE trdtra ! trends manager: tracers |
---|
[5836] | 25 | ! |
---|
[6140] | 26 | USE prtctl_trc ! Print control |
---|
[2030] | 27 | |
---|
| 28 | IMPLICIT NONE |
---|
| 29 | PRIVATE |
---|
| 30 | |
---|
[5836] | 31 | PUBLIC trc_ldf |
---|
| 32 | PUBLIC trc_ldf_ini |
---|
| 33 | ! |
---|
| 34 | LOGICAL , PUBLIC :: ln_trcldf_lap !: laplacian operator |
---|
| 35 | LOGICAL , PUBLIC :: ln_trcldf_blp !: bilaplacian operator |
---|
| 36 | LOGICAL , PUBLIC :: ln_trcldf_lev !: iso-level direction |
---|
| 37 | LOGICAL , PUBLIC :: ln_trcldf_hor !: horizontal direction (rotation to geopotential) |
---|
| 38 | LOGICAL , PUBLIC :: ln_trcldf_iso !: iso-neutral direction (standard) |
---|
| 39 | LOGICAL , PUBLIC :: ln_trcldf_triad !: iso-neutral direction (triad) |
---|
| 40 | REAL(wp), PUBLIC :: rn_ahtrc_0 !: laplacian diffusivity coefficient for passive tracer [m2/s] |
---|
| 41 | REAL(wp), PUBLIC :: rn_bhtrc_0 !: bilaplacian - -- - - [m4/s] |
---|
[6403] | 42 | REAL(wp), PUBLIC :: rn_fact_lap !: Enhanced zonal diffusivity coefficent in the equatorial domain |
---|
[5836] | 43 | ! |
---|
[6140] | 44 | ! !!: ** lateral mixing namelist (nam_trcldf) ** |
---|
| 45 | REAL(wp) :: rldf ! ratio between active and passive tracers diffusive coefficient |
---|
| 46 | |
---|
[3294] | 47 | INTEGER :: nldf = 0 ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals) |
---|
[5836] | 48 | |
---|
[2030] | 49 | !! * Substitutions |
---|
| 50 | # include "vectopt_loop_substitute.h90" |
---|
| 51 | !!---------------------------------------------------------------------- |
---|
[5836] | 52 | !! NEMO/TOP 3.7 , NEMO Consortium (2014) |
---|
[3294] | 53 | !! $Id$ |
---|
[2287] | 54 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[2030] | 55 | !!---------------------------------------------------------------------- |
---|
| 56 | CONTAINS |
---|
| 57 | |
---|
| 58 | SUBROUTINE trc_ldf( kt ) |
---|
| 59 | !!---------------------------------------------------------------------- |
---|
| 60 | !! *** ROUTINE tra_ldf *** |
---|
[3294] | 61 | !! |
---|
[2030] | 62 | !! ** Purpose : compute the lateral ocean tracer physics. |
---|
| 63 | !! |
---|
| 64 | !!---------------------------------------------------------------------- |
---|
| 65 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[6140] | 66 | ! |
---|
[6403] | 67 | INTEGER :: ji, jj, jk, jn |
---|
| 68 | REAL(wp) :: zdep |
---|
[2030] | 69 | CHARACTER (len=22) :: charout |
---|
[5836] | 70 | REAL(wp), POINTER, DIMENSION(:,:,:) :: zahu, zahv |
---|
[3294] | 71 | REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrtrd |
---|
[2030] | 72 | !!---------------------------------------------------------------------- |
---|
[3294] | 73 | ! |
---|
| 74 | IF( nn_timing == 1 ) CALL timing_start('trc_ldf') |
---|
| 75 | ! |
---|
| 76 | IF( l_trdtrc ) THEN |
---|
[5836] | 77 | CALL wrk_alloc( jpi,jpj,jpk,jptra, ztrtrd ) |
---|
[2030] | 78 | ztrtrd(:,:,:,:) = tra(:,:,:,:) |
---|
| 79 | ENDIF |
---|
[6403] | 80 | ! !* set the lateral diffusivity coef. for passive tracer |
---|
[5836] | 81 | CALL wrk_alloc( jpi,jpj,jpk, zahu, zahv ) |
---|
[6403] | 82 | zahu(:,:,:) = rldf * ahtu(:,:,:) |
---|
[5836] | 83 | zahv(:,:,:) = rldf * ahtv(:,:,:) |
---|
[6403] | 84 | ! !* Enhanced zonal diffusivity coefficent in the equatorial domain |
---|
| 85 | DO jk= 1, jpk |
---|
| 86 | DO jj = 1, jpj |
---|
| 87 | DO ji = 1, jpi |
---|
| 88 | IF( gdept_n(ji,jj,jk) > 200. .AND. gphit(ji,jj) < 5. .AND. gphit(ji,jj) > -5. ) THEN |
---|
| 89 | zdep = MAX( gdept_n(ji,jj,jk) - 1000., 0. ) / 1000. |
---|
| 90 | zahu(ji,jj,jk) = zahu(ji,jj,jk) * MAX( 1., rn_fact_lap * EXP( -zdep ) ) |
---|
| 91 | ENDIF |
---|
| 92 | END DO |
---|
| 93 | END DO |
---|
| 94 | END DO |
---|
| 95 | ! |
---|
[5836] | 96 | SELECT CASE ( nldf ) !* compute lateral mixing trend and add it to the general trend |
---|
| 97 | ! |
---|
| 98 | CASE ( np_lap ) ! iso-level laplacian |
---|
| 99 | CALL tra_ldf_lap ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb, tra, jptra, 1 ) |
---|
[2030] | 100 | ! |
---|
[5836] | 101 | CASE ( np_lap_i ) ! laplacian : standard iso-neutral operator (Madec) |
---|
| 102 | CALL tra_ldf_iso ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb, trb, tra, jptra, 1 ) |
---|
| 103 | ! |
---|
| 104 | CASE ( np_lap_it ) ! laplacian : triad iso-neutral operator (griffies) |
---|
| 105 | CALL tra_ldf_triad( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb, trb, tra, jptra, 1 ) |
---|
| 106 | ! |
---|
| 107 | CASE ( np_blp , np_blp_i , np_blp_it ) ! bilaplacian: all operator (iso-level, -neutral) |
---|
| 108 | CALL tra_ldf_blp ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb , tra, jptra, nldf ) |
---|
| 109 | ! |
---|
[2030] | 110 | END SELECT |
---|
| 111 | ! |
---|
[6140] | 112 | IF( l_trdtrc ) THEN ! send the trends for further diagnostics |
---|
[2030] | 113 | DO jn = 1, jptra |
---|
| 114 | ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn) |
---|
[4990] | 115 | CALL trd_tra( kt, 'TRC', jn, jptra_ldf, ztrtrd(:,:,:,jn) ) |
---|
[2030] | 116 | END DO |
---|
[3294] | 117 | CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
[2030] | 118 | ENDIF |
---|
[6140] | 119 | ! |
---|
| 120 | IF( ln_ctl ) THEN ! print mean trends (used for debugging) |
---|
| 121 | WRITE(charout, FMT="('ldf ')") |
---|
| 122 | CALL prt_ctl_trc_info(charout) |
---|
| 123 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[2030] | 124 | ENDIF |
---|
| 125 | ! |
---|
[5836] | 126 | CALL wrk_dealloc( jpi,jpj,jpk, zahu, zahv ) |
---|
| 127 | ! |
---|
[3294] | 128 | IF( nn_timing == 1 ) CALL timing_stop('trc_ldf') |
---|
| 129 | ! |
---|
[2030] | 130 | END SUBROUTINE trc_ldf |
---|
| 131 | |
---|
| 132 | |
---|
[5836] | 133 | SUBROUTINE trc_ldf_ini |
---|
[2030] | 134 | !!---------------------------------------------------------------------- |
---|
| 135 | !! *** ROUTINE ldf_ctl *** |
---|
[3294] | 136 | !! |
---|
[5836] | 137 | !! ** Purpose : Define the operator for the lateral diffusion |
---|
[2030] | 138 | !! |
---|
| 139 | !! ** Method : set nldf from the namtra_ldf logicals |
---|
| 140 | !! nldf == 0 laplacian operator |
---|
| 141 | !! nldf == 1 Rotated laplacian operator |
---|
| 142 | !! nldf == 2 bilaplacian operator |
---|
| 143 | !! nldf == 3 Rotated bilaplacian |
---|
| 144 | !!---------------------------------------------------------------------- |
---|
[5836] | 145 | INTEGER :: ioptio, ierr ! temporary integers |
---|
| 146 | INTEGER :: ios ! Local integer output status for namelist read |
---|
[6140] | 147 | !! |
---|
[5836] | 148 | NAMELIST/namtrc_ldf/ ln_trcldf_lap, ln_trcldf_blp, & |
---|
| 149 | & ln_trcldf_lev, ln_trcldf_hor, ln_trcldf_iso, ln_trcldf_triad, & |
---|
[6403] | 150 | & rn_ahtrc_0 , rn_bhtrc_0, rn_fact_lap |
---|
[2030] | 151 | !!---------------------------------------------------------------------- |
---|
[6140] | 152 | ! |
---|
| 153 | REWIND( numnat_ref ) ! namtrc_ldf in reference namelist |
---|
[5836] | 154 | READ ( numnat_ref, namtrc_ldf, IOSTAT = ios, ERR = 903) |
---|
[6140] | 155 | 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ldf in reference namelist', lwp ) |
---|
| 156 | ! |
---|
| 157 | REWIND( numnat_cfg ) ! namtrc_ldf in configuration namelist |
---|
[5836] | 158 | READ ( numnat_cfg, namtrc_ldf, IOSTAT = ios, ERR = 904 ) |
---|
[6140] | 159 | 904 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ldf in configuration namelist', lwp ) |
---|
[5836] | 160 | IF(lwm) WRITE ( numont, namtrc_ldf ) |
---|
[6140] | 161 | ! |
---|
| 162 | IF(lwp) THEN ! Namelist print |
---|
[5836] | 163 | WRITE(numout,*) |
---|
| 164 | WRITE(numout,*) 'trc_ldf_ini : lateral tracer diffusive operator' |
---|
| 165 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 166 | WRITE(numout,*) ' Namelist namtrc_ldf : set lateral mixing parameters (type, direction, coefficients)' |
---|
| 167 | WRITE(numout,*) ' operator' |
---|
| 168 | WRITE(numout,*) ' laplacian ln_trcldf_lap = ', ln_trcldf_lap |
---|
| 169 | WRITE(numout,*) ' bilaplacian ln_trcldf_blp = ', ln_trcldf_blp |
---|
| 170 | WRITE(numout,*) ' direction of action' |
---|
| 171 | WRITE(numout,*) ' iso-level ln_trcldf_lev = ', ln_trcldf_lev |
---|
| 172 | WRITE(numout,*) ' horizontal (geopotential) ln_trcldf_hor = ', ln_trcldf_hor |
---|
| 173 | WRITE(numout,*) ' iso-neutral (standard) ln_trcldf_iso = ', ln_trcldf_iso |
---|
| 174 | WRITE(numout,*) ' iso-neutral (triad) ln_trcldf_triad = ', ln_trcldf_triad |
---|
| 175 | WRITE(numout,*) ' diffusivity coefficient' |
---|
| 176 | WRITE(numout,*) ' laplacian rn_ahtrc_0 = ', rn_ahtrc_0 |
---|
| 177 | WRITE(numout,*) ' bilaplacian rn_bhtrc_0 = ', rn_bhtrc_0 |
---|
[6403] | 178 | WRITE(numout,*) ' enhanced zonal diffusivity rn_fact_lap = ', rn_fact_lap |
---|
| 179 | |
---|
[5836] | 180 | ENDIF |
---|
| 181 | ! |
---|
| 182 | ! ! control the namelist parameters |
---|
[2030] | 183 | ioptio = 0 |
---|
[5836] | 184 | IF( ln_trcldf_lap ) ioptio = ioptio + 1 |
---|
| 185 | IF( ln_trcldf_blp ) ioptio = ioptio + 1 |
---|
| 186 | IF( ioptio > 1 ) CALL ctl_stop( 'trc_ldf_ctl: use ONE or NONE of the 2 lap/bilap operator type on tracer' ) |
---|
| 187 | IF( ioptio == 0 ) nldf = np_no_ldf ! No lateral diffusion |
---|
| 188 | |
---|
| 189 | IF( ln_trcldf_lap .AND. ln_trcldf_blp ) CALL ctl_stop( 'trc_ldf_ctl: bilaplacian should be used on both TRC and TRA' ) |
---|
| 190 | IF( ln_trcldf_blp .AND. ln_trcldf_lap ) CALL ctl_stop( 'trc_ldf_ctl: laplacian should be used on both TRC and TRA' ) |
---|
[6140] | 191 | ! |
---|
[2030] | 192 | ioptio = 0 |
---|
[5836] | 193 | IF( ln_trcldf_lev ) ioptio = ioptio + 1 |
---|
| 194 | IF( ln_trcldf_hor ) ioptio = ioptio + 1 |
---|
| 195 | IF( ln_trcldf_iso ) ioptio = ioptio + 1 |
---|
| 196 | IF( ioptio /= 1 ) CALL ctl_stop( 'trc_ldf_ctl: use only ONE direction (level/hor/iso)' ) |
---|
[6140] | 197 | ! |
---|
[2030] | 198 | ! defined the type of lateral diffusion from ln_trcldf_... logicals |
---|
| 199 | ! CAUTION : nldf = 1 is used in trazdf_imp, change it carefully |
---|
| 200 | ierr = 0 |
---|
[5836] | 201 | IF( ln_trcldf_lap ) THEN !== laplacian operator ==! |
---|
[2030] | 202 | IF ( ln_zco ) THEN ! z-coordinate |
---|
[5836] | 203 | IF ( ln_trcldf_lev ) nldf = np_lap ! iso-level = horizontal (no rotation) |
---|
| 204 | IF ( ln_trcldf_hor ) nldf = np_lap ! iso-level = horizontal (no rotation) |
---|
| 205 | IF ( ln_trcldf_iso ) nldf = np_lap_i ! iso-neutral: standard ( rotation) |
---|
| 206 | IF ( ln_trcldf_triad ) nldf = np_lap_it ! iso-neutral: triad ( rotation) |
---|
[2030] | 207 | ENDIF |
---|
[5836] | 208 | IF ( ln_zps ) THEN ! z-coordinate with partial step |
---|
| 209 | IF ( ln_trcldf_lev ) ierr = 1 ! iso-level not allowed |
---|
| 210 | IF ( ln_trcldf_hor ) nldf = np_lap ! horizontal (no rotation) |
---|
| 211 | IF ( ln_trcldf_iso ) nldf = np_lap_i ! iso-neutral: standard (rotation) |
---|
| 212 | IF ( ln_trcldf_triad ) nldf = np_lap_it ! iso-neutral: triad (rotation) |
---|
[2030] | 213 | ENDIF |
---|
[5836] | 214 | IF ( ln_sco ) THEN ! s-coordinate |
---|
| 215 | IF ( ln_trcldf_lev ) nldf = np_lap ! iso-level (no rotation) |
---|
| 216 | IF ( ln_trcldf_hor ) nldf = np_lap_it ! horizontal ( rotation) !!gm a checker.... |
---|
| 217 | IF ( ln_trcldf_iso ) nldf = np_lap_i ! iso-neutral: standard (rotation) |
---|
| 218 | IF ( ln_trcldf_triad ) nldf = np_lap_it ! iso-neutral: triad (rotation) |
---|
[2030] | 219 | ENDIF |
---|
[5836] | 220 | ! ! diffusivity ratio: passive / active tracers |
---|
[6140] | 221 | IF( ABS(rn_aht_0) < 2._wp*TINY(1._wp) ) THEN |
---|
| 222 | IF( ABS(rn_ahtrc_0) < 2._wp*TINY(1._wp) ) THEN |
---|
[5836] | 223 | rldf = 1.0_wp |
---|
| 224 | ELSE |
---|
[6140] | 225 | CALL ctl_stop( 'trc_ldf_ctl : cannot define rldf, rn_aht_0==0, rn_ahtrc_0 /=0' ) |
---|
[5836] | 226 | ENDIF |
---|
| 227 | ELSE |
---|
| 228 | rldf = rn_ahtrc_0 / rn_aht_0 |
---|
| 229 | ENDIF |
---|
[2030] | 230 | ENDIF |
---|
[5836] | 231 | ! |
---|
| 232 | IF( ln_trcldf_blp ) THEN !== bilaplacian operator ==! |
---|
[2030] | 233 | IF ( ln_zco ) THEN ! z-coordinate |
---|
[5836] | 234 | IF ( ln_trcldf_lev ) nldf = np_blp ! iso-level = horizontal (no rotation) |
---|
| 235 | IF ( ln_trcldf_hor ) nldf = np_blp ! iso-level = horizontal (no rotation) |
---|
| 236 | IF ( ln_trcldf_iso ) nldf = np_blp_i ! iso-neutral: standard (rotation) |
---|
| 237 | IF ( ln_trcldf_triad ) nldf = np_blp_it ! iso-neutral: triad (rotation) |
---|
[2030] | 238 | ENDIF |
---|
[5836] | 239 | IF ( ln_zps ) THEN ! z-coordinate with partial step |
---|
| 240 | IF ( ln_trcldf_lev ) ierr = 1 ! iso-level not allowed |
---|
| 241 | IF ( ln_trcldf_hor ) nldf = np_blp ! horizontal (no rotation) |
---|
| 242 | IF ( ln_trcldf_iso ) nldf = np_blp_i ! iso-neutral: standard (rotation) |
---|
| 243 | IF ( ln_trcldf_triad ) nldf = np_blp_it ! iso-neutral: triad (rotation) |
---|
[2030] | 244 | ENDIF |
---|
[5836] | 245 | IF ( ln_sco ) THEN ! s-coordinate |
---|
| 246 | IF ( ln_trcldf_lev ) nldf = np_blp ! iso-level (no rotation) |
---|
| 247 | IF ( ln_trcldf_hor ) nldf = np_blp_it ! horizontal ( rotation) !!gm a checker.... |
---|
| 248 | IF ( ln_trcldf_iso ) nldf = np_blp_i ! iso-neutral: standard (rotation) |
---|
| 249 | IF ( ln_trcldf_triad ) nldf = np_blp_it ! iso-neutral: triad (rotation) |
---|
[2030] | 250 | ENDIF |
---|
[5836] | 251 | ! ! diffusivity ratio: passive / active tracers |
---|
[6140] | 252 | IF( ABS(rn_bht_0) < 2._wp*TINY(1._wp) ) THEN |
---|
| 253 | IF( ABS(rn_bhtrc_0) < 2._wp*TINY(1._wp) ) THEN |
---|
[5836] | 254 | rldf = 1.0_wp |
---|
| 255 | ELSE |
---|
[6140] | 256 | CALL ctl_stop( 'trc_ldf_ctl : cannot define rldf, rn_aht_0==0, rn_ahtrc_0 /=0' ) |
---|
[5836] | 257 | ENDIF |
---|
| 258 | ELSE |
---|
| 259 | rldf = SQRT( ABS( rn_bhtrc_0 / rn_bht_0 ) ) |
---|
| 260 | ENDIF |
---|
[2030] | 261 | ENDIF |
---|
[5836] | 262 | ! |
---|
[6140] | 263 | IF( ierr == 1 ) CALL ctl_stop( 'trc_ldf_ctl: iso-level in z-partial step, not allowed' ) |
---|
| 264 | IF( ln_ldfeiv .AND. .NOT.ln_trcldf_iso ) CALL ctl_stop( 'trc_ldf_ctl: eiv requires isopycnal laplacian diffusion' ) |
---|
| 265 | IF( nldf == 1 .OR. nldf == 3 ) l_ldfslp = .TRUE. ! slope of neutral surfaces required |
---|
[5836] | 266 | ! |
---|
[2030] | 267 | IF(lwp) THEN |
---|
| 268 | WRITE(numout,*) |
---|
[6140] | 269 | SELECT CASE( nldf ) |
---|
| 270 | CASE( np_no_ldf ) ; WRITE(numout,*) ' NO lateral diffusion' |
---|
| 271 | CASE( np_lap ) ; WRITE(numout,*) ' laplacian iso-level operator' |
---|
| 272 | CASE( np_lap_i ) ; WRITE(numout,*) ' Rotated laplacian operator (standard)' |
---|
| 273 | CASE( np_lap_it ) ; WRITE(numout,*) ' Rotated laplacian operator (triad)' |
---|
| 274 | CASE( np_blp ) ; WRITE(numout,*) ' bilaplacian iso-level operator' |
---|
| 275 | CASE( np_blp_i ) ; WRITE(numout,*) ' Rotated bilaplacian operator (standard)' |
---|
| 276 | CASE( np_blp_it ) ; WRITE(numout,*) ' Rotated bilaplacian operator (triad)' |
---|
| 277 | END SELECT |
---|
[2030] | 278 | ENDIF |
---|
| 279 | ! |
---|
[5836] | 280 | END SUBROUTINE trc_ldf_ini |
---|
[2030] | 281 | #else |
---|
| 282 | !!---------------------------------------------------------------------- |
---|
| 283 | !! Default option Empty module |
---|
| 284 | !!---------------------------------------------------------------------- |
---|
| 285 | CONTAINS |
---|
| 286 | SUBROUTINE trc_ldf( kt ) |
---|
| 287 | INTEGER, INTENT(in) :: kt |
---|
| 288 | WRITE(*,*) 'trc_ldf: You should not have seen this print! error?', kt |
---|
| 289 | END SUBROUTINE trc_ldf |
---|
| 290 | #endif |
---|
| 291 | !!====================================================================== |
---|
| 292 | END MODULE trcldf |
---|