/[lmdze]/trunk/Sources/phylmd/hbtm.f
ViewVC logotype

Diff of /trunk/Sources/phylmd/hbtm.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 149 by guez, Thu Jun 18 12:23:44 2015 UTC revision 178 by guez, Fri Mar 11 18:47:26 2016 UTC
# Line 26  contains Line 26  contains
26      ! Adaptation a LMDZ version couplee Pour le moment on fait passer      ! Adaptation a LMDZ version couplee Pour le moment on fait passer
27      ! en argument les grandeurs de surface : flux, t, q2m, t, on va      ! en argument les grandeurs de surface : flux, t, q2m, t, on va
28      ! utiliser systematiquement les grandeurs a 2m mais on garde la      ! utiliser systematiquement les grandeurs a 2m mais on garde la
29      ! possibilit\'e de changer si besoin est (jusqu'à pr\'esent la      ! possibilit\'e de changer si besoin est (jusqu'\`a pr\'esent la
30      ! forme de HB avec le 1er niveau modele etait conservee)      ! forme de HB avec le 1er niveau modele etait conservee)
31    
32      USE dimphy, ONLY: klev, klon      USE dimphy, ONLY: klev, klon
33      USE suphec_m, ONLY: rcpd, rd, retv, rg, rkappa, rlvtt, rtt, rv      USE suphec_m, ONLY: rcpd, rd, retv, rg, rkappa, rtt
34      USE yoethf_m, ONLY: r2es, rvtmp2      USE yoethf_m, ONLY: r2es, rvtmp2
35      USE fcttre, ONLY: foeew      USE fcttre, ONLY: foeew
36    
     REAL RLvCp, REPS  
37      ! Arguments:      ! Arguments:
38    
39      ! nombre de points a calculer      ! nombre de points a calculer
# Line 122  contains Line 121  contains
121      REAL rhino(klon, klev)      REAL rhino(klon, klev)
122      ! pts w/unstbl pbl (positive virtual ht flx)      ! pts w/unstbl pbl (positive virtual ht flx)
123      LOGICAL unstbl(klon)      LOGICAL unstbl(klon)
     ! stable pbl with levels within pbl  
     LOGICAL stblev(klon)  
     ! unstbl pbl with levels within pbl  
     LOGICAL unslev(klon)  
     ! unstb pbl w/lvls within srf pbl lyr  
     LOGICAL unssrf(klon)  
     ! unstb pbl w/lvls in outer pbl lyr  
     LOGICAL unsout(klon)  
124      LOGICAL check(klon) ! Richardson number > critical      LOGICAL check(klon) ! Richardson number > critical
125      ! flag de prolongerment cape pour pt Omega      ! flag de prolongerment cape pour pt Omega
126      LOGICAL omegafl(klon)      LOGICAL omegafl(klon)
# Line 146  contains Line 137  contains
137      REAL trmb1(klon), trmb2(klon), trmb3(klon)      REAL trmb1(klon), trmb2(klon), trmb3(klon)
138      ! Algorithme thermique      ! Algorithme thermique
139      REAL s(klon, klev) ! [P/Po]^Kappa milieux couches      REAL s(klon, klev) ! [P/Po]^Kappa milieux couches
     ! equivalent potential temperature of therma  
     REAL The_th(klon)  
140      ! total water of thermal      ! total water of thermal
141      REAL qT_th(klon)      REAL qT_th(klon)
142      ! T thermique niveau precedent      ! T thermique niveau precedent
     REAL Tbef(klon)  
143      REAL qsatbef(klon)      REAL qsatbef(klon)
144      ! le thermique est sature      ! le thermique est sature
145      LOGICAL Zsat(klon)      LOGICAL Zsat(klon)
146      ! Cape du thermique      ! Cape du thermique
147      REAL Cape(klon)      REAL Cape(klon)
     ! Cape locale  
     REAL Kape(klon)  
148      ! Eau liqu integr du thermique      ! Eau liqu integr du thermique
149      REAL EauLiq(klon)      REAL EauLiq(klon)
150      ! Critere d'instab d'entrainmt des nuages de      ! Critere d'instab d'entrainmt des nuages de
151      REAL ctei(klon)      REAL ctei(klon)
152      REAL aa, zthvd, zthvu, qqsat      REAL zthvd, zthvu, qqsat
     REAL a1, a2, a3  
153      REAL t2      REAL t2
154    
155      ! inverse phi function for momentum      ! inverse phi function for momentum
156      REAL phiminv(klon)      REAL phiminv(klon)
     ! inverse phi function for heat  
     REAL phihinv(klon)  
157      ! turbulent velocity scale for momentum      ! turbulent velocity scale for momentum
158      REAL wm(klon)      REAL wm(klon)
     ! k*ustar*pblh  
     REAL fak1(klon)  
     ! k*wm*pblh  
     REAL fak2(klon)  
     ! fakn*wstr/wm  
     REAL fak3(klon)  
     ! level eddy diffusivity for momentum  
     REAL pblk(klon)  
     ! Prandtl number for eddy diffusivities  
     REAL pr(klon)  
     ! zmzp / Obukhov length  
     REAL zl(klon)  
     ! zmzp / pblh  
     REAL zh(klon)  
     ! (1-(zmzp/pblh))**2  
     REAL zzh(klon)  
     ! w*, convective velocity scale  
     REAL wstr(klon)  
     ! current level height  
     REAL zm(klon)  
159      ! current level height + one level up      ! current level height + one level up
160      REAL zp(klon)      REAL zp(klon)
161      REAL zcor      REAL zcor
162    
163      REAL fac, pblmin, zmzp, term      REAL pblmin
164    
165      !-----------------------------------------------------------------      !-----------------------------------------------------------------
166    
# Line 208  contains Line 171  contains
171      b212=sqrt(b1*b2)      b212=sqrt(b1*b2)
172      b2sr=sqrt(b2)      b2sr=sqrt(b2)
173    
     ! Initialisation  
     RLvCp = RLVTT/RCPD  
     REPS = RD/RV  
   
174      ! Calculer les hauteurs de chaque couche      ! Calculer les hauteurs de chaque couche
175      ! (geopotentielle Int_dp/ro = Int_[Rd.T.dp/p] z = geop/g)      ! (geopotentielle Int_dp/ro = Int_[Rd.T.dp/p] z = geop/g)
176      ! pourquoi ne pas utiliser Phi/RG ?      ! pourquoi ne pas utiliser Phi/RG ?
# Line 271  contains Line 230  contains
230      ! until the Richardson number between the first level and the      ! until the Richardson number between the first level and the
231      ! current level exceeds the "critical" value.  (bonne idee Nu de      ! current level exceeds the "critical" value.  (bonne idee Nu de
232      ! separer le Ric et l'exces de temp du thermique)      ! separer le Ric et l'exces de temp du thermique)
     fac = 100.  
233      DO k = 2, isommet      DO k = 2, isommet
234         DO i = 1, knon         DO i = 1, knon
235            IF (check(i)) THEN            IF (check(i)) THEN
# Line 336  contains Line 294  contains
294            q_star = kqfs(i)/wm(i)            q_star = kqfs(i)/wm(i)
295            t_star = khfs(i)/wm(i)            t_star = khfs(i)/wm(i)
296    
           a1=b1*(1.+2.*RETV*qT_th(i))*t_star**2  
           a2=(RETV*T2m(i))**2*b2*q_star**2  
           a3=2.*RETV*T2m(i)*b212*q_star*t_star  
           aa=a1+a2+a3  
   
297            therm(i) = sqrt( b1*(1.+2.*RETV*qT_th(i))*t_star**2 &            therm(i) = sqrt( b1*(1.+2.*RETV*qT_th(i))*t_star**2 &
298                 + (RETV*T2m(i))**2*b2*q_star**2 &                 + (RETV*T2m(i))**2*b2*q_star**2 &
299                 + max(0., 2.*RETV*T2m(i)*b212*q_star*t_star))                 + max(0., 2.*RETV*T2m(i)*b212*q_star*t_star))
# Line 416  contains Line 369  contains
369         ! omegafl utilise pour prolongement CAPE         ! omegafl utilise pour prolongement CAPE
370         omegafl(i) = .FALSE.         omegafl(i) = .FALSE.
371         Cape(i) = 0.         Cape(i) = 0.
        Kape(i) = 0.  
372         EauLiq(i) = 0.         EauLiq(i) = 0.
373         CTEI(i) = 0.         CTEI(i) = 0.
        pblk(i) = 0.0  
        fak1(i) = ustar(i)*pblh(i)*vk  
374    
375         ! Do additional preparation for unstable cases only, set temperature         ! Do additional preparation for unstable cases only, set temperature
376         ! and moisture perturbations depending on stability.         ! and moisture perturbations depending on stability.
# Line 430  contains Line 380  contains
380            zxt=(T2m(i)-zref*0.5*RG/RCPD/(1.+RVTMP2*qT_th(i))) &            zxt=(T2m(i)-zref*0.5*RG/RCPD/(1.+RVTMP2*qT_th(i))) &
381                 *(1.+RETV*qT_th(i))                 *(1.+RETV*qT_th(i))
382            phiminv(i) = (1. - binm*pblh(i)/obklen(i))**onet            phiminv(i) = (1. - binm*pblh(i)/obklen(i))**onet
           phihinv(i) = sqrt(1. - binh*pblh(i)/obklen(i))  
383            wm(i) = ustar(i)*phiminv(i)            wm(i) = ustar(i)*phiminv(i)
           fak2(i) = wm(i)*pblh(i)*vk  
           wstr(i) = (heatv(i)*RG*pblh(i)/zxt)**onet  
           fak3(i) = fakn*wstr(i)/wm(i)  
384         ENDIF         ENDIF
        ! Computes Theta_e for thermal (all cases : to be modified)  
        ! attention ajout therm(i) = virtuelle  
        The_th(i) = T2m(i) + therm(i) + RLvCp*qT_th(i)  
385      ENDDO      ENDDO
386    
387      ! Main level loop to compute the diffusivities and      ! Main level loop to compute the diffusivities and
# Line 446  contains Line 389  contains
389      loop_level: DO k = 2, isommet      loop_level: DO k = 2, isommet
390         ! Find levels within boundary layer:         ! Find levels within boundary layer:
391         DO i = 1, knon         DO i = 1, knon
           unslev(i) = .FALSE.  
           stblev(i) = .FALSE.  
           zm(i) = z(i, k-1)  
392            zp(i) = z(i, k)            zp(i) = z(i, k)
393            IF (zkmin == 0. .AND. zp(i) > pblh(i)) zp(i) = pblh(i)            IF (zkmin == 0. .AND. zp(i) > pblh(i)) zp(i) = pblh(i)
           IF (zm(i) < pblh(i)) THEN  
              zmzp = 0.5*(zm(i) + zp(i))  
              zh(i) = zmzp/pblh(i)  
              zl(i) = zmzp/obklen(i)  
              zzh(i) = 0.  
              IF (zh(i) <= 1.) zzh(i) = (1. - zh(i))**2  
   
              ! stblev for points zm < plbh and stable and neutral  
              ! unslev for points zm < plbh and unstable  
              IF (unstbl(i)) THEN  
                 unslev(i) = .TRUE.  
              ELSE  
                 stblev(i) = .TRUE.  
              ENDIF  
           ENDIF  
        ENDDO  
   
        ! Stable and neutral points; set diffusivities; counter-gradient  
        ! terms zero for stable case:  
        DO i = 1, knon  
           IF (stblev(i)) THEN  
              IF (zl(i) <= 1.) THEN  
                 pblk(i) = fak1(i)*zh(i)*zzh(i)/(1. + betas*zl(i))  
              ELSE  
                 pblk(i) = fak1(i)*zh(i)*zzh(i)/(betas + zl(i))  
              ENDIF  
           ENDIF  
        ENDDO  
   
        ! unssrf, unstable within surface layer of pbl  
        ! unsout, unstable within outer layer of pbl  
        DO i = 1, knon  
           unssrf(i) = .FALSE.  
           unsout(i) = .FALSE.  
           IF (unslev(i)) THEN  
              IF (zh(i) < sffrac) THEN  
                 unssrf(i) = .TRUE.  
              ELSE  
                 unsout(i) = .TRUE.  
              ENDIF  
           ENDIF  
        ENDDO  
   
        ! Unstable for surface layer; counter-gradient terms zero  
        DO i = 1, knon  
           IF (unssrf(i)) THEN  
              term = (1. - betam*zl(i))**onet  
              pblk(i) = fak1(i)*zh(i)*zzh(i)*term  
              pr(i) = term/sqrt(1. - betah*zl(i))  
           ENDIF  
        ENDDO  
   
        ! Unstable for outer layer; counter-gradient terms non-zero:  
        DO i = 1, knon  
           IF (unsout(i)) THEN  
              pblk(i) = fak2(i)*zh(i)*zzh(i)  
              pr(i) = phiminv(i)/phihinv(i) + ccon*fak3(i)/fak  
           ENDIF  
394         ENDDO         ENDDO
395    
396         ! For all layers, compute integral info and CTEI         ! For all layers, compute integral info and CTEI
# Line 531  contains Line 413  contains
413                             * (qT_th(i)-qsatbef(i)) / (qsatbef(i)-qqsat)                             * (qT_th(i)-qsatbef(i)) / (qsatbef(i)-qqsat)
414                     endif                     endif
415                     Zsat(i) = .true.                     Zsat(i) = .true.
                    Tbef(i) = T2  
416                  endif                  endif
417               endif               endif
418               qsatbef(i) = qqsat               qsatbef(i) = qqsat

Legend:
Removed from v.149  
changed lines
  Added in v.178

  ViewVC Help
Powered by ViewVC 1.1.21