Changeset 5204 for LMDZ6/trunk


Ignore:
Timestamp:
Sep 20, 2024, 1:28:24 PM (2 months ago)
Author:
Laurent Fairhead
Message:

Integrating A.Borella's work on cirrus in the trunk

Location:
LMDZ6/trunk
Files:
2 deleted
20 edited
4 copied

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk

  • LMDZ6/trunk/DefLists/field_def_lmdz.xml

    r5150 r5204  
    156156        <field id="LWupSFC"    long_name="Upwd. IR rad. at surface"    unit="W/m2" />
    157157        <field id="LWupSFCclr"    long_name="CS Upwd. IR rad. at surface"    unit="W/m2" />
     158        <field id="LWupTOA"    long_name="LWup at TOA"    unit="W/m2" />
     159        <field id="LWupTOAclr"    long_name="LWup clear sky at TOA"    unit="W/m2" />
    158160        <field id="LWupTOAcleanclr"    long_name="CS clean (no aerosol) Upwd. IR rad. at TOA"    unit="W/m2" />
    159161        <field id="LWdnSFC"    long_name="Down. IR rad. at surface"    unit="W/m2" />
     
    879881        <field id="dqch4"        long_name="H2O due to CH4 oxidation and photolysis" unit="(kg/kg)/s" />
    880882        <field id="pvap"    long_name="pvap intermediary variable" unit="-">pres*ovap*461.5 / (287.04*(1.+ (10.9491/18.0153)*ovap)) </field>
    881         <field id="oclr"    long_name="Clear sky total water"    unit="kg/kg" />
    882         <field id="ocld"    long_name="Cloudy sky total water"   unit="kg/kg" />
    883         <field id="oss"     long_name="ISSR total water"    unit="kg/kg" />
    884         <field id="ovc"     long_name="In-cloud vapor"    unit="kg/kg" />
    885         <field id="rnebclr"    long_name="Clear sky fraction"    unit="-" />
    886         <field id="rnebss"     long_name="ISSR fraction"     unit="-" />
    887         <field id="rnebseri"   long_name="Cloud fraction"    unit="-" />
    888         <field id="gammass"    long_name="Supersaturation ratio"    unit="-" />
    889         <field id="N1ss"       long_name="N1ss"    unit="-" />
    890         <field id="N2ss"       long_name="N2ss"    unit="-" />
    891         <field id="drnebsub"   long_name="Cloud fraction change because of sublimation"    unit="s-1" />
    892         <field id="drnebcon"   long_name="Cloud fraction change because of condensation"   unit="s-1" />
    893         <field id="drnebtur"   long_name="Cloud fraction change because of turbulence"     unit="s-1" />
    894         <field id="drnebavi"   long_name="Cloud fraction change because of aviation"       unit="s-1" />
    895         <field id="qsatl"      long_name="Saturation with respect to liquid water"    unit="-" />
    896         <field id="qsats"      long_name="Saturation with respect to liquid ice"      unit="-" />
    897         <field id="flightm"    long_name="Aviation meters flown"      unit="m/s" />
    898         <field id="flighth2o"  long_name="Aviation H2O emitted"       unit="kg H2O/s" />
    899         <field id="fcontrP"    long_name="Gridbox fraction with potential persistent contrails"     unit="-" />
    900         <field id="fcontrN"    long_name="Gridbox fraction with potential non-persistent contrails"     unit="-" />
    901         <field id="qcontr"     long_name="Contrail qcontr"     unit="Pa" />
    902         <field id="qcontr2"     long_name="Contrail qcontr2"     unit="kg/kg" />
    903         <field id="Tcontr"     long_name="Contrail Tcontr"     unit="K" />
     883        <field id="cfseri"     long_name="Cloud fraction"    unit="-" />
     884        <field id="dcfdyn"     long_name="Dynamics cloud fraction tendency"    unit="s-1" />
     885        <field id="rvcseri"    long_name="Cloudy water vapor to total water vapor ratio"    unit="-" />
     886        <field id="drvcdyn"    long_name="Dynamics cloudy water vapor to total water vapor ratio tendency"    unit="s-1" />
     887        <field id="qsub"       long_name="Subsaturated clear sky total water"    unit="kg/kg" />
     888        <field id="qissr"      long_name="Supersaturated clear sky total water"    unit="kg/kg" />
     889        <field id="qcld"       long_name="Cloudy sky total water"    unit="kg/kg" />
     890        <field id="subfra"     long_name="Subsaturated clear sky fraction"    unit="kg/kg" />
     891        <field id="issrfra"    long_name="Supersaturated clear sky fraction"    unit="kg/kg" />
     892        <field id="gammacond"  long_name="Condensation threshold w.r.t. saturation"    unit="-" />
     893        <field id="dcfsub"     long_name="Sublimation cloud fraction tendency"    unit="s-1" />
     894        <field id="dcfcon"     long_name="Condensation cloud fraction tendency"    unit="s-1" />
     895        <field id="dcfmix"     long_name="Cloud mixing cloud fraction tendency"    unit="s-1" />
     896        <field id="dqiadj"     long_name="Temperature adjustment ice tendency"    unit="kg/kg/s" />
     897        <field id="dqisub"     long_name="Sublimation ice tendency"    unit="kg/kg/s" />
     898        <field id="dqicon"     long_name="Condensation ice tendency"    unit="kg/kg/s" />
     899        <field id="dqimix"     long_name="Cloud mixing ice tendency"    unit="kg/kg/s" />
     900        <field id="dqvcadj"    long_name="Temperature adjustment cloudy water vapor tendency"    unit="kg/kg/s" />
     901        <field id="dqvcsub"    long_name="Sublimation cloudy water vapor tendency"    unit="kg/kg/s" />
     902        <field id="dqvccon"    long_name="Condensation cloudy water vapor tendency"    unit="kg/kg/s" />
     903        <field id="dqvcmix"    long_name="Cloud mixing cloudy water vapor tendency"    unit="kg/kg/s" />
     904        <field id="qsatl"      long_name="Saturation with respect to liquid"    unit="kg/kg" />
     905        <field id="qsati"      long_name="Saturation with respect to ice"    unit="kg/kg" />
     906        <field id="Tcontr"     long_name="Temperature threshold for contrail formation"    unit="K" />
     907        <field id="qcontr"     long_name="Specific humidity threshold for contrail formation"    unit="Pa" />
     908        <field id="qcontr2"    long_name="Specific humidity threshold for contrail formation"    unit="kg/kg" />
     909        <field id="fcontrN"    long_name="Fraction with non-persistent contrail in clear-sky"    unit="-" />
     910        <field id="fcontrP"    long_name="Fraction with persistent contrail in ISSR"    unit="-" />
     911        <field id="dcfavi"     long_name="Aviation cloud fraction tendency"    unit="s-1" />
     912        <field id="dqiavi"     long_name="Aviation ice tendency"    unit="kg/kg/s" />
     913        <field id="dqvcavi"    long_name="Aviation cloudy water vapor tendency"    unit="kg/kg/s" />
     914        <field id="flightdist" long_name="Aviation flown distance"    unit="m/s/mesh" />
     915        <field id="flighth2o"  long_name="Aviation H2O flight emission"    unit="kg H2O/s/mesh" />
    904916        <field id="fluxt"     long_name="flux h"     unit="W/m2" />
    905917        <field id="fluxq"     long_name="flux q"     unit="-" />
  • LMDZ6/trunk/libf/dynphy_lonlat/phylmd/etat0phys_netcdf.F90

    r4801 r5204  
    4949    prw_ancien, u10m,v10m, treedrg, u_ancien, v_ancien, wake_delta_pbl_TKE, wake_dens, &
    5050    ale_bl, ale_bl_trig, alp_bl, &
    51     ale_wake, ale_bl_stat, AWAKE_S
     51    ale_wake, ale_bl_stat, AWAKE_S, &
     52    cf_ancien, rvc_ancien
    5253
    5354  USE comconst_mod, ONLY: pi, dtvr
     
    9495  USE init_ssrf_m, ONLY: start_init_subsurf
    9596  USE phys_state_var_mod, ONLY: beta_aridity, delta_tsurf, awake_dens, cv_gen, &
    96        ratqs_inter_, rneb_ancien
     97       ratqs_inter_
    9798  !use ioipsl_getincom
    9899  IMPLICIT NONE
     
    242243  ale_wake=0.
    243244  ale_bl_stat=0.
     245
     246  cf_ancien = 0.
     247  rvc_ancien = 0.
    244248 
    245249  z0m(:,:)=0 ! ym missing 5th subsurface initialization
     
    287291
    288292  ratqs_inter_ = 0.002
    289   rneb_ancien = 0.
    290293  CALL phyredem( "startphy.nc" )
    291294
  • LMDZ6/trunk/libf/phylmd/clesphys.h

    r5017 r5204  
    9494       LOGICAL :: ok_airs
    9595       INTEGER :: ip_ebil_phy, iflag_rrtm, iflag_ice_thermo, NSW, iflag_albedo
    96        LOGICAL :: ok_ice_sursat, ok_plane_h2o, ok_plane_contrail
     96       LOGICAL :: ok_ice_supersat, ok_plane_h2o, ok_plane_contrail
    9797       LOGICAL :: ok_chlorophyll
    9898       LOGICAL :: ok_strato
     
    157157     &     , ok_lic_melt, ok_lic_cond, aer_type                         &
    158158     &     , iflag_rrtm, ok_strato,ok_hines, ok_qch4                    &
    159      &     , iflag_ice_thermo, ok_ice_sursat                            &
     159     &     , iflag_ice_thermo, ok_ice_supersat                          &
    160160     &     , ok_plane_h2o, ok_plane_contrail                            &
    161161     &     , ok_gwd_rando, NSW, iflag_albedo                            &
  • LMDZ6/trunk/libf/phylmd/conf_phys_m.F90

    r4843 r5204  
    173173    INTEGER,SAVE :: iflag_clw_omp
    174174    INTEGER,SAVE :: iflag_ice_thermo_omp
    175     LOGICAL,SAVE :: ok_ice_sursat_omp
     175    LOGICAL,SAVE :: ok_ice_supersat_omp
    176176    LOGICAL,SAVE :: ok_plane_h2o_omp, ok_plane_contrail_omp
    177177    REAL,SAVE :: rad_froid_omp, rad_chau1_omp, rad_chau2_omp
     
    13471347
    13481348    !
    1349     !Config Key  = ok_ice_sursat
    1350     !Config Desc =
    1351     !Config Def  = 0
    1352     !Config Help =
    1353     !
    1354     ok_ice_sursat_omp = 0
    1355     CALL getin('ok_ice_sursat',ok_ice_sursat_omp)
     1349    !Config Key  = ok_ice_supersat
     1350    !Config Desc = include ice supersaturation for cold clouds
     1351    !Config Def  = .FALSE.
     1352    !Config Help =
     1353    !
     1354    ok_ice_supersat_omp = .FALSE.
     1355    CALL getin('ok_ice_supersat',ok_ice_supersat_omp)
    13561356
    13571357    !Config Key  = ok_plane_h2o
    1358     !Config Desc =
    1359     !Config Def  = 0
     1358    !Config Desc = include H2O emissions from aviation
     1359    !Config Def  = .FALSE.
    13601360    !Config Help =
    13611361    !
     
    13641364
    13651365    !Config Key  = ok_plane_contrail
    1366     !Config Desc =
    1367     !Config Def  = 0
     1366    !Config Desc = include the formation of contrail cirrus clouds
     1367    !Config Def  = .FALSE.
    13681368    !Config Help =
    13691369    !
     
    23452345    rad_chau2 = rad_chau2_omp
    23462346    iflag_ice_thermo = iflag_ice_thermo_omp
    2347     ok_ice_sursat = ok_ice_sursat_omp
     2347    ok_ice_supersat = ok_ice_supersat_omp
    23482348    ok_plane_h2o = ok_plane_h2o_omp
    23492349    ok_plane_contrail = ok_plane_contrail_omp
     
    27702770    WRITE(lunout,*) ' rad_chau2 = ',rad_chau2
    27712771    WRITE(lunout,*) ' iflag_ice_thermo = ',iflag_ice_thermo
    2772     WRITE(lunout,*) ' ok_ice_sursat = ',ok_ice_sursat
     2772    WRITE(lunout,*) ' ok_ice_supersat = ',ok_ice_supersat
    27732773    WRITE(lunout,*) ' ok_plane_h2o = ',ok_plane_h2o
    27742774    WRITE(lunout,*) ' ok_plane_contrail = ',ok_plane_contrail
  • LMDZ6/trunk/libf/phylmd/create_etat0_unstruct_mod.F90

    r5084 r5204  
    258258    prw_ancien = 0.
    259259    agesno = 0.
     260   
     261    ! LSCP condensation and ice supersaturation
     262    cf_ancien = 0.
     263    rvc_ancien = 0.
    260264
    261265    wake_delta_pbl_TKE(:,:,:)=0
     
    310314    END IF
    311315    ratqs_inter_ = 0.002
    312     rneb_ancien = 0.
    313316
    314317    CALL gather_omp(cell_area,cell_area_mpi)
  • LMDZ6/trunk/libf/phylmd/lmdz_lscp.F90

    r5191 r5204  
    88SUBROUTINE lscp(klon,klev,dtime,missing_val,            &
    99     paprs,pplay,temp,qt,qice_save,ptconv,ratqs,        &
    10      d_t, d_q, d_ql, d_qi, rneb, rneblsvol, rneb_seri,  &
     10     d_t, d_q, d_ql, d_qi, rneb, rneblsvol,             &
    1111     pfraclr, pfracld,                                  &
    1212     cldfraliq, sigma2_icefracturb,mean_icefracturb,    &
     
    1515     prfl, psfl, rhcl, qta, fraca,                      &
    1616     tv, pspsk, tla, thl, iflag_cld_th,                 &
    17      iflag_ice_thermo, ok_ice_sursat, qsatl, qsats,     &
    18      distcltop, temp_cltop, tke, tke_dissip,            &
    19      qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss,   &
    20      Tcontr, qcontr, qcontr2, fcontrN, fcontrP,         &
     17     iflag_ice_thermo, distcltop, temp_cltop,           &
     18     tke, tke_dissip,                                   &
     19     cell_area,                                         &
     20     cf_seri, rvc_seri, u_seri, v_seri,                 &
     21     qsub, qissr, qcld, subfra, issrfra, gamma_cond,    &
     22     ratio_qi_qtot, dcf_sub, dcf_con, dcf_mix,          &
     23     dqi_adj, dqi_sub, dqi_con, dqi_mix, dqvc_adj,      &
     24     dqvc_sub, dqvc_con, dqvc_mix, qsatl, qsati,        &
     25     Tcontr, qcontr, qcontr2, fcontrN, fcontrP, dcf_avi,&
     26     dqi_avi, dqvc_avi, flight_dist, flight_h2o,        &
    2127     cloudth_sth,cloudth_senv,cloudth_sigmath,cloudth_sigmaenv, &
    2228     qraindiag, qsnowdiag, dqreva, dqssub, dqrauto,     &
     
    100106USE lmdz_lscp_tools, ONLY : icefrac_lscp, icefrac_lscp_turb
    101107USE lmdz_lscp_tools, ONLY : fallice_velocity, distance_to_cloud_top
    102 USE ice_sursat_mod, ONLY : ice_sursat
     108USE lmdz_lscp_condensation, ONLY : condensation_lognormal, condensation_ice_supersat
    103109USE lmdz_lscp_poprecip, ONLY : poprecip_precld, poprecip_postcld
    104110
    105111! Use du module lmdz_lscp_ini contenant les constantes
    106 USE lmdz_lscp_ini, ONLY : prt_level, lunout
     112USE lmdz_lscp_ini, ONLY : prt_level, lunout, eps
    107113USE lmdz_lscp_ini, ONLY : seuil_neb, niter_lscp, iflag_evap_prec, t_coup, DDT0, ztfondue, rain_int_min
    108114USE lmdz_lscp_ini, ONLY : ok_radocond_snow, a_tr_sca, cld_expo_con, cld_expo_lsc
     
    113119USE lmdz_lscp_ini, ONLY : RCPD, RLSTT, RLVTT, RLMLT, RVTMP2, RTT, RD, RG
    114120USE lmdz_lscp_ini, ONLY : ok_poprecip
    115 USE lmdz_lscp_ini, ONLY : iflag_icefrac
     121USE lmdz_lscp_ini, ONLY : ok_external_lognormal, ok_ice_supersat, ok_unadjusted_clouds, iflag_icefrac
     122
    116123IMPLICIT NONE
    117124
     
    135142  INTEGER,                         INTENT(IN)   :: iflag_ice_thermo! flag to activate the ice thermodynamics
    136143                                                                   ! CR: if iflag_ice_thermo=2, only convection is active
    137   LOGICAL,                         INTENT(IN)   :: ok_ice_sursat   ! flag to determine if ice sursaturation is activated
    138 
    139144  LOGICAL, DIMENSION(klon,klev),   INTENT(IN)   :: ptconv          ! grid points where deep convection scheme is active
    140145
     
    146151  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: pspsk               ! exner potential (p/100000)**(R/cp)
    147152  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: tla                 ! liquid temperature within thermals [K]
    148   REAL, DIMENSION(klon,klev),      INTENT(IN)   :: tke                 !--turbulent kinetic energy [m2/s2]
    149   REAL, DIMENSION(klon,klev),      INTENT(IN)   :: tke_dissip          !--TKE dissipation [m2/s3]
     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]
    150155
    151156  ! INPUT/OUTPUT variables
     
    155160  REAL, DIMENSION(klon,klev),      INTENT(INOUT)   :: ratqs            ! function of pressure that sets the large-scale
    156161
    157 
    158   ! Input sursaturation en glace
    159   REAL, DIMENSION(klon,klev),      INTENT(INOUT):: rneb_seri           ! fraction nuageuse en memoire
     162  ! INPUT/OUTPUT condensation and ice supersaturation
     163  !--------------------------------------------------
     164  REAL, DIMENSION(klon,klev),      INTENT(INOUT):: cf_seri          ! cloud fraction [-]
     165  REAL, DIMENSION(klon,klev),      INTENT(INOUT):: ratio_qi_qtot    ! solid specific water to total specific water ratio [-]
     166  REAL, DIMENSION(klon,klev),      INTENT(INOUT):: rvc_seri         ! cloudy water vapor to total water vapor ratio [-]
     167  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: u_seri           ! eastward wind [m/s]
     168  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: v_seri           ! northward wind [m/s]
     169  REAL, DIMENSION(klon),           INTENT(IN)   :: cell_area        ! area of each cell [m2]
     170
     171  ! INPUT/OUTPUT aviation
     172  !--------------------------------------------------
     173  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: flight_dist      ! Aviation distance flown within the mesh [m/s/mesh]
     174  REAL, DIMENSION(klon,klev),      INTENT(IN)   :: flight_h2o       ! Aviation H2O emitted within the mesh [kg H2O/s/mesh]
    160175 
    161176  ! OUTPUT variables
    162177  !-----------------
    163178
    164   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: d_t                 ! temperature increment [K]
    165   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: d_q                 ! specific humidity increment [kg/kg]
    166   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: d_ql                ! liquid water increment [kg/kg]
    167   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: d_qi                ! cloud ice mass increment [kg/kg]
    168   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: rneb                ! cloud fraction [-]
    169   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: rneblsvol           ! cloud fraction per unit volume [-] 
    170   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfraclr             ! precip fraction clear-sky part [-]
    171   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfracld             ! precip fraction cloudy part [-]
     179  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: d_t              ! temperature increment [K]
     180  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: d_q              ! specific humidity increment [kg/kg]
     181  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: d_ql             ! liquid water increment [kg/kg]
     182  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: d_qi             ! cloud ice mass increment [kg/kg]
     183  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: rneb             ! cloud fraction [-]
     184  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: rneblsvol        ! cloud fraction per unit volume [-] 
     185  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfraclr          ! precip fraction clear-sky part [-]
     186  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfracld          ! precip fraction cloudy part [-]
    172187  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: cldfraliq           ! liquid fraction of cloud [-]
    173188  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: sigma2_icefracturb  ! Variance of the diagnostic supersaturation distribution (icefrac_turb) [-]
    174189  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: mean_icefracturb    ! Mean of the diagnostic supersaturation distribution (icefrac_turb) [-]
    175   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: radocond            ! condensed water used in the radiation scheme [kg/kg]
    176   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: radicefrac          ! ice fraction of condensed water for radiation scheme
    177   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: rhcl                ! clear-sky relative humidity [-]
    178   REAL, DIMENSION(klon),           INTENT(OUT)  :: rain                ! surface large-scale rainfall [kg/s/m2]
    179   REAL, DIMENSION(klon),           INTENT(OUT)  :: snow                ! surface large-scale snowfall [kg/s/m2]
    180   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qsatl               ! saturation specific humidity wrt liquid [kg/kg]
    181   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qsats               ! saturation specific humidity wrt ice [kg/kg] 
    182   REAL, DIMENSION(klon,klev+1),    INTENT(OUT)  :: prfl                ! large-scale rainfall flux in the column [kg/s/m2]
    183   REAL, DIMENSION(klon,klev+1),    INTENT(OUT)  :: psfl                ! large-scale snowfall flux in the column [kg/s/m2]
    184   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: distcltop           ! distance to cloud top [m]
    185   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: temp_cltop          ! temperature of cloud top [K]
    186   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: beta                ! conversion rate of condensed water
     190  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: radocond         ! condensed water used in the radiation scheme [kg/kg]
     191  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: radicefrac       ! ice fraction of condensed water for radiation scheme
     192  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: rhcl             ! clear-sky relative humidity [-]
     193  REAL, DIMENSION(klon),           INTENT(OUT)  :: rain             ! surface large-scale rainfall [kg/s/m2]
     194  REAL, DIMENSION(klon),           INTENT(OUT)  :: snow             ! surface large-scale snowfall [kg/s/m2]
     195  REAL, DIMENSION(klon,klev+1),    INTENT(OUT)  :: prfl             ! large-scale rainfall flux in the column [kg/s/m2]
     196  REAL, DIMENSION(klon,klev+1),    INTENT(OUT)  :: psfl             ! large-scale snowfall flux in the column [kg/s/m2]
     197  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: distcltop        ! distance to cloud top [m]
     198  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: temp_cltop       ! temperature of cloud top [K]
     199  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: beta             ! conversion rate of condensed water
    187200
    188201  ! fraction of aerosol scavenging through impaction and nucleation    (for on-line)
     
    191204  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: frac_nucl           ! scavenging fraction due tu nucleation [-]
    192205 
    193   ! for supersaturation and contrails parameterisation
    194  
    195   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qclr                ! specific total water content in clear sky region [kg/kg]
    196   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qcld                ! specific total water content in cloudy region [kg/kg]
    197   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qss                 ! specific total water content in supersat region [kg/kg]
    198   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qvc                 ! specific vapor content in clouds [kg/kg]
    199   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: rnebclr             ! mesh fraction of clear sky [-]   
    200   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: rnebss              ! mesh fraction of ISSR [-] 
    201   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: gamma_ss            ! coefficient governing the ice nucleation RHi threshold [-]     
    202   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: Tcontr              ! threshold temperature for contrail formation [K]
    203   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qcontr              ! threshold humidity for contrail formation [kg/kg]
    204   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qcontr2             ! // (2nd expression more consistent with LMDZ expression of q)         
    205   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: fcontrN             ! fraction of grid favourable to non-persistent contrails
    206   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: fcontrP             ! fraction of grid favourable to persistent contrails
    207   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: cloudth_sth         ! mean saturation deficit in thermals
    208   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: cloudth_senv        ! mean saturation deficit in environment
    209   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: cloudth_sigmath     ! std of saturation deficit in thermals
    210   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: cloudth_sigmaenv    ! std of saturation deficit in environment
     206  ! for condensation and ice supersaturation
     207
     208  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qsub           !--specific total water content in sub-saturated clear sky region [kg/kg]
     209  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qissr          !--specific total water content in supersat region [kg/kg]
     210  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qcld           !--specific total water content in cloudy region [kg/kg]
     211  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: subfra         !--mesh fraction of subsaturated clear sky [-]   
     212  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: issrfra        !--mesh fraction of ISSR [-] 
     213  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: gamma_cond     !--coefficient governing the ice nucleation RHi threshold [-]     
     214  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dcf_sub        !--cloud fraction tendency because of sublimation [s-1]
     215  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dcf_con        !--cloud fraction tendency because of condensation [s-1]
     216  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dcf_mix        !--cloud fraction tendency because of cloud mixing [s-1]
     217  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqi_adj        !--specific ice content tendency because of temperature adjustment [kg/kg/s]
     218  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqi_sub        !--specific ice content tendency because of sublimation [kg/kg/s]
     219  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqi_con        !--specific ice content tendency because of condensation [kg/kg/s]
     220  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqi_mix        !--specific ice content tendency because of cloud mixing [kg/kg/s]
     221  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqvc_adj       !--specific cloud water vapor tendency because of temperature adjustment [kg/kg/s]
     222  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqvc_sub       !--specific cloud water vapor tendency because of sublimation [kg/kg/s]
     223  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqvc_con       !--specific cloud water vapor tendency because of condensation [kg/kg/s]
     224  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqvc_mix       !--specific cloud water vapor tendency because of cloud mixing [kg/kg/s]
     225  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qsatl          !--saturation specific humidity wrt liquid [kg/kg]
     226  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qsati          !--saturation specific humidity wrt ice [kg/kg] 
     227
     228  ! for contrails and aviation
     229
     230  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: Tcontr         !--threshold temperature for contrail formation [K]
     231  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qcontr         !--threshold humidity for contrail formation [kg/kg]
     232  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: qcontr2        !--// (2nd expression more consistent with LMDZ expression of q)
     233  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: fcontrN        !--fraction of grid favourable to non-persistent contrails
     234  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: fcontrP        !--fraction of grid favourable to persistent contrails
     235  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dcf_avi        !--cloud fraction tendency because of aviation [s-1]
     236  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqi_avi        !--specific ice content tendency because of aviation [kg/kg/s]
     237  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqvc_avi       !--specific cloud water vapor tendency because of aviation [kg/kg/s]
     238
    211239
    212240  ! for POPRECIP
     
    225253  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqsfreez       !--snow tendency due to freezing [kg/kg/s]
    226254  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: dqrfreez       !--rain tendency due to freezing [kg/kg/s]
     255
     256  ! for thermals
     257
     258  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: cloudth_sth      !--mean saturation deficit in thermals
     259  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: cloudth_senv     !--mean saturation deficit in environment
     260  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: cloudth_sigmath  !--std of saturation deficit in thermals
     261  REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: cloudth_sigmaenv !--std of saturation deficit in environment
    227262
    228263
     
    291326  REAL, DIMENSION(klon) :: zdistcltop, ztemp_cltop
    292327  REAL, DIMENSION(klon) :: zqliq, zqice, zqvapcl        ! for icefrac_lscp_turb
     328 
     329  ! for condensation and ice supersaturation
     330  REAL, DIMENSION(klon) :: qvc, shear
     331  REAL :: delta_z
     332  !--Added for ice supersaturation (ok_ice_supersat) and contrails (ok_plane_contrails)
     333  ! Constants used for calculating ratios that are advected (using a parent-child
     334  ! formalism). This is not done in the dynamical core because at this moment,
     335  ! only isotopes can use this parent-child formalism. Note that the two constants
     336  ! are the same as the one use in the dynamical core, being also defined in
     337  ! dyn3d_common/infotrac.F90
     338  REAL :: min_qParent, min_ratio
    293339
    294340  INTEGER i, k, n, kk, iter
     
    376422ztemp_cltop(:) = 0.0
    377423ztupnew(:)=0.0
    378 !--ice supersaturation
    379 gamma_ss(:,:) = 1.0
    380 qss(:,:) = 0.0
    381 rnebss(:,:) = 0.0
    382 Tcontr(:,:) = missing_val
    383 qcontr(:,:) = missing_val
    384 qcontr2(:,:) = missing_val
    385 fcontrN(:,:) = 0.0
    386 fcontrP(:,:) = 0.0
     424
    387425distcltop(:,:)=0.
    388426temp_cltop(:,:)=0.
     427
     428!--Ice supersaturation
     429gamma_cond(:,:) = 1.
     430qissr(:,:)      = 0.
     431issrfra(:,:)    = 0.
     432dcf_sub(:,:)    = 0.
     433dcf_con(:,:)    = 0.
     434dcf_mix(:,:)    = 0.
     435dqi_adj(:,:)    = 0.
     436dqi_sub(:,:)    = 0.
     437dqi_con(:,:)    = 0.
     438dqi_mix(:,:)    = 0.
     439dqvc_adj(:,:)   = 0.
     440dqvc_sub(:,:)   = 0.
     441dqvc_con(:,:)   = 0.
     442dqvc_mix(:,:)   = 0.
     443fcontrN(:,:)    = 0.
     444fcontrP(:,:)    = 0.
     445Tcontr(:,:)     = missing_val
     446qcontr(:,:)     = missing_val
     447qcontr2(:,:)    = missing_val
     448dcf_avi(:,:)    = 0.
     449dqi_avi(:,:)    = 0.
     450dqvc_avi(:,:)   = 0.
     451qvc(:)          = 0.
     452shear(:)        = 0.
     453min_qParent     = 1.e-30
     454min_ratio       = 1.e-16
    389455
    390456!-- poprecip
     
    777843                    rneblsvol(i,k)=ctot_vol(i,k)
    778844                    zqn(i)=qcloud(i)
     845                    !--AB grid-mean vapor in the cloud - we assume saturation adjustment
     846                    qvc(i) = rneb(i,k) * zqs(i)
    779847                ENDDO
    780848
     
    812880        DO iter=1,iflag_fisrtilp_qsat+1
    813881
     882                keepgoing(:) = .FALSE.
     883
    814884                DO i=1,klon
    815885
    816886                    ! keepgoing = .true. while convergence is not satisfied
    817                     keepgoing(i)=ABS(DT(i)).GT.DDT0
    818 
    819                     IF ((keepgoing(i) .OR. (n_i(i) .EQ. 0)) .AND. lognormale(i)) THEN
     887
     888                    IF (((ABS(DT(i)).GT.DDT0) .OR. (n_i(i) .EQ. 0)) .AND. lognormale(i)) THEN
    820889
    821890                        ! if not convergence:
     891                        ! we calculate a new iteration
     892                        keepgoing(i) = .TRUE.
    822893
    823894                        ! P2.2.1> cloud fraction and condensed water mass calculation
     
    852923                  CALL icefrac_lscp(klon, zt(:), iflag_ice_thermo, zdistcltop(:),ztemp_cltop(:),zfice(:),dzfice(:))
    853924
     925                  !--AB Activates a condensation scheme that allows for
     926                  !--ice supersaturation and contrails evolution from aviation
     927                  IF (ok_ice_supersat) THEN
     928
     929                    !--Calculate the shear value (input for condensation and ice supersat)
     930                    DO i = 1, klon
     931                      !--Cell thickness [m]
     932                      delta_z = ( paprs(i,k) - paprs(i,k+1) ) / RG / pplay(i,k) * Tbef(i) * RD
     933                      IF ( iftop ) THEN
     934                        ! top
     935                        shear(i) = SQRT( ( (u_seri(i,k) - u_seri(i,k-1)) / delta_z )**2. &
     936                                       + ( (v_seri(i,k) - v_seri(i,k-1)) / delta_z )**2. )
     937                      ELSEIF ( k .EQ. 1 ) THEN
     938                        ! surface
     939                        shear(i) = SQRT( ( (u_seri(i,k+1) - u_seri(i,k)) / delta_z )**2. &
     940                                       + ( (v_seri(i,k+1) - v_seri(i,k)) / delta_z )**2. )
     941                      ELSE
     942                        ! other layers
     943                        shear(i) = SQRT( ( ( (u_seri(i,k+1) + u_seri(i,k)) / 2. &
     944                                           - (u_seri(i,k) + u_seri(i,k-1)) / 2. ) / delta_z )**2. &
     945                                       + ( ( (v_seri(i,k+1) + v_seri(i,k)) / 2. &
     946                                           - (v_seri(i,k) + v_seri(i,k-1)) / 2. ) / delta_z )**2. )
     947                      ENDIF
     948                    ENDDO
     949
     950                    !---------------------------------------------
     951                    !--   CONDENSATION AND ICE SUPERSATURATION  --
     952                    !---------------------------------------------
     953
     954                    CALL condensation_ice_supersat( &
     955                        klon, dtime, missing_val, &
     956                        pplay(:,k), paprs(:,k), paprs(:,k+1), &
     957                        cf_seri(:,k), rvc_seri(:,k), ratio_qi_qtot(:,k), &
     958                        shear(:), tke_dissip(:,k), cell_area(:), &
     959                        Tbef(:), zq(:), zqs(:), gammasat(:), ratqs(:,k), keepgoing(:), &
     960                        rneb(:,k), zqn(:), qvc(:), issrfra(:,k), qissr(:,k), &
     961                        dcf_sub(:,k), dcf_con(:,k), dcf_mix(:,k), &
     962                        dqi_adj(:,k), dqi_sub(:,k), dqi_con(:,k), dqi_mix(:,k), &
     963                        dqvc_adj(:,k), dqvc_sub(:,k), dqvc_con(:,k), dqvc_mix(:,k), &
     964                        Tcontr(:,k), qcontr(:,k), qcontr2(:,k), fcontrN(:,k), fcontrP(:,k), &
     965                        flight_dist(:,k), flight_h2o(:,k), &
     966                        dcf_avi(:,k), dqi_avi(:,k), dqvc_avi(:,k))
     967
     968
     969                  !--If .TRUE., calls an externalised version of the generalised
     970                  !--lognormal condensation scheme (Bony and Emanuel 2001)
     971                  !--Numerically, convergence is conserved with this option
     972                  !--The objective is to simplify LSCP
     973                  ELSEIF ( ok_external_lognormal ) THEN
     974                         
     975                   CALL condensation_lognormal( &
     976                       klon, Tbef(:), zq(:), zqs(:), gammasat(:), ratqs(:,k), &
     977                       keepgoing(:), rneb(:,k), zqn(:), qvc(:))
     978
     979
     980                 ELSE !--Generalised lognormal (Bony and Emanuel 2001)
     981
    854982                  DO i=1,klon !todoan : check if loop in i is needed
    855983
    856                       IF ((keepgoing(i) .OR. (n_i(i) .EQ. 0)) .AND. lognormale(i)) THEN
     984                      IF (keepgoing(i)) THEN
    857985
    858986                        zpdf_sig(i)=ratqs(i,k)*zq(i)
     
    868996                        zpdf_e2(i)=1.-erf(zpdf_e2(i))
    869997
    870                         IF ((.NOT.ok_ice_sursat).OR.(Tbef(i).GT.t_glace_min)) THEN
    871 
    872998                          IF (zpdf_e1(i).LT.1.e-10) THEN
    873999                              rneb(i,k)=0.
    874                               zqn(i)=gammasat(i)*zqs(i)
     1000                              zqn(i)=zqs(i)
     1001                              !--AB grid-mean vapor in the cloud - we assume saturation adjustment
     1002                              qvc(i) = 0.
    8751003                          ELSE
    8761004                              rneb(i,k)=0.5*zpdf_e1(i)
    8771005                              zqn(i)=zq(i)*zpdf_e2(i)/zpdf_e1(i)
     1006                              !--AB grid-mean vapor in the cloud - we assume saturation adjustment
     1007                              qvc(i) = rneb(i,k) * zqs(i)
    8781008                          ENDIF
    8791009
    880                           rnebss(i,k)=0.0   !--added by OB (needed because of the convergence loop on time)
    881                           fcontrN(i,k)=0.0  !--idem
    882                           fcontrP(i,k)=0.0  !--idem
    883                           qss(i,k)=0.0      !--idem
    884 
    885                        ELSE ! in case of ice supersaturation by Audran
    886 
    887                         !------------------------------------
    888                         ! ICE SUPERSATURATION
    889                         !------------------------------------
    890 
    891                         CALL ice_sursat(pplay(i,k), paprs(i,k)-paprs(i,k+1), dtime, i, k, temp(i,k), zq(i), &
    892                              gamma_ss(i,k), zqs(i), Tbef(i), rneb_seri(i,k), ratqs(i,k),                 &
    893                              rneb(i,k), zqn(i), rnebss(i,k), qss(i,k),                                   &
    894                              Tcontr(i,k), qcontr(i,k), qcontr2(i,k), fcontrN(i,k), fcontrP(i,k) )
    895 
    896                         ENDIF ! ((flag_ice_sursat.eq.0).or.(Tbef(i).gt.t_glace_min))
     1010                      ENDIF ! keepgoing
     1011                  ENDDO ! loop on klon
     1012
     1013                  ENDIF ! .NOT. ok_ice_supersat
     1014
     1015                  DO i=1,klon
     1016                      IF (keepgoing(i)) THEN
    8971017
    8981018                        ! If vertical heterogeneity, change fraction by volume as well
     
    9171037                       
    9181038                        ! LEA_R : check formule
    919                         qlbef(i)=max(0.,zqn(i)-zqs(i))
     1039                        IF ( ok_unadjusted_clouds ) THEN
     1040                          !--AB We relax the saturation adjustment assumption
     1041                          !-- qvc (grid-mean vapor in cloud) is calculated by the condensation scheme
     1042                          IF ( rneb(i,k) .GT. eps ) THEN
     1043                            qlbef(i) = MAX(0., zqn(i) - qvc(i) / rneb(i,k))
     1044                          ELSE
     1045                            qlbef(i) = 0.
     1046                          ENDIF
     1047                        ELSE
     1048                          qlbef(i)=max(0.,zqn(i)-zqs(i))
     1049                        ENDIF
     1050
    9201051                        num = -Tbef(i)+zt(i)+rneb(i,k)*((1-zfice(i))*RLVTT &
    9211052                              +zfice(i)*RLSTT)/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i)))*qlbef(i)
     
    9531084
    9541085        ! Partition function depending on temperature
    955         CALL icefrac_lscp(klon,zt,iflag_ice_thermo, zdistcltop,ztemp_cltop,zfice,dzfice)
     1086        CALL icefrac_lscp(klon, zt, iflag_ice_thermo, zdistcltop, ztemp_cltop, zfice, dzfice)
    9561087
    9571088        ! Partition function depending on tke for non shallow-convective clouds
     
    9841115                    zqn(i) = zq(i)
    9851116                    rneb(i,k) = 1.0
    986                     zcond(i) = MAX(0.0,zqn(i)-zqs(i))
     1117                    IF ( ok_unadjusted_clouds ) THEN
     1118                      !--AB We relax the saturation adjustment assumption
     1119                      !-- qvc (grid-mean vapor in cloud) is calculated by the condensation scheme
     1120                      zcond(i) = MAX(0., zqn(i) - qvc(i))
     1121                    ELSE
     1122                      zcond(i) = MAX(0.0,zqn(i)-zqs(i))
     1123                    ENDIF
    9871124                    rhcl(i,k)=1.0
    9881125                ELSE
    989                     zcond(i) = MAX(0.0,zqn(i)-zqs(i))*rneb(i,k)
     1126                    IF ( ok_unadjusted_clouds ) THEN
     1127                      !--AB We relax the saturation adjustment assumption
     1128                      !-- qvc (grid-mean vapor in cloud) is calculated by the condensation scheme
     1129                      zcond(i) = MAX(0., zqn(i) * rneb(i,k) - qvc(i))
     1130                    ELSE
     1131                      zcond(i) = MAX(0.0,zqn(i)-zqs(i))*rneb(i,k)
     1132                    ENDIF
    9901133                    ! following line is very strange and probably wrong:
    9911134                    rhcl(i,k)=(zqs(i)+zq(i))/2./zqs(i)
     
    10191162          rneblsvol(1:klon,k)=ctot_vol(1:klon,k)
    10201163        ENDIF
     1164   
     1165    !--AB Write diagnostics and tracers for ice supersaturation
     1166    IF ( ok_ice_supersat ) THEN
     1167      CALL calc_qsat_ecmwf(klon,zt,qzero,pplay(:,k),RTT,1,.false.,qsatl(:,k),zdqs)
     1168      CALL calc_qsat_ecmwf(klon,zt,qzero,pplay(:,k),RTT,2,.false.,qsati(:,k),zdqs)
     1169
     1170      DO i = 1, klon
     1171
     1172        cf_seri(i,k) = rneb(i,k)
     1173
     1174        IF ( .NOT. ok_unadjusted_clouds ) THEN
     1175          qvc(i) = zqs(i) * rneb(i,k)
     1176        ENDIF
     1177        IF ( zq(i) .GT. min_qParent ) THEN
     1178          rvc_seri(i,k) = qvc(i) / zq(i)
     1179        ELSE
     1180          rvc_seri(i,k) = min_ratio
     1181        ENDIF
     1182        !--The MIN barrier is NEEDED because of:
     1183        !-- 1) very rare pathological cases of the lsc scheme (rvc = 1. + 1e-16 sometimes)
     1184        !-- 2) the thermal scheme does NOT guarantee that qvc <= qvap (or even qincld <= qtot)
     1185        !--The MAX barrier is a safeguard that should not be activated
     1186        rvc_seri(i,k) = MIN(MAX(rvc_seri(i,k), 0.), 1.)
     1187
     1188        !--Diagnostics
     1189        gamma_cond(i,k) = gammasat(i)
     1190        IF ( issrfra(i,k) .LT. eps ) THEN
     1191          issrfra(i,k) = 0.
     1192          qissr(i,k) = 0.
     1193        ENDIF
     1194        subfra(i,k) = 1. - cf_seri(i,k) - issrfra(i,k)
     1195        qsub(i,k) = zq(i) - qvc(i) - qissr(i,k)
     1196        IF ( subfra(i,k) .LT. eps ) THEN
     1197          subfra(i,k) = 0.
     1198          qsub(i,k) = 0.
     1199        ENDIF
     1200        qcld(i,k) = qvc(i) + zcond(i)
     1201        IF ( cf_seri(i,k) .LT. eps ) THEN
     1202          qcld(i,k) = 0.
     1203        ENDIF
     1204      ENDDO
     1205    ENDIF
     1206
    10211207
    10221208    ! ----------------------------------------------------------------
     
    14401626    ENDDO
    14411627
    1442     !--save some variables for ice supersaturation
    1443     !
    1444     DO i = 1, klon
    1445         ! for memory
    1446         rneb_seri(i,k) = rneb(i,k)
    1447 
    1448         ! for diagnostics
    1449         rnebclr(i,k) = 1.0 - rneb(i,k) - rnebss(i,k)
    1450 
    1451         qvc(i,k) = zqs(i) * rneb(i,k)
    1452         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
    1453         qcld(i,k) = qvc(i,k) + zcond(i)
    1454    ENDDO
    1455    !q_sat
    1456    CALL calc_qsat_ecmwf(klon,Tbef(:),qzero(:),pplay(:,k),RTT,1,.false.,qsatl(:,k),zdqs(:))
    1457    CALL calc_qsat_ecmwf(klon,Tbef(:),qzero(:),pplay(:,k),RTT,2,.false.,qsats(:,k),zdqs(:))
    1458 
    1459 
    1460 
    14611628    ! Outputs:
    14621629    !-------------------------------
  • LMDZ6/trunk/libf/phylmd/lmdz_lscp_ini.F90

    r5007 r5204  
    66  !--------------------
    77 
    8   REAL RCPD, RLSTT, RLVTT, RLMLT, RVTMP2, RTT, RD, RG, RV, RPI
    9   !$OMP THREADPRIVATE(RCPD, RLSTT, RLVTT, RLMLT, RVTMP2, RTT, RD, RG, RV, RPI)
     8  REAL RCPD, RLSTT, RLVTT, RLMLT, RVTMP2, RTT, RD, RV, RG, RPI, EPS_W
     9  !$OMP THREADPRIVATE(RCPD, RLSTT, RLVTT, RLMLT, RVTMP2, RTT, RD, RV, RG, RPI, EPS_W)
    1010 
    1111  REAL, SAVE, PROTECTED :: seuil_neb=0.001      ! cloud fraction threshold: a cloud can precipitate when exceeded
     
    4040  !$OMP THREADPRIVATE(ztfondue)
    4141
    42   REAL, SAVE, PROTECTED :: temp_nowater=233.15  ! temperature below which liquid water no longer exists
     42  REAL, SAVE, PROTECTED :: temp_nowater=235.15  ! temperature below which liquid water no longer exists
    4343  !$OMP THREADPRIVATE(temp_nowater)
    4444
     
    140140  !$OMP THREADPRIVATE(dist_liq)
    141141
    142   REAL, SAVE, PROTECTED    :: tresh_cl=0.0                  ! cloud fraction threshold for cloud top search
     142  REAL, SAVE, PROTECTED  :: tresh_cl=0.0                  ! cloud fraction threshold for cloud top search
    143143  !$OMP THREADPRIVATE(tresh_cl)
     144
     145  !--Parameters for condensation and ice supersaturation
     146  LOGICAL, SAVE, PROTECTED :: ok_external_lognormal=.FALSE.  ! if True, the lognormal condensation scheme is calculated in the lmdz_lscp_condensation routine
     147  !$OMP THREADPRIVATE(ok_external_lognormal)
     148
     149  LOGICAL, SAVE, PROTECTED :: ok_ice_supersat=.FALSE.        ! activates the condensation scheme that allows for ice supersaturation
     150  !$OMP THREADPRIVATE(ok_ice_supersat)
     151
     152  LOGICAL, SAVE, PROTECTED :: ok_unadjusted_clouds=.FALSE.   ! if True, relax the saturation adjustment assumption for ice clouds
     153  !$OMP THREADPRIVATE(ok_unadjusted_clouds)
     154
     155  LOGICAL, SAVE, PROTECTED :: ok_weibull_warm_clouds=.FALSE. ! if True, the weibull condensation scheme replaces the lognormal condensation scheme at positive temperatures
     156  !$OMP THREADPRIVATE(ok_weibull_warm_clouds)
     157
     158  INTEGER, SAVE, PROTECTED :: iflag_cloud_sublim_pdf=3       ! iflag for the distribution of water inside ice clouds
     159  !$OMP THREADPRIVATE(iflag_cloud_sublim_pdf)
     160
     161  REAL, SAVE, PROTECTED :: depo_coef_cirrus=.5               ! [-] deposition coefficient for growth of ice crystals in cirrus clouds
     162  !$OMP THREADPRIVATE(depo_coef_cirrus)
     163
     164  REAL, SAVE, PROTECTED :: capa_cond_cirrus=.5               ! [-] capacitance factor for growth/sublimation of ice crystals in cirrus clouds
     165  !$OMP THREADPRIVATE(capa_cond_cirrus)
     166
     167  REAL, SAVE, PROTECTED :: mu_subl_pdf_lscp=1./3.            ! [-] shape factor of the gamma distribution of water inside ice clouds
     168  !$OMP THREADPRIVATE(mu_subl_pdf_lscp)
     169 
     170  REAL, SAVE, PROTECTED :: beta_pdf_lscp=8.75E-4             ! [] tuning coefficient for the standard deviation of the PDF of water vapor in the clear sky region
     171  !$OMP THREADPRIVATE(beta_pdf_lscp)
     172 
     173  REAL, SAVE, PROTECTED :: temp_thresh_pdf_lscp=188.         ! [K] factor for the PDF fit of water vapor in UTLS - below this temperature, water vapor is homogeneously distributed in the clear sky region
     174  !$OMP THREADPRIVATE(temp_thresh_pdf_lscp)
     175 
     176  REAL, SAVE, PROTECTED :: rhlmid_pdf_lscp=52.8              ! [%] factor for the PDF fit of water vapor in UTLS - below this rel hum wrt liq, std increases with RHliq, above it decreases with RHliq
     177  !$OMP THREADPRIVATE(rhlmid_pdf_lscp)
     178 
     179  REAL, SAVE, PROTECTED :: k0_pdf_lscp=2.80                  ! [-] factor for the PDF fit of water vapor in UTLS
     180  !$OMP THREADPRIVATE(k0_pdf_lscp)
     181 
     182  REAL, SAVE, PROTECTED :: kappa_pdf_lscp=0.0236             ! [] factor for the PDF fit of water vapor in UTLS
     183  !$OMP THREADPRIVATE(kappa_pdf_lscp)
     184 
     185  REAL, SAVE, PROTECTED :: rhl0_pdf_lscp=88.7                ! [%] factor for the PDF fit of water vapor in UTLS
     186  !$OMP THREADPRIVATE(rhl0_pdf_lscp)
     187 
     188  REAL, SAVE, PROTECTED :: cond_thresh_pdf_lscp=1.E-10       ! [-] threshold for the formation of new cloud
     189  !$OMP THREADPRIVATE(cond_thresh_pdf_lscp)
     190 
     191  REAL, SAVE, PROTECTED :: a_homofreez=2.349                 ! [-] factor for the Koop homogeneous freezing fit
     192  !$OMP THREADPRIVATE(a_homofreez)
     193 
     194  REAL, SAVE, PROTECTED :: b_homofreez=259.                  ! [K] factor for the Koop homogeneous freezing fit
     195  !$OMP THREADPRIVATE(b_homofreez)
     196
     197  REAL, SAVE, PROTECTED :: delta_hetfreez=1.                 ! [-] value between 0 and 1 to simulate for heterogeneous freezing.
     198  !$OMP THREADPRIVATE(delta_hetfreez)
     199 
     200  REAL, SAVE, PROTECTED :: coef_mixing_lscp=1e-7             ! [-] tuning coefficient for the mixing process
     201  !$OMP THREADPRIVATE(coef_mixing_lscp)
     202 
     203  REAL, SAVE, PROTECTED :: coef_shear_lscp=0.1               ! [-] additional coefficient for the shearing process (subprocess of the mixing process)
     204  !$OMP THREADPRIVATE(coef_shear_lscp)
     205 
     206  REAL, SAVE, PROTECTED :: chi_mixing_lscp=1.1               ! [-] factor for the macro distribution of ISSRs wrt clouds in a gridbox
     207  !$OMP THREADPRIVATE(chi_mixing_lscp)
     208
     209!  REAL, SAVE, PROTECTED :: contrail_cross_section=200000.
     210!  !$OMP THREADPRIVATE(contrail_cross_section)
     211  !--End of the parameters for condensation and ice supersaturation
    144212
    145213  !--Parameters for poprecip
     
    247315CONTAINS
    248316
    249 SUBROUTINE lscp_ini(dtime,lunout_in,prt_level_in,ok_ice_sursat, iflag_ratqs, fl_cor_ebil_in, RCPD_in, RLSTT_in, RLVTT_in, RLMLT_in, &
    250                     RVTMP2_in, RTT_in,RD_in,RG_in,RV_in,RPI_in)
     317SUBROUTINE lscp_ini(dtime,lunout_in,prt_level_in,ok_ice_supersat_in, iflag_ratqs, fl_cor_ebil_in, &
     318                    RCPD_in, RLSTT_in, RLVTT_in, RLMLT_in, RVTMP2_in, &
     319                    RTT_in, RD_in, RV_in, RG_in, RPI_in, EPS_W_in)
    251320
    252321
    253322   USE ioipsl_getin_p_mod, ONLY : getin_p
    254    USE ice_sursat_mod, ONLY: ice_sursat_init
    255323   USE lmdz_cloudth_ini, ONLY : cloudth_ini
    256324
    257325   REAL, INTENT(IN)      :: dtime
    258326   INTEGER, INTENT(IN)   :: lunout_in,prt_level_in,iflag_ratqs,fl_cor_ebil_in
    259    LOGICAL, INTENT(IN)   :: ok_ice_sursat
     327   LOGICAL, INTENT(IN)   :: ok_ice_supersat_in
    260328
    261329   REAL, INTENT(IN)      :: RCPD_in, RLSTT_in, RLVTT_in, RLMLT_in
    262    REAL, INTENT(IN)      ::  RVTMP2_in, RTT_in, RD_in, RG_in, RV_in, RPI_in
     330   REAL, INTENT(IN)      :: RVTMP2_in, RTT_in, RD_in, RV_in, RG_in, RPI_in, EPS_W_in
    263331   character (len=20) :: modname='lscp_ini_mod'
    264332   character (len=80) :: abort_message
     
    269337    fl_cor_ebil=fl_cor_ebil_in
    270338
     339    ok_ice_supersat=ok_ice_supersat_in
     340
    271341    RG=RG_in
    272342    RD=RD_in
     343    RV=RV_in
    273344    RCPD=RCPD_in
    274345    RLVTT=RLVTT_in
     
    279350    RVTMP2=RVTMP2_in
    280351    RPI=RPI_in
     352    EPS_W=EPS_W_in
    281353
    282354
     
    326398    CALL getin_p('gamma_taud',gamma_taud)
    327399    CALL getin_p('iflag_oldbug_fisrtilp',iflag_oldbug_fisrtilp)
     400    CALL getin_p('temp_nowater',temp_nowater)
     401    ! for poprecip
    328402    CALL getin_p('ok_poprecip',ok_poprecip)
    329403    CALL getin_p('ok_corr_vap_evasub',ok_corr_vap_evasub)
     
    345419    CALL getin_p('snow_fallspeed_clr',snow_fallspeed_clr)
    346420    CALL getin_p('snow_fallspeed_cld',snow_fallspeed_cld)
     421    ! for condensation and ice supersaturation
     422    CALL getin_p('ok_external_lognormal',ok_external_lognormal)
     423    CALL getin_p('ok_unadjusted_clouds',ok_unadjusted_clouds)
     424    CALL getin_p('ok_weibull_warm_clouds',ok_weibull_warm_clouds)
     425    CALL getin_p('iflag_cloud_sublim_pdf',iflag_cloud_sublim_pdf)
     426    CALL getin_p('depo_coef_cirrus',depo_coef_cirrus)
     427    CALL getin_p('capa_cond_cirrus',capa_cond_cirrus)
     428    CALL getin_p('mu_subl_pdf_lscp',mu_subl_pdf_lscp)
     429    CALL getin_p('beta_pdf_lscp',beta_pdf_lscp)
     430    CALL getin_p('temp_thresh_pdf_lscp',temp_thresh_pdf_lscp)
     431    CALL getin_p('rhlmid_pdf_lscp',rhlmid_pdf_lscp)
     432    CALL getin_p('k0_pdf_lscp',k0_pdf_lscp)
     433    CALL getin_p('kappa_pdf_lscp',kappa_pdf_lscp)
     434    CALL getin_p('rhl0_pdf_lscp',rhl0_pdf_lscp)
     435    CALL getin_p('cond_thresh_pdf_lscp',cond_thresh_pdf_lscp)
     436    CALL getin_p('a_homofreez',a_homofreez)
     437    CALL getin_p('b_homofreez',b_homofreez)
     438    CALL getin_p('delta_hetfreez',delta_hetfreez)
     439    CALL getin_p('coef_mixing_lscp',coef_mixing_lscp)
     440    CALL getin_p('coef_shear_lscp',coef_shear_lscp)
     441    CALL getin_p('chi_mixing_lscp',chi_mixing_lscp)
     442    !CALL getin_p('contrail_cross_section',contrail_cross_section)
    347443
    348444
     
    390486    WRITE(lunout,*) 'lscp_ini, iflag_oldbug_fisrtilp', iflag_oldbug_fisrtilp
    391487    WRITE(lunout,*) 'lscp_ini, fl_cor_ebil', fl_cor_ebil
     488    WRITE(lunout,*) 'lscp_ini, temp_nowater', temp_nowater
     489    ! for poprecip
    392490    WRITE(lunout,*) 'lscp_ini, ok_poprecip', ok_poprecip
    393491    WRITE(lunout,*) 'lscp_ini, ok_corr_vap_evasub', ok_corr_vap_evasub
     
    403501    WRITE(lunout,*) 'lscp_ini, snow_fallspeed_clr:', snow_fallspeed_clr
    404502    WRITE(lunout,*) 'lscp_ini, snow_fallspeed_cld:', snow_fallspeed_cld
     503    ! for condensation and ice supersaturation
     504    WRITE(lunout,*) 'lscp_ini, ok_external_lognormal:', ok_external_lognormal
     505    WRITE(lunout,*) 'lscp_ini, ok_ice_supersat:', ok_ice_supersat
     506    WRITE(lunout,*) 'lscp_ini, ok_unadjusted_clouds:', ok_unadjusted_clouds
     507    WRITE(lunout,*) 'lscp_ini, ok_weibull_warm_clouds:', ok_weibull_warm_clouds
     508    WRITE(lunout,*) 'lscp_ini, iflag_cloud_sublim_pdf:', iflag_cloud_sublim_pdf
     509    WRITE(lunout,*) 'lscp_ini, depo_coef_cirrus:', depo_coef_cirrus
     510    WRITE(lunout,*) 'lscp_ini, capa_cond_cirrus:', capa_cond_cirrus
     511    WRITE(lunout,*) 'lscp_ini, mu_subl_pdf_lscp:', mu_subl_pdf_lscp
     512    WRITE(lunout,*) 'lscp_ini, beta_pdf_lscp:', beta_pdf_lscp
     513    WRITE(lunout,*) 'lscp_ini, temp_thresh_pdf_lscp:', temp_thresh_pdf_lscp
     514    WRITE(lunout,*) 'lscp_ini, rhlmid_pdf_lscp:', rhlmid_pdf_lscp
     515    WRITE(lunout,*) 'lscp_ini, k0_pdf_lscp:', k0_pdf_lscp
     516    WRITE(lunout,*) 'lscp_ini, kappa_pdf_lscp:', kappa_pdf_lscp
     517    WRITE(lunout,*) 'lscp_ini, rhl0_pdf_lscp:', rhl0_pdf_lscp
     518    WRITE(lunout,*) 'lscp_ini, a_homofreez:', a_homofreez
     519    WRITE(lunout,*) 'lscp_ini, b_homofreez:', b_homofreez
     520    WRITE(lunout,*) 'lscp_ini, delta_hetfreez', delta_hetfreez
     521    WRITE(lunout,*) 'lscp_ini, coef_mixing_lscp:', coef_mixing_lscp
     522    WRITE(lunout,*) 'lscp_ini, coef_shear_lscp:', coef_shear_lscp
     523    WRITE(lunout,*) 'lscp_ini, chi_mixing_lscp:', chi_mixing_lscp
     524!    WRITE(lunout,*) 'lscp_ini, contrail_cross_section:', contrail_cross_section
    405525
    406526
     
    425545
    426546
     547    !--Check flags for condensation and ice supersaturation
     548    IF ( ok_external_lognormal .AND. ok_ice_supersat ) THEN
     549      abort_message = 'in lscp, ok_external_lognormal=y is incompatible with ok_ice_supersat=y'
     550      CALL abort_physic (modname,abort_message,1)
     551    ENDIF
     552
     553    IF ( ok_weibull_warm_clouds .AND. .NOT. ok_ice_supersat ) THEN
     554      abort_message = 'in lscp, ok_weibull_warm_clouds=y needs ok_ice_supersat=y'
     555      CALL abort_physic (modname,abort_message,1)
     556    ENDIF
     557
     558    IF ( ok_unadjusted_clouds .AND. .NOT. ok_ice_supersat ) THEN
     559      abort_message = 'in lscp, ok_unadjusted_clouds=y needs ok_ice_supersat=y'
     560      CALL abort_physic (modname,abort_message,1)
     561    ENDIF
     562
     563
    427564    !AA Temporary initialisation
    428565    a_tr_sca(1) = -0.5
     
    431568    a_tr_sca(4) = -0.5
    432569   
    433     IF (ok_ice_sursat) CALL ice_sursat_init()
    434 
    435570    CALL cloudth_ini(iflag_cloudth_vert,iflag_ratqs)
    436571
  • LMDZ6/trunk/libf/phylmd/lmdz_lscp_poprecip.F90

    r5047 r5204  
    247247
    248248  ELSEIF ( ( rain(i) + snow(i) ) .LE. 0. ) THEN
    249 
    250249    !--If no precip, we reinitialize the cloud fraction used for the precip to 0
    251250    precipfraccld(i) = 0.
  • LMDZ6/trunk/libf/phylmd/lmdz_lscp_tools.F90

    r5170 r5204  
    581581!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    582582
    583     use lmdz_lscp_ini, only: iflag_gammasat, t_glace_min, RTT
     583    use lmdz_lscp_ini, only: iflag_gammasat, temp_nowater, RTT
     584    use lmdz_lscp_ini, only: a_homofreez, b_homofreez, delta_hetfreez
    584585
    585586    IMPLICIT NONE
     
    596597
    597598    REAL, DIMENSION(klon) ::  qsi,qsl,dqsl,dqsi
    598     REAL  fcirrus, fac
    599     REAL, PARAMETER :: acirrus=2.349
    600     REAL, PARAMETER :: bcirrus=259.0
     599    REAL  f_homofreez, fac
    601600
    602601    INTEGER i
     
    605604        CALL CALC_QSAT_ECMWF(klon,temp,qtot,pressure,RTT,2,.false.,qsi,dqsi)
    606605
    607     DO i=1,klon
    608 
    609         IF (temp(i) .GE. RTT) THEN
     606    DO i = 1, klon
     607
     608        IF ( temp(i) .GE. RTT ) THEN
    610609            ! warm clouds: condensation at saturation wrt liquid
    611             gammasat(i)=1.
    612             dgammasatdt(i)=0.
    613 
    614         ELSEIF ((temp(i) .LT. RTT) .AND. (temp(i) .GT. t_glace_min)) THEN
     610            gammasat(i) = 1.
     611            dgammasatdt(i) = 0.
     612
     613        ELSE
     614            ! cold clouds: qsi > qsl
    615615           
    616             IF (iflag_gammasat .GE. 2) THEN         
    617                gammasat(i)=qsl(i)/qsi(i)
    618                dgammasatdt(i)=(dqsl(i)*qsi(i)-dqsi(i)*qsl(i))/qsi(i)/qsi(i)
     616            ! homogeneous freezing of aerosols, according to
     617            ! Koop, 2000 and Ren and MacKenzie, 2005 (QJRMS)
     618            ! 'Cirrus regime'
     619            ! if f_homofreez > qsl / qsi, liquid nucleation
     620            ! if f_homofreez < qsl / qsi, homogeneous freezing of aerosols
     621            ! Note: f_homofreez = qsl / qsi for temp ~= -38degC
     622            f_homofreez = a_homofreez - temp(i) / b_homofreez
     623           
     624            IF ( iflag_gammasat .GE. 3 ) THEN
     625              ! condensation at homogeneous freezing threshold for temp < -38 degC
     626              ! condensation at liquid saturation for temp > -38 degC
     627              IF ( f_homofreez .LE. qsl(i) / qsi(i) ) THEN
     628                gammasat(i) = f_homofreez
     629                dgammasatdt(i) = - 1. / b_homofreez
     630              ELSE
     631                gammasat(i) = qsl(i) / qsi(i)
     632                dgammasatdt(i) = ( dqsl(i) * qsi(i) - dqsi(i) * qsl(i) ) / qsi(i) / qsi(i)
     633              ENDIF
     634
     635            ELSEIF ( iflag_gammasat .EQ. 2 ) THEN
     636              ! condensation at homogeneous freezing threshold for temp < -38 degC
     637              ! condensation at a threshold linearly decreasing between homogeneous
     638              ! freezing and ice saturation for -38 degC < temp < temp_nowater
     639              ! condensation at ice saturation for temp > temp_nowater
     640              ! If temp_nowater = 235.15 K, this is equivalent to iflag_gammasat = 1
     641              IF ( f_homofreez .LE. qsl(i) / qsi(i) ) THEN
     642                gammasat(i) = f_homofreez
     643                dgammasatdt(i) = - 1. / b_homofreez
     644              ELSEIF ( temp(i) .LE. temp_nowater ) THEN
     645                ! Here, we assume that f_homofreez = qsl / qsi for temp = -38 degC = 235.15 K
     646                dgammasatdt(i) = ( a_homofreez - 235.15 / b_homofreez - 1. ) &
     647                               / ( 235.15 - temp_nowater )
     648                gammasat(i) = dgammasatdt(i) * ( temp(i) - temp_nowater ) + 1.
     649              ELSE
     650                gammasat(i) = 1.
     651                dgammasatdt(i) = 0.
     652              ENDIF
     653
     654            ELSEIF ( iflag_gammasat .EQ. 1 ) THEN
     655              ! condensation at homogeneous freezing threshold for temp < -38 degC
     656              ! condensation at ice saturation for temp > -38 degC
     657              IF ( f_homofreez .LE. qsl(i) / qsi(i) ) THEN
     658                gammasat(i) = f_homofreez
     659                dgammasatdt(i) = - 1. / b_homofreez
     660              ELSE
     661                gammasat(i) = 1.
     662                dgammasatdt(i) = 0.
     663              ENDIF
     664
    619665            ELSE
    620                gammasat(i)=1.
    621                dgammasatdt(i)=0.
     666              ! condensation at ice saturation for temp < -38 degC
     667              ! condensation at ice saturation for temp > -38 degC
     668              gammasat(i) = 1.
     669              dgammasatdt(i) = 0.
     670
    622671            ENDIF
    623672
    624         ELSE
    625 
    626             IF (iflag_gammasat .GE.1) THEN
    627             ! homogeneous freezing of aerosols, according to
    628             ! Koop, 2000 and Karcher 2008, QJRMS
    629             ! 'Cirrus regime'
    630                fcirrus=acirrus-temp(i)/bcirrus
    631                IF (fcirrus .GT. qsl(i)/qsi(i)) THEN
    632                   gammasat(i)=qsl(i)/qsi(i)
    633                   dgammasatdt(i)=(dqsl(i)*qsi(i)-dqsi(i)*qsl(i))/qsi(i)/qsi(i)
    634                ELSE
    635                   gammasat(i)=fcirrus
    636                   dgammasatdt(i)=-1.0/bcirrus
    637                ENDIF
    638            
    639             ELSE
    640 
    641                gammasat(i)=1.
    642                dgammasatdt(i)=0.
    643 
    644             ENDIF
     673            ! Note that the delta_hetfreez parameter allows to linearly decrease the
     674            ! condensation threshold between the calculated threshold and the ice saturation
     675            ! for delta_hetfreez = 1, the threshold is the calculated condensation threshold
     676            ! for delta_hetfreez = 0, the threshold is the ice saturation
     677            gammasat(i) = ( 1. - delta_hetfreez ) + delta_hetfreez * gammasat(i)
     678            dgammasatdt(i) = delta_hetfreez * dgammasatdt(i)
    645679
    646680        ENDIF
     
    722756!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    723757
     758!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     759FUNCTION GAMMAINC ( p, x )
     760
     761!*****************************************************************************80
     762!
     763!! GAMMAINC computes the regularized lower incomplete Gamma Integral
     764!
     765!  Modified:
     766!
     767!    20 January 2008
     768!
     769!  Author:
     770!
     771!    Original FORTRAN77 version by B Shea.
     772!    FORTRAN90 version by John Burkardt.
     773!
     774!  Reference:
     775!
     776!    B Shea,
     777!    Algorithm AS 239:
     778!    Chi-squared and Incomplete Gamma Integral,
     779!    Applied Statistics,
     780!    Volume 37, Number 3, 1988, pages 466-473.
     781!
     782!  Parameters:
     783!
     784!    Input, real X, P, the parameters of the incomplete
     785!    gamma ratio.  0 <= X, and 0 < P.
     786!
     787!    Output, real GAMMAINC, the value of the incomplete
     788!    Gamma integral.
     789!
     790  IMPLICIT NONE
     791
     792  REAL A
     793  REAL AN
     794  REAL ARG
     795  REAL B
     796  REAL C
     797  REAL, PARAMETER :: ELIMIT = - 88.0E+00
     798  REAL GAMMAINC
     799  REAL, PARAMETER :: OFLO = 1.0E+37
     800  REAL P
     801  REAL, PARAMETER :: PLIMIT = 1000.0E+00
     802  REAL PN1
     803  REAL PN2
     804  REAL PN3
     805  REAL PN4
     806  REAL PN5
     807  REAL PN6
     808  REAL RN
     809  REAL, PARAMETER :: TOL = 1.0E-14
     810  REAL X
     811  REAL, PARAMETER :: XBIG = 1.0E+08
     812
     813  GAMMAINC = 0.0E+00
     814
     815  IF ( X == 0.0E+00 ) THEN
     816    GAMMAINC = 0.0E+00
     817    RETURN
     818  END IF
     819!
     820!  IF P IS LARGE, USE A NORMAL APPROXIMATION.
     821!
     822  IF ( PLIMIT < P ) THEN
     823
     824    PN1 = 3.0E+00 * SQRT ( P ) * ( ( X / P )**( 1.0E+00 / 3.0E+00 ) &
     825    + 1.0E+00 / ( 9.0E+00 * P ) - 1.0E+00 )
     826
     827    GAMMAINC = 0.5E+00 * ( 1. + ERF ( PN1 ) )
     828    RETURN
     829
     830  END IF
     831!
     832!  IF X IS LARGE SET GAMMAD = 1.
     833!
     834  IF ( XBIG < X ) THEN
     835    GAMMAINC = 1.0E+00
     836    RETURN
     837  END IF
     838!
     839!  USE PEARSON'S SERIES EXPANSION.
     840!  (NOTE THAT P IS NOT LARGE ENOUGH TO FORCE OVERFLOW IN ALOGAM).
     841!
     842  IF ( X <= 1.0E+00 .OR. X < P ) THEN
     843
     844    ARG = P * LOG ( X ) - X - LOG_GAMMA ( P + 1.0E+00 )
     845    C = 1.0E+00
     846    GAMMAINC = 1.0E+00
     847    A = P
     848
     849    DO
     850
     851      A = A + 1.0E+00
     852      C = C * X / A
     853      GAMMAINC = GAMMAINC + C
     854
     855      IF ( C <= TOL ) THEN
     856        EXIT
     857      END IF
     858
     859    END DO
     860
     861    ARG = ARG + LOG ( GAMMAINC )
     862
     863    IF ( ELIMIT <= ARG ) THEN
     864      GAMMAINC = EXP ( ARG )
     865    ELSE
     866      GAMMAINC = 0.0E+00
     867    END IF
     868!
     869!  USE A CONTINUED FRACTION EXPANSION.
     870!
     871  ELSE
     872
     873    ARG = P * LOG ( X ) - X - LOG_GAMMA ( P )
     874    A = 1.0E+00 - P
     875    B = A + X + 1.0E+00
     876    C = 0.0E+00
     877    PN1 = 1.0E+00
     878    PN2 = X
     879    PN3 = X + 1.0E+00
     880    PN4 = X * B
     881    GAMMAINC = PN3 / PN4
     882
     883    DO
     884
     885      A = A + 1.0E+00
     886      B = B + 2.0E+00
     887      C = C + 1.0E+00
     888      AN = A * C
     889      PN5 = B * PN3 - AN * PN1
     890      PN6 = B * PN4 - AN * PN2
     891
     892      IF ( PN6 /= 0.0E+00 ) THEN
     893
     894        RN = PN5 / PN6
     895
     896        IF ( ABS ( GAMMAINC - RN ) <= MIN ( TOL, TOL * RN ) ) THEN
     897          EXIT
     898        END IF
     899
     900        GAMMAINC = RN
     901
     902      END IF
     903
     904      PN1 = PN3
     905      PN2 = PN4
     906      PN3 = PN5
     907      PN4 = PN6
     908!
     909!  RE-SCALE TERMS IN CONTINUED FRACTION IF TERMS ARE LARGE.
     910!
     911      IF ( OFLO <= ABS ( PN5 ) ) THEN
     912        PN1 = PN1 / OFLO
     913        PN2 = PN2 / OFLO
     914        PN3 = PN3 / OFLO
     915        PN4 = PN4 / OFLO
     916      END IF
     917
     918    END DO
     919
     920    ARG = ARG + LOG ( GAMMAINC )
     921
     922    IF ( ELIMIT <= ARG ) THEN
     923      GAMMAINC = 1.0E+00 - EXP ( ARG )
     924    ELSE
     925      GAMMAINC = 1.0E+00
     926    END IF
     927
     928  END IF
     929
     930  RETURN
     931END FUNCTION GAMMAINC
     932!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     933
    724934END MODULE lmdz_lscp_tools
    725935
  • LMDZ6/trunk/libf/phylmd/phyetat0_mod.F90

    r5199 r5204  
    2121       du_gwd_rando, du_gwd_front, entr_therm, f0, fm_therm, &
    2222       falb_dir, falb_dif, prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien, &
    23        ftsol, pbl_tke, pctsrf, q_ancien, ql_ancien, qs_ancien, qbs_ancien, rneb_ancien, radpas, radsol, rain_fall, ratqs, &
     23       ftsol, pbl_tke, pctsrf, q_ancien, ql_ancien, qs_ancien, qbs_ancien, &
     24       cf_ancien, rvc_ancien, radpas, radsol, rain_fall, ratqs, &
    2425       rnebcon, rugoro, sig1, snow_fall, bs_fall, solaire_etat0, sollw, sollwdown, &
    2526       solsw, solswfdiff, t_ancien, u_ancien, v_ancien, w01, wake_cstar, wake_deltaq, &
     
    397398  ancien_ok=ancien_ok.AND.phyetat0_get(ql_ancien,"QLANCIEN","QLANCIEN",0.)
    398399  ancien_ok=ancien_ok.AND.phyetat0_get(qs_ancien,"QSANCIEN","QSANCIEN",0.)
    399   ancien_ok=ancien_ok.AND.phyetat0_get(rneb_ancien,"RNEBANCIEN","RNEBANCIEN",0.)
    400400  ancien_ok=ancien_ok.AND.phyetat0_get(u_ancien,"UANCIEN","UANCIEN",0.)
    401401  ancien_ok=ancien_ok.AND.phyetat0_get(v_ancien,"VANCIEN","VANCIEN",0.)
     
    412412     prbsw_ancien(:)=0.
    413413  ENDIF
     414 
     415  ! cas specifique des variables de la sursaturation par rapport a la glace
     416  IF ( ok_ice_supersat ) THEN
     417    ancien_ok=ancien_ok.AND.phyetat0_get(cf_ancien,"CFANCIEN","CFANCIEN",0.)
     418    ancien_ok=ancien_ok.AND.phyetat0_get(rvc_ancien,"RVCANCIEN","RVCANCIEN",0.)
     419  ELSE
     420    cf_ancien(:,:)=0.
     421    rvc_ancien(:,:)=0.
     422  ENDIF
    414423
    415424  ! Ehouarn: addtional tests to check if t_ancien, q_ancien contain
     
    419428       (maxval(ql_ancien).EQ.minval(ql_ancien))     .OR. &
    420429       (maxval(qs_ancien).EQ.minval(qs_ancien))     .OR. &
    421        (maxval(rneb_ancien).EQ.minval(rneb_ancien)) .OR. &
    422430       (maxval(prw_ancien).EQ.minval(prw_ancien))   .OR. &
    423431       (maxval(prlw_ancien).EQ.minval(prlw_ancien)) .OR. &
     
    432440       ancien_ok=.false.
    433441    ENDIF
     442  ENDIF
     443
     444  IF ( ok_ice_supersat ) THEN
     445    IF ( (maxval(cf_ancien).EQ.minval(cf_ancien))     .OR. &
     446         (maxval(rvc_ancien).EQ.minval(rvc_ancien)) ) THEN
     447       ancien_ok=.false.
     448     ENDIF
    434449  ENDIF
    435450
  • LMDZ6/trunk/libf/phylmd/phyredem.F90

    r4744 r5204  
    1919                                zval, rugoro, t_ancien, q_ancien,            &
    2020                                prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien,      &
    21                                 ql_ancien, qs_ancien, qbs_ancien, rneb_ancien, u_ancien, &
    22                                 v_ancien, clwcon, rnebcon, ratqs, pbl_tke,   &
     21                                ql_ancien, qs_ancien, qbs_ancien, cf_ancien, &
     22                                rvc_ancien, u_ancien, v_ancien,              &
     23                                clwcon, rnebcon, ratqs, pbl_tke,             &
    2324                                wake_delta_pbl_tke, zmax0, f0, sig1, w01,    &
    2425                                wake_deltat, wake_deltaq, wake_s, awake_s,   &
     
    252253    ENDIF
    253254
    254     CALL put_field(pass,"RNEBANCIEN", "RNEBANCIEN", rneb_ancien)
     255    IF ( ok_ice_supersat ) THEN
     256      CALL put_field(pass,"CFANCIEN", "CFANCIEN", cf_ancien)
     257      CALL put_field(pass,"RVCANCIEN", "RVCANCIEN", rvc_ancien)
     258    ENDIF
    255259
    256260    CALL put_field(pass,"PRWANCIEN", "PRWANCIEN", prw_ancien)
  • LMDZ6/trunk/libf/phylmd/phys_local_var_mod.F90

    r5188 r5204  
    2222      REAL, SAVE, ALLOCATABLE :: u_seri(:,:), v_seri(:,:)
    2323      !$OMP THREADPRIVATE(u_seri, v_seri)
    24       REAL, SAVE, ALLOCATABLE :: rneb_seri(:,:)
    25       !$OMP THREADPRIVATE(rneb_seri)
    26       REAL, SAVE, ALLOCATABLE :: d_rneb_dyn(:,:)
    27       !$OMP THREADPRIVATE(d_rneb_dyn)
     24      REAL, SAVE, ALLOCATABLE :: cf_seri(:,:), rvc_seri(:,:)
     25      !$OMP THREADPRIVATE(cf_seri, rvc_seri)
    2826      REAL, SAVE, ALLOCATABLE :: l_mixmin(:,:,:),l_mix(:,:,:),wprime(:,:,:)
    2927      !$OMP THREADPRIVATE(l_mixmin, l_mix, wprime)
     
    4442      REAL, SAVE, ALLOCATABLE :: d_u_dyn(:,:), d_v_dyn(:,:)
    4543      !$OMP THREADPRIVATE(d_u_dyn, d_v_dyn)
     44      REAL, SAVE, ALLOCATABLE :: d_cf_dyn(:,:), d_rvc_dyn(:,:)
     45      !$OMP THREADPRIVATE(d_cf_dyn, d_rvc_dyn)
    4646      REAL, SAVE, ALLOCATABLE :: d_tr_dyn(:,:,:)
    4747      !$OMP THREADPRIVATE(d_tr_dyn)
     
    639639!$OMP THREADPRIVATE(zn2mout)
    640640
    641       REAL, SAVE, ALLOCATABLE :: qclr(:,:)
    642       !$OMP THREADPRIVATE(qclr)
    643       REAL, SAVE, ALLOCATABLE :: qcld(:,:)
    644       !$OMP THREADPRIVATE(qcld)
    645       REAL, SAVE, ALLOCATABLE :: qss(:,:)
    646       !$OMP THREADPRIVATE(qss)
    647       REAL, SAVE, ALLOCATABLE :: qvc(:,:)
    648       !$OMP THREADPRIVATE(qvc)
    649       REAL, SAVE, ALLOCATABLE :: rnebclr(:,:)
    650       !$OMP THREADPRIVATE(rnebclr)
    651       REAL, SAVE, ALLOCATABLE :: rnebss(:,:)
    652       !$OMP THREADPRIVATE(rnebss)
    653       REAL, SAVE, ALLOCATABLE :: gamma_ss(:,:)
    654       !$OMP THREADPRIVATE(gamma_ss)
    655       REAL, SAVE, ALLOCATABLE :: N1_ss(:,:)
    656       !$OMP THREADPRIVATE(N1_ss)
    657       REAL, SAVE, ALLOCATABLE :: N2_ss(:,:)
    658       !$OMP THREADPRIVATE(N2_ss)
    659       REAL, SAVE, ALLOCATABLE :: drneb_sub(:,:)
    660       !$OMP THREADPRIVATE(drneb_sub)
    661       REAL, SAVE, ALLOCATABLE :: drneb_con(:,:)
    662       !$OMP THREADPRIVATE(drneb_con)
    663       REAL, SAVE, ALLOCATABLE :: drneb_tur(:,:)
    664       !$OMP THREADPRIVATE(drneb_tur)
    665       REAL, SAVE, ALLOCATABLE :: drneb_avi(:,:)
    666       !$OMP THREADPRIVATE(drneb_avi)
    667       REAL, SAVE, ALLOCATABLE :: zqsatl(:,:)
    668       !$OMP THREADPRIVATE(zqsatl)
    669       REAL, SAVE, ALLOCATABLE :: zqsats(:,:)
    670       !$OMP THREADPRIVATE(zqsats)
    671       REAL, SAVE, ALLOCATABLE :: Tcontr(:,:)
    672       !$OMP THREADPRIVATE(Tcontr)
    673       REAL, SAVE, ALLOCATABLE :: qcontr(:,:)
    674       !$OMP THREADPRIVATE(qcontr)
    675       REAL, SAVE, ALLOCATABLE :: qcontr2(:,:)
    676       !$OMP THREADPRIVATE(qcontr2)
    677       REAL, SAVE, ALLOCATABLE :: fcontrN(:,:)
    678       !$OMP THREADPRIVATE(fcontrN)
    679       REAL, SAVE, ALLOCATABLE :: fcontrP(:,:)
    680       !$OMP THREADPRIVATE(fcontrP)
     641!-- LSCP - condensation and ice supersaturation variables
     642      REAL, SAVE, ALLOCATABLE :: qsub(:,:), qissr(:,:), qcld(:,:)
     643      !$OMP THREADPRIVATE(qsub, qissr, qcld)
     644      REAL, SAVE, ALLOCATABLE :: subfra(:,:), issrfra(:,:)
     645      !$OMP THREADPRIVATE(subfra, issrfra)
     646      REAL, SAVE, ALLOCATABLE :: gamma_cond(:,:)
     647      !$OMP THREADPRIVATE(gamma_cond)
     648      REAL, SAVE, ALLOCATABLE :: ratio_qi_qtot(:,:)
     649      !$OMP THREADPRIVATE(ratio_qi_qtot)
     650      REAL, SAVE, ALLOCATABLE :: dcf_sub(:,:), dcf_con(:,:), dcf_mix(:,:)
     651      !$OMP THREADPRIVATE(dcf_sub, dcf_con, dcf_mix)
     652      REAL, SAVE, ALLOCATABLE :: dqi_adj(:,:), dqi_sub(:,:), dqi_con(:,:), dqi_mix(:,:)
     653      !$OMP THREADPRIVATE(dqi_adj, dqi_sub, dqi_con, dqi_mix)
     654      REAL, SAVE, ALLOCATABLE :: dqvc_adj(:,:), dqvc_sub(:,:), dqvc_con(:,:), dqvc_mix(:,:)
     655      !$OMP THREADPRIVATE(dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix)
     656      REAL, SAVE, ALLOCATABLE :: qsatliq(:,:), qsatice(:,:)
     657      !$OMP THREADPRIVATE(qsatliq, qsatice)
     658
     659!-- LSCP - aviation and contrails variables
     660      REAL, SAVE, ALLOCATABLE :: Tcontr(:,:), qcontr(:,:), qcontr2(:,:)
     661      !$OMP THREADPRIVATE(Tcontr, qcontr, qcontr2)
     662      REAL, SAVE, ALLOCATABLE :: fcontrN(:,:), fcontrP(:,:)
     663      !$OMP THREADPRIVATE(fcontrN, fcontrP)
     664      REAL, SAVE, ALLOCATABLE :: dcf_avi(:,:), dqi_avi(:,:), dqvc_avi(:,:)
     665      !$OMP THREADPRIVATE(dcf_avi, dqi_avi, dqvc_avi)
     666      REAL, SAVE, ALLOCATABLE :: flight_dist(:,:), flight_h2o(:,:)
     667      !$OMP THREADPRIVATE(flight_dist, flight_h2o)
     668
     669!-- LSCP - mixed phase clouds variables
    681670      REAL, SAVE, ALLOCATABLE :: distcltop(:,:)
    682671      !$OMP THREADPRIVATE(distcltop)
     
    684673      !$OMP THREADPRIVATE(temp_cltop)
    685674
    686 
    687 !--POPRECIP variables
     675!-- LSCP - POPRECIP variables
    688676      REAL, SAVE, ALLOCATABLE :: qraindiag(:,:)
    689677      !$OMP THREADPRIVATE(qraindiag)
     
    843831! SN
    844832      ALLOCATE(u_seri(klon,klev),v_seri(klon,klev))
     833      ALLOCATE(cf_seri(klon,klev),rvc_seri(klon,klev))
    845834      ALLOCATE(l_mixmin(klon,klev+1,nbsrf),l_mix(klon,klev+1,nbsrf),wprime(klon,klev+1,nbsrf))
    846835      ALLOCATE(pbl_eps(klon,klev+1,nbsrf+1))
     
    855844      ALLOCATE(d_q_dyn2d(klon),d_ql_dyn2d(klon),d_qs_dyn2d(klon), d_qbs_dyn2d(klon))
    856845      ALLOCATE(d_u_dyn(klon,klev),d_v_dyn(klon,klev))
     846      ALLOCATE(d_cf_dyn(klon,klev),d_rvc_dyn(klon,klev))
    857847      ALLOCATE(d_tr_dyn(klon,klev,nbtr))                   !RomP
    858848      ALLOCATE(d_t_con(klon,klev),d_q_con(klon,klev),d_q_con_zmasse(klon,klev))
     
    12181208      ALLOCATE(zn2mout(klon,6))
    12191209
    1220 ! Supersaturation
    1221       ALLOCATE(rneb_seri(klon,klev))
    1222       ALLOCATE(d_rneb_dyn(klon,klev))
    1223       ALLOCATE(qclr(klon,klev), qcld(klon,klev), qss(klon,klev), qvc(klon,klev))
    1224       ALLOCATE(rnebclr(klon,klev), rnebss(klon,klev), gamma_ss(klon,klev))
    1225       ALLOCATE(N1_ss(klon,klev), N2_ss(klon,klev))
    1226       ALLOCATE(drneb_sub(klon,klev), drneb_con(klon,klev), drneb_tur(klon,klev), drneb_avi(klon,klev))
    1227       ALLOCATE(zqsatl(klon,klev), zqsats(klon,klev))
    1228       ALLOCATE(Tcontr(klon,klev), qcontr(klon,klev), qcontr2(klon,klev), fcontrN(klon,klev), fcontrP(klon,klev))
    1229 
    1230 !--POPRECIP variables
     1210!-- LSCP - condensation and ice supersaturation variables
     1211      ALLOCATE(qsub(klon,klev), qissr(klon,klev), qcld(klon,klev))
     1212      ALLOCATE(subfra(klon,klev), issrfra(klon,klev))
     1213      ALLOCATE(gamma_cond(klon,klev), ratio_qi_qtot(klon,klev))
     1214      ALLOCATE(dcf_sub(klon,klev), dcf_con(klon,klev), dcf_mix(klon,klev))
     1215      ALLOCATE(dqi_adj(klon,klev), dqi_sub(klon,klev), dqi_con(klon,klev), dqi_mix(klon,klev))
     1216      ALLOCATE(dqvc_adj(klon,klev), dqvc_sub(klon,klev), dqvc_con(klon,klev), dqvc_mix(klon,klev))
     1217      ALLOCATE(qsatliq(klon,klev), qsatice(klon,klev))
     1218
     1219!-- LSCP - aviation and contrails variables
     1220      ALLOCATE(Tcontr(klon,klev), qcontr(klon,klev), qcontr2(klon,klev))
     1221      ALLOCATE(fcontrN(klon,klev), fcontrP(klon,klev))
     1222      ALLOCATE(dcf_avi(klon,klev), dqi_avi(klon,klev), dqvc_avi(klon,klev))
     1223      ALLOCATE(flight_dist(klon,klev), flight_h2o(klon,klev))
     1224
     1225!-- LSCP - POPRECIP variables
    12311226      ALLOCATE(qraindiag(klon,klev), qsnowdiag(klon,klev))
    12321227      ALLOCATE(dqreva(klon,klev), dqssub(klon,klev))
     
    12971292! SN
    12981293      DEALLOCATE(u_seri,v_seri)
     1294      DEALLOCATE(cf_seri,rvc_seri)
    12991295      DEALLOCATE(l_mixmin,l_mix,wprime)
    13001296      DEALLOCATE(tke_shear,tke_buoy,tke_trans)
     
    13061302      DEALLOCATE(d_q_dyn2d,d_ql_dyn2d,d_qs_dyn2d, d_qbs_dyn2d)
    13071303      DEALLOCATE(d_u_dyn,d_v_dyn)
     1304      DEALLOCATE(d_cf_dyn,d_rvc_dyn)
    13081305      DEALLOCATE(d_tr_dyn)                      !RomP
    13091306      DEALLOCATE(d_t_con,d_q_con,d_q_con_zmasse)
     
    16161613      DEALLOCATE(zn2mout)
    16171614
    1618 ! Supersaturation
    1619       DEALLOCATE(rneb_seri)
    1620       DEALLOCATE(d_rneb_dyn)
    1621       DEALLOCATE(qclr, qcld, qss, qvc)
    1622       DEALLOCATE(rnebclr, rnebss, gamma_ss)
    1623       DEALLOCATE(N1_ss, N2_ss)
    1624       DEALLOCATE(drneb_sub, drneb_con, drneb_tur, drneb_avi)
    1625       DEALLOCATE(zqsatl, zqsats)
    1626       DEALLOCATE(Tcontr, qcontr, qcontr2, fcontrN, fcontrP)
    1627 
    1628 !--POPRECIP variables
     1615!-- LSCP - condensation and ice supersaturation variables
     1616      DEALLOCATE(qsub, qissr, qcld)
     1617      DEALLOCATE(subfra, issrfra)
     1618      DEALLOCATE(gamma_cond, ratio_qi_qtot)
     1619      DEALLOCATE(dcf_sub, dcf_con, dcf_mix)
     1620      DEALLOCATE(dqi_adj, dqi_sub, dqi_con, dqi_mix)
     1621      DEALLOCATE(dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix)
     1622      DEALLOCATE(qsatliq, qsatice)
     1623
     1624!-- LSCP - aviation and contrails variables
     1625      DEALLOCATE(Tcontr, qcontr, qcontr2)
     1626      DEALLOCATE(fcontrN, fcontrP)
     1627      DEALLOCATE(dcf_avi, dqi_avi, dqvc_avi)
     1628      DEALLOCATE(flight_dist, flight_h2o)
     1629
     1630!-- LSCP - POPRECIP variables
    16291631      DEALLOCATE(qraindiag, qsnowdiag)
    16301632      DEALLOCATE(dqreva, dqssub)
  • LMDZ6/trunk/libf/phylmd/phys_output_ctrlout_mod.F90

    r5150 r5204  
    450450  TYPE(ctrl_out), SAVE :: o_SWdn200clr = ctrl_out((/ 10, 1, 10, 10, 10, 10, 11, 11, 11, 11/), &
    451451    'SWdn200clr', 'SWdn clear sky at 200mb', 'W/m2', (/ ('', i=1, 10) /))
    452 
    453   ! arajouter
    454   !  type(ctrl_out),save :: o_LWupTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11, 11/),'LWupTOA', &
    455   !    (/ ('', i=1, 10) /))
    456   !  type(ctrl_out),save :: o_LWupTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11, 11/),'LWupTOAclr', &
    457   !    (/ ('', i=1, 10) /))
     452  TYPE(ctrl_out), SAVE :: o_LWupTOA = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11, 11/), &
     453    'LWupTOA', 'LWup at TOA', 'W/m2', (/ ('', i=1, 10) /))
     454  TYPE(ctrl_out), SAVE :: o_LWupTOAclr = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11, 11/), &
     455    'LWupTOAclr', 'LWup clear sky at TOA', 'W/m2', (/ ('', i=1, 10) /))
    458456  !  type(ctrl_out),save :: o_LWdnTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11, 11/),'LWdnTOA', &
    459457  !    (/ ('', i=1, 10) /))
     
    21202118    'albslw3', 'Surface albedo LW3', '-', (/ ('', i=1, 10) /))
    21212119
    2122 !--aviation & supersaturation
    2123   TYPE(ctrl_out), SAVE :: o_oclr = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2124     'oclr', 'Clear sky total water', 'kg/kg', (/ ('', i=1, 10) /))
    2125   TYPE(ctrl_out), SAVE :: o_ocld = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2126     'ocld', 'Cloudy sky total water', 'kg/kg', (/ ('', i=1, 10) /))
    2127   TYPE(ctrl_out), SAVE :: o_oss = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2128     'oss', 'ISSR total water', 'kg/kg', (/ ('', i=1, 10) /))
    2129   TYPE(ctrl_out), SAVE :: o_ovc = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2130     'ovc', 'In-cloup vapor', 'kg/kg', (/ ('', i=1, 10) /))
    2131   TYPE(ctrl_out), SAVE :: o_rnebclr = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2132     'rnebclr', 'Clear sky fraction', '-', (/ ('', i=1, 10) /))
    2133   TYPE(ctrl_out), SAVE :: o_rnebss = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2134     'rnebss', 'ISSR fraction', '-', (/ ('', i=1, 10) /))
    2135   TYPE(ctrl_out), SAVE :: o_rnebseri = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2136     'rnebseri', 'Cloud fraction', '-', (/ ('', i=1, 10) /))
    2137   TYPE(ctrl_out), SAVE :: o_gammass = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2138     'gammass', 'Gamma supersaturation', '', (/ ('', i=1, 10) /))
    2139   TYPE(ctrl_out), SAVE :: o_N1_ss = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2140     'N1ss', 'N1', '', (/ ('', i=1, 10) /))
    2141   TYPE(ctrl_out), SAVE :: o_N2_ss = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2142     'N2ss', 'N2', '', (/ ('', i=1, 10) /))
    2143   TYPE(ctrl_out), SAVE :: o_drnebsub = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2144     'drnebsub', 'Cloud fraction change because of sublimation', 's-1', (/ ('', i=1, 10) /))
    2145   TYPE(ctrl_out), SAVE :: o_drnebcon = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2146     'drnebcon', 'Cloud fraction change because of condensation', 's-1', (/ ('', i=1, 10) /))
    2147   TYPE(ctrl_out), SAVE :: o_drnebtur = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2148     'drnebtur', 'Cloud fraction change because of turbulence', 's-1', (/ ('', i=1, 10) /))
    2149   TYPE(ctrl_out), SAVE :: o_drnebavi = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2150     'drnebavi', 'Cloud fraction change because of aviation', 's-1', (/ ('', i=1, 10) /))
    2151   TYPE(ctrl_out), SAVE :: o_qsatl = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2152     'qsatl', 'Saturation with respect to liquid water', '', (/ ('', i=1, 10) /))
    2153   TYPE(ctrl_out), SAVE :: o_qsats = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2154     'qsats', 'Saturation with respect to solid water', '', (/ ('', i=1, 10) /))
    2155   TYPE(ctrl_out), SAVE :: o_flight_m = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2156     'flightm', 'Flown meters', 'm/s/mesh', (/ ('', i=1, 10) /))
    2157   TYPE(ctrl_out), SAVE :: o_flight_h2o = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2158     'flighth2o', 'H2O flight emission', 'kg H2O/s/mesh', (/ ('', i=1, 10) /))
    2159   TYPE(ctrl_out), SAVE :: o_Tcontr = ctrl_out((/ 1, 1, 1, 1, 11, 11, 11, 11, 11, 11/),&
     2120!-- LSCP - condensation and ice supersaturation variables
     2121  TYPE(ctrl_out), SAVE :: o_cfseri = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2122    'cfseri', 'Cloud fraction', '-', (/ ('', i=1, 10) /))
     2123  TYPE(ctrl_out), SAVE :: o_dcfdyn = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2124    'dcfdyn', 'Dynamics cloud fraction tendency', 's-1', (/ ('', i=1, 10) /))
     2125  TYPE(ctrl_out), SAVE :: o_rvcseri = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2126    'rvcseri', 'Cloudy water vapor to total water vapor ratio', '-', (/ ('', i=1, 10) /))
     2127  TYPE(ctrl_out), SAVE :: o_drvcdyn = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2128    'drvcdyn', 'Dynamics cloudy water vapor to total water vapor ratio tendency', 's-1', (/ ('', i=1, 10) /))
     2129  TYPE(ctrl_out), SAVE :: o_qsub = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2130    'qsub', 'Subsaturated clear sky total water', 'kg/kg', (/ ('', i=1, 10) /))
     2131  TYPE(ctrl_out), SAVE :: o_qissr = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2132    'qissr', 'Supersaturated clear sky total water', 'kg/kg', (/ ('', i=1, 10) /))
     2133  TYPE(ctrl_out), SAVE :: o_qcld = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2134    'qcld', 'Cloudy sky total water', 'kg/kg', (/ ('', i=1, 10) /))
     2135  TYPE(ctrl_out), SAVE :: o_subfra = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2136    'subfra', 'Subsaturated clear sky fraction', '-', (/ ('', i=1, 10) /))
     2137  TYPE(ctrl_out), SAVE :: o_issrfra = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2138    'issrfra', 'Supersaturated clear sky fraction', '-', (/ ('', i=1, 10) /))
     2139  TYPE(ctrl_out), SAVE :: o_gammacond = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2140    'gammacond', 'Condensation threshold w.r.t. saturation', '-', (/ ('', i=1, 10) /))
     2141  TYPE(ctrl_out), SAVE :: o_dcfsub = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2142    'dcfsub', 'Sublimation cloud fraction tendency', 's-1', (/ ('', i=1, 10) /))
     2143  TYPE(ctrl_out), SAVE :: o_dcfcon = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2144    'dcfcon', 'Condensation cloud fraction tendency', 's-1', (/ ('', i=1, 10) /))
     2145  TYPE(ctrl_out), SAVE :: o_dcfmix = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2146    'dcfmix', 'Cloud mixing cloud fraction tendency', 's-1', (/ ('', i=1, 10) /))
     2147  TYPE(ctrl_out), SAVE :: o_dqiadj = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2148    'dqiadj', 'Temperature adjustment ice tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2149  TYPE(ctrl_out), SAVE :: o_dqisub = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2150    'dqisub', 'Sublimation ice tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2151  TYPE(ctrl_out), SAVE :: o_dqicon = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2152    'dqicon', 'Condensation ice tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2153  TYPE(ctrl_out), SAVE :: o_dqimix = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2154    'dqimix', 'Cloud mixing ice tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2155  TYPE(ctrl_out), SAVE :: o_dqvcadj = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2156    'dqvcadj', 'Temperature adjustment cloudy water vapor tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2157  TYPE(ctrl_out), SAVE :: o_dqvcsub = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2158    'dqvcsub', 'Sublimation cloudy water vapor tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2159  TYPE(ctrl_out), SAVE :: o_dqvccon = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2160    'dqvccon', 'Condensation cloudy water vapor tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2161  TYPE(ctrl_out), SAVE :: o_dqvcmix = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2162    'dqvcmix', 'Cloud mixing cloudy water vapor tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2163  TYPE(ctrl_out), SAVE :: o_qsatl = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2164    'qsatl', 'Saturation with respect to liquid', 'kg/kg', (/ ('', i=1, 10) /))
     2165  TYPE(ctrl_out), SAVE :: o_qsati = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2166    'qsati', 'Saturation with respect to ice', 'kg/kg', (/ ('', i=1, 10) /))
     2167
     2168!-- LSCP - aviation variables
     2169  TYPE(ctrl_out), SAVE :: o_Tcontr = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/),&
    21602170    'Tcontr', 'Temperature threshold for contrail formation', 'K', (/ ('',i=1,10) /))
    2161   TYPE(ctrl_out), SAVE :: o_qcontr = ctrl_out((/ 1, 1, 1, 1, 11, 11, 11, 11, 11, 11/),&
    2162     'qcontr', 'Specific humidity threshold for contrail formation','Pa', (/ ('', i=1, 10) /))
    2163   TYPE(ctrl_out), SAVE :: o_qcontr2 = ctrl_out((/ 1, 1, 1, 1, 11, 11, 11, 11, 11, 11/),&
    2164     'qcontr2', 'Specific humidity threshold for contrail formation','kg/kg', (/ ('', i=1, 10) /))
    2165   TYPE(ctrl_out), SAVE :: o_fcontrN = ctrl_out((/ 2, 2, 2, 2, 2, 2, 11, 11, 11, 11/),&
     2171  TYPE(ctrl_out), SAVE :: o_qcontr = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/),&
     2172    'qcontr', 'Specific humidity threshold for contrail formation', 'Pa', (/ ('', i=1, 10) /))
     2173  TYPE(ctrl_out), SAVE :: o_qcontr2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/),&
     2174    'qcontr2', 'Specific humidity threshold for contrail formation', 'kg/kg', (/ ('', i=1, 10) /))
     2175  TYPE(ctrl_out), SAVE :: o_fcontrN = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/),&
    21662176    'fcontrN', 'Fraction with non-persistent contrail in clear-sky', '-', (/ ('', i=1,10)/))
    2167   TYPE(ctrl_out), SAVE :: o_fcontrP = ctrl_out((/ 2, 2, 2, 2, 2, 2, 11, 11, 11, 11/),&
     2177  TYPE(ctrl_out), SAVE :: o_fcontrP = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/),&
    21682178    'fcontrP', 'Fraction with persistent contrail in ISSR', '-', (/ ('', i=1,10)/))
     2179  TYPE(ctrl_out), SAVE :: o_dcfavi = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2180    'dcfavi', 'Aviation cloud fraction tendency', 's-1', (/ ('', i=1, 10) /))
     2181  TYPE(ctrl_out), SAVE :: o_dqiavi = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2182    'dqiavi', 'Aviation ice tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2183  TYPE(ctrl_out), SAVE :: o_dqvcavi = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2184    'dqvcavi', 'Aviation cloudy water vapor tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2185  TYPE(ctrl_out), SAVE :: o_flight_dist = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2186    'flightdist', 'Aviation flown distance', 'm/s/mesh', (/ ('', i=1, 10) /))
     2187  TYPE(ctrl_out), SAVE :: o_flight_h2o = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2188    'flighth2o', 'Aviation H2O flight emission', 'kg H2O/s/mesh', (/ ('', i=1, 10) /))
    21692189
    21702190!!!!!!!!!!!!! Sorties niveaux standards de pression NMC
  • LMDZ6/trunk/libf/phylmd/phys_output_write_mod.F90

    r5150 r5204  
    5454         o_SWdnTOAclr, o_nettop, o_SWup200, &
    5555         o_SWup200clr, o_SWdn200, o_SWdn200clr, &
     56         o_LWupTOA, o_LWupTOAclr, &
    5657         o_LWup200, o_LWup200clr, o_LWdn200, &
    5758         o_LWdn200clr, o_sols, o_sols0, &
     
    218219         o_p_tropopause, o_z_tropopause, o_t_tropopause,  &
    219220         o_col_O3_strato, o_col_O3_tropo,                 &
    220 !--aviation & supersaturation
    221          o_oclr, o_ocld, o_oss, o_ovc, o_rnebss, o_rnebclr, o_rnebseri, o_gammass, &
    222          o_N1_ss, o_N2_ss, o_qsatl, o_qsats, &
    223          o_drnebsub, o_drnebcon, o_drnebtur, o_drnebavi, o_flight_m, o_flight_h2o, &
     221!-- LSCP - condensation and ice supersaturation variables
     222         o_cfseri, o_dcfdyn, o_rvcseri, o_drvcdyn, &
     223         o_qsub, o_qissr, o_qcld, o_subfra, o_issrfra, o_gammacond, &
     224         o_dcfsub, o_dcfcon, o_dcfmix, o_dqiadj, o_dqisub, o_dqicon, o_dqimix, &
     225         o_dqvcadj, o_dqvcsub, o_dqvccon, o_dqvcmix, o_qsatl, o_qsati, &
     226!-- LSCP - aviation variables
    224227         o_Tcontr, o_qcontr, o_qcontr2, o_fcontrN, o_fcontrP, &
     228         o_dcfavi, o_dqiavi, o_dqvcavi, o_flight_dist, o_flight_h2o, &
    225229!--interactive CO2
    226230         o_flx_co2_ocean, o_flx_co2_ocean_cor, &
     
    262266#endif
    263267
    264     USE ice_sursat_mod, ONLY: flight_m, flight_h2o
    265268    USE lmdz_lscp_ini, ONLY: ok_poprecip
    266269
     
    328331         cldq, flwp, fiwp, ue, ve, uq, vq, &
    329332         uwat, vwat, &
    330          rneb_seri, d_rneb_dyn, &
    331333         plcl, plfc, wbeff, convoccur, upwd, dnwd, dnwd0, prw, prlw, prsw, prbsw, water_budget, &
    332334         s_pblh, s_pblt, s_lcl, s_therm, uwriteSTD, &
     
    342344         wdtrainA, wdtrainS, wdtrainM, n2, s2, strig, zcong, zlcl_th, proba_notrig, &
    343345         random_notrig, &
    344          qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
    345          N1_ss, N2_ss, zqsatl, zqsats, &
     346         cf_seri, d_cf_dyn, rvc_seri, d_rvc_dyn, &
     347         qsub, qissr, qcld, subfra, issrfra, gamma_cond, &
     348         dcf_sub, dcf_con, dcf_mix, &
     349         dqi_adj, dqi_sub, dqi_con, dqi_mix, &
     350         dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix, &
     351         qsatliq, qsatice, &
    346352         Tcontr, qcontr, qcontr2, fcontrN, fcontrP, &
    347          drneb_sub, drneb_con, drneb_tur, drneb_avi, &
     353         dcf_avi, dqi_avi, dqvc_avi, flight_dist, flight_h2o, &
    348354         alp_bl_det, alp_bl_fluct_m, alp_bl_conv, &
    349355         alp_bl_stat, alp_bl_fluct_tke, slab_wfbils, &
     
    10791085       CALL histwrite_phy(o_LWupSFCclr, zx_tmp_fi2d)
    10801086       CALL histwrite_phy(o_LWdnSFCclr, sollwdownclr)
     1087       
     1088       IF (vars_defined) THEN
     1089          zx_tmp_fi2d(:) = lwup(:,klevp1)
     1090       ENDIF
     1091       CALL histwrite_phy(o_LWupTOA, zx_tmp_fi2d)
     1092       
     1093       IF (vars_defined) THEN
     1094          zx_tmp_fi2d(:) = lwup0(:,klevp1)
     1095       ENDIF
     1096       CALL histwrite_phy(o_LWupTOAclr, zx_tmp_fi2d)
    10811097
    10821098       IF (type_trac/='inca' .OR. config_inca=='aeNP') THEN
     
    20682084       ENDIF
    20692085
    2070 !--aviation & supersaturation
    2071        IF (ok_ice_sursat) THEN
    2072          CALL histwrite_phy(o_oclr, qclr)
    2073          CALL histwrite_phy(o_ocld, qcld)
    2074          CALL histwrite_phy(o_oss, qss)
    2075          CALL histwrite_phy(o_ovc, qvc)
    2076          CALL histwrite_phy(o_rnebclr, rnebclr)
    2077          CALL histwrite_phy(o_rnebss, rnebss)
    2078          CALL histwrite_phy(o_rnebseri, rneb_seri)
    2079          CALL histwrite_phy(o_gammass, gamma_ss)
    2080          CALL histwrite_phy(o_N1_ss, N1_ss)
    2081          CALL histwrite_phy(o_N2_ss, N2_ss)
    2082          CALL histwrite_phy(o_drnebsub, drneb_sub)
    2083          CALL histwrite_phy(o_drnebcon, drneb_con)
    2084          CALL histwrite_phy(o_drnebtur, drneb_tur)
    2085          CALL histwrite_phy(o_drnebavi, drneb_avi)
    2086          CALL histwrite_phy(o_qsatl, zqsatl)
    2087          CALL histwrite_phy(o_qsats, zqsats)
     2086!-- LSCP - condensation and supersaturation variables
     2087       IF (ok_ice_supersat) THEN
     2088         CALL histwrite_phy(o_cfseri, cf_seri)
     2089         CALL histwrite_phy(o_dcfdyn, d_cf_dyn)
     2090         CALL histwrite_phy(o_rvcseri, rvc_seri)
     2091         CALL histwrite_phy(o_drvcdyn, d_rvc_dyn)
     2092         CALL histwrite_phy(o_qsub, qsub)
     2093         CALL histwrite_phy(o_qissr, qissr)
     2094         CALL histwrite_phy(o_qcld, qcld)
     2095         CALL histwrite_phy(o_subfra, subfra)
     2096         CALL histwrite_phy(o_issrfra, issrfra)
     2097         CALL histwrite_phy(o_gammacond, gamma_cond)
     2098         CALL histwrite_phy(o_dcfsub, dcf_sub)
     2099         CALL histwrite_phy(o_dcfcon, dcf_con)
     2100         CALL histwrite_phy(o_dcfmix, dcf_mix)
     2101         CALL histwrite_phy(o_dqiadj, dqi_adj)
     2102         CALL histwrite_phy(o_dqisub, dqi_sub)
     2103         CALL histwrite_phy(o_dqicon, dqi_con)
     2104         CALL histwrite_phy(o_dqimix, dqi_mix)
     2105         CALL histwrite_phy(o_dqvcadj, dqvc_adj)
     2106         CALL histwrite_phy(o_dqvcsub, dqvc_sub)
     2107         CALL histwrite_phy(o_dqvccon, dqvc_con)
     2108         CALL histwrite_phy(o_dqvcmix, dqvc_mix)
     2109         CALL histwrite_phy(o_qsatl, qsatliq)
     2110         CALL histwrite_phy(o_qsati, qsatice)
     2111       ENDIF
     2112!-- LSCP - aviation variables
     2113       IF (ok_plane_contrail) THEN
    20882114         CALL histwrite_phy(o_Tcontr, Tcontr)
    20892115         CALL histwrite_phy(o_qcontr, qcontr)
     
    20912117         CALL histwrite_phy(o_fcontrN, fcontrN)
    20922118         CALL histwrite_phy(o_fcontrP, fcontrP)
    2093        ENDIF
    2094        IF (ok_plane_contrail) THEN
    2095          CALL histwrite_phy(o_flight_m, flight_m)
     2119         CALL histwrite_phy(o_dcfavi, dcf_avi)
     2120         CALL histwrite_phy(o_dqiavi, dqi_avi)
     2121         CALL histwrite_phy(o_dqvcavi, dqvc_avi)
     2122         CALL histwrite_phy(o_flight_dist, flight_dist)
    20962123       ENDIF
    20972124       IF (ok_plane_h2o) THEN
  • LMDZ6/trunk/libf/phylmd/phys_state_var_mod.F90

    r5084 r5204  
    9393      REAL, ALLOCATABLE, SAVE :: u_ancien(:,:), v_ancien(:,:)
    9494!$OMP THREADPRIVATE(u_ancien, v_ancien)
     95      REAL, ALLOCATABLE, SAVE :: cf_ancien(:,:), rvc_ancien(:,:)
     96!$OMP THREADPRIVATE(cf_ancien, rvc_ancien)
    9597!!! RomP >>>
    9698      REAL, ALLOCATABLE, SAVE :: tr_ancien(:,:,:)
     
    101103      REAL, ALLOCATABLE, SAVE :: clwcon(:,:),rnebcon(:,:)
    102104!$OMP THREADPRIVATE(clwcon,rnebcon)
    103       REAL, ALLOCATABLE, SAVE :: rneb_ancien(:,:)
    104 !$OMP THREADPRIVATE(rneb_ancien)
    105105      REAL, ALLOCATABLE, SAVE :: qtc_cv(:,:),sigt_cv(:,:),detrain_cv(:,:),fm_cv(:,:)
    106106!$OMP THREADPRIVATE(qtc_cv,sigt_cv,detrain_cv,fm_cv)
     
    587587      ALLOCATE(prw_ancien(klon), prlw_ancien(klon), prsw_ancien(klon), prbsw_ancien(klon))
    588588      ALLOCATE(u_ancien(klon,klev), v_ancien(klon,klev))
     589      ALLOCATE(cf_ancien(klon,klev), rvc_ancien(klon,klev))
    589590!!! Rom P >>>
    590591      ALLOCATE(tr_ancien(klon,klev,nbtr))
    591592!!! Rom P <<<
    592593      ALLOCATE(clwcon(klon,klev),rnebcon(klon,klev))
    593       ALLOCATE(rneb_ancien(klon,klev))
    594594      ALLOCATE(qtc_cv(klon,klev),sigt_cv(klon,klev),detrain_cv(klon,klev),fm_cv(klon,klev))
    595595      ALLOCATE(ratqs(klon,klev))
     
    811811      DEALLOCATE(zthe, zpic, zval)
    812812      DEALLOCATE(rugoro, t_ancien, q_ancien, clwcon, rnebcon)
    813       DEALLOCATE(qs_ancien, ql_ancien, qbs_ancien, rneb_ancien)
     813      DEALLOCATE(qs_ancien, ql_ancien, qbs_ancien)
    814814      DEALLOCATE(prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien)
    815815      DEALLOCATE(qtc_cv,sigt_cv,detrain_cv,fm_cv)
    816816      DEALLOCATE(u_ancien, v_ancien)
     817      DEALLOCATE(cf_ancien, rvc_ancien)
    817818      DEALLOCATE(tr_ancien)                           !RomP
    818819      DEALLOCATE(ratqs, pbl_tke,coefh,coefm)
  • LMDZ6/trunk/libf/phylmd/physiq_mod.F90

    r5199 r5204  
    7272    USE tracinca_mod, ONLY: config_inca
    7373    USE tropopause_m,     ONLY: dyn_tropopause
    74     USE ice_sursat_mod,  ONLY: flight_init, airplane
    7574    USE vampir
    7675    USE write_field_phy
     
    156155       ! [Variables internes non sauvegardees de la physique]
    157156       ! Variables locales pour effectuer les appels en serie
    158        t_seri,q_seri,ql_seri,qs_seri,qbs_seri,u_seri,v_seri,tr_seri,rneb_seri, &
     157       t_seri,q_seri,ql_seri,qs_seri,qbs_seri, &
     158       u_seri,v_seri,cf_seri,rvc_seri,tr_seri, &
    159159       rhcl, &       
    160160       ! Dynamic tendencies (diagnostics)
    161        d_t_dyn,d_q_dyn,d_ql_dyn,d_qs_dyn,d_qbs_dyn,d_u_dyn,d_v_dyn,d_tr_dyn,d_rneb_dyn, &
     161       d_t_dyn,d_q_dyn,d_ql_dyn,d_qs_dyn,d_qbs_dyn, &
     162       d_u_dyn,d_v_dyn,d_cf_dyn,d_rvc_dyn,d_tr_dyn, &
    162163       d_q_dyn2d,d_ql_dyn2d,d_qs_dyn2d,d_qbs_dyn2d, &
    163164       ! Physic tendencies
     
    333334       pfraclr, pfracld, cldfraliq, sigma2_icefracturb, mean_icefracturb,  &
    334335       distcltop, temp_cltop,  &
    335        zqsatl, zqsats, &
    336        qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
     336       !-- LSCP - condensation and ice supersaturation variables
     337       qsub, qissr, qcld, subfra, issrfra, gamma_cond, ratio_qi_qtot, &
     338       dcf_sub, dcf_con, dcf_mix, dqi_adj, dqi_sub, dqi_con, dqi_mix, &
     339       dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix, qsatliq, qsatice, &
     340       !-- LSCP - aviation and contrails variables
    337341       Tcontr, qcontr, qcontr2, fcontrN, fcontrP, &
     342       dcf_avi, dqi_avi, dqvc_avi, flight_dist, flight_h2o, &
     343       !
    338344       cldemi,  &
    339345       cldfra, cldtau, fiwc,  &
     
    510516    !
    511517    ! indices de traceurs eau vapeur, liquide, glace, fraction nuageuse LS (optional), blowing snow (optional)
    512     INTEGER,SAVE :: ivap, iliq, isol, irneb, ibs
    513 !$OMP THREADPRIVATE(ivap, iliq, isol, irneb, ibs)
     518    INTEGER,SAVE :: ivap, iliq, isol, ibs, icf, irvc
     519!$OMP THREADPRIVATE(ivap, iliq, isol, ibs, icf, irvc)
    514520    !
    515521    !
     
    13631369       iliq = strIdx(tracers(:)%name, addPhase('H2O', 'l'))
    13641370       isol = strIdx(tracers(:)%name, addPhase('H2O', 's'))
    1365        irneb= strIdx(tracers(:)%name, addPhase('H2O', 'r'))
    13661371       ibs  = strIdx(tracers(:)%name, addPhase('H2O', 'b'))
     1372       icf  = strIdx(tracers(:)%name, addPhase('H2O', 'f'))
     1373       irvc = strIdx(tracers(:)%name, addPhase('H2O', 'c'))
    13671374!       CALL init_etat0_limit_unstruct
    13681375!       IF (.NOT. create_etat0_limit) CALL init_limit_read(days_elapsed)
     
    14061413       ENDIF
    14071414
    1408        IF (ok_ice_sursat.AND.(iflag_ice_thermo.EQ.0)) THEN
    1409           WRITE (lunout, *) ' ok_ice_sursat=y requires iflag_ice_thermo=1 as well'
     1415       IF (ok_ice_supersat.AND.(iflag_ice_thermo.EQ.0)) THEN
     1416          WRITE (lunout, *) ' ok_ice_supersat=y requires iflag_ice_thermo=1 as well'
    14101417          abort_message='see above'
    14111418          CALL abort_physic(modname,abort_message,1)
    14121419       ENDIF
    14131420
    1414        IF (ok_ice_sursat.AND.(nqo.LT.4)) THEN
    1415           WRITE (lunout, *) ' ok_ice_sursat=y requires 4 H2O tracers ', &
    1416                '(H2O_g, H2O_l, H2O_s, H2O_r) but nqo=', nqo, '. Might as well stop here.'
     1421       IF (ok_ice_supersat.AND.(nqo.LT.5)) THEN
     1422          WRITE (lunout, *) ' ok_ice_supersat=y requires 5 H2O tracers ', &
     1423               '(H2O_g, H2O_l, H2O_s, H2O_f, H2O_c) but nqo=', nqo, '. Might as well stop here.'
    14171424          abort_message='see above'
    14181425          CALL abort_physic(modname,abort_message,1)
    14191426       ENDIF
    14201427
    1421        IF (ok_plane_h2o.AND..NOT.ok_ice_sursat) THEN
    1422           WRITE (lunout, *) ' ok_plane_h2o=y requires ok_ice_sursat=y '
     1428       IF (ok_plane_h2o.AND..NOT.ok_ice_supersat) THEN
     1429          WRITE (lunout, *) ' ok_plane_h2o=y requires ok_ice_supersat=y '
    14231430          abort_message='see above'
    14241431          CALL abort_physic(modname,abort_message,1)
    14251432       ENDIF
    14261433
    1427        IF (ok_plane_contrail.AND..NOT.ok_ice_sursat) THEN
    1428           WRITE (lunout, *) ' ok_plane_contrail=y requires ok_ice_sursat=y '
     1434       IF (ok_plane_contrail.AND..NOT.ok_ice_supersat) THEN
     1435          WRITE (lunout, *) ' ok_plane_contrail=y requires ok_ice_supersat=y '
    14291436          abort_message='see above'
    14301437          CALL abort_physic(modname,abort_message,1)
     
    14321439
    14331440        IF (ok_bs) THEN
    1434          IF ((ok_ice_sursat.AND.nqo .LT.5).OR.(.NOT.ok_ice_sursat.AND.nqo.LT.4)) THEN
     1441         IF ((ok_ice_supersat.AND.nqo .LT.6).OR.(.NOT.ok_ice_supersat.AND.nqo.LT.4)) THEN
    14351442             WRITE (lunout, *) 'activation of blowing snow needs a specific H2O tracer', &
    14361443                               'but nqo=', nqo
     
    18501857   &    RG,RD,RCPD,RKAPPA,RLVTT,RETV)
    18511858       CALL ratqs_ini(klon,klev,iflag_thermals,lunout,nbsrf,is_lic,is_ter,RG,RV,RD,RCPD,RLSTT,RLVTT,RTT)
    1852        CALL lscp_ini(pdtphys,lunout,prt_level,ok_ice_sursat,iflag_ratqs,fl_cor_ebil,RCPD,RLSTT,RLVTT,RLMLT,RVTMP2,RTT,RD,RG,RV,RPI)
     1859       CALL lscp_ini(pdtphys,lunout,prt_level,ok_ice_supersat,iflag_ratqs,fl_cor_ebil, &
     1860                     RCPD,RLSTT,RLVTT,RLMLT,RVTMP2,RTT,RD,RV,RG,RPI,EPS_W)
    18531861       CALL blowing_snow_ini(RCPD, RLSTT, RLVTT, RLMLT, &
    18541862                             RVTMP2, RTT,RD,RG, RV, RPI)
     
    23362344                    sollwdown(:))
    23372345
     2346      !--Init for LSCP - condensation
     2347      ratio_qi_qtot(:,:) = 0.
    23382348
    23392349
     
    24332443          q_seri(i,k)  = qx(i,k,ivap)
    24342444          ql_seri(i,k) = qx(i,k,iliq)
    2435           qbs_seri(i,k) = 0.
     2445          qbs_seri(i,k)= 0.
     2446          cf_seri(i,k) = 0.
     2447          rvc_seri(i,k)= 0.
    24362448          !CR: ATTENTION, on rajoute la variable glace
    24372449          IF (nqo.EQ.2) THEN             !--vapour and liquid only
    24382450             qs_seri(i,k) = 0.
    2439              rneb_seri(i,k) = 0.
    24402451          ELSE IF (nqo.EQ.3) THEN        !--vapour, liquid and ice
    24412452             qs_seri(i,k) = qx(i,k,isol)
    2442              rneb_seri(i,k) = 0.
    2443           ELSE IF (nqo.GE.4) THEN        !--vapour, liquid, ice and rneb and blowing snow
     2453          ELSE IF (nqo.GE.4) THEN        !--vapour, liquid, ice, blowing snow, cloud fraction and cloudy water vapor to total water vapor ratio
    24442454             qs_seri(i,k) = qx(i,k,isol)
    2445              IF (ok_ice_sursat) THEN
    2446                rneb_seri(i,k) = qx(i,k,irneb)
     2455             IF (ok_ice_supersat) THEN
     2456               cf_seri(i,k) = qx(i,k,icf)
     2457               rvc_seri(i,k) = qx(i,k,irvc)
    24472458             ENDIF
    24482459             IF (ok_bs) THEN
     
    25222533       d_ql_dyn(:,:) = (ql_seri(:,:)-ql_ancien(:,:))/phys_tstep
    25232534       d_qs_dyn(:,:) = (qs_seri(:,:)-qs_ancien(:,:))/phys_tstep
    2524        d_qbs_dyn(:,:) = (qbs_seri(:,:)-qbs_ancien(:,:))/phys_tstep
     2535       d_qbs_dyn(:,:)= (qbs_seri(:,:)-qbs_ancien(:,:))/phys_tstep
     2536       d_cf_dyn(:,:) = (cf_seri(:,:)-cf_ancien(:,:))/phys_tstep
     2537       d_rvc_dyn(:,:)= (rvc_seri(:,:)-rvc_ancien(:,:))/phys_tstep
    25252538       CALL water_int(klon,klev,q_seri,zmasse,zx_tmp_fi2d)
    25262539       d_q_dyn2d(:)=(zx_tmp_fi2d(:)-prw_ancien(:))/phys_tstep
     
    25342547       IF (nqtot > nqo) d_tr_dyn(:,:,:)=(tr_seri(:,:,:)-tr_ancien(:,:,:))/phys_tstep
    25352548       ! !! RomP <<<
    2536        !!d_rneb_dyn(:,:)=(rneb_seri(:,:)-rneb_ancien(:,:))/phys_tstep
    2537        d_rneb_dyn(:,:)=0.0
    25382549    ELSE
    25392550       d_u_dyn(:,:)  = 0.0
     
    25432554       d_ql_dyn(:,:) = 0.0
    25442555       d_qs_dyn(:,:) = 0.0
     2556       d_qbs_dyn(:,:)= 0.0
     2557       d_cf_dyn(:,:) = 0.0
     2558       d_rvc_dyn(:,:)= 0.0
    25452559       d_q_dyn2d(:)  = 0.0
    25462560       d_ql_dyn2d(:) = 0.0
     
    25502564       IF (nqtot > nqo) d_tr_dyn(:,:,:)= 0.0
    25512565       ! !! RomP <<<
    2552        d_rneb_dyn(:,:)=0.0
    2553        d_qbs_dyn(:,:)=0.0
    25542566       ancien_ok = .TRUE.
    25552567    ENDIF
     
    26602672       ENDIF
    26612673    ENDIF
     2674
     2675    !-- Needed for LSCP - condensation and ice supersaturation
     2676    IF (ok_ice_supersat) THEN
     2677      DO k = 1, klev
     2678        DO i = 1, klon
     2679          IF ( ( q_seri(i,k) + ql_seri(i,k) + qs_seri(i,k) ) .GT. 0. ) THEN
     2680            ratio_qi_qtot(i,k) = qs_seri(i,k) / ( q_seri(i,k) + ql_seri(i,k) + qs_seri(i,k) )
     2681            rvc_seri(i,k) = rvc_seri(i,k) * q_seri(i,k) / ( q_seri(i,k) + ql_seri(i,k) + qs_seri(i,k) )
     2682          ELSE
     2683            ratio_qi_qtot(i,k) = 0.
     2684            rvc_seri(i,k) = 0.
     2685          ENDIF
     2686        ENDDO
     2687      ENDDO
     2688    ENDIF
     2689
    26622690    !
    26632691    ! Re-evaporer l'eau liquide nuageuse
     
    38293857
    38303858    !--mise à jour de flight_m et flight_h2o dans leur module
    3831     IF (ok_plane_h2o .OR. ok_plane_contrail) THEN
    3832       CALL airplane(debut,pphis,pplay,paprs,t_seri)
    3833     ENDIF
     3859    !IF (ok_plane_h2o .OR. ok_plane_contrail) THEN
     3860    !  CALL airplane(debut,pphis,pplay,paprs,t_seri)
     3861    !ENDIF
    38343862
    38353863    CALL lscp(klon,klev,phys_tstep,missing_val,paprs,pplay, &
    38363864         t_seri, q_seri,qs_ini,ptconv,ratqs, &
    3837          d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, rneb_seri, &
     3865         d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, &
    38383866         pfraclr, pfracld, cldfraliq, sigma2_icefracturb, mean_icefracturb,  &
    38393867         radocond, picefra, rain_lsc, snow_lsc, &
     
    38413869         prfl, psfl, rhcl,  &
    38423870         zqasc, fraca,ztv,zpspsk,ztla,zthl,iflag_cld_th, &
    3843          iflag_ice_thermo, ok_ice_sursat, zqsatl, zqsats, distcltop, temp_cltop,  &
    3844          pbl_tke(:,:,is_ave), pbl_eps(:,:,is_ave), qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
    3845          Tcontr, qcontr, qcontr2, fcontrN, fcontrP , &
     3871         iflag_ice_thermo, distcltop, temp_cltop,   &
     3872         pbl_tke(:,:,is_ave), pbl_eps(:,:,is_ave), &
     3873         cell_area, &
     3874         cf_seri, rvc_seri, u_seri, v_seri, &
     3875         qsub, qissr, qcld, subfra, issrfra, gamma_cond, ratio_qi_qtot, &
     3876         dcf_sub, dcf_con, dcf_mix, dqi_adj, dqi_sub, dqi_con, dqi_mix, &
     3877         dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix, qsatliq, qsatice, &
     3878         Tcontr, qcontr, qcontr2, fcontrN, fcontrP, &
     3879         dcf_avi, dqi_avi, dqvc_avi, flight_dist, flight_h2o, &
    38463880         cloudth_sth,cloudth_senv,cloudth_sigmath,cloudth_sigmaenv, &
    38473881         qraindiag, qsnowdiag, dqreva, dqssub, dqrauto, dqrcol, dqrmelt, &
     
    55505584             d_qx(i,k,isol) = ( qs_seri(i,k) - qx(i,k,isol) ) / phys_tstep
    55515585          ENDIF
    5552           !--ice_sursat: nqo=4, on ajoute rneb
    5553           IF (nqo.ge.4 .and. ok_ice_sursat) THEN
    5554              d_qx(i,k,irneb) = ( rneb_seri(i,k) - qx(i,k,irneb) ) / phys_tstep
     5586          !--ice_supersat: nqo=5, we add cloud fraction and cloudy water vapor to total water vapor ratio
     5587          IF (nqo.ge.5 .and. ok_ice_supersat) THEN
     5588             d_qx(i,k,icf) = ( cf_seri(i,k) - qx(i,k,icf) ) / phys_tstep
     5589             d_qx(i,k,irvc) = ( rvc_seri(i,k) - qx(i,k,irvc) ) / phys_tstep
    55555590          ENDIF
    55565591
     
    55865621    ql_ancien(:,:) = ql_seri(:,:)
    55875622    qs_ancien(:,:) = qs_seri(:,:)
    5588     qbs_ancien(:,:) = qbs_seri(:,:)
    5589     rneb_ancien(:,:) = rneb_seri(:,:)
     5623    qbs_ancien(:,:)= qbs_seri(:,:)
     5624    cf_ancien(:,:) = cf_seri(:,:)
     5625    rvc_ancien(:,:)= rvc_seri(:,:)
    55905626    CALL water_int(klon,klev,q_ancien,zmasse,prw_ancien)
    55915627    CALL water_int(klon,klev,ql_ancien,zmasse,prlw_ancien)
  • LMDZ6/trunk/libf/phylmdiso/phyetat0_mod.F90

    r5199 r5204  
    2525       du_gwd_rando, du_gwd_front, entr_therm, f0, fm_therm, &
    2626       falb_dir, falb_dif, prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien, &
    27        ftsol, pbl_tke, pctsrf, q_ancien, ql_ancien, qs_ancien, qbs_ancien, rneb_ancien, radpas, radsol, rain_fall, ratqs, &
     27       ftsol, pbl_tke, pctsrf, q_ancien, ql_ancien, qs_ancien, qbs_ancien, &
     28       cf_ancien, rvc_ancien, radpas, radsol, rain_fall, ratqs, &
    2829       rnebcon, rugoro, sig1, snow_fall, bs_fall, solaire_etat0, sollw, sollwdown, &
    2930       solsw, solswfdiff, t_ancien, u_ancien, v_ancien, w01, wake_cstar, wake_deltaq, &
     
    420421  ancien_ok=ancien_ok.AND.phyetat0_get(ql_ancien,"QLANCIEN","QLANCIEN",0.)
    421422  ancien_ok=ancien_ok.AND.phyetat0_get(qs_ancien,"QSANCIEN","QSANCIEN",0.)
    422   ancien_ok=ancien_ok.AND.phyetat0_get(rneb_ancien,"RNEBANCIEN","RNEBANCIEN",0.)
    423423  ancien_ok=ancien_ok.AND.phyetat0_get(u_ancien,"UANCIEN","UANCIEN",0.)
    424424  ancien_ok=ancien_ok.AND.phyetat0_get(v_ancien,"VANCIEN","VANCIEN",0.)
     
    435435     prbsw_ancien(:)=0.
    436436  ENDIF
     437 
     438  ! cas specifique des variables de la sursaturation par rapport a la glace
     439  IF ( ok_ice_supersat ) THEN
     440    ancien_ok=ancien_ok.AND.phyetat0_get(cf_ancien,"CFANCIEN","CFANCIEN",0.)
     441    ancien_ok=ancien_ok.AND.phyetat0_get(rvc_ancien,"RVCANCIEN","RVCANCIEN",0.)
     442  ELSE
     443    cf_ancien(:,:)=0.
     444    rvc_ancien(:,:)=0.
     445  ENDIF
    437446
    438447  ! Ehouarn: addtional tests to check if t_ancien, q_ancien contain
     
    442451       (maxval(ql_ancien).EQ.minval(ql_ancien))     .OR. &
    443452       (maxval(qs_ancien).EQ.minval(qs_ancien))     .OR. &
    444        (maxval(rneb_ancien).EQ.minval(rneb_ancien)) .OR. &
    445453       (maxval(prw_ancien).EQ.minval(prw_ancien))   .OR. &
    446454       (maxval(prlw_ancien).EQ.minval(prlw_ancien)) .OR. &
     
    455463       ancien_ok=.false.
    456464    ENDIF
     465  ENDIF
     466
     467  IF ( ok_ice_supersat ) THEN
     468    IF ( (maxval(cf_ancien).EQ.minval(cf_ancien))     .OR. &
     469         (maxval(rvc_ancien).EQ.minval(rvc_ancien)) ) THEN
     470       ancien_ok=.false.
     471     ENDIF
    457472  ENDIF
    458473
  • LMDZ6/trunk/libf/phylmdiso/phyredem.F90

    r4613 r5204  
    1919                                zval, rugoro, t_ancien, q_ancien,            &
    2020                                prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien,      &
    21                                 ql_ancien, qs_ancien, qbs_ancien,  u_ancien, &
    22                                 v_ancien, clwcon, rnebcon, ratqs, pbl_tke,   &
     21                                ql_ancien, qs_ancien, qbs_ancien, cf_ancien, &
     22                                rvc_ancien, u_ancien, v_ancien,              &
     23                                clwcon, rnebcon, ratqs, pbl_tke,             &
    2324                                wake_delta_pbl_tke, zmax0, f0, sig1, w01,    &
    2425                                wake_deltat, wake_deltaq, wake_s, wake_dens, &
     
    265266       CALL put_field(pass,"QBSANCIEN", "QBSANCIEN", qbs_ancien)
    266267       CALL put_field(pass,"PRBSWANCIEN", "PRBSWANCIEN", prbsw_ancien)
     268    ENDIF
     269
     270    IF ( ok_ice_supersat ) THEN
     271      CALL put_field(pass,"CFANCIEN", "CFANCIEN", cf_ancien)
     272      CALL put_field(pass,"RVCANCIEN", "RVCANCIEN", rvc_ancien)
    267273    ENDIF
    268274
  • LMDZ6/trunk/libf/phylmdiso/physiq_mod.F90

    r5199 r5204  
    7272    USE tracinca_mod, ONLY: config_inca
    7373    USE tropopause_m,     ONLY: dyn_tropopause
    74     USE ice_sursat_mod,  ONLY: flight_init, airplane
    7574    USE vampir
    7675    USE write_field_phy
     
    195194       ! [Variables internes non sauvegardees de la physique]
    196195       ! Variables locales pour effectuer les appels en serie
    197        t_seri,q_seri,ql_seri,qs_seri,qbs_seri,u_seri,v_seri,tr_seri,rneb_seri, &
     196       t_seri,q_seri,ql_seri,qs_seri,qbs_seri, &
     197       u_seri,v_seri,cf_seri,rvc_seri,tr_seri, &
     198       rhcl, &       
    198199       qx_seri, & ! CR
    199200       rhcl, &       
    200201       ! Dynamic tendencies (diagnostics)
    201        d_t_dyn,d_q_dyn,d_ql_dyn,d_qs_dyn,d_qbs_dyn,d_u_dyn,d_v_dyn,d_tr_dyn,d_rneb_dyn, &
     202       d_t_dyn,d_q_dyn,d_ql_dyn,d_qs_dyn,d_qbs_dyn, &
     203       d_u_dyn,d_v_dyn,d_cf_dyn,d_rvc_dyn,d_tr_dyn, &
    202204       d_q_dyn2d,d_ql_dyn2d,d_qs_dyn2d,d_qbs_dyn2d, &
    203205       ! Physic tendencies
     
    374376       pfraclr, pfracld, cldfraliq, sigma2_icefracturb, mean_icefracturb,  &
    375377       distcltop, temp_cltop,  &
    376        zqsatl, zqsats, &
    377        qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
     378       !-- LSCP - condensation and ice supersaturation variables
     379       qsub, qissr, qcld, subfra, issrfra, gamma_cond, ratio_qi_qtot, &
     380       dcf_sub, dcf_con, dcf_mix, dqi_adj, dqi_sub, dqi_con, dqi_mix, &
     381       dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix, qsatliq, qsatice, &
     382       !-- LSCP - aviation and contrails variables
    378383       Tcontr, qcontr, qcontr2, fcontrN, fcontrP, &
     384       dcf_avi, dqi_avi, dqvc_avi, flight_dist, flight_h2o, &
     385       !
    379386       cldemi,  &
    380387       cldfra, cldtau, fiwc,  &
     
    584591! reevap -> je commente les 2 lignes au dessus et je laisse la definition
    585592! plutot dans infotrac_phy
    586     INTEGER,SAVE :: irneb, ibs
    587 !$OMP THREADPRIVATE(irneb, ibs)
     593    INTEGER,SAVE :: irneb, ibs, icf,irvc
     594!$OMP THREADPRIVATE(irneb, ibs, icf,irvc)
    588595!
    589596    !
     
    14791486       iliq = strIdx(tracers(:)%name, addPhase('H2O', 'l'))
    14801487       isol = strIdx(tracers(:)%name, addPhase('H2O', 's'))
    1481        irneb= strIdx(tracers(:)%name, addPhase('H2O', 'r'))
    14821488       ibs  = strIdx(tracers(:)%name, addPhase('H2O', 'b'))
     1489       icf  = strIdx(tracers(:)%name, addPhase('H2O', 'f'))
     1490       irvc = strIdx(tracers(:)%name, addPhase('H2O', 'c'))
    14831491!       CALL init_etat0_limit_unstruct
    1484 !       IF (.NOT. create_etat0_limit) CALL init_limit_read(days_elapsed)
     1492       IF (.NOT. create_etat0_limit) CALL init_limit_read(days_elapsed)
    14851493       !CR:nvelles variables convection/poches froides
    14861494
     
    15331541       ENDIF
    15341542
    1535        IF (ok_ice_sursat.AND.(iflag_ice_thermo.EQ.0)) THEN
    1536           WRITE (lunout, *) ' ok_ice_sursat=y requires iflag_ice_thermo=1 as well'
     1543       IF (ok_ice_supersat.AND.(iflag_ice_thermo.EQ.0)) THEN
     1544          WRITE (lunout, *) ' ok_ice_supersat=y requires iflag_ice_thermo=1 as well'
    15371545          abort_message='see above'
    15381546          CALL abort_physic(modname,abort_message,1)
    15391547       ENDIF
    15401548
    1541        IF (ok_ice_sursat.AND.(nqo.LT.4)) THEN
    1542           WRITE (lunout, *) ' ok_ice_sursat=y requires 4 H2O tracers ', &
    1543                '(H2O_g, H2O_l, H2O_s, H2O_r) but nqo=', nqo, '. Might as well stop here.'
     1549       IF (ok_ice_supersat.AND.(nqo.LT.5)) THEN
     1550          WRITE (lunout, *) ' ok_ice_supersat=y requires 5 H2O tracers ', &
     1551               '(H2O_g, H2O_l, H2O_s, H2O_f, H2O_c) but nqo=', nqo, '. Might as well stop here.'
    15441552          abort_message='see above'
    15451553          CALL abort_physic(modname,abort_message,1)
    15461554       ENDIF
    15471555
    1548        IF (ok_plane_h2o.AND..NOT.ok_ice_sursat) THEN
    1549           WRITE (lunout, *) ' ok_plane_h2o=y requires ok_ice_sursat=y '
     1556       IF (ok_plane_h2o.AND..NOT.ok_ice_supersat) THEN
     1557          WRITE (lunout, *) ' ok_plane_h2o=y requires ok_ice_supersat=y '
    15501558          abort_message='see above'
    15511559          CALL abort_physic(modname,abort_message,1)
    15521560       ENDIF
    15531561
    1554        IF (ok_plane_contrail.AND..NOT.ok_ice_sursat) THEN
    1555           WRITE (lunout, *) ' ok_plane_contrail=y requires ok_ice_sursat=y '
     1562       IF (ok_plane_contrail.AND..NOT.ok_ice_supersat) THEN
     1563          WRITE (lunout, *) ' ok_plane_contrail=y requires ok_ice_supersat=y '
    15561564          abort_message='see above'
    15571565          CALL abort_physic(modname,abort_message,1)
     
    15621570          abort_message='blowing snow cannot be activated with water isotopes yet'
    15631571          CALL abort_physic(modname,abort_message, 1)
    1564 #endif
    1565          IF ((ok_ice_sursat.AND.nqo .LT.5).OR.(.NOT.ok_ice_sursat.AND.nqo.LT.4)) THEN
     1572         IF ((ok_ice_supersat.AND.nqo .LT.6).OR.(.NOT.ok_ice_supersat.AND.nqo.LT.4)) THEN
    15661573             WRITE (lunout, *) 'activation of blowing snow needs a specific H2O tracer', &
    15671574                               'but nqo=', nqo
     
    20152022   &    RG,RD,RCPD,RKAPPA,RLVTT,RETV)
    20162023       CALL ratqs_ini(klon,klev,iflag_thermals,lunout,nbsrf,is_lic,is_ter,RG,RV,RD,RCPD,RLSTT,RLVTT,RTT)
    2017        CALL lscp_ini(pdtphys,lunout,prt_level,ok_ice_sursat,iflag_ratqs,fl_cor_ebil,RCPD,RLSTT,RLVTT,RLMLT,RVTMP2,RTT,RD,RG,RV,RPI)
     2024       CALL lscp_ini(pdtphys,lunout,prt_level,ok_ice_supersat,iflag_ratqs,fl_cor_ebil, &
     2025                     RCPD,RLSTT,RLVTT,RLMLT,RVTMP2,RTT,RD,RV,RG,RPI,EPS_W)
    20182026       CALL blowing_snow_ini(RCPD, RLSTT, RLVTT, RLMLT, &
    20192027                             RVTMP2, RTT,RD,RG, RV, RPI)
     
    24972505                    sollwdown(:))
    24982506
     2507      !--Init for LSCP - condensation
     2508      ratio_qi_qtot(:,:) = 0.
    24992509
    25002510
     
    26042614          q_seri(i,k)  = qx(i,k,ivap)
    26052615          ql_seri(i,k) = qx(i,k,iliq)
    2606           qbs_seri(i,k) = 0.
     2616          qbs_seri(i,k)= 0.
     2617          cf_seri(i,k) = 0.
     2618          rvc_seri(i,k)= 0.
    26072619          !CR: ATTENTION, on rajoute la variable glace
    26082620          IF (nqo.EQ.2) THEN             !--vapour and liquid only
    26092621             qs_seri(i,k) = 0.
    2610              rneb_seri(i,k) = 0.
    26112622          ELSE IF (nqo.EQ.3) THEN        !--vapour, liquid and ice
    26122623             qs_seri(i,k) = qx(i,k,isol)
    2613              rneb_seri(i,k) = 0.
    2614           ELSE IF (nqo.GE.4) THEN        !--vapour, liquid, ice and rneb and blowing snow
     2624          ELSE IF (nqo.GE.4) THEN        !--vapour, liquid, ice, blowing snow, cloud fraction and cloudy water vapor to total water vapor ratio
    26152625             qs_seri(i,k) = qx(i,k,isol)
    2616              IF (ok_ice_sursat) THEN
    2617                rneb_seri(i,k) = qx(i,k,irneb)
     2626             IF (ok_ice_supersat) THEN
     2627               cf_seri(i,k) = qx(i,k,icf)
     2628               rvc_seri(i,k) = qx(i,k,irvc)
    26182629             ENDIF
    26192630             IF (ok_bs) THEN
     
    27842795       d_ql_dyn(:,:) = (ql_seri(:,:)-ql_ancien(:,:))/phys_tstep
    27852796       d_qs_dyn(:,:) = (qs_seri(:,:)-qs_ancien(:,:))/phys_tstep
    2786        d_qbs_dyn(:,:) = (qbs_seri(:,:)-qbs_ancien(:,:))/phys_tstep
     2797       d_qbs_dyn(:,:)= (qbs_seri(:,:)-qbs_ancien(:,:))/phys_tstep
     2798       d_cf_dyn(:,:) = (cf_seri(:,:)-cf_ancien(:,:))/phys_tstep
     2799       d_rvc_dyn(:,:)= (rvc_seri(:,:)-rvc_ancien(:,:))/phys_tstep
    27872800       CALL water_int(klon,klev,q_seri,zmasse,zx_tmp_fi2d)
    27882801       d_q_dyn2d(:)=(zx_tmp_fi2d(:)-prw_ancien(:))/phys_tstep
     
    27962809       IF (nqtot > nqo) d_tr_dyn(:,:,:)=(tr_seri(:,:,:)-tr_ancien(:,:,:))/phys_tstep
    27972810       ! !! RomP <<<
    2798        !!d_rneb_dyn(:,:)=(rneb_seri(:,:)-rneb_ancien(:,:))/phys_tstep
    2799        d_rneb_dyn(:,:)=0.0
    28002811
    28012812#ifdef ISO
     
    28792890       d_ql_dyn(:,:) = 0.0
    28802891       d_qs_dyn(:,:) = 0.0
     2892       d_qbs_dyn(:,:)= 0.0
     2893       d_cf_dyn(:,:) = 0.0
     2894       d_rvc_dyn(:,:)= 0.0
    28812895       d_q_dyn2d(:)  = 0.0
    28822896       d_ql_dyn2d(:) = 0.0
     
    29052919       IF (nqtot > nqo) d_tr_dyn(:,:,:)= 0.0
    29062920       ! !! RomP <<<
    2907        d_rneb_dyn(:,:)=0.0
    2908        d_qbs_dyn(:,:)=0.0
    29092921       ancien_ok = .TRUE.
    29102922#ifdef ISO
     
    30173029          ! "zmasse" changes a little.)
    30183030       ENDIF
     3031    ENDIF
     3032
     3033    !-- Needed for LSCP - condensation and ice supersaturation
     3034    IF (ok_ice_supersat) THEN
     3035      DO k = 1, klev
     3036        DO i = 1, klon
     3037          IF ( ( q_seri(i,k) + ql_seri(i,k) + qs_seri(i,k) ) .GT. 0. ) THEN
     3038            ratio_qi_qtot(i,k) = qs_seri(i,k) / ( q_seri(i,k) + ql_seri(i,k) + qs_seri(i,k) )
     3039            rvc_seri(i,k) = rvc_seri(i,k) * q_seri(i,k) / ( q_seri(i,k) + ql_seri(i,k) + qs_seri(i,k) )
     3040          ELSE
     3041            ratio_qi_qtot(i,k) = 0.
     3042            rvc_seri(i,k) = 0.
     3043          ENDIF
     3044        ENDDO
     3045      ENDDO
    30193046    ENDIF
    30203047
     
    50605087
    50615088    !--mise à jour de flight_m et flight_h2o dans leur module
    5062     IF (ok_plane_h2o .OR. ok_plane_contrail) THEN
    5063       CALL airplane(debut,pphis,pplay,paprs,t_seri)
    5064     ENDIF
     5089    !IF (ok_plane_h2o .OR. ok_plane_contrail) THEN
     5090    !  CALL airplane(debut,pphis,pplay,paprs,t_seri)
     5091    !ENDIF
    50655092
    50665093    CALL lscp(klon,klev,phys_tstep,missing_val,paprs,pplay, &
    50675094         t_seri, q_seri,qs_ini,ptconv,ratqs, &
    5068          d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, rneb_seri, &
     5095         d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, &
    50695096         pfraclr, pfracld, cldfraliq, sigma2_icefracturb, mean_icefracturb,  &
    50705097         radocond, picefra, rain_lsc, snow_lsc, &
     
    50725099         prfl, psfl, rhcl,  &
    50735100         zqasc, fraca,ztv,zpspsk,ztla,zthl,iflag_cld_th, &
    5074          iflag_ice_thermo, ok_ice_sursat, zqsatl, zqsats, distcltop, temp_cltop,  &
    5075          pbl_tke(:,:,is_ave), pbl_eps(:,:,is_ave), qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
    5076          Tcontr, qcontr, qcontr2, fcontrN, fcontrP , &
     5101         iflag_ice_thermo, distcltop, temp_cltop,
     5102         pbl_tke(:,:,is_ave), pbl_eps(:,:,is_ave), &
     5103         cell_area, &
     5104         cf_seri, rvc_seri, u_seri, v_seri, &
     5105         qsub, qissr, qcld, subfra, issrfra, gamma_cond, ratio_qi_qtot, &
     5106         dcf_sub, dcf_con, dcf_mix, dqi_adj, dqi_sub, dqi_con, dqi_mix, &
     5107         dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix, qsatliq, qsatice, &
     5108         Tcontr, qcontr, qcontr2, fcontrN, fcontrP, &
     5109         dcf_avi, dqi_avi, dqvc_avi, flight_dist, flight_h2o, &
    50775110         cloudth_sth,cloudth_senv,cloudth_sigmath,cloudth_sigmaenv, &
    50785111         qraindiag, qsnowdiag, dqreva, dqssub, dqrauto, dqrcol, dqrmelt, &
     
    71297162             d_qx(i,k,isol) = ( qs_seri(i,k) - qx(i,k,isol) ) / phys_tstep
    71307163          ENDIF
    7131           !--ice_sursat: nqo=4, on ajoute rneb
    7132           IF (nqo.ge.4 .and. ok_ice_sursat) THEN
    7133              d_qx(i,k,irneb) = ( rneb_seri(i,k) - qx(i,k,irneb) ) / phys_tstep
     7164          !--ice_supersat: nqo=5, we add cloud fraction and cloudy water vapor to total water vapor ratio
     7165          IF (nqo.ge.5 .and. ok_ice_supersat) THEN
     7166             d_qx(i,k,icf) = ( cf_seri(i,k) - qx(i,k,icf) ) / phys_tstep
     7167             d_qx(i,k,irvc) = ( rvc_seri(i,k) - qx(i,k,irvc) ) / phys_tstep
    71347168          ENDIF
    71357169
     
    71377171             d_qx(i,k,ibs) = ( qbs_seri(i,k) - qx(i,k,ibs) ) / phys_tstep
    71387172          ENDIF
    7139 
    71407173
    71417174       ENDDO
     
    71867219    ql_ancien(:,:) = ql_seri(:,:)
    71877220    qs_ancien(:,:) = qs_seri(:,:)
    7188     qbs_ancien(:,:) = qbs_seri(:,:)
    7189     rneb_ancien(:,:) = rneb_seri(:,:)
     7221    qbs_ancien(:,:)= qbs_seri(:,:)
     7222    cf_ancien(:,:) = cf_seri(:,:)
     7223    rvc_ancien(:,:)= rvc_seri(:,:)
    71907224#ifdef ISO
    71917225    xt_ancien(:,:,:)=xt_seri(:,:,:)
Note: See TracChangeset for help on using the changeset viewer.