1 | ! |
---|
2 | ! AC 2011-01-05 |
---|
3 | ! |
---|
4 | SUBROUTINE calltherm_interface (firstcall, & |
---|
5 | & zzlev,zzlay, & |
---|
6 | & ptimestep,pu,pv,pt,pq,pdu,pdv,pdt,pdq,q2, & |
---|
7 | & pplay,pplev,pphi,zpopsk, & |
---|
8 | & pdu_th,pdv_th,pdt_th,pdq_th,lmax,zmaxth,pbl_dtke, & |
---|
9 | & pdhdif,hfmax,wstar,sensibFlux) |
---|
10 | |
---|
11 | USE ioipsl_getincom |
---|
12 | |
---|
13 | implicit none |
---|
14 | #include "callkeys.h" |
---|
15 | #include "dimensions.h" |
---|
16 | #include "dimphys.h" |
---|
17 | #include "comcstfi.h" |
---|
18 | #include "tracer.h" |
---|
19 | |
---|
20 | !-------------------------------------------------------- |
---|
21 | ! Input Variables |
---|
22 | !-------------------------------------------------------- |
---|
23 | |
---|
24 | ! REAL, INTENT(IN) :: long(ngridmx),lati(ngridmx) |
---|
25 | REAL, INTENT(IN) :: ptimestep |
---|
26 | REAL, INTENT(IN) :: pplev(ngridmx,nlayermx+1) |
---|
27 | REAL, INTENT(IN) :: pplay(ngridmx,nlayermx) |
---|
28 | REAL, INTENT(IN) :: pphi(ngridmx,nlayermx) |
---|
29 | REAL, INTENT(IN) :: pu(ngridmx,nlayermx),pv(ngridmx,nlayermx) |
---|
30 | REAL, INTENT(IN) :: pt(ngridmx,nlayermx),pq(ngridmx,nlayermx,nqmx) |
---|
31 | REAL, INTENT(IN) :: zzlay(ngridmx,nlayermx) |
---|
32 | REAL, INTENT(IN) :: zzlev(ngridmx,nlayermx+1) |
---|
33 | LOGICAL, INTENT(IN) :: firstcall |
---|
34 | REAL, INTENT(IN) :: pdu(ngridmx,nlayermx),pdv(ngridmx,nlayermx) |
---|
35 | REAL, INTENT(IN) :: pdq(ngridmx,nlayermx,nqmx) |
---|
36 | REAL, INTENT(IN) :: pdt(ngridmx,nlayermx) |
---|
37 | REAL, INTENT(IN) :: q2(ngridmx,nlayermx+1) |
---|
38 | REAL, INTENT(IN) :: zpopsk(ngridmx,nlayermx) |
---|
39 | REAL, INTENT(IN) :: pdhdif(ngridmx,nlayermx) |
---|
40 | REAL, INTENT(IN) :: sensibFlux(ngridmx) |
---|
41 | |
---|
42 | !-------------------------------------------------------- |
---|
43 | ! Output Variables |
---|
44 | !-------------------------------------------------------- |
---|
45 | |
---|
46 | REAL, INTENT(OUT) :: pdu_th(ngridmx,nlayermx) |
---|
47 | REAL, INTENT(OUT) :: pdv_th(ngridmx,nlayermx) |
---|
48 | REAL, INTENT(OUT) :: pdt_th(ngridmx,nlayermx) |
---|
49 | REAL, INTENT(OUT) :: pdq_th(ngridmx,nlayermx,nqmx) |
---|
50 | INTEGER, INTENT(OUT) :: lmax(ngridmx) |
---|
51 | REAL, INTENT(OUT) :: zmaxth(ngridmx) |
---|
52 | REAL, INTENT(OUT) :: pbl_dtke(ngridmx,nlayermx+1) |
---|
53 | REAL, INTENT(OUT) :: wstar(ngridmx) |
---|
54 | |
---|
55 | !-------------------------------------------------------- |
---|
56 | ! Thermals local variables |
---|
57 | !-------------------------------------------------------- |
---|
58 | REAL zu(ngridmx,nlayermx), zv(ngridmx,nlayermx) |
---|
59 | REAL zt(ngridmx,nlayermx) |
---|
60 | REAL d_t_ajs(ngridmx,nlayermx) |
---|
61 | REAL d_u_ajs(ngridmx,nlayermx), d_q_ajs(ngridmx,nlayermx,nqmx) |
---|
62 | REAL d_v_ajs(ngridmx,nlayermx) |
---|
63 | REAL fm_therm(ngridmx,nlayermx+1), entr_therm(ngridmx,nlayermx) |
---|
64 | REAL detr_therm(ngridmx,nlayermx),detrmod(ngridmx,nlayermx) |
---|
65 | REAL zw2(ngridmx,nlayermx+1) |
---|
66 | REAL fraca(ngridmx,nlayermx+1),zfraca(ngridmx,nlayermx+1) |
---|
67 | REAL ztla(ngridmx,nlayermx) |
---|
68 | REAL q_therm(ngridmx,nlayermx), pq_therm(ngridmx,nlayermx,nqmx) |
---|
69 | REAL q2_therm(ngridmx,nlayermx), dq2_therm(ngridmx,nlayermx) |
---|
70 | REAL lmax_real(ngridmx) |
---|
71 | REAL masse(ngridmx,nlayermx) |
---|
72 | LOGICAL qtransport_thermals,dtke_thermals |
---|
73 | INTEGER l,ig,iq,ii(1),k |
---|
74 | CHARACTER (LEN=20) modname |
---|
75 | |
---|
76 | !-------------------------------------------------------- |
---|
77 | ! Local variables for sub-timestep |
---|
78 | !-------------------------------------------------------- |
---|
79 | |
---|
80 | REAL d_t_the(ngridmx,nlayermx), d_q_the(ngridmx,nlayermx,nqmx) |
---|
81 | REAL d_u_the(ngridmx,nlayermx),d_v_the(ngridmx,nlayermx) |
---|
82 | REAL dq2_the(ngridmx,nlayermx) |
---|
83 | INTEGER isplit |
---|
84 | INTEGER,SAVE :: nsplit_thermals |
---|
85 | REAL, SAVE :: r_aspect_thermals |
---|
86 | REAL fact |
---|
87 | REAL zfm_therm(ngridmx,nlayermx+1),zdt |
---|
88 | REAL zentr_therm(ngridmx,nlayermx),zdetr_therm(ngridmx,nlayermx) |
---|
89 | REAL zheatFlux(ngridmx,nlayermx) |
---|
90 | REAL zheatFlux_down(ngridmx,nlayermx) |
---|
91 | REAL zbuoyancyOut(ngridmx,nlayermx) |
---|
92 | REAL zbuoyancyEst(ngridmx,nlayermx) |
---|
93 | REAL zzw2(ngridmx,nlayermx+1) |
---|
94 | REAL zmax(ngridmx) |
---|
95 | INTEGER ndt,zlmax |
---|
96 | |
---|
97 | !-------------------------------------------------------- |
---|
98 | ! Diagnostics |
---|
99 | !-------------------------------------------------------- |
---|
100 | |
---|
101 | REAL heatFlux(ngridmx,nlayermx) |
---|
102 | REAL heatFlux_down(ngridmx,nlayermx) |
---|
103 | REAL buoyancyOut(ngridmx,nlayermx) |
---|
104 | REAL buoyancyEst(ngridmx,nlayermx) |
---|
105 | REAL hfmax(ngridmx),wmax(ngridmx) |
---|
106 | REAL pbl_teta(ngridmx),dteta(ngridmx,nlayermx) |
---|
107 | REAL rpdhd(ngridmx,nlayermx) |
---|
108 | REAL wtdif(ngridmx,nlayermx),rho(ngridmx,nlayermx) |
---|
109 | REAL wtth(ngridmx,nlayermx) |
---|
110 | |
---|
111 | !-------------------------------------------------------- |
---|
112 | ! Theta_m |
---|
113 | !-------------------------------------------------------- |
---|
114 | |
---|
115 | INTEGER ico2 |
---|
116 | SAVE ico2 |
---|
117 | |
---|
118 | ! ********************************************************************** |
---|
119 | ! Initialization |
---|
120 | ! ********************************************************************** |
---|
121 | |
---|
122 | lmax(:)=0 |
---|
123 | pdu_th(:,:)=0. |
---|
124 | pdv_th(:,:)=0. |
---|
125 | pdt_th(:,:)=0. |
---|
126 | entr_therm(:,:)=0. |
---|
127 | detr_therm(:,:)=0. |
---|
128 | q2_therm(:,:)=0. |
---|
129 | dq2_therm(:,:)=0. |
---|
130 | ztla(:,:)=0. |
---|
131 | pbl_dtke(:,:)=0. |
---|
132 | fm_therm(:,:)=0. |
---|
133 | zw2(:,:)=0. |
---|
134 | fraca(:,:)=0. |
---|
135 | zfraca(:,:)=0. |
---|
136 | if (tracer) then |
---|
137 | pdq_th(:,:,:)=0. |
---|
138 | end if |
---|
139 | d_t_ajs(:,:)=0. |
---|
140 | d_u_ajs(:,:)=0. |
---|
141 | d_v_ajs(:,:)=0. |
---|
142 | d_q_ajs(:,:,:)=0. |
---|
143 | heatFlux(:,:)=0. |
---|
144 | heatFlux_down(:,:)=0. |
---|
145 | buoyancyOut(:,:)=0. |
---|
146 | buoyancyEst(:,:)=0. |
---|
147 | zmaxth(:)=0. |
---|
148 | lmax_real(:)=0. |
---|
149 | |
---|
150 | |
---|
151 | ! ********************************************************************** |
---|
152 | ! Preparing inputs for the thermals |
---|
153 | ! ********************************************************************** |
---|
154 | |
---|
155 | zu(:,:)=pu(:,:)+pdu(:,:)*ptimestep |
---|
156 | zv(:,:)=pv(:,:)+pdv(:,:)*ptimestep |
---|
157 | zt(:,:)=pt(:,:)+pdt(:,:)*ptimestep |
---|
158 | |
---|
159 | pq_therm(:,:,:)=0. |
---|
160 | qtransport_thermals=.true. !! default setting |
---|
161 | !call getin("qtransport_thermals",qtransport_thermals) |
---|
162 | |
---|
163 | if(qtransport_thermals) then |
---|
164 | if(tracer) then |
---|
165 | pq_therm(:,:,:)=pq(:,:,:)+pdq(:,:,:)*ptimestep |
---|
166 | endif |
---|
167 | endif |
---|
168 | |
---|
169 | dtke_thermals=.false. !! default setting |
---|
170 | call getin("dtke_thermals",dtke_thermals) |
---|
171 | IF(dtke_thermals) THEN |
---|
172 | DO l=1,nlayermx |
---|
173 | q2_therm(:,l)=0.5*(q2(:,l)+q2(:,l+1)) |
---|
174 | ENDDO |
---|
175 | ENDIF |
---|
176 | |
---|
177 | ! ********************************************************************** |
---|
178 | ! Polar night mixing : theta_m |
---|
179 | ! ********************************************************************** |
---|
180 | |
---|
181 | if(firstcall) then |
---|
182 | ico2=0 |
---|
183 | if (tracer) then |
---|
184 | ! Prepare Special treatment if one of the tracers is CO2 gas |
---|
185 | do iq=1,nqmx |
---|
186 | if (noms(iq).eq."co2") then |
---|
187 | ico2=iq |
---|
188 | end if |
---|
189 | enddo |
---|
190 | endif |
---|
191 | endif !of if firstcall |
---|
192 | |
---|
193 | |
---|
194 | ! ********************************************************************** |
---|
195 | ! ********************************************************************** |
---|
196 | ! ********************************************************************** |
---|
197 | ! CALLTHERM |
---|
198 | ! ********************************************************************** |
---|
199 | ! ********************************************************************** |
---|
200 | ! ********************************************************************** |
---|
201 | |
---|
202 | ! r_aspect_thermals ! Mainly control the shape of the temperature profile |
---|
203 | ! in the surface layer. Decreasing it goes toward |
---|
204 | ! a convective-adjustment like profile. |
---|
205 | ! nsplit_thermals ! Sub-timestep for the thermals. Very dependant on the |
---|
206 | ! chosen timestep for the radiative transfer. |
---|
207 | ! It is recommended to run with 96 timestep per day and |
---|
208 | ! iradia = 1., configuration in which thermals can run |
---|
209 | ! very well with a sub-timestep of 10. |
---|
210 | IF (firstcall) THEN |
---|
211 | #ifdef MESOSCALE |
---|
212 | !! valid for timesteps < 200s |
---|
213 | nsplit_thermals=4 |
---|
214 | r_aspect_thermals=0.7 |
---|
215 | #else |
---|
216 | IF ((ptimestep .le. 3699.*24./96.) .and. (iradia .eq. 1)) THEN |
---|
217 | nsplit_thermals=10 |
---|
218 | ELSE |
---|
219 | nsplit_thermals=35 |
---|
220 | ENDIF |
---|
221 | r_aspect_thermals=1. |
---|
222 | #endif |
---|
223 | call getin("nsplit_thermals",nsplit_thermals) |
---|
224 | call getin("r_aspect_thermals",r_aspect_thermals) |
---|
225 | ENDIF |
---|
226 | |
---|
227 | ! ********************************************************************** |
---|
228 | ! SUB-TIMESTEP LOOP |
---|
229 | ! ********************************************************************** |
---|
230 | |
---|
231 | zdt=ptimestep/REAL(nsplit_thermals) |
---|
232 | |
---|
233 | DO isplit=1,nsplit_thermals |
---|
234 | |
---|
235 | ! Initialization of intermediary variables |
---|
236 | |
---|
237 | ! zfm_therm(:,:)=0. !init is done inside |
---|
238 | ! zentr_therm(:,:)=0. |
---|
239 | ! zdetr_therm(:,:)=0. |
---|
240 | ! zheatFlux(:,:)=0. |
---|
241 | ! zheatFlux_down(:,:)=0. |
---|
242 | ! zbuoyancyOut(:,:)=0. |
---|
243 | ! zbuoyancyEst(:,:)=0. |
---|
244 | zzw2(:,:)=0. |
---|
245 | zmax(:)=0. |
---|
246 | lmax(:)=0 |
---|
247 | ! d_t_the(:,:)=0. !init is done inside |
---|
248 | |
---|
249 | ! d_u_the(:,:)=0. !transported outside |
---|
250 | ! d_v_the(:,:)=0. |
---|
251 | dq2_the(:,:)=0. |
---|
252 | |
---|
253 | if (nqmx .ne. 0 .and. ico2 .ne. 0) then |
---|
254 | d_q_the(:,:,ico2)=0. |
---|
255 | endif |
---|
256 | |
---|
257 | CALL thermcell_main_mars(zdt & |
---|
258 | & ,pplay,pplev,pphi,zzlev,zzlay & |
---|
259 | & ,zu,zv,zt,pq_therm,q2_therm & |
---|
260 | & ,d_u_the,d_v_the,d_t_the,d_q_the,dq2_the & |
---|
261 | & ,zfm_therm,zentr_therm,zdetr_therm,lmax,zmax & |
---|
262 | & ,r_aspect_thermals & |
---|
263 | & ,zzw2,fraca,zpopsk & |
---|
264 | & ,ztla,zheatFlux,zheatFlux_down & |
---|
265 | & ,zbuoyancyOut,zbuoyancyEst) |
---|
266 | |
---|
267 | fact=1./REAL(nsplit_thermals) |
---|
268 | |
---|
269 | d_t_the(:,:)=d_t_the(:,:)*ptimestep*fact |
---|
270 | ! d_u_the(:,:)=d_u_the(:,:)*ptimestep*fact |
---|
271 | ! d_v_the(:,:)=d_v_the(:,:)*ptimestep*fact |
---|
272 | dq2_the(:,:)=dq2_the(:,:)*fact |
---|
273 | if (ico2 .ne. 0) then |
---|
274 | d_q_the(:,:,ico2)=d_q_the(:,:,ico2)*ptimestep*fact |
---|
275 | endif |
---|
276 | |
---|
277 | zmaxth(:)=zmaxth(:)+zmax(:)*fact |
---|
278 | lmax_real(:)=lmax_real(:)+float(lmax(:))*fact |
---|
279 | fm_therm(:,:)=fm_therm(:,:) & |
---|
280 | & +zfm_therm(:,:)*fact |
---|
281 | entr_therm(:,:)=entr_therm(:,:) & |
---|
282 | & +zentr_therm(:,:)*fact |
---|
283 | detr_therm(:,:)=detr_therm(:,:) & |
---|
284 | & +zdetr_therm(:,:)*fact |
---|
285 | zfraca(:,:)=zfraca(:,:) + fraca(:,:)*fact |
---|
286 | |
---|
287 | heatFlux(:,:)=heatFlux(:,:) & |
---|
288 | & +zheatFlux(:,:)*fact |
---|
289 | heatFlux_down(:,:)=heatFlux_down(:,:) & |
---|
290 | & +zheatFlux_down(:,:)*fact |
---|
291 | buoyancyOut(:,:)=buoyancyOut(:,:) & |
---|
292 | & +zbuoyancyOut(:,:)*fact |
---|
293 | buoyancyEst(:,:)=buoyancyEst(:,:) & |
---|
294 | & +zbuoyancyEst(:,:)*fact |
---|
295 | |
---|
296 | |
---|
297 | zw2(:,:)=zw2(:,:) + zzw2(:,:)*fact |
---|
298 | |
---|
299 | ! accumulation de la tendance |
---|
300 | |
---|
301 | d_t_ajs(:,:)=d_t_ajs(:,:)+d_t_the(:,:) |
---|
302 | ! d_u_ajs(:,:)=d_u_ajs(:,:)+d_u_the(:,:) |
---|
303 | ! d_v_ajs(:,:)=d_v_ajs(:,:)+d_v_the(:,:) |
---|
304 | if (ico2 .ne. 0) then |
---|
305 | d_q_ajs(:,:,ico2)=d_q_ajs(:,:,ico2)+d_q_the(:,:,ico2) |
---|
306 | endif |
---|
307 | ! dq2_therm(:,:)=dq2_therm(:,:)+dq2_the(:,:) |
---|
308 | ! incrementation des variables meteo |
---|
309 | |
---|
310 | zt(:,:) = zt(:,:) + d_t_the(:,:) |
---|
311 | ! zu(:,:) = zu(:,:) + d_u_the(:,:) |
---|
312 | ! zv(:,:) = zv(:,:) + d_v_the(:,:) |
---|
313 | if (ico2 .ne. 0) then |
---|
314 | pq_therm(:,:,ico2) = & |
---|
315 | & pq_therm(:,:,ico2) + d_q_the(:,:,ico2) |
---|
316 | endif |
---|
317 | ! q2_therm(:,:) = q2_therm(:,:) + dq2_therm(:,:) |
---|
318 | |
---|
319 | |
---|
320 | ENDDO ! isplit |
---|
321 | !**************************************************************** |
---|
322 | |
---|
323 | lmax(:)=nint(lmax_real(:)) |
---|
324 | zlmax=MAXVAL(lmax(:))+2 |
---|
325 | if (zlmax .ge. nlayermx) then |
---|
326 | print*,'thermals have reached last layer of the model' |
---|
327 | print*,'this is not good !' |
---|
328 | endif |
---|
329 | |
---|
330 | |
---|
331 | ! Now that we have computed total entrainment and detrainment, we can |
---|
332 | ! advect u, v, and q in thermals. (theta already advected). We can do |
---|
333 | ! that separatly because u,v,and q are not used in thermcell_main for |
---|
334 | ! any thermals-related computation : they are purely passive. |
---|
335 | |
---|
336 | ! mass of cells |
---|
337 | do l=1,nlayermx |
---|
338 | masse(:,l)=(pplev(:,l)-pplev(:,l+1))/g |
---|
339 | enddo |
---|
340 | |
---|
341 | detrmod(:,:)=0. |
---|
342 | do l=1,zlmax |
---|
343 | do ig=1,ngridmx |
---|
344 | detrmod(ig,l)=fm_therm(ig,l)-fm_therm(ig,l+1) & |
---|
345 | & +entr_therm(ig,l) |
---|
346 | if (detrmod(ig,l).lt.0.) then |
---|
347 | entr_therm(ig,l)=entr_therm(ig,l)-detrmod(ig,l) |
---|
348 | detrmod(ig,l)=0. |
---|
349 | endif |
---|
350 | enddo |
---|
351 | enddo |
---|
352 | ndt=10 |
---|
353 | call thermcell_dqup(ngridmx,nlayermx,ptimestep & |
---|
354 | & ,fm_therm,entr_therm,detrmod, & |
---|
355 | & masse,zu,d_u_ajs,ndt,zlmax) |
---|
356 | |
---|
357 | call thermcell_dqup(ngridmx,nlayermx,ptimestep & |
---|
358 | & ,fm_therm,entr_therm,detrmod, & |
---|
359 | & masse,zv,d_v_ajs,ndt,zlmax) |
---|
360 | |
---|
361 | if (nqmx .ne. 0.) then |
---|
362 | DO iq=1,nqmx |
---|
363 | if (iq .ne. ico2) then |
---|
364 | call thermcell_dqup(ngridmx,nlayermx,ptimestep & |
---|
365 | & ,fm_therm,entr_therm,detrmod, & |
---|
366 | & masse,pq_therm(:,:,iq),d_q_ajs(:,:,iq),ndt,zlmax) |
---|
367 | endif |
---|
368 | ENDDO |
---|
369 | endif |
---|
370 | |
---|
371 | if (dtke_thermals) then |
---|
372 | detrmod(:,:)=0. |
---|
373 | ndt=10 |
---|
374 | do l=1,zlmax |
---|
375 | do ig=1,ngridmx |
---|
376 | detrmod(ig,l)=fm_therm(ig,l)-fm_therm(ig,l+1) & |
---|
377 | & +entr_therm(ig,l) |
---|
378 | if (detrmod(ig,l).lt.0.) then |
---|
379 | entr_therm(ig,l)=entr_therm(ig,l)-detrmod(ig,l) |
---|
380 | detrmod(ig,l)=0. |
---|
381 | endif |
---|
382 | enddo |
---|
383 | enddo |
---|
384 | call thermcell_dqup(ngridmx,nlayermx,ptimestep & |
---|
385 | & ,fm_therm,entr_therm,detrmod, & |
---|
386 | & masse,q2_therm,dq2_therm,ndt,zlmax) |
---|
387 | endif |
---|
388 | |
---|
389 | DO ig=1,ngridmx |
---|
390 | wmax(ig)=MAXVAL(zw2(ig,:)) |
---|
391 | ENDDO |
---|
392 | |
---|
393 | ! ********************************************************************** |
---|
394 | ! ********************************************************************** |
---|
395 | ! ********************************************************************** |
---|
396 | ! CALLTHERM END |
---|
397 | ! ********************************************************************** |
---|
398 | ! ********************************************************************** |
---|
399 | ! ********************************************************************** |
---|
400 | |
---|
401 | |
---|
402 | ! ********************************************************************** |
---|
403 | ! Preparing outputs |
---|
404 | ! ********************************************************************** |
---|
405 | |
---|
406 | do l=1,zlmax |
---|
407 | pdu_th(:,l)=d_u_ajs(:,l) |
---|
408 | pdv_th(:,l)=d_v_ajs(:,l) |
---|
409 | enddo |
---|
410 | |
---|
411 | if(qtransport_thermals) then |
---|
412 | if(tracer) then |
---|
413 | do iq=1,nqmx |
---|
414 | if (iq .ne. ico2) then |
---|
415 | do l=1,zlmax |
---|
416 | pdq_th(:,l,iq)=d_q_ajs(:,l,iq) |
---|
417 | enddo |
---|
418 | else |
---|
419 | do l=1,zlmax |
---|
420 | pdq_th(:,l,iq)=d_q_ajs(:,l,iq)/ptimestep |
---|
421 | enddo |
---|
422 | endif |
---|
423 | enddo |
---|
424 | endif |
---|
425 | endif |
---|
426 | |
---|
427 | IF(dtke_thermals) THEN |
---|
428 | DO l=2,nlayermx |
---|
429 | pbl_dtke(:,l)=0.5*(dq2_therm(:,l-1)+dq2_therm(:,l)) |
---|
430 | ENDDO |
---|
431 | |
---|
432 | pbl_dtke(:,1)=0.5*dq2_therm(:,1) |
---|
433 | pbl_dtke(:,nlayermx+1)=0. |
---|
434 | ENDIF |
---|
435 | |
---|
436 | do l=1,zlmax |
---|
437 | pdt_th(:,l)=d_t_ajs(:,l)/ptimestep |
---|
438 | enddo |
---|
439 | |
---|
440 | |
---|
441 | ! ********************************************************************** |
---|
442 | ! Compute the free convection velocity scale for vdifc |
---|
443 | ! ********************************************************************** |
---|
444 | |
---|
445 | |
---|
446 | ! Potential temperature gradient |
---|
447 | |
---|
448 | dteta(:,nlayermx)=0. |
---|
449 | DO l=1,nlayermx-1 |
---|
450 | DO ig=1, ngridmx |
---|
451 | dteta(ig,l) = ((zt(ig,l+1)-zt(ig,l))/zpopsk(ig,l)) & |
---|
452 | & /(zzlay(ig,l+1)-zzlay(ig,l)) |
---|
453 | ENDDO |
---|
454 | ENDDO |
---|
455 | |
---|
456 | ! Computation of the pbl mixed layer temperature |
---|
457 | |
---|
458 | DO ig=1, ngridmx |
---|
459 | ii=MINLOC(abs(dteta(ig,1:lmax(ig)))) |
---|
460 | pbl_teta(ig) = zt(ig,ii(1))/zpopsk(ig,ii(1)) |
---|
461 | ENDDO |
---|
462 | |
---|
463 | ! we must add the heat flux from the diffusion scheme to hfmax |
---|
464 | |
---|
465 | ! compute rho as it is after the diffusion |
---|
466 | |
---|
467 | rho(:,:)=pplay(:,:) & |
---|
468 | & /(r*(pt(:,:)+pdhdif(:,:)*zpopsk(:,:)*ptimestep)) |
---|
469 | |
---|
470 | ! integrate -rho*pdhdif |
---|
471 | |
---|
472 | rpdhd(:,:)=0. |
---|
473 | |
---|
474 | DO ig=1,ngridmx |
---|
475 | DO l=1,lmax(ig) |
---|
476 | rpdhd(ig,l)=0. |
---|
477 | DO k=1,l |
---|
478 | rpdhd(ig,l)=rpdhd(ig,l)-rho(ig,k)*pdhdif(ig,k)* & |
---|
479 | & (zzlev(ig,k+1)-zzlev(ig,k)) |
---|
480 | ENDDO |
---|
481 | rpdhd(ig,l)=rpdhd(ig,l)-sensibFlux(ig)/cpp |
---|
482 | ENDDO |
---|
483 | ENDDO |
---|
484 | |
---|
485 | ! compute w'teta' from diffusion |
---|
486 | |
---|
487 | wtdif(:,:)=rpdhd(:,:)/rho(:,:) |
---|
488 | |
---|
489 | ! compute rho as it is after the thermals |
---|
490 | |
---|
491 | rho(:,:)=pplay(:,:)/(r*(zt(:,:))) |
---|
492 | ! integrate -rho*pdhdif |
---|
493 | |
---|
494 | DO ig=1,ngridmx |
---|
495 | DO l=1,lmax(ig) |
---|
496 | rpdhd(ig,l)=0. |
---|
497 | DO k=1,l |
---|
498 | rpdhd(ig,l)=rpdhd(ig,l)-rho(ig,k)*(pdt_th(ig,k)/zpopsk(ig,k))* & |
---|
499 | & (zzlev(ig,k+1)-zzlev(ig,k)) |
---|
500 | ENDDO |
---|
501 | rpdhd(ig,l)=rpdhd(ig,l)+ & |
---|
502 | & rho(ig,1)*(heatFlux(ig,1)+heatFlux_down(ig,1)) |
---|
503 | ENDDO |
---|
504 | ENDDO |
---|
505 | rpdhd(:,nlayermx)=0. |
---|
506 | |
---|
507 | ! compute w'teta' from thermals |
---|
508 | |
---|
509 | wtth(:,:)=rpdhd(:,:)/rho(:,:) |
---|
510 | |
---|
511 | ! We get the max heat flux from thermals and add the contribution from the diffusion |
---|
512 | |
---|
513 | DO ig=1,ngridmx |
---|
514 | hfmax(ig)=MAXVAL(wtth(ig,:)+wtdif(ig,:)) |
---|
515 | ENDDO |
---|
516 | ! We follow Spiga et. al 2010 (QJRMS) |
---|
517 | ! ------------ |
---|
518 | |
---|
519 | DO ig=1, ngridmx |
---|
520 | IF (zmax(ig) .gt. 0.) THEN |
---|
521 | wstar(ig)=(g*zmaxth(ig)*hfmax(ig)/pbl_teta(ig))**(1./3.) |
---|
522 | ELSE |
---|
523 | wstar(ig)=0. |
---|
524 | ENDIF |
---|
525 | ENDDO |
---|
526 | |
---|
527 | |
---|
528 | |
---|
529 | ! ********************************************************************** |
---|
530 | ! Diagnostics |
---|
531 | ! ********************************************************************** |
---|
532 | |
---|
533 | if(outptherm) then |
---|
534 | if (ngridmx .eq. 1) then |
---|
535 | call WRITEDIAGFI(ngridmx,'entr_therm','entrainement thermique',& |
---|
536 | & 'kg/m-2',1,entr_therm) |
---|
537 | call WRITEDIAGFI(ngridmx,'detr_therm','detrainement thermique',& |
---|
538 | & 'kg/m-2',1,detr_therm) |
---|
539 | call WRITEDIAGFI(ngridmx,'fm_therm','flux masse thermique',& |
---|
540 | & 'kg/m-2',1,fm_therm) |
---|
541 | call WRITEDIAGFI(ngridmx,'zw2','vitesse verticale thermique',& |
---|
542 | & 'm/s',1,zw2) |
---|
543 | call WRITEDIAGFI(ngridmx,'heatFlux_up','heatFlux_updraft',& |
---|
544 | & 'SI',1,heatFlux) |
---|
545 | call WRITEDIAGFI(ngridmx,'heatFlux_down','heatFlux_downdraft',& |
---|
546 | & 'SI',1,heatFlux_down) |
---|
547 | call WRITEDIAGFI(ngridmx,'fraca','fraction coverage',& |
---|
548 | & 'percent',1,fraca) |
---|
549 | call WRITEDIAGFI(ngridmx,'buoyancyOut','buoyancyOut',& |
---|
550 | & 'm.s-2',1,buoyancyOut) |
---|
551 | call WRITEDIAGFI(ngridmx,'buoyancyEst','buoyancyEst',& |
---|
552 | & 'm.s-2',1,buoyancyEst) |
---|
553 | call WRITEDIAGFI(ngridmx,'d_t_th', & |
---|
554 | & 'tendance temp TH','K',1,d_t_ajs) |
---|
555 | call WRITEDIAGFI(ngridmx,'d_q_th', & |
---|
556 | & 'tendance traceur TH','kg/kg',1,d_q_ajs) |
---|
557 | call WRITEDIAGFI(ngridmx,'zmax', & |
---|
558 | & 'pbl height','m',0,zmaxth) |
---|
559 | call WRITEDIAGFI(ngridmx,'d_u_th', & |
---|
560 | & 'tendance moment','m/s',1,pdu_th) |
---|
561 | call WRITEDIAGFI(ngridmx,'wtdif', & |
---|
562 | & 'heat flux from diffusion','K.m/s',1,wtdif) |
---|
563 | call WRITEDIAGFI(ngridmx,'wtth', & |
---|
564 | & 'heat flux from thermals','K.m/s',1,wtth) |
---|
565 | call WRITEDIAGFI(ngridmx,'wttot', & |
---|
566 | & 'heat flux PBL','K.m/s',1,wtdif(:,:)+wtth(:,:)) |
---|
567 | |
---|
568 | else |
---|
569 | |
---|
570 | call WRITEDIAGFI(ngridmx,'entr_therm','entrainement thermique',& |
---|
571 | & 'kg/m-2',3,entr_therm) |
---|
572 | call WRITEDIAGFI(ngridmx,'detr_therm','detrainement thermique',& |
---|
573 | & 'kg/m-2',3,detr_therm) |
---|
574 | call WRITEDIAGFI(ngridmx,'fm_therm','flux masse thermique',& |
---|
575 | & 'kg/m-2',3,fm_therm) |
---|
576 | call WRITEDIAGFI(ngridmx,'zw2','vitesse verticale thermique',& |
---|
577 | & 'm/s',3,zw2) |
---|
578 | call WRITEDIAGFI(ngridmx,'heatFlux','heatFlux',& |
---|
579 | & 'SI',3,heatFlux) |
---|
580 | call WRITEDIAGFI(ngridmx,'buoyancyOut','buoyancyOut',& |
---|
581 | & 'SI',3,buoyancyOut) |
---|
582 | call WRITEDIAGFI(ngridmx,'d_t_th', & |
---|
583 | & 'tendance temp TH','K',3,d_t_ajs) |
---|
584 | |
---|
585 | endif |
---|
586 | endif |
---|
587 | |
---|
588 | END |
---|