source: LMDZ5/trunk/libf/phylmd/ener_conserv.F90 @ 2896

Last change on this file since 2896 was 2895, checked in by fhourdin, 7 years ago

Correction pour l'option ... 11 de la conservation de l'energie.

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