1 | SUBROUTINE ener_conserv(klon,klev,pdtphys, & |
---|
2 | puo,pvo,pto,qx,ivap,iliq,isol, & |
---|
3 | pun,pvn,ptn,pqn,pqln,pqsn,dtke,masse,exner,d_t_ec) |
---|
4 | |
---|
5 | !============================================================= |
---|
6 | ! Energy conservation |
---|
7 | ! Based on the TKE equation |
---|
8 | ! The M2 and N2 terms at the origin of TKE production are |
---|
9 | ! concerted into heating in the d_t_ec term |
---|
10 | ! Option 1 is the standard |
---|
11 | ! 101 is for M2 term only |
---|
12 | ! 101 for N2 term only |
---|
13 | ! -1 is a previours treatment for kinetic energy only |
---|
14 | ! FH (hourdin@lmd.jussieu.fr), 2013/04/25 |
---|
15 | !============================================================= |
---|
16 | |
---|
17 | !============================================================= |
---|
18 | ! Declarations |
---|
19 | !============================================================= |
---|
20 | |
---|
21 | ! From module |
---|
22 | USE phys_local_var_mod, ONLY: d_u_vdf,d_v_vdf,d_t_vdf,d_u_ajs,d_v_ajs,d_t_ajs, & |
---|
23 | d_u_con,d_v_con,d_t_con,d_t_diss |
---|
24 | USE phys_local_var_mod, ONLY: d_t_eva,d_t_lsc,d_q_eva,d_q_lsc |
---|
25 | USE phys_local_var_mod, ONLY: d_u_oro,d_v_oro,d_u_lif,d_v_lif |
---|
26 | USE phys_local_var_mod, ONLY: du_gwd_hines,dv_gwd_hines,dv_gwd_front,dv_gwd_rando |
---|
27 | USE phys_state_var_mod, ONLY: du_gwd_front,du_gwd_rando |
---|
28 | USE phys_output_var_mod, ONLY: bils_ec,bils_ech,bils_tke,bils_kinetic,bils_enthalp,bils_latent,bils_diss |
---|
29 | USE add_phys_tend_mod, ONLY: fl_cor_ebil |
---|
30 | USE infotrac_phy, ONLY: nqtot |
---|
31 | USE lmdz_abort_physic, ONLY: abort_physic |
---|
32 | |
---|
33 | IMPLICIT none |
---|
34 | INCLUDE "YOMCST.h" |
---|
35 | INCLUDE "YOETHF.h" |
---|
36 | INCLUDE "clesphys.h" |
---|
37 | INCLUDE "compbl.h" |
---|
38 | |
---|
39 | ! Arguments |
---|
40 | INTEGER, INTENT(IN) :: klon,klev |
---|
41 | REAL, INTENT(IN) :: pdtphys |
---|
42 | REAL, DIMENSION(klon,klev), INTENT(IN) :: puo,pvo,pto |
---|
43 | REAL, DIMENSION(klon,klev,nqtot), INTENT(IN):: qx |
---|
44 | INTEGER, INTENT(IN) :: ivap, iliq, isol |
---|
45 | REAL, DIMENSION(klon,klev), INTENT(IN) :: pun,pvn,ptn,pqn,pqln,pqsn |
---|
46 | REAL, DIMENSION(klon,klev), INTENT(IN) :: masse,exner |
---|
47 | REAL, DIMENSION(klon,klev+1), INTENT(IN) :: dtke |
---|
48 | |
---|
49 | REAL, DIMENSION(klon,klev), INTENT(OUT) :: d_t_ec |
---|
50 | |
---|
51 | ! Local |
---|
52 | INTEGER k,i |
---|
53 | REAL, DIMENSION(klon,klev+1) :: fluxu,fluxv,fluxt |
---|
54 | REAL, DIMENSION(klon,klev+1) :: dddu,dddv,dddt |
---|
55 | REAL, DIMENSION(klon,klev) :: d_u,d_v,d_t,zv,zu,d_t_ech, pqo, pql0, pqs0 |
---|
56 | REAL ZRCPD |
---|
57 | |
---|
58 | character*80 abort_message |
---|
59 | character*20 :: modname |
---|
60 | |
---|
61 | |
---|
62 | modname='ener_conser' |
---|
63 | d_t_ec(:,:)=0. |
---|
64 | |
---|
65 | IF(ivap == 0) CALL abort_physic (modname,'can''t run without water vapour',1) |
---|
66 | IF(iliq == 0) CALL abort_physic (modname,'can''t run without liquid water',1) |
---|
67 | pqo = qx(:,:,ivap) |
---|
68 | pql0 = qx(:,:,iliq) |
---|
69 | IF(isol /= 0) pqs0 = qx(:,:,isol) |
---|
70 | |
---|
71 | IF (iflag_ener_conserv==-1) THEN |
---|
72 | !+jld ec_conser |
---|
73 | DO k = 1, klev |
---|
74 | DO i = 1, klon |
---|
75 | IF (fl_cor_ebil > 0) THEN |
---|
76 | ZRCPD = RCPD*(1.0+RVTMP2*(pqn(i,k)+pqln(i,k)+pqsn(i,k))) |
---|
77 | ELSE |
---|
78 | ZRCPD = RCPD*(1.0+RVTMP2*pqn(i,k)) |
---|
79 | ENDIF |
---|
80 | d_t_ec(i,k)=0.5/ZRCPD & |
---|
81 | *(puo(i,k)**2+pvo(i,k)**2-pun(i,k)**2-pvn(i,k)**2) |
---|
82 | ENDDO |
---|
83 | ENDDO |
---|
84 | !-jld ec_conser |
---|
85 | |
---|
86 | |
---|
87 | |
---|
88 | ELSEIF (iflag_ener_conserv>=1) THEN |
---|
89 | |
---|
90 | IF (iflag_ener_conserv<=2) THEN |
---|
91 | ! PRINT*,'ener_conserv pbl=',iflag_pbl |
---|
92 | IF (iflag_pbl>=20 .AND. iflag_pbl<=27) THEN !d_t_diss accounts for conserv |
---|
93 | d_t(:,:)=d_t_ajs(:,:) ! d_t_ajs = adjust + thermals |
---|
94 | d_u(:,:)=d_u_ajs(:,:)+d_u_con(:,:) |
---|
95 | d_v(:,:)=d_v_ajs(:,:)+d_v_con(:,:) |
---|
96 | ELSE |
---|
97 | d_t(:,:)=d_t_vdf(:,:)+d_t_ajs(:,:) ! d_t_ajs = adjust + thermals |
---|
98 | d_u(:,:)=d_u_vdf(:,:)+d_u_ajs(:,:)+d_u_con(:,:) |
---|
99 | d_v(:,:)=d_v_vdf(:,:)+d_v_ajs(:,:)+d_v_con(:,:) |
---|
100 | ENDIF |
---|
101 | ELSEIF (iflag_ener_conserv==101) THEN |
---|
102 | d_t(:,:)=0. |
---|
103 | d_u(:,:)=d_u_vdf(:,:)+d_u_ajs(:,:)+d_u_con(:,:) |
---|
104 | d_v(:,:)=d_v_vdf(:,:)+d_v_ajs(:,:)+d_v_con(:,:) |
---|
105 | ELSEIF (iflag_ener_conserv==110) THEN |
---|
106 | d_t(:,:)=d_t_vdf(:,:)+d_t_ajs(:,:) |
---|
107 | d_u(:,:)=0. |
---|
108 | d_v(:,:)=0. |
---|
109 | |
---|
110 | ELSEIF (iflag_ener_conserv==3) THEN |
---|
111 | d_t(:,:)=0. |
---|
112 | d_u(:,:)=0. |
---|
113 | d_v(:,:)=0. |
---|
114 | ELSEIF (iflag_ener_conserv==4) THEN |
---|
115 | d_t(:,:)=0. |
---|
116 | d_u(:,:)=d_u_vdf(:,:) |
---|
117 | d_v(:,:)=d_v_vdf(:,:) |
---|
118 | ELSEIF (iflag_ener_conserv==5) THEN |
---|
119 | d_t(:,:)=d_t_vdf(:,:) |
---|
120 | d_u(:,:)=d_u_vdf(:,:) |
---|
121 | d_v(:,:)=d_v_vdf(:,:) |
---|
122 | ELSEIF (iflag_ener_conserv==6) THEN |
---|
123 | d_t(:,:)=d_t_vdf(:,:) |
---|
124 | d_u(:,:)=d_u_vdf(:,:)+d_u_ajs(:,:) |
---|
125 | d_v(:,:)=d_v_vdf(:,:)+d_v_ajs(:,:) |
---|
126 | ELSEIF (iflag_ener_conserv==7) THEN |
---|
127 | d_t(:,:)=d_t_vdf(:,:)+d_t_ajs(:,:) |
---|
128 | d_u(:,:)=d_u_vdf(:,:)+d_u_ajs(:,:) |
---|
129 | d_v(:,:)=d_v_vdf(:,:)+d_v_ajs(:,:) |
---|
130 | ELSEIF (iflag_ener_conserv==8) THEN |
---|
131 | d_t(:,:)=d_t_vdf(:,:) |
---|
132 | d_u(:,:)=d_u_vdf(:,:)+d_u_ajs(:,:)+d_u_con(:,:) |
---|
133 | d_v(:,:)=d_v_vdf(:,:)+d_v_ajs(:,:)+d_v_con(:,:) |
---|
134 | ELSEIF (iflag_ener_conserv==9) THEN |
---|
135 | d_t(:,:)=d_t_vdf(:,:) |
---|
136 | d_u(:,:)=d_u_vdf(:,:)+d_u_ajs(:,:)+d_u_con(:,:)+d_u_oro(:,:) |
---|
137 | d_v(:,:)=d_v_vdf(:,:)+d_v_ajs(:,:)+d_v_con(:,:)+d_v_oro(:,:) |
---|
138 | ELSEIF (iflag_ener_conserv==10) THEN |
---|
139 | d_t(:,:)=d_t_vdf(:,:) |
---|
140 | d_u(:,:)=d_u_vdf(:,:)+d_u_ajs(:,:)+d_u_con(:,:)+d_u_oro(:,:)+d_u_lif(:,:) |
---|
141 | d_v(:,:)=d_v_vdf(:,:)+d_v_ajs(:,:)+d_v_con(:,:)+d_v_oro(:,:)+d_v_lif(:,:) |
---|
142 | ELSEIF (iflag_ener_conserv==11) THEN |
---|
143 | d_t(:,:)=d_t_vdf(:,:) |
---|
144 | d_u(:,:)=d_u_vdf(:,:)+d_u_ajs(:,:)+d_u_con(:,:)+d_u_oro(:,:)+d_u_lif(:,:) |
---|
145 | d_v(:,:)=d_v_vdf(:,:)+d_v_ajs(:,:)+d_v_con(:,:)+d_v_oro(:,:)+d_v_lif(:,:) |
---|
146 | IF (ok_hines) THEN |
---|
147 | d_u_vdf(:,:)=d_u_vdf(:,:)+du_gwd_hines(:,:) |
---|
148 | d_v_vdf(:,:)=d_v_vdf(:,:)+dv_gwd_hines(:,:) |
---|
149 | ENDIF |
---|
150 | IF (.NOT. ok_hines .AND. ok_gwd_rando) THEN |
---|
151 | d_u_vdf(:,:)=d_u_vdf(:,:)+du_gwd_front(:,:) |
---|
152 | d_v_vdf(:,:)=d_v_vdf(:,:)+dv_gwd_front(:,:) |
---|
153 | ENDIF |
---|
154 | IF (ok_gwd_rando) THEN |
---|
155 | d_u_vdf(:,:)=d_u_vdf(:,:)+du_gwd_rando(:,:) |
---|
156 | d_v_vdf(:,:)=d_v_vdf(:,:)+dv_gwd_rando(:,:) |
---|
157 | ENDIF |
---|
158 | ELSE |
---|
159 | abort_message = 'iflag_ener_conserv non prevu' |
---|
160 | CALL abort_physic (modname,abort_message,1) |
---|
161 | ENDIF |
---|
162 | |
---|
163 | !---------------------------------------------------------------------------- |
---|
164 | ! Two options wether we consider time integration in the energy conservation |
---|
165 | !---------------------------------------------------------------------------- |
---|
166 | |
---|
167 | IF (iflag_ener_conserv==2) THEN |
---|
168 | zu(:,:)=puo(:,:) |
---|
169 | zv(:,:)=pvo(:,:) |
---|
170 | else |
---|
171 | IF (iflag_pbl>=20 .AND. iflag_pbl<=27) THEN |
---|
172 | zu(:,:)=puo(:,:)+d_u_vdf(:,:)+0.5*d_u(:,:) |
---|
173 | zv(:,:)=pvo(:,:)+d_v_vdf(:,:)+0.5*d_v(:,:) |
---|
174 | ELSE |
---|
175 | zu(:,:)=puo(:,:)+0.5*d_u(:,:) |
---|
176 | zv(:,:)=pvo(:,:)+0.5*d_v(:,:) |
---|
177 | ENDIF |
---|
178 | endif |
---|
179 | |
---|
180 | fluxu(:,klev+1)=0. |
---|
181 | fluxv(:,klev+1)=0. |
---|
182 | fluxt(:,klev+1)=0. |
---|
183 | |
---|
184 | do k=klev,1,-1 |
---|
185 | fluxu(:,k)=fluxu(:,k+1)+masse(:,k)*d_u(:,k) |
---|
186 | fluxv(:,k)=fluxv(:,k+1)+masse(:,k)*d_v(:,k) |
---|
187 | fluxt(:,k)=fluxt(:,k+1)+masse(:,k)*d_t(:,k)/exner(:,k) |
---|
188 | enddo |
---|
189 | |
---|
190 | dddu(:,1)=2*zu(:,1)*fluxu(:,1) |
---|
191 | dddv(:,1)=2*zv(:,1)*fluxv(:,1) |
---|
192 | dddt(:,1)=(exner(:,1)-1.)*fluxt(:,1) |
---|
193 | |
---|
194 | do k=2,klev |
---|
195 | dddu(:,k)=(zu(:,k)-zu(:,k-1))*fluxu(:,k) |
---|
196 | dddv(:,k)=(zv(:,k)-zv(:,k-1))*fluxv(:,k) |
---|
197 | dddt(:,k)=(exner(:,k)-exner(:,k-1))*fluxt(:,k) |
---|
198 | enddo |
---|
199 | dddu(:,klev+1)=0. |
---|
200 | dddv(:,klev+1)=0. |
---|
201 | dddt(:,klev+1)=0. |
---|
202 | |
---|
203 | do k=1,klev |
---|
204 | d_t_ech(:,k)=-(rcpd*(dddt(:,k)+dddt(:,k+1)))/(2.*rcpd*masse(:,k)) |
---|
205 | d_t_ec(:,k)=-(dddu(:,k)+dddu(:,k+1)+dddv(:,k)+dddv(:,k+1))/(2.*rcpd*masse(:,k))+d_t_ech(:,k) |
---|
206 | enddo |
---|
207 | |
---|
208 | ENDIF |
---|
209 | |
---|
210 | !================================================================ |
---|
211 | ! Computation of integrated enthalpie and kinetic energy variation |
---|
212 | ! FH (hourdin@lmd.jussieu.fr), 2013/04/25 |
---|
213 | ! bils_ec : energie conservation term |
---|
214 | ! bils_ech : part of this term linked to temperature |
---|
215 | ! bils_tke : change of TKE |
---|
216 | ! bils_diss : dissipation of TKE (when activated) |
---|
217 | ! bils_kinetic : change of kinetic energie of the column |
---|
218 | ! bils_enthalp : change of enthalpie |
---|
219 | ! bils_latent : change of latent heat. Computed between |
---|
220 | ! after reevaporation (at the beginning of the physics) |
---|
221 | ! and before large scale condensation (fisrtilp) |
---|
222 | !================================================================ |
---|
223 | |
---|
224 | bils_ec(:)=0. |
---|
225 | bils_ech(:)=0. |
---|
226 | bils_tke(:)=0. |
---|
227 | bils_diss(:)=0. |
---|
228 | bils_kinetic(:)=0. |
---|
229 | bils_enthalp(:)=0. |
---|
230 | bils_latent(:)=0. |
---|
231 | DO k=1,klev |
---|
232 | bils_ec(:)=bils_ec(:)-d_t_ec(:,k)*masse(:,k) |
---|
233 | bils_diss(:)=bils_diss(:)-d_t_diss(:,k)*masse(:,k) |
---|
234 | bils_kinetic(:)=bils_kinetic(:)+masse(:,k)* & |
---|
235 | (pun(:,k)*pun(:,k)+pvn(:,k)*pvn(:,k) & |
---|
236 | -puo(:,k)*puo(:,k)-pvo(:,k)*pvo(:,k)) |
---|
237 | bils_enthalp(:)= & |
---|
238 | bils_enthalp(:)+masse(:,k)*(ptn(:,k)-pto(:,k)+d_t_ec(:,k)-d_t_eva(:,k)-d_t_lsc(:,k)) |
---|
239 | ! & bils_enthalp(:)+masse(:,k)*(ptn(:,k)-pto(:,k)+d_t_ec(:,k)) |
---|
240 | bils_latent(:)=bils_latent(:)+masse(:,k)* & |
---|
241 | ! & (pqn(:,k)-pqo(:,k)) |
---|
242 | (pqn(:,k)-pqo(:,k)-d_q_eva(:,k)-d_q_lsc(:,k)) |
---|
243 | ENDDO |
---|
244 | bils_ec(:)=rcpd*bils_ec(:)/pdtphys |
---|
245 | bils_diss(:)=rcpd*bils_diss(:)/pdtphys |
---|
246 | bils_kinetic(:)= 0.5*bils_kinetic(:)/pdtphys |
---|
247 | bils_enthalp(:)=rcpd*bils_enthalp(:)/pdtphys |
---|
248 | bils_latent(:)=rlvtt*bils_latent(:)/pdtphys |
---|
249 | !jyg< |
---|
250 | IF (iflag_pbl > 1) THEN |
---|
251 | DO k=1,klev |
---|
252 | bils_tke(:)=bils_tke(:)+0.5*(dtke(:,k)+dtke(:,k+1))*masse(:,k) |
---|
253 | ENDDO |
---|
254 | bils_tke(:)=bils_tke(:)/pdtphys |
---|
255 | ENDIF ! (iflag_pbl > 1) |
---|
256 | !>jyg |
---|
257 | |
---|
258 | IF (iflag_ener_conserv>=1) THEN |
---|
259 | bils_ech(:)=0. |
---|
260 | DO k=1,klev |
---|
261 | bils_ech(:)=bils_ech(:)-d_t_ech(:,k)*masse(:,k) |
---|
262 | ENDDO |
---|
263 | bils_ech(:)=rcpd*bils_ech(:)/pdtphys |
---|
264 | ENDIF |
---|
265 | |
---|
266 | RETURN |
---|
267 | |
---|
268 | END |
---|