Ignore:
Timestamp:
Feb 1, 2022, 6:34:34 PM (2 years ago)
Author:
evignon
Message:

Mise à jour de la routine de nuages lscp
les principaux changements consistent en:

  • des corrections de bug (déclaration et division

par zero) pour que la routine compile avec les modifications d'OB

  • des restructurations pour que les fonctions de lscp_tools_mod

travaillent sur des tableaux et non des scalaires

  • une séparation des coefficients d'évaporation de la neige et de la pluie
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/lscp_mod.F90

    r4062 r4072  
    66
    77!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    8 SUBROUTINE LSCP(dtime,missing_val,                      & 
     8SUBROUTINE LSCP(dtime,missing_val,                      &
    99     paprs,pplay,t,q,ptconv,ratqs,                      &
    10      d_t, d_q, d_ql, d_qi, rneb, rneb_seri,             & 
     10     d_t, d_q, d_ql, d_qi, rneb, rneb_seri,             &
    1111     radliq, radicefrac, rain, snow,                    &
    1212     pfrac_impa, pfrac_nucl, pfrac_1nucl,               &
     
    2525!     
    2626! This code is a new version of the fisrtilp.F90 routine, which is itself a
    27 ! fusion of 'first' (superrsaturation physics, P. LeVan K. Laval)
     27! merge of 'first' (superrsaturation physics, P. LeVan K. Laval)
    2828! and 'ilp' (il pleut, L. Li)
    2929!
     
    126126  INTEGER,                         INTENT(IN)   :: iflag_ice_thermo! flag to activate the ice thermodynamics
    127127                                                                   ! CR: if iflag_ice_thermo=2, only convection is active   
    128   LOGICAL,                         INTENT(IN)   :: ok_ice_sursat   ! flag to determine if ice sursaturation is activated 
     128  LOGICAL,                         INTENT(IN)   :: ok_ice_sursat   ! flag to determine if ice sursaturation is activated
    129129
    130130  LOGICAL, DIMENSION(klon,klev),   INTENT(IN)   :: ptconv          ! grid points where deep convection scheme is active
     
    138138  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: zpspsk          ! exner potential (p/100000)**(R/cp)
    139139  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: ztla            ! liquid temperature within thermals [K]
    140   REAL, DIMENSION(klon,klev),      INTENT(INOUT)   :: zthl            ! liquid potential temperature [K]
     140  REAL, DIMENSION(klon,klev),      INTENT(INOUT)   :: zthl         ! liquid potential temperature [K]
    141141
    142142  ! INPUT/OUTPUT variables
     
    145145  REAL, DIMENSION(klon,klev),      INTENT(INOUT):: ratqs            ! function of pressure that sets the large-scale
    146146                                                                    ! cloud PDF (sigma=ratqs*qt)
     147 
    147148
    148149  ! Input sursaturation en glace
     
    204205  PARAMETER (ztfondue=278.15)
    205206
    206   REAL, SAVE    :: rain_int_min=0.001                               ! Minimum local rain intensity [mm/s] before the decrease in  associates precipitation fraction
     207  REAL, SAVE    :: rain_int_min=0.001                               ! Minimum local rain intensity [mm/s] before the decrease in associated precipitation fraction
    207208  !$OMP THREADPRIVATE(rain_int_min)
    208209
    209 
    210  
     210  LOGICAL, SAVE :: ok_radliq_precip=.false.                         ! Inclusion of all precipitation in radliq (cloud water seen by radiation)
     211  !$OMP THREADPRIVATE(ok_radliq_precip)
     212
     213
     214
     215
    211216  ! LOCAL VARIABLES:
    212217  !----------------
    213218
    214219
    215   REAL qsl, qsi
     220  REAL qsl(klon), qsi(klon)
    216221  REAL zct, zcl
    217222  REAL ctot(klon,klev)
    218223  REAL ctot_vol(klon,klev)
    219   INTEGER mpc_bl_points(klon,klev)
    220224  REAL zqs(klon), zdqs(klon), zdelta, zcor, zcvm5 
    221225  REAL zdqsdT_raw(klon)
     
    230234  REAL zifl(klon), zifln(klon), zqev0,zqevi, zqevti
    231235  REAL zoliq(klon), zcond(klon), zq(klon), zqn(klon)
    232   REAL zoliqp(klon), zoliqi(klon)
     236  REAL zoliql(klon), zoliqi(klon)
    233237  REAL zt(klon)
    234   REAL zdz(klon),zrho(klon),ztot, zrhol(klon)
     238  REAL zdz(klon),zrho(klon),iwc(klon)
    235239  REAL zchau,zfroi,zfice(klon),zneb(klon),znebprecip(klon)
    236   REAL zmelt,zpluie,zice
     240  REAL zmelt,zrain,zsnow,zprecip
    237241  REAL dzfice(klon)
    238   REAL zsolid,qtot,dqsl,dqsi
     242  REAL zsolid
     243  REAL qtot(klon), qzero(klon)
     244  REAL dqsl(klon),dqsi(klon)
    239245  REAL smallestreal
    240246  !  Variables for Bergeron process
     
    262268  REAL tot_zneb(klon), tot_znebn(klon), d_tot_zneb(klon)                                             
    263269  REAL d_znebprecip_clr_cld(klon), d_znebprecip_cld_clr(klon)
    264   REAL velo(klon)
     270  REAL velo(klon,klev), vr
    265271  REAL qlmpc, qimpc, rnebmpc
    266   REAL radliqi(klon,klev)
     272  REAL radliqi(klon,klev), radliql(klon,klev)
    267273
    268274  INTEGER i, k, n, kk
    269275  INTEGER n_i(klon), iter
    270276  INTEGER ncoreczq 
     277  INTEGER mpc_bl_points(klon,klev)
    271278  INTEGER,SAVE :: itap=0
    272279  !$OMP THREADPRIVATE(itap)
     
    334341    CALL getin_p('seuil_neb',seuil_neb)
    335342    CALL getin_p('rain_int_min',rain_int_min)
     343    CALL getin_p('ok_radliq_precip',ok_radliq_precip)
    336344    WRITE(lunout,*) 'lscp, ninter:', ninter
    337345    WRITE(lunout,*) 'lscp, iflag_evap_prec:', iflag_evap_prec
    338346    WRITE(lunout,*) 'lscp, seuil_neb:', seuil_neb
    339347    WRITE(lunout,*) 'lscp, rain_int_min:', rain_int_min
     348    WRITE(lunout,*) 'lscp, ok_radliq_precip:', ok_radliq_precip
    340349
    341350    ! check for precipitation sub-time steps
     
    397406tot_znebn(:) = 0.0                                                                               
    398407d_tot_zneb(:) = 0.0   
     408qzero(:)=0.0
    399409
    400410!--ice sursaturation
     
    468478    ! --------------------------------------------------------------------
    469479    ! A part of the precipitation coming from above is evaporated/sublimated.
    470     !
    471480    ! --------------------------------------------------------------------
    472481
     
    474483    IF (iflag_evap_prec.GE.1) THEN
    475484
     485        ! Calculation of saturation specific humidity
     486        ! depending on temperature:
     487        CALL CALC_QSAT_ECMWF(klon,zt(:),qzero(:),pplay(:,k),RTT,0,.false.,zqs(:),zdqs(:))
     488        ! wrt liquid water
     489        CALL CALC_QSAT_ECMWF(klon,zt(:),qzero(:),pplay(:,k),RTT,1,.false.,qsl(:),dqsl(:))
     490        ! wrt ice
     491        CALL CALC_QSAT_ECMWF(klon,zt(:),qzero(:),pplay(:,k),RTT,2,.false.,qsi(:),dqsi(:))
    476492
    477493        DO i = 1, klon
     
    480496            IF (zrfl(i)+zifl(i).GT.0.) THEN
    481497                   
    482                 CALL CALC_QSAT_ECMWF(zt(i),0.,pplay(i,k),RTT,0,.false.,zqs(i),zdqs(i))
    483 
    484498            ! LTP: we only account for precipitation evaporation in the clear-sky (iflag_evap_prec=4).
    485499                IF (iflag_evap_prec.EQ.4) THEN                                                         
     
    503517                ENDIF   
    504518
    505                 ! A. JAM
    506                 ! We consider separately qsatice and qstal
    507                 ! qsat wrt liquid phase according to thermcep
    508                 CALL CALC_QSAT_ECMWF(zt(i),0.,pplay(i,k),RTT,1,.false.,qsl,dqsl)
    509 
    510          
     519
    511520                ! Evaporation of liquid precipitation coming from above
    512521                ! dP/dz=beta*(1-q/qsat)*sqrt(P)
     
    515524
    516525                IF (iflag_evap_prec.EQ.3) THEN
    517                     zqevt = znebprecip(i)*coef_eva*(1.0-zq(i)/qsl) &
     526                    zqevt = znebprecip(i)*coef_eva*(1.0-zq(i)/qsl(i)) &
    518527                    *SQRT(zrfl(i)/max(1.e-4,znebprecip(i)))        &
    519528                    *(paprs(i,k)-paprs(i,k+1))/pplay(i,k)*zt(i)*RD/RG
    520529                ELSE IF (iflag_evap_prec.EQ.4) THEN
    521                      zqevt = znebprecipclr(i)*coef_eva*(1.0-zq(i)/qsl) &
     530                     zqevt = znebprecipclr(i)*coef_eva*(1.0-zq(i)/qsl(i)) &
    522531                    *SQRT(zrfl(i)/max(1.e-8,znebprecipclr(i))) &
    523532                    *(paprs(i,k)-paprs(i,k+1))/pplay(i,k)*zt(i)*RD/RG
    524533                ELSE
    525                     zqevt = 1.*coef_eva*(1.0-zq(i)/qsl)*SQRT(zrfl(i)) &
     534                    zqevt = 1.*coef_eva*(1.0-zq(i)/qsl(i))*SQRT(zrfl(i)) &
    526535                    *(paprs(i,k)-paprs(i,k+1))/pplay(i,k)*zt(i)*RD/RG
    527536                ENDIF
     
    531540                *RG*dtime/(paprs(i,k)-paprs(i,k+1))
    532541         
    533                 ! qsat wrt ice according to thermcep
    534                 CALL CALC_QSAT_ECMWF(zt(i),0.,pplay(i,k),RTT,2,.false.,qsi,dqsi)
    535 
    536542                ! sublimation of the solid precipitation coming from above
    537543                IF (iflag_evap_prec.EQ.3) THEN
    538                     zqevti = znebprecip(i)*coef_eva*(1.0-zq(i)/qsi) &
     544                    zqevti = znebprecip(i)*coef_eva_i*(1.0-zq(i)/qsi(i)) &
    539545                    *SQRT(zifl(i)/max(1.e-4,znebprecip(i))) &
    540546                    *(paprs(i,k)-paprs(i,k+1))/pplay(i,k)*zt(i)*RD/RG
    541547                ELSE IF (iflag_evap_prec.EQ.4) THEN
    542                      zqevti = znebprecipclr(i)*coef_eva*(1.0-zq(i)/qsi) &
     548                     zqevti = znebprecipclr(i)*coef_eva_i*(1.0-zq(i)/qsi(i)) &
    543549                    *SQRT(zifl(i)/max(1.e-8,znebprecipclr(i))) &
    544550                    *(paprs(i,k)-paprs(i,k+1))/pplay(i,k)*zt(i)*RD/RG
    545551                ELSE
    546                     zqevti = 1.*coef_eva*(1.0-zq(i)/qsi)*SQRT(zifl(i)) &
     552                    zqevti = 1.*coef_eva_i*(1.0-zq(i)/qsi(i))*SQRT(zifl(i)) &
    547553                    *(paprs(i,k)-paprs(i,k+1))/pplay(i,k)*zt(i)*RD/RG
    548554                ENDIF
     
    566572
    567573
    568                 ! EV: agrees with JL's comments below so correct and comment
    569                 ! JLD: I do not understand the lines below. We distribute the liquid
    570                 ! and solid parts of the precipitation even if the layer does not get
    571                 ! saturated. To my opinion, we should all replace with:
    572                 ! zqev=zqevt
    573                 ! zqevi=zqevti
    574                 !    IF (zqevt+zqevti.GT.0.) THEN
    575                 !        zqev=MIN(zqev0*zqevt/(zqevt+zqevti),zqevt)
    576                 !        zqevi=MIN(zqev0*zqevti/(zqevt+zqevti),zqevti)
    577                 !    ELSE
    578                 !        zqev=0.
    579                 !        zqevi=0.
    580                 !    ENDIF
    581                 ! ENDIF
    582 
    583574                ! New solid and liquid precipitation fluxes
    584575                zrfln(i) = Max(0.,zrfl(i) - zqev*(paprs(i,k)-paprs(i,k+1))  &
     
    659650    ! Calculation of qsat, L/Cp*dqsat/dT and ncoreczq counter
    660651    !-------------------------------------------------------
    661        
    662         DO i = 1, klon
     652     
     653     qtot(:)=zq(:)+zmqc(:)
     654     CALL CALC_QSAT_ECMWF(klon,zt(:),qtot(:),pplay(:,k),RTT,0,.false.,zqs(:),zdqs(:))
     655     DO i = 1, klon
    663656            zdelta = MAX(0.,SIGN(1.,RTT-zt(i)))
    664             qtot=zq(i)+zmqc(i)
    665             CALL CALC_QSAT_ECMWF(zt(i),qtot,pplay(i,k),RTT,0,.false.,zqs(i),zdqs(i))
    666657            zdqsdT_raw(i) = zdqs(i)*RCPD*(1.0+RVTMP2*zq(i)) / (RLVTT*(1.-zdelta) + RLSTT*zdelta)
    667          
    668658            IF (zq(i) .LT. 1.e-15) THEN
    669659                ncoreczq=ncoreczq+1
     
    671661            ENDIF
    672662
    673         ENDDO
     663     ENDDO
    674664   
    675665
     
    777767                DO i=1,klon
    778768
    779                     ! convergence = .true. since convergence is not satisfied
     769                    ! convergence = .true. until when convergence is not satisfied
    780770                    convergence(i)=ABS(DT(i)).GT.DDT0
    781771                   
     
    796786
    797787                        ! Rneb, qzn and zcond for lognormal PDFs
    798                         qtot=zq(i)+zmqc(i)
    799                         CALL CALC_QSAT_ECMWF(Tbef(i),qtot,pplay(i,k),RTT,0,.false.,zqs(i),zdqs(i))
    800                         CALL CALC_GAMMASAT(Tbef(i),qtot,pplay(i,k),gammasat(i),dgammasatdt(i))
    801                        
    802                         ! saturation may occur at a humidity different from qsat (gamma qsat), so gamma correction for dqs
    803                         zdqs(i) = gammasat(i)*zdqs(i)+zqs(i)*dgammasatdt(i)
     788                        qtot(i)=zq(i)+zmqc(i)
     789                   
     790                      ENDIF
     791
     792                  ENDDO
     793
     794                  ! Calculation of saturation specific humidity and ce fraction
     795                  CALL CALC_QSAT_ECMWF(klon,Tbef(:),qtot(:),pplay(:,k),RTT,0,.false.,zqs(:),zdqs(:))
     796                  CALL CALC_GAMMASAT(klon,Tbef(:),qtot(:),pplay(:,k),gammasat(:),dgammasatdt(:))
     797                  ! saturation may occur at a humidity different from qsat (gamma qsat), so gamma correction for dqs
     798                  zdqs(:) = gammasat(:)*zdqs(:)+zqs(:)*dgammasatdt(:)
     799                  CALL ICEFRAC_LSCP(klon, zt(:),pplay(:,k)/paprs(:,1),zfice(:),dzfice(:))
     800
     801
     802
     803                  DO i=1,klon
     804
     805                      IF ((convergence(i) .OR. (n_i(i) .EQ. 0)) .AND. lognormale(i)) THEN
    804806
    805807                        zpdf_sig(i)=ratqs(i,k)*zq(i)
     
    826828                          ENDIF
    827829
    828                           rnebss(i,k)=0.0   !--ajout OB (necessaire car boucle de convergence sur le temps)
     830                          rnebss(i,k)=0.0   !--added by OB (needed because of the convergence loop on time)
    829831                          fcontrN(i,k)=0.0  !--idem
    830832                          fcontrP(i,k)=0.0  !--idem
    831833                          qss(i,k)=0.0      !--idem
    832 
     834                       
    833835                        ELSE
     836               
    834837                        !------------------------------------
    835                         ! SURSATURATION EN GLACE
     838                        ! ICE SUPERSATURATION
    836839                        !------------------------------------
    837840
    838841                        CALL ice_sursat(pplay(i,k), paprs(i,k)-paprs(i,k+1), dtime, i, k, t(i,k), zq(i), &
    839                              gamma_ss(i,k), zqs(i), Tbef(i), rneb_seri(i,k), ratqs(i,k),               &
    840                              rneb(i,k), zqn(i), rnebss(i,k), qss(i,k),                                 &
     842                             gamma_ss(i,k), zqs(i), Tbef(i), rneb_seri(i,k), ratqs(i,k),               & 
     843                             rneb(i,k), zqn(i), rnebss(i,k), qss(i,k),                                 & 
    841844                             Tcontr(i,k), qcontr(i,k), qcontr2(i,k), fcontrN(i,k), fcontrP(i,k) )
    842845
     
    850853
    851854
    852             ! P2.2.2> Approximative calculation of temperature variation DT
    853             !           due to condensation.
    854             ! Calculated variables:
    855             ! dT : temperature change due to condensation
    856             ! ---------------------------------------------------------------
    857 
    858                        ! EV: calculation of icefrac in one sole function
    859                         CALL icefrac_lscp(klon, zt(:),pplay(:,k)/paprs(:,1),zfice(:),dzfice(:))
     855                       ! P2.2.2> Approximative calculation of temperature variation DT
     856                       !           due to condensation.
     857                       ! Calculated variables:
     858                       ! dT : temperature change due to condensation
     859                       !---------------------------------------------------------------
     860
    860861               
    861862                        IF (zfice(i).LT.1) THEN
     
    896897
    897898        ! Partition function in stratiform clouds (will be overwritten in boundary-layer MPCs)
    898         CALL icefrac_lscp(klon,zt(:),pplay(:,k)/paprs(:,1),zfice(:), dzfice(:))
     899        CALL ICEFRAC_LSCP(klon,zt(:),pplay(:,k)/paprs(:,1),zfice(:), dzfice(:))
    899900
    900901        DO i=1, klon
     
    10021003
    10031004    DO i = 1, klon
    1004         IF (rneb(i,k).GT.0.0) THEN
    10051005            zoliq(i) = zcond(i)
    1006             zrho(i) = pplay(i,k) / zt(i) / RD
    1007             zdz(i) = (paprs(i,k)-paprs(i,k+1)) / (zrho(i)*RG)
    1008    
    1009             zneb(i) = MAX(rneb(i,k), seuil_neb)
     1006            zoliqi(i)= zoliq(i)*zfice(i)
     1007            zoliql(i)= zoliq(i)*(1.-zfice(i))
     1008            zrho(i)  = pplay(i,k) / zt(i) / RD
     1009            zdz(i)   = (paprs(i,k)-paprs(i,k+1)) / (zrho(i)*RG)
     1010            iwc(i)   = 0.
     1011            zneb(i)  = MAX(rneb(i,k),seuil_neb)
    10101012            radliq(i,k) = zoliq(i)/REAL(ninter+1)
    10111013            radicefrac(i,k) = zfice(i)
    10121014            radliqi(i,k)=zoliq(i)*zfice(i)/REAL(ninter+1)
    1013         ENDIF
     1015            radliql(i,k)=zoliq(i)*(1.-zfice(i))/REAL(ninter+1)
    10141016    ENDDO
    10151017
     
    10241026        DO i=1,klon
    10251027            IF (rneb(i,k).GT.0.0) THEN
    1026                 zrhol(i) = zrho(i) * zoliq(i) / zneb(i)
     1028                iwc(i) = zrho(i) * zoliqi(i) / zneb(i) ! in-cloud ice condensate content
    10271029            ENDIF
    10281030        ENDDO
    10291031
    1030         CALL FALLICE_VELOCITY(klon,zrhol(:),zt(:),zrho(:),pplay(:,k),ptconv(:,k),velo(:))
     1032        CALL FALLICE_VELOCITY(klon,iwc(:),zt(:),zrho(:),pplay(:,k),ptconv(:,k),velo(:,k))
    10311033
    10321034        DO i = 1, klon
     
    10341036            IF (rneb(i,k).GT.0.0) THEN
    10351037
    1036                 ! Initialization of zpluie, zice and ztot:
    1037                 zpluie=0.
    1038                 zice=0.
    1039                 ztot=0.
     1038                ! Initialization of zrain, zsnow and zprecip:
     1039                zrain=0.
     1040                zsnow=0.
     1041                zprecip=0.
    10401042
    10411043                IF (zneb(i).EQ.seuil_neb) THEN
    1042                     ztot = 0.0
    1043                     zice = 0.0
    1044                     zpluie= 0.0
     1044                    zprecip = 0.0
     1045                    zsnow = 0.0
     1046                    zrain= 0.0
    10451047                ELSE
    10461048                    ! water quantity to remove: zchau (Sundqvist, 1978)
     
    10491051                        zcl=cld_lc_con
    10501052                        zct=1./cld_tau_con
    1051                         zfroi = dtime/REAL(ninter)/zdz(i)*zoliq(i)*velo(i)*zfice(i)
     1053                        zfroi = dtime/REAL(ninter)/zdz(i)*zoliq(i)*velo(i,k)*zfice(i)
    10521054                    ELSE
    10531055                        zcl=cld_lc_lsc
    10541056                        zct=1./cld_tau_lsc
    10551057                        zfroi = dtime/REAL(ninter)/zdz(i)*zoliq(i) &   ! dqice/dt=1/rho*d(rho*wice*qice)/dz
    1056                             *velo(i) * zfice(i)
     1058                            *velo(i,k) * zfice(i)
    10571059                    ENDIF
    10581060
     
    10611063                    ! surface fraction (which is larger and artificially
    10621064                    ! reduces the in-cloud water).
     1065
    10631066                    IF ((iflag_cloudth_vert.GE.3).AND.(iflag_rain_incloud_vol.EQ.1)) THEN
    10641067                        zchau = zct   *dtime/REAL(ninter) * zoliq(i) &
     
    10691072                    ENDIF
    10701073
    1071                     zpluie = MIN(MAX(zchau,0.0),zoliq(i)*(1.-zfice(i)))
    1072                     zice   = MIN(MAX(zfroi,0.0),zoliq(i)*zfice(i))
    1073                     ztot   = MAX(zpluie + zice,0.0)
     1074                    zrain  = MIN(MAX(zchau,0.0),zoliq(i)*(1.-zfice(i)))
     1075                    zsnow   = MIN(MAX(zfroi,0.0),zoliq(i)*zfice(i))
     1076                    zprecip = MAX(zrain + zsnow,0.0)
    10741077
    10751078                ENDIF
    10761079           
    1077                 ztot    = MIN(ztot,zoliq(i))
    1078                 zice    = MIN(zice,ztot)
    1079                 zpluie  = MIN(zpluie,ztot)
    1080 
    1081                 zoliqp(i) = MAX(zoliq(i)*(1.-zfice(i))-1.*zpluie  , 0.0)
    1082                 zoliqi(i) = MAX(zoliq(i)*zfice(i)-1.*zice  , 0.0)
    1083                 zoliq(i)  = MAX(zoliq(i)-ztot , 0.0)
     1080                zoliql(i) = MAX(zoliq(i)*(1.-zfice(i))-1.*zrain  , 0.0)
     1081                zoliqi(i) = MAX(zoliq(i)*zfice(i)-1.*zsnow  , 0.0)
     1082                zoliq(i)  = MAX(zoliq(i)-zprecip , 0.0)
    10841083
    10851084                radliq(i,k) = radliq(i,k) + zoliq(i)/REAL(ninter+1)
     1085                radliql(i,k) = radliql(i,k) + zoliql(i)/REAL(ninter+1)
    10861086                radliqi(i,k) = radliqi(i,k) + zoliqi(i)/REAL(ninter+1)
    10871087           
    1088             ENDIF
     1088            ENDIF ! rneb >0
    10891089
    10901090        ENDDO  ! i = 1,klon
     
    10931093
    10941094   
    1095     ! Caculate the percentage of ice in "radliq" so cloud+precip seen by the radiation scheme
     1095    ! Include the contribution to non-evaporated precipitation to radliq
     1096    IF ((ok_radliq_precip) .AND. (k .LT. klev)) THEN
     1097        ! for rain drops, we assume a fallspeed of 5m/s
     1098        vr=5.0
     1099        radliql(:,k)=radliql(:,k)+zrfl(:)/vr/zrho(:)
     1100        ! for ice crystals, we take the fallspeed from level above
     1101        radliqi(:,k)=radliqi(:,k)+zifl(:)/zrho(:)/velo(:,k+1)
     1102        radliq(:,k)=radliql(:,k)+radliqi(:,k)
     1103    ENDIF
     1104
     1105    ! caculate the percentage of ice in "radliq" so cloud+precip seen by the radiation scheme
    10961106    DO i=1,klon
    1097         IF (radliq(i,k) .GT. 0) THEN
     1107        IF (radliq(i,k) .GT. 0.) THEN
    10981108            radicefrac(i,k)=MIN(MAX(radliqi(i,k)/radliq(i,k),0.),1.)
    10991109        ENDIF
     
    11011111
    11021112
    1103     ! CR&JYG: We account for the Wegener-Findeisen-Bergeron process in the precipitation flux:
    1104     ! If T<0C, liquid precip are converted into ice, which leads to an increase in
    1105     ! temperature DeltaT. The effect of DeltaT on condensates and precipitation is roughly
    1106     ! taken into account through a linearization of the equations and by approximating
    1107     ! the liquid precipitation process with a "threshold" process. We assume that
    1108     ! condensates are not modified during this operation. Liquid precipitation is
    1109     ! removed (in the limit DeltaT<273.15-T). Solid precipitation increases.
    1110     ! Water vapor increases as well
    1111     ! Note that compared to fisrtilp, we always assume iflag_bergeron=2
    1112 
    1113 
     1113    ! Precipitation flux calculation
    11141114
    11151115    DO i = 1, klon
    11161116
    11171117            IF (rneb(i,k) .GT. 0.0) THEN
    1118 
    1119                 zqpreci(i)=(zcond(i)-zoliq(i))*zfice(i)
    1120                 zqprecl(i)=(zcond(i)-zoliq(i))*(1.-zfice(i))
    1121                 zcp=RCPD*(1.0+RVTMP2*(zq(i)+zmqc(i)+zcond(i)))
    1122                 coef1 = rneb(i,k)*RLSTT/zcp*zdqsdT_raw(i)
    1123                 ! Computation of DT if all the liquid precip freezes
    1124                 DeltaT = RLMLT*zqprecl(i) / (zcp*(1.+coef1))
    1125                 ! T should not exceed the freezing point
    1126                 ! that is Delta > RTT-zt(i)
    1127                 DeltaT = max( min( RTT-zt(i), DeltaT) , 0. )
    1128                 zt(i)  = zt(i) + DeltaT
    1129                 ! water vaporization due to temp. increase
    1130                 Deltaq = rneb(i,k)*zdqsdT_raw(i)*DeltaT
    1131                 ! we add this vaporized water to the total vapor and we remove it from the precip
    1132                 zq(i) = zq(i) +  Deltaq
    1133                 ! The three "max" lines herebelow protect from rounding errors
    1134                 zcond(i) = max( zcond(i)- Deltaq, 0. )
    1135                 ! liquid precipitation freezes oe evaporates
    1136                 Deltaqprecl = -zcp/RLMLT*(1.+coef1)*DeltaT
    1137                 zqprecl(i) = max( zqprecl(i) + Deltaqprecl, 0. )
    1138                 ! iced water budget
    1139                 zqpreci(i) = max (zqpreci(i) - Deltaqprecl - Deltaq, 0.)
     1118               
     1119
     1120               ! CR&JYG: We account for the Wegener-Findeisen-Bergeron process in the precipitation flux:
     1121               ! If T<0C, liquid precip are converted into ice, which leads to an increase in
     1122               ! temperature DeltaT. The effect of DeltaT on condensates and precipitation is roughly
     1123               ! taken into account through a linearization of the equations and by approximating
     1124               ! the liquid precipitation process with a "threshold" process. We assume that
     1125               ! condensates are not modified during this operation. Liquid precipitation is
     1126               ! removed (in the limit DeltaT<273.15-T). Solid precipitation increases.
     1127               ! Water vapor increases as well
     1128               ! Note that compared to fisrtilp, we always assume iflag_bergeron=2
     1129
     1130                    zqpreci(i)=(zcond(i)-zoliq(i))*zfice(i)
     1131                    zqprecl(i)=(zcond(i)-zoliq(i))*(1.-zfice(i))
     1132                    zcp=RCPD*(1.0+RVTMP2*(zq(i)+zmqc(i)+zcond(i)))
     1133                    coef1 = rneb(i,k)*RLSTT/zcp*zdqsdT_raw(i)
     1134                    ! Computation of DT if all the liquid precip freezes
     1135                    DeltaT = RLMLT*zqprecl(i) / (zcp*(1.+coef1))
     1136                    ! T should not exceed the freezing point
     1137                    ! that is Delta > RTT-zt(i)
     1138                    DeltaT = max( min( RTT-zt(i), DeltaT) , 0. )
     1139                    zt(i)  = zt(i) + DeltaT
     1140                    ! water vaporization due to temp. increase
     1141                    Deltaq = rneb(i,k)*zdqsdT_raw(i)*DeltaT
     1142                    ! we add this vaporized water to the total vapor and we remove it from the precip
     1143                    zq(i) = zq(i) +  Deltaq
     1144                    ! The three "max" lines herebelow protect from rounding errors
     1145                    zcond(i) = max( zcond(i)- Deltaq, 0. )
     1146                    ! liquid precipitation converted to ice precip
     1147                    Deltaqprecl = -zcp/RLMLT*(1.+coef1)*DeltaT
     1148                    zqprecl(i) = max( zqprecl(i) + Deltaqprecl, 0. )
     1149                    ! iced water budget
     1150                    zqpreci(i) = max (zqpreci(i) - Deltaqprecl - Deltaq, 0.)
     1151
    11401152           
    1141                 d_ql(i,k) = (1-zfice(i))*zoliq(i)
    1142                 d_qi(i,k) = zfice(i)*zoliq(i)
    1143        
    11441153                IF (iflag_evap_prec.EQ.4) THEN                                                           
    11451154                    zrflcld(i) = zrflcld(i)+zqprecl(i) &                                                   
     
    11651174    IF (iflag_evap_prec.EQ.4) THEN 
    11661175
    1167         DO i=1, klon                                       
     1176        DO i=1,klon                                       
    11681177               
    11691178            IF ((zrflclr(i) + ziflclr(i)) .GT. 0. ) THEN     
     
    11921201    ! Outputs:
    11931202    ! Precipitation fluxes at layer interfaces
    1194     ! and temperature and vapor tendencies
     1203    ! and temperature and water species tendencies
    11951204    DO i = 1, klon
    11961205        psfl(i,k)=zifl(i)
    11971206        prfl(i,k)=zrfl(i)
     1207        d_ql(i,k) = (1-zfice(i))*zoliq(i)
     1208        d_qi(i,k) = zfice(i)*zoliq(i)
    11981209        d_q(i,k) = zq(i) - q(i,k)
    11991210        d_t(i,k) = zt(i) - t(i,k)
     
    12641275    ENDDO
    12651276     
    1266     !--save some variables for ice sursaturation
     1277    !--save some variables for ice supersaturation
    12671278    !
    12681279    DO i = 1, klon
    1269         ! pour la mémoire
     1280        ! for memory
    12701281        rneb_seri(i,k) = rneb(i,k)
    12711282
    1272         ! pour les diagnostics
     1283        ! for diagnostics
    12731284        rnebclr(i,k) = 1.0 - rneb(i,k) - rnebss(i,k)
    12741285
    12751286        qvc(i,k) = zqs(i) * rneb(i,k)
    1276         qclr(i,k) = MAX(1.e-10,zq(i) - qvc(i,k) - qss(i,k))  !--ajout OB a cause de cas pathologiques avec lognormale=F
     1287        qclr(i,k) = MAX(1.e-10,zq(i) - qvc(i,k) - qss(i,k))  !--added by OB because of pathologic cases with the lognormal
    12771288        qcld(i,k) = qvc(i,k) + zcond(i)
    1278 
    1279         !q_sat
    1280         CALL CALC_QSAT_ECMWF(Tbef(i),0.,pplay(i,k),RTT,1,.false.,zqsatl(i,k),zdqs(i))
    1281         CALL CALC_QSAT_ECMWF(Tbef(i),0.,pplay(i,k),RTT,2,.false.,zqsats(i,k),zdqs(i))
    1282 
    1283      ENDDO
    1284 
    1285 ENDDO
     1289   END DO
     1290   !q_sat
     1291   CALL CALC_QSAT_ECMWF(klon,Tbef(:),qzero(:),pplay(:,k),RTT,1,.false.,zqsatl(:,k),zdqs(:))
     1292   CALL CALC_QSAT_ECMWF(klon,Tbef(:),qzero(:),pplay(:,k),RTT,2,.false.,zqsats(:,k),zdqs(:))     
     1293
     1294END DO
    12861295
    12871296!======================================================================
Note: See TracChangeset for help on using the changeset viewer.