1 | MODULE trdtra |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE trdtra *** |
---|
4 | !! Ocean diagnostics: ocean tracers trends pre-processing |
---|
5 | !!===================================================================== |
---|
6 | !! History : 3.3 ! 2010-06 (C. Ethe) creation for the TRA/TRC merge |
---|
7 | !! 3.5 ! 2012-02 (G. Madec) update the comments |
---|
8 | !!---------------------------------------------------------------------- |
---|
9 | |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | !! trd_tra : pre-process the tracer trends |
---|
12 | !! trd_tra_adv : transform a div(U.T) trend into a U.grad(T) trend |
---|
13 | !! trd_tra_mng : tracer trend manager: dispatch to the diagnostic modules |
---|
14 | !! trd_tra_iom : output 3D tracer trends using IOM |
---|
15 | !!---------------------------------------------------------------------- |
---|
16 | USE oce ! ocean dynamics and tracers variables |
---|
17 | USE dom_oce ! ocean domain |
---|
18 | USE sbc_oce ! surface boundary condition: ocean |
---|
19 | USE zdf_oce ! ocean vertical physics |
---|
20 | USE trd_oce ! trends: ocean variables |
---|
21 | USE trdtrc ! ocean passive mixed layer tracers trends |
---|
22 | USE trdglo ! trends: global domain averaged |
---|
23 | USE trdpen ! trends: Potential ENergy |
---|
24 | USE trdmxl ! ocean active mixed layer tracers trends |
---|
25 | USE ldftra ! ocean active tracers lateral physics |
---|
26 | USE ldfslp |
---|
27 | USE zdfddm ! vertical physics: double diffusion |
---|
28 | USE phycst ! physical constants |
---|
29 | ! |
---|
30 | USE in_out_manager ! I/O manager |
---|
31 | USE iom ! I/O manager library |
---|
32 | USE lib_mpp ! MPP library |
---|
33 | |
---|
34 | IMPLICIT NONE |
---|
35 | PRIVATE |
---|
36 | |
---|
37 | PUBLIC trd_tra ! called by all tra_... modules |
---|
38 | |
---|
39 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: trdtx, trdty, trdt ! use to store the temperature trends |
---|
40 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: avt_evd ! store avt_evd to calculate EVD trend |
---|
41 | |
---|
42 | !! * Substitutions |
---|
43 | # include "do_loop_substitute.h90" |
---|
44 | # include "domzgr_substitute.h90" |
---|
45 | !!---------------------------------------------------------------------- |
---|
46 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
47 | !! $Id$ |
---|
48 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
49 | !!---------------------------------------------------------------------- |
---|
50 | CONTAINS |
---|
51 | |
---|
52 | INTEGER FUNCTION trd_tra_alloc() |
---|
53 | !!--------------------------------------------------------------------- |
---|
54 | !! *** FUNCTION trd_tra_alloc *** |
---|
55 | !!--------------------------------------------------------------------- |
---|
56 | ALLOCATE( trdtx(jpi,jpj,jpk) , trdty(jpi,jpj,jpk) , trdt(jpi,jpj,jpk) , avt_evd(jpi,jpj,jpk), STAT= trd_tra_alloc ) |
---|
57 | ! |
---|
58 | CALL mpp_sum ( 'trdtra', trd_tra_alloc ) |
---|
59 | IF( trd_tra_alloc /= 0 ) CALL ctl_stop( 'STOP', 'trd_tra_alloc: failed to allocate arrays' ) |
---|
60 | END FUNCTION trd_tra_alloc |
---|
61 | |
---|
62 | |
---|
63 | SUBROUTINE trd_tra( kt, Kmm, Krhs, ctype, ktra, ktrd, ptrd, pu, ptra ) |
---|
64 | !!--------------------------------------------------------------------- |
---|
65 | !! *** ROUTINE trd_tra *** |
---|
66 | !! |
---|
67 | !! ** Purpose : pre-process tracer trends |
---|
68 | !! |
---|
69 | !! ** Method : - mask the trend |
---|
70 | !! - advection (ptra present) converte the incoming flux (U.T) |
---|
71 | !! into trend (U.T => -U.grat(T)=div(U.T)-T.div(U)) through a |
---|
72 | !! call to trd_tra_adv |
---|
73 | !! - 'TRA' case : regroup T & S trends |
---|
74 | !! - send the trends to trd_tra_mng (trdtrc) for further processing |
---|
75 | !!---------------------------------------------------------------------- |
---|
76 | INTEGER , INTENT(in) :: kt ! time step |
---|
77 | CHARACTER(len=3) , INTENT(in) :: ctype ! tracers trends type 'TRA'/'TRC' |
---|
78 | INTEGER , INTENT(in) :: ktra ! tracer index |
---|
79 | INTEGER , INTENT(in) :: ktrd ! tracer trend index |
---|
80 | INTEGER , INTENT(in) :: Kmm, Krhs ! time level indices |
---|
81 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in) :: ptrd ! tracer trend or flux |
---|
82 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL :: pu ! now velocity |
---|
83 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL :: ptra ! now tracer variable |
---|
84 | ! |
---|
85 | INTEGER :: jk ! loop indices |
---|
86 | INTEGER :: i01 ! 0 or 1 |
---|
87 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: ztrds ! 3D workspace |
---|
88 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zwt, zws, ztrdt ! 3D workspace |
---|
89 | !!---------------------------------------------------------------------- |
---|
90 | ! |
---|
91 | IF( .NOT. ALLOCATED( trdtx ) ) THEN ! allocate trdtra arrays |
---|
92 | IF( trd_tra_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'trd_tra : unable to allocate arrays' ) |
---|
93 | avt_evd(:,:,:) = 0._wp |
---|
94 | ENDIF |
---|
95 | ! |
---|
96 | i01 = COUNT( (/ PRESENT(pu) .OR. ( ktrd /= jptra_xad .AND. ktrd /= jptra_yad .AND. ktrd /= jptra_zad ) /) ) |
---|
97 | ! |
---|
98 | IF( ctype == 'TRA' .AND. ktra == jp_tem ) THEN !== Temperature trend ==! |
---|
99 | ! |
---|
100 | SELECT CASE( ktrd*i01 ) |
---|
101 | ! ! advection: transform the advective flux into a trend |
---|
102 | CASE( jptra_xad ) ; CALL trd_tra_adv( ptrd, pu, ptra, 'X', trdtx, Kmm ) |
---|
103 | CASE( jptra_yad ) ; CALL trd_tra_adv( ptrd, pu, ptra, 'Y', trdty, Kmm ) |
---|
104 | CASE( jptra_zad ) ; CALL trd_tra_adv( ptrd, pu, ptra, 'Z', trdt, Kmm ) |
---|
105 | CASE( jptra_bbc, & ! qsr, bbc: on temperature only, send to trd_tra_mng |
---|
106 | & jptra_qsr ) ; trdt(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) |
---|
107 | ztrds(:,:,:) = 0._wp |
---|
108 | CALL trd_tra_mng( trdt, ztrds, ktrd, kt, Kmm ) |
---|
109 | !!gm Gurvan, verify the jptra_evd trend please ! |
---|
110 | CASE( jptra_evd ) ; avt_evd(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) |
---|
111 | CASE DEFAULT ! other trends: masked trends |
---|
112 | trdt(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) ! mask & store |
---|
113 | END SELECT |
---|
114 | ! |
---|
115 | ENDIF |
---|
116 | |
---|
117 | IF( ctype == 'TRA' .AND. ktra == jp_sal ) THEN !== Salinity trends ==! |
---|
118 | ! |
---|
119 | SELECT CASE( ktrd*i01 ) |
---|
120 | ! ! advection: transform the advective flux into a trend |
---|
121 | ! ! and send T & S trends to trd_tra_mng |
---|
122 | CASE( jptra_xad ) ; CALL trd_tra_adv( ptrd , pu , ptra, 'X' , ztrds, Kmm ) |
---|
123 | CALL trd_tra_mng( trdtx, ztrds, ktrd, kt, Kmm ) |
---|
124 | CASE( jptra_yad ) ; CALL trd_tra_adv( ptrd , pu , ptra, 'Y' , ztrds, Kmm ) |
---|
125 | CALL trd_tra_mng( trdty, ztrds, ktrd, kt, Kmm ) |
---|
126 | CASE( jptra_zad ) ; CALL trd_tra_adv( ptrd , pu , ptra, 'Z' , ztrds, Kmm ) |
---|
127 | CALL trd_tra_mng( trdt , ztrds, ktrd, kt, Kmm ) |
---|
128 | CASE( jptra_zdfp ) ! diagnose the "PURE" Kz trend (here: just before the swap) |
---|
129 | ! ! iso-neutral diffusion case otherwise jptra_zdf is "PURE" |
---|
130 | ALLOCATE( zwt(jpi,jpj,jpk), zws(jpi,jpj,jpk), ztrdt(jpi,jpj,jpk) ) |
---|
131 | ! |
---|
132 | zwt(:,:, 1 ) = 0._wp ; zws(:,:, 1 ) = 0._wp ! vertical diffusive fluxes |
---|
133 | zwt(:,:,jpk) = 0._wp ; zws(:,:,jpk) = 0._wp |
---|
134 | DO jk = 2, jpk |
---|
135 | zwt(:,:,jk) = avt(:,:,jk) * ( ts(:,:,jk-1,jp_tem,Krhs) - ts(:,:,jk,jp_tem,Krhs) ) & |
---|
136 | & / e3w(:,:,jk,Kmm) * tmask(:,:,jk) |
---|
137 | zws(:,:,jk) = avs(:,:,jk) * ( ts(:,:,jk-1,jp_sal,Krhs) - ts(:,:,jk,jp_sal,Krhs) ) & |
---|
138 | & / e3w(:,:,jk,Kmm) * tmask(:,:,jk) |
---|
139 | END DO |
---|
140 | ! |
---|
141 | ztrdt(:,:,jpk) = 0._wp ; ztrds(:,:,jpk) = 0._wp |
---|
142 | DO jk = 1, jpkm1 |
---|
143 | ztrdt(:,:,jk) = ( zwt(:,:,jk) - zwt(:,:,jk+1) ) / e3t(:,:,jk,Kmm) |
---|
144 | ztrds(:,:,jk) = ( zws(:,:,jk) - zws(:,:,jk+1) ) / e3t(:,:,jk,Kmm) |
---|
145 | END DO |
---|
146 | CALL trd_tra_mng( ztrdt, ztrds, jptra_zdfp, kt, Kmm ) |
---|
147 | ! |
---|
148 | ! ! Also calculate EVD trend at this point. |
---|
149 | zwt(:,:,:) = 0._wp ; zws(:,:,:) = 0._wp ! vertical diffusive fluxes |
---|
150 | DO jk = 2, jpk |
---|
151 | zwt(:,:,jk) = avt_evd(:,:,jk) * ( ts(:,:,jk-1,jp_tem,Krhs) - ts(:,:,jk,jp_tem,Krhs) ) & |
---|
152 | & / e3w(:,:,jk,Kmm) * tmask(:,:,jk) |
---|
153 | zws(:,:,jk) = avt_evd(:,:,jk) * ( ts(:,:,jk-1,jp_sal,Krhs) - ts(:,:,jk,jp_sal,Krhs) ) & |
---|
154 | & / e3w(:,:,jk,Kmm) * tmask(:,:,jk) |
---|
155 | END DO |
---|
156 | ! |
---|
157 | ztrdt(:,:,jpk) = 0._wp ; ztrds(:,:,jpk) = 0._wp |
---|
158 | DO jk = 1, jpkm1 |
---|
159 | ztrdt(:,:,jk) = ( zwt(:,:,jk) - zwt(:,:,jk+1) ) / e3t(:,:,jk,Kmm) |
---|
160 | ztrds(:,:,jk) = ( zws(:,:,jk) - zws(:,:,jk+1) ) / e3t(:,:,jk,Kmm) |
---|
161 | END DO |
---|
162 | CALL trd_tra_mng( ztrdt, ztrds, jptra_evd, kt, Kmm ) |
---|
163 | ! |
---|
164 | DEALLOCATE( zwt, zws, ztrdt ) |
---|
165 | ! |
---|
166 | CASE DEFAULT ! other trends: mask and send T & S trends to trd_tra_mng |
---|
167 | ztrds(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) |
---|
168 | CALL trd_tra_mng( trdt, ztrds, ktrd, kt, Kmm ) |
---|
169 | END SELECT |
---|
170 | ENDIF |
---|
171 | |
---|
172 | IF( ctype == 'TRC' ) THEN !== passive tracer trend ==! |
---|
173 | ! |
---|
174 | SELECT CASE( ktrd*i01 ) |
---|
175 | ! ! advection: transform the advective flux into a masked trend |
---|
176 | CASE( jptra_xad ) ; CALL trd_tra_adv( ptrd , pu , ptra, 'X', ztrds, Kmm ) |
---|
177 | CASE( jptra_yad ) ; CALL trd_tra_adv( ptrd , pu , ptra, 'Y', ztrds, Kmm ) |
---|
178 | CASE( jptra_zad ) ; CALL trd_tra_adv( ptrd , pu , ptra, 'Z', ztrds, Kmm ) |
---|
179 | CASE DEFAULT ! other trends: just masked |
---|
180 | ztrds(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) |
---|
181 | END SELECT |
---|
182 | ! ! send trend to trd_trc |
---|
183 | CALL trd_trc( ztrds, ktra, ktrd, kt, Kmm ) |
---|
184 | ! |
---|
185 | ENDIF |
---|
186 | ! |
---|
187 | END SUBROUTINE trd_tra |
---|
188 | |
---|
189 | |
---|
190 | SUBROUTINE trd_tra_adv( pf, pu, pt, cdir, ptrd, Kmm ) |
---|
191 | !!--------------------------------------------------------------------- |
---|
192 | !! *** ROUTINE trd_tra_adv *** |
---|
193 | !! |
---|
194 | !! ** Purpose : transformed a advective flux into a masked advective trends |
---|
195 | !! |
---|
196 | !! ** Method : use the following transformation: -div(U.T) = - U grad(T) + T.div(U) |
---|
197 | !! i-advective trends = -un. di-1[T] = -( di-1[fi] - tn di-1[un] ) |
---|
198 | !! j-advective trends = -un. di-1[T] = -( dj-1[fi] - tn dj-1[un] ) |
---|
199 | !! k-advective trends = -un. di+1[T] = -( dk+1[fi] - tn dk+1[un] ) |
---|
200 | !! where fi is the incoming advective flux. |
---|
201 | !!---------------------------------------------------------------------- |
---|
202 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pf ! advective flux in one direction |
---|
203 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pu ! now velocity in one direction |
---|
204 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pt ! now or before tracer |
---|
205 | CHARACTER(len=1) , INTENT(in ) :: cdir ! X/Y/Z direction |
---|
206 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( out) :: ptrd ! advective trend in one direction |
---|
207 | INTEGER, INTENT(in) :: Kmm ! time level index |
---|
208 | ! |
---|
209 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
210 | INTEGER :: ii, ij, ik ! index shift as function of the direction |
---|
211 | !!---------------------------------------------------------------------- |
---|
212 | ! |
---|
213 | SELECT CASE( cdir ) ! shift depending on the direction |
---|
214 | CASE( 'X' ) ; ii = 1 ; ij = 0 ; ik = 0 ! i-trend |
---|
215 | CASE( 'Y' ) ; ii = 0 ; ij = 1 ; ik = 0 ! j-trend |
---|
216 | CASE( 'Z' ) ; ii = 0 ; ij = 0 ; ik =-1 ! k-trend |
---|
217 | END SELECT |
---|
218 | ! |
---|
219 | ! ! set to zero uncomputed values |
---|
220 | ptrd(jpi,:,:) = 0._wp ; ptrd(1,:,:) = 0._wp |
---|
221 | ptrd(:,jpj,:) = 0._wp ; ptrd(:,1,:) = 0._wp |
---|
222 | ptrd(:,:,jpk) = 0._wp |
---|
223 | ! |
---|
224 | DO_3D( 0, 0, 0, 0, 1, jpkm1 ) ! advective trend |
---|
225 | ptrd(ji,jj,jk) = - ( pf (ji,jj,jk) - pf (ji-ii,jj-ij,jk-ik) & |
---|
226 | & - ( pu(ji,jj,jk) - pu(ji-ii,jj-ij,jk-ik) ) * pt(ji,jj,jk) ) & |
---|
227 | & * r1_e1e2t(ji,jj) / e3t(ji,jj,jk,Kmm) * tmask(ji,jj,jk) |
---|
228 | END_3D |
---|
229 | ! |
---|
230 | END SUBROUTINE trd_tra_adv |
---|
231 | |
---|
232 | |
---|
233 | SUBROUTINE trd_tra_mng( ptrdx, ptrdy, ktrd, kt, Kmm ) |
---|
234 | !!--------------------------------------------------------------------- |
---|
235 | !! *** ROUTINE trd_tra_mng *** |
---|
236 | !! |
---|
237 | !! ** Purpose : Dispatch all tracer trends computation, e.g. 3D output, |
---|
238 | !! integral constraints, potential energy, and/or |
---|
239 | !! mixed layer budget. |
---|
240 | !!---------------------------------------------------------------------- |
---|
241 | REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdx ! Temperature or U trend |
---|
242 | REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdy ! Salinity or V trend |
---|
243 | INTEGER , INTENT(in ) :: ktrd ! tracer trend index |
---|
244 | INTEGER , INTENT(in ) :: kt ! time step |
---|
245 | INTEGER , INTENT(in ) :: Kmm ! time level index |
---|
246 | !!---------------------------------------------------------------------- |
---|
247 | |
---|
248 | ! ! 3D output of tracers trends using IOM interface |
---|
249 | IF( ln_tra_trd ) CALL trd_tra_iom ( ptrdx, ptrdy, ktrd, kt, Kmm ) |
---|
250 | |
---|
251 | ! ! Integral Constraints Properties for tracers trends !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
252 | IF( ln_glo_trd ) CALL trd_glo( ptrdx, ptrdy, ktrd, 'TRA', kt, Kmm ) |
---|
253 | |
---|
254 | ! ! Potential ENergy trends |
---|
255 | IF( ln_PE_trd ) CALL trd_pen( ptrdx, ptrdy, ktrd, kt, rDt, Kmm ) |
---|
256 | |
---|
257 | ! ! Mixed layer trends for active tracers |
---|
258 | IF( ln_tra_mxl ) THEN |
---|
259 | !----------------------------------------------------------------------------------------------- |
---|
260 | ! W.A.R.N.I.N.G : |
---|
261 | ! jptra_ldf : called by traldf.F90 |
---|
262 | ! at this stage we store: |
---|
263 | ! - the lateral geopotential diffusion (here, lateral = horizontal) |
---|
264 | ! - and the iso-neutral diffusion if activated |
---|
265 | ! jptra_zdf : called by trazdf.F90 |
---|
266 | ! * in case of iso-neutral diffusion we store the vertical diffusion component in the |
---|
267 | ! lateral trend including the K_z contrib, which will be removed later (see trd_mxl) |
---|
268 | !----------------------------------------------------------------------------------------------- |
---|
269 | |
---|
270 | SELECT CASE ( ktrd ) |
---|
271 | CASE ( jptra_xad ) ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_xad, '3D' ) ! zonal advection |
---|
272 | CASE ( jptra_yad ) ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_yad, '3D' ) ! merid. advection |
---|
273 | CASE ( jptra_zad ) ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_zad, '3D' ) ! vertical advection |
---|
274 | CASE ( jptra_ldf ) ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_ldf, '3D' ) ! lateral diffusion |
---|
275 | CASE ( jptra_bbl ) ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_bbl, '3D' ) ! bottom boundary layer |
---|
276 | CASE ( jptra_zdf ) |
---|
277 | IF( ln_traldf_iso ) THEN ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_ldf, '3D' ) ! lateral diffusion (K_z) |
---|
278 | ELSE ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_zdf, '3D' ) ! vertical diffusion (K_z) |
---|
279 | ENDIF |
---|
280 | CASE ( jptra_dmp ) ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_dmp, '3D' ) ! internal 3D restoring (tradmp) |
---|
281 | CASE ( jptra_qsr ) ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_for, '3D' ) ! air-sea : penetrative sol radiat |
---|
282 | CASE ( jptra_nsr ) ; ptrdx(:,:,2:jpk) = 0._wp ; ptrdy(:,:,2:jpk) = 0._wp |
---|
283 | CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_for, '2D' ) ! air-sea : non penetr sol radiation |
---|
284 | CASE ( jptra_bbc ) ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_bbc, '3D' ) ! bottom bound cond (geoth flux) |
---|
285 | CASE ( jptra_npc ) ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_npc, '3D' ) ! non penetr convect adjustment |
---|
286 | CASE ( jptra_atf ) ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_atf, '3D' ) ! asselin time filter (last trend) |
---|
287 | ! |
---|
288 | CALL trd_mxl( kt, rDt ) ! trends: Mixed-layer (output) |
---|
289 | END SELECT |
---|
290 | ! |
---|
291 | ENDIF |
---|
292 | ! |
---|
293 | END SUBROUTINE trd_tra_mng |
---|
294 | |
---|
295 | |
---|
296 | SUBROUTINE trd_tra_iom( ptrdx, ptrdy, ktrd, kt, Kmm ) |
---|
297 | !!--------------------------------------------------------------------- |
---|
298 | !! *** ROUTINE trd_tra_iom *** |
---|
299 | !! |
---|
300 | !! ** Purpose : output 3D tracer trends using IOM |
---|
301 | !!---------------------------------------------------------------------- |
---|
302 | REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdx ! Temperature or U trend |
---|
303 | REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdy ! Salinity or V trend |
---|
304 | INTEGER , INTENT(in ) :: ktrd ! tracer trend index |
---|
305 | INTEGER , INTENT(in ) :: kt ! time step |
---|
306 | INTEGER , INTENT(in ) :: Kmm ! time level index |
---|
307 | !! |
---|
308 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
309 | INTEGER :: ikbu, ikbv ! local integers |
---|
310 | REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z2dx, z2dy ! 2D workspace |
---|
311 | !!---------------------------------------------------------------------- |
---|
312 | ! |
---|
313 | !!gm Rq: mask the trends already masked in trd_tra, but lbc_lnk should probably be added |
---|
314 | ! |
---|
315 | ! Trends evaluated every time step that could go to the standard T file and can be output every ts into a 1ts file if 1ts output is selected |
---|
316 | SELECT CASE( ktrd ) |
---|
317 | ! This total trend is done every time step |
---|
318 | CASE( jptra_tot ) ; CALL iom_put( "ttrd_tot" , ptrdx ) ! model total trend |
---|
319 | CALL iom_put( "strd_tot" , ptrdy ) |
---|
320 | END SELECT |
---|
321 | ! |
---|
322 | ! These trends are done every second time step. When 1ts output is selected must go different (2ts) file from standard T-file |
---|
323 | IF( MOD( kt, 2 ) == 0 ) THEN |
---|
324 | SELECT CASE( ktrd ) |
---|
325 | CASE( jptra_xad ) ; CALL iom_put( "ttrd_xad" , ptrdx ) ! x- horizontal advection |
---|
326 | CALL iom_put( "strd_xad" , ptrdy ) |
---|
327 | CASE( jptra_yad ) ; CALL iom_put( "ttrd_yad" , ptrdx ) ! y- horizontal advection |
---|
328 | CALL iom_put( "strd_yad" , ptrdy ) |
---|
329 | CASE( jptra_zad ) ; CALL iom_put( "ttrd_zad" , ptrdx ) ! z- vertical advection |
---|
330 | CALL iom_put( "strd_zad" , ptrdy ) |
---|
331 | IF( ln_linssh ) THEN ! cst volume : adv flux through z=0 surface |
---|
332 | ALLOCATE( z2dx(jpi,jpj), z2dy(jpi,jpj) ) |
---|
333 | z2dx(:,:) = ww(:,:,1) * ts(:,:,1,jp_tem,Kmm) / e3t(:,:,1,Kmm) |
---|
334 | z2dy(:,:) = ww(:,:,1) * ts(:,:,1,jp_sal,Kmm) / e3t(:,:,1,Kmm) |
---|
335 | CALL iom_put( "ttrd_sad", z2dx ) |
---|
336 | CALL iom_put( "strd_sad", z2dy ) |
---|
337 | DEALLOCATE( z2dx, z2dy ) |
---|
338 | ENDIF |
---|
339 | CASE( jptra_totad ) ; CALL iom_put( "ttrd_totad", ptrdx ) ! total advection |
---|
340 | CALL iom_put( "strd_totad", ptrdy ) |
---|
341 | CASE( jptra_ldf ) ; CALL iom_put( "ttrd_ldf" , ptrdx ) ! lateral diffusion |
---|
342 | CALL iom_put( "strd_ldf" , ptrdy ) |
---|
343 | CASE( jptra_zdf ) ; CALL iom_put( "ttrd_zdf" , ptrdx ) ! vertical diffusion (including Kz contribution) |
---|
344 | CALL iom_put( "strd_zdf" , ptrdy ) |
---|
345 | CASE( jptra_zdfp ) ; CALL iom_put( "ttrd_zdfp" , ptrdx ) ! PURE vertical diffusion (no isoneutral contribution) |
---|
346 | CALL iom_put( "strd_zdfp" , ptrdy ) |
---|
347 | CASE( jptra_evd ) ; CALL iom_put( "ttrd_evd" , ptrdx ) ! EVD trend (convection) |
---|
348 | CALL iom_put( "strd_evd" , ptrdy ) |
---|
349 | CASE( jptra_dmp ) ; CALL iom_put( "ttrd_dmp" , ptrdx ) ! internal restoring (damping) |
---|
350 | CALL iom_put( "strd_dmp" , ptrdy ) |
---|
351 | CASE( jptra_bbl ) ; CALL iom_put( "ttrd_bbl" , ptrdx ) ! bottom boundary layer |
---|
352 | CALL iom_put( "strd_bbl" , ptrdy ) |
---|
353 | CASE( jptra_npc ) ; CALL iom_put( "ttrd_npc" , ptrdx ) ! static instability mixing |
---|
354 | CALL iom_put( "strd_npc" , ptrdy ) |
---|
355 | CASE( jptra_bbc ) ; CALL iom_put( "ttrd_bbc" , ptrdx ) ! geothermal heating (only on temperature) |
---|
356 | CASE( jptra_nsr ) ; CALL iom_put( "ttrd_qns" , ptrdx(:,:,1) ) ! surface forcing + runoff (ln_rnf=T) |
---|
357 | CALL iom_put( "strd_cdt" , ptrdy(:,:,1) ) ! output as 2D surface fields |
---|
358 | CASE( jptra_qsr ) ; CALL iom_put( "ttrd_qsr" , ptrdx ) ! penetrative solar radiat. (only on temperature) |
---|
359 | END SELECT |
---|
360 | ! the Asselin filter trend is also every other time step but needs to be lagged one time step |
---|
361 | ! Even when 1ts output is selected can go to the same (2ts) file as the trends plotted every even time step. |
---|
362 | ELSE IF( MOD( kt, 2 ) == 1 ) THEN |
---|
363 | SELECT CASE( ktrd ) |
---|
364 | CASE( jptra_atf ) ; CALL iom_put( "ttrd_atf" , ptrdx ) ! asselin time Filter |
---|
365 | CALL iom_put( "strd_atf" , ptrdy ) |
---|
366 | END SELECT |
---|
367 | END IF |
---|
368 | ! |
---|
369 | END SUBROUTINE trd_tra_iom |
---|
370 | |
---|
371 | !!====================================================================== |
---|
372 | END MODULE trdtra |
---|