[458] | 1 | MODULE traldf |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE traldf *** |
---|
| 4 | !! Ocean Active tracers : lateral diffusive trends |
---|
| 5 | !!===================================================================== |
---|
[2528] | 6 | !! History : 9.0 ! 2005-11 (G. Madec) Original code |
---|
| 7 | !! NEMO 3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA |
---|
[458] | 8 | !!---------------------------------------------------------------------- |
---|
[503] | 9 | |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
[2528] | 11 | !! tra_ldf : update the tracer trend with the lateral diffusion |
---|
| 12 | !! tra_ldf_init : initialization, namelist read, and parameters control |
---|
| 13 | !! ldf_ano : compute lateral diffusion for constant T-S profiles |
---|
[458] | 14 | !!---------------------------------------------------------------------- |
---|
| 15 | USE oce ! ocean dynamics and tracers |
---|
| 16 | USE dom_oce ! ocean space and time domain |
---|
| 17 | USE phycst ! physical constants |
---|
| 18 | USE ldftra_oce ! ocean tracer lateral physics |
---|
| 19 | USE ldfslp ! ??? |
---|
| 20 | USE traldf_bilapg ! lateral mixing (tra_ldf_bilapg routine) |
---|
| 21 | USE traldf_bilap ! lateral mixing (tra_ldf_bilap routine) |
---|
| 22 | USE traldf_iso ! lateral mixing (tra_ldf_iso routine) |
---|
[2528] | 23 | USE traldf_iso_grif ! lateral mixing (tra_ldf_iso_grif routine) |
---|
[458] | 24 | USE traldf_lap ! lateral mixing (tra_ldf_lap routine) |
---|
[4990] | 25 | USE trd_oce ! trends: ocean variables |
---|
| 26 | USE trdtra ! trends manager: tracers |
---|
| 27 | ! |
---|
[458] | 28 | USE prtctl ! Print control |
---|
| 29 | USE in_out_manager ! I/O manager |
---|
| 30 | USE lib_mpp ! distribued memory computing library |
---|
| 31 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
[3294] | 32 | USE wrk_nemo ! Memory allocation |
---|
| 33 | USE timing ! Timing |
---|
[11394] | 34 | USE stopack |
---|
[458] | 35 | |
---|
| 36 | IMPLICIT NONE |
---|
| 37 | PRIVATE |
---|
| 38 | |
---|
[4990] | 39 | PUBLIC tra_ldf ! called by step.F90 |
---|
| 40 | PUBLIC tra_ldf_init ! called by opa.F90 |
---|
[2528] | 41 | ! |
---|
| 42 | INTEGER :: nldf = 0 ! type of lateral diffusion used defined from ln_traldf_... namlist logicals) |
---|
[458] | 43 | |
---|
[2715] | 44 | REAL, SAVE, ALLOCATABLE, DIMENSION(:,:,:) :: t0_ldf, s0_ldf !: lateral diffusion trends of T & S for a cst profile |
---|
| 45 | ! ! (key_traldf_ano only) |
---|
[11394] | 46 | #if defined key_traldf_c3d |
---|
[11420] | 47 | REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:,:) :: ahtu0,ahtv0,ahtw0,ahtt0 |
---|
[11394] | 48 | #endif |
---|
| 49 | #if defined key_traldf_c2d |
---|
[11420] | 50 | REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,: ) :: ahtu0,ahtv0,ahtw0,ahtt0 |
---|
[11394] | 51 | #endif |
---|
[2715] | 52 | |
---|
[458] | 53 | !! * Substitutions |
---|
| 54 | # include "domzgr_substitute.h90" |
---|
| 55 | # include "vectopt_loop_substitute.h90" |
---|
[503] | 56 | !!---------------------------------------------------------------------- |
---|
[2528] | 57 | !! NEMO/OPA 3.3 , NEMO Consortium (2010) |
---|
[6486] | 58 | !! $Id$ |
---|
[2528] | 59 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[503] | 60 | !!---------------------------------------------------------------------- |
---|
[458] | 61 | CONTAINS |
---|
| 62 | |
---|
| 63 | SUBROUTINE tra_ldf( kt ) |
---|
| 64 | !!---------------------------------------------------------------------- |
---|
| 65 | !! *** ROUTINE tra_ldf *** |
---|
| 66 | !! |
---|
| 67 | !! ** Purpose : compute the lateral ocean tracer physics. |
---|
| 68 | !!---------------------------------------------------------------------- |
---|
[503] | 69 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 70 | !! |
---|
[3294] | 71 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdt, ztrds |
---|
[458] | 72 | !!---------------------------------------------------------------------- |
---|
[3294] | 73 | ! |
---|
| 74 | IF( nn_timing == 1 ) CALL timing_start('tra_ldf') |
---|
| 75 | ! |
---|
| 76 | rldf = 1 ! For active tracers the |
---|
[6498] | 77 | r_fact_lap(:,:,:) = 1.0 |
---|
[458] | 78 | |
---|
[2528] | 79 | IF( l_trdtra ) THEN !* Save ta and sa trends |
---|
[3294] | 80 | CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds ) |
---|
| 81 | ztrdt(:,:,:) = tsa(:,:,:,jp_tem) |
---|
| 82 | ztrds(:,:,:) = tsa(:,:,:,jp_sal) |
---|
[458] | 83 | ENDIF |
---|
| 84 | |
---|
[11394] | 85 | #if defined key_traldf_c3d |
---|
[11404] | 86 | IF( ( kt == nit000 ) .AND. & |
---|
| 87 | & ln_stopack .AND. & |
---|
| 88 | & (nn_spp_ahtu+nn_spp_ahtv+nn_spp_ahtw+nn_spp_ahtt) > 0 ) THEN |
---|
[11394] | 89 | ALLOCATE ( ahtu0(jpi,jpj,jpk), ahtv0(jpi,jpj,jpk) ) |
---|
| 90 | ALLOCATE ( ahtt0(jpi,jpj,jpk), ahtw0(jpi,jpj,jpk) ) |
---|
| 91 | ahtu0 = ahtu |
---|
| 92 | ahtv0 = ahtv |
---|
| 93 | ahtw0 = ahtw |
---|
| 94 | ahtt0 = ahtt |
---|
| 95 | ENDIF |
---|
| 96 | #endif |
---|
| 97 | #if defined key_traldf_c2d |
---|
[11404] | 98 | IF( ( kt == nit000 ) .AND. & |
---|
| 99 | & ln_stopack .AND. & |
---|
| 100 | & (nn_spp_ahtu+nn_spp_ahtv+nn_spp_ahtw+nn_spp_ahtt) > 0 ) THEN |
---|
[11394] | 101 | ALLOCATE ( ahtu0(jpi,jpj), ahtv0(jpi,jpj) ) |
---|
| 102 | ALLOCATE ( ahtt0(jpi,jpj), ahtw0(jpi,jpj) ) |
---|
| 103 | ahtu0 = ahtu |
---|
| 104 | ahtv0 = ahtv |
---|
| 105 | ahtw0 = ahtw |
---|
| 106 | ahtt0 = ahtt |
---|
| 107 | ENDIF |
---|
| 108 | #endif |
---|
| 109 | #if defined key_traldf_c3d || defined key_traldf_c2d |
---|
[11404] | 110 | IF( ln_stopack .AND. ( nn_spp_ahtu > 0 ) ) THEN |
---|
[11394] | 111 | ahtu = ahtu0 |
---|
| 112 | CALL spp_aht(kt,ahtu,nn_spp_ahtu,rn_ahtu_sd,jk_spp_ahtu) |
---|
| 113 | ENDIF |
---|
[11404] | 114 | IF( ln_stopack .AND. ( nn_spp_ahtv > 0 ) ) THEN |
---|
[11394] | 115 | ahtv = ahtv0 |
---|
| 116 | CALL spp_aht(kt,ahtv,nn_spp_ahtv,rn_ahtv_sd,jk_spp_ahtv) |
---|
| 117 | ENDIF |
---|
[11404] | 118 | IF( ln_stopack .AND. ( nn_spp_ahtw > 0 ) ) THEN |
---|
[11394] | 119 | ahtw = ahtw0 |
---|
| 120 | CALL spp_aht(kt,ahtw,nn_spp_ahtw,rn_ahtw_sd,jk_spp_ahtw) |
---|
| 121 | ENDIF |
---|
[11404] | 122 | IF( ln_stopack .AND. ( nn_spp_ahtt > 0 ) ) THEN |
---|
[11394] | 123 | ahtt = ahtt0 |
---|
| 124 | CALL spp_aht(kt,ahtt,nn_spp_ahtt,rn_ahtt_sd,jk_spp_ahtt) |
---|
| 125 | ENDIF |
---|
| 126 | #endif |
---|
| 127 | |
---|
[458] | 128 | SELECT CASE ( nldf ) ! compute lateral mixing trend and add it to the general trend |
---|
[4990] | 129 | CASE ( 0 ) ; CALL tra_ldf_lap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
| 130 | & tsb, tsa, jpts ) ! iso-level laplacian |
---|
[2528] | 131 | CASE ( 1 ) ! rotated laplacian |
---|
| 132 | IF( ln_traldf_grif ) THEN |
---|
[3294] | 133 | CALL tra_ldf_iso_grif( kt, nit000,'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 ) ! Griffies operator |
---|
[2528] | 134 | ELSE |
---|
[4990] | 135 | CALL tra_ldf_iso ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
| 136 | & tsb, tsa, jpts, ahtb0 ) ! Madec operator |
---|
[2528] | 137 | ENDIF |
---|
[4990] | 138 | CASE ( 2 ) ; CALL tra_ldf_bilap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
| 139 | & tsb, tsa, jpts ) ! iso-level bilaplacian |
---|
[3294] | 140 | CASE ( 3 ) ; CALL tra_ldf_bilapg ( kt, nit000, 'TRA', tsb, tsa, jpts ) ! s-coord. geopot. bilap. |
---|
[503] | 141 | ! |
---|
[2528] | 142 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
[4990] | 143 | CALL tra_ldf_lap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
| 144 | & tsb, tsa, jpts ) |
---|
[2528] | 145 | CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf0 - Ta: ', mask1=tmask, & |
---|
| 146 | & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
| 147 | IF( ln_traldf_grif ) THEN |
---|
[3294] | 148 | CALL tra_ldf_iso_grif( kt, nit000, 'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 ) |
---|
[2528] | 149 | ELSE |
---|
[4990] | 150 | CALL tra_ldf_iso ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
| 151 | & tsb, tsa, jpts, ahtb0 ) |
---|
[2528] | 152 | ENDIF |
---|
| 153 | CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf1 - Ta: ', mask1=tmask, & |
---|
| 154 | & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
[4990] | 155 | CALL tra_ldf_bilap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
| 156 | & tsb, tsa, jpts ) |
---|
[2528] | 157 | CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf2 - Ta: ', mask1=tmask, & |
---|
| 158 | & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
[3294] | 159 | CALL tra_ldf_bilapg( kt, nit000, 'TRA', tsb, tsa, jpts ) |
---|
[2528] | 160 | CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf3 - Ta: ', mask1=tmask, & |
---|
| 161 | & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
[458] | 162 | END SELECT |
---|
| 163 | |
---|
| 164 | #if defined key_traldf_ano |
---|
[2528] | 165 | tsa(:,:,:,jp_tem) = tsa(:,:,:,jp_tem) - t0_ldf(:,:,:) ! anomaly: substract the reference diffusivity |
---|
| 166 | tsa(:,:,:,jp_sal) = tsa(:,:,:,jp_sal) - s0_ldf(:,:,:) |
---|
[458] | 167 | #endif |
---|
[2528] | 168 | |
---|
[503] | 169 | IF( l_trdtra ) THEN ! save the horizontal diffusive trends for further diagnostics |
---|
[2528] | 170 | ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) |
---|
| 171 | ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:) |
---|
[4990] | 172 | CALL trd_tra( kt, 'TRA', jp_tem, jptra_ldf, ztrdt ) |
---|
| 173 | CALL trd_tra( kt, 'TRA', jp_sal, jptra_ldf, ztrds ) |
---|
[3294] | 174 | CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds ) |
---|
[458] | 175 | ENDIF |
---|
| 176 | ! ! print mean trends (used for debugging) |
---|
[2528] | 177 | IF(ln_ctl) CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf - Ta: ', mask1=tmask, & |
---|
| 178 | & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
[503] | 179 | ! |
---|
[3294] | 180 | IF( nn_timing == 1 ) CALL timing_stop('tra_ldf') |
---|
| 181 | ! |
---|
[458] | 182 | END SUBROUTINE tra_ldf |
---|
| 183 | |
---|
| 184 | |
---|
[2528] | 185 | SUBROUTINE tra_ldf_init |
---|
[458] | 186 | !!---------------------------------------------------------------------- |
---|
[2528] | 187 | !! *** ROUTINE tra_ldf_init *** |
---|
[458] | 188 | !! |
---|
| 189 | !! ** Purpose : Choice of the operator for the lateral tracer diffusion |
---|
| 190 | !! |
---|
[1601] | 191 | !! ** Method : set nldf from the namtra_ldf logicals |
---|
[458] | 192 | !! nldf == -1 ESOPA test: ALL operators are used |
---|
| 193 | !! nldf == 0 laplacian operator |
---|
| 194 | !! nldf == 1 Rotated laplacian operator |
---|
| 195 | !! nldf == 2 bilaplacian operator |
---|
| 196 | !! nldf == 3 Rotated bilaplacian |
---|
| 197 | !!---------------------------------------------------------------------- |
---|
| 198 | INTEGER :: ioptio, ierr ! temporary integers |
---|
| 199 | !!---------------------------------------------------------------------- |
---|
| 200 | |
---|
| 201 | ! Define the lateral mixing oparator for tracers |
---|
| 202 | ! =============================================== |
---|
| 203 | |
---|
[503] | 204 | IF(lwp) THEN ! Namelist print |
---|
[458] | 205 | WRITE(numout,*) |
---|
[2528] | 206 | WRITE(numout,*) 'tra_ldf_init : lateral tracer diffusive operator' |
---|
[458] | 207 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
[2528] | 208 | WRITE(numout,*) ' Namelist namtra_ldf already read in ldftra module' |
---|
| 209 | WRITE(numout,*) ' see ldf_tra_init report for lateral mixing parameters' |
---|
| 210 | WRITE(numout,*) |
---|
[458] | 211 | ENDIF |
---|
| 212 | |
---|
[503] | 213 | ! ! control the input |
---|
[458] | 214 | ioptio = 0 |
---|
| 215 | IF( ln_traldf_lap ) ioptio = ioptio + 1 |
---|
| 216 | IF( ln_traldf_bilap ) ioptio = ioptio + 1 |
---|
[620] | 217 | IF( ioptio > 1 ) CALL ctl_stop( ' use ONE or NONE of the 2 lap/bilap operator type on tracer' ) |
---|
| 218 | IF( ioptio == 0 ) nldf = -2 ! No lateral diffusion |
---|
[458] | 219 | ioptio = 0 |
---|
| 220 | IF( ln_traldf_level ) ioptio = ioptio + 1 |
---|
| 221 | IF( ln_traldf_hor ) ioptio = ioptio + 1 |
---|
| 222 | IF( ln_traldf_iso ) ioptio = ioptio + 1 |
---|
[3294] | 223 | IF( ioptio > 1 ) CALL ctl_stop( ' use only ONE direction (level/hor/iso)' ) |
---|
[458] | 224 | |
---|
| 225 | ! defined the type of lateral diffusion from ln_traldf_... logicals |
---|
[902] | 226 | ! CAUTION : nldf = 1 is used in trazdf_imp, change it carefully |
---|
[458] | 227 | ierr = 0 |
---|
[620] | 228 | IF( ln_traldf_lap ) THEN ! laplacian operator |
---|
[458] | 229 | IF ( ln_zco ) THEN ! z-coordinate |
---|
| 230 | IF ( ln_traldf_level ) nldf = 0 ! iso-level (no rotation) |
---|
| 231 | IF ( ln_traldf_hor ) nldf = 0 ! horizontal (no rotation) |
---|
| 232 | IF ( ln_traldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
| 233 | ENDIF |
---|
[4990] | 234 | IF ( ln_zps ) THEN ! zps-coordinate |
---|
[458] | 235 | IF ( ln_traldf_level ) ierr = 1 ! iso-level not allowed |
---|
| 236 | IF ( ln_traldf_hor ) nldf = 0 ! horizontal (no rotation) |
---|
| 237 | IF ( ln_traldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
| 238 | ENDIF |
---|
[4990] | 239 | IF ( ln_sco ) THEN ! s-coordinate |
---|
[458] | 240 | IF ( ln_traldf_level ) nldf = 0 ! iso-level (no rotation) |
---|
| 241 | IF ( ln_traldf_hor ) nldf = 1 ! horizontal ( rotation) |
---|
| 242 | IF ( ln_traldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
| 243 | ENDIF |
---|
| 244 | ENDIF |
---|
| 245 | |
---|
| 246 | IF( ln_traldf_bilap ) THEN ! bilaplacian operator |
---|
| 247 | IF ( ln_zco ) THEN ! z-coordinate |
---|
| 248 | IF ( ln_traldf_level ) nldf = 2 ! iso-level (no rotation) |
---|
| 249 | IF ( ln_traldf_hor ) nldf = 2 ! horizontal (no rotation) |
---|
| 250 | IF ( ln_traldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
| 251 | ENDIF |
---|
[4990] | 252 | IF ( ln_zps ) THEN ! zps-coordinate |
---|
[458] | 253 | IF ( ln_traldf_level ) ierr = 1 ! iso-level not allowed |
---|
| 254 | IF ( ln_traldf_hor ) nldf = 2 ! horizontal (no rotation) |
---|
| 255 | IF ( ln_traldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
| 256 | ENDIF |
---|
[4990] | 257 | IF ( ln_sco ) THEN ! s-coordinate |
---|
[458] | 258 | IF ( ln_traldf_level ) nldf = 2 ! iso-level (no rotation) |
---|
| 259 | IF ( ln_traldf_hor ) nldf = 3 ! horizontal ( rotation) |
---|
| 260 | IF ( ln_traldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
| 261 | ENDIF |
---|
| 262 | ENDIF |
---|
| 263 | |
---|
[4488] | 264 | IF( nldf == 3 ) CALL ctl_warn( 'geopotential bilaplacian tracer diffusion in s-coords not thoroughly tested' ) |
---|
[503] | 265 | IF( ierr == 1 ) CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' ) |
---|
| 266 | IF( ierr == 2 ) CALL ctl_stop( ' isoneutral bilaplacian operator does not exist' ) |
---|
[11394] | 267 | IF( ln_traldf_hor .AND. ln_traldf_grif ) & |
---|
| 268 | & CALL ctl_stop( ' horizontal operator and Griffies triads not available; sitch to isoneutral operator' ) |
---|
[6498] | 269 | IF( ln_traldf_grif .AND. ln_isfcav ) & |
---|
| 270 | CALL ctl_stop( ' ice shelf and traldf_grif not tested') |
---|
[503] | 271 | IF( lk_traldf_eiv .AND. .NOT.ln_traldf_iso ) & |
---|
| 272 | CALL ctl_stop( ' eddy induced velocity on tracers', & |
---|
| 273 | & ' the eddy induced velocity on tracers requires isopycnal laplacian diffusion' ) |
---|
[458] | 274 | IF( nldf == 1 .OR. nldf == 3 ) THEN ! rotation |
---|
[503] | 275 | IF( .NOT.lk_ldfslp ) CALL ctl_stop( ' the rotation of the diffusive tensor require key_ldfslp' ) |
---|
[915] | 276 | l_traldf_rot = .TRUE. ! needed for trazdf_imp |
---|
[458] | 277 | ENDIF |
---|
| 278 | |
---|
| 279 | IF( lk_esopa ) THEN |
---|
| 280 | IF(lwp) WRITE(numout,*) ' esopa control: use all lateral physics options' |
---|
| 281 | nldf = -1 |
---|
| 282 | ENDIF |
---|
| 283 | |
---|
| 284 | IF(lwp) THEN |
---|
| 285 | WRITE(numout,*) |
---|
[620] | 286 | IF( nldf == -2 ) WRITE(numout,*) ' NO lateral diffusion' |
---|
| 287 | IF( nldf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
| 288 | IF( nldf == 0 ) WRITE(numout,*) ' laplacian operator' |
---|
| 289 | IF( nldf == 1 ) WRITE(numout,*) ' Rotated laplacian operator' |
---|
| 290 | IF( nldf == 2 ) WRITE(numout,*) ' bilaplacian operator' |
---|
| 291 | IF( nldf == 3 ) WRITE(numout,*) ' Rotated bilaplacian' |
---|
[458] | 292 | ENDIF |
---|
| 293 | |
---|
| 294 | ! Reference T & S diffusivity (if necessary) |
---|
| 295 | ! =========================== |
---|
| 296 | CALL ldf_ano |
---|
[503] | 297 | ! |
---|
[2528] | 298 | END SUBROUTINE tra_ldf_init |
---|
[458] | 299 | |
---|
| 300 | #if defined key_traldf_ano |
---|
| 301 | !!---------------------------------------------------------------------- |
---|
| 302 | !! 'key_traldf_ano' T & S lateral diffusion on anomalies |
---|
| 303 | !!---------------------------------------------------------------------- |
---|
| 304 | |
---|
| 305 | SUBROUTINE ldf_ano |
---|
| 306 | !!---------------------------------------------------------------------- |
---|
| 307 | !! *** ROUTINE ldf_ano *** |
---|
| 308 | !! |
---|
| 309 | !! ** Purpose : initializations of |
---|
| 310 | !!---------------------------------------------------------------------- |
---|
[2715] | 311 | ! |
---|
[458] | 312 | USE zdf_oce ! vertical mixing |
---|
| 313 | USE trazdf ! vertical mixing: double diffusion |
---|
| 314 | USE zdfddm ! vertical mixing: double diffusion |
---|
[2715] | 315 | ! |
---|
[503] | 316 | INTEGER :: jk ! Dummy loop indice |
---|
[2715] | 317 | INTEGER :: ierr ! local integer |
---|
| 318 | LOGICAL :: llsave ! local logical |
---|
| 319 | REAL(wp) :: zt0, zs0, z12 ! local scalar |
---|
[3294] | 320 | REAL(wp), POINTER, DIMENSION(:,:,:) :: zt_ref, zs_ref, ztb, zsb, zavt |
---|
[458] | 321 | !!---------------------------------------------------------------------- |
---|
[3294] | 322 | ! |
---|
| 323 | IF( nn_timing == 1 ) CALL timing_start('ldf_ano') |
---|
| 324 | ! |
---|
| 325 | CALL wrk_alloc( jpi, jpj, jpk, zt_ref, zs_ref, ztb, zsb, zavt ) |
---|
| 326 | ! |
---|
[458] | 327 | |
---|
| 328 | IF(lwp) THEN |
---|
| 329 | WRITE(numout,*) |
---|
| 330 | WRITE(numout,*) 'tra:ldf_ano : lateral diffusion acting on anomalies' |
---|
| 331 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 332 | ENDIF |
---|
| 333 | |
---|
[2715] | 334 | ! ! allocate trabbl arrays |
---|
| 335 | ALLOCATE( t0_ldf(jpi,jpj,jpk) , s0_ldf(jpi,jpj,jpk) , STAT=ierr ) |
---|
| 336 | IF( lk_mpp ) CALL mpp_sum( ierr ) |
---|
| 337 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'ldf_ano: unable to allocate arrays' ) |
---|
| 338 | |
---|
[458] | 339 | ! defined the T & S reference profiles |
---|
| 340 | ! ------------------------------------ |
---|
| 341 | zt0 =10.e0 ! homogeneous ocean |
---|
| 342 | zs0 =35.e0 |
---|
| 343 | zt_ref(:,:,:) = 10.0 * tmask(:,:,:) |
---|
| 344 | zs_ref(:,:,:) = 35.0 * tmask(:,:,:) |
---|
| 345 | IF(lwp) WRITE(numout,*) ' homogeneous ocean T = ', zt0, ' S = ',zs0 |
---|
| 346 | |
---|
[5120] | 347 | ! Initialisation of gtui/gtvi in case of no cavity |
---|
| 348 | IF ( .NOT. ln_isfcav ) THEN |
---|
| 349 | gtui(:,:,:) = 0.0_wp |
---|
| 350 | gtvi(:,:,:) = 0.0_wp |
---|
| 351 | END IF |
---|
[458] | 352 | ! ! T & S profile (to be coded +namelist parameter |
---|
| 353 | |
---|
| 354 | ! prepare the ldf computation |
---|
| 355 | ! --------------------------- |
---|
| 356 | llsave = l_trdtra |
---|
| 357 | l_trdtra = .false. ! desactivate trend computation |
---|
| 358 | t0_ldf(:,:,:) = 0.e0 |
---|
| 359 | s0_ldf(:,:,:) = 0.e0 |
---|
[2528] | 360 | ztb (:,:,:) = tsb (:,:,:,jp_tem) |
---|
| 361 | zsb (:,:,:) = tsb (:,:,:,jp_sal) |
---|
| 362 | ua (:,:,:) = tsa (:,:,:,jp_tem) |
---|
| 363 | va (:,:,:) = tsa (:,:,:,jp_sal) |
---|
[458] | 364 | zavt (:,:,:) = avt(:,:,:) |
---|
[474] | 365 | IF( lk_zdfddm ) THEN CALL ctl_stop( ' key_traldf_ano with key_zdfddm not implemented' ) |
---|
[458] | 366 | ! set tb, sb to reference values and avr to zero |
---|
[2528] | 367 | tsb (:,:,:,jp_tem) = zt_ref(:,:,:) |
---|
| 368 | tsb (:,:,:,jp_sal) = zs_ref(:,:,:) |
---|
| 369 | tsa (:,:,:,jp_tem) = 0.e0 |
---|
| 370 | tsa (:,:,:,jp_sal) = 0.e0 |
---|
| 371 | avt(:,:,:) = 0.e0 |
---|
[458] | 372 | |
---|
| 373 | ! Compute the ldf trends |
---|
| 374 | ! ---------------------- |
---|
[3294] | 375 | CALL tra_ldf( nit000 + 1 ) ! horizontal components (+1: no more init) |
---|
| 376 | CALL tra_zdf( nit000 ) ! vertical component (if necessary nit000 to performed the init) |
---|
[458] | 377 | |
---|
| 378 | ! finalise the computation and recover all arrays |
---|
| 379 | ! ----------------------------------------------- |
---|
| 380 | l_trdtra = llsave |
---|
| 381 | z12 = 2.e0 |
---|
| 382 | IF( neuler == 1) z12 = 1.e0 |
---|
| 383 | IF( ln_zdfexp ) THEN ! ta,sa are the trends |
---|
[2528] | 384 | t0_ldf(:,:,:) = tsa(:,:,:,jp_tem) |
---|
| 385 | s0_ldf(:,:,:) = tsa(:,:,:,jp_sal) |
---|
[458] | 386 | ELSE |
---|
| 387 | DO jk = 1, jpkm1 |
---|
[2528] | 388 | t0_ldf(:,:,jk) = ( tsa(:,:,jk,jp_tem) - tsb(:,:,jk,jp_tem) ) / ( z12 *rdttra(jk) ) |
---|
| 389 | s0_ldf(:,:,jk) = ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / ( z12 *rdttra(jk) ) |
---|
[458] | 390 | END DO |
---|
| 391 | ENDIF |
---|
[2528] | 392 | tsb(:,:,:,jp_tem) = ztb (:,:,:) |
---|
| 393 | tsb(:,:,:,jp_sal) = zsb (:,:,:) |
---|
| 394 | tsa(:,:,:,jp_tem) = ua (:,:,:) |
---|
| 395 | tsa(:,:,:,jp_sal) = va (:,:,:) |
---|
| 396 | avt(:,:,:) = zavt(:,:,:) |
---|
[503] | 397 | ! |
---|
[3294] | 398 | CALL wrk_dealloc( jpi, jpj, jpk, zt_ref, zs_ref, ztb, zsb, zavt ) |
---|
[2715] | 399 | ! |
---|
[3294] | 400 | IF( nn_timing == 1 ) CALL timing_stop('ldf_ano') |
---|
| 401 | ! |
---|
[458] | 402 | END SUBROUTINE ldf_ano |
---|
| 403 | |
---|
| 404 | #else |
---|
| 405 | !!---------------------------------------------------------------------- |
---|
| 406 | !! default option : Dummy code NO T & S background profiles |
---|
| 407 | !!---------------------------------------------------------------------- |
---|
| 408 | SUBROUTINE ldf_ano |
---|
| 409 | IF(lwp) THEN |
---|
| 410 | WRITE(numout,*) |
---|
| 411 | WRITE(numout,*) 'tra:ldf_ano : lateral diffusion acting on the full fields' |
---|
| 412 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 413 | ENDIF |
---|
| 414 | END SUBROUTINE ldf_ano |
---|
| 415 | #endif |
---|
| 416 | |
---|
| 417 | !!====================================================================== |
---|
[620] | 418 | END MODULE traldf |
---|