[2030] | 1 | MODULE trcldf |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE trcldf *** |
---|
[3294] | 4 | !! Ocean Passive tracers : lateral diffusive trends |
---|
[2030] | 5 | !!===================================================================== |
---|
| 6 | !! History : 9.0 ! 2005-11 (G. Madec) Original code |
---|
[3294] | 7 | !! NEMO 3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA |
---|
[2030] | 8 | !!---------------------------------------------------------------------- |
---|
| 9 | #if defined key_top |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
| 11 | !! 'key_top' TOP models |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
| 14 | !! trc_ldf : update the tracer trend with the lateral diffusion |
---|
| 15 | !! ldf_ctl : initialization, namelist read, and parameters control |
---|
| 16 | !!---------------------------------------------------------------------- |
---|
| 17 | USE oce_trc ! ocean dynamics and active tracers |
---|
| 18 | USE trc ! ocean passive tracers variables |
---|
| 19 | USE trcnam_trp ! passive tracers transport namelist variables |
---|
| 20 | USE ldftra_oce ! lateral diffusion coefficient on tracers |
---|
| 21 | USE ldfslp ! ??? |
---|
| 22 | USE traldf_bilapg ! lateral mixing (tra_ldf_bilapg routine) |
---|
| 23 | USE traldf_bilap ! lateral mixing (tra_ldf_bilap routine) |
---|
| 24 | USE traldf_iso ! lateral mixing (tra_ldf_iso routine) |
---|
[3294] | 25 | USE traldf_iso_grif ! lateral mixing (tra_ldf_iso_grif routine) |
---|
[2030] | 26 | USE traldf_lap ! lateral mixing (tra_ldf_lap routine) |
---|
[4990] | 27 | USE trd_oce |
---|
[2030] | 28 | USE trdtra |
---|
| 29 | USE prtctl_trc ! Print control |
---|
| 30 | |
---|
| 31 | IMPLICIT NONE |
---|
| 32 | PRIVATE |
---|
| 33 | |
---|
[3294] | 34 | PUBLIC trc_ldf ! called by step.F90 |
---|
[2030] | 35 | ! !!: ** lateral mixing namelist (nam_trcldf) ** |
---|
[3294] | 36 | REAL(wp) :: rldf_rat ! ratio between active and passive tracers diffusive coefficient |
---|
| 37 | INTEGER :: nldf = 0 ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals) |
---|
[2030] | 38 | !! * Substitutions |
---|
| 39 | # include "domzgr_substitute.h90" |
---|
| 40 | # include "vectopt_loop_substitute.h90" |
---|
| 41 | !!---------------------------------------------------------------------- |
---|
[2287] | 42 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[3294] | 43 | !! $Id$ |
---|
[2287] | 44 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[2030] | 45 | !!---------------------------------------------------------------------- |
---|
| 46 | |
---|
| 47 | CONTAINS |
---|
| 48 | |
---|
| 49 | SUBROUTINE trc_ldf( kt ) |
---|
| 50 | !!---------------------------------------------------------------------- |
---|
| 51 | !! *** ROUTINE tra_ldf *** |
---|
[3294] | 52 | !! |
---|
[2030] | 53 | !! ** Purpose : compute the lateral ocean tracer physics. |
---|
| 54 | !! |
---|
| 55 | !!---------------------------------------------------------------------- |
---|
| 56 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 57 | !! |
---|
| 58 | INTEGER :: jn |
---|
| 59 | CHARACTER (len=22) :: charout |
---|
[3294] | 60 | REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrtrd |
---|
[2030] | 61 | !!---------------------------------------------------------------------- |
---|
[3294] | 62 | ! |
---|
| 63 | IF( nn_timing == 1 ) CALL timing_start('trc_ldf') |
---|
| 64 | ! |
---|
| 65 | IF( kt == nittrc000 ) CALL ldf_ctl ! initialisation & control of options |
---|
[2030] | 66 | |
---|
[3294] | 67 | rldf = rldf_rat |
---|
[2030] | 68 | |
---|
[3294] | 69 | IF( l_trdtrc ) THEN |
---|
| 70 | CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
[2030] | 71 | ztrtrd(:,:,:,:) = tra(:,:,:,:) |
---|
| 72 | ENDIF |
---|
| 73 | |
---|
| 74 | SELECT CASE ( nldf ) ! compute lateral mixing trend and add it to the general trend |
---|
[4990] | 75 | CASE ( 0 ) ; CALL tra_ldf_lap ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra ) ! iso-level laplacian |
---|
[3294] | 76 | CASE ( 1 ) ! rotated laplacian |
---|
| 77 | IF( ln_traldf_grif ) THEN |
---|
| 78 | CALL tra_ldf_iso_grif( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) |
---|
| 79 | ELSE |
---|
[4990] | 80 | CALL tra_ldf_iso ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra, rn_ahtb_0 ) |
---|
[3294] | 81 | ENDIF |
---|
[4990] | 82 | CASE ( 2 ) ; CALL tra_ldf_bilap ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra ) ! iso-level bilaplacian |
---|
[3294] | 83 | CASE ( 3 ) ; CALL tra_ldf_bilapg( kt, nittrc000, 'TRC', trb, tra, jptra ) ! s-coord. horizontal bilaplacian |
---|
[2030] | 84 | ! |
---|
| 85 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
[4990] | 86 | CALL tra_ldf_lap ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra ) |
---|
[2034] | 87 | WRITE(charout, FMT="('ldf0 ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 88 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[3294] | 89 | IF( ln_traldf_grif ) THEN |
---|
| 90 | CALL tra_ldf_iso_grif( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) |
---|
| 91 | ELSE |
---|
[4990] | 92 | CALL tra_ldf_iso ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra, rn_ahtb_0 ) |
---|
[3294] | 93 | ENDIF |
---|
[2034] | 94 | WRITE(charout, FMT="('ldf1 ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 95 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[4990] | 96 | CALL tra_ldf_bilap ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra ) |
---|
[2034] | 97 | WRITE(charout, FMT="('ldf2 ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 98 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[3294] | 99 | CALL tra_ldf_bilapg( kt, nittrc000, 'TRC', trb, tra, jptra ) |
---|
[2034] | 100 | WRITE(charout, FMT="('ldf3 ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 101 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[2030] | 102 | END SELECT |
---|
| 103 | ! |
---|
| 104 | IF( l_trdtrc ) THEN ! save the horizontal diffusive trends for further diagnostics |
---|
| 105 | DO jn = 1, jptra |
---|
| 106 | ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn) |
---|
[4990] | 107 | CALL trd_tra( kt, 'TRC', jn, jptra_ldf, ztrtrd(:,:,:,jn) ) |
---|
[2030] | 108 | END DO |
---|
[3294] | 109 | CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
[2030] | 110 | ENDIF |
---|
| 111 | ! ! print mean trends (used for debugging) |
---|
| 112 | IF( ln_ctl ) THEN |
---|
| 113 | WRITE(charout, FMT="('ldf ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 114 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
| 115 | ENDIF |
---|
| 116 | ! |
---|
[3294] | 117 | IF( nn_timing == 1 ) CALL timing_stop('trc_ldf') |
---|
| 118 | ! |
---|
[2030] | 119 | END SUBROUTINE trc_ldf |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | SUBROUTINE ldf_ctl |
---|
| 123 | !!---------------------------------------------------------------------- |
---|
| 124 | !! *** ROUTINE ldf_ctl *** |
---|
[3294] | 125 | !! |
---|
[2030] | 126 | !! ** Purpose : Choice of the operator for the lateral tracer diffusion |
---|
| 127 | !! |
---|
| 128 | !! ** Method : set nldf from the namtra_ldf logicals |
---|
[3294] | 129 | !! nldf == -2 No lateral diffusion |
---|
[2030] | 130 | !! nldf == -1 ESOPA test: ALL operators are used |
---|
| 131 | !! nldf == 0 laplacian operator |
---|
| 132 | !! nldf == 1 Rotated laplacian operator |
---|
| 133 | !! nldf == 2 bilaplacian operator |
---|
| 134 | !! nldf == 3 Rotated bilaplacian |
---|
| 135 | !!---------------------------------------------------------------------- |
---|
[3294] | 136 | INTEGER :: ioptio, ierr ! temporary integers |
---|
[2030] | 137 | !!---------------------------------------------------------------------- |
---|
| 138 | |
---|
[3294] | 139 | IF (ABS(rn_aht_0) < 2._wp*TINY(1.e0)) THEN |
---|
| 140 | IF (ABS(rn_ahtrc_0) < 2._wp*TINY(1.e0)) THEN |
---|
| 141 | rldf_rat = 1.0_wp |
---|
| 142 | ELSE |
---|
| 143 | CALL ctl_stop( 'STOP', 'ldf_ctl : cannot define rldf_rat, rn_aht_0==0, rn_ahtrc_0 /=0' ) |
---|
| 144 | END IF |
---|
| 145 | ELSE |
---|
| 146 | rldf_rat = rn_ahtrc_0 / rn_aht_0 |
---|
| 147 | END IF |
---|
[2030] | 148 | ! Define the lateral mixing oparator for tracers |
---|
| 149 | ! =============================================== |
---|
[3294] | 150 | |
---|
[2030] | 151 | ! ! control the input |
---|
| 152 | ioptio = 0 |
---|
| 153 | IF( ln_trcldf_lap ) ioptio = ioptio + 1 |
---|
| 154 | IF( ln_trcldf_bilap ) ioptio = ioptio + 1 |
---|
| 155 | IF( ioptio > 1 ) CALL ctl_stop( ' use ONE or NONE of the 2 lap/bilap operator type on tracer' ) |
---|
| 156 | IF( ioptio == 0 ) nldf = -2 ! No lateral diffusion |
---|
| 157 | ioptio = 0 |
---|
| 158 | IF( ln_trcldf_level ) ioptio = ioptio + 1 |
---|
| 159 | IF( ln_trcldf_hor ) ioptio = ioptio + 1 |
---|
| 160 | IF( ln_trcldf_iso ) ioptio = ioptio + 1 |
---|
| 161 | IF( ioptio /= 1 ) CALL ctl_stop( ' use only ONE direction (level/hor/iso)' ) |
---|
| 162 | |
---|
| 163 | ! defined the type of lateral diffusion from ln_trcldf_... logicals |
---|
| 164 | ! CAUTION : nldf = 1 is used in trazdf_imp, change it carefully |
---|
| 165 | ierr = 0 |
---|
| 166 | IF( ln_trcldf_lap ) THEN ! laplacian operator |
---|
| 167 | IF ( ln_zco ) THEN ! z-coordinate |
---|
| 168 | IF ( ln_trcldf_level ) nldf = 0 ! iso-level (no rotation) |
---|
| 169 | IF ( ln_trcldf_hor ) nldf = 0 ! horizontal (no rotation) |
---|
| 170 | IF ( ln_trcldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
| 171 | ENDIF |
---|
| 172 | IF ( ln_zps ) THEN ! z-coordinate |
---|
| 173 | IF ( ln_trcldf_level ) ierr = 1 ! iso-level not allowed |
---|
| 174 | IF ( ln_trcldf_hor ) nldf = 0 ! horizontal (no rotation) |
---|
| 175 | IF ( ln_trcldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
| 176 | ENDIF |
---|
| 177 | IF ( ln_sco ) THEN ! z-coordinate |
---|
| 178 | IF ( ln_trcldf_level ) nldf = 0 ! iso-level (no rotation) |
---|
| 179 | IF ( ln_trcldf_hor ) nldf = 1 ! horizontal ( rotation) |
---|
| 180 | IF ( ln_trcldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
| 181 | ENDIF |
---|
| 182 | ENDIF |
---|
| 183 | |
---|
| 184 | IF( ln_trcldf_bilap ) THEN ! bilaplacian operator |
---|
| 185 | IF ( ln_zco ) THEN ! z-coordinate |
---|
| 186 | IF ( ln_trcldf_level ) nldf = 2 ! iso-level (no rotation) |
---|
| 187 | IF ( ln_trcldf_hor ) nldf = 2 ! horizontal (no rotation) |
---|
| 188 | IF ( ln_trcldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
| 189 | ENDIF |
---|
| 190 | IF ( ln_zps ) THEN ! z-coordinate |
---|
[3294] | 191 | IF ( ln_trcldf_level ) ierr = 1 ! iso-level not allowed |
---|
[2030] | 192 | IF ( ln_trcldf_hor ) nldf = 2 ! horizontal (no rotation) |
---|
| 193 | IF ( ln_trcldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
| 194 | ENDIF |
---|
| 195 | IF ( ln_sco ) THEN ! z-coordinate |
---|
| 196 | IF ( ln_trcldf_level ) nldf = 2 ! iso-level (no rotation) |
---|
| 197 | IF ( ln_trcldf_hor ) nldf = 3 ! horizontal ( rotation) |
---|
| 198 | IF ( ln_trcldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
| 199 | ENDIF |
---|
| 200 | ENDIF |
---|
| 201 | |
---|
| 202 | IF( ierr == 1 ) CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' ) |
---|
| 203 | IF( ierr == 2 ) CALL ctl_stop( ' isoneutral bilaplacian operator does not exist' ) |
---|
| 204 | IF( lk_traldf_eiv .AND. .NOT.ln_trcldf_iso ) & |
---|
| 205 | CALL ctl_stop( ' eddy induced velocity on tracers', & |
---|
| 206 | & ' the eddy induced velocity on tracers requires isopycnal laplacian diffusion' ) |
---|
| 207 | IF( nldf == 1 .OR. nldf == 3 ) THEN ! rotation |
---|
| 208 | IF( .NOT.lk_ldfslp ) CALL ctl_stop( ' the rotation of the diffusive tensor require key_ldfslp' ) |
---|
| 209 | #if defined key_offline |
---|
| 210 | l_traldf_rot = .TRUE. ! needed for trazdf_imp |
---|
| 211 | #endif |
---|
| 212 | ENDIF |
---|
| 213 | |
---|
| 214 | IF( lk_esopa ) THEN |
---|
| 215 | IF(lwp) WRITE(numout,*) ' esopa control: use all lateral physics options' |
---|
| 216 | nldf = -1 |
---|
| 217 | ENDIF |
---|
| 218 | |
---|
| 219 | IF(lwp) THEN |
---|
| 220 | WRITE(numout,*) |
---|
| 221 | IF( nldf == -2 ) WRITE(numout,*) ' NO lateral diffusion' |
---|
| 222 | IF( nldf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
| 223 | IF( nldf == 0 ) WRITE(numout,*) ' laplacian operator' |
---|
| 224 | IF( nldf == 1 ) WRITE(numout,*) ' Rotated laplacian operator' |
---|
| 225 | IF( nldf == 2 ) WRITE(numout,*) ' bilaplacian operator' |
---|
| 226 | IF( nldf == 3 ) WRITE(numout,*) ' Rotated bilaplacian' |
---|
| 227 | ENDIF |
---|
| 228 | |
---|
[3294] | 229 | IF( ln_trcldf_bilap ) THEN |
---|
| 230 | IF(lwp) WRITE(numout,*) ' biharmonic tracer diffusion' |
---|
| 231 | IF( rn_ahtrc_0 > 0 .AND. .NOT. lk_esopa ) CALL ctl_stop( 'The horizontal diffusivity coef. rn_ahtrc_0 must be negative' ) |
---|
| 232 | ELSE |
---|
| 233 | IF(lwp) WRITE(numout,*) ' harmonic tracer diffusion (default)' |
---|
| 234 | IF( rn_ahtrc_0 < 0 .AND. .NOT. lk_esopa ) CALL ctl_stop('The horizontal diffusivity coef. rn_ahtrc_0 must be positive' ) |
---|
| 235 | ENDIF |
---|
| 236 | |
---|
| 237 | ! ratio between active and passive tracers diffusive coef. |
---|
| 238 | IF (ABS(rn_aht_0) < 2._wp*TINY(1.e0)) THEN |
---|
| 239 | IF (ABS(rn_ahtrc_0) < 2._wp*TINY(1.e0)) THEN |
---|
| 240 | rldf_rat = 1.0_wp |
---|
| 241 | ELSE |
---|
| 242 | CALL ctl_stop( 'STOP', 'ldf_ctl : cannot define rldf_rat, rn_aht_0==0, rn_ahtrc_0 /=0' ) |
---|
| 243 | END IF |
---|
| 244 | ELSE |
---|
| 245 | rldf_rat = rn_ahtrc_0 / rn_aht_0 |
---|
| 246 | END IF |
---|
| 247 | IF( rldf_rat < 0 ) THEN |
---|
| 248 | IF( .NOT.lk_offline ) THEN |
---|
| 249 | CALL ctl_stop( 'Choose the same type of diffusive scheme both for active & passive tracers' ) |
---|
| 250 | ELSE |
---|
| 251 | CALL ctl_stop( 'Change the sign of rn_aht_0 in namelist to -/+1' ) |
---|
| 252 | ENDIF |
---|
| 253 | ENDIF |
---|
[2030] | 254 | ! |
---|
| 255 | END SUBROUTINE ldf_ctl |
---|
| 256 | #else |
---|
| 257 | !!---------------------------------------------------------------------- |
---|
| 258 | !! Default option Empty module |
---|
| 259 | !!---------------------------------------------------------------------- |
---|
| 260 | CONTAINS |
---|
| 261 | SUBROUTINE trc_ldf( kt ) |
---|
| 262 | INTEGER, INTENT(in) :: kt |
---|
| 263 | WRITE(*,*) 'trc_ldf: You should not have seen this print! error?', kt |
---|
| 264 | END SUBROUTINE trc_ldf |
---|
| 265 | #endif |
---|
| 266 | !!====================================================================== |
---|
| 267 | END MODULE trcldf |
---|