1 | |
---|
2 | ! $Id: add_phys_tend_mod.F90 5103 2024-07-23 13:29:36Z 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 mod_grid_phy_lmdz, 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 | ! COMMON /turb_forcing/dtime_frcg, hthturb_gcssold, hqturb_gcssold, & |
---|
54 | ! turb_fcg_gcssold |
---|
55 | #ifdef ISO |
---|
56 | REAL,SAVE,ALLOCATABLE :: hxtturb_gcssold(:,:) |
---|
57 | !$OMP THREADPRIVATE(hxtturb_gcssold) |
---|
58 | ! variable à définir dans le 1D |
---|
59 | #endif |
---|
60 | |
---|
61 | ! Arguments : |
---|
62 | ! ------------ |
---|
63 | REAL zdu(klon, klev), zdv(klon, klev) |
---|
64 | REAL zdt(klon, klev), zdq(klon, klev), zdql(klon, klev), zdqi(klon, klev), zdqbs(klon,klev) |
---|
65 | CHARACTER *(*) text |
---|
66 | REAL paprs(klon,klev+1) |
---|
67 | INTEGER flag_inhib_tend ! if flag_inhib_tend != 0, tendencies are not added |
---|
68 | INTEGER itap ! time step number |
---|
69 | #ifdef ISO |
---|
70 | REAL zdxt(ntraciso,klon, klev), zdxtl(ntraciso,klon, klev), zdxti(ntraciso,klon, klev) |
---|
71 | #endif |
---|
72 | |
---|
73 | ! Local : |
---|
74 | ! -------- |
---|
75 | REAL zzdt(klon, klev), zzdq(klon, klev) |
---|
76 | INTEGER i, k |
---|
77 | #ifdef ISO |
---|
78 | REAL zzdxt(ntraciso,klon, klev) |
---|
79 | INTEGER ixt |
---|
80 | #endif |
---|
81 | |
---|
82 | IF (firstcall) THEN |
---|
83 | ALLOCATE(hthturb_gcssold(nbp_lev)) |
---|
84 | ALLOCATE(hqturb_gcssold(nbp_lev)) |
---|
85 | #ifdef ISO |
---|
86 | ALLOCATE(hxtturb_gcssold(ntraciso,nbp_lev)) |
---|
87 | #endif |
---|
88 | firstcall=.FALSE. |
---|
89 | ENDIF |
---|
90 | |
---|
91 | IF (turb_fcg_gcssold) THEN |
---|
92 | DO k = 1, klev |
---|
93 | DO i = 1, klon |
---|
94 | zzdt(i, k) = hthturb_gcssold(k)*dtime_frcg |
---|
95 | zzdq(i, k) = hqturb_gcssold(k)*dtime_frcg |
---|
96 | #ifdef ISO |
---|
97 | do ixt=1,ntraciso |
---|
98 | zzdxt(ixt,i, k) = hxtturb_gcssold(ixt,k)*dtime_frcg |
---|
99 | enddo |
---|
100 | #endif |
---|
101 | END DO |
---|
102 | END DO |
---|
103 | PRINT *, ' add_pbl_tend, dtime_frcg ', dtime_frcg |
---|
104 | PRINT *, ' add_pbl_tend, zzdt ', zzdt |
---|
105 | PRINT *, ' add_pbl_tend, zzdq ', zzdq |
---|
106 | CALL add_phys_tend(zdu, zdv, zzdt, zzdq, zdql, zdqi, zdqbs, paprs, text,abortphy,flag_inhib_tend, itap, 0 & |
---|
107 | #ifdef ISO |
---|
108 | ,zzdxt,zdxtl,zdxti & |
---|
109 | #endif |
---|
110 | ) |
---|
111 | ELSE |
---|
112 | CALL add_phys_tend(zdu, zdv, zdt, zdq, zdql, zdqi, zdqbs, paprs, text,abortphy,flag_inhib_tend, itap, 0 & |
---|
113 | #ifdef ISO |
---|
114 | ,zdxt,zdxtl,zdxti & |
---|
115 | #endif |
---|
116 | ) |
---|
117 | END IF |
---|
118 | |
---|
119 | |
---|
120 | RETURN |
---|
121 | END SUBROUTINE add_pbl_tend |
---|
122 | |
---|
123 | ! $Id: add_phys_tend_mod.F90 5103 2024-07-23 13:29:36Z abarral $ |
---|
124 | |
---|
125 | SUBROUTINE add_phys_tend (zdu,zdv,zdt,zdq,zdql,zdqi,zdqbs,paprs,text, & |
---|
126 | abortphy,flag_inhib_tend, itap, diag_mode & |
---|
127 | #ifdef ISO |
---|
128 | ,zdxt,zdxtl,zdxti & |
---|
129 | #endif |
---|
130 | ) |
---|
131 | !====================================================================== |
---|
132 | ! Ajoute les tendances des variables physiques aux variables |
---|
133 | ! d'etat de la dynamique t_seri, q_seri ... |
---|
134 | ! On en profite pour faire des tests sur les tendances en question. |
---|
135 | !====================================================================== |
---|
136 | |
---|
137 | |
---|
138 | !====================================================================== |
---|
139 | ! Declarations |
---|
140 | !====================================================================== |
---|
141 | |
---|
142 | USE dimphy, ONLY: klon, klev |
---|
143 | USE phys_state_var_mod, ONLY: phys_tstep |
---|
144 | USE phys_local_var_mod, ONLY: u_seri, v_seri, ql_seri, qs_seri, qbs_seri, q_seri, t_seri |
---|
145 | #ifdef ISO |
---|
146 | USE phys_local_var_mod, ONLY: xtl_seri, xts_seri, xt_seri |
---|
147 | #endif |
---|
148 | USE phys_state_var_mod, ONLY: ftsol |
---|
149 | USE geometry_mod, ONLY: longitude_deg, latitude_deg |
---|
150 | USE print_control_mod, ONLY: prt_level |
---|
151 | USE cmp_seri_mod |
---|
152 | 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 & |
---|
153 | , d_h_qw_col, d_h_ql_col, d_h_qs_col, d_h_qbs_col, d_h_col |
---|
154 | |
---|
155 | #ifdef ISO |
---|
156 | USE infotrac_phy, ONLY: ntraciso=>ntiso |
---|
157 | #ifdef ISOVERIF |
---|
158 | USE isotopes_mod, ONLY: iso_eau |
---|
159 | USE isotopes_verif_mod |
---|
160 | #endif |
---|
161 | #endif |
---|
162 | IMPLICIT none |
---|
163 | include "YOMCST.h" |
---|
164 | include "clesphys.h" |
---|
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 | ! ------------------------------------------------ |
---|
616 | ! Compute vertical sum for each atmospheric column |
---|
617 | ! ------------------------------------------------ |
---|
618 | n=2 ! end of time step |
---|
619 | |
---|
620 | CALL integr_v(klon, klev, zcpvap, & |
---|
621 | t_seri, q_seri, ql_seri, qs_seri, qbs_seri, u_seri, v_seri, zairm, & |
---|
622 | zqw_col(:,n), zql_col(:,n), zqs_col(:,n), zqbs_col(:,n), zek_col(:,n), zh_dair_col(:,n), & |
---|
623 | zh_qw_col(:,n), zh_ql_col(:,n), zh_qs_col(:,n), zh_qbs_col(:,n), zh_col(:,n)) |
---|
624 | |
---|
625 | ! ------------------------------------------------ |
---|
626 | ! Compute the changes by unit of time |
---|
627 | ! ------------------------------------------------ |
---|
628 | |
---|
629 | d_qw_col(:) = (zqw_col(:,2)-zqw_col(:,1))/phys_tstep |
---|
630 | d_ql_col(:) = (zql_col(:,2)-zql_col(:,1))/phys_tstep |
---|
631 | d_qs_col(:) = (zqs_col(:,2)-zqs_col(:,1))/phys_tstep |
---|
632 | d_qbs_col(:) = (zqbs_col(:,2)-zqbs_col(:,1))/phys_tstep |
---|
633 | d_qt_col(:) = d_qw_col(:) + d_ql_col(:) + d_qs_col(:) + d_qbs_col(:) |
---|
634 | |
---|
635 | d_ek_col(:) = (zek_col(:,2)-zek_col(:,1))/phys_tstep |
---|
636 | |
---|
637 | d_h_dair_col(:) = (zh_dair_col(:,2)-zh_dair_col(:,1))/phys_tstep |
---|
638 | d_h_qw_col(:) = (zh_qw_col(:,2)-zh_qw_col(:,1))/phys_tstep |
---|
639 | d_h_ql_col(:) = (zh_ql_col(:,2)-zh_ql_col(:,1))/phys_tstep |
---|
640 | d_h_qs_col(:) = (zh_qs_col(:,2)-zh_qs_col(:,1))/phys_tstep |
---|
641 | d_h_qbs_col(:) = (zh_qbs_col(:,2)-zh_qbs_col(:,1))/phys_tstep |
---|
642 | |
---|
643 | d_h_col = (zh_col(:,2)-zh_col(:,1))/phys_tstep |
---|
644 | |
---|
645 | end if ! end if (fl_ebil .GT. 0) |
---|
646 | |
---|
647 | ! When in diagnostic mode, restore "out" variables to initial values. |
---|
648 | IF (diag_mode == 1) THEN |
---|
649 | u_seri(:,:) = sav_u_seri(:,:) |
---|
650 | v_seri(:,:) = sav_v_seri(:,:) |
---|
651 | ql_seri(:,:) = sav_ql_seri(:,:) |
---|
652 | qs_seri(:,:) = sav_qs_seri(:,:) |
---|
653 | qbs_seri(:,:) = sav_qbs_seri(:,:) |
---|
654 | q_seri(:,:) = sav_q_seri(:,:) |
---|
655 | t_seri(:,:) = sav_t_seri(:,:) |
---|
656 | zdq(:,:) = sav_zdq(:,:) |
---|
657 | #ifdef ISO |
---|
658 | xtl_seri(:,:,:) = sav_xtl_seri(:,:,:) |
---|
659 | xts_seri(:,:,:) = sav_xts_seri(:,:,:) |
---|
660 | xt_seri(:,:,:) = sav_xt_seri(:,:,:) |
---|
661 | zdxt(:,:,:) = sav_zdxt(:,:,:) |
---|
662 | #endif |
---|
663 | ENDIF ! (mode == 1) |
---|
664 | |
---|
665 | RETURN |
---|
666 | END SUBROUTINE add_phys_tend |
---|
667 | |
---|
668 | SUBROUTINE diag_phys_tend (nlon, nlev, uu, vv, temp, qv, ql, qs, qbs, & |
---|
669 | zdu,zdv,zdt,zdq,zdql,zdqs,zdqbs,paprs,text) |
---|
670 | !====================================================================== |
---|
671 | ! Ajoute les tendances des variables physiques aux variables |
---|
672 | ! d'etat de la dynamique t_seri, q_seri ... |
---|
673 | ! On en profite pour faire des tests sur les tendances en question. |
---|
674 | !====================================================================== |
---|
675 | ! C Risi: on ne met pas les isos dedans car elle n'est jamais apelée. |
---|
676 | |
---|
677 | !====================================================================== |
---|
678 | ! Declarations |
---|
679 | !====================================================================== |
---|
680 | |
---|
681 | USE phys_state_var_mod, ONLY: phys_tstep, ftsol |
---|
682 | USE geometry_mod, ONLY: longitude_deg, latitude_deg |
---|
683 | USE print_control_mod, ONLY: prt_level |
---|
684 | USE cmp_seri_mod |
---|
685 | 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 & |
---|
686 | , d_h_qw_col, d_h_ql_col, d_h_qs_col, d_h_qbs_col, d_h_col |
---|
687 | IMPLICIT none |
---|
688 | include "YOMCST.h" |
---|
689 | include "clesphys.h" |
---|
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 | ! ------------------------------------------------ |
---|
795 | ! Compute vertical sum for each atmospheric column |
---|
796 | ! ------------------------------------------------ |
---|
797 | n=2 ! end of time step |
---|
798 | |
---|
799 | CALL integr_v(nlon, nlev, rcpv, & |
---|
800 | temp_n, qv_n, ql_n, qs_n, qbs_n, uu_n, vv_n, zairm, & |
---|
801 | zqw_col(:,n), zql_col(:,n), zqs_col(:,n), zqbs_col(:,n), zek_col(:,n), zh_dair_col(:,n), & |
---|
802 | zh_qw_col(:,n), zh_ql_col(:,n), zh_qs_col(:,n), zh_qbs_col(:,n), zh_col(:,n)) |
---|
803 | |
---|
804 | ! ------------------------------------------------ |
---|
805 | ! Compute the changes by unit of time |
---|
806 | ! ------------------------------------------------ |
---|
807 | |
---|
808 | d_qw_col(:) = (zqw_col(:,2)-zqw_col(:,1))/phys_tstep |
---|
809 | d_ql_col(:) = (zql_col(:,2)-zql_col(:,1))/phys_tstep |
---|
810 | d_qs_col(:) = (zqs_col(:,2)-zqs_col(:,1))/phys_tstep |
---|
811 | d_qbs_col(:) = (zqbs_col(:,2)-zqbs_col(:,1))/phys_tstep |
---|
812 | d_qt_col(:) = d_qw_col(:) + d_ql_col(:) + d_qs_col(:) + d_qbs_col(:) |
---|
813 | |
---|
814 | d_ek_col(:) = (zek_col(:,2)-zek_col(:,1))/phys_tstep |
---|
815 | |
---|
816 | print *,'zdu ', zdu |
---|
817 | print *,'zdv ', zdv |
---|
818 | print *,'d_ek_col, zek_col(2), zek_col(1) ',d_ek_col(1), zek_col(1,2), zek_col(1,1) |
---|
819 | |
---|
820 | d_h_dair_col(:) = (zh_dair_col(:,2)-zh_dair_col(:,1))/phys_tstep |
---|
821 | d_h_qw_col(:) = (zh_qw_col(:,2)-zh_qw_col(:,1))/phys_tstep |
---|
822 | d_h_ql_col(:) = (zh_ql_col(:,2)-zh_ql_col(:,1))/phys_tstep |
---|
823 | d_h_qs_col(:) = (zh_qs_col(:,2)-zh_qs_col(:,1))/phys_tstep |
---|
824 | d_h_qbs_col(:) = (zh_qbs_col(:,2)-zh_qbs_col(:,1))/phys_tstep |
---|
825 | |
---|
826 | d_h_col = (zh_col(:,2)-zh_col(:,1))/phys_tstep |
---|
827 | |
---|
828 | end if ! end if (fl_ebil .GT. 0) |
---|
829 | |
---|
830 | RETURN |
---|
831 | END SUBROUTINE diag_phys_tend |
---|
832 | |
---|
833 | SUBROUTINE integr_v(nlon, nlev, zcpvap, & |
---|
834 | temp, qv, ql, qs, qbs, uu, vv, zairm, & |
---|
835 | zqw_col, zql_col, zqs_col, zqbs_col, zek_col, zh_dair_col, & |
---|
836 | zh_qw_col, zh_ql_col, zh_qs_col, zh_qbs_col, zh_col) |
---|
837 | |
---|
838 | IMPLICIT none |
---|
839 | include "YOMCST.h" |
---|
840 | |
---|
841 | INTEGER, INTENT(IN) :: nlon,nlev |
---|
842 | REAL, INTENT(IN) :: zcpvap |
---|
843 | REAL, DIMENSION(nlon,nlev), INTENT(IN) :: temp, qv, ql, qs, qbs, uu, vv |
---|
844 | REAL, DIMENSION(nlon,nlev), INTENT(IN) :: zairm |
---|
845 | REAL, DIMENSION(nlon), INTENT(OUT) :: zqw_col |
---|
846 | REAL, DIMENSION(nlon), INTENT(OUT) :: zql_col |
---|
847 | REAL, DIMENSION(nlon), INTENT(OUT) :: zqs_col, zqbs_col |
---|
848 | REAL, DIMENSION(nlon), INTENT(OUT) :: zek_col |
---|
849 | REAL, DIMENSION(nlon), INTENT(OUT) :: zh_dair_col |
---|
850 | REAL, DIMENSION(nlon), INTENT(OUT) :: zh_qw_col |
---|
851 | REAL, DIMENSION(nlon), INTENT(OUT) :: zh_ql_col |
---|
852 | REAL, DIMENSION(nlon), INTENT(OUT) :: zh_qs_col, zh_qbs_col |
---|
853 | REAL, DIMENSION(nlon), INTENT(OUT) :: zh_col |
---|
854 | |
---|
855 | INTEGER :: i, k |
---|
856 | |
---|
857 | |
---|
858 | ! Reset variables |
---|
859 | zqw_col(:) = 0. |
---|
860 | zql_col(:) = 0. |
---|
861 | zqs_col(:) = 0. |
---|
862 | zqbs_col(:) = 0. |
---|
863 | zek_col(:) = 0. |
---|
864 | zh_dair_col(:) = 0. |
---|
865 | zh_qw_col(:) = 0. |
---|
866 | zh_ql_col(:) = 0. |
---|
867 | zh_qs_col(:) = 0. |
---|
868 | zh_qbs_col(:) = 0. |
---|
869 | |
---|
870 | !JLD write (*,*) "rcpd, zcpvap, zcwat, zcice ",rcpd, zcpvap, zcwat, zcice |
---|
871 | |
---|
872 | ! ------------------------------------------------ |
---|
873 | ! Compute vertical sum for each atmospheric column |
---|
874 | ! ------------------------------------------------ |
---|
875 | DO k = 1, nlev |
---|
876 | DO i = 1, nlon |
---|
877 | ! Watter mass |
---|
878 | zqw_col(i) = zqw_col(i) + qv(i, k)*zairm(i, k) |
---|
879 | zql_col(i) = zql_col(i) + ql(i, k)*zairm(i, k) |
---|
880 | zqs_col(i) = zqs_col(i) + qs(i, k)*zairm(i, k) |
---|
881 | zqbs_col(i)= zqbs_col(i) + qbs(i,k)*zairm(i,k) |
---|
882 | ! Kinetic Energy |
---|
883 | zek_col(i) = zek_col(i) + 0.5*(uu(i,k)**2+vv(i,k)**2)*zairm(i, k) |
---|
884 | ! Air enthalpy : dry air, water vapour, liquid, solid |
---|
885 | zh_dair_col(i) = zh_dair_col(i) + rcpd*(1.-qv(i,k)-ql(i,k)-qs(i,k))* & |
---|
886 | zairm(i, k)*temp(i, k) |
---|
887 | zh_qw_col(i) = zh_qw_col(i) + zcpvap*temp(i, k) *qv(i, k)*zairm(i, k) !jyg |
---|
888 | zh_ql_col(i) = zh_ql_col(i) + (zcpvap*temp(i, k) - rlvtt)*ql(i, k)*zairm(i, k) !jyg |
---|
889 | zh_qs_col(i) = zh_qs_col(i) + (zcpvap*temp(i, k) - rlstt)*qs(i, k)*zairm(i, k) !jyg |
---|
890 | zh_qbs_col(i) = zh_qbs_col(i) + (zcpvap*temp(i, k) - rlstt)*qbs(i, k)*zairm(i, k) !jyg |
---|
891 | END DO |
---|
892 | END DO |
---|
893 | ! compute total air enthalpy |
---|
894 | zh_col(:) = zh_dair_col(:) + zh_qw_col(:) + zh_ql_col(:) + zh_qs_col(:) + zh_qbs_col(:) |
---|
895 | |
---|
896 | END SUBROUTINE integr_v |
---|
897 | |
---|
898 | SUBROUTINE prt_enerbil (text, itap) |
---|
899 | !====================================================================== |
---|
900 | ! Print enenrgy budget diagnotics for the 1D case |
---|
901 | !====================================================================== |
---|
902 | |
---|
903 | !====================================================================== |
---|
904 | ! Declarations |
---|
905 | !====================================================================== |
---|
906 | |
---|
907 | USE dimphy, ONLY: klon, klev |
---|
908 | USE phys_state_var_mod, ONLY: phys_tstep |
---|
909 | USE phys_state_var_mod, ONLY: topsw, toplw, solsw, sollw, rain_con, snow_con, bs_fall |
---|
910 | USE geometry_mod, ONLY: longitude_deg, latitude_deg |
---|
911 | USE print_control_mod, ONLY: prt_level |
---|
912 | USE cmp_seri_mod |
---|
913 | 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 & |
---|
914 | , d_h_qw_col, d_h_ql_col, d_h_qs_col, d_h_qbs_col, d_h_col |
---|
915 | USE phys_local_var_mod, ONLY: evap, sens |
---|
916 | USE phys_local_var_mod, ONLY: u_seri, v_seri, ql_seri, qs_seri, qbs_seri, q_seri, t_seri & |
---|
917 | , rain_lsc, snow_lsc |
---|
918 | USE climb_hq_mod, ONLY: d_h_col_vdf, f_h_bnd |
---|
919 | IMPLICIT none |
---|
920 | include "YOMCST.h" |
---|
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 | |
---|
942 | bilq_bnd = 0. |
---|
943 | bilh_bnd = 0. |
---|
944 | |
---|
945 | param: SELECT CASE (text) |
---|
946 | CASE("vdf") param |
---|
947 | bilq_bnd = evap(1) |
---|
948 | bilh_bnd = sens(1)+(rcpv-rcpd)*evap(1)*t_seri(1,1) |
---|
949 | CASE("lsc") param |
---|
950 | bilq_bnd = - rain_lsc(1) - snow_lsc(1) |
---|
951 | bilh_bnd = (-(rcw-rcpd)*t_seri(1,1) + rlvtt) * rain_lsc(1) & |
---|
952 | + (-(rcs-rcpd)*t_seri(1,1) + rlstt) * snow_lsc(1) |
---|
953 | CASE("bsss") param |
---|
954 | bilq_bnd = - bs_fall(1) |
---|
955 | bilh_bnd = (-(rcs-rcpd)*t_seri(1,1) + rlstt) * bs_fall(1) |
---|
956 | CASE("convection") param |
---|
957 | bilq_bnd = - rain_con(1) - snow_con(1) |
---|
958 | bilh_bnd = (-(rcw-rcpd)*t_seri(1,1) + rlvtt) * rain_con(1) & |
---|
959 | + (-(rcs-rcpd)*t_seri(1,1) + rlstt) * snow_con(1) |
---|
960 | CASE("SW") param |
---|
961 | bilh_bnd = topsw(1) - solsw(1) |
---|
962 | CASE("LW") param |
---|
963 | bilh_bnd = -(toplw(1) + sollw(1)) |
---|
964 | CASE DEFAULT param |
---|
965 | bilq_bnd = 0. |
---|
966 | bilh_bnd = 0. |
---|
967 | END SELECT param |
---|
968 | |
---|
969 | bilq_error = d_qt_col(1) - bilq_bnd |
---|
970 | bilh_error = d_h_col(1) - bilh_bnd |
---|
971 | ! are the errors too large? |
---|
972 | if ( abs(bilq_error) > bilq_seuil) bilq_ok=1 |
---|
973 | if ( abs(bilh_error) > bilh_seuil) bilh_ok=1 |
---|
974 | |
---|
975 | ! Print diagnostics |
---|
976 | ! ================= |
---|
977 | if ( (bilq_ok == 0).and.(bilh_ok == 0) ) then |
---|
978 | status="enerbil-OK" |
---|
979 | else |
---|
980 | status="enerbil-PB" |
---|
981 | end if |
---|
982 | |
---|
983 | if ( prt_level >= 3) then |
---|
984 | write(*,9010) text,status," itap:",itap,"enerbilERROR: Q", bilq_error," H", bilh_error |
---|
985 | 9010 format (1x,A8,2x,A12,A6,I4,A18,E15.6,A5,E15.6) |
---|
986 | end if |
---|
987 | if ( prt_level >= 3) then |
---|
988 | write(*,9000) text,"enerbil: Q,H,KE budget", d_qt_col(1), d_h_col(1),d_ek_col(1) |
---|
989 | end if |
---|
990 | if ( prt_level >= 5) then |
---|
991 | write(*,9000) text,"enerbil at boundaries: Q, H",bilq_bnd, bilh_bnd |
---|
992 | 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) |
---|
993 | 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) |
---|
994 | end if |
---|
995 | |
---|
996 | specific_diag: SELECT CASE (text) |
---|
997 | CASE("vdf") specific_diag |
---|
998 | if ( prt_level >= 5) then |
---|
999 | write(*,9000) text,"enerbil: d_h, bilh, sens,t_seri", d_h_col(1), bilh_bnd, sens(1), t_seri(1,1) |
---|
1000 | write(*,9000) text,"enerbil: d_h_col_vdf, f_h, diff",d_h_col_vdf, f_h_bnd, bilh_bnd-sens(1) |
---|
1001 | end if |
---|
1002 | CASE("lsc") specific_diag |
---|
1003 | if ( prt_level >= 5) then |
---|
1004 | 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) |
---|
1005 | 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) |
---|
1006 | end if |
---|
1007 | CASE("convection") specific_diag |
---|
1008 | if ( prt_level >= 5) then |
---|
1009 | 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) |
---|
1010 | 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) |
---|
1011 | end if |
---|
1012 | END SELECT specific_diag |
---|
1013 | |
---|
1014 | 9000 format (1x,A8,2x,A35,10E15.6) |
---|
1015 | |
---|
1016 | end if ! end if (fl_ebil .GT. 0) |
---|
1017 | |
---|
1018 | END SUBROUTINE prt_enerbil |
---|
1019 | |
---|
1020 | END MODULE add_phys_tend_mod |
---|