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