1 | MODULE traldf |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE traldf *** |
---|
4 | !! Ocean Active tracers : lateral diffusive trends |
---|
5 | !!===================================================================== |
---|
6 | !! History : 9.0 ! 2005-11 (G. Madec) Original code |
---|
7 | !! NEMO 3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA |
---|
8 | !!---------------------------------------------------------------------- |
---|
9 | |
---|
10 | !!---------------------------------------------------------------------- |
---|
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 |
---|
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) |
---|
23 | USE traldf_iso_grif ! lateral mixing (tra_ldf_iso_grif routine) |
---|
24 | USE traldf_lap ! lateral mixing (tra_ldf_lap routine) |
---|
25 | USE trd_oce ! trends: ocean variables |
---|
26 | USE trdtra ! trends manager: tracers |
---|
27 | ! |
---|
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) |
---|
32 | USE wrk_nemo ! Memory allocation |
---|
33 | USE timing ! Timing |
---|
34 | USE stopack |
---|
35 | |
---|
36 | IMPLICIT NONE |
---|
37 | PRIVATE |
---|
38 | |
---|
39 | PUBLIC tra_ldf ! called by step.F90 |
---|
40 | PUBLIC tra_ldf_init ! called by opa.F90 |
---|
41 | ! |
---|
42 | INTEGER :: nldf = 0 ! type of lateral diffusion used defined from ln_traldf_... namlist logicals) |
---|
43 | |
---|
44 | REAL, SAVE, ALLOCATABLE, DIMENSION(:,:,:) :: t0_ldf, s0_ldf !: lateral diffusion trends of T & S for a cst profile |
---|
45 | ! ! (key_traldf_ano only) |
---|
46 | #if defined key_traldf_c3d |
---|
47 | REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:,:) :: ahtu0, ahtv0, ahtw0, ahtt0 |
---|
48 | #endif |
---|
49 | #if defined key_traldf_c2d |
---|
50 | REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,: ) :: ahtu0, ahtv0, ahtw0, ahtt0 |
---|
51 | #endif |
---|
52 | |
---|
53 | !! * Substitutions |
---|
54 | # include "domzgr_substitute.h90" |
---|
55 | # include "vectopt_loop_substitute.h90" |
---|
56 | !!---------------------------------------------------------------------- |
---|
57 | !! NEMO/OPA 3.3 , NEMO Consortium (2010) |
---|
58 | !! $Id$ |
---|
59 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
60 | !!---------------------------------------------------------------------- |
---|
61 | CONTAINS |
---|
62 | |
---|
63 | SUBROUTINE tra_ldf( kt ) |
---|
64 | !!---------------------------------------------------------------------- |
---|
65 | !! *** ROUTINE tra_ldf *** |
---|
66 | !! |
---|
67 | !! ** Purpose : compute the lateral ocean tracer physics. |
---|
68 | !!---------------------------------------------------------------------- |
---|
69 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
70 | !! |
---|
71 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdt, ztrds |
---|
72 | !!---------------------------------------------------------------------- |
---|
73 | ! |
---|
74 | IF( nn_timing == 1 ) CALL timing_start('tra_ldf') |
---|
75 | ! |
---|
76 | rldf = 1 ! For active tracers the |
---|
77 | r_fact_lap(:,:,:) = 1.0 |
---|
78 | |
---|
79 | IF( l_trdtra ) THEN !* Save ta and sa trends |
---|
80 | CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds ) |
---|
81 | ztrdt(:,:,:) = tsa(:,:,:,jp_tem) |
---|
82 | ztrds(:,:,:) = tsa(:,:,:,jp_sal) |
---|
83 | ENDIF |
---|
84 | |
---|
85 | #if defined key_traldf_c3d |
---|
86 | IF( ( kt == nit000 ) .AND. & |
---|
87 | & ( ln_stopack ) .AND. & |
---|
88 | & ( ( nn_spp_ahtu + nn_spp_ahtv + nn_spp_ahtw + nn_spp_ahtt ) > 0 ) ) THEN |
---|
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 |
---|
98 | IF( ( kt == nit000 ) .AND. & |
---|
99 | & ( ln_stopack ) .AND. & |
---|
100 | & ( ( nn_spp_ahtu + nn_spp_ahtv + nn_spp_ahtw + nn_spp_ahtt ) > 0 ) ) THEN |
---|
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 |
---|
110 | IF( ln_stopack .AND. ( nn_spp_ahtu > 0 ) ) THEN |
---|
111 | ahtu = ahtu0 |
---|
112 | CALL spp_aht(kt, ahtu, nn_spp_ahtu, rn_ahtu_sd, jk_spp_ahtu) |
---|
113 | ENDIF |
---|
114 | IF( ln_stopack .AND. ( nn_spp_ahtv > 0 ) ) THEN |
---|
115 | ahtv = ahtv0 |
---|
116 | CALL spp_aht(kt, ahtv, nn_spp_ahtv, rn_ahtv_sd, jk_spp_ahtv) |
---|
117 | ENDIF |
---|
118 | IF( ln_stopack .AND. ( nn_spp_ahtw > 0 ) ) THEN |
---|
119 | ahtw = ahtw0 |
---|
120 | CALL spp_aht(kt, ahtw, nn_spp_ahtw, rn_ahtw_sd, jk_spp_ahtw) |
---|
121 | ENDIF |
---|
122 | IF( ln_stopack .AND. ( nn_spp_ahtt > 0 ) ) THEN |
---|
123 | ahtt = ahtt0 |
---|
124 | CALL spp_aht(kt, ahtt, nn_spp_ahtt, rn_ahtt_sd, jk_spp_ahtt) |
---|
125 | ENDIF |
---|
126 | #endif |
---|
127 | |
---|
128 | SELECT CASE ( nldf ) ! compute lateral mixing trend and add it to the general trend |
---|
129 | CASE ( 0 ) ; CALL tra_ldf_lap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
130 | & tsb, tsa, jpts ) ! iso-level laplacian |
---|
131 | CASE ( 1 ) ! rotated laplacian |
---|
132 | IF( ln_traldf_grif ) THEN |
---|
133 | CALL tra_ldf_iso_grif( kt, nit000,'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 ) ! Griffies operator |
---|
134 | ELSE |
---|
135 | CALL tra_ldf_iso ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
136 | & tsb, tsa, jpts, ahtb0 ) ! Madec operator |
---|
137 | ENDIF |
---|
138 | CASE ( 2 ) ; CALL tra_ldf_bilap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
139 | & tsb, tsa, jpts ) ! iso-level bilaplacian |
---|
140 | CASE ( 3 ) ; CALL tra_ldf_bilapg ( kt, nit000, 'TRA', tsb, tsa, jpts ) ! s-coord. geopot. bilap. |
---|
141 | ! |
---|
142 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
143 | CALL tra_ldf_lap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
144 | & tsb, tsa, jpts ) |
---|
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 |
---|
148 | CALL tra_ldf_iso_grif( kt, nit000, 'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 ) |
---|
149 | ELSE |
---|
150 | CALL tra_ldf_iso ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
151 | & tsb, tsa, jpts, ahtb0 ) |
---|
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' ) |
---|
155 | CALL tra_ldf_bilap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & |
---|
156 | & tsb, tsa, jpts ) |
---|
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' ) |
---|
159 | CALL tra_ldf_bilapg( kt, nit000, 'TRA', tsb, tsa, jpts ) |
---|
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' ) |
---|
162 | END SELECT |
---|
163 | |
---|
164 | #if defined key_traldf_ano |
---|
165 | tsa(:,:,:,jp_tem) = tsa(:,:,:,jp_tem) - t0_ldf(:,:,:) ! anomaly: substract the reference diffusivity |
---|
166 | tsa(:,:,:,jp_sal) = tsa(:,:,:,jp_sal) - s0_ldf(:,:,:) |
---|
167 | #endif |
---|
168 | |
---|
169 | IF( l_trdtra ) THEN ! save the horizontal diffusive trends for further diagnostics |
---|
170 | ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) |
---|
171 | ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:) |
---|
172 | CALL trd_tra( kt, 'TRA', jp_tem, jptra_ldf, ztrdt ) |
---|
173 | CALL trd_tra( kt, 'TRA', jp_sal, jptra_ldf, ztrds ) |
---|
174 | CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds ) |
---|
175 | ENDIF |
---|
176 | ! ! print mean trends (used for debugging) |
---|
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' ) |
---|
179 | ! |
---|
180 | IF( nn_timing == 1 ) CALL timing_stop('tra_ldf') |
---|
181 | ! |
---|
182 | END SUBROUTINE tra_ldf |
---|
183 | |
---|
184 | |
---|
185 | SUBROUTINE tra_ldf_init |
---|
186 | !!---------------------------------------------------------------------- |
---|
187 | !! *** ROUTINE tra_ldf_init *** |
---|
188 | !! |
---|
189 | !! ** Purpose : Choice of the operator for the lateral tracer diffusion |
---|
190 | !! |
---|
191 | !! ** Method : set nldf from the namtra_ldf logicals |
---|
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 | |
---|
204 | IF(lwp) THEN ! Namelist print |
---|
205 | WRITE(numout,*) |
---|
206 | WRITE(numout,*) 'tra_ldf_init : lateral tracer diffusive operator' |
---|
207 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
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,*) |
---|
211 | ENDIF |
---|
212 | |
---|
213 | ! ! control the input |
---|
214 | ioptio = 0 |
---|
215 | IF( ln_traldf_lap ) ioptio = ioptio + 1 |
---|
216 | IF( ln_traldf_bilap ) ioptio = ioptio + 1 |
---|
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 |
---|
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 |
---|
223 | IF( ioptio > 1 ) CALL ctl_stop( ' use only ONE direction (level/hor/iso)' ) |
---|
224 | |
---|
225 | ! defined the type of lateral diffusion from ln_traldf_... logicals |
---|
226 | ! CAUTION : nldf = 1 is used in trazdf_imp, change it carefully |
---|
227 | ierr = 0 |
---|
228 | IF( ln_traldf_lap ) THEN ! laplacian operator |
---|
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 |
---|
234 | IF ( ln_zps ) THEN ! zps-coordinate |
---|
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 |
---|
239 | IF ( ln_sco ) THEN ! s-coordinate |
---|
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 |
---|
252 | IF ( ln_zps ) THEN ! zps-coordinate |
---|
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 |
---|
257 | IF ( ln_sco ) THEN ! s-coordinate |
---|
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 | |
---|
264 | IF( nldf == 3 ) CALL ctl_warn( 'geopotential bilaplacian tracer diffusion in s-coords not thoroughly tested' ) |
---|
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' ) |
---|
267 | IF( ln_traldf_grif .AND. ln_isfcav ) & |
---|
268 | CALL ctl_stop( ' ice shelf and traldf_grif not tested') |
---|
269 | IF( lk_traldf_eiv .AND. .NOT.ln_traldf_iso ) & |
---|
270 | CALL ctl_stop( ' eddy induced velocity on tracers', & |
---|
271 | & ' the eddy induced velocity on tracers requires isopycnal laplacian diffusion' ) |
---|
272 | IF( nldf == 1 .OR. nldf == 3 ) THEN ! rotation |
---|
273 | IF( .NOT.lk_ldfslp ) CALL ctl_stop( ' the rotation of the diffusive tensor require key_ldfslp' ) |
---|
274 | l_traldf_rot = .TRUE. ! needed for trazdf_imp |
---|
275 | ENDIF |
---|
276 | |
---|
277 | IF( lk_esopa ) THEN |
---|
278 | IF(lwp) WRITE(numout,*) ' esopa control: use all lateral physics options' |
---|
279 | nldf = -1 |
---|
280 | ENDIF |
---|
281 | |
---|
282 | IF(lwp) THEN |
---|
283 | WRITE(numout,*) |
---|
284 | IF( nldf == -2 ) WRITE(numout,*) ' NO lateral diffusion' |
---|
285 | IF( nldf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
286 | IF( nldf == 0 ) WRITE(numout,*) ' laplacian operator' |
---|
287 | IF( nldf == 1 ) WRITE(numout,*) ' Rotated laplacian operator' |
---|
288 | IF( nldf == 2 ) WRITE(numout,*) ' bilaplacian operator' |
---|
289 | IF( nldf == 3 ) WRITE(numout,*) ' Rotated bilaplacian' |
---|
290 | ENDIF |
---|
291 | |
---|
292 | ! Reference T & S diffusivity (if necessary) |
---|
293 | ! =========================== |
---|
294 | CALL ldf_ano |
---|
295 | ! |
---|
296 | END SUBROUTINE tra_ldf_init |
---|
297 | |
---|
298 | #if defined key_traldf_ano |
---|
299 | !!---------------------------------------------------------------------- |
---|
300 | !! 'key_traldf_ano' T & S lateral diffusion on anomalies |
---|
301 | !!---------------------------------------------------------------------- |
---|
302 | |
---|
303 | SUBROUTINE ldf_ano |
---|
304 | !!---------------------------------------------------------------------- |
---|
305 | !! *** ROUTINE ldf_ano *** |
---|
306 | !! |
---|
307 | !! ** Purpose : initializations of |
---|
308 | !!---------------------------------------------------------------------- |
---|
309 | ! |
---|
310 | USE zdf_oce ! vertical mixing |
---|
311 | USE trazdf ! vertical mixing: double diffusion |
---|
312 | USE zdfddm ! vertical mixing: double diffusion |
---|
313 | ! |
---|
314 | INTEGER :: jk ! Dummy loop indice |
---|
315 | INTEGER :: ierr ! local integer |
---|
316 | LOGICAL :: llsave ! local logical |
---|
317 | REAL(wp) :: zt0, zs0, z12 ! local scalar |
---|
318 | REAL(wp), POINTER, DIMENSION(:,:,:) :: zt_ref, zs_ref, ztb, zsb, zavt |
---|
319 | !!---------------------------------------------------------------------- |
---|
320 | ! |
---|
321 | IF( nn_timing == 1 ) CALL timing_start('ldf_ano') |
---|
322 | ! |
---|
323 | CALL wrk_alloc( jpi, jpj, jpk, zt_ref, zs_ref, ztb, zsb, zavt ) |
---|
324 | ! |
---|
325 | |
---|
326 | IF(lwp) THEN |
---|
327 | WRITE(numout,*) |
---|
328 | WRITE(numout,*) 'tra:ldf_ano : lateral diffusion acting on anomalies' |
---|
329 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
330 | ENDIF |
---|
331 | |
---|
332 | ! ! allocate trabbl arrays |
---|
333 | ALLOCATE( t0_ldf(jpi,jpj,jpk) , s0_ldf(jpi,jpj,jpk) , STAT=ierr ) |
---|
334 | IF( lk_mpp ) CALL mpp_sum( ierr ) |
---|
335 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'ldf_ano: unable to allocate arrays' ) |
---|
336 | |
---|
337 | ! defined the T & S reference profiles |
---|
338 | ! ------------------------------------ |
---|
339 | zt0 =10.e0 ! homogeneous ocean |
---|
340 | zs0 =35.e0 |
---|
341 | zt_ref(:,:,:) = 10.0 * tmask(:,:,:) |
---|
342 | zs_ref(:,:,:) = 35.0 * tmask(:,:,:) |
---|
343 | IF(lwp) WRITE(numout,*) ' homogeneous ocean T = ', zt0, ' S = ',zs0 |
---|
344 | |
---|
345 | ! Initialisation of gtui/gtvi in case of no cavity |
---|
346 | IF ( .NOT. ln_isfcav ) THEN |
---|
347 | gtui(:,:,:) = 0.0_wp |
---|
348 | gtvi(:,:,:) = 0.0_wp |
---|
349 | END IF |
---|
350 | ! ! T & S profile (to be coded +namelist parameter |
---|
351 | |
---|
352 | ! prepare the ldf computation |
---|
353 | ! --------------------------- |
---|
354 | llsave = l_trdtra |
---|
355 | l_trdtra = .false. ! desactivate trend computation |
---|
356 | t0_ldf(:,:,:) = 0.e0 |
---|
357 | s0_ldf(:,:,:) = 0.e0 |
---|
358 | ztb (:,:,:) = tsb (:,:,:,jp_tem) |
---|
359 | zsb (:,:,:) = tsb (:,:,:,jp_sal) |
---|
360 | ua (:,:,:) = tsa (:,:,:,jp_tem) |
---|
361 | va (:,:,:) = tsa (:,:,:,jp_sal) |
---|
362 | zavt (:,:,:) = avt(:,:,:) |
---|
363 | IF( lk_zdfddm ) THEN CALL ctl_stop( ' key_traldf_ano with key_zdfddm not implemented' ) |
---|
364 | ! set tb, sb to reference values and avr to zero |
---|
365 | tsb (:,:,:,jp_tem) = zt_ref(:,:,:) |
---|
366 | tsb (:,:,:,jp_sal) = zs_ref(:,:,:) |
---|
367 | tsa (:,:,:,jp_tem) = 0.e0 |
---|
368 | tsa (:,:,:,jp_sal) = 0.e0 |
---|
369 | avt(:,:,:) = 0.e0 |
---|
370 | |
---|
371 | ! Compute the ldf trends |
---|
372 | ! ---------------------- |
---|
373 | CALL tra_ldf( nit000 + 1 ) ! horizontal components (+1: no more init) |
---|
374 | CALL tra_zdf( nit000 ) ! vertical component (if necessary nit000 to performed the init) |
---|
375 | |
---|
376 | ! finalise the computation and recover all arrays |
---|
377 | ! ----------------------------------------------- |
---|
378 | l_trdtra = llsave |
---|
379 | z12 = 2.e0 |
---|
380 | IF( neuler == 1) z12 = 1.e0 |
---|
381 | IF( ln_zdfexp ) THEN ! ta,sa are the trends |
---|
382 | t0_ldf(:,:,:) = tsa(:,:,:,jp_tem) |
---|
383 | s0_ldf(:,:,:) = tsa(:,:,:,jp_sal) |
---|
384 | ELSE |
---|
385 | DO jk = 1, jpkm1 |
---|
386 | t0_ldf(:,:,jk) = ( tsa(:,:,jk,jp_tem) - tsb(:,:,jk,jp_tem) ) / ( z12 *rdttra(jk) ) |
---|
387 | s0_ldf(:,:,jk) = ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / ( z12 *rdttra(jk) ) |
---|
388 | END DO |
---|
389 | ENDIF |
---|
390 | tsb(:,:,:,jp_tem) = ztb (:,:,:) |
---|
391 | tsb(:,:,:,jp_sal) = zsb (:,:,:) |
---|
392 | tsa(:,:,:,jp_tem) = ua (:,:,:) |
---|
393 | tsa(:,:,:,jp_sal) = va (:,:,:) |
---|
394 | avt(:,:,:) = zavt(:,:,:) |
---|
395 | ! |
---|
396 | CALL wrk_dealloc( jpi, jpj, jpk, zt_ref, zs_ref, ztb, zsb, zavt ) |
---|
397 | ! |
---|
398 | IF( nn_timing == 1 ) CALL timing_stop('ldf_ano') |
---|
399 | ! |
---|
400 | END SUBROUTINE ldf_ano |
---|
401 | |
---|
402 | #else |
---|
403 | !!---------------------------------------------------------------------- |
---|
404 | !! default option : Dummy code NO T & S background profiles |
---|
405 | !!---------------------------------------------------------------------- |
---|
406 | SUBROUTINE ldf_ano |
---|
407 | IF(lwp) THEN |
---|
408 | WRITE(numout,*) |
---|
409 | WRITE(numout,*) 'tra:ldf_ano : lateral diffusion acting on the full fields' |
---|
410 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
411 | ENDIF |
---|
412 | END SUBROUTINE ldf_ano |
---|
413 | #endif |
---|
414 | |
---|
415 | !!====================================================================== |
---|
416 | END MODULE traldf |
---|