Ignore:
Timestamp:
Sep 20, 2024, 12:32:04 PM (7 weeks ago)
Author:
Laurent Fairhead
Message:

Updating cirrus branch to trunk revision 5171

Location:
LMDZ6/branches/cirrus
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/cirrus

  • LMDZ6/branches/cirrus/libf/phylmd/lmdz_lscp.F90

    r5163 r5202  
    77!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    88SUBROUTINE lscp(klon,klev,dtime,missing_val,            &
    9      paprs,pplay,temp,qt,ptconv,ratqs,                  &
     9     paprs,pplay,temp,qt,qice_save,ptconv,ratqs,        &
    1010     d_t, d_q, d_ql, d_qi, rneb, rneblsvol,             &
    11      pfraclr,pfracld,                                   &
     11     pfraclr, pfracld,                                  &
     12     cldfraliq, sigma2_icefracturb,mean_icefracturb,    &
    1213     radocond, radicefrac, rain, snow,                  &
    1314     frac_impa, frac_nucl, beta,                        &
    14      prfl, psfl, rhcl, qta, fraca,                     &
    15      tv, pspsk, tla, thl, iflag_cld_th,             &
    16      iflag_ice_thermo, distcltop, temp_cltop, cell_area,&
    17      cf_seri, rvc_seri, u_seri, v_seri, pbl_eps,        &
     15     prfl, psfl, rhcl, qta, fraca,                      &
     16     tv, pspsk, tla, thl, iflag_cld_th,                 &
     17     iflag_ice_thermo, distcltop, temp_cltop,           &
     18     tke, tke_dissip,                                   &
     19     cell_area,                                         &
     20     cf_seri, rvc_seri, u_seri, v_seri,                 &
    1821     qsub, qissr, qcld, subfra, issrfra, gamma_cond,    &
    1922     ratio_qi_qtot, dcf_sub, dcf_con, dcf_mix,          &
     
    100103! USE de modules contenant des fonctions.
    101104USE lmdz_cloudth, ONLY : cloudth, cloudth_v3, cloudth_v6, cloudth_mpc
    102 USE lmdz_lscp_tools, ONLY : calc_qsat_ecmwf, icefrac_lscp, calc_gammasat
     105USE lmdz_lscp_tools, ONLY : calc_qsat_ecmwf, calc_gammasat
     106USE lmdz_lscp_tools, ONLY : icefrac_lscp, icefrac_lscp_turb
    103107USE lmdz_lscp_tools, ONLY : fallice_velocity, distance_to_cloud_top
    104108USE lmdz_lscp_condensation, ONLY : condensation_lognormal, condensation_ice_supersat
     
    115119USE lmdz_lscp_ini, ONLY : RCPD, RLSTT, RLVTT, RLMLT, RVTMP2, RTT, RD, RG
    116120USE lmdz_lscp_ini, ONLY : ok_poprecip
    117 USE lmdz_lscp_ini, ONLY : ok_external_lognormal, ok_ice_supersat, ok_unadjusted_clouds
     121USE lmdz_lscp_ini, ONLY : ok_external_lognormal, ok_ice_supersat, ok_unadjusted_clouds, iflag_icefrac
    118122
    119123IMPLICIT NONE
     
    134138  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: temp            ! temperature (K)
    135139  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: qt              ! total specific humidity (in vapor phase in input) [kg/kg]
     140  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: qice_save       ! ice specific from previous time step [kg/kg]
    136141  INTEGER,                         INTENT(IN)   :: iflag_cld_th    ! flag that determines the distribution of convective clouds
    137142  INTEGER,                         INTENT(IN)   :: iflag_ice_thermo! flag to activate the ice thermodynamics
     
    141146  !Inputs associated with thermal plumes
    142147
    143   REAL, DIMENSION(klon,klev),      INTENT(IN)   :: tv             ! virtual potential temperature [K]
    144   REAL, DIMENSION(klon,klev),      INTENT(IN)   :: qta            ! specific humidity within thermals [kg/kg]
    145   REAL, DIMENSION(klon,klev),      INTENT(IN)   :: fraca          ! fraction of thermals within the mesh [-]
    146   REAL, DIMENSION(klon,klev),      INTENT(IN)   :: pspsk          ! exner potential (p/100000)**(R/cp)
    147   REAL, DIMENSION(klon,klev),      INTENT(IN)   :: tla            ! liquid temperature within thermals [K]
     148  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: tv                  ! virtual potential temperature [K]
     149  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: qta                 ! specific humidity within thermals [kg/kg]
     150  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: fraca               ! fraction of thermals within the mesh [-]
     151  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: pspsk               ! exner potential (p/100000)**(R/cp)
     152  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: tla                 ! liquid temperature within thermals [K]
     153  REAL, DIMENSION(klon,klev+1),      INTENT(IN)   :: tke                 !--turbulent kinetic energy [m2/s2]
     154  REAL, DIMENSION(klon,klev+1),      INTENT(IN)   :: tke_dissip          !--TKE dissipation [m2/s3]
    148155
    149156  ! INPUT/OUTPUT variables
    150157  !------------------------
    151158 
    152   REAL, DIMENSION(klon,klev),      INTENT(INOUT)   :: thl          ! liquid potential temperature [K]
    153   REAL, DIMENSION(klon,klev),      INTENT(INOUT)   :: ratqs        ! function of pressure that sets the large-scale
     159  REAL, DIMENSION(klon,klev),      INTENT(INOUT)   :: thl              ! liquid potential temperature [K]
     160  REAL, DIMENSION(klon,klev),      INTENT(INOUT)   :: ratqs            ! function of pressure that sets the large-scale
    154161
    155162  ! INPUT/OUTPUT condensation and ice supersaturation
     
    160167  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: u_seri           ! eastward wind [m/s]
    161168  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: v_seri           ! northward wind [m/s]
    162   REAL, DIMENSION(klon,klev+1),    INTENT(IN)   :: pbl_eps          ! TKE dissipation [?]
    163169  REAL, DIMENSION(klon),           INTENT(IN)   :: cell_area        ! area of each cell [m2]
    164170
     
    179185  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfraclr          ! precip fraction clear-sky part [-]
    180186  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfracld          ! precip fraction cloudy part [-]
     187  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: cldfraliq           ! liquid fraction of cloud [-]
     188  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: sigma2_icefracturb  ! Variance of the diagnostic supersaturation distribution (icefrac_turb) [-]
     189  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: mean_icefracturb    ! Mean of the diagnostic supersaturation distribution (icefrac_turb) [-]
    181190  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: radocond         ! condensed water used in the radiation scheme [kg/kg]
    182191  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: radicefrac       ! ice fraction of condensed water for radiation scheme
     
    190199  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: beta             ! conversion rate of condensed water
    191200
    192   ! fraction of aerosol scavenging through impaction and nucleation (for on-line)
     201  ! fraction of aerosol scavenging through impaction and nucleation    (for on-line)
    193202 
    194   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: frac_impa        ! scavenging fraction due tu impaction [-]
    195   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: frac_nucl        ! scavenging fraction due tu nucleation [-]
     203  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: frac_impa           ! scavenging fraction due tu impaction [-]
     204  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: frac_nucl           ! scavenging fraction due tu nucleation [-]
    196205 
    197206  ! for condensation and ice supersaturation
     
    255264  ! LOCAL VARIABLES:
    256265  !----------------
    257 
    258   REAL,DIMENSION(klon) :: qsl, qsi
     266  REAL,DIMENSION(klon) :: qsl, qsi                                ! saturation threshold at current vertical level
    259267  REAL :: zct, zcl,zexpo
    260268  REAL, DIMENSION(klon,klev) :: ctot
     
    263271  REAL :: zdelta, zcor, zcvm5
    264272  REAL, DIMENSION(klon) :: zdqsdT_raw
    265   REAL, DIMENSION(klon) :: gammasat,dgammasatdt                ! coefficient to make cold condensation at the correct RH and derivative wrt T
    266   REAL, DIMENSION(klon) :: Tbef,qlbef,DT
     273  REAL, DIMENSION(klon) :: gammasat,dgammasatdt                   ! coefficient to make cold condensation at the correct RH and derivative wrt T
     274  REAL, DIMENSION(klon) :: Tbef,qlbef,DT                          ! temperature, humidity and temp. variation during lognormal iteration
    267275  REAL :: num,denom
    268276  REAL :: cste
    269   REAL, DIMENSION(klon) :: zpdf_sig,zpdf_k,zpdf_delta
    270   REAL, DIMENSION(klon) :: Zpdf_a,zpdf_b,zpdf_e1,zpdf_e2
     277  REAL, DIMENSION(klon) :: zpdf_sig,zpdf_k,zpdf_delta             ! lognormal parameters
     278  REAL, DIMENSION(klon) :: Zpdf_a,zpdf_b,zpdf_e1,zpdf_e2          ! lognormal intermediate variables
    271279  REAL :: erf
    272280  REAL, DIMENSION(klon) :: zfice_th
     
    285293  REAL :: zmelt,zrain,zsnow,zprecip
    286294  REAL, DIMENSION(klon) :: dzfice
     295  REAL, DIMENSION(klon) :: zfice_turb, dzfice_turb
    287296  REAL :: zsolid
    288297  REAL, DIMENSION(klon) :: qtot, qzero
     
    315324  REAL, DIMENSION(klon,klev) :: radocondi, radocondl
    316325  REAL :: effective_zneb
    317   REAL, DIMENSION(klon) :: distcltop1D, temp_cltop1D
     326  REAL, DIMENSION(klon) :: zdistcltop, ztemp_cltop
     327  REAL, DIMENSION(klon) :: zqliq, zqice, zqvapcl        ! for icefrac_lscp_turb
    318328 
    319329  ! for condensation and ice supersaturation
     
    328338  REAL :: min_qParent, min_ratio
    329339
    330 
    331340  INTEGER i, k, n, kk, iter
    332341  INTEGER, DIMENSION(klon) :: n_i
     
    382391pfraclr(:,:)=0.0
    383392pfracld(:,:)=0.0
     393cldfraliq(:,:)=0.
     394sigma2_icefracturb(:,:)=0.
     395mean_icefracturb(:,:)=0.
    384396radocond(:,:) = 0.0
    385397radicefrac(:,:) = 0.0
     
    391403zfice(:)=0.0
    392404dzfice(:)=0.0
     405zfice_turb(:)=0.0
     406dzfice_turb(:)=0.0
    393407zqprecl(:)=0.0
    394408zqpreci(:)=0.0
     
    405419d_tot_zneb(:) = 0.0
    406420qzero(:) = 0.0
    407 distcltop1D(:)=0.0
    408 temp_cltop1D(:) = 0.0
     421zdistcltop(:)=0.0
     422ztemp_cltop(:) = 0.0
    409423ztupnew(:)=0.0
    410424
     
    459473
    460474
    461 
    462475!c_iso: variable initialisation for iso
    463476
     
    478491
    479492    ! Initialisation temperature and specific humidity
     493    ! temp(klon,klev) is not modified by the routine, instead all changes in temperature are made on zt
     494    ! at the end of the klon loop, a temperature incremtent d_t due to all processes
     495    ! (thermalization, evap/sub incoming precip, cloud formation, precipitation processes) is calculated
     496    ! d_t = temperature tendency due to lscp
     497    ! The temperature of the overlying layer is updated here because needed for thermalization
    480498    DO i = 1, klon
    481499        zt(i)=temp(i,k)
     
    812830                ELSEIF (iflag_cloudth_vert .EQ. 7) THEN
    813831                   ! Updated version of Arnaud Jam (correction by E. Vignon) + adapted treatment
    814                    ! for boundary-layer mixed phase clouds following Vignon et al. 
     832                   ! for boundary-layer mixed phase clouds
    815833                    CALL cloudth_mpc(klon,klev,k,mpc_bl_points,zt,zq,qta(:,k),fraca(:,k), &
    816834                                     pspsk(:,k),paprs(:,k+1),paprs(:,k),pplay(:,k), tla(:,k), &
     
    834852           
    835853                ! lognormal
    836             lognormale = .TRUE.
     854            lognormale(:) = .TRUE.
    837855
    838856        ELSEIF (iflag_cld_th .GE. 6) THEN
    839857           
    840858                ! lognormal distribution when no thermals
    841             lognormale = fraca(:,k) < min_frac_th_cld
     859            lognormale(:) = fraca(:,k) < min_frac_th_cld
    842860
    843861        ELSE
    844862                ! When iflag_cld_th=5, we always assume
    845863                ! bi-gaussian distribution
    846             lognormale = .FALSE.
     864            lognormale(:) = .FALSE.
    847865       
    848866        ENDIF
     
    900918                  IF (iflag_t_glace.GE.4) THEN
    901919                  ! For iflag_t_glace GE 4 the phase partition function dependends on temperature AND distance to cloud top
    902                        CALL distance_to_cloud_top(klon,klev,k,temp,pplay,paprs,rneb,distcltop1D,temp_cltop1D)
     920                       CALL distance_to_cloud_top(klon,klev,k,temp,pplay,paprs,rneb,zdistcltop,ztemp_cltop)
    903921                  ENDIF
    904                   CALL icefrac_lscp(klon, zt(:), iflag_ice_thermo, distcltop1D(:),temp_cltop1D(:),zfice(:),dzfice(:))
    905 
     922
     923                  CALL icefrac_lscp(klon, zt(:), iflag_ice_thermo, zdistcltop(:),ztemp_cltop(:),zfice(:),dzfice(:))
    906924
    907925                  !--AB Activates a condensation scheme that allows for
     
    938956                        pplay(:,k), paprs(:,k), paprs(:,k+1), &
    939957                        cf_seri(:,k), rvc_seri(:,k), ratio_qi_qtot(:,k), &
    940                         shear(:), pbl_eps(:,k), cell_area(:), &
     958                        shear(:), tke_dissip(:,k), cell_area(:), &
    941959                        Tbef(:), zq(:), zqs(:), gammasat(:), ratqs(:,k), keepgoing(:), &
    942960                        rneb(:,k), zqn(:), qvc(:), issrfra(:,k), qissr(:,k), &
     
    10171035                            cste=RLSTT
    10181036                        ENDIF
    1019 
     1037                       
     1038                        ! LEA_R : check formule
    10201039                        IF ( ok_unadjusted_clouds ) THEN
    10211040                          !--AB We relax the saturation adjustment assumption
     
    10591078        ! For iflag_t_glace GE 4 the phase partition function dependends on temperature AND distance to cloud top
    10601079        IF (iflag_t_glace.GE.4) THEN
    1061             CALL distance_to_cloud_top(klon,klev,k,temp,pplay,paprs,rneb,distcltop1D,temp_cltop1D)
    1062             distcltop(:,k)=distcltop1D(:)
    1063             temp_cltop(:,k)=temp_cltop1D(:)
    1064         ENDIF   
    1065         ! Partition function in stratiform clouds (will be overwritten in boundary-layer MPCs)
    1066         CALL icefrac_lscp(klon,zt,iflag_ice_thermo,distcltop1D,temp_cltop1D,zfice,dzfice)
    1067 
     1080           CALL distance_to_cloud_top(klon,klev,k,temp,pplay,paprs,rneb,zdistcltop,ztemp_cltop)
     1081           distcltop(:,k)=zdistcltop(:)
     1082           temp_cltop(:,k)=ztemp_cltop(:)
     1083        ENDIF
     1084
     1085        ! Partition function depending on temperature
     1086        CALL icefrac_lscp(klon, zt, iflag_ice_thermo, zdistcltop, ztemp_cltop, zfice, dzfice)
     1087
     1088        ! Partition function depending on tke for non shallow-convective clouds
     1089        IF (iflag_icefrac .GE. 1) THEN
     1090
     1091           CALL icefrac_lscp_turb(klon, dtime, Tbef, pplay(:,k), paprs(:,k), paprs(:,k+1), qice_save(:,k), ziflcld, zqn, &
     1092           rneb(:,k), tke(:,k), tke_dissip(:,k), zqliq, zqvapcl, zqice, zfice_turb, dzfice_turb, cldfraliq(:,k),sigma2_icefracturb(:,k), mean_icefracturb(:,k))
     1093
     1094        ENDIF
    10681095
    10691096        ! Water vapor update, Phase determination and subsequent latent heat exchange
    10701097        DO i=1, klon
    1071 
     1098            ! Overwrite phase partitioning in boundary layer mixed phase clouds when the
     1099            ! iflag_cloudth_vert=7 and specific param is activated
    10721100            IF (mpc_bl_points(i,k) .GT. 0) THEN
    1073                
    10741101                zcond(i) = MAX(0.0,qincloud_mpc(i))*rneb(i,k)
    10751102                ! following line is very strange and probably wrong
     
    10781105                zq(i) = zq(i) - zcond(i)       
    10791106                zfice(i)=zfice_th(i)
    1080 
    10811107            ELSE
    1082 
    10831108                ! Checks on rneb, rhcl and zqn
    10841109                IF (rneb(i,k) .LE. 0.0) THEN
     
    11081133                    ! following line is very strange and probably wrong:
    11091134                    rhcl(i,k)=(zqs(i)+zq(i))/2./zqs(i)
     1135                    ! Overwrite partitioning for non shallow-convective clouds if iflag_icefrac>1 (icefrac turb param)
     1136                    IF (iflag_icefrac .GE. 1) THEN
     1137                        IF (lognormale(i)) THEN 
     1138                           zcond(i)  = zqliq(i) + zqice(i)
     1139                           zfice(i)=zfice_turb(i)
     1140                           rhcl(i,k) = zqvapcl(i) * rneb(i,k) + (zq(i) - zqn(i)) * (1.-rneb(i,k))
     1141                        ENDIF
     1142                    ENDIF
    11101143                ENDIF
    11111144
     
    14931526                znebprecipcld(i)=0.0
    14941527            ENDIF
    1495 
     1528        !IF ( ((1-zfice(i))*zoliq(i) .GT. 0.) .AND. (zt(i) .LE. 233.15) ) THEN
     1529        !print*,'WARNING LEA OLIQ A <-40°C '
     1530        !print*,'zt,Tbef,oliq,oice,cldfraliq,icefrac,rneb',zt(i),Tbef(i),(1-zfice(i))*zoliq(i),zfice(i)*zoliq(i),cldfraliq(i,k),zfice(i),rneb(i,k)
     1531        !ENDIF
    14961532        ENDDO
    14971533
Note: See TracChangeset for help on using the changeset viewer.