1 | ! |
---|
2 | MODULE add_phys_tend_mod |
---|
3 | |
---|
4 | IMPLICIT NONE |
---|
5 | ! flag to compute diagnostics to check energy conservation. If fl_ebil==0, no check |
---|
6 | INTEGER, SAVE :: fl_ebil |
---|
7 | !$OMP THREADPRIVATE(fl_ebil) |
---|
8 | ! flag to include modifcations to ensure energy conservation. If fl_cor_ebil==0, no corrections |
---|
9 | ! Note that with time, all these modifications should be included by default |
---|
10 | INTEGER, SAVE :: fl_cor_ebil |
---|
11 | !$OMP THREADPRIVATE(fl_cor_ebil) |
---|
12 | |
---|
13 | CONTAINS |
---|
14 | |
---|
15 | SUBROUTINE add_pbl_tend(zdu, zdv, zdt, zdq, zdql, zdqi, paprs, text,abortphy,flag_inhib_tend, itap) |
---|
16 | ! ====================================================================== |
---|
17 | ! Ajoute les tendances de couche limite, soit determinees par la |
---|
18 | ! parametrisation |
---|
19 | ! physique, soit forcees, aux variables d etat de la dynamique t_seri, |
---|
20 | ! q_seri ... |
---|
21 | ! ====================================================================== |
---|
22 | |
---|
23 | |
---|
24 | ! ====================================================================== |
---|
25 | ! Declarations |
---|
26 | ! ====================================================================== |
---|
27 | |
---|
28 | USE dimphy, ONLY: klon, klev |
---|
29 | ! USE dimphy |
---|
30 | USE phys_local_var_mod |
---|
31 | USE phys_state_var_mod |
---|
32 | USE mod_grid_phy_lmdz, ONLY: nbp_lev |
---|
33 | IMPLICIT NONE |
---|
34 | REAL,SAVE,ALLOCATABLE :: hthturb_gcssold(:) |
---|
35 | REAL,SAVE,ALLOCATABLE :: hqturb_gcssold(:) |
---|
36 | !$OMP THREADPRIVATE(hthturb_gcssold,hqturb_gcssold) |
---|
37 | REAL,SAVE :: dtime_frcg |
---|
38 | LOGICAL,SAVE :: turb_fcg_gcssold |
---|
39 | LOGICAL,SAVE :: firstcall=.true. |
---|
40 | !$OMP THREADPRIVATE(firstcall,turb_fcg_gcssold,dtime_frcg) |
---|
41 | INTEGER abortphy |
---|
42 | ! COMMON /turb_forcing/dtime_frcg, hthturb_gcssold, hqturb_gcssold, & |
---|
43 | ! turb_fcg_gcssold |
---|
44 | |
---|
45 | ! Arguments : |
---|
46 | ! ------------ |
---|
47 | REAL zdu(klon, klev), zdv(klon, klev) |
---|
48 | REAL zdt(klon, klev), zdq(klon, klev), zdql(klon, klev), zdqi(klon, klev) |
---|
49 | CHARACTER *(*) text |
---|
50 | REAL paprs(klon,klev+1) |
---|
51 | INTEGER flag_inhib_tend ! if flag_inhib_tend != 0, tendencies are not added |
---|
52 | INTEGER itap ! time step number |
---|
53 | |
---|
54 | ! Local : |
---|
55 | ! -------- |
---|
56 | REAL zzdt(klon, klev), zzdq(klon, klev) |
---|
57 | INTEGER i, k |
---|
58 | |
---|
59 | IF (firstcall) THEN |
---|
60 | ALLOCATE(hthturb_gcssold(nbp_lev)) |
---|
61 | ALLOCATE(hqturb_gcssold(nbp_lev)) |
---|
62 | firstcall=.false. |
---|
63 | ENDIF |
---|
64 | |
---|
65 | IF (turb_fcg_gcssold) THEN |
---|
66 | DO k = 1, klev |
---|
67 | DO i = 1, klon |
---|
68 | zzdt(i, k) = hthturb_gcssold(k)*dtime_frcg |
---|
69 | zzdq(i, k) = hqturb_gcssold(k)*dtime_frcg |
---|
70 | END DO |
---|
71 | END DO |
---|
72 | PRINT *, ' add_pbl_tend, dtime_frcg ', dtime_frcg |
---|
73 | PRINT *, ' add_pbl_tend, zzdt ', zzdt |
---|
74 | PRINT *, ' add_pbl_tend, zzdq ', zzdq |
---|
75 | CALL add_phys_tend(zdu, zdv, zzdt, zzdq, zdql, zdqi, paprs, text,abortphy,flag_inhib_tend, itap) |
---|
76 | ELSE |
---|
77 | CALL add_phys_tend(zdu, zdv, zdt, zdq, zdql, zdqi, paprs, text,abortphy,flag_inhib_tend, itap) |
---|
78 | END IF |
---|
79 | |
---|
80 | |
---|
81 | RETURN |
---|
82 | END SUBROUTINE add_pbl_tend |
---|
83 | ! |
---|
84 | ! $Id: add_phys_tend.F90 2611 2016-08-03 15:41:26Z jyg $ |
---|
85 | ! |
---|
86 | SUBROUTINE add_phys_tend (zdu,zdv,zdt,zdq,zdql,zdqi,paprs,text,abortphy,flag_inhib_tend, itap) |
---|
87 | !====================================================================== |
---|
88 | ! Ajoute les tendances des variables physiques aux variables |
---|
89 | ! d'etat de la dynamique t_seri, q_seri ... |
---|
90 | ! On en profite pour faire des tests sur les tendances en question. |
---|
91 | !====================================================================== |
---|
92 | |
---|
93 | |
---|
94 | !====================================================================== |
---|
95 | ! Declarations |
---|
96 | !====================================================================== |
---|
97 | |
---|
98 | USE dimphy, ONLY: klon, klev |
---|
99 | USE phys_state_var_mod, ONLY : dtime |
---|
100 | USE phys_local_var_mod, ONLY: u_seri, v_seri, ql_seri, qs_seri, q_seri, t_seri |
---|
101 | USE phys_state_var_mod, ONLY: ftsol |
---|
102 | USE geometry_mod, ONLY: longitude_deg, latitude_deg |
---|
103 | USE print_control_mod, ONLY: prt_level |
---|
104 | USE cmp_seri_mod |
---|
105 | USE phys_output_var_mod, ONLY : d_qw_col, d_ql_col, d_qs_col, d_qt_col, d_ek_col, d_h_dair_col & |
---|
106 | & , d_h_qw_col, d_h_ql_col, d_h_qs_col, d_h_col |
---|
107 | IMPLICIT none |
---|
108 | include "YOMCST.h" |
---|
109 | include "clesphys.h" |
---|
110 | |
---|
111 | ! Arguments : |
---|
112 | !------------ |
---|
113 | REAL zdu(klon,klev),zdv(klon,klev) |
---|
114 | REAL zdt(klon,klev),zdq(klon,klev),zdql(klon,klev),zdqi(klon,klev) |
---|
115 | REAL paprs(klon,klev+1) |
---|
116 | CHARACTER*(*) text |
---|
117 | INTEGER abortphy |
---|
118 | INTEGER flag_inhib_tend ! if flag_inhib_tend != 0, tendencies are not added |
---|
119 | INTEGER itap ! time step number |
---|
120 | |
---|
121 | ! Local : |
---|
122 | !-------- |
---|
123 | REAL zt,zq |
---|
124 | REAL zq_int, zqp_int, zq_new |
---|
125 | |
---|
126 | REAL zqp(klev) |
---|
127 | |
---|
128 | INTEGER i, k,j, n |
---|
129 | INTEGER jadrs(klon*klev), jbad |
---|
130 | INTEGER jqadrs(klon*klev), jqbad |
---|
131 | INTEGER kadrs(klon*klev) |
---|
132 | INTEGER kqadrs(klon*klev) |
---|
133 | |
---|
134 | LOGICAL done(klon) |
---|
135 | |
---|
136 | integer debug_level |
---|
137 | logical, save :: first=.true. |
---|
138 | !$OMP THREADPRIVATE(first) |
---|
139 | ! |
---|
140 | !====================================================================== |
---|
141 | ! Variables for energy conservation tests |
---|
142 | !====================================================================== |
---|
143 | ! |
---|
144 | |
---|
145 | ! zh_col------- total enthalpy of vertical air column |
---|
146 | ! (air with watter vapour, liquid and solid) (J/m2) |
---|
147 | ! zh_dair_col--- total enthalpy of dry air (J/m2) |
---|
148 | ! zh_qw_col---- total enthalpy of watter vapour (J/m2) |
---|
149 | ! zh_ql_col---- total enthalpy of liquid watter (J/m2) |
---|
150 | ! zh_qs_col---- total enthalpy of solid watter (J/m2) |
---|
151 | ! zqw_col------ total mass of watter vapour (kg/m2) |
---|
152 | ! zql_col------ total mass of liquid watter (kg/m2) |
---|
153 | ! zqs_col------ total mass of solid watter (kg/m2) |
---|
154 | ! zek_col------ total kinetic energy (kg/m2) |
---|
155 | ! |
---|
156 | REAL zairm(klon, klev) ! layer air mass (kg/m2) |
---|
157 | REAL zqw_col(klon,2) |
---|
158 | REAL zql_col(klon,2) |
---|
159 | REAL zqs_col(klon,2) |
---|
160 | REAL zek_col(klon,2) |
---|
161 | REAL zh_dair_col(klon,2) |
---|
162 | REAL zh_qw_col(klon,2), zh_ql_col(klon,2), zh_qs_col(klon,2) |
---|
163 | REAL zh_col(klon,2) |
---|
164 | |
---|
165 | REAL zcpvap, zcwat, zcice |
---|
166 | |
---|
167 | !====================================================================== |
---|
168 | ! Initialisations |
---|
169 | |
---|
170 | IF (prt_level >= 5) then |
---|
171 | write (*,*) "In add_phys_tend, after ",text |
---|
172 | call flush |
---|
173 | end if |
---|
174 | |
---|
175 | ! if flag_inhib_tend != 0, tendencies are not added |
---|
176 | IF (flag_inhib_tend /= 0) then |
---|
177 | ! If requiered, diagnostics are shown |
---|
178 | IF (flag_inhib_tend > 0) then |
---|
179 | ! print some diagnostics if xxx_seri have changed |
---|
180 | call cmp_seri(flag_inhib_tend,text) |
---|
181 | END IF |
---|
182 | RETURN ! on n ajoute pas les tendance |
---|
183 | END IF |
---|
184 | |
---|
185 | IF (abortphy==1) RETURN ! on n ajoute pas les tendance si le modele |
---|
186 | ! a deja plante. |
---|
187 | |
---|
188 | debug_level=10 |
---|
189 | if (first) then |
---|
190 | print *,"TestJLD rcpv, rcw, rcs",rcpv, rcw, rcs |
---|
191 | first=.false. |
---|
192 | endif |
---|
193 | !====================================================================== |
---|
194 | ! Diagnostics for energy conservation tests |
---|
195 | !====================================================================== |
---|
196 | DO k = 1, klev |
---|
197 | ! layer air mass |
---|
198 | zairm(:, k) = (paprs(:,k)-paprs(:,k+1))/rg |
---|
199 | END DO |
---|
200 | |
---|
201 | if (fl_ebil .GT. 0) then |
---|
202 | ! Reset variables |
---|
203 | zqw_col(:,:) = 0. |
---|
204 | zql_col(:,:) = 0. |
---|
205 | zqs_col(:,:) = 0. |
---|
206 | zek_col(:,:) = 0. |
---|
207 | zh_dair_col(:,:) = 0. |
---|
208 | zh_qw_col(:,:) = 0. |
---|
209 | zh_ql_col(:,:) = 0. |
---|
210 | zh_qs_col(:,:) = 0. |
---|
211 | |
---|
212 | zcpvap = rcpv |
---|
213 | zcwat = rcw |
---|
214 | zcice = rcs |
---|
215 | !JLD write (*,*) "rcpd, zcpvap, zcwat, zcice ",rcpd, zcpvap, zcwat, zcice |
---|
216 | |
---|
217 | ! ------------------------------------------------ |
---|
218 | ! Compute vertical sum for each atmospheric column |
---|
219 | ! ------------------------------------------------ |
---|
220 | n=1 ! begining of time step |
---|
221 | DO k = 1, klev |
---|
222 | DO i = 1, klon |
---|
223 | ! Watter mass |
---|
224 | zqw_col(i,n) = zqw_col(i,n) + q_seri(i, k)*zairm(i, k) |
---|
225 | zql_col(i,n) = zql_col(i,n) + ql_seri(i, k)*zairm(i, k) |
---|
226 | zqs_col(i,n) = zqs_col(i,n) + qs_seri(i, k)*zairm(i, k) |
---|
227 | ! Kinetic Energy |
---|
228 | zek_col(i,n) = zek_col(i,n) + 0.5*(u_seri(i,k)**2+v_seri(i,k)**2)*zairm(i, k) |
---|
229 | ! Air enthalpy : dry air, water vapour, liquid, solid |
---|
230 | zh_dair_col(i,n) = zh_dair_col(i,n) + rcpd*(1.-q_seri(i,k)-ql_seri(i,k)-qs_seri(i,k))* & |
---|
231 | zairm(i, k)*t_seri(i, k) |
---|
232 | zh_qw_col(i,n) = zh_qw_col(i,n) + zcpvap*q_seri(i, k)*zairm(i, k)*t_seri(i, k) |
---|
233 | zh_ql_col(i,n) = zh_ql_col(i,n) + zcwat*ql_seri(i, k)*zairm(i, k)*t_seri(i, k) - & |
---|
234 | rlvtt*ql_seri(i, k)*zairm(i, k) |
---|
235 | zh_qs_col(i,n) = zh_qs_col(i,n) + zcice*qs_seri(i, k)*zairm(i, k)*t_seri(i, k) - & |
---|
236 | rlstt*qs_seri(i, k)*zairm(i, k) |
---|
237 | END DO |
---|
238 | END DO |
---|
239 | ! compute total air enthalpy |
---|
240 | zh_col(:,n) = zh_dair_col(:,n) + zh_qw_col(:,n) + zh_ql_col(:,n) + zh_qs_col(:,n) |
---|
241 | |
---|
242 | end if ! end if (fl_ebil .GT. 0) |
---|
243 | |
---|
244 | !====================================================================== |
---|
245 | ! Ajout des tendances sur le vent et l'eau liquide |
---|
246 | !====================================================================== |
---|
247 | |
---|
248 | u_seri(:,:)=u_seri(:,:)+zdu(:,:) |
---|
249 | v_seri(:,:)=v_seri(:,:)+zdv(:,:) |
---|
250 | ql_seri(:,:)=ql_seri(:,:)+zdql(:,:) |
---|
251 | qs_seri(:,:)=qs_seri(:,:)+zdqi(:,:) |
---|
252 | |
---|
253 | !====================================================================== |
---|
254 | ! On ajoute les tendances de la temperature et de la vapeur d'eau |
---|
255 | ! en verifiant que ca ne part pas dans les choux |
---|
256 | !====================================================================== |
---|
257 | |
---|
258 | jbad=0 |
---|
259 | jqbad=0 |
---|
260 | DO k = 1, klev |
---|
261 | DO i = 1, klon |
---|
262 | zt=t_seri(i,k)+zdt(i,k) |
---|
263 | zq=q_seri(i,k)+zdq(i,k) |
---|
264 | IF ( zt>370. .or. zt<130. .or. abs(zdt(i,k))>50. ) then |
---|
265 | jbad = jbad + 1 |
---|
266 | jadrs(jbad) = i |
---|
267 | kadrs(jbad) = k |
---|
268 | ENDIF |
---|
269 | IF ( zq<0. .or. zq>0.1 .or. abs(zdq(i,k))>1.e-2 ) then |
---|
270 | jqbad = jqbad + 1 |
---|
271 | jqadrs(jqbad) = i |
---|
272 | kqadrs(jqbad) = k |
---|
273 | ENDIF |
---|
274 | t_seri(i,k)=zt |
---|
275 | q_seri(i,k)=zq |
---|
276 | ENDDO |
---|
277 | ENDDO |
---|
278 | |
---|
279 | !===================================================================================== |
---|
280 | ! Impression et stop en cas de probleme important |
---|
281 | !===================================================================================== |
---|
282 | |
---|
283 | IF (jbad .GT. 0) THEN |
---|
284 | DO j = 1, jbad |
---|
285 | i=jadrs(j) |
---|
286 | if(prt_level.ge.debug_level) THEN |
---|
287 | print*,'PLANTAGE POUR LE POINT i lon lat =',& |
---|
288 | i,longitude_deg(i),latitude_deg(i),text |
---|
289 | print*,'l T dT Q dQ ' |
---|
290 | DO k = 1, klev |
---|
291 | write(*,'(i3,2f14.4,2e14.2)') k,t_seri(i,k),zdt(i,k),q_seri(i,k),zdq(i,k) |
---|
292 | ENDDO |
---|
293 | call print_debug_phys(i,debug_level,text) |
---|
294 | endif |
---|
295 | ENDDO |
---|
296 | ENDIF |
---|
297 | ! |
---|
298 | !===================================================================================== |
---|
299 | ! Impression, warning et correction en cas de probleme moins important |
---|
300 | !===================================================================================== |
---|
301 | IF (jqbad .GT. 0) THEN |
---|
302 | done(:) = .false. !jyg |
---|
303 | DO j = 1, jqbad |
---|
304 | i=jqadrs(j) |
---|
305 | if(prt_level.ge.debug_level) THEN |
---|
306 | print*,'WARNING : EAU POUR LE POINT i lon lat =',& |
---|
307 | i,longitude_deg(i),latitude_deg(i),text |
---|
308 | print*,'l T dT Q dQ ' |
---|
309 | DO k = 1, klev |
---|
310 | write(*,'(i3,2f14.4,2e14.2)') k,t_seri(i,k),zdt(i,k),q_seri(i,k),zdq(i,k) |
---|
311 | ENDDO |
---|
312 | endif |
---|
313 | IF (ok_conserv_q) THEN |
---|
314 | !jyg<20140228 Corrections pour conservation de l'eau |
---|
315 | IF (.NOT.done(i)) THEN !jyg |
---|
316 | DO k = 1, klev |
---|
317 | zqp(k) = max(q_seri(i,k),1.e-15) |
---|
318 | ENDDO |
---|
319 | zq_int = 0. |
---|
320 | zqp_int = 0. |
---|
321 | DO k = 1, klev |
---|
322 | zq_int = zq_int + q_seri(i,k)*(paprs(i,k)-paprs(i,k+1))/Rg |
---|
323 | zqp_int = zqp_int + zqp(k) *(paprs(i,k)-paprs(i,k+1))/Rg |
---|
324 | ENDDO |
---|
325 | if(prt_level.ge.debug_level) THEN |
---|
326 | print*,' cas q_seri<1.e-15 i k zq_int zqp_int zq_int/zqp_int :', & |
---|
327 | i, kqadrs(j), zq_int, zqp_int, zq_int/zqp_int |
---|
328 | endif |
---|
329 | DO k = 1, klev |
---|
330 | zq_new = zqp(k)*zq_int/zqp_int |
---|
331 | zdq(i,k) = zdq(i,k) + zq_new - q_seri(i,k) |
---|
332 | q_seri(i,k) = zq_new |
---|
333 | ENDDO |
---|
334 | done(i) = .true. |
---|
335 | ENDIF !(.NOT.done(i)) |
---|
336 | ELSE |
---|
337 | !jyg> |
---|
338 | DO k = 1, klev |
---|
339 | zq=q_seri(i,k)+zdq(i,k) |
---|
340 | if (zq.lt.1.e-15) then |
---|
341 | if (q_seri(i,k).lt.1.e-15) then |
---|
342 | if(prt_level.ge.debug_level) THEN |
---|
343 | print*,' cas q_seri<1.e-15 i k q_seri zq zdq :',i,k,q_seri(i,k),zq,zdq(i,k) |
---|
344 | endif |
---|
345 | q_seri(i,k)=1.e-15 |
---|
346 | zdq(i,k)=(1.e-15-q_seri(i,k)) |
---|
347 | endif |
---|
348 | endif |
---|
349 | ! zq=q_seri(i,k)+zdq(i,k) |
---|
350 | ! if (zq.lt.1.e-15) then |
---|
351 | ! zdq(i,k)=(1.e-15-q_seri(i,k)) |
---|
352 | ! endif |
---|
353 | ENDDO |
---|
354 | !jyg<20140228 |
---|
355 | ENDIF ! (ok_conserv_q) |
---|
356 | !jyg> |
---|
357 | ENDDO ! j = 1, jqbad |
---|
358 | ENDIF |
---|
359 | ! |
---|
360 | |
---|
361 | !IM ajout memes tests pour reverifier les jbad, jqbad beg |
---|
362 | jbad=0 |
---|
363 | jqbad=0 |
---|
364 | DO k = 1, klev |
---|
365 | DO i = 1, klon |
---|
366 | IF ( t_seri(i,k)>370. .or. t_seri(i,k)<130. .or. abs(zdt(i,k))>50. ) then |
---|
367 | jbad = jbad + 1 |
---|
368 | jadrs(jbad) = i |
---|
369 | ! if(prt_level.ge.debug_level) THEN |
---|
370 | ! print*,'cas2 i k t_seri zdt',i,k,t_seri(i,k),zdt(i,k) |
---|
371 | ! endif |
---|
372 | ENDIF |
---|
373 | IF ( q_seri(i,k)<0. .or. q_seri(i,k)>0.1 .or. abs(zdq(i,k))>1.e-2 ) then |
---|
374 | jqbad = jqbad + 1 |
---|
375 | jqadrs(jqbad) = i |
---|
376 | kqadrs(jqbad) = k |
---|
377 | ! if(prt_level.ge.debug_level) THEN |
---|
378 | ! print*,'cas2 i k q_seri zdq',i,k,q_seri(i,k),zdq(i,k) |
---|
379 | ! endif |
---|
380 | ENDIF |
---|
381 | ENDDO |
---|
382 | ENDDO |
---|
383 | IF (jbad .GT. 0) THEN |
---|
384 | DO j = 1, jbad |
---|
385 | i=jadrs(j) |
---|
386 | k=kadrs(j) |
---|
387 | if(prt_level.ge.debug_level) THEN |
---|
388 | print*,'PLANTAGE2 POUR LE POINT i itap lon lat txt jbad zdt t',& |
---|
389 | i,itap,longitude_deg(i),latitude_deg(i),text,jbad, & |
---|
390 | & zdt(i,k),t_seri(i,k)-zdt(i,k) |
---|
391 | !!! if(prt_level.ge.10.and.itap.GE.229.and.i.EQ.3027) THEN |
---|
392 | print*,'l T dT Q dQ ' |
---|
393 | DO k = 1, klev |
---|
394 | write(*,'(i3,2f14.4,2e14.2)') k,t_seri(i,k),zdt(i,k),q_seri(i,k),zdq(i,k) |
---|
395 | ENDDO |
---|
396 | call print_debug_phys(i,debug_level,text) |
---|
397 | endif |
---|
398 | ENDDO |
---|
399 | ENDIF |
---|
400 | ! |
---|
401 | IF (jqbad .GT. 0) THEN |
---|
402 | DO j = 1, jqbad |
---|
403 | i=jqadrs(j) |
---|
404 | k=kqadrs(j) |
---|
405 | if(prt_level.ge.debug_level) THEN |
---|
406 | print*,'WARNING : EAU2 POUR LE POINT i itap lon lat txt jqbad zdq q zdql ql',& |
---|
407 | i,itap,longitude_deg(i),latitude_deg(i),text,jqbad,& |
---|
408 | & zdq(i,k), q_seri(i,k)-zdq(i,k), zdql(i,k), ql_seri(i,k)-zdql(i,k) |
---|
409 | !!! if(prt_level.ge.10.and.itap.GE.229.and.i.EQ.3027) THEN |
---|
410 | print*,'l T dT Q dQ ' |
---|
411 | DO k = 1, klev |
---|
412 | write(*,'(i3,2f14.4,2e14.2)') k,t_seri(i,k),zdt(i,k),q_seri(i,k),zdq(i,k) |
---|
413 | ENDDO |
---|
414 | call print_debug_phys(i,debug_level,text) |
---|
415 | endif |
---|
416 | ENDDO |
---|
417 | ENDIF |
---|
418 | |
---|
419 | !====================================================================== |
---|
420 | ! Contrôle des min/max pour arrêt du modèle |
---|
421 | ! Si le modele est en mode abortphy, on retire les tendances qu'on |
---|
422 | ! vient d'ajouter. Pas exactement parce qu'on ne tient pas compte des |
---|
423 | ! seuils. |
---|
424 | !====================================================================== |
---|
425 | |
---|
426 | CALL hgardfou(t_seri,ftsol,text,abortphy) |
---|
427 | IF (abortphy==1) THEN |
---|
428 | Print*,'ERROR ABORT hgardfou dans ',text |
---|
429 | ! JLD pourquoi on ne modifie pas de meme t_seri et q_seri ? |
---|
430 | u_seri(:,:)=u_seri(:,:)-zdu(:,:) |
---|
431 | v_seri(:,:)=v_seri(:,:)-zdv(:,:) |
---|
432 | ql_seri(:,:)=ql_seri(:,:)-zdql(:,:) |
---|
433 | qs_seri(:,:)=qs_seri(:,:)-zdqi(:,:) |
---|
434 | ENDIF |
---|
435 | |
---|
436 | !====================================================================== |
---|
437 | ! Diagnostics for energy conservation tests |
---|
438 | !====================================================================== |
---|
439 | |
---|
440 | if (fl_ebil .GT. 0) then |
---|
441 | |
---|
442 | ! ------------------------------------------------ |
---|
443 | ! Compute vertical sum for each atmospheric column |
---|
444 | ! ------------------------------------------------ |
---|
445 | n=2 ! end of time step |
---|
446 | DO k = 1, klev |
---|
447 | DO i = 1, klon |
---|
448 | ! Watter mass |
---|
449 | zqw_col(i,n) = zqw_col(i,n) + q_seri(i, k)*zairm(i, k) |
---|
450 | zql_col(i,n) = zql_col(i,n) + ql_seri(i, k)*zairm(i, k) |
---|
451 | zqs_col(i,n) = zqs_col(i,n) + qs_seri(i, k)*zairm(i, k) |
---|
452 | ! Kinetic Energy |
---|
453 | zek_col(i,n) = zek_col(i,n) + 0.5*(u_seri(i,k)**2+v_seri(i,k)**2)*zairm(i, k) |
---|
454 | ! Air enthalpy : dry air, water vapour, liquid, solid |
---|
455 | zh_dair_col(i,n) = zh_dair_col(i,n) + rcpd*(1.-q_seri(i,k)-ql_seri(i,k)-qs_seri(i,k))* & |
---|
456 | zairm(i, k)*t_seri(i, k) |
---|
457 | zh_qw_col(i,n) = zh_qw_col(i,n) + zcpvap*q_seri(i, k)*zairm(i, k)*t_seri(i, k) |
---|
458 | zh_ql_col(i,n) = zh_ql_col(i,n) + zcwat*ql_seri(i, k)*zairm(i, k)*t_seri(i, k) - & |
---|
459 | rlvtt*ql_seri(i, k)*zairm(i, k) |
---|
460 | zh_qs_col(i,n) = zh_qs_col(i,n) + zcice*qs_seri(i, k)*zairm(i, k)*t_seri(i, k) - & |
---|
461 | rlstt*qs_seri(i, k)*zairm(i, k) |
---|
462 | END DO |
---|
463 | END DO |
---|
464 | ! compute total air enthalpy |
---|
465 | zh_col(:,n) = zh_dair_col(:,n) + zh_qw_col(:,n) + zh_ql_col(:,n) + zh_qs_col(:,n) |
---|
466 | |
---|
467 | ! ------------------------------------------------ |
---|
468 | ! Compute the changes by unit of time |
---|
469 | ! ------------------------------------------------ |
---|
470 | |
---|
471 | d_qw_col(:) = (zqw_col(:,2)-zqw_col(:,1))/dtime |
---|
472 | d_ql_col(:) = (zql_col(:,2)-zql_col(:,1))/dtime |
---|
473 | d_qs_col(:) = (zqs_col(:,2)-zqs_col(:,1))/dtime |
---|
474 | d_qt_col(:) = d_qw_col(:) + d_ql_col(:) + d_qs_col(:) |
---|
475 | |
---|
476 | d_ek_col(:) = (zek_col(:,2)-zek_col(:,1))/dtime |
---|
477 | |
---|
478 | d_h_dair_col(:) = (zh_dair_col(:,2)-zh_dair_col(:,1))/dtime |
---|
479 | d_h_qw_col(:) = (zh_qw_col(:,2)-zh_qw_col(:,1))/dtime |
---|
480 | d_h_ql_col(:) = (zh_ql_col(:,2)-zh_ql_col(:,1))/dtime |
---|
481 | d_h_qs_col(:) = (zh_qs_col(:,2)-zh_qs_col(:,1))/dtime |
---|
482 | |
---|
483 | d_h_col = (zh_col(:,2)-zh_col(:,1))/dtime |
---|
484 | |
---|
485 | end if ! end if (fl_ebil .GT. 0) |
---|
486 | |
---|
487 | |
---|
488 | RETURN |
---|
489 | END SUBROUTINE add_phys_tend |
---|
490 | |
---|
491 | SUBROUTINE prt_enerbil (text, itap) |
---|
492 | !====================================================================== |
---|
493 | ! Print enenrgy budget diagnotics for the 1D case |
---|
494 | !====================================================================== |
---|
495 | |
---|
496 | !====================================================================== |
---|
497 | ! Declarations |
---|
498 | !====================================================================== |
---|
499 | |
---|
500 | USE dimphy, ONLY: klon, klev |
---|
501 | USE phys_state_var_mod, ONLY : dtime |
---|
502 | USE phys_state_var_mod, ONLY : topsw, toplw, solsw, sollw, rain_con, snow_con |
---|
503 | USE geometry_mod, ONLY: longitude_deg, latitude_deg |
---|
504 | USE print_control_mod, ONLY: prt_level |
---|
505 | USE cmp_seri_mod |
---|
506 | USE phys_output_var_mod, ONLY : d_qw_col, d_ql_col, d_qs_col, d_qt_col, d_ek_col, d_h_dair_col & |
---|
507 | & , d_h_qw_col, d_h_ql_col, d_h_qs_col, d_h_col |
---|
508 | USE phys_local_var_mod, ONLY: evap, sens |
---|
509 | USE phys_local_var_mod, ONLY: u_seri, v_seri, ql_seri, qs_seri, q_seri, t_seri & |
---|
510 | & , rain_lsc, snow_lsc |
---|
511 | USE climb_hq_mod, ONLY : d_h_col_vdf, f_h_bnd |
---|
512 | IMPLICIT none |
---|
513 | include "YOMCST.h" |
---|
514 | |
---|
515 | ! Arguments : |
---|
516 | !------------ |
---|
517 | CHARACTER*(*) text ! text specifing the involved parametrization |
---|
518 | integer itap ! time step number |
---|
519 | ! local variables |
---|
520 | ! --------------- |
---|
521 | real bilq_seuil, bilh_seuil ! thresold on error in Q and H budget |
---|
522 | real bilq_error, bilh_error ! erros in Q and H budget |
---|
523 | real bilq_bnd, bilh_bnd ! Q and H budget due to exchange with boundaries |
---|
524 | integer bilq_ok, bilh_ok |
---|
525 | CHARACTER*(12) status |
---|
526 | |
---|
527 | bilq_seuil = 1.E-10 |
---|
528 | bilh_seuil = 1.E-1 |
---|
529 | bilq_ok=0 |
---|
530 | bilh_ok=0 |
---|
531 | |
---|
532 | print *,'prt_level:',prt_level,' fl_ebil:',fl_ebil,' fl_cor_ebil:',fl_cor_ebil |
---|
533 | if ( (fl_ebil .GT. 0) .and. (klon .EQ. 1)) then |
---|
534 | |
---|
535 | bilq_bnd = 0. |
---|
536 | bilh_bnd = 0. |
---|
537 | |
---|
538 | param: SELECT CASE (text) |
---|
539 | CASE("vdf") param |
---|
540 | bilq_bnd = evap(1) |
---|
541 | bilh_bnd = sens(1)+(rcpv-rcpd)*evap(1)*t_seri(1,1) |
---|
542 | CASE("lsc") param |
---|
543 | bilq_bnd = - rain_lsc(1) - snow_lsc(1) |
---|
544 | bilh_bnd = (-(rcw-rcpd)*t_seri(1,1) + rlvtt) * rain_lsc(1) & |
---|
545 | & + (-(rcs-rcpd)*t_seri(1,1) + rlstt) * snow_lsc(1) |
---|
546 | CASE("convection") param |
---|
547 | bilq_bnd = - rain_con(1) - snow_con(1) |
---|
548 | bilh_bnd = (-(rcw-rcpd)*t_seri(1,1) + rlvtt) * rain_con(1) & |
---|
549 | & + (-(rcs-rcpd)*t_seri(1,1) + rlstt) * snow_con(1) |
---|
550 | CASE("SW") param |
---|
551 | bilh_bnd = topsw(1) - solsw(1) |
---|
552 | CASE("LW") param |
---|
553 | bilh_bnd = -(toplw(1) + sollw(1)) |
---|
554 | CASE DEFAULT param |
---|
555 | bilq_bnd = 0. |
---|
556 | bilh_bnd = 0. |
---|
557 | END SELECT param |
---|
558 | |
---|
559 | bilq_error = d_qt_col(1) - bilq_bnd |
---|
560 | bilh_error = d_h_col(1) - bilh_bnd |
---|
561 | ! are the errors too large? |
---|
562 | if ( abs(bilq_error) .gt. bilq_seuil) bilq_ok=1 |
---|
563 | if ( abs(bilh_error) .gt. bilh_seuil) bilh_ok=1 |
---|
564 | ! |
---|
565 | ! Print diagnostics |
---|
566 | ! ================= |
---|
567 | if ( (bilq_ok .eq. 0).and.(bilh_ok .eq. 0) ) then |
---|
568 | status="enerbil-OK" |
---|
569 | else |
---|
570 | status="enerbil-PB" |
---|
571 | end if |
---|
572 | |
---|
573 | if ( prt_level .GE. 3) then |
---|
574 | write(*,9010) text,status," itap:",itap,"enerbilERROR: Q", bilq_error," H", bilh_error |
---|
575 | 9010 format (1x,A8,2x,A12,A6,I4,A18,E15.6,A5,E15.6) |
---|
576 | end if |
---|
577 | if ( prt_level .GE. 3) then |
---|
578 | write(*,9000) text,"enerbil: Q,H,KE budget", d_qt_col(1), d_h_col(1),d_ek_col(1) |
---|
579 | end if |
---|
580 | if ( prt_level .GE. 5) then |
---|
581 | write(*,9000) text,"enerbil at boundaries: Q, H",bilq_bnd, bilh_bnd |
---|
582 | write(*,9000) text,"enerbil: water budget",d_qt_col(1),d_qw_col(1),d_ql_col(1),d_qs_col(1) |
---|
583 | write(*,9000) text,"enerbil: enthalpy budget",d_h_col(1),d_h_dair_col(1),d_h_qw_col(1),d_h_ql_col(1),d_h_qs_col(1) |
---|
584 | end if |
---|
585 | |
---|
586 | specific_diag: SELECT CASE (text) |
---|
587 | CASE("vdf") specific_diag |
---|
588 | if ( prt_level .GE. 5) then |
---|
589 | write(*,9000) text,"enerbil: d_h, bilh, sens,t_seri", d_h_col(1), bilh_bnd, sens(1), t_seri(1,1) |
---|
590 | write(*,9000) text,"enerbil: d_h_col_vdf, f_h, diff",d_h_col_vdf, f_h_bnd, bilh_bnd-sens(1) |
---|
591 | end if |
---|
592 | CASE("lsc") specific_diag |
---|
593 | if ( prt_level .GE. 5) then |
---|
594 | write(*,9000) text,"enerbil: rain, bil_lat, bil_sens", rain_lsc(1), rlvtt * rain_lsc(1), -(rcw-rcpd)*t_seri(1,1) * rain_lsc(1) |
---|
595 | write(*,9000) text,"enerbil: snow, bil_lat, bil_sens", snow_lsc(1), rlstt * snow_lsc(1), -(rcs-rcpd)*t_seri(1,1) * snow_lsc(1) |
---|
596 | end if |
---|
597 | END SELECT specific_diag |
---|
598 | |
---|
599 | 9000 format (1x,A8,2x,A30,10E15.6) |
---|
600 | |
---|
601 | end if ! end if (fl_ebil .GT. 0) |
---|
602 | |
---|
603 | END SUBROUTINE prt_enerbil |
---|
604 | |
---|
605 | END MODULE add_phys_tend_mod |
---|