[458] | 1 | MODULE traldf |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE traldf *** |
---|
| 4 | !! Ocean Active tracers : lateral diffusive trends |
---|
| 5 | !!===================================================================== |
---|
[503] | 6 | !! History : 9.0 ! 05-11 (G. Madec) Original code |
---|
[458] | 7 | !!---------------------------------------------------------------------- |
---|
[503] | 8 | |
---|
| 9 | !!---------------------------------------------------------------------- |
---|
[458] | 10 | !! tra_ldf : update the tracer trend with the lateral diffusion |
---|
| 11 | !! ldf_ctl : initialization, namelist read, and parameters control |
---|
| 12 | !! ldf_ano : compute lateral diffusion for constant T-S profiles |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
| 14 | USE oce ! ocean dynamics and tracers |
---|
| 15 | USE dom_oce ! ocean space and time domain |
---|
| 16 | USE phycst ! physical constants |
---|
| 17 | USE ldftra_oce ! ocean tracer lateral physics |
---|
| 18 | USE ldfslp ! ??? |
---|
| 19 | USE traldf_bilapg ! lateral mixing (tra_ldf_bilapg routine) |
---|
| 20 | USE traldf_bilap ! lateral mixing (tra_ldf_bilap routine) |
---|
| 21 | USE traldf_iso ! lateral mixing (tra_ldf_iso routine) |
---|
| 22 | USE traldf_lap ! lateral mixing (tra_ldf_lap routine) |
---|
| 23 | USE trdmod ! ocean active tracers trends |
---|
| 24 | USE trdmod_oce ! ocean variables trends |
---|
| 25 | USE prtctl ! Print control |
---|
| 26 | USE in_out_manager ! I/O manager |
---|
| 27 | USE lib_mpp ! distribued memory computing library |
---|
| 28 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
| 29 | |
---|
| 30 | IMPLICIT NONE |
---|
| 31 | PRIVATE |
---|
| 32 | |
---|
[503] | 33 | PUBLIC tra_ldf ! called by step.F90 |
---|
[458] | 34 | |
---|
[503] | 35 | INTEGER :: nldf = 0 ! type of lateral diffusion used defined from ln_traldf_... namlist logicals) |
---|
[458] | 36 | #if defined key_traldf_ano |
---|
[503] | 37 | REAL, DIMENSION(jpi,jpj,jpk) :: t0_ldf, s0_ldf ! lateral diffusion trends of T & S |
---|
| 38 | ! ! for a constant vertical profile |
---|
[458] | 39 | #endif |
---|
| 40 | |
---|
| 41 | !! * Substitutions |
---|
| 42 | # include "domzgr_substitute.h90" |
---|
| 43 | # include "vectopt_loop_substitute.h90" |
---|
[503] | 44 | !!---------------------------------------------------------------------- |
---|
| 45 | !! OPA 9.0 , LOCEAN-IPSL (2006) |
---|
| 46 | !! $Header$ |
---|
| 47 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
| 48 | !!---------------------------------------------------------------------- |
---|
[458] | 49 | |
---|
| 50 | CONTAINS |
---|
| 51 | |
---|
| 52 | SUBROUTINE tra_ldf( kt ) |
---|
| 53 | !!---------------------------------------------------------------------- |
---|
| 54 | !! *** ROUTINE tra_ldf *** |
---|
| 55 | !! |
---|
| 56 | !! ** Purpose : compute the lateral ocean tracer physics. |
---|
| 57 | !! |
---|
| 58 | !!---------------------------------------------------------------------- |
---|
[503] | 59 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 60 | !! |
---|
| 61 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: ztrdt, ztrds ! 3D temporary workspace |
---|
[458] | 62 | !!---------------------------------------------------------------------- |
---|
| 63 | |
---|
[503] | 64 | IF( kt == nit000 ) CALL ldf_ctl ! initialisation & control of options |
---|
[458] | 65 | |
---|
| 66 | IF( l_trdtra ) THEN ! temporary save of ta and sa trends |
---|
| 67 | ztrdt(:,:,:) = ta(:,:,:) |
---|
| 68 | ztrds(:,:,:) = sa(:,:,:) |
---|
| 69 | ENDIF |
---|
| 70 | |
---|
| 71 | SELECT CASE ( nldf ) ! compute lateral mixing trend and add it to the general trend |
---|
[503] | 72 | CASE ( 0 ) ; CALL tra_ldf_lap ( kt ) ! iso-level laplacian |
---|
| 73 | CASE ( 1 ) ; CALL tra_ldf_iso ( kt ) ! rotated laplacian (except dk[ dk[.] ] part) |
---|
| 74 | CASE ( 2 ) ; CALL tra_ldf_bilap ( kt ) ! iso-level bilaplacian |
---|
| 75 | CASE ( 3 ) ; CALL tra_ldf_bilapg( kt ) ! s-coord. horizontal bilaplacian |
---|
| 76 | ! |
---|
| 77 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
[458] | 78 | CALL tra_ldf_lap ( kt ) |
---|
| 79 | CALL prt_ctl( tab3d_1=ta, clinfo1=' ldf0 - Ta: ', mask1=tmask, & |
---|
| 80 | & tab3d_2=sa, clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
| 81 | CALL tra_ldf_iso ( kt ) |
---|
| 82 | CALL prt_ctl( tab3d_1=ta, clinfo1=' ldf1 - Ta: ', mask1=tmask, & |
---|
| 83 | & tab3d_2=sa, clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
| 84 | CALL tra_ldf_bilap ( kt ) |
---|
| 85 | CALL prt_ctl( tab3d_1=ta, clinfo1=' ldf2 - Ta: ', mask1=tmask, & |
---|
| 86 | & tab3d_2=sa, clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
| 87 | CALL tra_ldf_bilapg ( kt ) |
---|
| 88 | CALL prt_ctl( tab3d_1=ta, clinfo1=' ldf3 - Ta: ', mask1=tmask, & |
---|
| 89 | & tab3d_2=sa, clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
| 90 | END SELECT |
---|
| 91 | |
---|
| 92 | #if defined key_traldf_ano |
---|
[503] | 93 | ta(:,:,:) = ta(:,:,:) - t0_ldf(:,:,:) ! anomaly: substract the reference diffusivity |
---|
[458] | 94 | sa(:,:,:) = sa(:,:,:) - s0_ldf(:,:,:) |
---|
| 95 | #endif |
---|
[503] | 96 | IF( l_trdtra ) THEN ! save the horizontal diffusive trends for further diagnostics |
---|
[458] | 97 | ztrdt(:,:,:) = ta(:,:,:) - ztrdt(:,:,:) |
---|
| 98 | ztrds(:,:,:) = sa(:,:,:) - ztrds(:,:,:) |
---|
[503] | 99 | CALL trd_mod( ztrdt, ztrds, jptra_trd_ldf, 'TRA', kt ) |
---|
[458] | 100 | ENDIF |
---|
| 101 | ! ! print mean trends (used for debugging) |
---|
| 102 | IF(ln_ctl) CALL prt_ctl( tab3d_1=ta, clinfo1=' ldf - Ta: ', mask1=tmask, & |
---|
| 103 | & tab3d_2=sa, clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
[503] | 104 | ! |
---|
[458] | 105 | END SUBROUTINE tra_ldf |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | SUBROUTINE ldf_ctl |
---|
| 109 | !!---------------------------------------------------------------------- |
---|
| 110 | !! *** ROUTINE ldf_ctl *** |
---|
| 111 | !! |
---|
| 112 | !! ** Purpose : Choice of the operator for the lateral tracer diffusion |
---|
| 113 | !! |
---|
| 114 | !! ** Method : set nldf from the nam_traldf logicals |
---|
| 115 | !! nldf == -1 ESOPA test: ALL operators are used |
---|
| 116 | !! nldf == 0 laplacian operator |
---|
| 117 | !! nldf == 1 Rotated laplacian operator |
---|
| 118 | !! nldf == 2 bilaplacian operator |
---|
| 119 | !! nldf == 3 Rotated bilaplacian |
---|
| 120 | !!---------------------------------------------------------------------- |
---|
| 121 | INTEGER :: ioptio, ierr ! temporary integers |
---|
| 122 | ! |
---|
| 123 | ! NAMELIST/nam_traldf/ ln_traldf_lap , ln_traldf_bilap, & |
---|
| 124 | ! & ln_traldf_level, ln_traldf_hor, ln_traldf_iso, & |
---|
| 125 | ! & aht0, ahtb0, aeiv0 |
---|
| 126 | !!---------------------------------------------------------------------- |
---|
| 127 | |
---|
| 128 | ! Define the lateral mixing oparator for tracers |
---|
| 129 | ! =============================================== |
---|
| 130 | |
---|
| 131 | ! Namelist nam_traldf already read in ldftra module |
---|
| 132 | ! ! Read Namelist nam_traldf : Lateral physics on tracers |
---|
| 133 | ! REWIND( numnam ) |
---|
| 134 | ! READ ( numnam, nam_traldf ) |
---|
| 135 | |
---|
[503] | 136 | IF(lwp) THEN ! Namelist print |
---|
[458] | 137 | WRITE(numout,*) |
---|
| 138 | WRITE(numout,*) 'tra:ldf_ctl : lateral tracer diffusive operator' |
---|
| 139 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
[503] | 140 | WRITE(numout,*) ' Namelist nam_traldf : set lateral mixing parameters (type, direction, coefficients)' |
---|
| 141 | WRITE(numout,*) ' laplacian operator ln_traldf_lap = ', ln_traldf_lap |
---|
| 142 | WRITE(numout,*) ' bilaplacian operator ln_traldf_bilap = ', ln_traldf_bilap |
---|
| 143 | WRITE(numout,*) ' iso-level ln_traldf_level = ', ln_traldf_level |
---|
| 144 | WRITE(numout,*) ' horizontal (geopotential) ln_traldf_hor = ', ln_traldf_hor |
---|
| 145 | WRITE(numout,*) ' iso-neutral ln_traldf_iso = ', ln_traldf_iso |
---|
[458] | 146 | ENDIF |
---|
| 147 | |
---|
[503] | 148 | ! ! control the input |
---|
[458] | 149 | ioptio = 0 |
---|
| 150 | IF( ln_traldf_lap ) ioptio = ioptio + 1 |
---|
| 151 | IF( ln_traldf_bilap ) ioptio = ioptio + 1 |
---|
[503] | 152 | IF( ioptio /= 1 ) CALL ctl_stop( ' use ONE of the 2 lap/bilap operator type on tracer' ) |
---|
[458] | 153 | ioptio = 0 |
---|
| 154 | IF( ln_traldf_level ) ioptio = ioptio + 1 |
---|
| 155 | IF( ln_traldf_hor ) ioptio = ioptio + 1 |
---|
| 156 | IF( ln_traldf_iso ) ioptio = ioptio + 1 |
---|
[503] | 157 | IF( ioptio /= 1 ) CALL ctl_stop( ' use only ONE direction (level/hor/iso)' ) |
---|
[458] | 158 | |
---|
| 159 | ! defined the type of lateral diffusion from ln_traldf_... logicals |
---|
| 160 | ierr = 0 |
---|
| 161 | IF ( ln_traldf_lap ) THEN ! laplacian operator |
---|
| 162 | IF ( ln_zco ) THEN ! z-coordinate |
---|
| 163 | IF ( ln_traldf_level ) nldf = 0 ! iso-level (no rotation) |
---|
| 164 | IF ( ln_traldf_hor ) nldf = 0 ! horizontal (no rotation) |
---|
| 165 | IF ( ln_traldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
| 166 | ENDIF |
---|
| 167 | IF ( ln_zps ) THEN ! z-coordinate |
---|
| 168 | IF ( ln_traldf_level ) ierr = 1 ! iso-level not allowed |
---|
| 169 | IF ( ln_traldf_hor ) nldf = 0 ! horizontal (no rotation) |
---|
| 170 | IF ( ln_traldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
| 171 | ENDIF |
---|
| 172 | IF ( ln_sco ) THEN ! z-coordinate |
---|
| 173 | IF ( ln_traldf_level ) nldf = 0 ! iso-level (no rotation) |
---|
| 174 | IF ( ln_traldf_hor ) nldf = 1 ! horizontal ( rotation) |
---|
| 175 | IF ( ln_traldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
| 176 | ENDIF |
---|
| 177 | ENDIF |
---|
| 178 | |
---|
| 179 | IF( ln_traldf_bilap ) THEN ! bilaplacian operator |
---|
| 180 | IF ( ln_zco ) THEN ! z-coordinate |
---|
| 181 | IF ( ln_traldf_level ) nldf = 2 ! iso-level (no rotation) |
---|
| 182 | IF ( ln_traldf_hor ) nldf = 2 ! horizontal (no rotation) |
---|
| 183 | IF ( ln_traldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
| 184 | ENDIF |
---|
| 185 | IF ( ln_zps ) THEN ! z-coordinate |
---|
| 186 | IF ( ln_traldf_level ) ierr = 1 ! iso-level not allowed |
---|
| 187 | IF ( ln_traldf_hor ) nldf = 2 ! horizontal (no rotation) |
---|
| 188 | IF ( ln_traldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
| 189 | ENDIF |
---|
| 190 | IF ( ln_sco ) THEN ! z-coordinate |
---|
| 191 | IF ( ln_traldf_level ) nldf = 2 ! iso-level (no rotation) |
---|
| 192 | IF ( ln_traldf_hor ) nldf = 3 ! horizontal ( rotation) |
---|
| 193 | IF ( ln_traldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
| 194 | ENDIF |
---|
| 195 | ENDIF |
---|
| 196 | |
---|
[503] | 197 | IF( ierr == 1 ) CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' ) |
---|
| 198 | IF( ierr == 2 ) CALL ctl_stop( ' isoneutral bilaplacian operator does not exist' ) |
---|
| 199 | IF( lk_traldf_eiv .AND. .NOT.ln_traldf_iso ) & |
---|
| 200 | CALL ctl_stop( ' eddy induced velocity on tracers', & |
---|
| 201 | & ' the eddy induced velocity on tracers requires isopycnal laplacian diffusion' ) |
---|
[458] | 202 | IF( nldf == 1 .OR. nldf == 3 ) THEN ! rotation |
---|
[503] | 203 | IF( .NOT.lk_ldfslp ) CALL ctl_stop( ' the rotation of the diffusive tensor require key_ldfslp' ) |
---|
[458] | 204 | ENDIF |
---|
| 205 | |
---|
| 206 | IF( lk_esopa ) THEN |
---|
| 207 | IF(lwp) WRITE(numout,*) ' esopa control: use all lateral physics options' |
---|
| 208 | nldf = -1 |
---|
| 209 | ENDIF |
---|
| 210 | |
---|
| 211 | IF(lwp) THEN |
---|
| 212 | WRITE(numout,*) |
---|
| 213 | IF( nldf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
| 214 | IF( nldf == 0 ) WRITE(numout,*) ' laplacian operator' |
---|
| 215 | IF( nldf == 1 ) WRITE(numout,*) ' Rotated laplacian operator' |
---|
| 216 | IF( nldf == 2 ) WRITE(numout,*) ' bilaplacian operator' |
---|
| 217 | IF( nldf == 3 ) WRITE(numout,*) ' Rotated bilaplacian' |
---|
| 218 | ENDIF |
---|
| 219 | |
---|
| 220 | ! Reference T & S diffusivity (if necessary) |
---|
| 221 | ! =========================== |
---|
| 222 | CALL ldf_ano |
---|
[503] | 223 | ! |
---|
[458] | 224 | END SUBROUTINE ldf_ctl |
---|
| 225 | |
---|
| 226 | #if defined key_traldf_ano |
---|
| 227 | !!---------------------------------------------------------------------- |
---|
| 228 | !! 'key_traldf_ano' T & S lateral diffusion on anomalies |
---|
| 229 | !!---------------------------------------------------------------------- |
---|
| 230 | |
---|
| 231 | SUBROUTINE ldf_ano |
---|
| 232 | !!---------------------------------------------------------------------- |
---|
| 233 | !! *** ROUTINE ldf_ano *** |
---|
| 234 | !! |
---|
| 235 | !! ** Purpose : initializations of |
---|
| 236 | !!---------------------------------------------------------------------- |
---|
| 237 | USE zdf_oce ! vertical mixing |
---|
| 238 | USE trazdf ! vertical mixing: double diffusion |
---|
| 239 | USE zdfddm ! vertical mixing: double diffusion |
---|
[503] | 240 | !! |
---|
| 241 | INTEGER :: jk ! Dummy loop indice |
---|
| 242 | LOGICAL :: llsave ! |
---|
| 243 | REAL(wp) :: zt0, zs0, z12 ! temporary scalar |
---|
| 244 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zt_ref, ztb, zavt ! 3D workspace |
---|
| 245 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zs_ref, zsb ! 3D workspace |
---|
[458] | 246 | !!---------------------------------------------------------------------- |
---|
| 247 | |
---|
| 248 | IF(lwp) THEN |
---|
| 249 | WRITE(numout,*) |
---|
| 250 | WRITE(numout,*) 'tra:ldf_ano : lateral diffusion acting on anomalies' |
---|
| 251 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 252 | ENDIF |
---|
| 253 | |
---|
| 254 | ! defined the T & S reference profiles |
---|
| 255 | ! ------------------------------------ |
---|
| 256 | zt0 =10.e0 ! homogeneous ocean |
---|
| 257 | zs0 =35.e0 |
---|
| 258 | zt_ref(:,:,:) = 10.0 * tmask(:,:,:) |
---|
| 259 | zs_ref(:,:,:) = 35.0 * tmask(:,:,:) |
---|
| 260 | IF(lwp) WRITE(numout,*) ' homogeneous ocean T = ', zt0, ' S = ',zs0 |
---|
| 261 | |
---|
| 262 | ! ! T & S profile (to be coded +namelist parameter |
---|
| 263 | |
---|
| 264 | ! prepare the ldf computation |
---|
| 265 | ! --------------------------- |
---|
| 266 | llsave = l_trdtra |
---|
| 267 | l_trdtra = .false. ! desactivate trend computation |
---|
| 268 | t0_ldf(:,:,:) = 0.e0 |
---|
| 269 | s0_ldf(:,:,:) = 0.e0 |
---|
| 270 | ztb (:,:,:) = tb (:,:,:) |
---|
| 271 | zsb (:,:,:) = sb (:,:,:) |
---|
| 272 | ua (:,:,:) = ta (:,:,:) |
---|
| 273 | va (:,:,:) = sa (:,:,:) |
---|
| 274 | zavt (:,:,:) = avt(:,:,:) |
---|
[474] | 275 | IF( lk_zdfddm ) THEN CALL ctl_stop( ' key_traldf_ano with key_zdfddm not implemented' ) |
---|
[458] | 276 | ! set tb, sb to reference values and avr to zero |
---|
| 277 | tb (:,:,:) = zt_ref(:,:,:) |
---|
| 278 | sb (:,:,:) = zs_ref(:,:,:) |
---|
| 279 | ta (:,:,:) = 0.e0 |
---|
| 280 | sa (:,:,:) = 0.e0 |
---|
| 281 | avt(:,:,:) = 0.e0 |
---|
| 282 | |
---|
| 283 | ! Compute the ldf trends |
---|
| 284 | ! ---------------------- |
---|
| 285 | CALL tra_ldf( nit000+1 ) ! horizontal components (+1: no more init) |
---|
| 286 | CALL tra_zdf( nit000 ) ! vertical component (if necessary nit000 to performed the init) |
---|
| 287 | |
---|
| 288 | ! finalise the computation and recover all arrays |
---|
| 289 | ! ----------------------------------------------- |
---|
| 290 | l_trdtra = llsave |
---|
| 291 | z12 = 2.e0 |
---|
| 292 | IF( neuler == 1) z12 = 1.e0 |
---|
| 293 | IF( ln_zdfexp ) THEN ! ta,sa are the trends |
---|
| 294 | t0_ldf(:,:,:) = ta(:,:,:) |
---|
| 295 | s0_ldf(:,:,:) = sa(:,:,:) |
---|
| 296 | ELSE |
---|
| 297 | DO jk = 1, jpkm1 |
---|
| 298 | t0_ldf(:,:,jk) = ( ta(:,:,jk) - tb(:,:,jk) ) / ( z12 *rdttra(jk) ) |
---|
| 299 | s0_ldf(:,:,jk) = ( sa(:,:,jk) - tb(:,:,jk) ) / ( z12 *rdttra(jk) ) |
---|
| 300 | END DO |
---|
| 301 | ENDIF |
---|
| 302 | tb (:,:,:) = ztb (:,:,:) |
---|
| 303 | sb (:,:,:) = zsb (:,:,:) |
---|
| 304 | ta (:,:,:) = ua (:,:,:) |
---|
| 305 | sa (:,:,:) = va (:,:,:) |
---|
| 306 | avt (:,:,:) = zavt(:,:,:) |
---|
[503] | 307 | ! |
---|
[458] | 308 | END SUBROUTINE ldf_ano |
---|
| 309 | |
---|
| 310 | #else |
---|
| 311 | !!---------------------------------------------------------------------- |
---|
| 312 | !! default option : Dummy code NO T & S background profiles |
---|
| 313 | !!---------------------------------------------------------------------- |
---|
| 314 | SUBROUTINE ldf_ano |
---|
| 315 | IF(lwp) THEN |
---|
| 316 | WRITE(numout,*) |
---|
| 317 | WRITE(numout,*) 'tra:ldf_ano : lateral diffusion acting on the full fields' |
---|
| 318 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 319 | ENDIF |
---|
| 320 | END SUBROUTINE ldf_ano |
---|
| 321 | #endif |
---|
| 322 | |
---|
| 323 | !!====================================================================== |
---|
[503] | 324 | END MODULE traldf |
---|