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