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