[1754] | 1 | subroutine ener_conserv(klon,klev,pdtphys, & |
---|
[1761] | 2 | & puo,pvo,pto,pqo,pun,pvn,ptn,pqn,dtke,masse,exner,d_t_ec) |
---|
[1754] | 3 | |
---|
| 4 | !============================================================= |
---|
| 5 | ! Energy conservation |
---|
| 6 | ! Based on the TKE equation |
---|
| 7 | ! The M2 and N2 terms at the origin of TKE production are |
---|
| 8 | ! concerted into heating in the d_t_ec term |
---|
| 9 | ! Option 1 is the standard |
---|
| 10 | ! 101 is for M2 term only |
---|
| 11 | ! 101 for N2 term only |
---|
| 12 | ! -1 is a previours treatment for kinetic energy only |
---|
| 13 | ! FH (hourdin@lmd.jussieu.fr), 2013/04/25 |
---|
| 14 | !============================================================= |
---|
| 15 | |
---|
| 16 | !============================================================= |
---|
| 17 | ! Declarations |
---|
| 18 | !============================================================= |
---|
| 19 | |
---|
| 20 | ! From module |
---|
[1761] | 21 | USE phys_local_var_mod, ONLY : d_u_vdf,d_v_vdf,d_t_vdf,d_u_ajs,d_v_ajs,d_t_ajs,d_u_con,d_v_con,d_t_con,d_t_diss |
---|
| 22 | USE phys_output_var_mod, ONLY : bils_ec,bils_tke,bils_kinetic,bils_enthalp,bils_latent,bils_diss |
---|
[1754] | 23 | |
---|
| 24 | IMPLICIT none |
---|
| 25 | #include "YOMCST.h" |
---|
| 26 | #include "YOETHF.h" |
---|
| 27 | #include "clesphys.h" |
---|
[1761] | 28 | #include "compbl.h" |
---|
[1754] | 29 | |
---|
| 30 | ! Arguments |
---|
| 31 | INTEGER, INTENT(IN) :: klon,klev |
---|
| 32 | REAL, INTENT(IN) :: pdtphys |
---|
| 33 | REAL, DIMENSION(klon,klev),INTENT(IN) :: puo,pvo,pto,pqo |
---|
| 34 | REAL, DIMENSION(klon,klev),INTENT(IN) :: pun,pvn,ptn,pqn |
---|
| 35 | REAL, DIMENSION(klon,klev),INTENT(IN) :: masse,exner |
---|
[1761] | 36 | REAL, DIMENSION(klon,klev+1),INTENT(IN) :: dtke |
---|
[1754] | 37 | REAL, DIMENSION(klon,klev),INTENT(OUT) :: d_t_ec |
---|
| 38 | integer k,i |
---|
| 39 | |
---|
| 40 | ! Local |
---|
| 41 | REAL, DIMENSION(klon,klev+1) :: fluxu,fluxv,fluxt |
---|
| 42 | REAL, DIMENSION(klon,klev+1) :: dddu,dddv,dddt |
---|
| 43 | REAL, DIMENSION(klon,klev) :: d_u,d_v,d_t,zv,zu |
---|
| 44 | REAL ZRCPD |
---|
| 45 | |
---|
| 46 | character*80 abort_message |
---|
| 47 | character*20 :: modname |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | modname='ener_conser' |
---|
| 51 | d_t_ec(:,:)=0. |
---|
| 52 | |
---|
| 53 | IF (iflag_ener_conserv==-1) THEN |
---|
| 54 | !+jld ec_conser |
---|
| 55 | DO k = 1, klev |
---|
| 56 | DO i = 1, klon |
---|
| 57 | ZRCPD = RCPD*(1.0+RVTMP2*pqn(i,k)) |
---|
| 58 | d_t_ec(i,k)=0.5/ZRCPD & |
---|
| 59 | & *(puo(i,k)**2+pvo(i,k)**2-pun(i,k)**2-pvn(i,k)**2) |
---|
| 60 | ENDDO |
---|
| 61 | ENDDO |
---|
| 62 | !-jld ec_conser |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | ELSEIF (iflag_ener_conserv>=1) THEN |
---|
| 67 | |
---|
| 68 | IF (iflag_ener_conserv<=2) THEN |
---|
[1761] | 69 | ! print*,'ener_conserv pbl=',iflag_pbl |
---|
| 70 | IF (iflag_pbl>=20 .AND. iflag_pbl<=27) THEN !d_t_diss accounts for conserv |
---|
| 71 | d_t(:,:)=d_t_ajs(:,:) ! d_t_ajs = adjust + thermals |
---|
| 72 | d_u(:,:)=d_u_ajs(:,:)+d_u_con(:,:) |
---|
| 73 | d_v(:,:)=d_v_ajs(:,:)+d_v_con(:,:) |
---|
| 74 | ELSE |
---|
| 75 | d_t(:,:)=d_t_vdf(:,:)+d_t_ajs(:,:) ! d_t_ajs = adjust + thermals |
---|
| 76 | d_u(:,:)=d_u_vdf(:,:)+d_u_ajs(:,:)+d_u_con(:,:) |
---|
| 77 | d_v(:,:)=d_v_vdf(:,:)+d_v_ajs(:,:)+d_v_con(:,:) |
---|
| 78 | ENDIF |
---|
[1754] | 79 | ELSEIF (iflag_ener_conserv==101) THEN |
---|
| 80 | d_t(:,:)=0. |
---|
| 81 | d_u(:,:)=d_u_vdf(:,:)+d_u_ajs(:,:)+d_u_con(:,:) |
---|
| 82 | d_v(:,:)=d_v_vdf(:,:)+d_v_ajs(:,:)+d_v_con(:,:) |
---|
| 83 | ELSEIF (iflag_ener_conserv==110) THEN |
---|
| 84 | d_t(:,:)=d_t_vdf(:,:)+d_t_ajs(:,:) |
---|
| 85 | d_u(:,:)=0. |
---|
| 86 | d_v(:,:)=0. |
---|
| 87 | ELSE |
---|
| 88 | abort_message = 'iflag_ener_conserv non prevu' |
---|
| 89 | CALL abort_gcm (modname,abort_message,1) |
---|
| 90 | ENDIF |
---|
| 91 | |
---|
| 92 | !---------------------------------------------------------------------------- |
---|
| 93 | ! Two options wether we consider time integration in the energy conservation |
---|
| 94 | !---------------------------------------------------------------------------- |
---|
| 95 | |
---|
| 96 | if (iflag_ener_conserv==2) then |
---|
| 97 | zu(:,:)=puo(:,:) |
---|
| 98 | zv(:,:)=pvo(:,:) |
---|
| 99 | else |
---|
[1761] | 100 | IF (iflag_pbl>=20 .AND. iflag_pbl<=27) THEN |
---|
| 101 | zu(:,:)=puo(:,:)+d_u_vdf(:,:)+0.5*d_u(:,:) |
---|
| 102 | zv(:,:)=pvo(:,:)+d_v_vdf(:,:)+0.5*d_v(:,:) |
---|
| 103 | ELSE |
---|
| 104 | zu(:,:)=puo(:,:)+0.5*d_u(:,:) |
---|
| 105 | zv(:,:)=pvo(:,:)+0.5*d_v(:,:) |
---|
| 106 | ENDIF |
---|
[1754] | 107 | endif |
---|
| 108 | |
---|
| 109 | fluxu(:,klev+1)=0. |
---|
| 110 | fluxv(:,klev+1)=0. |
---|
| 111 | fluxt(:,klev+1)=0. |
---|
| 112 | |
---|
| 113 | do k=klev,1,-1 |
---|
| 114 | fluxu(:,k)=fluxu(:,k+1)+masse(:,k)*d_u(:,k) |
---|
| 115 | fluxv(:,k)=fluxv(:,k+1)+masse(:,k)*d_v(:,k) |
---|
| 116 | fluxt(:,k)=fluxt(:,k+1)+masse(:,k)*d_t(:,k)/exner(:,k) |
---|
| 117 | enddo |
---|
| 118 | |
---|
| 119 | dddu(:,1)=2*zu(:,1)*fluxu(:,1) |
---|
| 120 | dddv(:,1)=2*zv(:,1)*fluxv(:,1) |
---|
| 121 | dddt(:,1)=(exner(:,1)-1.)*fluxt(:,1) |
---|
| 122 | |
---|
| 123 | do k=2,klev |
---|
| 124 | dddu(:,k)=(zu(:,k)-zu(:,k-1))*fluxu(:,k) |
---|
| 125 | dddv(:,k)=(zv(:,k)-zv(:,k-1))*fluxv(:,k) |
---|
| 126 | dddt(:,k)=(exner(:,k)-exner(:,k-1))*fluxt(:,k) |
---|
| 127 | enddo |
---|
| 128 | dddu(:,klev+1)=0. |
---|
| 129 | dddv(:,klev+1)=0. |
---|
| 130 | dddt(:,klev+1)=0. |
---|
| 131 | |
---|
| 132 | do k=1,klev |
---|
| 133 | d_t_ec(:,k)=-(dddu(:,k)+dddu(:,k+1)+dddv(:,k)+dddv(:,k+1) & |
---|
| 134 | & +rcpd*(dddt(:,k)+dddt(:,k+1)))/(2.*rcpd*masse(:,k)) |
---|
| 135 | enddo |
---|
| 136 | ! d_t_ec=0. |
---|
| 137 | |
---|
| 138 | ENDIF |
---|
| 139 | |
---|
| 140 | !================================================================ |
---|
| 141 | ! Computation of integrated enthalpie and kinetic energy variation |
---|
| 142 | ! FH (hourdin@lmd.jussieu.fr), 2013/04/25 |
---|
| 143 | !================================================================ |
---|
| 144 | |
---|
| 145 | bils_ec(:)=0. |
---|
[1761] | 146 | bils_tke(:)=0. |
---|
| 147 | bils_diss(:)=0. |
---|
[1754] | 148 | bils_kinetic(:)=0. |
---|
| 149 | bils_enthalp(:)=0. |
---|
| 150 | bils_latent(:)=0. |
---|
| 151 | DO k=1,klev |
---|
| 152 | bils_ec(:)=bils_ec(:)-d_t_ec(:,k)*masse(:,k) |
---|
[1761] | 153 | bils_tke(:)=bils_tke(:)+0.5*(dtke(:,k)+dtke(:,k+1))*masse(:,k) |
---|
| 154 | bils_diss(:)=bils_diss(:)-d_t_diss(:,k)*masse(:,k) |
---|
[1754] | 155 | bils_kinetic(:)=bils_kinetic(:)+masse(:,k)* & |
---|
| 156 | & (pun(:,k)*pun(:,k)+pvn(:,k)*pvn(:,k) & |
---|
| 157 | & -puo(:,k)*puo(:,k)-pvo(:,k)*pvo(:,k)) |
---|
| 158 | bils_enthalp(:)= & |
---|
| 159 | & bils_enthalp(:)+masse(:,k)*(ptn(:,k)-pto(:,k)+d_t_ec(:,k)) |
---|
| 160 | bils_latent(:)=bils_latent(:)+masse(:,k)* & |
---|
| 161 | & (pqn(:,k)-pqo(:,k)) |
---|
| 162 | ENDDO |
---|
| 163 | bils_ec(:)=rcpd*bils_ec(:)/pdtphys |
---|
[1761] | 164 | bils_tke(:)=bils_tke(:)/pdtphys |
---|
| 165 | bils_diss(:)=rcpd*bils_diss(:)/pdtphys |
---|
[1754] | 166 | bils_kinetic(:)= 0.5*bils_kinetic(:)/pdtphys |
---|
| 167 | bils_enthalp(:)=rcpd*bils_enthalp(:)/pdtphys |
---|
| 168 | bils_latent(:)=rlvtt*bils_latent(:)/pdtphys |
---|
| 169 | RETURN |
---|
| 170 | |
---|
| 171 | END |
---|