Ignore:
Timestamp:
Sep 24, 2024, 10:47:17 AM (2 months ago)
Author:
abarral
Message:

Merge r5204 r5205
Light lint
Correct missing IOIPSL includes

Location:
LMDZ6/branches/Amaury_dev
Files:
2 deleted
24 edited
2 copied

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Amaury_dev/DefLists/field_def_lmdz.xml

    r5219 r5224  
    1 <!-- $Id$ -->
    21<field_definition level="1" prec="4" operation="average" freq_op="1ts" enabled=".true." default_value="9.96921e+36">
    32   
     
    156155        <field id="LWupSFC"    long_name="Upwd. IR rad. at surface"    unit="W/m2" />
    157156        <field id="LWupSFCclr"    long_name="CS Upwd. IR rad. at surface"    unit="W/m2" />
     157        <field id="LWupTOA"    long_name="LWup at TOA"    unit="W/m2" />
     158        <field id="LWupTOAclr"    long_name="LWup clear sky at TOA"    unit="W/m2" />
    158159        <field id="LWupTOAcleanclr"    long_name="CS clean (no aerosol) Upwd. IR rad. at TOA"    unit="W/m2" />
    159160        <field id="LWdnSFC"    long_name="Down. IR rad. at surface"    unit="W/m2" />
     
    879880        <field id="dqch4"        long_name="H2O due to CH4 oxidation and photolysis" unit="(kg/kg)/s" />
    880881        <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" />
     882        <field id="cfseri"     long_name="Cloud fraction"    unit="-" />
     883        <field id="dcfdyn"     long_name="Dynamics cloud fraction tendency"    unit="s-1" />
     884        <field id="rvcseri"    long_name="Cloudy water vapor to total water vapor ratio"    unit="-" />
     885        <field id="drvcdyn"    long_name="Dynamics cloudy water vapor to total water vapor ratio tendency"    unit="s-1" />
     886        <field id="qsub"       long_name="Subsaturated clear sky total water"    unit="kg/kg" />
     887        <field id="qissr"      long_name="Supersaturated clear sky total water"    unit="kg/kg" />
     888        <field id="qcld"       long_name="Cloudy sky total water"    unit="kg/kg" />
     889        <field id="subfra"     long_name="Subsaturated clear sky fraction"    unit="kg/kg" />
     890        <field id="issrfra"    long_name="Supersaturated clear sky fraction"    unit="kg/kg" />
     891        <field id="gammacond"  long_name="Condensation threshold w.r.t. saturation"    unit="-" />
     892        <field id="dcfsub"     long_name="Sublimation cloud fraction tendency"    unit="s-1" />
     893        <field id="dcfcon"     long_name="Condensation cloud fraction tendency"    unit="s-1" />
     894        <field id="dcfmix"     long_name="Cloud mixing cloud fraction tendency"    unit="s-1" />
     895        <field id="dqiadj"     long_name="Temperature adjustment ice tendency"    unit="kg/kg/s" />
     896        <field id="dqisub"     long_name="Sublimation ice tendency"    unit="kg/kg/s" />
     897        <field id="dqicon"     long_name="Condensation ice tendency"    unit="kg/kg/s" />
     898        <field id="dqimix"     long_name="Cloud mixing ice tendency"    unit="kg/kg/s" />
     899        <field id="dqvcadj"    long_name="Temperature adjustment cloudy water vapor tendency"    unit="kg/kg/s" />
     900        <field id="dqvcsub"    long_name="Sublimation cloudy water vapor tendency"    unit="kg/kg/s" />
     901        <field id="dqvccon"    long_name="Condensation cloudy water vapor tendency"    unit="kg/kg/s" />
     902        <field id="dqvcmix"    long_name="Cloud mixing cloudy water vapor tendency"    unit="kg/kg/s" />
     903        <field id="qsatl"      long_name="Saturation with respect to liquid"    unit="kg/kg" />
     904        <field id="qsati"      long_name="Saturation with respect to ice"    unit="kg/kg" />
     905        <field id="Tcontr"     long_name="Temperature threshold for contrail formation"    unit="K" />
     906        <field id="qcontr"     long_name="Specific humidity threshold for contrail formation"    unit="Pa" />
     907        <field id="qcontr2"    long_name="Specific humidity threshold for contrail formation"    unit="kg/kg" />
     908        <field id="fcontrN"    long_name="Fraction with non-persistent contrail in clear-sky"    unit="-" />
     909        <field id="fcontrP"    long_name="Fraction with persistent contrail in ISSR"    unit="-" />
     910        <field id="dcfavi"     long_name="Aviation cloud fraction tendency"    unit="s-1" />
     911        <field id="dqiavi"     long_name="Aviation ice tendency"    unit="kg/kg/s" />
     912        <field id="dqvcavi"    long_name="Aviation cloudy water vapor tendency"    unit="kg/kg/s" />
     913        <field id="flightdist" long_name="Aviation flown distance"    unit="m/s/mesh" />
     914        <field id="flighth2o"  long_name="Aviation H2O flight emission"    unit="kg H2O/s/mesh" />
    904915        <field id="fluxt"     long_name="flux h"     unit="W/m2" />
    905916        <field id="fluxq"     long_name="flux q"     unit="-" />
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/lmdz_check_isotopes.f90

    r5223 r5224  
    1212
    1313    USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
     14    USE ioipsl, ONLY: getin
    1415    IMPLICIT NONE
    1516
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/lmdz_dynetat0.f90

    r5223 r5224  
    2727    USE lmdz_comgeom2
    2828    USE lmdz_strings, ONLY: strIdx
     29    USE ioipsl, ONLY: getin
    2930
    3031    USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
  • LMDZ6/branches/Amaury_dev/libf/dyn3d_common/iso_verif_dyn.f90

    r5223 r5224  
    6565        (x, iso, q, err_msg)
    6666  USE lmdz_infotrac, ONLY: isoName, getKey
     67  USE ioipsl, ONLY: getin
     68
    6769  IMPLICIT NONE
    6870
  • LMDZ6/branches/Amaury_dev/libf/dynphy_lonlat/phylmd/etat0phys_netcdf.F90

    r5159 r5224  
    4848          prw_ancien, u10m, v10m, treedrg, u_ancien, v_ancien, wake_delta_pbl_TKE, wake_dens, &
    4949          ale_bl, ale_bl_trig, alp_bl, &
    50           ale_wake, ale_bl_stat, AWAKE_S
     50          ale_wake, ale_bl_stat, AWAKE_S, &
     51          cf_ancien, rvc_ancien
    5152
    5253  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 lmdz_alpale
    9899    USE lmdz_compbl, ONLY: iflag_pbl, iflag_pbl_split, iflag_order2_sollw, ifl_pbltree
     
    246247    ale_bl_stat = 0.
    247248
     249    cf_ancien = 0.
     250    rvc_ancien = 0.
     251
    248252    z0m(:, :) = 0 ! ym missing 5th subsurface initialization
    249253
     
    290294
    291295    ratqs_inter_ = 0.002
    292     rneb_ancien = 0.
    293296    CALL phyredem("startphy.nc")
    294297
  • LMDZ6/branches/Amaury_dev/libf/phylmd/conf_phys_m.F90

    r5158 r5224  
    172172    INTEGER, SAVE :: iflag_clw_omp
    173173    INTEGER, SAVE :: iflag_ice_thermo_omp
    174     LOGICAL, SAVE :: ok_ice_sursat_omp
     174    LOGICAL, SAVE :: ok_ice_supersat_omp
    175175    LOGICAL, SAVE :: ok_plane_h2o_omp, ok_plane_contrail_omp
    176176    REAL, SAVE :: rad_froid_omp, rad_chau1_omp, rad_chau2_omp
     
    13051305    CALL getin('iflag_ice_thermo', iflag_ice_thermo_omp)
    13061306
    1307     !Config Key  = ok_ice_sursat
    1308     !Config Desc =
    1309     !Config Def  = 0
    1310     !Config Help =
    1311 
    1312     ok_ice_sursat_omp = .FALSE.
    1313     CALL getin('ok_ice_sursat', ok_ice_sursat_omp)
     1307    !Config Key  = ok_ice_supersat
     1308    !Config Desc = include ice supersaturation for cold clouds
     1309    !Config Def  = .FALSE.
     1310    !Config Help =
     1311
     1312     ok_ice_supersat_omp = .FALSE.
     1313    CALL getin('ok_ice_supersat',ok_ice_supersat_omp)
    13141314
    13151315    !Config Key  = ok_plane_h2o
    1316     !Config Desc =
    1317     !Config Def  = 0
     1316    !Config Desc = include H2O emissions from aviation
     1317    !Config Def  = .FALSE.
    13181318    !Config Help =
    13191319
     
    13221322
    13231323    !Config Key  = ok_plane_contrail
    1324     !Config Desc =
    1325     !Config Def  = 0
     1324    !Config Desc = include the formation of contrail cirrus clouds
     1325    !Config Def  = .FALSE.
    13261326    !Config Help =
    13271327
     
    22582258    rad_chau2 = rad_chau2_omp
    22592259    iflag_ice_thermo = iflag_ice_thermo_omp
    2260     ok_ice_sursat = ok_ice_sursat_omp
     2260    ok_ice_supersat = ok_ice_supersat_omp
    22612261    ok_plane_h2o = ok_plane_h2o_omp
    22622262    ok_plane_contrail = ok_plane_contrail_omp
     
    26832683    WRITE(lunout, *) ' rad_chau2 = ', rad_chau2
    26842684    WRITE(lunout, *) ' iflag_ice_thermo = ', iflag_ice_thermo
    2685     WRITE(lunout, *) ' ok_ice_sursat = ', ok_ice_sursat
     2685    WRITE(lunout,*)  ' ok_ice_supersat = ',ok_ice_supersat
    26862686    WRITE(lunout, *) ' ok_plane_h2o = ', ok_plane_h2o
    26872687    WRITE(lunout, *) ' ok_plane_contrail = ', ok_plane_contrail
  • LMDZ6/branches/Amaury_dev/libf/phylmd/create_etat0_unstruct_mod.F90

    r5139 r5224  
    257257    prw_ancien = 0.
    258258    agesno = 0.
     259   
     260    ! LSCP condensation and ice supersaturation
     261    cf_ancien = 0.
     262    rvc_ancien = 0.
    259263
    260264    wake_delta_pbl_TKE(:,:,:)=0
     
    309313    END IF
    310314    ratqs_inter_ = 0.002
    311     rneb_ancien = 0.
    312315
    313316    CALL gather_omp(cell_area,cell_area_mpi)
  • LMDZ6/branches/Amaury_dev/libf/phylmd/dyn1d/lmdz_old_lmdz1d.F90

    r5186 r5224  
    1919            ftsol, beta_aridity, pbl_tke, pctsrf, radsol, rain_fall, snow_fall, ratqs, &
    2020            rnebcon, rugoro, sig1, w01, solaire_etat0, sollw, sollwdown, &
    21             solsw, solswfdiff, t_ancien, q_ancien, u_ancien, v_ancien, rneb_ancien, &
     21            solsw, solswfdiff, t_ancien, q_ancien, u_ancien, v_ancien, &
    2222            wake_delta_pbl_TKE, delta_tsurf, wake_fip, wake_pe, &
    2323            wake_deltaq, wake_deltat, wake_s, awake_s, wake_dens, &
     
    915915        u_ancien(1, :) = u(:)
    916916                v_ancien(1, :) = v(:)
    917                 rneb_ancien(1, :) = 0.
    918917
    919918        u10m = 0.
  • LMDZ6/branches/Amaury_dev/libf/phylmd/dyn1d/lmdz_scm.F90

    r5186 r5224  
    1212            ftsol, beta_aridity, pbl_tke, pctsrf, radsol, rain_fall, snow_fall, ratqs, &
    1313            rnebcon, rugoro, sig1, w01, solaire_etat0, sollw, sollwdown, &
    14             solsw, solswfdiff, t_ancien, q_ancien, u_ancien, v_ancien, rneb_ancien, &
     14            solsw, solswfdiff, t_ancien, q_ancien, u_ancien, v_ancien, &
    1515            wake_delta_pbl_TKE, delta_tsurf, wake_fip, wake_pe, &
    1616            wake_deltaq, wake_deltat, wake_s, awake_s, wake_dens, &
     
    665665        u_ancien(1, :)= u(:)
    666666                v_ancien(1, :)= v(:)
    667                 rneb_ancien(1, :)= 0.
    668667
    669668        u10m = 0.
  • LMDZ6/branches/Amaury_dev/libf/phylmd/lmdz_clesphys.f90

    r5137 r5224  
    1 ! $Id$
    21! Replaces clesphys.h
    32
     
    4544          , ok_lic_melt, ok_lic_cond, aer_type                         &
    4645          , iflag_rrtm, ok_strato, ok_hines, ok_qch4                    &
    47           , iflag_ice_thermo, ok_ice_sursat                            &
     46          , iflag_ice_thermo, ok_ice_supersat                            &
    4847          , ok_plane_h2o, ok_plane_contrail                            &
    4948          , ok_gwd_rando, NSW, iflag_albedo                            &
     
    142141  LOGICAL :: ok_airs
    143142  INTEGER :: ip_ebil_phy, iflag_rrtm, iflag_ice_thermo, NSW, iflag_albedo
    144   LOGICAL :: ok_ice_sursat, ok_plane_h2o, ok_plane_contrail
     143  LOGICAL :: ok_ice_supersat, ok_plane_h2o, ok_plane_contrail
    145144  LOGICAL :: ok_chlorophyll
    146145  LOGICAL :: ok_strato
     
    202201  !$OMP      , ok_lic_melt, ok_lic_cond, aer_type                         &
    203202  !$OMP      , iflag_rrtm, ok_strato, ok_hines, ok_qch4                    &
    204   !$OMP      , iflag_ice_thermo, ok_ice_sursat                            &
     203  !$OMP      , iflag_ice_thermo, ok_ice_supersat                            &
    205204  !$OMP      , ok_plane_h2o, ok_plane_contrail                            &
    206205  !$OMP      , ok_gwd_rando, NSW, iflag_albedo                            &
  • LMDZ6/branches/Amaury_dev/libf/phylmd/lmdz_lscp.F90

    r5194 r5224  
    88  SUBROUTINE 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, &
     
    99105    USE lmdz_lscp_tools, ONLY: icefrac_lscp, icefrac_lscp_turb
    100106    USE lmdz_lscp_tools, ONLY: fallice_velocity, distance_to_cloud_top
    101     USE ice_sursat_mod, ONLY: ice_sursat
     107    USE lmdz_lscp_condensation, ONLY: condensation_lognormal, condensation_ice_supersat
    102108    USE lmdz_lscp_poprecip, ONLY: poprecip_precld, poprecip_postcld
    103109
    104110    ! Use du module lmdz_lscp_ini contenant les constantes
    105     USE lmdz_lscp_ini, ONLY: prt_level, lunout
     111    USE lmdz_lscp_ini, ONLY: prt_level, lunout, eps
    106112    USE lmdz_lscp_ini, ONLY: seuil_neb, niter_lscp, iflag_evap_prec, t_coup, DDT0, ztfondue, rain_int_min
    107113    USE lmdz_lscp_ini, ONLY: ok_radocond_snow, a_tr_sca, cld_expo_con, cld_expo_lsc
     
    112118    USE lmdz_lscp_ini, ONLY: RCPD, RLSTT, RLVTT, RLMLT, RVTMP2, RTT, RD, RG
    113119    USE lmdz_lscp_ini, ONLY: ok_poprecip
    114     USE lmdz_lscp_ini, ONLY: iflag_icefrac
     120    USE lmdz_lscp_ini, ONLY: ok_external_lognormal, ok_ice_supersat, ok_unadjusted_clouds, iflag_icefrac
    115121    USE lmdz_abort_physic, ONLY: abort_physic
    116122    IMPLICIT NONE
     
    135141    INTEGER, INTENT(IN) :: iflag_ice_thermo! flag to activate the ice thermodynamics
    136142    ! 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 
    139143    LOGICAL, DIMENSION(klon, klev), INTENT(IN) :: ptconv          ! grid points where deep convection scheme is active
    140144
     
    146150    REAL, DIMENSION(klon, klev), INTENT(IN) :: pspsk               ! exner potential (p/100000)**(R/cp)
    147151    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]
     152    REAL, DIMENSION(klon, klev+1), INTENT(IN) :: tke                 !--turbulent kinetic energy [m2/s2]
     153    REAL, DIMENSION(klon, klev+1), INTENT(IN) :: tke_dissip          !--TKE dissipation [m2/s3]
    150154
    151155    ! INPUT/OUTPUT variables
     
    155159    REAL, DIMENSION(klon, klev), INTENT(INOUT) :: ratqs            ! function of pressure that sets the large-scale
    156160
    157 
    158     ! Input sursaturation en glace
    159     REAL, DIMENSION(klon, klev), INTENT(INOUT) :: rneb_seri           ! fraction nuageuse en memoire
     161    ! INPUT/OUTPUT condensation and ice supersaturation
     162    !--------------------------------------------------
     163    REAL, DIMENSION(klon, klev), INTENT(INOUT) :: cf_seri          ! cloud fraction [-]
     164    REAL, DIMENSION(klon, klev), INTENT(INOUT) :: ratio_qi_qtot    ! solid specific water to total specific water ratio [-]
     165    REAL, DIMENSION(klon, klev), INTENT(INOUT) :: rvc_seri         ! cloudy water vapor to total water vapor ratio [-]
     166    REAL, DIMENSION(klon, klev), INTENT(IN) :: u_seri           ! eastward wind [m/s]
     167    REAL, DIMENSION(klon, klev), INTENT(IN) :: v_seri           ! northward wind [m/s]
     168    REAL, DIMENSION(klon), INTENT(IN) :: cell_area        ! area of each cell [m2]
     169
     170    ! INPUT/OUTPUT aviation
     171    !--------------------------------------------------
     172    REAL, DIMENSION(klon, klev), INTENT(IN) :: flight_dist      ! Aviation distance flown within the mesh [m/s/mesh]
     173    REAL, DIMENSION(klon, klev), INTENT(IN) :: flight_h2o       ! Aviation H2O emitted within the mesh [kg H2O/s/mesh]
    160174
    161175    ! OUTPUT variables
    162176    !-----------------
    163177
    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 [-]
     178    REAL, DIMENSION(klon, klev), INTENT(OUT) :: d_t              ! temperature increment [K]
     179    REAL, DIMENSION(klon, klev), INTENT(OUT) :: d_q              ! specific humidity increment [kg/kg]
     180    REAL, DIMENSION(klon, klev), INTENT(OUT) :: d_ql             ! liquid water increment [kg/kg]
     181    REAL, DIMENSION(klon, klev), INTENT(OUT) :: d_qi             ! cloud ice mass increment [kg/kg]
     182    REAL, DIMENSION(klon, klev), INTENT(OUT) :: rneb             ! cloud fraction [-]
     183    REAL, DIMENSION(klon, klev), INTENT(OUT) :: rneblsvol        ! cloud fraction per unit volume [-]
     184    REAL, DIMENSION(klon, klev), INTENT(OUT) :: pfraclr          ! precip fraction clear-sky part [-]
     185    REAL, DIMENSION(klon, klev), INTENT(OUT) :: pfracld          ! precip fraction cloudy part [-]
    172186    REAL, DIMENSION(klon, klev), INTENT(OUT) :: cldfraliq           ! liquid fraction of cloud [-]
    173187    REAL, DIMENSION(klon, klev), INTENT(OUT) :: sigma2_icefracturb  ! Variance of the diagnostic supersaturation distribution (icefrac_turb) [-]
    174188    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
     189    REAL, DIMENSION(klon, klev), INTENT(OUT) :: radocond         ! condensed water used in the radiation scheme [kg/kg]
     190    REAL, DIMENSION(klon, klev), INTENT(OUT) :: radicefrac       ! ice fraction of condensed water for radiation scheme
     191    REAL, DIMENSION(klon, klev), INTENT(OUT) :: rhcl             ! clear-sky relative humidity [-]
     192    REAL, DIMENSION(klon), INTENT(OUT) :: rain             ! surface large-scale rainfall [kg/s/m2]
     193    REAL, DIMENSION(klon), INTENT(OUT) :: snow             ! surface large-scale snowfall [kg/s/m2]
     194    REAL, DIMENSION(klon, klev + 1), INTENT(OUT) :: prfl             ! large-scale rainfall flux in the column [kg/s/m2]
     195    REAL, DIMENSION(klon, klev + 1), INTENT(OUT) :: psfl             ! large-scale snowfall flux in the column [kg/s/m2]
     196    REAL, DIMENSION(klon, klev), INTENT(OUT) :: distcltop        ! distance to cloud top [m]
     197    REAL, DIMENSION(klon, klev), INTENT(OUT) :: temp_cltop       ! temperature of cloud top [K]
     198    REAL, DIMENSION(klon, klev), INTENT(OUT) :: beta             ! conversion rate of condensed water
    187199
    188200    ! fraction of aerosol scavenging through impaction and nucleation    (for on-line)
     
    191203    REAL, DIMENSION(klon, klev), INTENT(OUT) :: frac_nucl           ! scavenging fraction due tu nucleation [-]
    192204
    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
     205    ! for condensation and ice supersaturation
     206
     207    REAL, DIMENSION(klon, klev), INTENT(OUT) :: qsub           !--specific total water content in sub-saturated clear sky region [kg/kg]
     208    REAL, DIMENSION(klon, klev), INTENT(OUT) :: qissr          !--specific total water content in supersat region [kg/kg]
     209    REAL, DIMENSION(klon, klev), INTENT(OUT) :: qcld           !--specific total water content in cloudy region [kg/kg]
     210    REAL, DIMENSION(klon, klev), INTENT(OUT) :: subfra         !--mesh fraction of subsaturated clear sky [-]
     211    REAL, DIMENSION(klon, klev), INTENT(OUT) :: issrfra        !--mesh fraction of ISSR [-]
     212    REAL, DIMENSION(klon, klev), INTENT(OUT) :: gamma_cond     !--coefficient governing the ice nucleation RHi threshold [-]
     213    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dcf_sub        !--cloud fraction tendency because of sublimation [s-1]
     214    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dcf_con        !--cloud fraction tendency because of condensation [s-1]
     215    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dcf_mix        !--cloud fraction tendency because of cloud mixing [s-1]
     216    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqi_adj        !--specific ice content tendency because of temperature adjustment [kg/kg/s]
     217    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqi_sub        !--specific ice content tendency because of sublimation [kg/kg/s]
     218    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqi_con        !--specific ice content tendency because of condensation [kg/kg/s]
     219    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqi_mix        !--specific ice content tendency because of cloud mixing [kg/kg/s]
     220    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqvc_adj       !--specific cloud water vapor tendency because of temperature adjustment [kg/kg/s]
     221    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqvc_sub       !--specific cloud water vapor tendency because of sublimation [kg/kg/s]
     222    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqvc_con       !--specific cloud water vapor tendency because of condensation [kg/kg/s]
     223    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqvc_mix       !--specific cloud water vapor tendency because of cloud mixing [kg/kg/s]
     224    REAL, DIMENSION(klon, klev), INTENT(OUT) :: qsatl          !--saturation specific humidity wrt liquid [kg/kg]
     225    REAL, DIMENSION(klon, klev), INTENT(OUT) :: qsati          !--saturation specific humidity wrt ice [kg/kg]
     226
     227    ! for contrails and aviation
     228
     229    REAL, DIMENSION(klon, klev), INTENT(OUT) :: Tcontr         !--threshold temperature for contrail formation [K]
     230    REAL, DIMENSION(klon, klev), INTENT(OUT) :: qcontr         !--threshold humidity for contrail formation [kg/kg]
     231    REAL, DIMENSION(klon, klev), INTENT(OUT) :: qcontr2        !--// (2nd expression more consistent with LMDZ expression of q)
     232    REAL, DIMENSION(klon, klev), INTENT(OUT) :: fcontrN        !--fraction of grid favourable to non-persistent contrails
     233    REAL, DIMENSION(klon, klev), INTENT(OUT) :: fcontrP        !--fraction of grid favourable to persistent contrails
     234    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dcf_avi        !--cloud fraction tendency because of aviation [s-1]
     235    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqi_avi        !--specific ice content tendency because of aviation [kg/kg/s]
     236    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqvc_avi       !--specific cloud water vapor tendency because of aviation [kg/kg/s]
    211237
    212238    ! for POPRECIP
     
    225251    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqsfreez       !--snow tendency due to freezing [kg/kg/s]
    226252    REAL, DIMENSION(klon, klev), INTENT(OUT) :: dqrfreez       !--rain tendency due to freezing [kg/kg/s]
     253
     254    ! for thermals
     255
     256    REAL, DIMENSION(klon, klev), INTENT(OUT) :: cloudth_sth      !--mean saturation deficit in thermals
     257    REAL, DIMENSION(klon, klev), INTENT(OUT) :: cloudth_senv     !--mean saturation deficit in environment
     258    REAL, DIMENSION(klon, klev), INTENT(OUT) :: cloudth_sigmath  !--std of saturation deficit in thermals
     259    REAL, DIMENSION(klon, klev), INTENT(OUT) :: cloudth_sigmaenv !--std of saturation deficit in environment
    227260
    228261
     
    292325    REAL, DIMENSION(klon) :: zqliq, zqice, zqvapcl        ! for icefrac_lscp_turb
    293326
     327    ! for condensation and ice supersaturation
     328    REAL, DIMENSION(klon) :: qvc, shear
     329    REAL :: delta_z
     330    !--Added for ice supersaturation (ok_ice_supersat) and contrails (ok_plane_contrails)
     331    ! Constants used for calculating ratios that are advected (using a parent-child
     332    ! formalism). This is not done in the dynamical core because at this moment,
     333    ! only isotopes can use this parent-child formalism. Note that the two constants
     334    ! are the same as the one use in the dynamical core, being also defined in
     335    ! dyn3d_common/infotrac.F90
     336    REAL :: min_qParent, min_ratio
     337
    294338    INTEGER i, k, n, kk, iter
    295339    INTEGER, DIMENSION(klon) :: n_i
     
    375419    ztemp_cltop(:) = 0.0
    376420    ztupnew(:) = 0.0
    377     !--ice supersaturation
    378     gamma_ss(:, :) = 1.0
    379     qss(:, :) = 0.0
    380     rnebss(:, :) = 0.0
     421
     422    distcltop(:, :) = 0.
     423    temp_cltop(:, :) = 0.
     424
     425    !--Ice supersaturation
     426    gamma_cond(:, :) = 1.
     427    qissr(:, :) = 0.
     428    issrfra(:, :) = 0.
     429    dcf_sub(:, :) = 0.
     430    dcf_con(:, :) = 0.
     431    dcf_mix(:, :) = 0.
     432    dqi_adj(:, :) = 0.
     433    dqi_sub(:, :) = 0.
     434    dqi_con(:, :) = 0.
     435    dqi_mix(:, :) = 0.
     436    dqvc_adj(:, :) = 0.
     437    dqvc_sub(:, :) = 0.
     438    dqvc_con(:, :) = 0.
     439    dqvc_mix(:, :) = 0.
     440    fcontrN(:, :) = 0.
     441    fcontrP(:, :) = 0.
    381442    Tcontr(:, :) = missing_val
    382443    qcontr(:, :) = missing_val
    383444    qcontr2(:, :) = missing_val
    384     fcontrN(:, :) = 0.0
    385     fcontrP(:, :) = 0.0
    386     distcltop(:, :) = 0.
    387     temp_cltop(:, :) = 0.
     445    dcf_avi(:, :) = 0.
     446    dqi_avi(:, :) = 0.
     447    dqvc_avi(:, :) = 0.
     448    qvc(:) = 0.
     449    shear(:) = 0.
     450    min_qParent = 1.e-30
     451    min_ratio = 1.e-16
    388452
    389453    !-- poprecip
     
    772836          rneblsvol(i, k) = ctot_vol(i, k)
    773837          zqn(i) = qcloud(i)
     838          !--AB grid-mean vapor in the cloud - we assume saturation adjustment
     839          qvc(i) = rneb(i, k) * zqs(i)
    774840        ENDDO
    775841
     
    807873      DO iter = 1, iflag_fisrtilp_qsat + 1
    808874
     875        keepgoing(:) = .FALSE.
     876
    809877        DO i = 1, klon
    810878
    811879          ! keepgoing = .TRUE. while convergence is not satisfied
    812           keepgoing(i) = ABS(DT(i))>DDT0
    813 
    814           IF ((keepgoing(i) .OR. (n_i(i) == 0)) .AND. lognormale(i)) THEN
     880          IF (((ABS(DT(i))>DDT0) .OR. (n_i(i) == 0)) .AND. lognormale(i)) THEN
     881
    815882
    816883            ! if not convergence:
     884            ! we calculate a new iteration
     885            keepgoing(i) = .TRUE.
    817886
    818887            ! P2.2.1> cloud fraction and condensed water mass calculation
     
    830899            qtot(i) = zq(i) + zmqc(i)
    831900
    832           ENDIF
    833 
    834         ENDDO
     901          END IF
     902
     903        END DO
    835904
    836905        ! Calculation of saturation specific humidity and ice fraction
     
    843912          ! For iflag_t_glace GE 4 the phase partition function dependends on temperature AND distance to cloud top
    844913          CALL distance_to_cloud_top(klon, klev, k, temp, pplay, paprs, rneb, zdistcltop, ztemp_cltop)
    845         ENDIF
     914        END IF
    846915
    847916        CALL icefrac_lscp(klon, zt(:), iflag_ice_thermo, zdistcltop(:), ztemp_cltop(:), zfice(:), dzfice(:))
    848917
    849         DO i = 1, klon !todoan : check if loop in i is needed
    850 
    851           IF ((keepgoing(i) .OR. (n_i(i) == 0)) .AND. lognormale(i)) THEN
    852 
    853             zpdf_sig(i) = ratqs(i, k) * zq(i)
    854             zpdf_k(i) = -sqrt(log(1. + (zpdf_sig(i) / zq(i))**2))
    855             zpdf_delta(i) = log(zq(i) / (gammasat(i) * zqs(i)))
    856             zpdf_a(i) = zpdf_delta(i) / (zpdf_k(i) * sqrt(2.))
    857             zpdf_b(i) = zpdf_k(i) / (2. * sqrt(2.))
    858             zpdf_e1(i) = zpdf_a(i) - zpdf_b(i)
    859             zpdf_e1(i) = sign(min(ABS(zpdf_e1(i)), 5.), zpdf_e1(i))
    860             zpdf_e1(i) = 1. - erf(zpdf_e1(i))
    861             zpdf_e2(i) = zpdf_a(i) + zpdf_b(i)
    862             zpdf_e2(i) = sign(min(ABS(zpdf_e2(i)), 5.), zpdf_e2(i))
    863             zpdf_e2(i) = 1. - erf(zpdf_e2(i))
    864 
    865             IF ((.NOT.ok_ice_sursat).OR.(Tbef(i)>t_glace_min)) THEN
     918        !--AB Activates a condensation scheme that allows for
     919        !--ice supersaturation and contrails evolution from aviation
     920        IF (ok_ice_supersat) THEN
     921
     922          !--Calculate the shear value (input for condensation and ice supersat)
     923          DO i = 1, klon
     924            !--Cell thickness [m]
     925            delta_z = (paprs(i, k) - paprs(i, k + 1)) / RG / pplay(i, k) * Tbef(i) * RD
     926            IF (iftop) THEN
     927              ! top
     928              shear(i) = SQRT(((u_seri(i, k) - u_seri(i, k - 1)) / delta_z)**2. &
     929                      + ((v_seri(i, k) - v_seri(i, k - 1)) / delta_z)**2.)
     930            ELSE IF (k == 1) THEN
     931              ! surface
     932              shear(i) = SQRT(((u_seri(i, k + 1) - u_seri(i, k)) / delta_z)**2. &
     933                      + ((v_seri(i, k + 1) - v_seri(i, k)) / delta_z)**2.)
     934            ELSE
     935              ! other layers
     936              shear(i) = SQRT((((u_seri(i, k + 1) + u_seri(i, k)) / 2. &
     937                      - (u_seri(i, k) + u_seri(i, k - 1)) / 2.) / delta_z)**2. &
     938                      + (((v_seri(i, k + 1) + v_seri(i, k)) / 2. &
     939                              - (v_seri(i, k) + v_seri(i, k - 1)) / 2.) / delta_z)**2.)
     940            END IF
     941          END DO
     942
     943          !---------------------------------------------
     944          !--   CONDENSATION AND ICE SUPERSATURATION  --
     945          !---------------------------------------------
     946
     947          CALL condensation_ice_supersat(&
     948                  klon, dtime, missing_val, &
     949                  pplay(:, k), paprs(:, k), paprs(:, k + 1), &
     950                  cf_seri(:, k), rvc_seri(:, k), ratio_qi_qtot(:, k), &
     951                  shear(:), tke_dissip(:, k), cell_area(:), &
     952                  Tbef(:), zq(:), zqs(:), gammasat(:), ratqs(:, k), keepgoing(:), &
     953                  rneb(:, k), zqn(:), qvc(:), issrfra(:, k), qissr(:, k), &
     954                  dcf_sub(:, k), dcf_con(:, k), dcf_mix(:, k), &
     955                  dqi_adj(:, k), dqi_sub(:, k), dqi_con(:, k), dqi_mix(:, k), &
     956                  dqvc_adj(:, k), dqvc_sub(:, k), dqvc_con(:, k), dqvc_mix(:, k), &
     957                  Tcontr(:, k), qcontr(:, k), qcontr2(:, k), fcontrN(:, k), fcontrP(:, k), &
     958                  flight_dist(:, k), flight_h2o(:, k), &
     959                  dcf_avi(:, k), dqi_avi(:, k), dqvc_avi(:, k))
     960
     961
     962          !--If .TRUE., calls an externalised version of the generalised
     963          !--lognormal condensation scheme (Bony and Emanuel 2001)
     964          !--Numerically, convergence is conserved with this option
     965          !--The objective is to simplify LSCP
     966        ELSE IF (ok_external_lognormal) THEN
     967
     968          CALL condensation_lognormal(&
     969                  klon, Tbef(:), zq(:), zqs(:), gammasat(:), ratqs(:, k), &
     970                  keepgoing(:), rneb(:, k), zqn(:), qvc(:))
     971
     972        ELSE !--Generalised lognormal (Bony and Emanuel 2001)
     973
     974          DO i = 1, klon !todoan : check if loop in i is needed
     975
     976            IF (keepgoing(i)) THEN
     977
     978              zpdf_sig(i) = ratqs(i, k) * zq(i)
     979              zpdf_k(i) = -sqrt(log(1. + (zpdf_sig(i) / zq(i))**2))
     980              zpdf_delta(i) = log(zq(i) / (gammasat(i) * zqs(i)))
     981              zpdf_a(i) = zpdf_delta(i) / (zpdf_k(i) * sqrt(2.))
     982              zpdf_b(i) = zpdf_k(i) / (2. * sqrt(2.))
     983              zpdf_e1(i) = zpdf_a(i) - zpdf_b(i)
     984              zpdf_e1(i) = sign(min(ABS(zpdf_e1(i)), 5.), zpdf_e1(i))
     985              zpdf_e1(i) = 1. - erf(zpdf_e1(i))
     986              zpdf_e2(i) = zpdf_a(i) + zpdf_b(i)
     987              zpdf_e2(i) = sign(min(ABS(zpdf_e2(i)), 5.), zpdf_e2(i))
     988              zpdf_e2(i) = 1. - erf(zpdf_e2(i))
    866989
    867990              IF (zpdf_e1(i)<1.e-10) THEN
    868991                rneb(i, k) = 0.
    869                 zqn(i) = gammasat(i) * zqs(i)
     992                zqn(i) = zqs(i)
     993                !--AB grid-mean vapor in the cloud - we assume saturation adjustment
     994                qvc(i) = 0.
    870995              ELSE
    871996                rneb(i, k) = 0.5 * zpdf_e1(i)
    872997                zqn(i) = zq(i) * zpdf_e2(i) / zpdf_e1(i)
    873               ENDIF
    874 
    875               rnebss(i, k) = 0.0   !--added by OB (needed because of the convergence loop on time)
    876               fcontrN(i, k) = 0.0  !--idem
    877               fcontrP(i, k) = 0.0  !--idem
    878               qss(i, k) = 0.0      !--idem
    879 
    880             ELSE ! in case of ice supersaturation by Audran
    881 
    882               !------------------------------------
    883               ! ICE SUPERSATURATION
    884               !------------------------------------
    885 
    886               CALL ice_sursat(pplay(i, k), paprs(i, k) - paprs(i, k + 1), dtime, i, k, temp(i, k), zq(i), &
    887                       gamma_ss(i, k), zqs(i), Tbef(i), rneb_seri(i, k), ratqs(i, k), &
    888                       rneb(i, k), zqn(i), rnebss(i, k), qss(i, k), &
    889                       Tcontr(i, k), qcontr(i, k), qcontr2(i, k), fcontrN(i, k), fcontrP(i, k))
    890 
    891             ENDIF ! ((flag_ice_sursat.EQ.0).OR.(Tbef(i).gt.t_glace_min))
     998                !--AB grid-mean vapor in the cloud - we assume saturation adjustment
     999                qvc(i) = rneb(i, k) * zqs(i)
     1000              END IF
     1001
     1002            END IF ! keepgoing
     1003          END DO ! loop on klon
     1004
     1005        END IF ! .NOT. ok_ice_supersat
     1006
     1007        DO i = 1, klon
     1008          IF (keepgoing(i)) THEN
    8921009
    8931010            ! If vertical heterogeneity, change fraction by volume as well
     
    8951012              ctot_vol(i, k) = rneb(i, k)
    8961013              rneblsvol(i, k) = ctot_vol(i, k)
    897             ENDIF
     1014            END IF
    8981015
    8991016
     
    9111028
    9121029            ! LEA_R : check formule
    913             qlbef(i) = max(0., zqn(i) - zqs(i))
     1030            IF (ok_unadjusted_clouds) THEN
     1031              !--AB We relax the saturation adjustment assumption
     1032              !-- qvc (grid-mean vapor in cloud) is calculated by the condensation scheme
     1033              IF (rneb(i, k) > eps) THEN
     1034                qlbef(i) = MAX(0., zqn(i) - qvc(i) / rneb(i, k))
     1035              ELSE
     1036                qlbef(i) = 0.
     1037              ENDIF
     1038            ELSE
     1039              qlbef(i) = max(0., zqn(i) - zqs(i))
     1040            ENDIF
     1041
    9141042            num = -Tbef(i) + zt(i) + rneb(i, k) * ((1 - zfice(i)) * RLVTT &
    9151043                    + zfice(i) * RLSTT) / RCPD / (1.0 + RVTMP2 * (zq(i) + zmqc(i))) * qlbef(i)
     
    9781106            zqn(i) = zq(i)
    9791107            rneb(i, k) = 1.0
    980             zcond(i) = MAX(0.0, zqn(i) - zqs(i))
     1108            IF (ok_unadjusted_clouds) THEN
     1109              !--AB We relax the saturation adjustment assumption
     1110              !-- qvc (grid-mean vapor in cloud) is calculated by the condensation scheme
     1111              zcond(i) = MAX(0., zqn(i) - qvc(i))
     1112            ELSE
     1113              IF (ok_unadjusted_clouds) THEN
     1114                !--AB We relax the saturation adjustment assumption
     1115                !-- qvc (grid-mean vapor in cloud) is calculated by the condensation scheme
     1116                zcond(i) = MAX(0., zqn(i) * rneb(i, k) - qvc(i))
     1117              ELSE
     1118                zcond(i) = MAX(0.0, zqn(i) - zqs(i)) * rneb(i, k)
     1119              ENDIF
     1120            ENDIF
    9811121            rhcl(i, k) = 1.0
    9821122          ELSE
     
    10061146                * RLVTT / RCPD / (1.0 + RVTMP2 * (zq(i) + zmqc(i) + zcond(i))) &
    10071147                + zfice(i) * zcond(i) * RLSTT / RCPD / (1.0 + RVTMP2 * (zq(i) + zmqc(i) + zcond(i)))
    1008       ENDDO
     1148      END DO
    10091149
    10101150      ! If vertical heterogeneity, change volume fraction
     
    10121152        ctot_vol(1:klon, k) = min(max(ctot_vol(1:klon, k), 0.), 1.)
    10131153        rneblsvol(1:klon, k) = ctot_vol(1:klon, k)
    1014       ENDIF
     1154      END IF
     1155
     1156      !--AB Write diagnostics and tracers for ice supersaturation
     1157      IF (ok_ice_supersat) THEN
     1158        CALL calc_qsat_ecmwf(klon, zt, qzero, pplay(:, k), RTT, 1, .FALSE., qsatl(:, k), zdqs)
     1159        CALL calc_qsat_ecmwf(klon, zt, qzero, pplay(:, k), RTT, 2, .FALSE., qsati(:, k), zdqs)
     1160
     1161        DO i = 1, klon
     1162
     1163          cf_seri(i, k) = rneb(i, k)
     1164
     1165          IF (.NOT. ok_unadjusted_clouds) THEN
     1166            qvc(i) = zqs(i) * rneb(i, k)
     1167          END IF
     1168          IF (zq(i) > min_qParent) THEN
     1169            rvc_seri(i, k) = qvc(i) / zq(i)
     1170          ELSE
     1171            rvc_seri(i, k) = min_ratio
     1172          END IF
     1173          !--The MIN barrier is NEEDED because of:
     1174          !-- 1) very rare pathological cases of the lsc scheme (rvc = 1. + 1e-16 sometimes)
     1175          !-- 2) the thermal scheme does NOT guarantee that qvc <= qvap (or even qincld <= qtot)
     1176          !--The MAX barrier is a safeguard that should not be activated
     1177          rvc_seri(i, k) = MIN(MAX(rvc_seri(i, k), 0.), 1.)
     1178
     1179          !--Diagnostics
     1180          gamma_cond(i, k) = gammasat(i)
     1181          IF (issrfra(i, k) < eps) THEN
     1182            issrfra(i, k) = 0.
     1183            qissr(i, k) = 0.
     1184          END IF
     1185          subfra(i, k) = 1. - cf_seri(i, k) - issrfra(i, k)
     1186          qsub(i, k) = zq(i) - qvc(i) - qissr(i, k)
     1187          IF (subfra(i, k) < eps) THEN
     1188            subfra(i, k) = 0.
     1189            qsub(i, k) = 0.
     1190          END IF
     1191          qcld(i, k) = qvc(i) + zcond(i)
     1192          IF (cf_seri(i, k) < eps) THEN
     1193            qcld(i, k) = 0.
     1194          END IF
     1195        END DO
     1196      END IF
    10151197
    10161198      ! ----------------------------------------------------------------
     
    10241206          zoliql(i) = zcond(i) * (1. - zfice(i))
    10251207          zoliqi(i) = zcond(i) * zfice(i)
    1026         ENDDO
     1208        END DO
    10271209
    10281210        CALL poprecip_postcld(klon, dtime, paprs(:, k), paprs(:, k + 1), pplay(:, k), &
     
    13321514              znebprecipcld(i) = 0.0
    13331515            ENDIF
    1334         ENDDO
     1516          ENDDO
    13351517
    13361518        ENDIF
     
    14251607            frac_impa(i, kk) = 1. - zneb(i) * zfrac_lessi
    14261608
    1427           ENDIF
    1428 
    1429         ENDDO
    1430 
    1431       ENDDO
    1432 
    1433       !--save some variables for ice supersaturation
    1434 
    1435       DO i = 1, klon
    1436         ! for memory
    1437         rneb_seri(i, k) = rneb(i, k)
    1438 
    1439         ! for diagnostics
    1440         rnebclr(i, k) = 1.0 - rneb(i, k) - rnebss(i, k)
    1441 
    1442         qvc(i, k) = zqs(i) * rneb(i, k)
    1443         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
    1444         qcld(i, k) = qvc(i, k) + zcond(i)
    1445       ENDDO
    1446       !q_sat
    1447       CALL calc_qsat_ecmwf(klon, Tbef(:), qzero(:), pplay(:, k), RTT, 1, .FALSE., qsatl(:, k), zdqs(:))
    1448       CALL calc_qsat_ecmwf(klon, Tbef(:), qzero(:), pplay(:, k), RTT, 2, .FALSE., qsats(:, k), zdqs(:))
    1449 
    1450 
     1609          END IF
     1610
     1611        END DO
     1612
     1613      END DO
    14511614
    14521615      ! Outputs:
     
    14651628        ! c_iso: same for isotopes
    14661629        d_t(i, k) = zt(i) - temp(i, k)
    1467       ENDDO
    1468 
    1469     ENDDO
     1630      END DO
     1631
     1632    END DO
    14701633
    14711634
  • LMDZ6/branches/Amaury_dev/libf/phylmd/lmdz_lscp_condensation.f90

    • Property svn:mergeinfo set to (toggle deleted branches)
      /LMDZ6/trunk/libf/phylmd/lmdz_lscp_condensation.F90mergedeligible
      /LMDZ4/branches/LMDZ4-dev/libf/phylmd/lmdz_lscp_condensation.F901074-1276,​1281-1284
      /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/lmdz_lscp_condensation.F901293-1401
      /LMDZ5/branches/LMDZ5V1.0-dev/libf/phylmd/lmdz_lscp_condensation.F901436-1453
      /LMDZ5/branches/LMDZ5V2.0-dev/libf/phylmd/lmdz_lscp_condensation.F901456-1491
      /LMDZ5/branches/LMDZ_tree_FC/libf/phylmd/lmdz_lscp_condensation.F902924-2946
      /LMDZ6/branches/LMDZ_ECRad/libf/phylmd/lmdz_lscp_condensation.F904175-4488
      /LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/lmdz_lscp_condensation.F904660-4721
      /LMDZ6/branches/Ocean_skin/libf/phylmd/lmdz_lscp_condensation.F903428-4369
      /LMDZ6/branches/blowing_snow/libf/phylmd/lmdz_lscp_condensation.F904485-4522
    r5223 r5224  
    7474
    7575
    76     IF ( pdf_e1 .LT. eps ) THEN
     76    IF ( pdf_e1 < eps ) THEN
    7777      cldfra(i) = 0.
    7878      qincld(i) = qsat(i)
     
    300300    !--If ok_weibull_warm_clouds = .TRUE., the Weibull law is used for
    301301    !--all clouds, and the lognormal scheme is not activated
    302     IF ( ( temp(i) .GT. temp_nowater ) .AND. .NOT. ok_weibull_warm_clouds ) THEN
     302    IF ( ( temp(i) > temp_nowater ) .AND. .NOT. ok_weibull_warm_clouds ) THEN
    303303
    304304      pdf_std   = ratqs(i) * qtot(i)
     
    315315
    316316
    317       IF ( pdf_e1 .LT. eps ) THEN
     317      IF ( pdf_e1 < eps ) THEN
    318318        cldfra(i) = 0.
    319319        qincld(i) = qsat(i)
     
    330330
    331331      !--Initialisation
    332       IF ( temp(i) .GT. temp_nowater ) THEN
     332      IF ( temp(i) > temp_nowater ) THEN
    333333        !--If the air mass is warm (liquid water can exist),
    334334        !--all the memory is lost and the scheme becomes statistical,
     
    460460     
    461461      !--If there is a cloud
    462       IF ( cldfra(i) .GT. eps ) THEN
     462      IF ( cldfra(i) > eps ) THEN
    463463       
    464464        qvapincld = qvc(i) / cldfra(i)
     
    468468        !--Most probably, we advected a cloud with no ice water content (possible
    469469        !--if the entire cloud precipited for example)
    470         IF ( qiceincld .LT. eps ) THEN
     470        IF ( qiceincld < eps ) THEN
    471471          dcf_sub(i) = - cldfra(i)
    472472          dqvc_sub(i) = - qvc(i)
     
    493493                  + 0.7957 * ( qiceincld * rho * 1e3 )**0.2535 * ( temp(i) - RTT + 190. ) ) / 2.
    494494
    495             IF ( qvapincld .GE. qsat(i) ) THEN
     495            IF ( qvapincld >= qsat(i) ) THEN
    496496              !--If the cloud is initially supersaturated
    497497              !--Exact explicit integration (qvc exact, qice explicit)
     
    507507              qice_ratio = ( 1. - 2. / 3. / kappa / r_ice**2. * dtime * ( qsat(i) - qvapincld ) )
    508508
    509               IF ( qice_ratio .LT. 0. ) THEN
     509              IF ( qice_ratio < 0. ) THEN
    510510                !--If all the ice has been sublimated, we sublimate
    511511                !--completely the cloud and do not activate the sublimation
     
    540540
    541541          !--If the vapor in cloud is below vapor needed for the cloud to survive
    542           IF ( qvapincld .LT. qvapincld_new ) THEN
     542          IF ( qvapincld < qvapincld_new ) THEN
    543543            !--Sublimation of the subsaturated cloud
    544544            !--iflag_cloud_sublim_pdf selects the PDF of the ice water content
     
    548548            !--iflag = 3 --> gamma distribution (Karcher et al 2018)
    549549
    550             IF ( iflag_cloud_sublim_pdf .EQ. 1 ) THEN
     550            IF ( iflag_cloud_sublim_pdf == 1 ) THEN
    551551              !--Uniform distribution starting at qvapincld
    552552              pdf_e1 = 1. / ( 2. * qiceincld )
     
    556556                                       * pdf_e1 / 2.
    557557
    558             ELSEIF ( iflag_cloud_sublim_pdf .EQ. 2 ) THEN
     558            ELSEIF ( iflag_cloud_sublim_pdf == 2 ) THEN
    559559              !--Exponential distribution starting at qvapincld
    560560              pdf_alpha = 1. / qiceincld
     
    565565                                       + qvapincld - qvapincld_new * pdf_e1 )
    566566
    567             ELSEIF ( iflag_cloud_sublim_pdf .GE. 3 ) THEN
     567            ELSEIF ( iflag_cloud_sublim_pdf >= 3 ) THEN
    568568              !--Gamma distribution starting at qvapincld
    569569              pdf_alpha = ( mu_subl_pdf_lscp + 1. ) / qiceincld
     
    608608
    609609      !--If there is a clear-sky region
    610       IF ( ( 1. - cldfra(i) ) .GT. eps ) THEN
     610      IF ( ( 1. - cldfra(i) ) > eps ) THEN
    611611
    612612        !--Water quantity in the clear-sky + potential liquid cloud (gridbox average)
     
    626626               * ( ( 1. - cldfra(i) ) * cell_area(i) )**( 1. / 4. ) &
    627627               * MAX( temp(i) - temp_thresh_pdf_lscp, 0. )
    628         IF ( rhl_clr .GT. rhlmid_pdf_lscp ) THEN
     628        IF ( rhl_clr > rhlmid_pdf_lscp ) THEN
    629629          pdf_std = pdf_e1 * ( 2. * rhlmid_pdf_lscp - rhl_clr ) / rhlmid_pdf_lscp
    630630        ELSE
     
    660660          qvc(i) = cldfra(i) * qsat(i)
    661661
    662         ELSEIF ( cf_cond .GT. cond_thresh_pdf_lscp ) THEN
     662        ELSEIF ( cf_cond > cond_thresh_pdf_lscp ) THEN
    663663          !--We check that there is something to condense, if not the
    664664          !--condensation process stops
     
    670670          pdf_e4 = ( 2. * pdf_e3 * pdf_e1 - pdf_x ) &
    671671                 / ( pdf_e3 * pdf_e1 / rhlmid_pdf_lscp - 1. )
    672           IF ( ( MIN(pdf_e4, rhl_clr) .LT. rhlmid_pdf_lscp ) .OR. ( pdf_e4 .GT. rhl_clr ) ) THEN
     672          IF ( ( MIN(pdf_e4, rhl_clr) < rhlmid_pdf_lscp ) .OR. ( pdf_e4 > rhl_clr ) ) THEN
    673673            pdf_e4 = pdf_x / ( pdf_e3 * pdf_e1 / rhlmid_pdf_lscp + 1. )
    674674          ENDIF
     
    720720      !--If there is still clear sky, we diagnose the ISSR
    721721      !--We recalculte the PDF properties (after the condensation process)
    722       IF ( ( ( 1. - dcf_con(i) - cldfra(i) ) .GT. eps ) .AND. .NOT. ok_warm_cloud ) THEN
     722      IF ( ( ( 1. - dcf_con(i) - cldfra(i) ) > eps ) .AND. .NOT. ok_warm_cloud ) THEN
    723723        !--Water quantity in the clear-sky + potential liquid cloud (gridbox average)
    724724        qclr = qtot(i) - dqi_con(i) - dqvc_con(i) - qcld(i)
     
    737737               * ( ( 1. - dcf_con(i) - cldfra(i) ) * cell_area(i) )**( 1. / 4. ) &
    738738               * MAX( temp(i) - temp_thresh_pdf_lscp, 0. )
    739         IF ( rhl_clr .GT. rhlmid_pdf_lscp ) THEN
     739        IF ( rhl_clr > rhlmid_pdf_lscp ) THEN
    740740          pdf_std = pdf_e1 * ( 2. * rhlmid_pdf_lscp - rhl_clr ) / rhlmid_pdf_lscp
    741741        ELSE
     
    772772      !--but does not cover the entire mesh.
    773773      !
    774       IF ( ( cldfra(i) .LT. ( 1. - dcf_con(i) - eps ) ) .AND. ( cldfra(i) .GT. eps ) &
     774      IF ( ( cldfra(i) < ( 1. - dcf_con(i) - eps ) ) .AND. ( cldfra(i) > eps ) &
    775775           .AND. .NOT. ok_warm_cloud ) THEN
    776776
     
    879879        !--First, we mix the subsaturated sky (subfra_mix) and the cloud close
    880880        !--to this fraction (sigma_mix * cldfra_mix).
    881         IF ( subfra(i) .GT. eps ) THEN
     881        IF ( subfra(i) > eps ) THEN
    882882
    883883          IF ( ok_unadjusted_clouds ) THEN
     
    898898                      / ( subfra_mix + cldfra_mix * sigma_mix )
    899899
    900             IF ( qvapinmix .GT. qsat(i) ) THEN
     900            IF ( qvapinmix > qsat(i) ) THEN
    901901              !--If the mixed air is supersaturated, we condense the subsaturated
    902902              !--region which was mixed.
     
    916916        !--for which the mixed air is always supersatured, therefore
    917917        !--the cloud necessarily expands
    918         IF ( issrfra(i) .GT. eps ) THEN
     918        IF ( issrfra(i) > eps ) THEN
    919919
    920920          IF ( ok_unadjusted_clouds ) THEN
     
    994994      !-------------------------------------------
    995995
    996       IF ( cldfra(i) .LT. eps ) THEN
     996      IF ( cldfra(i) < eps ) THEN
    997997        !--If the cloud is too small, it is sublimated.
    998998        cldfra(i) = 0.
  • LMDZ6/branches/Amaury_dev/libf/phylmd/lmdz_lscp_ini.F90

    r5117 r5224  
    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 lmdz_ioipsl_getin_p, ONLY: getin_p
    254    USE ice_sursat_mod, ONLY: ice_sursat_init
    255323   USE lmdz_cloudth_ini, ONLY: cloudth_ini
    256324   USE lmdz_abort_physic, ONLY: abort_physic
     
    258326   REAL, INTENT(IN)      :: dtime
    259327   INTEGER, INTENT(IN)   :: lunout_in,prt_level_in,iflag_ratqs,fl_cor_ebil_in
    260    LOGICAL, INTENT(IN)   :: ok_ice_sursat
     328   LOGICAL, INTENT(IN)   :: ok_ice_supersat_in
    261329
    262330   REAL, INTENT(IN)      :: RCPD_in, RLSTT_in, RLVTT_in, RLMLT_in
    263    REAL, INTENT(IN)      ::  RVTMP2_in, RTT_in, RD_in, RG_in, RV_in, RPI_in
     331   REAL, INTENT(IN)      :: RVTMP2_in, RTT_in, RD_in, RV_in, RG_in, RPI_in, EPS_W_in
    264332   CHARACTER (LEN=20) :: modname='lscp_ini_mod'
    265333   CHARACTER (LEN=80) :: abort_message
     
    270338    fl_cor_ebil=fl_cor_ebil_in
    271339
     340    ok_ice_supersat=ok_ice_supersat_in
     341
    272342    RG=RG_in
    273343    RD=RD_in
     344    RV=RV_in
    274345    RCPD=RCPD_in
    275346    RLVTT=RLVTT_in
     
    280351    RVTMP2=RVTMP2_in
    281352    RPI=RPI_in
     353    EPS_W=EPS_W_in
    282354
    283355
     
    327399    CALL getin_p('gamma_taud',gamma_taud)
    328400    CALL getin_p('iflag_oldbug_fisrtilp',iflag_oldbug_fisrtilp)
     401    CALL getin_p('temp_nowater',temp_nowater)
     402    ! for poprecip
    329403    CALL getin_p('ok_poprecip',ok_poprecip)
    330404    CALL getin_p('ok_corr_vap_evasub',ok_corr_vap_evasub)
     
    346420    CALL getin_p('snow_fallspeed_clr',snow_fallspeed_clr)
    347421    CALL getin_p('snow_fallspeed_cld',snow_fallspeed_cld)
     422    ! for condensation and ice supersaturation
     423    CALL getin_p('ok_external_lognormal',ok_external_lognormal)
     424    CALL getin_p('ok_unadjusted_clouds',ok_unadjusted_clouds)
     425    CALL getin_p('ok_weibull_warm_clouds',ok_weibull_warm_clouds)
     426    CALL getin_p('iflag_cloud_sublim_pdf',iflag_cloud_sublim_pdf)
     427    CALL getin_p('depo_coef_cirrus',depo_coef_cirrus)
     428    CALL getin_p('capa_cond_cirrus',capa_cond_cirrus)
     429    CALL getin_p('mu_subl_pdf_lscp',mu_subl_pdf_lscp)
     430    CALL getin_p('beta_pdf_lscp',beta_pdf_lscp)
     431    CALL getin_p('temp_thresh_pdf_lscp',temp_thresh_pdf_lscp)
     432    CALL getin_p('rhlmid_pdf_lscp',rhlmid_pdf_lscp)
     433    CALL getin_p('k0_pdf_lscp',k0_pdf_lscp)
     434    CALL getin_p('kappa_pdf_lscp',kappa_pdf_lscp)
     435    CALL getin_p('rhl0_pdf_lscp',rhl0_pdf_lscp)
     436    CALL getin_p('cond_thresh_pdf_lscp',cond_thresh_pdf_lscp)
     437    CALL getin_p('a_homofreez',a_homofreez)
     438    CALL getin_p('b_homofreez',b_homofreez)
     439    CALL getin_p('delta_hetfreez',delta_hetfreez)
     440    CALL getin_p('coef_mixing_lscp',coef_mixing_lscp)
     441    CALL getin_p('coef_shear_lscp',coef_shear_lscp)
     442    CALL getin_p('chi_mixing_lscp',chi_mixing_lscp)
     443    !CALL getin_p('contrail_cross_section',contrail_cross_section)
    348444
    349445
     
    391487    WRITE(lunout,*) 'lscp_ini, iflag_oldbug_fisrtilp', iflag_oldbug_fisrtilp
    392488    WRITE(lunout,*) 'lscp_ini, fl_cor_ebil', fl_cor_ebil
     489    WRITE(lunout,*) 'lscp_ini, temp_nowater', temp_nowater
     490    ! for poprecip
    393491    WRITE(lunout,*) 'lscp_ini, ok_poprecip', ok_poprecip
    394492    WRITE(lunout,*) 'lscp_ini, ok_corr_vap_evasub', ok_corr_vap_evasub
     
    404502    WRITE(lunout,*) 'lscp_ini, snow_fallspeed_clr:', snow_fallspeed_clr
    405503    WRITE(lunout,*) 'lscp_ini, snow_fallspeed_cld:', snow_fallspeed_cld
     504    ! for condensation and ice supersaturation
     505    WRITE(lunout,*) 'lscp_ini, ok_external_lognormal:', ok_external_lognormal
     506    WRITE(lunout,*) 'lscp_ini, ok_ice_supersat:', ok_ice_supersat
     507    WRITE(lunout,*) 'lscp_ini, ok_unadjusted_clouds:', ok_unadjusted_clouds
     508    WRITE(lunout,*) 'lscp_ini, ok_weibull_warm_clouds:', ok_weibull_warm_clouds
     509    WRITE(lunout,*) 'lscp_ini, iflag_cloud_sublim_pdf:', iflag_cloud_sublim_pdf
     510    WRITE(lunout,*) 'lscp_ini, depo_coef_cirrus:', depo_coef_cirrus
     511    WRITE(lunout,*) 'lscp_ini, capa_cond_cirrus:', capa_cond_cirrus
     512    WRITE(lunout,*) 'lscp_ini, mu_subl_pdf_lscp:', mu_subl_pdf_lscp
     513    WRITE(lunout,*) 'lscp_ini, beta_pdf_lscp:', beta_pdf_lscp
     514    WRITE(lunout,*) 'lscp_ini, temp_thresh_pdf_lscp:', temp_thresh_pdf_lscp
     515    WRITE(lunout,*) 'lscp_ini, rhlmid_pdf_lscp:', rhlmid_pdf_lscp
     516    WRITE(lunout,*) 'lscp_ini, k0_pdf_lscp:', k0_pdf_lscp
     517    WRITE(lunout,*) 'lscp_ini, kappa_pdf_lscp:', kappa_pdf_lscp
     518    WRITE(lunout,*) 'lscp_ini, rhl0_pdf_lscp:', rhl0_pdf_lscp
     519    WRITE(lunout,*) 'lscp_ini, a_homofreez:', a_homofreez
     520    WRITE(lunout,*) 'lscp_ini, b_homofreez:', b_homofreez
     521    WRITE(lunout,*) 'lscp_ini, delta_hetfreez', delta_hetfreez
     522    WRITE(lunout,*) 'lscp_ini, coef_mixing_lscp:', coef_mixing_lscp
     523    WRITE(lunout,*) 'lscp_ini, coef_shear_lscp:', coef_shear_lscp
     524    WRITE(lunout,*) 'lscp_ini, chi_mixing_lscp:', chi_mixing_lscp
     525!    WRITE(lunout,*) 'lscp_ini, contrail_cross_section:', contrail_cross_section
    406526
    407527
     
    423543
    424544
     545    !--Check flags for condensation and ice supersaturation
     546    IF ( ok_external_lognormal .AND. ok_ice_supersat ) THEN
     547      abort_message = 'in lscp, ok_external_lognormal=y is incompatible with ok_ice_supersat=y'
     548      CALL abort_physic (modname,abort_message,1)
     549    ENDIF
     550
     551    IF ( ok_weibull_warm_clouds .AND. .NOT. ok_ice_supersat ) THEN
     552      abort_message = 'in lscp, ok_weibull_warm_clouds=y needs ok_ice_supersat=y'
     553      CALL abort_physic (modname,abort_message,1)
     554    ENDIF
     555
     556    IF ( ok_unadjusted_clouds .AND. .NOT. ok_ice_supersat ) THEN
     557      abort_message = 'in lscp, ok_unadjusted_clouds=y needs ok_ice_supersat=y'
     558      CALL abort_physic (modname,abort_message,1)
     559    ENDIF
     560
     561
    425562    !AA Temporary initialisation
    426563    a_tr_sca(1) = -0.5
     
    428565    a_tr_sca(3) = -0.5
    429566    a_tr_sca(4) = -0.5
    430    
    431     IF (ok_ice_sursat) CALL ice_sursat_init()
    432567
    433568    CALL cloudth_ini(iflag_cloudth_vert,iflag_ratqs)
  • LMDZ6/branches/Amaury_dev/libf/phylmd/lmdz_lscp_poprecip.F90

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

    r5174 r5224  
    445445            mean_pdf = sursat_env * 1. / tau_mixingenv / (invtau_phaserelax + 1. / tau_mixingenv)
    446446            cldfraliq(i) = 0.5 * (1. - erf((sursat_iceliq - mean_pdf) / (SQRT(2. * sigma2_pdf))))
    447             IF (cldfraliq(i) .GT. liqfra_max) THEN
     447            IF (cldfraliq(i) > liqfra_max) THEN
    448448                cldfraliq(i) = liqfra_max
    449449            ENDIF
     
    502502    !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    503503    USE lmdz_yoethf
    504 
    505     USE lmdz_yomcst
     504    USE lmdz_yomcst, ONLY: rcpd, retv, rlstt, rlvtt
     505    USE lmdz_lscp_ini, ONLY: iflag_gammasat, temp_nowater, RTT
     506    USE lmdz_lscp_ini, ONLY: a_homofreez, b_homofreez, delta_hetfreez
    506507
    507508    IMPLICIT NONE
    508  INCLUDE "FCTTRE.h"
     509    INCLUDE "FCTTRE.h"
    509510
    510511    INTEGER, INTENT(IN) :: klon  ! number of horizontal grid points
     
    564565    !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    565566
    566     USE lmdz_lscp_ini, ONLY: iflag_gammasat, t_glace_min, RTT
     567    USE lmdz_lscp_ini, ONLY: iflag_gammasat, temp_nowater, RTT
     568    USE lmdz_lscp_ini, ONLY: a_homofreez, b_homofreez, delta_hetfreez
    567569
    568570    IMPLICIT NONE
     
    578580
    579581    REAL, DIMENSION(klon) :: qsi, qsl, dqsl, dqsi
    580     REAL  fcirrus, fac
    581     REAL, PARAMETER :: acirrus = 2.349
    582     REAL, PARAMETER :: bcirrus = 259.0
     582    REAL  f_homofreez, fac
    583583
    584584    INTEGER i
     
    594594        dgammasatdt(i) = 0.
    595595
    596       ELSEIF ((temp(i) < RTT) .AND. (temp(i) > t_glace_min)) THEN
    597 
    598         IF (iflag_gammasat >= 2) THEN
    599           gammasat(i) = qsl(i) / qsi(i)
    600           dgammasatdt(i) = (dqsl(i) * qsi(i) - dqsi(i) * qsl(i)) / qsi(i) / qsi(i)
     596      ELSE
     597        ! cold clouds: qsi > qsl
     598
     599        ! homogeneous freezing of aerosols, according to
     600        ! Koop, 2000 and Ren and MacKenzie, 2005 (QJRMS)
     601        ! 'Cirrus regime'
     602        ! if f_homofreez > qsl / qsi, liquid nucleation
     603        ! if f_homofreez < qsl / qsi, homogeneous freezing of aerosols
     604        ! Note: f_homofreez = qsl / qsi for temp ~= -38degC
     605        f_homofreez = a_homofreez - temp(i) / b_homofreez
     606
     607        IF (iflag_gammasat >= 3) THEN
     608          ! condensation at homogeneous freezing threshold for temp < -38 degC
     609          ! condensation at liquid saturation for temp > -38 degC
     610          IF (f_homofreez <= qsl(i) / qsi(i)) THEN
     611            gammasat(i) = f_homofreez
     612            dgammasatdt(i) = - 1. / b_homofreez
     613          ELSE
     614            gammasat(i) = qsl(i) / qsi(i)
     615            dgammasatdt(i) = (dqsl(i) * qsi(i) - dqsi(i) * qsl(i)) / qsi(i) / qsi(i)
     616          END IF
     617
     618        ELSE IF ( iflag_gammasat == 2 ) THEN
     619              ! condensation at homogeneous freezing threshold for temp < -38 degC
     620              ! condensation at a threshold linearly decreasing between homogeneous
     621              ! freezing and ice saturation for -38 degC < temp < temp_nowater
     622              ! condensation at ice saturation for temp > temp_nowater
     623              ! If temp_nowater = 235.15 K, this is equivalent to iflag_gammasat = 1
     624              IF ( f_homofreez <= qsl(i) / qsi(i) ) THEN
     625                gammasat(i) = f_homofreez
     626                dgammasatdt(i) = - 1. / b_homofreez
     627              ELSE IF ( temp(i) <= temp_nowater ) THEN
     628                ! Here, we assume that f_homofreez = qsl / qsi for temp = -38 degC = 235.15 K
     629                dgammasatdt(i) = ( a_homofreez - 235.15 / b_homofreez - 1. ) &
     630                               / ( 235.15 - temp_nowater )
     631                gammasat(i) = dgammasatdt(i) * ( temp(i) - temp_nowater ) + 1.
     632              ELSE
     633                gammasat(i) = 1.
     634                dgammasatdt(i) = 0.
     635              END IF
     636
     637        ELSE IF (iflag_gammasat == 1) THEN
     638          ! condensation at homogeneous freezing threshold for temp < -38 degC
     639          ! condensation at ice saturation for temp > -38 degC
     640          IF (f_homofreez <= qsl(i) / qsi(i)) THEN
     641            gammasat(i) = f_homofreez
     642            dgammasatdt(i) = - 1. / b_homofreez
     643          ELSE
     644            gammasat(i) = 1.
     645            dgammasatdt(i) = 0.
     646          END IF
     647
     648
    601649        ELSE
     650          ! condensation at ice saturation for temp < -38 degC
     651          ! condensation at ice saturation for temp > -38 degC
    602652          gammasat(i) = 1.
    603653          dgammasatdt(i) = 0.
    604         ENDIF
    605 
    606       ELSE
    607 
    608         IF (iflag_gammasat >=1) THEN
    609           ! homogeneous freezing of aerosols, according to
    610           ! Koop, 2000 and Karcher 2008, QJRMS
    611           ! 'Cirrus regime'
    612           fcirrus = acirrus - temp(i) / bcirrus
    613           IF (fcirrus > qsl(i) / qsi(i)) THEN
    614             gammasat(i) = qsl(i) / qsi(i)
    615             dgammasatdt(i) = (dqsl(i) * qsi(i) - dqsi(i) * qsl(i)) / qsi(i) / qsi(i)
    616           ELSE
    617             gammasat(i) = fcirrus
    618             dgammasatdt(i) = -1.0 / bcirrus
    619           ENDIF
    620 
    621         ELSE
    622 
    623           gammasat(i) = 1.
    624           dgammasatdt(i) = 0.
    625 
    626         ENDIF
    627 
    628       ENDIF
     654        END IF
     655
     656        ! Note that the delta_hetfreez parameter allows to linearly decrease the
     657        ! condensation threshold between the calculated threshold and the ice saturation
     658        ! for delta_hetfreez = 1, the threshold is the calculated condensation threshold
     659        ! for delta_hetfreez = 0, the threshold is the ice saturation
     660        gammasat(i) = (1. - delta_hetfreez) + delta_hetfreez * gammasat(i)
     661        dgammasatdt(i) = delta_hetfreez * dgammasatdt(i)
     662
     663      END IF
    629664
    630665    END DO
     
    702737  !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    703738
     739
     740  !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     741  FUNCTION GAMMAINC (p, x)
     742
     743    !*****************************************************************************80
     744    !
     745    !! GAMMAINC computes the regularized lower incomplete Gamma Integral
     746    !
     747    !  Modified:
     748    !
     749    !    20 January 2008
     750    !
     751    !  Author:
     752    !
     753    !    Original FORTRAN77 version by B Shea.
     754    !    FORTRAN90 version by John Burkardt.
     755    !
     756    !  Reference:
     757    !
     758    !    B Shea,
     759    !    Algorithm AS 239:
     760    !    Chi-squared and Incomplete Gamma Integral,
     761    !    Applied Statistics,
     762    !    Volume 37, Number 3, 1988, pages 466-473.
     763    !
     764    !  Parameters:
     765    !
     766    !    Input, real X, P, the parameters of the incomplete
     767    !    gamma ratio.  0 <= X, and 0 < P.
     768    !
     769    !    Output, real GAMMAINC, the value of the incomplete
     770    !    Gamma integral.
     771    !
     772    IMPLICIT NONE
     773
     774    REAL A
     775    REAL AN
     776    REAL ARG
     777    REAL B
     778    REAL C
     779    REAL, PARAMETER :: ELIMIT = - 88.0E+00
     780    REAL GAMMAINC
     781    REAL, PARAMETER :: OFLO = 1.0E+37
     782    REAL P
     783    REAL, PARAMETER :: PLIMIT = 1000.0E+00
     784    REAL PN1
     785    REAL PN2
     786    REAL PN3
     787    REAL PN4
     788    REAL PN5
     789    REAL PN6
     790    REAL RN
     791    REAL, PARAMETER :: TOL = 1.0E-14
     792    REAL X
     793    REAL, PARAMETER :: XBIG = 1.0E+08
     794
     795    GAMMAINC = 0.0E+00
     796
     797    IF (X == 0.0E+00) THEN
     798      GAMMAINC = 0.0E+00
     799      RETURN
     800    END IF
     801    !
     802    !  IF P IS LARGE, USE A NORMAL APPROXIMATION.
     803    !
     804    IF (PLIMIT < P) THEN
     805
     806      PN1 = 3.0E+00 * SQRT (P) * ((X / P)**(1.0E+00 / 3.0E+00) &
     807              + 1.0E+00 / (9.0E+00 * P) - 1.0E+00)
     808
     809      GAMMAINC = 0.5E+00 * (1. + ERF (PN1))
     810      RETURN
     811
     812    END IF
     813    !
     814    !  IF X IS LARGE SET GAMMAD = 1.
     815    !
     816    IF (XBIG < X) THEN
     817      GAMMAINC = 1.0E+00
     818      RETURN
     819    END IF
     820    !
     821    !  USE PEARSON'S SERIES EXPANSION.
     822    !  (NOTE THAT P IS NOT LARGE ENOUGH TO FORCE OVERFLOW IN ALOGAM).
     823    !
     824    IF (X <= 1.0E+00 .OR. X < P) THEN
     825
     826      ARG = P * LOG (X) - X - LOG_GAMMA (P + 1.0E+00)
     827      C = 1.0E+00
     828      GAMMAINC = 1.0E+00
     829      A = P
     830
     831      DO
     832
     833        A = A + 1.0E+00
     834        C = C * X / A
     835        GAMMAINC = GAMMAINC + C
     836
     837        IF (C <= TOL) THEN
     838          EXIT
     839        END IF
     840
     841      END DO
     842
     843      ARG = ARG + LOG (GAMMAINC)
     844
     845      IF (ELIMIT <= ARG) THEN
     846        GAMMAINC = EXP (ARG)
     847      ELSE
     848        GAMMAINC = 0.0E+00
     849      END IF
     850      !
     851      !  USE A CONTINUED FRACTION EXPANSION.
     852      !
     853    ELSE
     854
     855      ARG = P * LOG (X) - X - LOG_GAMMA (P)
     856      A = 1.0E+00 - P
     857      B = A + X + 1.0E+00
     858      C = 0.0E+00
     859      PN1 = 1.0E+00
     860      PN2 = X
     861      PN3 = X + 1.0E+00
     862      PN4 = X * B
     863      GAMMAINC = PN3 / PN4
     864
     865      DO
     866
     867        A = A + 1.0E+00
     868        B = B + 2.0E+00
     869        C = C + 1.0E+00
     870        AN = A * C
     871        PN5 = B * PN3 - AN * PN1
     872        PN6 = B * PN4 - AN * PN2
     873
     874        IF (PN6 /= 0.0E+00) THEN
     875
     876          RN = PN5 / PN6
     877
     878          IF (ABS (GAMMAINC - RN) <= MIN (TOL, TOL * RN)) THEN
     879            EXIT
     880          END IF
     881
     882          GAMMAINC = RN
     883
     884        END IF
     885
     886        PN1 = PN3
     887        PN2 = PN4
     888        PN3 = PN5
     889        PN4 = PN6
     890        !
     891        !  RE-SCALE TERMS IN CONTINUED FRACTION IF TERMS ARE LARGE.
     892        !
     893        IF (OFLO <= ABS (PN5)) THEN
     894          PN1 = PN1 / OFLO
     895          PN2 = PN2 / OFLO
     896          PN3 = PN3 / OFLO
     897          PN4 = PN4 / OFLO
     898        END IF
     899
     900      END DO
     901
     902      ARG = ARG + LOG (GAMMAINC)
     903
     904      IF (ELIMIT <= ARG) THEN
     905        GAMMAINC = 1.0E+00 - EXP (ARG)
     906      ELSE
     907        GAMMAINC = 1.0E+00
     908      END IF
     909
     910    END IF
     911
     912    RETURN
     913  END FUNCTION GAMMAINC
     914  !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     915
    704916END MODULE lmdz_lscp_tools
    705917
  • LMDZ6/branches/Amaury_dev/libf/phylmd/phyetat0_mod.F90

    r5221 r5224  
    1 ! $Id$
    2 
    31MODULE phyetat0_mod
    42  USE lmdz_abort_physic, ONLY: abort_physic
     
    2119            du_gwd_rando, du_gwd_front, entr_therm, f0, fm_therm, &
    2220            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, &
     21            ftsol, pbl_tke, pctsrf, q_ancien, ql_ancien, qs_ancien, qbs_ancien, &
     22            cf_ancien, rvc_ancien, radpas, radsol, rain_fall, ratqs, &
    2423            rnebcon, rugoro, sig1, snow_fall, bs_fall, solaire_etat0, sollw, sollwdown, &
    2524            solsw, solswfdiff, t_ancien, u_ancien, v_ancien, w01, wake_cstar, wake_deltaq, &
     
    397396    ancien_ok = ancien_ok.AND.phyetat0_get(ql_ancien, "QLANCIEN", "QLANCIEN", 0.)
    398397    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.)
    400398    ancien_ok = ancien_ok.AND.phyetat0_get(u_ancien, "UANCIEN", "UANCIEN", 0.)
    401399    ancien_ok = ancien_ok.AND.phyetat0_get(v_ancien, "VANCIEN", "VANCIEN", 0.)
     
    413411    ENDIF
    414412
     413    ! cas specifique des variables de la sursaturation par rapport a la glace
     414    IF (ok_ice_supersat) THEN
     415      ancien_ok = ancien_ok.AND.phyetat0_get(cf_ancien, "CFANCIEN", "CFANCIEN", 0.)
     416      ancien_ok = ancien_ok.AND.phyetat0_get(rvc_ancien, "RVCANCIEN", "RVCANCIEN", 0.)
     417    ELSE
     418      cf_ancien(:, :) = 0.
     419      rvc_ancien(:, :) = 0.
     420    ENDIF
     421
    415422    ! Ehouarn: addtional tests to check if t_ancien, q_ancien contain
    416423    !          dummy values (as is the case when generated by ce0l,
     
    419426            (maxval(ql_ancien)==minval(ql_ancien))     .OR. &
    420427            (maxval(qs_ancien)==minval(qs_ancien))     .OR. &
    421             (maxval(rneb_ancien)==minval(rneb_ancien)) .OR. &
    422428            (maxval(prw_ancien)==minval(prw_ancien))   .OR. &
    423429            (maxval(prlw_ancien)==minval(prlw_ancien)) .OR. &
     
    431437              (maxval(prbsw_ancien)==minval(prbsw_ancien))) THEN
    432438        ancien_ok = .FALSE.
     439      ENDIF
     440    ENDIF
     441
     442    IF (ok_ice_supersat) THEN
     443      IF ((maxval(cf_ancien)==minval(cf_ancien))     .OR. &
     444              (maxval(rvc_ancien)==minval(rvc_ancien))) THEN
     445        ancien_ok = .false.
    433446      ENDIF
    434447    ENDIF
  • LMDZ6/branches/Amaury_dev/libf/phylmd/phyredem.F90

    r5139 r5224  
    1 ! $Id$
    2 
    31SUBROUTINE phyredem(fichnom)
    42
     
    1816          zval, rugoro, t_ancien, q_ancien, &
    1917          prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien, &
    20           ql_ancien, qs_ancien, qbs_ancien, rneb_ancien, u_ancien, &
     18          ql_ancien, qs_ancien, qbs_ancien, cf_ancien, rvc_ancien, u_ancien, &
    2119          v_ancien, clwcon, rnebcon, ratqs, pbl_tke, &
    2220          wake_delta_pbl_tke, zmax0, f0, sig1, w01, &
     
    250248    ENDIF
    251249
    252     CALL put_field(pass, "RNEBANCIEN", "RNEBANCIEN", rneb_ancien)
     250    IF (ok_ice_supersat) THEN
     251      CALL put_field(pass, "CFANCIEN", "CFANCIEN", cf_ancien)
     252      CALL put_field(pass, "RVCANCIEN", "RVCANCIEN", rvc_ancien)
     253    ENDIF
    253254
    254255    CALL put_field(pass, "PRWANCIEN", "PRWANCIEN", prw_ancien)
  • LMDZ6/branches/Amaury_dev/libf/phylmd/phys_local_var_mod.F90

    r5219 r5224  
    1 
    2 ! $Id$
    3 
    41MODULE phys_local_var_mod
    52  USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_STRATAER
     
    2320  REAL, SAVE, ALLOCATABLE :: u_seri(:, :), v_seri(:, :)
    2421  !$OMP THREADPRIVATE(u_seri, v_seri)
    25   REAL, SAVE, ALLOCATABLE :: rneb_seri(:, :)
    26   !$OMP THREADPRIVATE(rneb_seri)
    27   REAL, SAVE, ALLOCATABLE :: d_rneb_dyn(:, :)
    28   !$OMP THREADPRIVATE(d_rneb_dyn)
     22  REAL, SAVE, ALLOCATABLE :: cf_seri(:,:), rvc_seri(:,:)
     23  !$OMP THREADPRIVATE(cf_seri, rvc_seri)
    2924  REAL, SAVE, ALLOCATABLE :: l_mixmin(:, :, :), l_mix(:, :, :), wprime(:, :, :)
    3025  !$OMP THREADPRIVATE(l_mixmin, l_mix, wprime)
     
    4540  REAL, SAVE, ALLOCATABLE :: d_u_dyn(:, :), d_v_dyn(:, :)
    4641  !$OMP THREADPRIVATE(d_u_dyn, d_v_dyn)
     42  REAL, SAVE, ALLOCATABLE :: d_cf_dyn(:, :), d_rvc_dyn(:, :)
     43  !$OMP THREADPRIVATE(d_cf_dyn, d_rvc_dyn)
    4744  REAL, SAVE, ALLOCATABLE :: d_tr_dyn(:, :, :)
    4845  !$OMP THREADPRIVATE(d_tr_dyn)
     
    640637  !$OMP THREADPRIVATE(zn2mout)
    641638
    642   REAL, SAVE, ALLOCATABLE :: qclr(:, :)
    643   !$OMP THREADPRIVATE(qclr)
    644   REAL, SAVE, ALLOCATABLE :: qcld(:, :)
    645   !$OMP THREADPRIVATE(qcld)
    646   REAL, SAVE, ALLOCATABLE :: qss(:, :)
    647   !$OMP THREADPRIVATE(qss)
    648   REAL, SAVE, ALLOCATABLE :: qvc(:, :)
    649   !$OMP THREADPRIVATE(qvc)
    650   REAL, SAVE, ALLOCATABLE :: rnebclr(:, :)
    651   !$OMP THREADPRIVATE(rnebclr)
    652   REAL, SAVE, ALLOCATABLE :: rnebss(:, :)
    653   !$OMP THREADPRIVATE(rnebss)
    654   REAL, SAVE, ALLOCATABLE :: gamma_ss(:, :)
    655   !$OMP THREADPRIVATE(gamma_ss)
    656   REAL, SAVE, ALLOCATABLE :: N1_ss(:, :)
    657   !$OMP THREADPRIVATE(N1_ss)
    658   REAL, SAVE, ALLOCATABLE :: N2_ss(:, :)
    659   !$OMP THREADPRIVATE(N2_ss)
    660   REAL, SAVE, ALLOCATABLE :: drneb_sub(:, :)
    661   !$OMP THREADPRIVATE(drneb_sub)
    662   REAL, SAVE, ALLOCATABLE :: drneb_con(:, :)
    663   !$OMP THREADPRIVATE(drneb_con)
    664   REAL, SAVE, ALLOCATABLE :: drneb_tur(:, :)
    665   !$OMP THREADPRIVATE(drneb_tur)
    666   REAL, SAVE, ALLOCATABLE :: drneb_avi(:, :)
    667   !$OMP THREADPRIVATE(drneb_avi)
    668   REAL, SAVE, ALLOCATABLE :: zqsatl(:, :)
    669   !$OMP THREADPRIVATE(zqsatl)
    670   REAL, SAVE, ALLOCATABLE :: zqsats(:, :)
    671   !$OMP THREADPRIVATE(zqsats)
    672   REAL, SAVE, ALLOCATABLE :: Tcontr(:, :)
    673   !$OMP THREADPRIVATE(Tcontr)
    674   REAL, SAVE, ALLOCATABLE :: qcontr(:, :)
    675   !$OMP THREADPRIVATE(qcontr)
    676   REAL, SAVE, ALLOCATABLE :: qcontr2(:, :)
    677   !$OMP THREADPRIVATE(qcontr2)
    678   REAL, SAVE, ALLOCATABLE :: fcontrN(:, :)
    679   !$OMP THREADPRIVATE(fcontrN)
    680   REAL, SAVE, ALLOCATABLE :: fcontrP(:, :)
    681   !$OMP THREADPRIVATE(fcontrP)
     639  !-- LSCP - condensation and ice supersaturation variables
     640  REAL, SAVE, ALLOCATABLE :: qsub(:,:), qissr(:,:), qcld(:,:)
     641  !$OMP THREADPRIVATE(qsub, qissr, qcld)
     642  REAL, SAVE, ALLOCATABLE :: subfra(:,:), issrfra(:,:)
     643  !$OMP THREADPRIVATE(subfra, issrfra)
     644  REAL, SAVE, ALLOCATABLE :: gamma_cond(:,:)
     645  !$OMP THREADPRIVATE(gamma_cond)
     646  REAL, SAVE, ALLOCATABLE :: ratio_qi_qtot(:,:)
     647  !$OMP THREADPRIVATE(ratio_qi_qtot)
     648  REAL, SAVE, ALLOCATABLE :: dcf_sub(:,:), dcf_con(:,:), dcf_mix(:,:)
     649  !$OMP THREADPRIVATE(dcf_sub, dcf_con, dcf_mix)
     650  REAL, SAVE, ALLOCATABLE :: dqi_adj(:,:), dqi_sub(:,:), dqi_con(:,:), dqi_mix(:,:)
     651  !$OMP THREADPRIVATE(dqi_adj, dqi_sub, dqi_con, dqi_mix)
     652  REAL, SAVE, ALLOCATABLE :: dqvc_adj(:,:), dqvc_sub(:,:), dqvc_con(:,:), dqvc_mix(:,:)
     653  !$OMP THREADPRIVATE(dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix)
     654  REAL, SAVE, ALLOCATABLE :: qsatliq(:,:), qsatice(:,:)
     655  !$OMP THREADPRIVATE(qsatliq, qsatice)
     656
     657  !-- LSCP - aviation and contrails variables
     658  REAL, SAVE, ALLOCATABLE :: Tcontr(:,:), qcontr(:,:), qcontr2(:,:)
     659  !$OMP THREADPRIVATE(Tcontr, qcontr, qcontr2)
     660  REAL, SAVE, ALLOCATABLE :: fcontrN(:,:), fcontrP(:,:)
     661  !$OMP THREADPRIVATE(fcontrN, fcontrP)
     662  REAL, SAVE, ALLOCATABLE :: dcf_avi(:,:), dqi_avi(:,:), dqvc_avi(:,:)
     663  !$OMP THREADPRIVATE(dcf_avi, dqi_avi, dqvc_avi)
     664  REAL, SAVE, ALLOCATABLE :: flight_dist(:,:), flight_h2o(:,:)
     665  !$OMP THREADPRIVATE(flight_dist, flight_h2o)
     666
     667  !-- LSCP - mixed phase clouds variables
    682668  REAL, SAVE, ALLOCATABLE :: distcltop(:, :)
    683669  !$OMP THREADPRIVATE(distcltop)
     
    686672
    687673
    688   !--POPRECIP variables
     674  !-- LSCP - POPRECIP variables
    689675  REAL, SAVE, ALLOCATABLE :: qraindiag(:, :)
    690676  !$OMP THREADPRIVATE(qraindiag)
     
    831817    ! SN
    832818    ALLOCATE(u_seri(klon, klev), v_seri(klon, klev))
     819    ALLOCATE(cf_seri(klon, klev), rvc_seri(klon, klev))
    833820    ALLOCATE(l_mixmin(klon, klev + 1, nbsrf), l_mix(klon, klev + 1, nbsrf), wprime(klon, klev + 1, nbsrf))
    834821    ALLOCATE(pbl_eps(klon, klev + 1, nbsrf + 1))
     
    843830    ALLOCATE(d_q_dyn2d(klon), d_ql_dyn2d(klon), d_qs_dyn2d(klon), d_qbs_dyn2d(klon))
    844831    ALLOCATE(d_u_dyn(klon, klev), d_v_dyn(klon, klev))
     832    ALLOCATE(d_cf_dyn(klon,klev),d_rvc_dyn(klon,klev))
    845833    ALLOCATE(d_tr_dyn(klon, klev, nbtr))                   !RomP
    846834    ALLOCATE(d_t_con(klon, klev), d_q_con(klon, klev), d_q_con_zmasse(klon, klev))
     
    12061194    ALLOCATE(zn2mout(klon, 6))
    12071195
    1208     ! Supersaturation
    1209     ALLOCATE(rneb_seri(klon, klev))
    1210     ALLOCATE(d_rneb_dyn(klon, klev))
    1211     ALLOCATE(qclr(klon, klev), qcld(klon, klev), qss(klon, klev), qvc(klon, klev))
    1212     ALLOCATE(rnebclr(klon, klev), rnebss(klon, klev), gamma_ss(klon, klev))
    1213     ALLOCATE(N1_ss(klon, klev), N2_ss(klon, klev))
    1214     ALLOCATE(drneb_sub(klon, klev), drneb_con(klon, klev), drneb_tur(klon, klev), drneb_avi(klon, klev))
    1215     ALLOCATE(zqsatl(klon, klev), zqsats(klon, klev))
    1216     ALLOCATE(Tcontr(klon, klev), qcontr(klon, klev), qcontr2(klon, klev), fcontrN(klon, klev), fcontrP(klon, klev))
    1217 
    1218     !--POPRECIP variables
     1196    !-- LSCP - condensation and ice supersaturation variables
     1197    ALLOCATE(qsub(klon,klev), qissr(klon,klev), qcld(klon,klev))
     1198    ALLOCATE(subfra(klon,klev), issrfra(klon,klev))
     1199    ALLOCATE(gamma_cond(klon,klev), ratio_qi_qtot(klon,klev))
     1200    ALLOCATE(dcf_sub(klon,klev), dcf_con(klon,klev), dcf_mix(klon,klev))
     1201    ALLOCATE(dqi_adj(klon,klev), dqi_sub(klon,klev), dqi_con(klon,klev), dqi_mix(klon,klev))
     1202    ALLOCATE(dqvc_adj(klon,klev), dqvc_sub(klon,klev), dqvc_con(klon,klev), dqvc_mix(klon,klev))
     1203    ALLOCATE(qsatliq(klon,klev), qsatice(klon,klev))
     1204
     1205    !-- LSCP - aviation and contrails variables
     1206    ALLOCATE(Tcontr(klon,klev), qcontr(klon,klev), qcontr2(klon,klev))
     1207    ALLOCATE(fcontrN(klon,klev), fcontrP(klon,klev))
     1208    ALLOCATE(dcf_avi(klon,klev), dqi_avi(klon,klev), dqvc_avi(klon,klev))
     1209    ALLOCATE(flight_dist(klon,klev), flight_h2o(klon,klev))
     1210
     1211    !-- LSCP - POPRECIP variables
    12191212    ALLOCATE(qraindiag(klon, klev), qsnowdiag(klon, klev))
    12201213    ALLOCATE(dqreva(klon, klev), dqssub(klon, klev))
     
    12851278    ! SN
    12861279    DEALLOCATE(u_seri, v_seri)
     1280    DEALLOCATE(cf_seri,rvc_seri)
    12871281    DEALLOCATE(l_mixmin, l_mix, wprime)
    12881282    DEALLOCATE(tke_shear, tke_buoy, tke_trans)
     
    12941288    DEALLOCATE(d_q_dyn2d, d_ql_dyn2d, d_qs_dyn2d, d_qbs_dyn2d)
    12951289    DEALLOCATE(d_u_dyn, d_v_dyn)
     1290    DEALLOCATE(d_cf_dyn,d_rvc_dyn)
    12961291    DEALLOCATE(d_tr_dyn)                      !RomP
    12971292    DEALLOCATE(d_t_con, d_q_con, d_q_con_zmasse)
     
    16041599    DEALLOCATE(zn2mout)
    16051600
    1606     ! Supersaturation
    1607     DEALLOCATE(rneb_seri)
    1608     DEALLOCATE(d_rneb_dyn)
    1609     DEALLOCATE(qclr, qcld, qss, qvc)
    1610     DEALLOCATE(rnebclr, rnebss, gamma_ss)
    1611     DEALLOCATE(N1_ss, N2_ss)
    1612     DEALLOCATE(drneb_sub, drneb_con, drneb_tur, drneb_avi)
    1613     DEALLOCATE(zqsatl, zqsats)
    1614     DEALLOCATE(Tcontr, qcontr, qcontr2, fcontrN, fcontrP)
    1615 
    1616     !--POPRECIP variables
     1601    !-- LSCP - condensation and ice supersaturation variables
     1602    DEALLOCATE(qsub, qissr, qcld)
     1603    DEALLOCATE(subfra, issrfra)
     1604    DEALLOCATE(gamma_cond, ratio_qi_qtot)
     1605    DEALLOCATE(dcf_sub, dcf_con, dcf_mix)
     1606    DEALLOCATE(dqi_adj, dqi_sub, dqi_con, dqi_mix)
     1607    DEALLOCATE(dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix)
     1608    DEALLOCATE(qsatliq, qsatice)
     1609
     1610    !-- LSCP - aviation and contrails variables
     1611    DEALLOCATE(Tcontr, qcontr, qcontr2)
     1612    DEALLOCATE(fcontrN, fcontrP)
     1613    DEALLOCATE(dcf_avi, dqi_avi, dqvc_avi)
     1614    DEALLOCATE(flight_dist, flight_h2o)
     1615
     1616    !-- LSCP - POPRECIP variables
    16171617    DEALLOCATE(qraindiag, qsnowdiag)
    16181618    DEALLOCATE(dqreva, dqssub)
  • LMDZ6/branches/Amaury_dev/libf/phylmd/phys_output_ctrlout_mod.F90

    r5219 r5224  
    1 
    2 ! $Id$
    3 
    41MODULE phys_output_ctrlout_mod
    52
     
    450447  TYPE(ctrl_out), SAVE :: o_SWdn200clr = ctrl_out((/ 10, 1, 10, 10, 10, 10, 11, 11, 11, 11/), &
    451448    '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) /))
     449  TYPE(ctrl_out), SAVE :: o_LWupTOA = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11, 11/), &
     450    'LWupTOA', 'LWup at TOA', 'W/m2', (/ ('', i=1, 10) /))
     451  TYPE(ctrl_out), SAVE :: o_LWupTOAclr = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11, 11/), &
     452    'LWupTOAclr', 'LWup clear sky at TOA', 'W/m2', (/ ('', i=1, 10) /))
    458453  !  type(ctrl_out),save :: o_LWdnTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11, 11/),'LWdnTOA', &
    459454  !    (/ ('', i=1, 10) /))
     
    21182113    'albslw3', 'Surface albedo LW3', '-', (/ ('', i=1, 10) /))
    21192114
    2120 !--aviation & supersaturation
    2121   TYPE(ctrl_out), SAVE :: o_oclr = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2122     'oclr', 'Clear sky total water', 'kg/kg', (/ ('', i=1, 10) /))
    2123   TYPE(ctrl_out), SAVE :: o_ocld = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2124     'ocld', 'Cloudy sky total water', 'kg/kg', (/ ('', i=1, 10) /))
    2125   TYPE(ctrl_out), SAVE :: o_oss = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2126     'oss', 'ISSR total water', 'kg/kg', (/ ('', i=1, 10) /))
    2127   TYPE(ctrl_out), SAVE :: o_ovc = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2128     'ovc', 'In-cloup vapor', 'kg/kg', (/ ('', i=1, 10) /))
    2129   TYPE(ctrl_out), SAVE :: o_rnebclr = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2130     'rnebclr', 'Clear sky fraction', '-', (/ ('', i=1, 10) /))
    2131   TYPE(ctrl_out), SAVE :: o_rnebss = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2132     'rnebss', 'ISSR fraction', '-', (/ ('', i=1, 10) /))
    2133   TYPE(ctrl_out), SAVE :: o_rnebseri = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2134     'rnebseri', 'Cloud fraction', '-', (/ ('', i=1, 10) /))
    2135   TYPE(ctrl_out), SAVE :: o_gammass = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2136     'gammass', 'Gamma supersaturation', '', (/ ('', i=1, 10) /))
    2137   TYPE(ctrl_out), SAVE :: o_N1_ss = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2138     'N1ss', 'N1', '', (/ ('', i=1, 10) /))
    2139   TYPE(ctrl_out), SAVE :: o_N2_ss = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2140     'N2ss', 'N2', '', (/ ('', i=1, 10) /))
    2141   TYPE(ctrl_out), SAVE :: o_drnebsub = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2142     'drnebsub', 'Cloud fraction change because of sublimation', 's-1', (/ ('', i=1, 10) /))
    2143   TYPE(ctrl_out), SAVE :: o_drnebcon = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2144     'drnebcon', 'Cloud fraction change because of condensation', 's-1', (/ ('', i=1, 10) /))
    2145   TYPE(ctrl_out), SAVE :: o_drnebtur = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2146     'drnebtur', 'Cloud fraction change because of turbulence', 's-1', (/ ('', i=1, 10) /))
    2147   TYPE(ctrl_out), SAVE :: o_drnebavi = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2148     'drnebavi', 'Cloud fraction change because of aviation', 's-1', (/ ('', i=1, 10) /))
    2149   TYPE(ctrl_out), SAVE :: o_qsatl = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2150     'qsatl', 'Saturation with respect to liquid water', '', (/ ('', i=1, 10) /))
    2151   TYPE(ctrl_out), SAVE :: o_qsats = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2152     'qsats', 'Saturation with respect to solid water', '', (/ ('', i=1, 10) /))
    2153   TYPE(ctrl_out), SAVE :: o_flight_m = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2154     'flightm', 'Flown meters', 'm/s/mesh', (/ ('', i=1, 10) /))
    2155   TYPE(ctrl_out), SAVE :: o_flight_h2o = ctrl_out((/ 1, 1, 1, 1, 10, 10, 11, 11, 11, 11/), &
    2156     'flighth2o', 'H2O flight emission', 'kg H2O/s/mesh', (/ ('', i=1, 10) /))
    2157   TYPE(ctrl_out), SAVE :: o_Tcontr = ctrl_out((/ 1, 1, 1, 1, 11, 11, 11, 11, 11, 11/),&
     2115!-- LSCP - condensation and ice supersaturation variables
     2116  TYPE(ctrl_out), SAVE :: o_cfseri = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2117    'cfseri', 'Cloud fraction', '-', (/ ('', i=1, 10) /))
     2118  TYPE(ctrl_out), SAVE :: o_dcfdyn = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2119    'dcfdyn', 'Dynamics cloud fraction tendency', 's-1', (/ ('', i=1, 10) /))
     2120  TYPE(ctrl_out), SAVE :: o_rvcseri = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2121    'rvcseri', 'Cloudy water vapor to total water vapor ratio', '-', (/ ('', i=1, 10) /))
     2122  TYPE(ctrl_out), SAVE :: o_drvcdyn = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2123    'drvcdyn', 'Dynamics cloudy water vapor to total water vapor ratio tendency', 's-1', (/ ('', i=1, 10) /))
     2124  TYPE(ctrl_out), SAVE :: o_qsub = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2125    'qsub', 'Subsaturated clear sky total water', 'kg/kg', (/ ('', i=1, 10) /))
     2126  TYPE(ctrl_out), SAVE :: o_qissr = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2127    'qissr', 'Supersaturated clear sky total water', 'kg/kg', (/ ('', i=1, 10) /))
     2128  TYPE(ctrl_out), SAVE :: o_qcld = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2129    'qcld', 'Cloudy sky total water', 'kg/kg', (/ ('', i=1, 10) /))
     2130  TYPE(ctrl_out), SAVE :: o_subfra = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2131    'subfra', 'Subsaturated clear sky fraction', '-', (/ ('', i=1, 10) /))
     2132  TYPE(ctrl_out), SAVE :: o_issrfra = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2133    'issrfra', 'Supersaturated clear sky fraction', '-', (/ ('', i=1, 10) /))
     2134  TYPE(ctrl_out), SAVE :: o_gammacond = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2135    'gammacond', 'Condensation threshold w.r.t. saturation', '-', (/ ('', i=1, 10) /))
     2136  TYPE(ctrl_out), SAVE :: o_dcfsub = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2137    'dcfsub', 'Sublimation cloud fraction tendency', 's-1', (/ ('', i=1, 10) /))
     2138  TYPE(ctrl_out), SAVE :: o_dcfcon = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2139    'dcfcon', 'Condensation cloud fraction tendency', 's-1', (/ ('', i=1, 10) /))
     2140  TYPE(ctrl_out), SAVE :: o_dcfmix = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2141    'dcfmix', 'Cloud mixing cloud fraction tendency', 's-1', (/ ('', i=1, 10) /))
     2142  TYPE(ctrl_out), SAVE :: o_dqiadj = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2143    'dqiadj', 'Temperature adjustment ice tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2144  TYPE(ctrl_out), SAVE :: o_dqisub = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2145    'dqisub', 'Sublimation ice tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2146  TYPE(ctrl_out), SAVE :: o_dqicon = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2147    'dqicon', 'Condensation ice tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2148  TYPE(ctrl_out), SAVE :: o_dqimix = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2149    'dqimix', 'Cloud mixing ice tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2150  TYPE(ctrl_out), SAVE :: o_dqvcadj = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2151    'dqvcadj', 'Temperature adjustment cloudy water vapor tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2152  TYPE(ctrl_out), SAVE :: o_dqvcsub = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2153    'dqvcsub', 'Sublimation cloudy water vapor tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2154  TYPE(ctrl_out), SAVE :: o_dqvccon = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2155    'dqvccon', 'Condensation cloudy water vapor tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2156  TYPE(ctrl_out), SAVE :: o_dqvcmix = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2157    'dqvcmix', 'Cloud mixing cloudy water vapor tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2158  TYPE(ctrl_out), SAVE :: o_qsatl = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2159    'qsatl', 'Saturation with respect to liquid', 'kg/kg', (/ ('', i=1, 10) /))
     2160  TYPE(ctrl_out), SAVE :: o_qsati = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2161    'qsati', 'Saturation with respect to ice', 'kg/kg', (/ ('', i=1, 10) /))
     2162
     2163!-- LSCP - aviation variables
     2164  TYPE(ctrl_out), SAVE :: o_Tcontr = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/),&
    21582165    'Tcontr', 'Temperature threshold for contrail formation', 'K', (/ ('',i=1,10) /))
    2159   TYPE(ctrl_out), SAVE :: o_qcontr = ctrl_out((/ 1, 1, 1, 1, 11, 11, 11, 11, 11, 11/),&
    2160     'qcontr', 'Specific humidity threshold for contrail formation','Pa', (/ ('', i=1, 10) /))
    2161   TYPE(ctrl_out), SAVE :: o_qcontr2 = ctrl_out((/ 1, 1, 1, 1, 11, 11, 11, 11, 11, 11/),&
    2162     'qcontr2', 'Specific humidity threshold for contrail formation','kg/kg', (/ ('', i=1, 10) /))
    2163   TYPE(ctrl_out), SAVE :: o_fcontrN = ctrl_out((/ 2, 2, 2, 2, 2, 2, 11, 11, 11, 11/),&
     2166  TYPE(ctrl_out), SAVE :: o_qcontr = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/),&
     2167    'qcontr', 'Specific humidity threshold for contrail formation', 'Pa', (/ ('', i=1, 10) /))
     2168  TYPE(ctrl_out), SAVE :: o_qcontr2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/),&
     2169    'qcontr2', 'Specific humidity threshold for contrail formation', 'kg/kg', (/ ('', i=1, 10) /))
     2170  TYPE(ctrl_out), SAVE :: o_fcontrN = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/),&
    21642171    'fcontrN', 'Fraction with non-persistent contrail in clear-sky', '-', (/ ('', i=1,10)/))
    2165   TYPE(ctrl_out), SAVE :: o_fcontrP = ctrl_out((/ 2, 2, 2, 2, 2, 2, 11, 11, 11, 11/),&
     2172  TYPE(ctrl_out), SAVE :: o_fcontrP = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/),&
    21662173    'fcontrP', 'Fraction with persistent contrail in ISSR', '-', (/ ('', i=1,10)/))
     2174  TYPE(ctrl_out), SAVE :: o_dcfavi = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2175    'dcfavi', 'Aviation cloud fraction tendency', 's-1', (/ ('', i=1, 10) /))
     2176  TYPE(ctrl_out), SAVE :: o_dqiavi = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2177    'dqiavi', 'Aviation ice tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2178  TYPE(ctrl_out), SAVE :: o_dqvcavi = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2179    'dqvcavi', 'Aviation cloudy water vapor tendency', 'kg/kg/s', (/ ('', i=1, 10) /))
     2180  TYPE(ctrl_out), SAVE :: o_flight_dist = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2181    'flightdist', 'Aviation flown distance', 'm/s/mesh', (/ ('', i=1, 10) /))
     2182  TYPE(ctrl_out), SAVE :: o_flight_h2o = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     2183    'flighth2o', 'Aviation H2O flight emission', 'kg H2O/s/mesh', (/ ('', i=1, 10) /))
    21672184
    21682185!!!!!!!!!!!!! Sorties niveaux standards de pression NMC
  • LMDZ6/branches/Amaury_dev/libf/phylmd/phys_output_write_mod.F90

    r5219 r5224  
    1 
    2 ! $Id$
    3 
    41MODULE phys_output_write_mod
    52
     
    5451         o_SWdnTOAclr, o_nettop, o_SWup200, &
    5552         o_SWup200clr, o_SWdn200, o_SWdn200clr, &
     53         o_LWupTOA, o_LWupTOAclr, &
    5654         o_LWup200, o_LWup200clr, o_LWdn200, &
    5755         o_LWdn200clr, o_sols, o_sols0, &
     
    218216         o_p_tropopause, o_z_tropopause, o_t_tropopause,  &
    219217         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, &
     218!-- LSCP - condensation and ice supersaturation variables
     219         o_cfseri, o_dcfdyn, o_rvcseri, o_drvcdyn, &
     220         o_qsub, o_qissr, o_qcld, o_subfra, o_issrfra, o_gammacond, &
     221         o_dcfsub, o_dcfcon, o_dcfmix, o_dqiadj, o_dqisub, o_dqicon, o_dqimix, &
     222         o_dqvcadj, o_dqvcsub, o_dqvccon, o_dqvcmix, o_qsatl, o_qsati, &
     223!-- LSCP - aviation variables
    224224         o_Tcontr, o_qcontr, o_qcontr2, o_fcontrN, o_fcontrP, &
     225         o_dcfavi, o_dqiavi, o_dqvcavi, o_flight_dist, o_flight_h2o, &
    225226!--interactive CO2
    226227         o_flx_co2_ocean, o_flx_co2_ocean_cor, &
     
    260261         o_SAD_sulfate, o_reff_sulfate, o_sulfmmr, o_nd_mode, o_sulfmmr_mode
    261262
    262     USE ice_sursat_mod, ONLY: flight_m, flight_h2o
    263263    USE lmdz_lscp_ini, ONLY: ok_poprecip
    264264
     
    326326         cldq, flwp, fiwp, ue, ve, uq, vq, &
    327327         uwat, vwat, &
    328          rneb_seri, d_rneb_dyn, &
    329328         plcl, plfc, wbeff, convoccur, upwd, dnwd, dnwd0, prw, prlw, prsw, prbsw, water_budget, &
    330329         s_pblh, s_pblt, s_lcl, s_therm, uwriteSTD, &
     
    340339         wdtrainA, wdtrainS, wdtrainM, n2, s2, strig, zcong, zlcl_th, proba_notrig, &
    341340         random_notrig, &
    342          qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
    343          N1_ss, N2_ss, zqsatl, zqsats, &
     341         cf_seri, d_cf_dyn, rvc_seri, d_rvc_dyn, &
     342         qsub, qissr, qcld, subfra, issrfra, gamma_cond, &
     343         dcf_sub, dcf_con, dcf_mix, &
     344         dqi_adj, dqi_sub, dqi_con, dqi_mix, &
     345         dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix, &
     346         qsatliq, qsatice, &
    344347         Tcontr, qcontr, qcontr2, fcontrN, fcontrP, &
    345          drneb_sub, drneb_con, drneb_tur, drneb_avi, &
     348         dcf_avi, dqi_avi, dqvc_avi, flight_dist, flight_h2o, &
    346349         alp_bl_det, alp_bl_fluct_m, alp_bl_conv, &
    347350         alp_bl_stat, alp_bl_fluct_tke, slab_wfbils, &
     
    10711074       CALL histwrite_phy(o_LWupSFCclr, zx_tmp_fi2d)
    10721075       CALL histwrite_phy(o_LWdnSFCclr, sollwdownclr)
     1076
     1077       IF (vars_defined) THEN
     1078          zx_tmp_fi2d(:) = lwup(:,klevp1)
     1079       ENDIF
     1080       CALL histwrite_phy(o_LWupTOA, zx_tmp_fi2d)
     1081
     1082       IF (vars_defined) THEN
     1083          zx_tmp_fi2d(:) = lwup0(:,klevp1)
     1084       ENDIF
     1085       CALL histwrite_phy(o_LWupTOAclr, zx_tmp_fi2d)
    10731086
    10741087       IF (type_trac/='inca' .OR. config_inca=='aeNP') THEN
     
    20582071       ENDIF
    20592072
    2060 !--aviation & supersaturation
    2061        IF (ok_ice_sursat) THEN
    2062          CALL histwrite_phy(o_oclr, qclr)
    2063          CALL histwrite_phy(o_ocld, qcld)
    2064          CALL histwrite_phy(o_oss, qss)
    2065          CALL histwrite_phy(o_ovc, qvc)
    2066          CALL histwrite_phy(o_rnebclr, rnebclr)
    2067          CALL histwrite_phy(o_rnebss, rnebss)
    2068          CALL histwrite_phy(o_rnebseri, rneb_seri)
    2069          CALL histwrite_phy(o_gammass, gamma_ss)
    2070          CALL histwrite_phy(o_N1_ss, N1_ss)
    2071          CALL histwrite_phy(o_N2_ss, N2_ss)
    2072          CALL histwrite_phy(o_drnebsub, drneb_sub)
    2073          CALL histwrite_phy(o_drnebcon, drneb_con)
    2074          CALL histwrite_phy(o_drnebtur, drneb_tur)
    2075          CALL histwrite_phy(o_drnebavi, drneb_avi)
    2076          CALL histwrite_phy(o_qsatl, zqsatl)
    2077          CALL histwrite_phy(o_qsats, zqsats)
     2073!-- LSCP - condensation and supersaturation variables
     2074       IF (ok_ice_supersat) THEN
     2075         CALL histwrite_phy(o_cfseri, cf_seri)
     2076         CALL histwrite_phy(o_dcfdyn, d_cf_dyn)
     2077         CALL histwrite_phy(o_rvcseri, rvc_seri)
     2078         CALL histwrite_phy(o_drvcdyn, d_rvc_dyn)
     2079         CALL histwrite_phy(o_qsub, qsub)
     2080         CALL histwrite_phy(o_qissr, qissr)
     2081         CALL histwrite_phy(o_qcld, qcld)
     2082         CALL histwrite_phy(o_subfra, subfra)
     2083         CALL histwrite_phy(o_issrfra, issrfra)
     2084         CALL histwrite_phy(o_gammacond, gamma_cond)
     2085         CALL histwrite_phy(o_dcfsub, dcf_sub)
     2086         CALL histwrite_phy(o_dcfcon, dcf_con)
     2087         CALL histwrite_phy(o_dcfmix, dcf_mix)
     2088         CALL histwrite_phy(o_dqiadj, dqi_adj)
     2089         CALL histwrite_phy(o_dqisub, dqi_sub)
     2090         CALL histwrite_phy(o_dqicon, dqi_con)
     2091         CALL histwrite_phy(o_dqimix, dqi_mix)
     2092         CALL histwrite_phy(o_dqvcadj, dqvc_adj)
     2093         CALL histwrite_phy(o_dqvcsub, dqvc_sub)
     2094         CALL histwrite_phy(o_dqvccon, dqvc_con)
     2095         CALL histwrite_phy(o_dqvcmix, dqvc_mix)
     2096         CALL histwrite_phy(o_qsatl, qsatliq)
     2097         CALL histwrite_phy(o_qsati, qsatice)
     2098       ENDIF
     2099!-- LSCP - aviation variables
     2100       IF (ok_plane_contrail) THEN
    20782101         CALL histwrite_phy(o_Tcontr, Tcontr)
    20792102         CALL histwrite_phy(o_qcontr, qcontr)
     
    20812104         CALL histwrite_phy(o_fcontrN, fcontrN)
    20822105         CALL histwrite_phy(o_fcontrP, fcontrP)
    2083        ENDIF
    2084        IF (ok_plane_contrail) THEN
    2085          CALL histwrite_phy(o_flight_m, flight_m)
     2106         CALL histwrite_phy(o_dcfavi, dcf_avi)
     2107         CALL histwrite_phy(o_dqiavi, dqi_avi)
     2108         CALL histwrite_phy(o_dqvcavi, dqvc_avi)
     2109         CALL histwrite_phy(o_flight_dist, flight_dist)
    20862110       ENDIF
    20872111       IF (ok_plane_h2o) THEN
  • LMDZ6/branches/Amaury_dev/libf/phylmd/phys_state_var_mod.F90

    r5137 r5224  
    1 
    2 ! $Id$
    3 
    4       MODULE phys_state_var_mod
     1MODULE phys_state_var_mod
    52! Variables sauvegardees pour le startphy.nc
    63!======================================================================
     
    9390      REAL, ALLOCATABLE, SAVE :: u_ancien(:,:), v_ancien(:,:)
    9491!$OMP THREADPRIVATE(u_ancien, v_ancien)
     92      REAL, ALLOCATABLE, SAVE :: cf_ancien(:,:), rvc_ancien(:,:)
     93!$OMP THREADPRIVATE(cf_ancien, rvc_ancien)
    9594!!! RomP >>>
    9695      REAL, ALLOCATABLE, SAVE :: tr_ancien(:,:,:)
     
    101100      REAL, ALLOCATABLE, SAVE :: clwcon(:,:),rnebcon(:,:)
    102101!$OMP THREADPRIVATE(clwcon,rnebcon)
    103       REAL, ALLOCATABLE, SAVE :: rneb_ancien(:,:)
    104 !$OMP THREADPRIVATE(rneb_ancien)
    105102      REAL, ALLOCATABLE, SAVE :: qtc_cv(:,:),sigt_cv(:,:),detrain_cv(:,:),fm_cv(:,:)
    106103!$OMP THREADPRIVATE(qtc_cv,sigt_cv,detrain_cv,fm_cv)
     
    587584      ALLOCATE(prw_ancien(klon), prlw_ancien(klon), prsw_ancien(klon), prbsw_ancien(klon))
    588585      ALLOCATE(u_ancien(klon,klev), v_ancien(klon,klev))
     586      ALLOCATE(cf_ancien(klon,klev), rvc_ancien(klon,klev))
    589587!!! Rom P >>>
    590588      ALLOCATE(tr_ancien(klon,klev,nbtr))
    591589!!! Rom P <<<
    592590      ALLOCATE(clwcon(klon,klev),rnebcon(klon,klev))
    593       ALLOCATE(rneb_ancien(klon,klev))
    594591      ALLOCATE(qtc_cv(klon,klev),sigt_cv(klon,klev),detrain_cv(klon,klev),fm_cv(klon,klev))
    595592      ALLOCATE(ratqs(klon,klev))
     
    812809      DEALLOCATE(zthe, zpic, zval)
    813810      DEALLOCATE(rugoro, t_ancien, q_ancien, clwcon, rnebcon)
    814       DEALLOCATE(qs_ancien, ql_ancien, qbs_ancien, rneb_ancien)
     811      DEALLOCATE(qs_ancien, ql_ancien, qbs_ancien)
    815812      DEALLOCATE(prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien)
    816813      DEALLOCATE(qtc_cv,sigt_cv,detrain_cv,fm_cv)
    817814      DEALLOCATE(u_ancien, v_ancien)
     815      DEALLOCATE(cf_ancien, rvc_ancien)
    818816      DEALLOCATE(tr_ancien)                           !RomP
    819817      DEALLOCATE(ratqs, pbl_tke,coefh,coefm)
  • LMDZ6/branches/Amaury_dev/libf/phylmd/physiq_mod.F90

    r5221 r5224  
    1 ! $Id$
    2 
    3 !#define IO_DEBUG
    41MODULE physiq_mod
    52  IMPLICIT NONE
     
    7067    USE tracinca_mod, ONLY: config_inca
    7168    USE tropopause_m, ONLY: dyn_tropopause
    72     USE ice_sursat_mod, ONLY: flight_init, airplane
    7369    USE lmdz_vampir
    7470    USE lmdz_writefield_phy
     
    139135            ! [Variables internes non sauvegardees de la physique]
    140136            ! Variables locales pour effectuer les appels en serie
    141             t_seri, q_seri, ql_seri, qs_seri, qbs_seri, u_seri, v_seri, tr_seri, rneb_seri, &
     137            t_seri,q_seri,ql_seri,qs_seri,qbs_seri, &
     138            u_seri,v_seri,cf_seri,rvc_seri,tr_seri, &
    142139            rhcl, &
    143140            ! Dynamic tendencies (diagnostics)
    144             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, &
     141            d_t_dyn, d_q_dyn, d_ql_dyn, d_qs_dyn, d_qbs_dyn, &
     142            d_u_dyn, d_v_dyn,d_cf_dyn,d_rvc_dyn,d_tr_dyn, &
    145143            d_q_dyn2d, d_ql_dyn2d, d_qs_dyn2d, d_qbs_dyn2d, &
    146144            ! Physic tendencies
     
    314312            pfraclr, pfracld, cldfraliq, sigma2_icefracturb, mean_icefracturb, &
    315313            distcltop, temp_cltop, &
    316             zqsatl, zqsats, &
    317             qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
     314            !-- LSCP - condensation and ice supersaturation variables
     315            qsub, qissr, qcld, subfra, issrfra, gamma_cond, ratio_qi_qtot, &
     316            dcf_sub, dcf_con, dcf_mix, dqi_adj, dqi_sub, dqi_con, dqi_mix, &
     317            dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix, qsatliq, qsatice, &
     318            !-- LSCP - aviation and contrails variables
    318319            Tcontr, qcontr, qcontr2, fcontrN, fcontrP, &
     320            dcf_avi, dqi_avi, dqvc_avi, flight_dist, flight_h2o, &
     321            !
    319322            cldemi, &
    320323            cldfra, cldtau, fiwc, &
     
    496499
    497500    ! indices de traceurs eau vapeur, liquide, glace, fraction nuageuse LS (optional), blowing snow (optional)
    498     INTEGER, SAVE :: ivap, iliq, isol, irneb, ibs
    499     !$OMP THREADPRIVATE(ivap, iliq, isol, irneb, ibs)
     501    INTEGER, SAVE :: ivap, iliq, isol, ibs, icf, irvc
     502    !$OMP THREADPRIVATE(ivap, iliq, isol, ibs, icf, irvc)
    500503
    501504
     
    13171320      iliq = strIdx(tracers(:)%name, addPhase('H2O', 'l'))
    13181321      isol = strIdx(tracers(:)%name, addPhase('H2O', 's'))
    1319       irneb = strIdx(tracers(:)%name, addPhase('H2O', 'r'))
    13201322      ibs = strIdx(tracers(:)%name, addPhase('H2O', 'b'))
     1323      icf = strIdx(tracers(:)%name, addPhase('H2O', 'f'))
     1324      irvc = strIdx(tracers(:)%name, addPhase('H2O', 'c'))
    13211325      !       CALL init_etat0_limit_unstruct
    13221326      !       IF (.NOT. create_etat0_limit) CALL init_limit_read(days_elapsed)
     
    13601364      ENDIF
    13611365
    1362       IF (ok_ice_sursat.AND.(iflag_ice_thermo==0)) THEN
    1363         WRITE (lunout, *) ' ok_ice_sursat=y requires iflag_ice_thermo=1 as well'
     1366      IF (ok_ice_supersat.AND.(iflag_ice_thermo==0)) THEN
     1367        WRITE (lunout, *) ' ok_ice_supersat=y requires iflag_ice_thermo=1 as well'
    13641368        abort_message = 'see above'
    13651369        CALL abort_physic(modname, abort_message, 1)
    13661370      ENDIF
    13671371
    1368       IF (ok_ice_sursat.AND.(nqo<4)) THEN
    1369         WRITE (lunout, *) ' ok_ice_sursat=y requires 4 H2O tracers ', &
    1370                 '(H2O_g, H2O_l, H2O_s, H2O_r) but nqo=', nqo, '. Might as well stop here.'
     1372      IF (ok_ice_supersat.AND.(nqo<5)) THEN
     1373        WRITE (lunout, *) ' ok_ice_supersat=y requires 5 H2O tracers ', &
     1374                '(H2O_g, H2O_l, H2O_s, H2O_f, H2O_c) but nqo=', nqo, '. Might as well stop here.'
    13711375        abort_message = 'see above'
    13721376        CALL abort_physic(modname, abort_message, 1)
    13731377      ENDIF
    13741378
    1375       IF (ok_plane_h2o.AND..NOT.ok_ice_sursat) THEN
    1376         WRITE (lunout, *) ' ok_plane_h2o=y requires ok_ice_sursat=y '
     1379      IF (ok_plane_h2o.AND..NOT.ok_ice_supersat) THEN
     1380        WRITE (lunout, *) ' ok_plane_h2o=y requires ok_ice_supersat=y '
    13771381        abort_message = 'see above'
    13781382        CALL abort_physic(modname, abort_message, 1)
    13791383      ENDIF
    13801384
    1381       IF (ok_plane_contrail.AND..NOT.ok_ice_sursat) THEN
    1382         WRITE (lunout, *) ' ok_plane_contrail=y requires ok_ice_sursat=y '
     1385      IF (ok_plane_contrail.AND..NOT.ok_ice_supersat) THEN
     1386        WRITE (lunout, *) ' ok_plane_contrail=y requires ok_ice_supersat=y '
    13831387        abort_message = 'see above'
    13841388        CALL abort_physic(modname, abort_message, 1)
     
    13861390
    13871391      IF (ok_bs) THEN
    1388         IF ((ok_ice_sursat.AND.nqo <5).OR.(.NOT.ok_ice_sursat.AND.nqo<4)) THEN
     1392        IF ((ok_ice_supersat.AND.nqo <6).OR.(.NOT.ok_ice_supersat.AND.nqo<4)) THEN
    13891393          WRITE (lunout, *) 'activation of blowing snow needs a specific H2O tracer', &
    13901394                  'but nqo=', nqo
     
    17951799              RG, RD, RCPD, RKAPPA, RLVTT, RETV)
    17961800      CALL ratqs_ini(klon, klev, iflag_thermals, lunout, nbsrf, is_lic, is_ter, RG, RV, RD, RCPD, RLSTT, RLVTT, RTT)
    1797       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)
     1801      CALL lscp_ini(pdtphys, lunout, prt_level, ok_ice_supersat, iflag_ratqs, fl_cor_ebil, &
     1802              RCPD, RLSTT, RLVTT, RLMLT, RVTMP2, RTT, RD, RV, RG, RPI, EPS_W)
    17981803      CALL blowing_snow_ini(RCPD, RLSTT, RLVTT, RLMLT, &
    17991804              RVTMP2, RTT, RD, RG, RV, RPI)
     
    22652270              sollwdown(:))
    22662271
     2272      !--Init for LSCP - condensation
     2273      ratio_qi_qtot(:,:) = 0.
     2274
    22672275    ENDIF
    22682276
     
    23612369        ql_seri(i, k) = qx(i, k, iliq)
    23622370        qbs_seri(i, k) = 0.
     2371        cf_seri(i, k) = 0.
     2372        rvc_seri(i, k) = 0.
    23632373        !CR: ATTENTION, on rajoute la variable glace
    23642374        IF (nqo==2) THEN             !--vapour and liquid only
    23652375          qs_seri(i, k) = 0.
    2366           rneb_seri(i, k) = 0.
    23672376        ELSE IF (nqo==3) THEN        !--vapour, liquid and ice
    23682377          qs_seri(i, k) = qx(i, k, isol)
    2369           rneb_seri(i, k) = 0.
    2370         ELSE IF (nqo>=4) THEN        !--vapour, liquid, ice and rneb and blowing snow
     2378        ELSE IF (nqo>=4) THEN        !--vapour, liquid, ice, blowing snow, cloud fraction and cloudy water vapor to total water vapor ratio
    23712379          qs_seri(i, k) = qx(i, k, isol)
    2372           IF (ok_ice_sursat) THEN
    2373             rneb_seri(i, k) = qx(i, k, irneb)
    2374           ENDIF
     2380          IF (ok_ice_supersat) THEN
     2381            cf_seri(i, k) = qx(i, k, icf)
     2382            rvc_seri(i, k) = qx(i, k, irvc)
     2383          END IF
    23752384          IF (ok_bs) THEN
    23762385            qbs_seri(i, k) = qx(i, k, ibs)
    2377           ENDIF
    2378         ENDIF
    2379       ENDDO
    2380     ENDDO
     2386          END IF
     2387        END IF
     2388      END DO
     2389    END DO
    23812390    ! Lea Raillard qs_ini for cloud phase param.
    23822391    qs_ini(:, :) = qs_seri(:, :)
     
    24502459      d_qs_dyn(:, :) = (qs_seri(:, :) - qs_ancien(:, :)) / phys_tstep
    24512460      d_qbs_dyn(:, :) = (qbs_seri(:, :) - qbs_ancien(:, :)) / phys_tstep
     2461      d_cf_dyn(:, :) = (cf_seri(:, :) - cf_ancien(:, :)) / phys_tstep
     2462      d_rvc_dyn(:, :) = (rvc_seri(:, :) - rvc_ancien(:, :))/phys_tstep
    24522463      CALL water_int(klon, klev, q_seri, zmasse, zx_tmp_fi2d)
    24532464      d_q_dyn2d(:) = (zx_tmp_fi2d(:) - prw_ancien(:)) / phys_tstep
     
    24612472      IF (nqtot > nqo) d_tr_dyn(:, :, :) = (tr_seri(:, :, :) - tr_ancien(:, :, :)) / phys_tstep
    24622473      ! !! RomP <<<
    2463       !!d_rneb_dyn(:,:)=(rneb_seri(:,:)-rneb_ancien(:,:))/phys_tstep
    2464       d_rneb_dyn(:, :) = 0.0
    24652474    ELSE
    24662475      d_u_dyn(:, :) = 0.0
     
    24702479      d_ql_dyn(:, :) = 0.0
    24712480      d_qs_dyn(:, :) = 0.0
     2481      d_qbs_dyn(:, :) = 0.0
     2482      d_cf_dyn(:, :) = 0.0
     2483      d_rvc_dyn(:, :) = 0.0
    24722484      d_q_dyn2d(:) = 0.0
    24732485      d_ql_dyn2d(:) = 0.0
     
    24772489      IF (nqtot > nqo) d_tr_dyn(:, :, :) = 0.0
    24782490      ! !! RomP <<<
    2479       d_rneb_dyn(:, :) = 0.0
    2480       d_qbs_dyn(:, :) = 0.0
    24812491      ancien_ok = .TRUE.
    24822492    ENDIF
     
    25852595        ! "zmasse" changes a little.)
    25862596      ENDIF
     2597    ENDIF
     2598
     2599    !-- Needed for LSCP - condensation and ice supersaturation
     2600    IF (ok_ice_supersat) THEN
     2601      DO k = 1, klev
     2602        DO i = 1, klon
     2603          IF ((q_seri(i, k) + ql_seri(i, k) + qs_seri(i, k)) > 0.) THEN
     2604            ratio_qi_qtot(i, k) = qs_seri(i, k) / (q_seri(i, k) + ql_seri(i, k) + qs_seri(i, k))
     2605            rvc_seri(i, k) = rvc_seri(i, k) * q_seri(i, k) / (q_seri(i, k) + ql_seri(i, k) + qs_seri(i, k))
     2606          ELSE
     2607            ratio_qi_qtot(i, k) = 0.
     2608            rvc_seri(i, k) = 0.
     2609          ENDIF
     2610        ENDDO
     2611      ENDDO
    25872612    ENDIF
    25882613
     
    37383763
    37393764      !--mise à jour de flight_m et flight_h2o dans leur module
    3740       IF (ok_plane_h2o .OR. ok_plane_contrail) THEN
    3741         CALL airplane(debut, pphis, pplay, paprs, t_seri)
    3742       ENDIF
     3765      !IF (ok_plane_h2o .OR. ok_plane_contrail) THEN
     3766      !  CALL airplane(debut,pphis,pplay,paprs,t_seri)
     3767      !ENDIF
    37433768
    37443769      CALL lscp(klon, klev, phys_tstep, missing_val, paprs, pplay, &
    37453770              t_seri, q_seri, qs_ini, ptconv, ratqs, &
    3746               d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, rneb_seri, &
     3771              d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, &
    37473772              pfraclr, pfracld, cldfraliq, sigma2_icefracturb, mean_icefracturb, &
    37483773              radocond, picefra, rain_lsc, snow_lsc, &
     
    37503775              prfl, psfl, rhcl, &
    37513776              zqasc, fraca, ztv, zpspsk, ztla, zthl, iflag_cld_th, &
    3752               iflag_ice_thermo, ok_ice_sursat, zqsatl, zqsats, distcltop, temp_cltop, &
    3753               pbl_tke(:, :, is_ave), pbl_eps(:, :, is_ave), qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
     3777              iflag_ice_thermo, distcltop, temp_cltop, &
     3778              pbl_tke(:, :, is_ave), pbl_eps(:, :, is_ave), &
     3779              cell_area, &
     3780              cf_seri, rvc_seri, u_seri, v_seri, &
     3781              qsub, qissr, qcld, subfra, issrfra, gamma_cond, ratio_qi_qtot, &
     3782              dcf_sub, dcf_con, dcf_mix, dqi_adj, dqi_sub, dqi_con, dqi_mix, &
     3783              dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix, qsatliq, qsatice, &
    37543784              Tcontr, qcontr, qcontr2, fcontrN, fcontrP, &
     3785              dcf_avi, dqi_avi, dqvc_avi, flight_dist, flight_h2o, &
    37553786              cloudth_sth, cloudth_senv, cloudth_sigmath, cloudth_sigmaenv, &
    37563787              qraindiag, qsnowdiag, dqreva, dqssub, dqrauto, dqrcol, dqrmelt, &
     
    54215452          d_qx(i, k, isol) = (qs_seri(i, k) - qx(i, k, isol)) / phys_tstep
    54225453        ENDIF
    5423         !--ice_sursat: nqo=4, on ajoute rneb
    5424         IF (nqo>=4 .AND. ok_ice_sursat) THEN
    5425           d_qx(i, k, irneb) = (rneb_seri(i, k) - qx(i, k, irneb)) / phys_tstep
     5454        !--ice_supersat: nqo=5, we add cloud fraction and cloudy water vapor to total water vapor ratio
     5455        IF (nqo>=5 .and. ok_ice_supersat) THEN
     5456          d_qx(i, k, icf) = (cf_seri(i, k) - qx(i, k, icf)) / phys_tstep
     5457          d_qx(i, k, irvc) = (rvc_seri(i, k) - qx(i, k, irvc)) / phys_tstep
    54265458        ENDIF
    54275459
     
    54585490    qs_ancien(:, :) = qs_seri(:, :)
    54595491    qbs_ancien(:, :) = qbs_seri(:, :)
    5460     rneb_ancien(:, :) = rneb_seri(:, :)
     5492    cf_ancien(:, :) = cf_seri(:, :)
     5493    rvc_ancien(:, :) = rvc_seri(:, :)
    54615494    CALL water_int(klon, klev, q_ancien, zmasse, prw_ancien)
    54625495    CALL water_int(klon, klev, ql_ancien, zmasse, prlw_ancien)
  • LMDZ6/branches/Amaury_dev/libf/phylmdiso/lmdz_lscp_condensation.f90

    • Property svn:mergeinfo set to (toggle deleted branches)
      /LMDZ6/trunk/libf/phylmdiso/lmdz_lscp_condensation.F90mergedeligible
      /LMDZ4/branches/LMDZ4-dev/libf/phylmdiso/lmdz_lscp_condensation.F901074-1276,​1281-1284
      /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmdiso/lmdz_lscp_condensation.F901293-1401
      /LMDZ5/branches/LMDZ5V1.0-dev/libf/phylmdiso/lmdz_lscp_condensation.F901436-1453
      /LMDZ5/branches/LMDZ5V2.0-dev/libf/phylmdiso/lmdz_lscp_condensation.F901456-1491
      /LMDZ5/branches/LMDZ_tree_FC/libf/phylmdiso/lmdz_lscp_condensation.F902924-2946
      /LMDZ6/branches/LMDZ_ECRad/libf/phylmdiso/lmdz_lscp_condensation.F904175-4488
      /LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmdiso/lmdz_lscp_condensation.F904660-4721
      /LMDZ6/branches/Ocean_skin/libf/phylmdiso/lmdz_lscp_condensation.F903428-4369
      /LMDZ6/branches/blowing_snow/libf/phylmdiso/lmdz_lscp_condensation.F904485-4522
    r5223 r5224  
    1 link ../phylmd/lmdz_lscp_condensation.F90
     1link ../phylmd/lmdz_lscp_condensation.f90
  • LMDZ6/branches/Amaury_dev/libf/phylmdiso/phyetat0_mod.F90

    r5221 r5224  
    1 ! $Id: phyetat0.F90 3890 2021-05-05 15:15:06Z jyg $
    2 
    31MODULE phyetat0_mod
    42  USE lmdz_abort_physic, ONLY: abort_physic
     
    2624       du_gwd_rando, du_gwd_front, entr_therm, f0, fm_therm, &
    2725       falb_dir, falb_dif, prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien, &
    28        ftsol, pbl_tke, pctsrf, q_ancien, ql_ancien, qs_ancien, qbs_ancien, rneb_ancien, radpas, radsol, rain_fall, ratqs, &
     26       ftsol, pbl_tke, pctsrf, q_ancien, ql_ancien, qs_ancien, qbs_ancien, &
     27       cf_ancien, rvc_ancien, radpas, radsol, rain_fall, ratqs, &
    2928       rnebcon, rugoro, sig1, snow_fall, bs_fall, solaire_etat0, sollw, sollwdown, &
    3029       solsw, solswfdiff, t_ancien, u_ancien, v_ancien, w01, wake_cstar, wake_deltaq, &
     
    421420  ancien_ok=ancien_ok.AND.phyetat0_get(ql_ancien,"QLANCIEN","QLANCIEN",0.)
    422421  ancien_ok=ancien_ok.AND.phyetat0_get(qs_ancien,"QSANCIEN","QSANCIEN",0.)
    423   ancien_ok=ancien_ok.AND.phyetat0_get(rneb_ancien,"RNEBANCIEN","RNEBANCIEN",0.)
    424422  ancien_ok=ancien_ok.AND.phyetat0_get(u_ancien,"UANCIEN","UANCIEN",0.)
    425423  ancien_ok=ancien_ok.AND.phyetat0_get(v_ancien,"VANCIEN","VANCIEN",0.)
     
    437435  ENDIF
    438436
     437  ! cas specifique des variables de la sursaturation par rapport a la glace
     438  IF ( ok_ice_supersat ) THEN
     439    ancien_ok=ancien_ok.AND.phyetat0_get(cf_ancien,"CFANCIEN","CFANCIEN",0.)
     440    ancien_ok=ancien_ok.AND.phyetat0_get(rvc_ancien,"RVCANCIEN","RVCANCIEN",0.)
     441  ELSE
     442    cf_ancien(:,:)=0.
     443    rvc_ancien(:,:)=0.
     444  ENDIF
     445
    439446  ! Ehouarn: addtional tests to check if t_ancien, q_ancien contain
    440447  !          dummy values (as is the case when generated by ce0l,
     
    443450       (maxval(ql_ancien)==minval(ql_ancien))     .OR. &
    444451       (maxval(qs_ancien)==minval(qs_ancien))     .OR. &
    445        (maxval(rneb_ancien)==minval(rneb_ancien)) .OR. &
    446452       (maxval(prw_ancien)==minval(prw_ancien))   .OR. &
    447453       (maxval(prlw_ancien)==minval(prlw_ancien)) .OR. &
     
    456462       ancien_ok=.FALSE.
    457463    ENDIF
     464  ENDIF
     465
     466  IF ( ok_ice_supersat ) THEN
     467    IF ( (maxval(cf_ancien)==minval(cf_ancien))     .OR. &
     468         (maxval(rvc_ancien)==minval(rvc_ancien)) ) THEN
     469       ancien_ok=.false.
     470     ENDIF
    458471  ENDIF
    459472
  • LMDZ6/branches/Amaury_dev/libf/phylmdiso/phyredem.F90

    r5158 r5224  
    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, &
     
    266267       CALL put_field(pass,"QBSANCIEN", "QBSANCIEN", qbs_ancien)
    267268       CALL put_field(pass,"PRBSWANCIEN", "PRBSWANCIEN", prbsw_ancien)
     269    ENDIF
     270
     271    IF ( ok_ice_supersat ) THEN
     272      CALL put_field(pass,"CFANCIEN", "CFANCIEN", cf_ancien)
     273      CALL put_field(pass,"RVCANCIEN", "RVCANCIEN", rvc_ancien)
    268274    ENDIF
    269275
  • LMDZ6/branches/Amaury_dev/libf/phylmdiso/physiq_mod.F90

    r5221 r5224  
    1 
    2 ! $Id: physiq_mod.F90 3908 2021-05-20 07:11:13Z idelkadi $
    3 
    4 !#define IO_DEBUG
    51MODULE physiq_mod
    62
     
    7268    USE tracinca_mod, ONLY: config_inca
    7369    USE tropopause_m,     ONLY: dyn_tropopause
    74     USE ice_sursat_mod,  ONLY: flight_init, airplane
    7570    USE lmdz_vampir
    7671    USE lmdz_writefield_phy
     
    181176       ! [Variables internes non sauvegardees de la physique]
    182177       ! Variables locales pour effectuer les appels en serie
    183        t_seri,q_seri,ql_seri,qs_seri,qbs_seri,u_seri,v_seri,tr_seri,rneb_seri, &
     178       t_seri,q_seri,ql_seri,qs_seri,qbs_seri, &
     179       u_seri,v_seri,cf_seri,rvc_seri,tr_seri, &
     180       rhcl, &
    184181       qx_seri, & ! CR
    185182       rhcl, &       
    186183       ! Dynamic tendencies (diagnostics)
    187        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, &
     184       d_t_dyn,d_q_dyn,d_ql_dyn,d_qs_dyn,d_qbs_dyn, &
     185       d_u_dyn,d_v_dyn,d_cf_dyn,d_rvc_dyn,d_tr_dyn, &
    188186       d_q_dyn2d,d_ql_dyn2d,d_qs_dyn2d,d_qbs_dyn2d, &
    189187       ! Physic tendencies
     
    360358       pfraclr, pfracld, cldfraliq, sigma2_icefracturb, mean_icefracturb,  &
    361359       distcltop, temp_cltop,  &
    362        zqsatl, zqsats, &
    363        qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
     360       !-- LSCP - condensation and ice supersaturation variables
     361       qsub, qissr, qcld, subfra, issrfra, gamma_cond, ratio_qi_qtot, &
     362       dcf_sub, dcf_con, dcf_mix, dqi_adj, dqi_sub, dqi_con, dqi_mix, &
     363       dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix, qsatliq, qsatice, &
     364       !-- LSCP - aviation and contrails variables
    364365       Tcontr, qcontr, qcontr2, fcontrN, fcontrP, &
     366       dcf_avi, dqi_avi, dqvc_avi, flight_dist, flight_h2o, &
     367       !
    365368       cldemi,  &
    366369       cldfra, cldtau, fiwc,  &
     
    578581! reevap -> je commente les 2 lignes au dessus et je laisse la definition
    579582! plutot dans infotrac_phy
    580     INTEGER,SAVE :: irneb, ibs
    581 !$OMP THREADPRIVATE(irneb, ibs)
     583    INTEGER,SAVE :: irneb, ibs, icf,irvc
     584!$OMP THREADPRIVATE(irneb, ibs, icf,irvc)
    582585
    583586
     
    14501453       iliq = strIdx(tracers(:)%name, addPhase('H2O', 'l'))
    14511454       isol = strIdx(tracers(:)%name, addPhase('H2O', 's'))
    1452        irneb= strIdx(tracers(:)%name, addPhase('H2O', 'r'))
    14531455       ibs  = strIdx(tracers(:)%name, addPhase('H2O', 'b'))
     1456       icf  = strIdx(tracers(:)%name, addPhase('H2O', 'f'))
     1457       irvc = strIdx(tracers(:)%name, addPhase('H2O', 'c'))
    14541458!       CALL init_etat0_limit_unstruct
    1455 !       IF (.NOT. create_etat0_limit) CALL init_limit_read(days_elapsed)
     1459       IF (.NOT. create_etat0_limit) CALL init_limit_read(days_elapsed)
    14561460       !CR:nvelles variables convection/poches froides
    14571461
     
    15081512       ENDIF
    15091513
    1510        IF (ok_ice_sursat.AND.(iflag_ice_thermo==0)) THEN
    1511           WRITE (lunout, *) ' ok_ice_sursat=y requires iflag_ice_thermo=1 as well'
     1514       IF (ok_ice_supersat.AND.(iflag_ice_thermo==0)) THEN
     1515          WRITE (lunout, *) ' ok_ice_supersat=y requires iflag_ice_thermo=1 as well'
    15121516          abort_message='see above'
    15131517          CALL abort_physic(modname,abort_message,1)
    15141518       ENDIF
    15151519
    1516        IF (ok_ice_sursat.AND.(nqo<4)) THEN
    1517           WRITE (lunout, *) ' ok_ice_sursat=y requires 4 H2O tracers ', &
    1518                '(H2O_g, H2O_l, H2O_s, H2O_r) but nqo=', nqo, '. Might as well stop here.'
     1520       IF (ok_ice_supersat.AND.(nqo<5)) THEN
     1521          WRITE (lunout, *) ' ok_ice_supersat=y requires 4 H2O tracers ', &
     1522               '(H2O_g, H2O_l, H2O_s, H2O_f, H2O_c) but nqo=', nqo, '. Might as well stop here.'
    15191523          abort_message='see above'
    15201524          CALL abort_physic(modname,abort_message,1)
    15211525       ENDIF
    15221526
    1523        IF (ok_plane_h2o.AND..NOT.ok_ice_sursat) THEN
    1524           WRITE (lunout, *) ' ok_plane_h2o=y requires ok_ice_sursat=y '
     1527       IF (ok_plane_h2o.AND..NOT.ok_ice_supersat) THEN
     1528          WRITE (lunout, *) ' ok_plane_h2o=y requires ok_ice_supersat=y '
    15251529          abort_message='see above'
    15261530          CALL abort_physic(modname,abort_message,1)
    15271531       ENDIF
    15281532
    1529        IF (ok_plane_contrail.AND..NOT.ok_ice_sursat) THEN
    1530           WRITE (lunout, *) ' ok_plane_contrail=y requires ok_ice_sursat=y '
     1533       IF (ok_plane_contrail.AND..NOT.ok_ice_supersat) THEN
     1534          WRITE (lunout, *) ' ok_plane_contrail=y requires ok_ice_supersat=y '
    15311535          abort_message='see above'
    15321536          CALL abort_physic(modname,abort_message,1)
     
    15381542          CALL abort_physic(modname,abort_message, 1)
    15391543#endif
    1540          IF ((ok_ice_sursat.AND.nqo <5).OR.(.NOT.ok_ice_sursat.AND.nqo<4)) THEN
     1544         IF ((ok_ice_supersat.AND.nqo <6).OR.(.NOT.ok_ice_supersat.AND.nqo<4)) THEN
    15411545             WRITE (lunout, *) 'activation of blowing snow needs a specific H2O tracer', &
    15421546                               'but nqo=', nqo
     
    19811985        RG,RD,RCPD,RKAPPA,RLVTT,RETV)
    19821986       CALL ratqs_ini(klon,klev,iflag_thermals,lunout,nbsrf,is_lic,is_ter,RG,RV,RD,RCPD,RLSTT,RLVTT,RTT)
    1983        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)
     1987       CALL lscp_ini(pdtphys,lunout,prt_level,ok_ice_supersat,iflag_ratqs,fl_cor_ebil, &
     1988                     RCPD,RLSTT,RLVTT,RLMLT,RVTMP2,RTT,RD,RV,RG,RPI,EPS_W)
    19841989       CALL blowing_snow_ini(RCPD, RLSTT, RLVTT, RLMLT, &
    19851990                             RVTMP2, RTT,RD,RG, RV, RPI)
     
    24582463                    sollwdown(:))
    24592464
     2465      !--Init for LSCP - condensation
     2466      ratio_qi_qtot(:,:) = 0.
    24602467
    24612468
     
    25652572          q_seri(i,k)  = qx(i,k,ivap)
    25662573          ql_seri(i,k) = qx(i,k,iliq)
    2567           qbs_seri(i,k) = 0.
     2574          qbs_seri(i,k)= 0.
     2575          cf_seri(i,k) = 0.
     2576          rvc_seri(i,k)= 0.
    25682577          !CR: ATTENTION, on rajoute la variable glace
    25692578          IF (nqo==2) THEN             !--vapour and liquid only
    25702579             qs_seri(i,k) = 0.
    2571              rneb_seri(i,k) = 0.
    25722580          ELSE IF (nqo==3) THEN        !--vapour, liquid and ice
    25732581             qs_seri(i,k) = qx(i,k,isol)
    2574              rneb_seri(i,k) = 0.
    2575           ELSE IF (nqo>=4) THEN        !--vapour, liquid, ice and rneb and blowing snow
     2582          ELSE IF (nqo>=4) THEN        !--vapour, liquid, ice, blowing snow, cloud fraction and cloudy water vapor to total water vapor ratio
    25762583             qs_seri(i,k) = qx(i,k,isol)
    2577              IF (ok_ice_sursat) THEN
    2578                rneb_seri(i,k) = qx(i,k,irneb)
     2584             IF (ok_ice_supersat) THEN
     2585               cf_seri(i,k) = qx(i,k,icf)
     2586               rvc_seri(i,k) = qx(i,k,irvc)
    25792587             ENDIF
    25802588             IF (ok_bs) THEN
     
    27482756       d_ql_dyn(:,:) = (ql_seri(:,:)-ql_ancien(:,:))/phys_tstep
    27492757       d_qs_dyn(:,:) = (qs_seri(:,:)-qs_ancien(:,:))/phys_tstep
    2750        d_qbs_dyn(:,:) = (qbs_seri(:,:)-qbs_ancien(:,:))/phys_tstep
     2758       d_qbs_dyn(:,:)= (qbs_seri(:,:)-qbs_ancien(:,:))/phys_tstep
     2759       d_cf_dyn(:,:) = (cf_seri(:,:)-cf_ancien(:,:))/phys_tstep
     2760       d_rvc_dyn(:,:)= (rvc_seri(:,:)-rvc_ancien(:,:))/phys_tstep
    27512761       CALL water_int(klon,klev,q_seri,zmasse,zx_tmp_fi2d)
    27522762       d_q_dyn2d(:)=(zx_tmp_fi2d(:)-prw_ancien(:))/phys_tstep
     
    27602770       IF (nqtot > nqo) d_tr_dyn(:,:,:)=(tr_seri(:,:,:)-tr_ancien(:,:,:))/phys_tstep
    27612771       ! !! RomP <<<
    2762        !!d_rneb_dyn(:,:)=(rneb_seri(:,:)-rneb_ancien(:,:))/phys_tstep
    2763        d_rneb_dyn(:,:)=0.0
    27642772
    27652773#ifdef ISO
     
    28432851       d_ql_dyn(:,:) = 0.0
    28442852       d_qs_dyn(:,:) = 0.0
     2853       d_qbs_dyn(:,:)= 0.0
     2854       d_cf_dyn(:,:) = 0.0
     2855       d_rvc_dyn(:,:)= 0.0
    28452856       d_q_dyn2d(:)  = 0.0
    28462857       d_ql_dyn2d(:) = 0.0
     
    28692880       IF (nqtot > nqo) d_tr_dyn(:,:,:)= 0.0
    28702881       ! !! RomP <<<
    2871        d_rneb_dyn(:,:)=0.0
    2872        d_qbs_dyn(:,:)=0.0
    28732882       ancien_ok = .TRUE.
    28742883#ifdef ISO
     
    29802989          ! "zmasse" changes a little.)
    29812990       ENDIF
     2991    ENDIF
     2992
     2993    !-- Needed for LSCP - condensation and ice supersaturation
     2994    IF (ok_ice_supersat) THEN
     2995      DO k = 1, klev
     2996        DO i = 1, klon
     2997          IF ( ( q_seri(i,k) + ql_seri(i,k) + qs_seri(i,k) ) > 0. ) THEN
     2998            ratio_qi_qtot(i,k) = qs_seri(i,k) / ( q_seri(i,k) + ql_seri(i,k) + qs_seri(i,k) )
     2999            rvc_seri(i,k) = rvc_seri(i,k) * q_seri(i,k) / ( q_seri(i,k) + ql_seri(i,k) + qs_seri(i,k) )
     3000          ELSE
     3001            ratio_qi_qtot(i,k) = 0.
     3002            rvc_seri(i,k) = 0.
     3003          ENDIF
     3004        ENDDO
     3005      ENDDO
    29823006    ENDIF
    29833007
     
    50135037
    50145038    !--mise à jour de flight_m et flight_h2o dans leur module
    5015     IF (ok_plane_h2o .OR. ok_plane_contrail) THEN
    5016       CALL airplane(debut,pphis,pplay,paprs,t_seri)
    5017     ENDIF
     5039    !IF (ok_plane_h2o .OR. ok_plane_contrail) THEN
     5040    !  CALL airplane(debut,pphis,pplay,paprs,t_seri)
     5041    !ENDIF
    50185042
    50195043    CALL lscp(klon,klev,phys_tstep,missing_val,paprs,pplay, &
    50205044         t_seri, q_seri,qs_ini,ptconv,ratqs, &
    5021          d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, rneb_seri, &
     5045         d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, &
    50225046         pfraclr, pfracld, cldfraliq, sigma2_icefracturb, mean_icefracturb,  &
    50235047         radocond, picefra, rain_lsc, snow_lsc, &
     
    50255049         prfl, psfl, rhcl,  &
    50265050         zqasc, fraca,ztv,zpspsk,ztla,zthl,iflag_cld_th, &
    5027          iflag_ice_thermo, ok_ice_sursat, zqsatl, zqsats, distcltop, temp_cltop,  &
    5028          pbl_tke(:,:,is_ave), pbl_eps(:,:,is_ave), qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
    5029          Tcontr, qcontr, qcontr2, fcontrN, fcontrP , &
     5051         iflag_ice_thermo, distcltop, temp_cltop, &
     5052         pbl_tke(:,:,is_ave), pbl_eps(:,:,is_ave), &
     5053         cell_area, &
     5054         cf_seri, rvc_seri, u_seri, v_seri, &
     5055         qsub, qissr, qcld, subfra, issrfra, gamma_cond, ratio_qi_qtot, &
     5056         dcf_sub, dcf_con, dcf_mix, dqi_adj, dqi_sub, dqi_con, dqi_mix, &
     5057         dqvc_adj, dqvc_sub, dqvc_con, dqvc_mix, qsatliq, qsatice, &
     5058         Tcontr, qcontr, qcontr2, fcontrN, fcontrP, &
     5059         dcf_avi, dqi_avi, dqvc_avi, flight_dist, flight_h2o, &
    50305060         cloudth_sth,cloudth_senv,cloudth_sigmath,cloudth_sigmaenv, &
    50315061         qraindiag, qsnowdiag, dqreva, dqssub, dqrauto, dqrcol, dqrmelt, &
     
    70727102             d_qx(i,k,isol) = ( qs_seri(i,k) - qx(i,k,isol) ) / phys_tstep
    70737103          ENDIF
    7074           !--ice_sursat: nqo=4, on ajoute rneb
    7075           IF (nqo>=4 .AND. ok_ice_sursat) THEN
    7076              d_qx(i,k,irneb) = ( rneb_seri(i,k) - qx(i,k,irneb) ) / phys_tstep
     7104          !--ice_supersat: nqo=5, we add cloud fraction and cloudy water vapor to total water vapor ratio
     7105          IF (nqo>=5 .and. ok_ice_supersat) THEN
     7106            d_qx(i, k, icf) = (cf_seri(i, k) - qx(i, k, icf)) / phys_tstep
     7107            d_qx(i, k, irvc) = (rvc_seri(i, k) - qx(i, k, irvc)) / phys_tstep
    70777108          ENDIF
    70787109
     
    70807111             d_qx(i,k,ibs) = ( qbs_seri(i,k) - qx(i,k,ibs) ) / phys_tstep
    70817112          ENDIF
    7082 
    70837113
    70847114       ENDDO
     
    71267156    ql_ancien(:,:) = ql_seri(:,:)
    71277157    qs_ancien(:,:) = qs_seri(:,:)
    7128     qbs_ancien(:,:) = qbs_seri(:,:)
    7129     rneb_ancien(:,:) = rneb_seri(:,:)
     7158    qbs_ancien(:,:)= qbs_seri(:,:)
     7159    cf_ancien(:,:) = cf_seri(:,:)
     7160    rvc_ancien(:,:)= rvc_seri(:,:)
    71307161#ifdef ISO
    71317162    xt_ancien(:,:,:)=xt_seri(:,:,:)
Note: See TracChangeset for help on using the changeset viewer.