1 | |
---|
2 | ! $Id: add_phys_tend_mod.F90 5160 2024-08-03 12:56:58Z abarral $ |
---|
3 | |
---|
4 | |
---|
5 | MODULE add_phys_tend_mod |
---|
6 | |
---|
7 | IMPLICIT NONE |
---|
8 | ! flag to compute diagnostics to check energy conservation. If fl_ebil==0, no check |
---|
9 | INTEGER, SAVE :: fl_ebil |
---|
10 | !$OMP THREADPRIVATE(fl_ebil) |
---|
11 | ! flag to include modifcations to ensure energy conservation. If fl_cor_ebil==0, no corrections |
---|
12 | ! Note that with time, all these modifications should be included by default |
---|
13 | INTEGER, SAVE :: fl_cor_ebil |
---|
14 | !$OMP THREADPRIVATE(fl_cor_ebil) |
---|
15 | |
---|
16 | CONTAINS |
---|
17 | |
---|
18 | SUBROUTINE add_pbl_tend(zdu, zdv, zdt, zdq, zdql, zdqi, zdqbs, paprs, text,abortphy,flag_inhib_tend, itap & |
---|
19 | #ifdef ISO |
---|
20 | ,zdxt,zdxtl,zdxti & |
---|
21 | #endif |
---|
22 | ) |
---|
23 | ! ====================================================================== |
---|
24 | ! Ajoute les tendances de couche limite, soit determinees par la |
---|
25 | ! parametrisation |
---|
26 | ! physique, soit forcees, aux variables d etat de la dynamique t_seri, |
---|
27 | ! q_seri ... |
---|
28 | ! ====================================================================== |
---|
29 | |
---|
30 | |
---|
31 | ! ====================================================================== |
---|
32 | ! Declarations |
---|
33 | ! ====================================================================== |
---|
34 | |
---|
35 | USE dimphy, ONLY: klon, klev |
---|
36 | ! USE dimphy |
---|
37 | USE phys_local_var_mod |
---|
38 | USE phys_state_var_mod |
---|
39 | USE lmdz_grid_phy, ONLY: nbp_lev |
---|
40 | #ifdef ISO |
---|
41 | USE infotrac_phy, ONLY: ntraciso=>ntiso |
---|
42 | USE isotopes_mod, ONLY: iso_eau |
---|
43 | #endif |
---|
44 | IMPLICIT NONE |
---|
45 | REAL,SAVE,ALLOCATABLE :: hthturb_gcssold(:) |
---|
46 | REAL,SAVE,ALLOCATABLE :: hqturb_gcssold(:) |
---|
47 | !$OMP THREADPRIVATE(hthturb_gcssold,hqturb_gcssold) |
---|
48 | REAL,SAVE :: dtime_frcg |
---|
49 | LOGICAL,SAVE :: turb_fcg_gcssold |
---|
50 | LOGICAL,SAVE :: firstcall=.TRUE. |
---|
51 | !$OMP THREADPRIVATE(firstcall,turb_fcg_gcssold,dtime_frcg) |
---|
52 | INTEGER abortphy |
---|
53 | #ifdef ISO |
---|
54 | REAL,SAVE,ALLOCATABLE :: hxtturb_gcssold(:,:) |
---|
55 | !$OMP THREADPRIVATE(hxtturb_gcssold) |
---|
56 | ! variable à définir dans le 1D |
---|
57 | #endif |
---|
58 | |
---|
59 | ! Arguments : |
---|
60 | ! ------------ |
---|
61 | REAL zdu(klon, klev), zdv(klon, klev) |
---|
62 | REAL zdt(klon, klev), zdq(klon, klev), zdql(klon, klev), zdqi(klon, klev), zdqbs(klon,klev) |
---|
63 | CHARACTER *(*) text |
---|
64 | REAL paprs(klon,klev+1) |
---|
65 | INTEGER flag_inhib_tend ! if flag_inhib_tend != 0, tendencies are not added |
---|
66 | INTEGER itap ! time step number |
---|
67 | #ifdef ISO |
---|
68 | REAL zdxt(ntraciso,klon, klev), zdxtl(ntraciso,klon, klev), zdxti(ntraciso,klon, klev) |
---|
69 | #endif |
---|
70 | |
---|
71 | ! Local : |
---|
72 | ! -------- |
---|
73 | REAL zzdt(klon, klev), zzdq(klon, klev) |
---|
74 | INTEGER i, k |
---|
75 | #ifdef ISO |
---|
76 | REAL zzdxt(ntraciso,klon, klev) |
---|
77 | INTEGER ixt |
---|
78 | #endif |
---|
79 | |
---|
80 | IF (firstcall) THEN |
---|
81 | ALLOCATE(hthturb_gcssold(nbp_lev)) |
---|
82 | ALLOCATE(hqturb_gcssold(nbp_lev)) |
---|
83 | #ifdef ISO |
---|
84 | ALLOCATE(hxtturb_gcssold(ntraciso,nbp_lev)) |
---|
85 | #endif |
---|
86 | firstcall=.FALSE. |
---|
87 | ENDIF |
---|
88 | |
---|
89 | IF (turb_fcg_gcssold) THEN |
---|
90 | DO k = 1, klev |
---|
91 | DO i = 1, klon |
---|
92 | zzdt(i, k) = hthturb_gcssold(k)*dtime_frcg |
---|
93 | zzdq(i, k) = hqturb_gcssold(k)*dtime_frcg |
---|
94 | #ifdef ISO |
---|
95 | DO ixt=1,ntraciso |
---|
96 | zzdxt(ixt,i, k) = hxtturb_gcssold(ixt,k)*dtime_frcg |
---|
97 | enddo |
---|
98 | #endif |
---|
99 | END DO |
---|
100 | END DO |
---|
101 | PRINT *, ' add_pbl_tend, dtime_frcg ', dtime_frcg |
---|
102 | PRINT *, ' add_pbl_tend, zzdt ', zzdt |
---|
103 | PRINT *, ' add_pbl_tend, zzdq ', zzdq |
---|
104 | CALL add_phys_tend(zdu, zdv, zzdt, zzdq, zdql, zdqi, zdqbs, paprs, text,abortphy,flag_inhib_tend, itap, 0 & |
---|
105 | #ifdef ISO |
---|
106 | ,zzdxt,zdxtl,zdxti & |
---|
107 | #endif |
---|
108 | ) |
---|
109 | ELSE |
---|
110 | CALL add_phys_tend(zdu, zdv, zdt, zdq, zdql, zdqi, zdqbs, paprs, text,abortphy,flag_inhib_tend, itap, 0 & |
---|
111 | #ifdef ISO |
---|
112 | ,zdxt,zdxtl,zdxti & |
---|
113 | #endif |
---|
114 | ) |
---|
115 | END IF |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | END SUBROUTINE add_pbl_tend |
---|
120 | |
---|
121 | ! $Id: add_phys_tend_mod.F90 5160 2024-08-03 12:56:58Z abarral $ |
---|
122 | |
---|
123 | SUBROUTINE add_phys_tend(zdu,zdv,zdt,zdq,zdql,zdqi,zdqbs,paprs,text, & |
---|
124 | abortphy,flag_inhib_tend, itap, diag_mode & |
---|
125 | #ifdef ISO |
---|
126 | ,zdxt,zdxtl,zdxti & |
---|
127 | #endif |
---|
128 | ) |
---|
129 | !====================================================================== |
---|
130 | ! Ajoute les tendances des variables physiques aux variables |
---|
131 | ! d'etat de la dynamique t_seri, q_seri ... |
---|
132 | ! On en profite pour faire des tests sur les tendances en question. |
---|
133 | !====================================================================== |
---|
134 | |
---|
135 | |
---|
136 | !====================================================================== |
---|
137 | ! Declarations |
---|
138 | !====================================================================== |
---|
139 | |
---|
140 | USE dimphy, ONLY: klon, klev |
---|
141 | USE phys_state_var_mod, ONLY: phys_tstep |
---|
142 | USE phys_local_var_mod, ONLY: u_seri, v_seri, ql_seri, qs_seri, qbs_seri, q_seri, t_seri |
---|
143 | #ifdef ISO |
---|
144 | USE phys_local_var_mod, ONLY: xtl_seri, xts_seri, xt_seri |
---|
145 | #endif |
---|
146 | USE phys_state_var_mod, ONLY: ftsol |
---|
147 | USE lmdz_geometry, ONLY: longitude_deg, latitude_deg |
---|
148 | USE lmdz_print_control, ONLY: prt_level |
---|
149 | USE cmp_seri_mod |
---|
150 | USE phys_output_var_mod, ONLY: d_qw_col, d_ql_col, d_qs_col, d_qbs_col, d_qt_col, d_ek_col, d_h_dair_col & |
---|
151 | , d_h_qw_col, d_h_ql_col, d_h_qs_col, d_h_qbs_col, d_h_col |
---|
152 | USE lmdz_clesphys |
---|
153 | |
---|
154 | #ifdef ISO |
---|
155 | USE infotrac_phy, ONLY: ntraciso=>ntiso |
---|
156 | #ifdef ISOVERIF |
---|
157 | USE isotopes_mod, ONLY: iso_eau |
---|
158 | USE isotopes_verif_mod |
---|
159 | #endif |
---|
160 | #endif |
---|
161 | |
---|
162 | USE lmdz_yomcst |
---|
163 | |
---|
164 | IMPLICIT NONE |
---|
165 | |
---|
166 | ! Arguments : |
---|
167 | !------------ |
---|
168 | REAL, DIMENSION(klon,klev), INTENT(IN) :: zdu, zdv |
---|
169 | REAL, DIMENSION(klon,klev), INTENT(IN) :: zdt, zdql, zdqi, zdqbs |
---|
170 | REAL, DIMENSION(klon,klev+1), INTENT(IN) :: paprs |
---|
171 | CHARACTER*(*), INTENT(IN) :: text |
---|
172 | INTEGER, INTENT(IN) :: abortphy |
---|
173 | INTEGER, INTENT(IN) :: flag_inhib_tend ! if not 0, tendencies are not added |
---|
174 | INTEGER, INTENT(IN) :: itap ! time step number |
---|
175 | INTEGER, INTENT(IN) :: diag_mode ! 0 -> normal effective mode |
---|
176 | ! 1 -> only conservation stats are computed |
---|
177 | |
---|
178 | REAL, DIMENSION(klon,klev), INTENT(INOUT) :: zdq |
---|
179 | #ifdef ISO |
---|
180 | REAL zdxt(ntraciso,klon,klev),zdxtl(ntraciso,klon,klev) & |
---|
181 | ,zdxti(ntraciso,klon,klev) |
---|
182 | INTEGER ixt |
---|
183 | #endif |
---|
184 | |
---|
185 | ! Local : |
---|
186 | !-------- |
---|
187 | REAL zt,zq |
---|
188 | #ifdef ISO |
---|
189 | REAL zxt(ntraciso) |
---|
190 | REAL qprec(klon,klev) |
---|
191 | REAL zxt_int(ntraciso), zxtp_int(ntraciso), zxtp(ntraciso,klev),zxt_new |
---|
192 | #endif |
---|
193 | REAL zq_int, zqp_int, zq_new |
---|
194 | |
---|
195 | REAL zqp(klev) |
---|
196 | |
---|
197 | ! Save variables, used in diagnostic mode (diag_mode=1). |
---|
198 | REAL, DIMENSION(klon,klev) :: sav_u_seri, sav_v_seri |
---|
199 | REAL, DIMENSION(klon,klev) :: sav_ql_seri, sav_qs_seri, sav_qbs_seri, sav_q_seri |
---|
200 | REAL, DIMENSION(klon,klev) :: sav_t_seri |
---|
201 | REAL, DIMENSION(klon,klev) :: sav_zdq |
---|
202 | #ifdef ISO |
---|
203 | REAL, DIMENSION(ntraciso,klon,klev) :: sav_zdxt |
---|
204 | REAL, DIMENSION(ntraciso,klon,klev) :: sav_xtl_seri, sav_xts_seri, sav_xt_seri |
---|
205 | #endif |
---|
206 | |
---|
207 | INTEGER i, k,j, n |
---|
208 | INTEGER jadrs(klon*klev), jbad |
---|
209 | INTEGER jqadrs(klon*klev), jqbad |
---|
210 | INTEGER kadrs(klon*klev) |
---|
211 | INTEGER kqadrs(klon*klev) |
---|
212 | |
---|
213 | LOGICAL done(klon) |
---|
214 | |
---|
215 | INTEGER debug_level |
---|
216 | logical, save :: first=.TRUE. |
---|
217 | !$OMP THREADPRIVATE(first) |
---|
218 | |
---|
219 | !====================================================================== |
---|
220 | ! Variables for energy conservation tests |
---|
221 | !====================================================================== |
---|
222 | |
---|
223 | ! zh_col------- total enthalpy of vertical air column |
---|
224 | ! (air with watter vapour, liquid and solid) (J/m2) |
---|
225 | ! zh_dair_col--- total enthalpy of dry air (J/m2) |
---|
226 | ! zh_qw_col---- total enthalpy of watter vapour (J/m2) |
---|
227 | ! zh_ql_col---- total enthalpy of liquid watter (J/m2) |
---|
228 | ! zh_qs_col---- total enthalpy of solid watter (J/m2) |
---|
229 | ! zh_qbs_col---- total enthalpy of blowing snow (J/m2) |
---|
230 | ! zqw_col------ total mass of watter vapour (kg/m2) |
---|
231 | ! zql_col------ total mass of liquid watter (kg/m2) |
---|
232 | ! zqs_col------ total mass of cloud ice (kg/m2) |
---|
233 | ! zqbs_col------ total mass of blowing snow (kg/m2) |
---|
234 | ! zek_col------ total kinetic energy (kg/m2) |
---|
235 | |
---|
236 | REAL zairm(klon, klev) ! layer air mass (kg/m2) |
---|
237 | REAL zqw_col(klon,2) |
---|
238 | REAL zql_col(klon,2) |
---|
239 | REAL zqs_col(klon,2) |
---|
240 | REAL zqbs_col(klon,2) |
---|
241 | REAL zek_col(klon,2) |
---|
242 | REAL zh_dair_col(klon,2) |
---|
243 | REAL zh_qw_col(klon,2), zh_ql_col(klon,2), zh_qs_col(klon,2), zh_qbs_col(klon,2) |
---|
244 | REAL zh_col(klon,2) |
---|
245 | |
---|
246 | REAL zcpvap, zcwat, zcice |
---|
247 | |
---|
248 | !====================================================================== |
---|
249 | ! Initialisations |
---|
250 | |
---|
251 | IF (prt_level >= 5) THEN |
---|
252 | write (*,*) "In add_phys_tend, after ",text |
---|
253 | CALL flush |
---|
254 | end if |
---|
255 | |
---|
256 | ! if flag_inhib_tend != 0, tendencies are not added |
---|
257 | IF (flag_inhib_tend /= 0) THEN |
---|
258 | ! If requiered, diagnostics are shown |
---|
259 | IF (flag_inhib_tend > 0) THEN |
---|
260 | ! print some diagnostics if xxx_seri have changed |
---|
261 | CALL cmp_seri(flag_inhib_tend,text) |
---|
262 | END IF |
---|
263 | RETURN ! on n ajoute pas les tendance |
---|
264 | END IF |
---|
265 | |
---|
266 | IF (abortphy==1) RETURN ! on n ajoute pas les tendance si le modele |
---|
267 | ! a deja plante. |
---|
268 | |
---|
269 | debug_level=10 |
---|
270 | IF (first) THEN |
---|
271 | PRINT *,"TestJLD rcpv, rcw, rcs",rcpv, rcw, rcs |
---|
272 | first=.FALSE. |
---|
273 | endif |
---|
274 | |
---|
275 | ! PRINT *,'add_phys_tend: paprs ',paprs |
---|
276 | ! When in diagnostic mode, save initial values of out variables |
---|
277 | IF (diag_mode == 1) THEN |
---|
278 | sav_u_seri(:,:) = u_seri(:,:) |
---|
279 | sav_v_seri(:,:) = v_seri(:,:) |
---|
280 | sav_ql_seri(:,:) = ql_seri(:,:) |
---|
281 | sav_qs_seri(:,:) = qs_seri(:,:) |
---|
282 | sav_qbs_seri(:,:) = qbs_seri(:,:) |
---|
283 | sav_q_seri(:,:) = q_seri(:,:) |
---|
284 | sav_t_seri(:,:) = t_seri(:,:) |
---|
285 | sav_zdq(:,:) = zdq(:,:) |
---|
286 | #ifdef ISO |
---|
287 | sav_zdxt(:,:,:) = zdxt(:,:,:) |
---|
288 | #endif |
---|
289 | ENDIF ! (diag_mode == 1) |
---|
290 | !====================================================================== |
---|
291 | ! Diagnostics for energy conservation tests |
---|
292 | !====================================================================== |
---|
293 | DO k = 1, klev |
---|
294 | ! layer air mass |
---|
295 | zairm(:, k) = (paprs(:,k)-paprs(:,k+1))/rg |
---|
296 | END DO |
---|
297 | |
---|
298 | IF (fl_ebil > 0) THEN |
---|
299 | ! ------------------------------------------------ |
---|
300 | ! Compute vertical sum for each atmospheric column |
---|
301 | ! ------------------------------------------------ |
---|
302 | n=1 ! begining of time step |
---|
303 | |
---|
304 | zcpvap = rcpv |
---|
305 | zcwat = rcw |
---|
306 | zcice = rcs |
---|
307 | |
---|
308 | CALL integr_v(klon, klev, zcpvap, & |
---|
309 | t_seri, q_seri, ql_seri, qs_seri, qbs_seri, u_seri, v_seri, zairm, & |
---|
310 | zqw_col(:,n), zql_col(:,n), zqs_col(:,n), zqbs_col(:,n), zek_col(:,n), zh_dair_col(:,n), & |
---|
311 | zh_qw_col(:,n), zh_ql_col(:,n), zh_qs_col(:,n), zh_qbs_col(:,n), zh_col(:,n)) |
---|
312 | |
---|
313 | end if ! end if (fl_ebil .GT. 0) |
---|
314 | |
---|
315 | !====================================================================== |
---|
316 | ! Ajout des tendances sur le vent et l'eau liquide |
---|
317 | !====================================================================== |
---|
318 | |
---|
319 | #ifdef ISO |
---|
320 | #ifdef ISOVERIF |
---|
321 | IF (iso_eau.gt.0) THEN |
---|
322 | CALL iso_verif_egalite_vect2D( & |
---|
323 | xt_seri,q_seri, & |
---|
324 | 'add_phys_tend 321a: '//text,ntraciso,klon,klev) |
---|
325 | CALL iso_verif_egalite_vect2D( & |
---|
326 | xtl_seri,ql_seri, & |
---|
327 | 'add_phys_tend 321b: '//text,ntraciso,klon,klev) |
---|
328 | endif !if (iso_eau.gt.0) THEN |
---|
329 | #ifdef ISOTRAC |
---|
330 | CALL iso_verif_traceur_vect(xt_seri,klon,klev, & |
---|
331 | 'add_phys_tend 328a: '//text) |
---|
332 | CALL iso_verif_traceur_vect(xtl_seri,klon,klev, & |
---|
333 | 'add_phys_tend 328b: '//text) |
---|
334 | #endif |
---|
335 | #endif |
---|
336 | #endif |
---|
337 | |
---|
338 | u_seri(:,:)=u_seri(:,:)+zdu(:,:) |
---|
339 | v_seri(:,:)=v_seri(:,:)+zdv(:,:) |
---|
340 | ql_seri(:,:)=ql_seri(:,:)+zdql(:,:) |
---|
341 | qs_seri(:,:)=qs_seri(:,:)+zdqi(:,:) |
---|
342 | qbs_seri(:,:)=qbs_seri(:,:)+zdqbs(:,:) |
---|
343 | #ifdef ISO |
---|
344 | xtl_seri(:,:,:)=xtl_seri(:,:,:)+zdxtl(:,:,:) |
---|
345 | xts_seri(:,:,:)=xts_seri(:,:,:)+zdxti(:,:,:) |
---|
346 | #endif |
---|
347 | |
---|
348 | !====================================================================== |
---|
349 | ! On ajoute les tendances de la temperature et de la vapeur d'eau |
---|
350 | ! en verifiant que ca ne part pas dans les choux |
---|
351 | !====================================================================== |
---|
352 | |
---|
353 | jbad=0 |
---|
354 | jqbad=0 |
---|
355 | DO k = 1, klev |
---|
356 | DO i = 1, klon |
---|
357 | zt=t_seri(i,k)+zdt(i,k) |
---|
358 | zq=q_seri(i,k)+zdq(i,k) |
---|
359 | #ifdef ISO |
---|
360 | DO ixt=1,ntraciso |
---|
361 | zxt(ixt)=xt_seri(ixt,i,k)+zdxt(ixt,i,k) |
---|
362 | enddo !do ixt=1,ntraciso |
---|
363 | qprec(i,k)=q_seri(i,k) |
---|
364 | #endif |
---|
365 | IF ( zt>370. .OR. zt<130. .OR. abs(zdt(i,k))>50. ) THEN |
---|
366 | jbad = jbad + 1 |
---|
367 | jadrs(jbad) = i |
---|
368 | kadrs(jbad) = k |
---|
369 | ENDIF |
---|
370 | IF ( zq<0. .OR. zq>0.1 .OR. abs(zdq(i,k))>1.e-2 ) THEN |
---|
371 | jqbad = jqbad + 1 |
---|
372 | jqadrs(jqbad) = i |
---|
373 | kqadrs(jqbad) = k |
---|
374 | ENDIF |
---|
375 | t_seri(i,k)=zt |
---|
376 | q_seri(i,k)=zq |
---|
377 | #ifdef ISO |
---|
378 | DO ixt=1,ntraciso |
---|
379 | xt_seri(ixt,i,k)=zxt(ixt) |
---|
380 | enddo !do ixt=1,ntraciso |
---|
381 | #endif |
---|
382 | ENDDO |
---|
383 | ENDDO |
---|
384 | |
---|
385 | #ifdef ISO |
---|
386 | #ifdef ISOVERIF |
---|
387 | IF (iso_eau.gt.0) THEN |
---|
388 | CALL iso_verif_egalite_vect2D( & |
---|
389 | xt_seri,q_seri, & |
---|
390 | 'add_phys_tend 122: '//text,ntraciso,klon,klev) |
---|
391 | CALL iso_verif_egalite_vect2D( & |
---|
392 | xtl_seri,ql_seri, & |
---|
393 | 'add_phys_tend 138: '//text,ntraciso,klon,klev) |
---|
394 | endif !if (iso_eau.gt.0) THEN |
---|
395 | #ifdef ISOTRAC |
---|
396 | CALL iso_verif_traceur_vect(xt_seri,klon,klev, & |
---|
397 | 'add_phys_tend 374a: '//text) |
---|
398 | CALL iso_verif_traceur_vect(xtl_seri,klon,klev, & |
---|
399 | 'add_phys_tend 374b: '//text) |
---|
400 | #endif |
---|
401 | #endif |
---|
402 | #endif |
---|
403 | |
---|
404 | |
---|
405 | !===================================================================================== |
---|
406 | ! Impression et stop en cas de probleme important |
---|
407 | !===================================================================================== |
---|
408 | |
---|
409 | IF (jbad > 0) THEN |
---|
410 | DO j = 1, jbad |
---|
411 | i=jadrs(j) |
---|
412 | IF(prt_level>=debug_level) THEN |
---|
413 | PRINT*,'PLANTAGE POUR LE POINT i lon lat =',& |
---|
414 | i,longitude_deg(i),latitude_deg(i),text |
---|
415 | PRINT*,'l T dT Q dQ ' |
---|
416 | DO k = 1, klev |
---|
417 | WRITE(*,'(i3,2f14.4,2e14.2)') k,t_seri(i,k),zdt(i,k),q_seri(i,k),zdq(i,k) |
---|
418 | ENDDO |
---|
419 | CALL print_debug_phys(i,debug_level,text) |
---|
420 | endif |
---|
421 | ENDDO |
---|
422 | ENDIF |
---|
423 | |
---|
424 | !===================================================================================== |
---|
425 | ! Impression, warning et correction en cas de probleme moins important |
---|
426 | !===================================================================================== |
---|
427 | IF (jqbad > 0) THEN |
---|
428 | done(:) = .FALSE. !jyg |
---|
429 | DO j = 1, jqbad |
---|
430 | i=jqadrs(j) |
---|
431 | IF(prt_level>=debug_level) THEN |
---|
432 | PRINT*,'WARNING : EAU POUR LE POINT i lon lat =',& |
---|
433 | i,longitude_deg(i),latitude_deg(i),text |
---|
434 | PRINT*,'l T dT Q dQ ' |
---|
435 | DO k = 1, klev |
---|
436 | WRITE(*,'(i3,2f14.4,2e14.2)') k,t_seri(i,k),zdt(i,k),q_seri(i,k),zdq(i,k) |
---|
437 | ENDDO |
---|
438 | endif |
---|
439 | IF (ok_conserv_q) THEN |
---|
440 | !jyg<20140228 Corrections pour conservation de l'eau |
---|
441 | IF (.NOT.done(i)) THEN !jyg |
---|
442 | DO k = 1, klev |
---|
443 | zqp(k) = max(q_seri(i,k),1.e-15) |
---|
444 | #ifdef ISO |
---|
445 | DO ixt=1,ntraciso |
---|
446 | zxtp(ixt,k)=xt_seri(ixt,i,k)*max(1.0,1.e-15/qprec(i,k)) |
---|
447 | enddo |
---|
448 | #endif |
---|
449 | ENDDO |
---|
450 | zq_int = 0. |
---|
451 | zqp_int = 0. |
---|
452 | DO k = 1, klev |
---|
453 | zq_int = zq_int + q_seri(i,k)*(paprs(i,k)-paprs(i,k+1))/Rg |
---|
454 | zqp_int = zqp_int + zqp(k) *(paprs(i,k)-paprs(i,k+1))/Rg |
---|
455 | ENDDO |
---|
456 | #ifdef ISO |
---|
457 | DO ixt=1,ntraciso |
---|
458 | zxt_int(ixt) = 0. |
---|
459 | zxtp_int(ixt) = 0. |
---|
460 | DO k = 1, klev |
---|
461 | zxt_int(ixt) = zxt_int(ixt) + xt_seri(ixt,i,k)*(paprs(i,k)-paprs(i,k+1))/Rg |
---|
462 | zxtp_int(ixt) = zxtp_int(ixt) + zxtp(ixt,k) *(paprs(i,k)-paprs(i,k+1))/Rg |
---|
463 | ENDDO |
---|
464 | enddo |
---|
465 | #endif |
---|
466 | IF(prt_level>=debug_level) THEN |
---|
467 | PRINT*,' cas q_seri<1.e-15 i k zq_int zqp_int zq_int/zqp_int :', & |
---|
468 | i, kqadrs(j), zq_int, zqp_int, zq_int/zqp_int |
---|
469 | endif |
---|
470 | DO k = 1, klev |
---|
471 | zq_new = zqp(k)*zq_int/zqp_int |
---|
472 | zdq(i,k) = zdq(i,k) + zq_new - q_seri(i,k) |
---|
473 | q_seri(i,k) = zq_new |
---|
474 | #ifdef ISO |
---|
475 | DO ixt=1,ntraciso |
---|
476 | zxt_new = zxtp(ixt,k)*zxt_int(ixt)/zxtp_int(ixt) |
---|
477 | zdxt(ixt,i,k) = zdxt(ixt,i,k) + zxt_new - xt_seri(ixt,i,k) |
---|
478 | xt_seri(ixt,i,k) = zxt_new |
---|
479 | enddo !ixt=1,ntraciso |
---|
480 | #endif |
---|
481 | ENDDO |
---|
482 | done(i) = .TRUE. |
---|
483 | ENDIF !(.NOT.done(i)) |
---|
484 | ELSE |
---|
485 | !jyg> |
---|
486 | DO k = 1, klev |
---|
487 | zq=q_seri(i,k)+zdq(i,k) |
---|
488 | IF (zq<1.e-15) THEN |
---|
489 | IF (q_seri(i,k)<1.e-15) THEN |
---|
490 | IF(prt_level>=debug_level) THEN |
---|
491 | PRINT*,' cas q_seri<1.e-15 i k q_seri zq zdq :',i,k,q_seri(i,k),zq,zdq(i,k) |
---|
492 | endif |
---|
493 | q_seri(i,k)=1.e-15 |
---|
494 | zdq(i,k)=(1.e-15-q_seri(i,k)) |
---|
495 | #ifdef ISO |
---|
496 | DO ixt=1,ntraciso |
---|
497 | xt_seri(ixt,i,k)=1.e-15*(xt_seri(ixt,i,k)/qprec(i,k)) |
---|
498 | ! xt_seri(ixt,i,k)=1.e-15*(Rdefault(index_iso(ixt))) |
---|
499 | ! zdxt(ixt,i,k)=0.0 |
---|
500 | zdxt(ixt,i,k)=xt_seri(ixt,i,k)*(1.e-15/qprec(i,k)-1) |
---|
501 | enddo !do ixt=1,ntraciso |
---|
502 | #endif |
---|
503 | endif |
---|
504 | endif |
---|
505 | ! zq=q_seri(i,k)+zdq(i,k) |
---|
506 | ! if (zq.lt.1.e-15) THEN |
---|
507 | ! zdq(i,k)=(1.e-15-q_seri(i,k)) |
---|
508 | ! endif |
---|
509 | ENDDO |
---|
510 | !jyg<20140228 |
---|
511 | ENDIF ! (ok_conserv_q) |
---|
512 | !jyg> |
---|
513 | ENDDO ! j = 1, jqbad |
---|
514 | ENDIF |
---|
515 | |
---|
516 | #ifdef ISO |
---|
517 | #ifdef ISOVERIF |
---|
518 | IF (iso_eau.gt.0) THEN |
---|
519 | CALL iso_verif_egalite_vect2D( & |
---|
520 | xt_seri,q_seri, & |
---|
521 | 'add_phys_tend 173'//text,ntraciso,klon,klev) |
---|
522 | CALL iso_verif_egalite_vect2D( & |
---|
523 | zdxt,zdq, & |
---|
524 | 'add_phys_tend 175'//text,ntraciso,klon,klev) |
---|
525 | endif !if (iso_eau.gt.0) THEN |
---|
526 | #ifdef ISOTRAC |
---|
527 | CALL iso_verif_traceur_vect(xt_seri,klon,klev, & |
---|
528 | 'add_phys_tend 499'//text) |
---|
529 | #endif |
---|
530 | #endif |
---|
531 | #endif |
---|
532 | |
---|
533 | !IM ajout memes tests pour reverifier les jbad, jqbad beg |
---|
534 | jbad=0 |
---|
535 | jqbad=0 |
---|
536 | DO k = 1, klev |
---|
537 | DO i = 1, klon |
---|
538 | IF ( t_seri(i,k)>370. .OR. t_seri(i,k)<130. .OR. abs(zdt(i,k))>50. ) THEN |
---|
539 | jbad = jbad + 1 |
---|
540 | jadrs(jbad) = i |
---|
541 | ! IF(prt_level.ge.debug_level) THEN |
---|
542 | ! PRINT*,'cas2 i k t_seri zdt',i,k,t_seri(i,k),zdt(i,k) |
---|
543 | ! endif |
---|
544 | ENDIF |
---|
545 | IF ( q_seri(i,k)<0. .OR. q_seri(i,k)>0.1 .OR. abs(zdq(i,k))>1.e-2 ) THEN |
---|
546 | jqbad = jqbad + 1 |
---|
547 | jqadrs(jqbad) = i |
---|
548 | kqadrs(jqbad) = k |
---|
549 | ! IF(prt_level.ge.debug_level) THEN |
---|
550 | ! PRINT*,'cas2 i k q_seri zdq',i,k,q_seri(i,k),zdq(i,k) |
---|
551 | ! endif |
---|
552 | ENDIF |
---|
553 | ENDDO |
---|
554 | ENDDO |
---|
555 | IF (jbad > 0) THEN |
---|
556 | DO j = 1, jbad |
---|
557 | i=jadrs(j) |
---|
558 | k=kadrs(j) |
---|
559 | IF(prt_level>=debug_level) THEN |
---|
560 | PRINT*,'PLANTAGE2 POUR LE POINT i itap lon lat txt jbad zdt t',& |
---|
561 | i,itap,longitude_deg(i),latitude_deg(i),text,jbad, & |
---|
562 | zdt(i,k),t_seri(i,k)-zdt(i,k) |
---|
563 | !!! IF(prt_level.ge.10.AND.itap.GE.229.AND.i.EQ.3027) THEN |
---|
564 | PRINT*,'l T dT Q dQ ' |
---|
565 | DO k = 1, klev |
---|
566 | WRITE(*,'(i3,2f14.4,2e14.2)') k,t_seri(i,k),zdt(i,k),q_seri(i,k),zdq(i,k) |
---|
567 | ENDDO |
---|
568 | CALL print_debug_phys(i,debug_level,text) |
---|
569 | endif |
---|
570 | ENDDO |
---|
571 | ENDIF |
---|
572 | |
---|
573 | IF (jqbad > 0) THEN |
---|
574 | DO j = 1, jqbad |
---|
575 | i=jqadrs(j) |
---|
576 | k=kqadrs(j) |
---|
577 | IF(prt_level>=debug_level) THEN |
---|
578 | PRINT*,'WARNING : EAU2 POUR LE POINT i itap lon lat txt jqbad zdq q zdql ql',& |
---|
579 | i,itap,longitude_deg(i),latitude_deg(i),text,jqbad,& |
---|
580 | zdq(i,k), q_seri(i,k)-zdq(i,k), zdql(i,k), ql_seri(i,k)-zdql(i,k) |
---|
581 | !!! IF(prt_level.ge.10.AND.itap.GE.229.AND.i.EQ.3027) THEN |
---|
582 | PRINT*,'l T dT Q dQ ' |
---|
583 | DO k = 1, klev |
---|
584 | WRITE(*,'(i3,2f14.4,2e14.2)') k,t_seri(i,k),zdt(i,k),q_seri(i,k),zdq(i,k) |
---|
585 | ENDDO |
---|
586 | CALL print_debug_phys(i,debug_level,text) |
---|
587 | endif |
---|
588 | ENDDO |
---|
589 | ENDIF |
---|
590 | |
---|
591 | !====================================================================== |
---|
592 | ! Contrôle des min/max pour arrêt du modèle |
---|
593 | ! Si le modele est en mode abortphy, on retire les tendances qu'on |
---|
594 | ! vient d'ajouter. Pas exactement parce qu'on ne tient pas compte des |
---|
595 | ! seuils. |
---|
596 | !====================================================================== |
---|
597 | |
---|
598 | CALL hgardfou(t_seri,ftsol,text,abortphy) |
---|
599 | IF (abortphy==1) THEN |
---|
600 | Print*,'ERROR ABORT hgardfou dans ',text |
---|
601 | ! JLD pourquoi on ne modifie pas de meme t_seri et q_seri ? |
---|
602 | u_seri(:,:)=u_seri(:,:)-zdu(:,:) |
---|
603 | v_seri(:,:)=v_seri(:,:)-zdv(:,:) |
---|
604 | ql_seri(:,:)=ql_seri(:,:)-zdql(:,:) |
---|
605 | qs_seri(:,:)=qs_seri(:,:)-zdqi(:,:) |
---|
606 | qbs_seri(:,:)=qbs_seri(:,:)-zdqbs(:,:) |
---|
607 | ENDIF |
---|
608 | |
---|
609 | !====================================================================== |
---|
610 | ! Diagnostics for energy conservation tests |
---|
611 | !====================================================================== |
---|
612 | |
---|
613 | IF (fl_ebil > 0) THEN |
---|
614 | ! ------------------------------------------------ |
---|
615 | ! Compute vertical sum for each atmospheric column |
---|
616 | ! ------------------------------------------------ |
---|
617 | n=2 ! end of time step |
---|
618 | |
---|
619 | CALL integr_v(klon, klev, zcpvap, & |
---|
620 | t_seri, q_seri, ql_seri, qs_seri, qbs_seri, u_seri, v_seri, zairm, & |
---|
621 | zqw_col(:,n), zql_col(:,n), zqs_col(:,n), zqbs_col(:,n), zek_col(:,n), zh_dair_col(:,n), & |
---|
622 | zh_qw_col(:,n), zh_ql_col(:,n), zh_qs_col(:,n), zh_qbs_col(:,n), zh_col(:,n)) |
---|
623 | |
---|
624 | ! ------------------------------------------------ |
---|
625 | ! Compute the changes by unit of time |
---|
626 | ! ------------------------------------------------ |
---|
627 | |
---|
628 | d_qw_col(:) = (zqw_col(:,2)-zqw_col(:,1))/phys_tstep |
---|
629 | d_ql_col(:) = (zql_col(:,2)-zql_col(:,1))/phys_tstep |
---|
630 | d_qs_col(:) = (zqs_col(:,2)-zqs_col(:,1))/phys_tstep |
---|
631 | d_qbs_col(:) = (zqbs_col(:,2)-zqbs_col(:,1))/phys_tstep |
---|
632 | d_qt_col(:) = d_qw_col(:) + d_ql_col(:) + d_qs_col(:) + d_qbs_col(:) |
---|
633 | |
---|
634 | d_ek_col(:) = (zek_col(:,2)-zek_col(:,1))/phys_tstep |
---|
635 | |
---|
636 | d_h_dair_col(:) = (zh_dair_col(:,2)-zh_dair_col(:,1))/phys_tstep |
---|
637 | d_h_qw_col(:) = (zh_qw_col(:,2)-zh_qw_col(:,1))/phys_tstep |
---|
638 | d_h_ql_col(:) = (zh_ql_col(:,2)-zh_ql_col(:,1))/phys_tstep |
---|
639 | d_h_qs_col(:) = (zh_qs_col(:,2)-zh_qs_col(:,1))/phys_tstep |
---|
640 | d_h_qbs_col(:) = (zh_qbs_col(:,2)-zh_qbs_col(:,1))/phys_tstep |
---|
641 | |
---|
642 | d_h_col = (zh_col(:,2)-zh_col(:,1))/phys_tstep |
---|
643 | |
---|
644 | end if ! end if (fl_ebil .GT. 0) |
---|
645 | |
---|
646 | ! When in diagnostic mode, restore "out" variables to initial values. |
---|
647 | IF (diag_mode == 1) THEN |
---|
648 | u_seri(:,:) = sav_u_seri(:,:) |
---|
649 | v_seri(:,:) = sav_v_seri(:,:) |
---|
650 | ql_seri(:,:) = sav_ql_seri(:,:) |
---|
651 | qs_seri(:,:) = sav_qs_seri(:,:) |
---|
652 | qbs_seri(:,:) = sav_qbs_seri(:,:) |
---|
653 | q_seri(:,:) = sav_q_seri(:,:) |
---|
654 | t_seri(:,:) = sav_t_seri(:,:) |
---|
655 | zdq(:,:) = sav_zdq(:,:) |
---|
656 | #ifdef ISO |
---|
657 | xtl_seri(:,:,:) = sav_xtl_seri(:,:,:) |
---|
658 | xts_seri(:,:,:) = sav_xts_seri(:,:,:) |
---|
659 | xt_seri(:,:,:) = sav_xt_seri(:,:,:) |
---|
660 | zdxt(:,:,:) = sav_zdxt(:,:,:) |
---|
661 | #endif |
---|
662 | ENDIF ! (mode == 1) |
---|
663 | |
---|
664 | |
---|
665 | END SUBROUTINE add_phys_tend |
---|
666 | |
---|
667 | SUBROUTINE diag_phys_tend(nlon, nlev, uu, vv, temp, qv, ql, qs, qbs, & |
---|
668 | zdu,zdv,zdt,zdq,zdql,zdqs,zdqbs,paprs,text) |
---|
669 | !====================================================================== |
---|
670 | ! Ajoute les tendances des variables physiques aux variables |
---|
671 | ! d'etat de la dynamique t_seri, q_seri ... |
---|
672 | ! On en profite pour faire des tests sur les tendances en question. |
---|
673 | !====================================================================== |
---|
674 | ! C Risi: on ne met pas les isos dedans car elle n'est jamais apelée. |
---|
675 | |
---|
676 | !====================================================================== |
---|
677 | ! Declarations |
---|
678 | !====================================================================== |
---|
679 | |
---|
680 | USE phys_state_var_mod, ONLY: phys_tstep, ftsol |
---|
681 | USE lmdz_geometry, ONLY: longitude_deg, latitude_deg |
---|
682 | USE lmdz_print_control, ONLY: prt_level |
---|
683 | USE cmp_seri_mod |
---|
684 | USE phys_output_var_mod, ONLY: d_qw_col, d_ql_col, d_qs_col, d_qbs_col, d_qt_col, d_ek_col, d_h_dair_col & |
---|
685 | , d_h_qw_col, d_h_ql_col, d_h_qs_col, d_h_qbs_col, d_h_col |
---|
686 | USE lmdz_clesphys |
---|
687 | USE lmdz_yomcst |
---|
688 | |
---|
689 | IMPLICIT NONE |
---|
690 | |
---|
691 | ! Arguments : |
---|
692 | !------------ |
---|
693 | INTEGER, INTENT(IN) :: nlon, nlev |
---|
694 | REAL, DIMENSION(nlon,nlev), INTENT(IN) :: uu, vv |
---|
695 | REAL, DIMENSION(nlon,nlev), INTENT(IN) :: temp, qv, ql, qs, qbs |
---|
696 | REAL, DIMENSION(nlon,nlev), INTENT(IN) :: zdu, zdv |
---|
697 | REAL, DIMENSION(nlon,nlev), INTENT(IN) :: zdt, zdq, zdql, zdqs, zdqbs |
---|
698 | REAL, DIMENSION(nlon,nlev+1), INTENT(IN) :: paprs |
---|
699 | CHARACTER*(*), INTENT(IN) :: text |
---|
700 | |
---|
701 | ! Local : |
---|
702 | !-------- |
---|
703 | REAL, DIMENSION(nlon,nlev) :: uu_n, vv_n |
---|
704 | REAL, DIMENSION(nlon,nlev) :: temp_n, qv_n, ql_n, qs_n, qbs_n |
---|
705 | |
---|
706 | INTEGER k, n |
---|
707 | |
---|
708 | INTEGER debug_level |
---|
709 | logical, save :: first=.TRUE. |
---|
710 | !$OMP THREADPRIVATE(first) |
---|
711 | |
---|
712 | !====================================================================== |
---|
713 | ! Variables for energy conservation tests |
---|
714 | !====================================================================== |
---|
715 | |
---|
716 | ! zh_col------- total enthalpy of vertical air column |
---|
717 | ! (air with watter vapour, liquid and solid) (J/m2) |
---|
718 | ! zh_dair_col--- total enthalpy of dry air (J/m2) |
---|
719 | ! zh_qw_col---- total enthalpy of watter vapour (J/m2) |
---|
720 | ! zh_ql_col---- total enthalpy of liquid watter (J/m2) |
---|
721 | ! zh_qs_col---- total enthalpy of solid watter (J/m2) |
---|
722 | ! zqw_col------ total mass of watter vapour (kg/m2) |
---|
723 | ! zql_col------ total mass of liquid watter (kg/m2) |
---|
724 | ! zqs_col------ total mass of cloud ice (kg/m2) |
---|
725 | ! zqbs_col------ total mass of blowing snow (kg/m2) |
---|
726 | ! zek_col------ total kinetic energy (kg/m2) |
---|
727 | |
---|
728 | REAL zairm(nlon, nlev) ! layer air mass (kg/m2) |
---|
729 | REAL zqw_col(nlon,2) |
---|
730 | REAL zql_col(nlon,2) |
---|
731 | REAL zqs_col(nlon,2) |
---|
732 | REAL zqbs_col(nlon,2) |
---|
733 | REAL zek_col(nlon,2) |
---|
734 | REAL zh_dair_col(nlon,2) |
---|
735 | REAL zh_qw_col(nlon,2), zh_ql_col(nlon,2), zh_qs_col(nlon,2), zh_qbs_col(nlon,2) |
---|
736 | REAL zh_col(nlon,2) |
---|
737 | |
---|
738 | !====================================================================== |
---|
739 | ! Initialisations |
---|
740 | |
---|
741 | IF (prt_level >= 5) THEN |
---|
742 | write (*,*) "In diag_phys_tend, after ",text |
---|
743 | CALL flush |
---|
744 | end if |
---|
745 | |
---|
746 | debug_level=10 |
---|
747 | IF (first) THEN |
---|
748 | PRINT *,"TestJLD rcpv, rcw, rcs",rcpv, rcw, rcs |
---|
749 | first=.FALSE. |
---|
750 | endif |
---|
751 | |
---|
752 | ! PRINT *,'add_phys_tend: paprs ',paprs |
---|
753 | !====================================================================== |
---|
754 | ! Diagnostics for energy conservation tests |
---|
755 | !====================================================================== |
---|
756 | DO k = 1, nlev |
---|
757 | ! layer air mass |
---|
758 | zairm(:, k) = (paprs(:,k)-paprs(:,k+1))/rg |
---|
759 | END DO |
---|
760 | |
---|
761 | IF (fl_ebil > 0) THEN |
---|
762 | ! ------------------------------------------------ |
---|
763 | ! Compute vertical sum for each atmospheric column |
---|
764 | ! ------------------------------------------------ |
---|
765 | n=1 ! begining of time step |
---|
766 | |
---|
767 | CALL integr_v(nlon, nlev, rcpv, & |
---|
768 | temp, qv, ql, qs, qbs, uu, vv, zairm, & |
---|
769 | zqw_col(:,n), zql_col(:,n), zqs_col(:,n), zqbs_col(:,n), zek_col(:,n), zh_dair_col(:,n), & |
---|
770 | zh_qw_col(:,n), zh_ql_col(:,n), zh_qs_col(:,n), zh_qbs_col(:,n), zh_col(:,n)) |
---|
771 | |
---|
772 | end if ! end if (fl_ebil .GT. 0) |
---|
773 | |
---|
774 | !====================================================================== |
---|
775 | ! Ajout des tendances sur le vent, la temperature et les diverses phases de l'eau |
---|
776 | !====================================================================== |
---|
777 | |
---|
778 | uu_n(:,:)=uu(:,:)+zdu(:,:) |
---|
779 | vv_n(:,:)=vv(:,:)+zdv(:,:) |
---|
780 | qv_n(:,:)=qv(:,:)+zdq(:,:) |
---|
781 | ql_n(:,:)=ql(:,:)+zdql(:,:) |
---|
782 | qs_n(:,:)=qs(:,:)+zdqs(:,:) |
---|
783 | qbs_n(:,:)=qbs(:,:)+zdqbs(:,:) |
---|
784 | temp_n(:,:)=temp(:,:)+zdt(:,:) |
---|
785 | |
---|
786 | |
---|
787 | |
---|
788 | !====================================================================== |
---|
789 | ! Diagnostics for energy conservation tests |
---|
790 | !====================================================================== |
---|
791 | |
---|
792 | IF (fl_ebil > 0) THEN |
---|
793 | ! ------------------------------------------------ |
---|
794 | ! Compute vertical sum for each atmospheric column |
---|
795 | ! ------------------------------------------------ |
---|
796 | n=2 ! end of time step |
---|
797 | |
---|
798 | CALL integr_v(nlon, nlev, rcpv, & |
---|
799 | temp_n, qv_n, ql_n, qs_n, qbs_n, uu_n, vv_n, zairm, & |
---|
800 | zqw_col(:,n), zql_col(:,n), zqs_col(:,n), zqbs_col(:,n), zek_col(:,n), zh_dair_col(:,n), & |
---|
801 | zh_qw_col(:,n), zh_ql_col(:,n), zh_qs_col(:,n), zh_qbs_col(:,n), zh_col(:,n)) |
---|
802 | |
---|
803 | ! ------------------------------------------------ |
---|
804 | ! Compute the changes by unit of time |
---|
805 | ! ------------------------------------------------ |
---|
806 | |
---|
807 | d_qw_col(:) = (zqw_col(:,2)-zqw_col(:,1))/phys_tstep |
---|
808 | d_ql_col(:) = (zql_col(:,2)-zql_col(:,1))/phys_tstep |
---|
809 | d_qs_col(:) = (zqs_col(:,2)-zqs_col(:,1))/phys_tstep |
---|
810 | d_qbs_col(:) = (zqbs_col(:,2)-zqbs_col(:,1))/phys_tstep |
---|
811 | d_qt_col(:) = d_qw_col(:) + d_ql_col(:) + d_qs_col(:) + d_qbs_col(:) |
---|
812 | |
---|
813 | d_ek_col(:) = (zek_col(:,2)-zek_col(:,1))/phys_tstep |
---|
814 | |
---|
815 | PRINT *,'zdu ', zdu |
---|
816 | PRINT *,'zdv ', zdv |
---|
817 | PRINT *,'d_ek_col, zek_col(2), zek_col(1) ',d_ek_col(1), zek_col(1,2), zek_col(1,1) |
---|
818 | |
---|
819 | d_h_dair_col(:) = (zh_dair_col(:,2)-zh_dair_col(:,1))/phys_tstep |
---|
820 | d_h_qw_col(:) = (zh_qw_col(:,2)-zh_qw_col(:,1))/phys_tstep |
---|
821 | d_h_ql_col(:) = (zh_ql_col(:,2)-zh_ql_col(:,1))/phys_tstep |
---|
822 | d_h_qs_col(:) = (zh_qs_col(:,2)-zh_qs_col(:,1))/phys_tstep |
---|
823 | d_h_qbs_col(:) = (zh_qbs_col(:,2)-zh_qbs_col(:,1))/phys_tstep |
---|
824 | |
---|
825 | d_h_col = (zh_col(:,2)-zh_col(:,1))/phys_tstep |
---|
826 | |
---|
827 | end if ! end if (fl_ebil .GT. 0) |
---|
828 | |
---|
829 | |
---|
830 | END SUBROUTINE diag_phys_tend |
---|
831 | |
---|
832 | SUBROUTINE integr_v(nlon, nlev, zcpvap, & |
---|
833 | temp, qv, ql, qs, qbs, uu, vv, zairm, & |
---|
834 | zqw_col, zql_col, zqs_col, zqbs_col, zek_col, zh_dair_col, & |
---|
835 | zh_qw_col, zh_ql_col, zh_qs_col, zh_qbs_col, zh_col) |
---|
836 | |
---|
837 | USE lmdz_yomcst |
---|
838 | IMPLICIT NONE |
---|
839 | |
---|
840 | INTEGER, INTENT(IN) :: nlon,nlev |
---|
841 | REAL, INTENT(IN) :: zcpvap |
---|
842 | REAL, DIMENSION(nlon,nlev), INTENT(IN) :: temp, qv, ql, qs, qbs, uu, vv |
---|
843 | REAL, DIMENSION(nlon,nlev), INTENT(IN) :: zairm |
---|
844 | REAL, DIMENSION(nlon), INTENT(OUT) :: zqw_col |
---|
845 | REAL, DIMENSION(nlon), INTENT(OUT) :: zql_col |
---|
846 | REAL, DIMENSION(nlon), INTENT(OUT) :: zqs_col, zqbs_col |
---|
847 | REAL, DIMENSION(nlon), INTENT(OUT) :: zek_col |
---|
848 | REAL, DIMENSION(nlon), INTENT(OUT) :: zh_dair_col |
---|
849 | REAL, DIMENSION(nlon), INTENT(OUT) :: zh_qw_col |
---|
850 | REAL, DIMENSION(nlon), INTENT(OUT) :: zh_ql_col |
---|
851 | REAL, DIMENSION(nlon), INTENT(OUT) :: zh_qs_col, zh_qbs_col |
---|
852 | REAL, DIMENSION(nlon), INTENT(OUT) :: zh_col |
---|
853 | |
---|
854 | INTEGER :: i, k |
---|
855 | |
---|
856 | |
---|
857 | ! Reset variables |
---|
858 | zqw_col(:) = 0. |
---|
859 | zql_col(:) = 0. |
---|
860 | zqs_col(:) = 0. |
---|
861 | zqbs_col(:) = 0. |
---|
862 | zek_col(:) = 0. |
---|
863 | zh_dair_col(:) = 0. |
---|
864 | zh_qw_col(:) = 0. |
---|
865 | zh_ql_col(:) = 0. |
---|
866 | zh_qs_col(:) = 0. |
---|
867 | zh_qbs_col(:) = 0. |
---|
868 | |
---|
869 | !JLD write (*,*) "rcpd, zcpvap, zcwat, zcice ",rcpd, zcpvap, zcwat, zcice |
---|
870 | |
---|
871 | ! ------------------------------------------------ |
---|
872 | ! Compute vertical sum for each atmospheric column |
---|
873 | ! ------------------------------------------------ |
---|
874 | DO k = 1, nlev |
---|
875 | DO i = 1, nlon |
---|
876 | ! Watter mass |
---|
877 | zqw_col(i) = zqw_col(i) + qv(i, k)*zairm(i, k) |
---|
878 | zql_col(i) = zql_col(i) + ql(i, k)*zairm(i, k) |
---|
879 | zqs_col(i) = zqs_col(i) + qs(i, k)*zairm(i, k) |
---|
880 | zqbs_col(i)= zqbs_col(i) + qbs(i,k)*zairm(i,k) |
---|
881 | ! Kinetic Energy |
---|
882 | zek_col(i) = zek_col(i) + 0.5*(uu(i,k)**2+vv(i,k)**2)*zairm(i, k) |
---|
883 | ! Air enthalpy : dry air, water vapour, liquid, solid |
---|
884 | zh_dair_col(i) = zh_dair_col(i) + rcpd*(1.-qv(i,k)-ql(i,k)-qs(i,k))* & |
---|
885 | zairm(i, k)*temp(i, k) |
---|
886 | zh_qw_col(i) = zh_qw_col(i) + zcpvap*temp(i, k) *qv(i, k)*zairm(i, k) !jyg |
---|
887 | zh_ql_col(i) = zh_ql_col(i) + (zcpvap*temp(i, k) - rlvtt)*ql(i, k)*zairm(i, k) !jyg |
---|
888 | zh_qs_col(i) = zh_qs_col(i) + (zcpvap*temp(i, k) - rlstt)*qs(i, k)*zairm(i, k) !jyg |
---|
889 | zh_qbs_col(i) = zh_qbs_col(i) + (zcpvap*temp(i, k) - rlstt)*qbs(i, k)*zairm(i, k) !jyg |
---|
890 | END DO |
---|
891 | END DO |
---|
892 | ! compute total air enthalpy |
---|
893 | zh_col(:) = zh_dair_col(:) + zh_qw_col(:) + zh_ql_col(:) + zh_qs_col(:) + zh_qbs_col(:) |
---|
894 | |
---|
895 | END SUBROUTINE integr_v |
---|
896 | |
---|
897 | SUBROUTINE prt_enerbil(text, itap) |
---|
898 | !====================================================================== |
---|
899 | ! Print enenrgy budget diagnotics for the 1D case |
---|
900 | !====================================================================== |
---|
901 | |
---|
902 | !====================================================================== |
---|
903 | ! Declarations |
---|
904 | !====================================================================== |
---|
905 | |
---|
906 | USE dimphy, ONLY: klon, klev |
---|
907 | USE phys_state_var_mod, ONLY: phys_tstep |
---|
908 | USE phys_state_var_mod, ONLY: topsw, toplw, solsw, sollw, rain_con, snow_con, bs_fall |
---|
909 | USE lmdz_geometry, ONLY: longitude_deg, latitude_deg |
---|
910 | USE lmdz_print_control, ONLY: prt_level |
---|
911 | USE cmp_seri_mod |
---|
912 | USE phys_output_var_mod, ONLY: d_qw_col, d_ql_col, d_qs_col, d_qbs_col, d_qt_col, d_ek_col, d_h_dair_col & |
---|
913 | , d_h_qw_col, d_h_ql_col, d_h_qs_col, d_h_qbs_col, d_h_col |
---|
914 | USE phys_local_var_mod, ONLY: evap, sens |
---|
915 | USE phys_local_var_mod, ONLY: u_seri, v_seri, ql_seri, qs_seri, qbs_seri, q_seri, t_seri & |
---|
916 | , rain_lsc, snow_lsc |
---|
917 | USE climb_hq_mod, ONLY: d_h_col_vdf, f_h_bnd |
---|
918 | USE lmdz_yomcst |
---|
919 | |
---|
920 | IMPLICIT NONE |
---|
921 | |
---|
922 | ! Arguments : |
---|
923 | !------------ |
---|
924 | CHARACTER*(*) text ! text specifing the involved parametrization |
---|
925 | INTEGER itap ! time step number |
---|
926 | ! local variables |
---|
927 | ! --------------- |
---|
928 | REAL bilq_seuil, bilh_seuil ! thresold on error in Q and H budget |
---|
929 | REAL bilq_error, bilh_error ! erros in Q and H budget |
---|
930 | REAL bilq_bnd, bilh_bnd ! Q and H budget due to exchange with boundaries |
---|
931 | INTEGER bilq_ok, bilh_ok |
---|
932 | CHARACTER*(12) status |
---|
933 | |
---|
934 | bilq_seuil = 1.E-10 |
---|
935 | bilh_seuil = 1.E-1 |
---|
936 | bilq_ok=0 |
---|
937 | bilh_ok=0 |
---|
938 | |
---|
939 | !!PRINT *,'prt_level:',prt_level,' fl_ebil:',fl_ebil,' fl_cor_ebil:',fl_cor_ebil |
---|
940 | IF ( (fl_ebil > 0) .AND. (klon == 1)) THEN |
---|
941 | bilq_bnd = 0. |
---|
942 | bilh_bnd = 0. |
---|
943 | |
---|
944 | param: SELECT CASE (text) |
---|
945 | CASE("vdf") param |
---|
946 | bilq_bnd = evap(1) |
---|
947 | bilh_bnd = sens(1)+(rcpv-rcpd)*evap(1)*t_seri(1,1) |
---|
948 | CASE("lsc") param |
---|
949 | bilq_bnd = - rain_lsc(1) - snow_lsc(1) |
---|
950 | bilh_bnd = (-(rcw-rcpd)*t_seri(1,1) + rlvtt) * rain_lsc(1) & |
---|
951 | + (-(rcs-rcpd)*t_seri(1,1) + rlstt) * snow_lsc(1) |
---|
952 | CASE("bsss") param |
---|
953 | bilq_bnd = - bs_fall(1) |
---|
954 | bilh_bnd = (-(rcs-rcpd)*t_seri(1,1) + rlstt) * bs_fall(1) |
---|
955 | CASE("convection") param |
---|
956 | bilq_bnd = - rain_con(1) - snow_con(1) |
---|
957 | bilh_bnd = (-(rcw-rcpd)*t_seri(1,1) + rlvtt) * rain_con(1) & |
---|
958 | + (-(rcs-rcpd)*t_seri(1,1) + rlstt) * snow_con(1) |
---|
959 | CASE("SW") param |
---|
960 | bilh_bnd = topsw(1) - solsw(1) |
---|
961 | CASE("LW") param |
---|
962 | bilh_bnd = -(toplw(1) + sollw(1)) |
---|
963 | CASE DEFAULT param |
---|
964 | bilq_bnd = 0. |
---|
965 | bilh_bnd = 0. |
---|
966 | END SELECT param |
---|
967 | |
---|
968 | bilq_error = d_qt_col(1) - bilq_bnd |
---|
969 | bilh_error = d_h_col(1) - bilh_bnd |
---|
970 | ! are the errors too large? |
---|
971 | IF ( abs(bilq_error) > bilq_seuil) bilq_ok=1 |
---|
972 | IF ( abs(bilh_error) > bilh_seuil) bilh_ok=1 |
---|
973 | |
---|
974 | ! Print diagnostics |
---|
975 | ! ================= |
---|
976 | IF ( (bilq_ok == 0).AND.(bilh_ok == 0) ) THEN |
---|
977 | status="enerbil-OK" |
---|
978 | else |
---|
979 | status="enerbil-PB" |
---|
980 | end if |
---|
981 | |
---|
982 | IF ( prt_level >= 3) THEN |
---|
983 | WRITE(*,9010) text,status," itap:",itap,"enerbilERROR: Q", bilq_error," H", bilh_error |
---|
984 | 9010 format (1x,A8,2x,A12,A6,I4,A18,E15.6,A5,E15.6) |
---|
985 | end if |
---|
986 | IF ( prt_level >= 3) THEN |
---|
987 | WRITE(*,9000) text,"enerbil: Q,H,KE budget", d_qt_col(1), d_h_col(1),d_ek_col(1) |
---|
988 | end if |
---|
989 | IF ( prt_level >= 5) THEN |
---|
990 | WRITE(*,9000) text,"enerbil at boundaries: Q, H",bilq_bnd, bilh_bnd |
---|
991 | WRITE(*,9000) text,"enerbil: water budget",d_qt_col(1),d_qw_col(1),d_ql_col(1),d_qs_col(1), d_qbs_col(1) |
---|
992 | 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),d_h_qbs_col(1) |
---|
993 | end if |
---|
994 | |
---|
995 | specific_diag: SELECT CASE (text) |
---|
996 | CASE("vdf") specific_diag |
---|
997 | IF ( prt_level >= 5) THEN |
---|
998 | WRITE(*,9000) text,"enerbil: d_h, bilh, sens,t_seri", d_h_col(1), bilh_bnd, sens(1), t_seri(1,1) |
---|
999 | WRITE(*,9000) text,"enerbil: d_h_col_vdf, f_h, diff",d_h_col_vdf, f_h_bnd, bilh_bnd-sens(1) |
---|
1000 | end if |
---|
1001 | CASE("lsc") specific_diag |
---|
1002 | IF ( prt_level >= 5) THEN |
---|
1003 | 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) |
---|
1004 | 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) |
---|
1005 | end if |
---|
1006 | CASE("convection") specific_diag |
---|
1007 | IF ( prt_level >= 5) THEN |
---|
1008 | WRITE(*,9000) text,"enerbil: rain, bil_lat, bil_sens", rain_con(1), rlvtt * rain_con(1), -(rcw-rcpd)*t_seri(1,1) * rain_con(1) |
---|
1009 | WRITE(*,9000) text,"enerbil: snow, bil_lat, bil_sens", snow_con(1), rlstt * snow_con(1), -(rcs-rcpd)*t_seri(1,1) * snow_con(1) |
---|
1010 | end if |
---|
1011 | END SELECT specific_diag |
---|
1012 | |
---|
1013 | 9000 format (1x,A8,2x,A35,10E15.6) |
---|
1014 | |
---|
1015 | end if ! end if (fl_ebil .GT. 0) |
---|
1016 | |
---|
1017 | END SUBROUTINE prt_enerbil |
---|
1018 | |
---|
1019 | END MODULE add_phys_tend_mod |
---|