source: LMDZ6/trunk/libf/phylmd/ener_conserv.F90 @ 3821

Last change on this file since 3821 was 3071, checked in by jyg, 7 years ago

Correction in ener_conserv.F90: bils_tke is
set to zero if iflag_pbl <= 1.

Cosmetic correction in physiq_mod.F90: pbl_tke is
initialized to zero if iflag_pbl <= 1 and
klon_glo=1.

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 8.7 KB
Line 
1subroutine ener_conserv(klon,klev,pdtphys, &
2 &                      puo,pvo,pto,pqo,pql0,pqs0, &
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
22USE 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
24USE phys_local_var_mod, ONLY : d_t_eva,d_t_lsc,d_q_eva,d_q_lsc
25USE phys_local_var_mod, ONLY : d_u_oro,d_v_oro,d_u_lif,d_v_lif
26USE phys_local_var_mod, ONLY : du_gwd_hines,dv_gwd_hines,dv_gwd_front,dv_gwd_rando
27USE phys_state_var_mod, ONLY : du_gwd_front,du_gwd_rando
28USE phys_output_var_mod, ONLY : bils_ec,bils_ech,bils_tke,bils_kinetic,bils_enthalp,bils_latent,bils_diss
29USE add_phys_tend_mod, ONLY : fl_cor_ebil
30
31
32IMPLICIT none
33#include "YOMCST.h"
34#include "YOETHF.h"
35#include "clesphys.h"
36#include "compbl.h"
37
38! Arguments
39INTEGER, INTENT(IN) :: klon,klev
40REAL, INTENT(IN) :: pdtphys
41REAL, DIMENSION(klon,klev), INTENT(IN)      :: puo,pvo,pto,pqo,pql0,pqs0
42REAL, DIMENSION(klon,klev), INTENT(IN)      :: pun,pvn,ptn,pqn,pqln,pqsn
43REAL, DIMENSION(klon,klev), INTENT(IN)      :: masse,exner
44REAL, DIMENSION(klon,klev+1), INTENT(IN)    :: dtke
45!
46REAL, DIMENSION(klon,klev), INTENT(OUT)     :: d_t_ec
47
48! Local
49      integer k,i
50REAL, DIMENSION(klon,klev+1) :: fluxu,fluxv,fluxt
51REAL, DIMENSION(klon,klev+1) :: dddu,dddv,dddt
52REAL, DIMENSION(klon,klev) :: d_u,d_v,d_t,zv,zu,d_t_ech
53REAL ZRCPD
54
55character*80 abort_message
56character*20 :: modname
57
58
59modname='ener_conser'
60d_t_ec(:,:)=0.
61
62IF (iflag_ener_conserv==-1) THEN
63!+jld ec_conser
64   DO k = 1, klev
65   DO i = 1, klon
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
75!-jld ec_conser
76
77
78
79ELSEIF (iflag_ener_conserv>=1) THEN
80
81   IF (iflag_ener_conserv<=2) THEN
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
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.
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(:,:)
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
149   ELSE
150      abort_message = 'iflag_ener_conserv non prevu'
151      CALL abort_physic (modname,abort_message,1)
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
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
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
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)
197   enddo
198
199ENDIF
200
201!================================================================
202!  Computation of integrated enthalpie and kinetic energy variation
203!  FH (hourdin@lmd.jussieu.fr), 2013/04/25
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)
213!================================================================
214
215      bils_ec(:)=0.
216      bils_ech(:)=0.
217      bils_tke(:)=0.
218      bils_diss(:)=0.
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)
224        bils_diss(:)=bils_diss(:)-d_t_diss(:,k)*masse(:,k)
225        bils_kinetic(:)=bils_kinetic(:)+masse(:,k)* &
226     &           (pun(:,k)*pun(:,k)+pvn(:,k)*pvn(:,k) &
227     &            -puo(:,k)*puo(:,k)-pvo(:,k)*pvo(:,k))
228        bils_enthalp(:)= &
229     &  bils_enthalp(:)+masse(:,k)*(ptn(:,k)-pto(:,k)+d_t_ec(:,k)-d_t_eva(:,k)-d_t_lsc(:,k))
230!    &  bils_enthalp(:)+masse(:,k)*(ptn(:,k)-pto(:,k)+d_t_ec(:,k))
231        bils_latent(:)=bils_latent(:)+masse(:,k)* &
232!    &             (pqn(:,k)-pqo(:,k))
233     &             (pqn(:,k)-pqo(:,k)-d_q_eva(:,k)-d_q_lsc(:,k))
234      ENDDO
235      bils_ec(:)=rcpd*bils_ec(:)/pdtphys
236      bils_diss(:)=rcpd*bils_diss(:)/pdtphys
237      bils_kinetic(:)= 0.5*bils_kinetic(:)/pdtphys
238      bils_enthalp(:)=rcpd*bils_enthalp(:)/pdtphys
239      bils_latent(:)=rlvtt*bils_latent(:)/pdtphys
240!jyg<
241      IF (iflag_pbl > 1) THEN
242        DO k=1,klev
243          bils_tke(:)=bils_tke(:)+0.5*(dtke(:,k)+dtke(:,k+1))*masse(:,k)
244        ENDDO
245        bils_tke(:)=bils_tke(:)/pdtphys
246      ENDIF  ! (iflag_pbl > 1)
247!>jyg
248
249IF (iflag_ener_conserv>=1) THEN
250      bils_ech(:)=0.
251      DO k=1,klev
252        bils_ech(:)=bils_ech(:)-d_t_ech(:,k)*masse(:,k)
253      ENDDO
254      bils_ech(:)=rcpd*bils_ech(:)/pdtphys
255ENDIF
256
257RETURN
258
259END
Note: See TracBrowser for help on using the repository browser.