Ignore:
Timestamp:
Jul 22, 2024, 6:53:44 PM (4 months ago)
Author:
abarral
Message:

Remove CRAY key (obsolete calls to functions that don't exist anymore, bugs in some implementations, irrelevant now)
Replace usage of CPP_XIOS key by using_xios logical
Remove always unused testcpu bits
Replace most uses of CPP_StratAer by the corresponding logical defined in lmdz_cppkeys_wrapper.F90 [this breaks iso compilation because phyiso doesn't define all aerosols - to be fixed later]
Replaces uses of include "yomcst.h" by the lmdz_yomcst.f90 module in .[fF]90 files

Location:
LMDZ6/branches/Amaury_dev/libf/phylmdiso
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Amaury_dev/libf/phylmdiso/isotopes_mod.F90

    r4982 r5098  
    144144!$OMP THREADPRIVATE(ok_prod_nucl_tritium)
    145145   INTEGER, PARAMETER :: nessai = 486
    146    INTEGER, DIMENSION(nessai), SAVE :: &
     146   INTEGER, DIMENSION(nessai) :: &
    147147                    day_nucl, month_nucl, year_nucl
    148148!$OMP THREADPRIVATE(day_nucl, month_nucl, year_nucl)
    149    REAL,    DIMENSION(nessai), SAVE :: &
     149   REAL,    DIMENSION(nessai) :: &
    150150                    lat_nucl, lon_nucl, zmin_nucl, zmax_nucl, HTO_nucl
    151151!$OMP THREADPRIVATE(lat_nucl, lon_nucl, zmin_nucl, zmax_nucl, HTO_nucl)
  • LMDZ6/branches/Amaury_dev/libf/phylmdiso/isotopes_routines_mod.F90

    r5087 r5098  
    1717&       bidouille_anti_divergence, &
    1818&       iso_eau,iso_HDO,iso_O18
     19USE lmdz_yomcst
     20
    1921#ifdef ISOVERIF
    2022!USE isotopes_verif_mod, ONLY: errmax,errmaxrel
     
    2830#endif
    2931implicit none
    30 
    31 #include "YOMCST.h"       
    3232
    3333! inputs
     
    1296212962&       bidouille_anti_divergence, ridicule,ridicule_snow, &
    1296312963&       tcorr,toce,alpha_liq_sol
    12964     USE indice_sol_mod   
     12964    USE indice_sol_mod
     12965    USE lmdz_yomcst
    1296512966#ifdef ISOVERIF
    1296612967!    USE isotopes_verif_mod, ONLY: errmax,errmaxrel,errmax_sol,deltalim_snow
     
    1297812979#include "YOETHF.h"
    1297912980#include "FCTTRE.h"   
    12980 #include "YOMCST.h"
    1298112981!#include "dimensions.h"
    1298212982!#include "paramet.h"
     
    1353413534&       rh_cste_surf_cond,Rdefault,T_cste_surf_cond,iso_O17,iso_O18, &
    1353513535&       ridicule_evap,tnat
     13536    USE lmdz_yomcst
    1353613537#ifdef ISOVERIF
    1353713538!    USE isotopes_verif_mod, ONLY: deltaDfaible, faible_evap,errmax,errmaxrel
     
    1354613547#include "YOETHF.h"         
    1354713548#include "FCTTRE.h"   
    13548 #include "YOMCST.h"
    13549        
     13549
    1355013550        ! inputs
    1355113551        integer, intent(in) :: klon,knon ! dimensions
     
    1444714447&       ridicule_evap
    1444814448USE fonte_neige_mod, ONLY: gestion_neige_besoin_varglob_fonte_neige
     14449USE lmdz_yomcst
    1444914450#ifdef ISOVERIF
    1445014451!USE isotopes_verif_mod, ONLY: errmax,errmaxrel,errmax_sol,deltalim_snow, &
     
    1446014461
    1446114462#include "YOETHF.h"
    14462 #include "FCTTRE.h"   
    14463 #include "YOMCST.h"
    14464 !#include "dimensions.h"
    14465 !#include "paramet.h"
     14463#include "FCTTRE.h"
    1446614464       
    1446714465        ! inputs
     
    1663416632        USE geometry_mod, only: latitude_deg,longitude_deg, & ! en degré, remplace rlat et rlon
    1663516633                   latitude,longitude ! en radian, remplace rlatd et rlond
     16634        USE lmdz_yomcst
    1663616635#ifdef ISOVERIF
    1663716636        USE isotopes_verif_mod
    1663816637#endif
    1663916638      implicit none
    16640 
    16641 #include "YOMCST.h"
    1664216639
    1664316640! input
     
    1823218229        USE dimphy, only: klon,klev
    1823318230        use geometry_mod, only: latitude_deg,longitude_deg
     18231        USE lmdz_yomcst
    1823418232#ifdef ISOVERIF
    1823518233        USE isotopes_verif_mod
     
    1823718235      implicit none
    1823818236
    18239 #include "YOMCST.h"
    1824018237#include "dimensions.h"
    1824118238! pour avoir iim et jjm
     
    1837518372        use geometry_mod, only: cell_area
    1837618373        use dimphy, only: klon,klev
     18374        USE lmdz_yomcst
    1837718375#ifdef ISOVERIF
    1837818376        USE isotopes_verif_mod
    1837918377#endif
    1838018378      implicit none
    18381 
    18382 #include "YOMCST.h"
    1838318379
    1838418380!     Arguments
  • LMDZ6/branches/Amaury_dev/libf/phylmdiso/phys_local_var_mod.F90

    r5066 r5098  
    22! $Id: phys_local_var_mod.F90 3888 2021-05-05 10:50:37Z jyg $
    33!
    4       MODULE phys_local_var_mod
    5 ! Variables locales pour effectuer les appels en serie
    6 !======================================================================
    7 !
    8 !
    9 !======================================================================
    10 ! Declaration des variables
    11 
    12       REAL, SAVE, ALLOCATABLE :: t_seri(:,:), q_seri(:,:)
    13       !$OMP THREADPRIVATE(t_seri, q_seri)
    14       REAL, SAVE, ALLOCATABLE :: ql_seri(:,:),qs_seri(:,:)
    15       !$OMP THREADPRIVATE(ql_seri,qs_seri)
    16       REAL, SAVE, ALLOCATABLE :: qx_seri(:,:,:)
    17       !$OMP THREADPRIVATE(qx_seri)
    18       REAL, SAVE, ALLOCATABLE :: qbs_seri(:,:)
    19       !$OMP THREADPRIVATE(qbs_seri)
    20       REAL, SAVE, ALLOCATABLE :: u_seri(:,:), v_seri(:,:)
    21       !$OMP THREADPRIVATE(u_seri, v_seri)
    22       REAL, SAVE, ALLOCATABLE :: rneb_seri(:,:)
    23       !$OMP THREADPRIVATE(rneb_seri)
    24       REAL, SAVE, ALLOCATABLE :: d_rneb_dyn(:,:)
    25       !$OMP THREADPRIVATE(d_rneb_dyn)
    26       REAL, SAVE, ALLOCATABLE :: l_mixmin(:,:,:),l_mix(:,:,:),wprime(:,:,:)
    27       !$OMP THREADPRIVATE(l_mixmin, l_mix, wprime)
    28       REAL, SAVE, ALLOCATABLE :: pbl_eps(:,:,:)
    29       !$OMP THREADPRIVATE(pbl_eps)
    30       REAL, SAVE, ALLOCATABLE :: tke_shear(:,:,:), tke_buoy(:,:,:), tke_trans(:,:,:)
    31       !$OMP THREADPRIVATE(tke_shear,tke_buoy,tke_trans)
    32       REAL, SAVE, ALLOCATABLE :: tr_seri(:,:,:)
    33       !$OMP THREADPRIVATE(tr_seri)
    34       REAL, SAVE, ALLOCATABLE :: rhcl(:,:)
    35       !$OMP THREADPRIVATE(rhcl)
    36       REAL, SAVE, ALLOCATABLE :: d_t_dyn(:,:), d_q_dyn(:,:)
    37       !$OMP THREADPRIVATE(d_t_dyn, d_q_dyn)
    38       REAL, SAVE, ALLOCATABLE :: d_ql_dyn(:,:), d_qs_dyn(:,:), d_qbs_dyn(:,:)
    39       !$OMP THREADPRIVATE(d_ql_dyn, d_qs_dyn, d_qbs_dyn)
    40       REAL, SAVE, ALLOCATABLE :: d_q_dyn2d(:), d_ql_dyn2d(:), d_qs_dyn2d(:), d_qbs_dyn2d(:)
    41       !$OMP THREADPRIVATE(d_q_dyn2d, d_ql_dyn2d, d_qs_dyn2d, d_qbs_dyn2d)
    42       REAL, SAVE, ALLOCATABLE :: d_u_dyn(:,:), d_v_dyn(:,:)
    43       !$OMP THREADPRIVATE(d_u_dyn, d_v_dyn)
    44       REAL, SAVE, ALLOCATABLE :: d_tr_dyn(:,:,:)
    45       !$OMP THREADPRIVATE(d_tr_dyn)
    46       REAL, SAVE, ALLOCATABLE :: d_t_con(:,:),d_q_con(:,:),d_q_con_zmasse(:,:)
    47       !$OMP THREADPRIVATE(d_t_con,d_q_con,d_q_con_zmasse)
    48       REAL, SAVE, ALLOCATABLE :: d_u_con(:,:),d_v_con(:,:)
    49       !$OMP THREADPRIVATE(d_u_con,d_v_con)
    50       REAL, SAVE, ALLOCATABLE :: d_t_wake(:,:),d_q_wake(:,:)
    51       !$OMP THREADPRIVATE( d_t_wake,d_q_wake)
    52       REAL, SAVE, ALLOCATABLE :: d_t_lsc(:,:),d_q_lsc(:,:),d_ql_lsc(:,:),d_qi_lsc(:,:)
    53       !$OMP THREADPRIVATE(d_t_lsc,d_q_lsc,d_ql_lsc,d_qi_lsc)
    54       REAL, SAVE, ALLOCATABLE :: d_t_lwr(:,:),d_t_lw0(:,:),d_t_swr(:,:),d_t_sw0(:,:)
    55       !$OMP THREADPRIVATE(d_t_lwr,d_t_lw0,d_t_swr,d_t_sw0)
    56       REAL, SAVE, ALLOCATABLE :: d_t_ajsb(:,:), d_q_ajsb(:,:)
    57       !$OMP THREADPRIVATE(d_t_ajsb, d_q_ajsb)
    58       REAL, SAVE, ALLOCATABLE :: d_t_ajs(:,:), d_q_ajs(:,:)
    59       !$OMP THREADPRIVATE(d_t_ajs, d_q_ajs)
    60       REAL, SAVE, ALLOCATABLE :: d_u_ajs(:,:), d_v_ajs(:,:)
    61       !$OMP THREADPRIVATE(d_u_ajs, d_v_ajs)
    62 !nrlmd<
    63       REAL, SAVE, ALLOCATABLE :: d_t_ajs_w(:,:), d_q_ajs_w(:,:)
    64       !$OMP THREADPRIVATE(d_t_ajs_w, d_q_ajs_w)
    65       REAL, SAVE, ALLOCATABLE :: d_t_ajs_x(:,:), d_q_ajs_x(:,:)
    66       !$OMP THREADPRIVATE(d_t_ajs_x, d_q_ajs_x)
    67 !>nrlmd
    68       REAL, SAVE, ALLOCATABLE :: d_t_eva(:,:),d_q_eva(:,:),d_ql_eva(:,:),d_qi_eva(:,:)
    69       !$OMP THREADPRIVATE(d_t_eva,d_q_eva,d_ql_eva,d_qi_eva)
    70       REAL, SAVE, ALLOCATABLE :: d_qx_eva(:,:,:)
    71       !$OMP THREADPRIVATE(d_qx_eva)
    72       REAL, SAVE, ALLOCATABLE :: d_t_lscst(:,:),d_q_lscst(:,:)
    73       !$OMP THREADPRIVATE(d_t_lscst,d_q_lscst)
    74       REAL, SAVE, ALLOCATABLE :: d_t_lscth(:,:),d_q_lscth(:,:)
    75       !$OMP THREADPRIVATE(d_t_lscth,d_q_lscth)
    76       REAL, SAVE, ALLOCATABLE :: plul_th(:),plul_st(:)
    77       !$OMP THREADPRIVATE(plul_th,plul_st)
    78 !tendances dues a oro et lif
    79       REAL, SAVE, ALLOCATABLE :: d_t_oli(:,:)
    80       !$OMP THREADPRIVATE(d_t_oli)
    81       REAL, SAVE, ALLOCATABLE :: d_u_oli(:,:), d_v_oli(:,:)
    82       !$OMP THREADPRIVATE(d_u_oli, d_v_oli)
    83       REAL, SAVE, ALLOCATABLE :: d_t_vdf(:,:), d_q_vdf(:,:), d_qbs_vdf(:,:), d_t_diss(:,:)
    84       !$OMP THREADPRIVATE( d_t_vdf, d_q_vdf, d_qbs_vdf, d_t_diss)
    85       REAL, SAVE, ALLOCATABLE :: d_u_vdf(:,:), d_v_vdf(:,:)
    86       !$OMP THREADPRIVATE(d_u_vdf, d_v_vdf)
    87 !nrlmd+jyg<
    88       REAL, SAVE, ALLOCATABLE :: d_t_vdf_w(:,:), d_q_vdf_w(:,:)
    89       !$OMP THREADPRIVATE( d_t_vdf_w, d_q_vdf_w)
    90       REAL, SAVE, ALLOCATABLE :: d_t_vdf_x(:,:), d_q_vdf_x(:,:)
    91       !$OMP THREADPRIVATE( d_t_vdf_x, d_q_vdf_x)
    92       REAL, SAVE, ALLOCATABLE :: d_t_bsss(:,:), d_q_bsss(:,:), d_qbs_bsss(:,:)
    93       !$OMP THREADPRIVATE( d_t_bsss,d_q_bsss, d_qbs_bsss)
    94 !>nrlmd+jyg
    95       REAL, SAVE, ALLOCATABLE :: d_t_oro(:,:)
    96       !$OMP THREADPRIVATE(d_t_oro)
    97       REAL, SAVE, ALLOCATABLE :: d_u_oro(:,:), d_v_oro(:,:)
    98       !$OMP THREADPRIVATE(d_u_oro, d_v_oro)
    99       REAL, SAVE, ALLOCATABLE :: d_t_oro_gw(:,:)
    100       !$OMP THREADPRIVATE(d_t_oro_gw)
    101       REAL, SAVE, ALLOCATABLE :: d_u_oro_gw(:,:), d_v_oro_gw(:,:)
    102       !$OMP THREADPRIVATE(d_u_oro_gw, d_v_oro_gw)
    103       REAL, SAVE, ALLOCATABLE :: d_t_lif(:,:)
    104       !$OMP THREADPRIVATE(d_t_lif)
    105       REAL, SAVE, ALLOCATABLE :: d_u_lif(:,:), d_v_lif(:,:)
    106       !$OMP THREADPRIVATE(d_u_lif, d_v_lif)
    107 ! Tendances Ondes de G non oro (runs strato).
    108       REAL, SAVE, ALLOCATABLE :: du_gwd_hines(:,:)
    109       !$OMP THREADPRIVATE(du_gwd_hines)
    110       REAL, SAVE, ALLOCATABLE :: dv_gwd_hines(:,:)
    111       !$OMP THREADPRIVATE(dv_gwd_hines)
    112       REAL, SAVE, ALLOCATABLE :: dv_gwd_rando(:,:)
    113       !$OMP THREADPRIVATE(dv_gwd_rando)
    114       REAL, SAVE, ALLOCATABLE :: dv_gwd_front(:,:)
    115       !$OMP THREADPRIVATE(dv_gwd_front)
    116       REAL, SAVE, ALLOCATABLE :: east_gwstress(:,:)
    117       !$OMP THREADPRIVATE(east_gwstress)
    118       REAL, SAVE, ALLOCATABLE :: west_gwstress(:,:)
    119       !$OMP THREADPRIVATE(west_gwstress)
    120       REAL, SAVE, ALLOCATABLE :: d_t_hin(:,:)
    121       !$OMP THREADPRIVATE(d_t_hin)
    122 ! tendance due a l'oxydation du methane
    123       REAL, SAVE, ALLOCATABLE :: d_q_ch4(:,:)
    124       !$OMP THREADPRIVATE(d_q_ch4)
     4MODULE phys_local_var_mod
     5  USE lmdz_cppkeys_wrapper, ONLY : CPPKEY_STRATAER
     6  ! Variables locales pour effectuer les appels en serie
     7  !======================================================================
     8  !
     9  !
     10  !======================================================================
     11  ! Declaration des variables
     12
     13  REAL, SAVE, ALLOCATABLE :: t_seri(:, :), q_seri(:, :)
     14  !$OMP THREADPRIVATE(t_seri, q_seri)
     15  REAL, SAVE, ALLOCATABLE :: ql_serf_r_wetbi(:, :), qs_seri(:, :)
     16  !$OMP THREADPRIVATE(ql_seri,qs_seri)
     17  REAL, SAVE, ALLOCATABLE :: qx_seri(:, :, :)
     18  !$OMP THREADPRIVATE(qx_seri)
     19  REAL, SAVE, ALLOCATABLE :: qbs_seri(:, :)
     20  !$OMP THREADPRIVATE(qbs_seri)
     21  REAL, SAVE, ALLOCATABLE :: u_seri(:, :), v_seri(:, :)
     22  !$OMP THREADPRIVATE(u_seri, v_seri)
     23  REAL, SAVE, ALLOCATABLE :: rneb_seri(:, :)
     24  !$OMP THREADPRIVATE(rneb_seri)
     25  REAL, SAVE, ALLOCATABLE :: d_rneb_dyn(:, :)
     26  !$OMP THREADPRIVATE(d_rneb_dyn)
     27  REAL, SAVE, ALLOCATABLE :: l_mixmin(:, :, :), l_mix(:, :, :), wprime(:, :, :)
     28  !$OMP THREADPRIVATE(l_mixmin, l_mix, wprime)
     29  REAL, SAVE, ALLOCATABLE :: pbl_eps(:, :, :)
     30  !$OMP THREADPRIVATE(pbl_eps)
     31  REAL, SAVE, ALLOCATABLE :: tke_shear(:, :, :), tke_buoy(:, :, :), tke_trans(:, :, :)
     32  !$OMP THREADPRIVATE(tke_shear,tke_buoy,tke_trans)
     33  REAL, SAVE, ALLOCATABLE :: tr_seri(:, :, :)
     34  !$OMP THREADPRIVATE(tr_seri)
     35  REAL, SAVE, ALLOCATABLE :: rhcl(:, :)
     36  !$OMP THREADPRIVATE(rhcl)
     37  REAL, SAVE, ALLOCATABLE :: d_t_dyn(:, :), d_q_dyn(:, :)
     38  !$OMP THREADPRIVATE(d_t_dyn, d_q_dyn)
     39  REAL, SAVE, ALLOCATABLE :: d_ql_dyn(:, :), d_qs_dyn(:, :), d_qbs_dyn(:, :)
     40  !$OMP THREADPRIVATE(d_ql_dyn, d_qs_dyn, d_qbs_dyn)
     41  REAL, SAVE, ALLOCATABLE :: d_q_dyn2d(:), d_ql_dyn2d(:), d_qs_dyn2d(:), d_qbs_dyn2d(:)
     42  !$OMP THREADPRIVATE(d_q_dyn2d, d_ql_dyn2d, d_qs_dyn2d, d_qbs_dyn2d)
     43  REAL, SAVE, ALLOCATABLE :: d_u_dyn(:, :), d_v_dyn(:, :)
     44  !$OMP THREADPRIVATE(d_u_dyn, d_v_dyn)
     45  REAL, SAVE, ALLOCATABLE :: d_tr_dyn(:, :, :)
     46  !$OMP THREADPRIVATE(d_tr_dyn)
     47  REAL, SAVE, ALLOCATABLE :: d_t_con(:, :), d_q_con(:, :), d_q_con_zmasse(:, :)
     48  !$OMP THREADPRIVATE(d_t_con,d_q_con,d_q_con_zmasse)
     49  REAL, SAVE, ALLOCATABLE :: d_u_con(:, :), d_v_con(:, :)
     50  !$OMP THREADPRIVATE(d_u_con,d_v_con)
     51  REAL, SAVE, ALLOCATABLE :: d_t_wake(:, :), d_q_wake(:, :)
     52  !$OMP THREADPRIVATE( d_t_wake,d_q_wake)
     53  REAL, SAVE, ALLOCATABLE :: d_t_lsc(:, :), d_q_lsc(:, :), d_ql_lsc(:, :), d_qi_lsc(:, :)
     54  !$OMP THREADPRIVATE(d_t_lsc,d_q_lsc,d_ql_lsc,d_qi_lsc)
     55  REAL, SAVE, ALLOCATABLE :: d_t_lwr(:, :), d_t_lw0(:, :), d_t_swr(:, :), d_t_sw0(:, :)
     56  !$OMP THREADPRIVATE(d_t_lwr,d_t_lw0,d_t_swr,d_t_sw0)
     57  REAL, SAVE, ALLOCATABLE :: d_t_ajsb(:, :), d_q_ajsb(:, :)
     58  !$OMP THREADPRIVATE(d_t_ajsb, d_q_ajsb)
     59  REAL, SAVE, ALLOCATABLE :: d_t_ajs(:, :), d_q_ajs(:, :)
     60  !$OMP THREADPRIVATE(d_t_ajs, d_q_ajs)
     61  REAL, SAVE, ALLOCATABLE :: d_u_ajs(:, :), d_v_ajs(:, :)
     62  !$OMP THREADPRIVATE(d_u_ajs, d_v_ajs)
     63  !nrlmd<
     64  REAL, SAVE, ALLOCATABLE :: d_t_ajs_w(:, :), d_q_ajs_w(:, :)
     65  !$OMP THREADPRIVATE(d_t_ajs_w, d_q_ajs_w)
     66  REAL, SAVE, ALLOCATABLE :: d_t_ajs_x(:, :), d_q_ajs_x(:, :)
     67  !$OMP THREADPRIVATE(d_t_ajs_x, d_q_ajs_x)
     68  !>nrlmd
     69  REAL, SAVE, ALLOCATABLE :: d_t_eva(:, :), d_q_eva(:, :), d_ql_eva(:, :), d_qi_eva(:, :)
     70  !$OMP THREADPRIVATE(d_t_eva,d_q_eva,d_ql_eva,d_qi_eva)
     71  REAL, SAVE, ALLOCATABLE :: d_qx_eva(:, :, :)
     72  !$OMP THREADPRIVATE(d_qx_eva)
     73  REAL, SAVE, ALLOCATABLE :: d_t_lscst(:, :), d_q_lscst(:, :)
     74  !$OMP THREADPRIVATE(d_t_lscst,d_q_lscst)
     75  REAL, SAVE, ALLOCATABLE :: d_t_lscth(:, :), d_q_lscth(:, :)
     76  !$OMP THREADPRIVATE(d_t_lscth,d_q_lscth)
     77  REAL, SAVE, ALLOCATABLE :: plul_th(:), plul_st(:)
     78  !$OMP THREADPRIVATE(plul_th,plul_st)
     79  !tendances dues a oro et lif
     80  REAL, SAVE, ALLOCATABLE :: d_t_oli(:, :)
     81  !$OMP THREADPRIVATE(d_t_oli)
     82  REAL, SAVE, ALLOCATABLE :: d_u_oli(:, :), d_v_oli(:, :)
     83  !$OMP THREADPRIVATE(d_u_oli, d_v_oli)
     84  REAL, SAVE, ALLOCATABLE :: d_t_vdf(:, :), d_q_vdf(:, :), d_qbs_vdf(:, :), d_t_diss(:, :)
     85  !$OMP THREADPRIVATE( d_t_vdf, d_q_vdf, d_qbs_vdf, d_t_diss)
     86  REAL, SAVE, ALLOCATABLE :: d_u_vdf(:, :), d_v_vdf(:, :)
     87  !$OMP THREADPRIVATE(d_u_vdf, d_v_vdf)
     88  !nrlmd+jyg<
     89  REAL, SAVE, ALLOCATABLE :: d_t_vdf_w(:, :), d_q_vdf_w(:, :)
     90  !$OMP THREADPRIVATE( d_t_vdf_w, d_q_vdf_w)
     91  REAL, SAVE, ALLOCATABLE :: d_t_vdf_x(:, :), d_q_vdf_x(:, :)
     92  !$OMP THREADPRIVATE( d_t_vdf_x, d_q_vdf_x)
     93  REAL, SAVE, ALLOCATABLE :: d_t_bsss(:, :), d_q_bsss(:, :), d_qbs_bsss(:, :)
     94  !$OMP THREADPRIVATE( d_t_bsss,d_q_bsss, d_qbs_bsss)
     95  !>nrlmd+jyg
     96  REAL, SAVE, ALLOCATABLE :: d_t_oro(:, :)
     97  !$OMP THREADPRIVATE(d_t_oro)
     98  REAL, SAVE, ALLOCATABLE :: d_u_oro(:, :), d_v_oro(:, :)
     99  !$OMP THREADPRIVATE(d_u_oro, d_v_oro)
     100  REAL, SAVE, ALLOCATABLE :: d_t_oro_gw(:, :)
     101  !$OMP THREADPRIVATE(d_t_oro_gw)
     102  REAL, SAVE, ALLOCATABLE :: d_u_oro_gw(:, :), d_v_oro_gw(:, :)
     103  !$OMP THREADPRIVATE(d_u_oro_gw, d_v_oro_gw)
     104  REAL, SAVE, ALLOCATABLE :: d_t_lif(:, :)
     105  !$OMP THREADPRIVATE(d_t_lif)
     106  REAL, SAVE, ALLOCATABLE :: d_u_lif(:, :), d_v_lif(:, :)
     107  !$OMP THREADPRIVATE(d_u_lif, d_v_lif)
     108  ! Tendances Ondes de G non oro (runs strato).
     109  REAL, SAVE, ALLOCATABLE :: du_gwd_hines(:, :)
     110  !$OMP THREADPRIVATE(du_gwd_hines)
     111  REAL, SAVE, ALLOCATABLE :: dv_gwd_hines(:, :)
     112  !$OMP THREADPRIVATE(dv_gwd_hines)
     113  REAL, SAVE, ALLOCATABLE :: dv_gwd_rando(:, :)
     114  !$OMP THREADPRIVATE(dv_gwd_rando)
     115  REAL, SAVE, ALLOCATABLE :: dv_gwd_front(:, :)
     116  !$OMP THREADPRIVATE(dv_gwd_front)
     117  REAL, SAVE, ALLOCATABLE :: east_gwstress(:, :)
     118  !$OMP THREADPRIVATE(east_gwstress)
     119  REAL, SAVE, ALLOCATABLE :: west_gwstress(:, :)
     120  !$OMP THREADPRIVATE(west_gwstress)
     121  REAL, SAVE, ALLOCATABLE :: d_t_hin(:, :)
     122  !$OMP THREADPRIVATE(d_t_hin)
     123  ! tendance due a l'oxydation du methane
     124  REAL, SAVE, ALLOCATABLE :: d_q_ch4(:, :)
     125  !$OMP THREADPRIVATE(d_q_ch4)
    125126#ifdef ISO
    126127      REAL, SAVE, ALLOCATABLE :: xt_seri(:,:,:)
     
    168169#endif
    169170
    170 ! tendance du a la conersion Ec -> E thermique
    171       REAL, SAVE, ALLOCATABLE :: d_t_ec(:,:)
    172       !$OMP THREADPRIVATE(d_t_ec)
    173       REAL, SAVE, ALLOCATABLE :: d_ts(:,:), d_tr(:,:,:)
    174       !$OMP THREADPRIVATE(d_ts, d_tr)
    175 
    176 ! aerosols
    177       REAL, SAVE, ALLOCATABLE :: m_allaer (:,:,:)
    178       !$OMP THREADPRIVATE(m_allaer)
    179 ! diagnostique pour le rayonnement
    180       REAL, SAVE, ALLOCATABLE :: topswad_aero(:), solswad_aero(:)      ! diag
    181       !$OMP THREADPRIVATE(topswad_aero,solswad_aero)
    182       REAL, SAVE, ALLOCATABLE :: topswai_aero(:), solswai_aero(:)      ! diag
    183       !$OMP THREADPRIVATE(topswai_aero,solswai_aero)
    184       REAL, SAVE, ALLOCATABLE :: topswad0_aero(:), solswad0_aero(:)     ! diag
    185       !$OMP THREADPRIVATE(topswad0_aero,solswad0_aero)
    186       REAL, SAVE, ALLOCATABLE :: topsw_aero(:,:),  solsw_aero(:,:)      ! diag
    187       !$OMP THREADPRIVATE(topsw_aero,solsw_aero)
    188       REAL, SAVE, ALLOCATABLE :: topsw0_aero(:,:), solsw0_aero(:,:)     ! diag
    189       !$OMP THREADPRIVATE(topsw0_aero,solsw0_aero)
    190       REAL, SAVE, ALLOCATABLE :: topswcf_aero(:,:),  solswcf_aero(:,:)  ! diag
    191       !$OMP THREADPRIVATE(topswcf_aero,solswcf_aero)
    192 ! LW radiation diagnostics CK
    193       REAL, SAVE, ALLOCATABLE :: toplwad_aero(:), sollwad_aero(:)      ! diag
    194       !$OMP THREADPRIVATE(toplwad_aero,sollwad_aero)
    195       REAL, SAVE, ALLOCATABLE :: toplwai_aero(:), sollwai_aero(:)      ! diag
    196       !$OMP THREADPRIVATE(toplwai_aero,sollwai_aero)
    197       REAL, SAVE, ALLOCATABLE :: toplwad0_aero(:), sollwad0_aero(:)     ! diag
    198       !$OMP THREADPRIVATE(toplwad0_aero,sollwad0_aero)
    199 ! Special RRTM
    200       REAL, SAVE, ALLOCATABLE :: ZLWFT0_i(:,:),  ZSWFT0_i(:,:)      ! diag
    201       !$OMP THREADPRIVATE(ZLWFT0_i,ZSWFT0_i)
    202       REAL, SAVE, ALLOCATABLE :: ZFLDN0(:,:),  ZFLUP0(:,:)      ! diag
    203       !$OMP THREADPRIVATE(ZFLDN0,ZFLUP0)
    204       REAL, SAVE, ALLOCATABLE :: ZFSDN0(:,:),  ZFSUP0(:,:)      ! diag
    205       !$OMP THREADPRIVATE(ZFSDN0,ZFSUP0)
    206 !
    207       REAL, SAVE, ALLOCATABLE :: stratomask(:,:)
    208       !$OMP THREADPRIVATE(stratomask)
    209       REAL, SAVE, ALLOCATABLE :: tausum_aero(:,:,:)
    210       !$OMP THREADPRIVATE(tausum_aero)
    211       REAL, SAVE, ALLOCATABLE :: drytausum_aero(:,:)
    212       !$OMP THREADPRIVATE(drytausum_aero)
    213       REAL, SAVE, ALLOCATABLE :: tau3d_aero(:,:,:,:)
    214       !$OMP THREADPRIVATE(tau3d_aero)
    215       REAL, SAVE, ALLOCATABLE :: dNovrN(:)
    216       !$OMP THREADPRIVATE(dNovrN)
    217       REAL, SAVE, ALLOCATABLE :: zfice(:,:)
    218       !$OMP THREADPRIVATE(zfice)
    219       REAL, SAVE, ALLOCATABLE :: od443aer(:)
    220       !$OMP THREADPRIVATE(od443aer)
    221       REAL, SAVE, ALLOCATABLE :: od550aer(:)
    222       !$OMP THREADPRIVATE(od550aer)
    223       REAL, SAVE, ALLOCATABLE :: dryod550aer(:)
    224       !$OMP THREADPRIVATE(dryod550aer)
    225       REAL, SAVE, ALLOCATABLE :: abs550aer(:)
    226       !$OMP THREADPRIVATE(abs550aer)
    227       REAL, SAVE, ALLOCATABLE :: od865aer(:)
    228       !$OMP THREADPRIVATE(od865aer)
    229       REAL, SAVE, ALLOCATABLE :: ec550aer(:,:)
    230       !$OMP THREADPRIVATE(ec550aer)
    231       REAL, SAVE, ALLOCATABLE :: od550lt1aer(:)
    232       !$OMP THREADPRIVATE(od550lt1aer)
    233       REAL, SAVE, ALLOCATABLE :: sconcso4(:)
    234       !$OMP THREADPRIVATE(sconcso4)
    235       REAL, SAVE, ALLOCATABLE :: sconcno3(:)
    236       !$OMP THREADPRIVATE(sconcno3)
    237       REAL, SAVE, ALLOCATABLE :: sconcoa(:)
    238       !$OMP THREADPRIVATE(sconcoa)
    239       REAL, SAVE, ALLOCATABLE :: sconcbc(:)
    240       !$OMP THREADPRIVATE(sconcbc)
    241       REAL, SAVE, ALLOCATABLE :: sconcss(:)
    242       !$OMP THREADPRIVATE(sconcss)
    243       REAL, SAVE, ALLOCATABLE :: sconcdust(:)
    244       !$OMP THREADPRIVATE(sconcdust)
    245       REAL, SAVE, ALLOCATABLE :: concso4(:,:)
    246       !$OMP THREADPRIVATE(concso4)
    247       REAL, SAVE, ALLOCATABLE :: concno3(:,:)
    248       !$OMP THREADPRIVATE(concno3)
    249       REAL, SAVE, ALLOCATABLE :: concoa(:,:)
    250       !$OMP THREADPRIVATE(concoa)
    251       REAL, SAVE, ALLOCATABLE :: concbc(:,:)
    252       !$OMP THREADPRIVATE(concbc)
    253       REAL, SAVE, ALLOCATABLE :: concss(:,:)
    254       !$OMP THREADPRIVATE(concss)
    255       REAL, SAVE, ALLOCATABLE :: concdust(:,:)
    256       !$OMP THREADPRIVATE(concdust)
    257       REAL, SAVE, ALLOCATABLE :: loadso4(:)
    258       !$OMP THREADPRIVATE(loadso4)
    259       REAL, SAVE, ALLOCATABLE :: loadoa(:)
    260       !$OMP THREADPRIVATE(loadoa)
    261       REAL, SAVE, ALLOCATABLE :: loadbc(:)
    262       !$OMP THREADPRIVATE(loadbc)
    263       REAL, SAVE, ALLOCATABLE :: loadss(:)
    264       !$OMP THREADPRIVATE(loadss)
    265       REAL, SAVE, ALLOCATABLE :: loaddust(:)
    266       !$OMP THREADPRIVATE(loaddust)
    267       REAL, SAVE, ALLOCATABLE :: loadno3(:)
    268       !$OMP THREADPRIVATE(loadno3)
    269       REAL, SAVE, ALLOCATABLE :: load_tmp1(:), load_tmp2(:)
    270       !$OMP THREADPRIVATE(load_tmp1, load_tmp2)
    271       REAL, SAVE, ALLOCATABLE :: load_tmp3(:), load_tmp4(:)
    272       !$OMP THREADPRIVATE(load_tmp3, load_tmp4)
    273       REAL, SAVE, ALLOCATABLE :: load_tmp5(:), load_tmp6(:)
    274       !$OMP THREADPRIVATE(load_tmp5, load_tmp6)
    275       REAL, SAVE, ALLOCATABLE :: load_tmp7(:), load_tmp8(:)
    276       !$OMP THREADPRIVATE(load_tmp7, load_tmp8)
    277       REAL, SAVE, ALLOCATABLE :: load_tmp9(:), load_tmp10(:)
    278       !$OMP THREADPRIVATE(load_tmp9, load_tmp10)
    279 
    280 !IM ajout variables CFMIP2/CMIP5
    281       REAL,ALLOCATABLE,SAVE :: topswad_aerop(:), solswad_aerop(:)
    282 !$OMP THREADPRIVATE(topswad_aerop, solswad_aerop)
    283       REAL,ALLOCATABLE,SAVE :: topswai_aerop(:), solswai_aerop(:)
    284 !$OMP THREADPRIVATE(topswai_aerop, solswai_aerop)
    285       REAL,ALLOCATABLE,SAVE :: topswad0_aerop(:), solswad0_aerop(:)
    286 !$OMP THREADPRIVATE(topswad0_aerop, solswad0_aerop)
    287       REAL,ALLOCATABLE,SAVE :: topsw_aerop(:,:), topsw0_aerop(:,:) 
    288 !$OMP THREADPRIVATE(topsw_aerop, topsw0_aerop)
    289       REAL,ALLOCATABLE,SAVE :: solsw_aerop(:,:), solsw0_aerop(:,:)
    290 !$OMP THREADPRIVATE(solsw_aerop, solsw0_aerop)
    291       REAL,ALLOCATABLE,SAVE :: topswcf_aerop(:,:), solswcf_aerop(:,:)
    292 !$OMP THREADPRIVATE(topswcf_aerop, solswcf_aerop)
    293 
    294 ! additional LW variables CK
    295       REAL,ALLOCATABLE,SAVE :: toplwad_aerop(:), sollwad_aerop(:)
    296 !$OMP THREADPRIVATE(toplwad_aerop, sollwad_aerop)
    297       REAL,ALLOCATABLE,SAVE :: toplwai_aerop(:), sollwai_aerop(:)
    298 !$OMP THREADPRIVATE(toplwai_aerop, sollwai_aerop)
    299       REAL,ALLOCATABLE,SAVE :: toplwad0_aerop(:), sollwad0_aerop(:)
    300 !$OMP THREADPRIVATE(toplwad0_aerop, sollwad0_aerop)
    301 
    302 !AI 08 2023 ajout pour Ecrad
    303       REAL,ALLOCATABLE,SAVE :: topswad_aero_s2(:), solswad_aero_s2(:)
    304 !$OMP THREADPRIVATE(topswad_aero_s2, solswad_aero_s2)
    305       REAL,ALLOCATABLE,SAVE :: topswai_aero_s2(:), solswai_aero_s2(:)
    306 !$OMP THREADPRIVATE(topswai_aero_s2, solswai_aero_s2)
    307       REAL,ALLOCATABLE,SAVE :: topswad0_aero_s2(:), solswad0_aero_s2(:)
    308 !$OMP THREADPRIVATE(topswad0_aero_s2, solswad0_aero_s2)
    309       REAL,ALLOCATABLE,SAVE :: topsw_aero_s2(:,:), topsw0_aero_s2(:,:)
    310 !$OMP THREADPRIVATE(topsw_aero_s2, topsw0_aero_s2)
    311       REAL,ALLOCATABLE,SAVE :: solsw_aero_s2(:,:), solsw0_aero_s2(:,:)
    312 !$OMP THREADPRIVATE(solsw_aero_s2, solsw0_aero_s2)
    313       REAL,ALLOCATABLE,SAVE :: topswcf_aero_s2(:,:), solswcf_aero_s2(:,:)
    314 !$OMP THREADPRIVATE(topswcf_aero_s2, solswcf_aero_s2)
    315 ! additional LW variables CK
    316       REAL,ALLOCATABLE,SAVE :: toplwad_aero_s2(:), sollwad_aero_s2(:)
    317 !$OMP THREADPRIVATE(toplwad_aero_s2, sollwad_aero_s2)
    318       REAL,ALLOCATABLE,SAVE :: toplwai_aero_s2(:), sollwai_aero_s2(:)
    319 !$OMP THREADPRIVATE(toplwai_aero_s2, sollwai_aero_s2)
    320       REAL,ALLOCATABLE,SAVE :: toplwad0_aero_s2(:), sollwad0_aero_s2(:)
    321 !$OMP THREADPRIVATE(toplwad0_aero_s2, sollwad0_aero_s2)
    322 
    323 !Ajout de celles n??cessaires au phys_output_write_mod
    324       REAL, SAVE, ALLOCATABLE :: tal1(:), pal1(:), pab1(:), pab2(:)
    325 !$OMP THREADPRIVATE(tal1, pal1, pab1, pab2)
    326       REAL, SAVE, ALLOCATABLE :: ptstar(:), pt0(:), slp(:)
    327 !$OMP THREADPRIVATE(ptstar, pt0, slp)
    328       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: sens, flwp, fiwp
    329 !$OMP THREADPRIVATE(sens, flwp, fiwp)
    330 !!
    331 !FC
    332       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: zxfluxt, zxfluxq
    333 !$OMP THREADPRIVATE(zxfluxt, zxfluxq)
    334 !FC
    335 !!         Wake variables
    336       REAL,ALLOCATABLE,SAVE,DIMENSION(:)            :: alp_wake
    337 !$OMP THREADPRIVATE(alp_wake)           
    338 !!jyg!      REAL,ALLOCATABLE,SAVE,DIMENSION(:)            :: wake_h,wake_k
    339       REAL,ALLOCATABLE,SAVE,DIMENSION(:)            :: wake_h
    340       INTEGER,ALLOCATABLE,SAVE,DIMENSION(:)        :: wake_k
    341 !$OMP THREADPRIVATE(wake_h,wake_k)                       
    342     REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)            :: wake_omg
    343 !$OMP THREADPRIVATE(wake_omg)                     
    344     REAL, SAVE, ALLOCATABLE,DIMENSION(:,:)          :: d_deltat_wk, d_deltaq_wk
    345 !$OMP THREADPRIVATE(d_deltat_wk, d_deltaq_wk)
    346       REAL,ALLOCATABLE,SAVE,DIMENSION(:)            :: d_s_wk, d_dens_a_wk, d_dens_wk
    347 !$OMP THREADPRIVATE(d_s_wk, d_dens_a_wk, d_dens_wk)
    348     REAL, SAVE, ALLOCATABLE,DIMENSION(:,:)          :: d_deltat_wk_gw, d_deltaq_wk_gw
    349 !$OMP THREADPRIVATE(d_deltat_wk_gw, d_deltaq_wk_gw)
    350     REAL, SAVE, ALLOCATABLE,DIMENSION(:,:)          :: d_deltat_vdf, d_deltaq_vdf
    351 !$OMP THREADPRIVATE(d_deltat_vdf, d_deltaq_vdf)
    352 !!!      REAL,ALLOCATABLE,SAVE,DIMENSION(:)          :: d_s_vdf, d_dens_vdf
    353 !!!$OMP THREADPRIVATE(d_s_vdf, d_dens_vdf)
    354     REAL, SAVE, ALLOCATABLE,DIMENSION(:,:)          :: d_deltat_the, d_deltaq_the
    355 !$OMP THREADPRIVATE(d_deltat_the, d_deltaq_the)
    356 !!!      REAL,ALLOCATABLE,SAVE,DIMENSION(:)          :: d_s_the, d_dens_the
    357 !!!$OMP THREADPRIVATE(d_s_the, d_dens_the)
    358       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)          :: d_deltat_ajs_cv, d_deltaq_ajs_cv
    359 !$OMP THREADPRIVATE(d_deltat_ajs_cv, d_deltaq_ajs_cv)                       
     171  ! tendance du a la conersion Ec -> E thermique
     172  REAL, SAVE, ALLOCATABLE :: d_t_ec(:, :)
     173  !$OMP THREADPRIVATE(d_t_ec)
     174  REAL, SAVE, ALLOCATABLE :: d_ts(:, :), d_tr(:, :, :)
     175  !$OMP THREADPRIVATE(d_ts, d_tr)
     176
     177  ! aerosols
     178  REAL, SAVE, ALLOCATABLE :: m_allaer (:, :, :)
     179  !$OMP THREADPRIVATE(m_allaer)
     180  ! diagnostique pour le rayonnement
     181  REAL, SAVE, ALLOCATABLE :: topswad_aero(:), solswad_aero(:)      ! diag
     182  !$OMP THREADPRIVATE(topswad_aero,solswad_aero)
     183  REAL, SAVE, ALLOCATABLE :: topswai_aero(:), solswai_aero(:)      ! diag
     184  !$OMP THREADPRIVATE(topswai_aero,solswai_aero)
     185  REAL, SAVE, ALLOCATABLE :: topswad0_aero(:), solswad0_aero(:)     ! diag
     186  !$OMP THREADPRIVATE(topswad0_aero,solswad0_aero)
     187  REAL, SAVE, ALLOCATABLE :: topsw_aero(:, :), solsw_aero(:, :)      ! diag
     188  !$OMP THREADPRIVATE(topsw_aero,solsw_aero)
     189  REAL, SAVE, ALLOCATABLE :: topsw0_aero(:, :), solsw0_aero(:, :)     ! diag
     190  !$OMP THREADPRIVATE(topsw0_aero,solsw0_aero)
     191  REAL, SAVE, ALLOCATABLE :: topswcf_aero(:, :), solswcf_aero(:, :)  ! diag
     192  !$OMP THREADPRIVATE(topswcf_aero,solswcf_aero)
     193  ! LW radiation diagnostics CK
     194  REAL, SAVE, ALLOCATABLE :: toplwad_aero(:), sollwad_aero(:)      ! diag
     195  !$OMP THREADPRIVATE(toplwad_aero,sollwad_aero)
     196  REAL, SAVE, ALLOCATABLE :: toplwai_aero(:), sollwai_aero(:)      ! diag
     197  !$OMP THREADPRIVATE(toplwai_aero,sollwai_aero)
     198  REAL, SAVE, ALLOCATABLE :: toplwad0_aero(:), sollwad0_aero(:)     ! diag
     199  !$OMP THREADPRIVATE(toplwad0_aero,sollwad0_aero)
     200  ! Special RRTM
     201  REAL, SAVE, ALLOCATABLE :: ZLWFT0_i(:, :), ZSWFT0_i(:, :)      ! diag
     202  !$OMP THREADPRIVATE(ZLWFT0_i,ZSWFT0_i)
     203  REAL, SAVE, ALLOCATABLE :: ZFLDN0(:, :), ZFLUP0(:, :)      ! diag
     204  !$OMP THREADPRIVATE(ZFLDN0,ZFLUP0)
     205  REAL, SAVE, ALLOCATABLE :: ZFSDN0(:, :), ZFSUP0(:, :)      ! diag
     206  !$OMP THREADPRIVATE(ZFSDN0,ZFSUP0)
     207  !
     208  REAL, SAVE, ALLOCATABLE :: stratomask(:, :)
     209  !$OMP THREADPRIVATE(stratomask)
     210  REAL, SAVE, ALLOCATABLE :: tausum_aero(:, :, :)
     211  !$OMP THREADPRIVATE(tausum_aero)
     212  REAL, SAVE, ALLOCATABLE :: drytausum_aero(:, :)
     213  !$OMP THREADPRIVATE(drytausum_aero)
     214  REAL, SAVE, ALLOCATABLE :: tau3d_aero(:, :, :, :)
     215  !$OMP THREADPRIVATE(tau3d_aero)
     216  REAL, SAVE, ALLOCATABLE :: dNovrN(:)
     217  !$OMP THREADPRIVATE(dNovrN)
     218  REAL, SAVE, ALLOCATABLE :: zfice(:, :)
     219  !$OMP THREADPRIVATE(zfice)
     220  REAL, SAVE, ALLOCATABLE :: od443aer(:)
     221  !$OMP THREADPRIVATE(od443aer)
     222  REAL, SAVE, ALLOCATABLE :: od550aer(:)
     223  !$OMP THREADPRIVATE(od550aer)
     224  REAL, SAVE, ALLOCATABLE :: dryod550aer(:)
     225  !$OMP THREADPRIVATE(dryod550aer)
     226  REAL, SAVE, ALLOCATABLE :: abs550aer(:)
     227  !$OMP THREADPRIVATE(abs550aer)
     228  REAL, SAVE, ALLOCATABLE :: od865aer(:)
     229  !$OMP THREADPRIVATE(od865aer)
     230  REAL, SAVE, ALLOCATABLE :: ec550aer(:, :)
     231  !$OMP THREADPRIVATE(ec550aer)
     232  REAL, SAVE, ALLOCATABLE :: od550lt1aer(:)
     233  !$OMP THREADPRIVATE(od550lt1aer)
     234  REAL, SAVE, ALLOCATABLE :: sconcso4(:)
     235  !$OMP THREADPRIVATE(sconcso4)
     236  REAL, SAVE, ALLOCATABLE :: sconcno3(:)
     237  !$OMP THREADPRIVATE(sconcno3)
     238  REAL, SAVE, ALLOCATABLE :: sconcoa(:)
     239  !$OMP THREADPRIVATE(sconcoa)
     240  REAL, SAVE, ALLOCATABLE :: sconcbc(:)
     241  !$OMP THREADPRIVATE(sconcbc)
     242  REAL, SAVE, ALLOCATABLE :: sconcss(:)
     243  !$OMP THREADPRIVATE(sconcss)
     244  REAL, SAVE, ALLOCATABLE :: sconcdust(:)
     245  !$OMP THREADPRIVATE(sconcdust)
     246  REAL, SAVE, ALLOCATABLE :: concso4(:, :)
     247  !$OMP THREADPRIVATE(concso4)
     248  REAL, SAVE, ALLOCATABLE :: concno3(:, :)
     249  !$OMP THREADPRIVATE(concno3)
     250  REAL, SAVE, ALLOCATABLE :: concoa(:, :)
     251  !$OMP THREADPRIVATE(concoa)
     252  REAL, SAVE, ALLOCATABLE :: concbc(:, :)
     253  !$OMP THREADPRIVATE(concbc)
     254  REAL, SAVE, ALLOCATABLE :: concss(:, :)
     255  !$OMP THREADPRIVATE(concss)
     256  REAL, SAVE, ALLOCATABLE :: concdust(:, :)
     257  !$OMP THREADPRIVATE(concdust)
     258  REAL, SAVE, ALLOCATABLE :: loadso4(:)
     259  !$OMP THREADPRIVATE(loadso4)
     260  REAL, SAVE, ALLOCATABLE :: loadoa(:)
     261  !$OMP THREADPRIVATE(loadoa)
     262  REAL, SAVE, ALLOCATABLE :: loadbc(:)
     263  !$OMP THREADPRIVATE(loadbc)
     264  REAL, SAVE, ALLOCATABLE :: loadss(:)
     265  !$OMP THREADPRIVATE(loadss)
     266  REAL, SAVE, ALLOCATABLE :: loaddust(:)
     267  !$OMP THREADPRIVATE(loaddust)
     268  REAL, SAVE, ALLOCATABLE :: loadno3(:)
     269  !$OMP THREADPRIVATE(loadno3)
     270  REAL, SAVE, ALLOCATABLE :: load_tmp1(:), load_tmp2(:)
     271  !$OMP THREADPRIVATE(load_tmp1, load_tmp2)
     272  REAL, SAVE, ALLOCATABLE :: load_tmp3(:), load_tmp4(:)
     273  !$OMP THREADPRIVATE(load_tmp3, load_tmp4)
     274  REAL, SAVE, ALLOCATABLE :: load_tmp5(:), load_tmp6(:)
     275  !$OMP THREADPRIVATE(load_tmp5, load_tmp6)
     276  REAL, SAVE, ALLOCATABLE :: load_tmp7(:), load_tmp8(:)
     277  !$OMP THREADPRIVATE(load_tmp7, load_tmp8)
     278  REAL, SAVE, ALLOCATABLE :: load_tmp9(:), load_tmp10(:)
     279  !$OMP THREADPRIVATE(load_tmp9, load_tmp10)
     280
     281  !IM ajout variables CFMIP2/CMIP5
     282  REAL, ALLOCATABLE, SAVE :: topswad_aerop(:), solswad_aerop(:)
     283  !$OMP THREADPRIVATE(topswad_aerop, solswad_aerop)
     284  REAL, ALLOCATABLE, SAVE :: topswai_aerop(:), solswai_aerop(:)
     285  !$OMP THREADPRIVATE(topswai_aerop, solswai_aerop)
     286  REAL, ALLOCATABLE, SAVE :: topswad0_aerop(:), solswad0_aerop(:)
     287  !$OMP THREADPRIVATE(topswad0_aerop, solswad0_aerop)
     288  REAL, ALLOCATABLE, SAVE :: topsw_aerop(:, :), topsw0_aerop(:, :)
     289  !$OMP THREADPRIVATE(topsw_aerop, topsw0_aerop)
     290  REAL, ALLOCATABLE, SAVE :: solsw_aerop(:, :), solsw0_aerop(:, :)
     291  !$OMP THREADPRIVATE(solsw_aerop, solsw0_aerop)
     292  REAL, ALLOCATABLE, SAVE :: topswcf_aerop(:, :), solswcf_aerop(:, :)
     293  !$OMP THREADPRIVATE(topswcf_aerop, solswcf_aerop)
     294
     295  ! additional LW variables CK
     296  REAL, ALLOCATABLE, SAVE :: toplwad_aerop(:), sollwad_aerop(:)
     297  !$OMP THREADPRIVATE(toplwad_aerop, sollwad_aerop)
     298  REAL, ALLOCATABLE, SAVE :: toplwai_aerop(:), sollwai_aerop(:)
     299  !$OMP THREADPRIVATE(toplwai_aerop, sollwai_aerop)
     300  REAL, ALLOCATABLE, SAVE :: toplwad0_aerop(:), sollwad0_aerop(:)
     301  !$OMP THREADPRIVATE(toplwad0_aerop, sollwad0_aerop)
     302
     303  !AI 08 2023 ajout pour Ecrad
     304  REAL, ALLOCATABLE, SAVE :: topswad_aero_s2(:), solswad_aero_s2(:)
     305  !$OMP THREADPRIVATE(topswad_aero_s2, solswad_aero_s2)
     306  REAL, ALLOCATABLE, SAVE :: topswai_aero_s2(:), solswai_aero_s2(:)
     307  !$OMP THREADPRIVATE(topswai_aero_s2, solswai_aero_s2)
     308  REAL, ALLOCATABLE, SAVE :: topswad0_aero_s2(:), solswad0_aero_s2(:)
     309  !$OMP THREADPRIVATE(topswad0_aero_s2, solswad0_aero_s2)
     310  REAL, ALLOCATABLE, SAVE :: topsw_aero_s2(:, :), topsw0_aero_s2(:, :)
     311  !$OMP THREADPRIVATE(topsw_aero_s2, topsw0_aero_s2)
     312  REAL, ALLOCATABLE, SAVE :: solsw_aero_s2(:, :), solsw0_aero_s2(:, :)
     313  !$OMP THREADPRIVATE(solsw_aero_s2, solsw0_aero_s2)
     314  REAL, ALLOCATABLE, SAVE :: topswcf_aero_s2(:, :), solswcf_aero_s2(:, :)
     315  !$OMP THREADPRIVATE(topswcf_aero_s2, solswcf_aero_s2)
     316  ! additional LW variables CK
     317  REAL, ALLOCATABLE, SAVE :: toplwad_aero_s2(:), sollwad_aero_s2(:)
     318  !$OMP THREADPRIVATE(toplwad_aero_s2, sollwad_aero_s2)
     319  REAL, ALLOCATABLE, SAVE :: toplwai_aero_s2(:), sollwai_aero_s2(:)
     320  !$OMP THREADPRIVATE(toplwai_aero_s2, sollwai_aero_s2)
     321  REAL, ALLOCATABLE, SAVE :: toplwad0_aero_s2(:), sollwad0_aero_s2(:)
     322  !$OMP THREADPRIVATE(toplwad0_aero_s2, sollwad0_aero_s2)
     323
     324  !Ajout de celles n??cessaires au phys_output_write_mod
     325  REAL, SAVE, ALLOCATABLE :: tal1(:), pal1(:), pab1(:), pab2(:)
     326  !$OMP THREADPRIVATE(tal1, pal1, pab1, pab2)
     327  REAL, SAVE, ALLOCATABLE :: ptstar(:), pt0(:), slp(:)
     328  !$OMP THREADPRIVATE(ptstar, pt0, slp)
     329  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: sens, flwp, fiwp
     330  !$OMP THREADPRIVATE(sens, flwp, fiwp)
     331  !!
     332  !FC
     333  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: zxfluxt, zxfluxq
     334  !$OMP THREADPRIVATE(zxfluxt, zxfluxq)
     335  !FC
     336  !!         Wake variables
     337  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: alp_wake
     338  !$OMP THREADPRIVATE(alp_wake)
     339  !!jyg!      REAL,ALLOCATABLE,SAVE,DIMENSION(:)            :: wake_h,wake_k
     340  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: wake_h
     341  INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) :: wake_k
     342  !$OMP THREADPRIVATE(wake_h,wake_k)
     343  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: wake_omg
     344  !$OMP THREADPRIVATE(wake_omg)
     345  REAL, SAVE, ALLOCATABLE, DIMENSION(:, :) :: d_deltat_wk, d_deltaq_wk
     346  !$OMP THREADPRIVATE(d_deltat_wk, d_deltaq_wk)
     347  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: d_s_wk, d_dens_a_wk, d_dens_wk
     348  !$OMP THREADPRIVATE(d_s_wk, d_dens_a_wk, d_dens_wk)
     349  REAL, SAVE, ALLOCATABLE, DIMENSION(:, :) :: d_deltat_wk_gw, d_deltaq_wk_gw
     350  !$OMP THREADPRIVATE(d_deltat_wk_gw, d_deltaq_wk_gw)
     351  REAL, SAVE, ALLOCATABLE, DIMENSION(:, :) :: d_deltat_vdf, d_deltaq_vdf
     352  !$OMP THREADPRIVATE(d_deltat_vdf, d_deltaq_vdf)
     353  !!!      REAL,ALLOCATABLE,SAVE,DIMENSION(:)          :: d_s_vdf, d_dens_vdf
     354  !!!$OMP THREADPRIVATE(d_s_vdf, d_dens_vdf)
     355  REAL, SAVE, ALLOCATABLE, DIMENSION(:, :) :: d_deltat_the, d_deltaq_the
     356  !$OMP THREADPRIVATE(d_deltat_the, d_deltaq_the)
     357  !!!      REAL,ALLOCATABLE,SAVE,DIMENSION(:)          :: d_s_the, d_dens_the
     358  !!!$OMP THREADPRIVATE(d_s_the, d_dens_the)
     359  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: d_deltat_ajs_cv, d_deltaq_ajs_cv
     360  !$OMP THREADPRIVATE(d_deltat_ajs_cv, d_deltaq_ajs_cv)
    360361#ifdef ISO
    361362    REAL, SAVE, ALLOCATABLE,DIMENSION(:,:,:)          :: d_deltaxt_wk
     
    370371!$OMP THREADPRIVATE(d_deltaxt_ajs_cv)
    371372#endif                       
    372 !!         End of Wake variables
    373 !!
    374       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: bils
    375 !$OMP THREADPRIVATE(bils)
    376       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: cdragm, cdragh
    377 !$OMP THREADPRIVATE(cdragm, cdragh)
    378       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: cldh, cldl, cldm, cldq, cldt, qsat2m
    379 !$OMP THREADPRIVATE(cldh, cldl, cldm, cldq, cldt, qsat2m)
    380 !AS: cldhjn, cldljn, cldmjn,cldtjn pas utilisés en tant que variables, juste noms de diagnostics
    381       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: JrNt
    382 !$OMP THREADPRIVATE(JrNt)
    383       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: dthmin, evap, snowerosion, fder, plcl, plfc, prw, prlw, prsw, prbsw, water_budget
    384 !$OMP THREADPRIVATE(dthmin, evap, snowerosion, fder, plcl, plfc, prw, prlw, prsw, prbsw, water_budget)
    385       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zustar, zu10m, zv10m, rh2m
    386 !$OMP THREADPRIVATE(zustar, zu10m, zv10m, rh2m)
    387       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: s_lcl, s_pblh, s_pblt, s_therm
    388 !$OMP THREADPRIVATE(s_lcl, s_pblh, s_pblt, s_therm)
    389 !
    390 !nrlmd+jyg<
    391       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: s_pblh_x, s_pblh_w
    392 !$OMP THREADPRIVATE(s_pblh_x, s_pblh_w)
    393       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: s_lcl_x, s_lcl_w
    394 !$OMP THREADPRIVATE(s_lcl_x, s_lcl_w)
    395 !>nrlmd+jyg
    396 !
    397       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: slab_wfbils
    398 !$OMP THREADPRIVATE(slab_wfbils)
    399       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: tpot, tpote, ue, uq, uwat, ve, vq, vwat, zxffonte
    400 !$OMP THREADPRIVATE(tpot, tpote, ue, uq, uwat, ve, vq, vwat, zxffonte)
    401       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxustartlic, zxrhoslic, zxqsaltlic
    402 !$OMP THREADPRIVATE(zxustartlic, zxrhoslic, zxqsaltlic)
    403       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxfqcalving
    404 !$OMP THREADPRIVATE(zxfqcalving)
    405       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxfluxlat, zxtsol, snow_lsc, zxfqfonte
    406 !$OMP THREADPRIVATE(zxfluxlat, zxtsol, snow_lsc, zxfqfonte)
    407       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxrunofflic
    408 !$OMP THREADPRIVATE(zxrunofflic)
    409       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxqsurf, rain_lsc, rain_num
    410 !$OMP THREADPRIVATE(zxqsurf, rain_lsc, rain_num)
     373  !!         End of Wake variables
     374  !!
     375  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: bils
     376  !$OMP THREADPRIVATE(bils)
     377  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: cdragm, cdragh
     378  !$OMP THREADPRIVATE(cdragm, cdragh)
     379  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: cldh, cldl, cldm, cldq, cldt, qsat2m
     380  !$OMP THREADPRIVATE(cldh, cldl, cldm, cldq, cldt, qsat2m)
     381  !AS: cldhjn, cldljn, cldmjn,cldtjn pas utilisés en tant que variables, juste noms de diagnostics
     382  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: JrNt
     383  !$OMP THREADPRIVATE(JrNt)
     384  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: dthmin, evap, snowerosion, fder, plcl, plfc, prw, prlw, prsw, prbsw, water_budget
     385  !$OMP THREADPRIVATE(dthmin, evap, snowerosion, fder, plcl, plfc, prw, prlw, prsw, prbsw, water_budget)
     386  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zustar, zu10m, zv10m, rh2m
     387  !$OMP THREADPRIVATE(zustar, zu10m, zv10m, rh2m)
     388  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: s_lcl, s_pblh, s_pblt, s_therm
     389  !$OMP THREADPRIVATE(s_lcl, s_pblh, s_pblt, s_therm)
     390  !
     391  !nrlmd+jyg<
     392  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: s_pblh_x, s_pblh_w
     393  !$OMP THREADPRIVATE(s_pblh_x, s_pblh_w)
     394  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: s_lcl_x, s_lcl_w
     395  !$OMP THREADPRIVATE(s_lcl_x, s_lcl_w)
     396  !>nrlmd+jyg
     397  !
     398  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: slab_wfbils
     399  !$OMP THREADPRIVATE(slab_wfbils)
     400  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: tpot, tpote, ue, uq, uwat, ve, vq, vwat, zxffonte
     401  !$OMP THREADPRIVATE(tpot, tpote, ue, uq, uwat, ve, vq, vwat, zxffonte)
     402  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxustartlic, zxrhoslic, zxqsaltlic
     403  !$OMP THREADPRIVATE(zxustartlic, zxrhoslic, zxqsaltlic)
     404  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxfqcalving
     405  !$OMP THREADPRIVATE(zxfqcalving)
     406  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxfluxlat, zxtsol, snow_lsc, zxfqfonte
     407  !$OMP THREADPRIVATE(zxfluxlat, zxtsol, snow_lsc, zxfqfonte)
     408  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxrunofflic
     409  !$OMP THREADPRIVATE(zxrunofflic)
     410  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxqsurf, rain_lsc, rain_num
     411  !$OMP THREADPRIVATE(zxqsurf, rain_lsc, rain_num)
    411412#ifdef ISO
    412413      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: xtevap,xtprw
     
    424425!$OMP THREADPRIVATE(xtrain_lsc)
    425426#endif
    426 !
    427 !jyg+nrlmd<
    428 !!!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    429 !                                                                          c
    430 !       Declarations liees a la couche limite differentiee w-x             c
    431 !                                                                          c
    432 !!!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    433       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: sens_x, sens_w
    434 !$OMP THREADPRIVATE(sens_x, sens_w)
    435       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxfluxlat_x, zxfluxlat_w
    436 !$OMP THREADPRIVATE(zxfluxlat_x, zxfluxlat_w)
    437       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: delta_qsurf
    438 !$OMP THREADPRIVATE(delta_qsurf)
    439 !jyg<
    440 !!! Entrees supplementaires couche-limite
    441 !!      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: t_x, t_w
    442 !!!$OMP THREADPRIVATE(t_x, t_w)
    443 !!      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: q_x, q_w
    444 !!!$OMP THREADPRIVATE(q_x, q_w)
    445 !>jyg
    446 !!! Sorties ferret
    447       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: dtvdf_x, dtvdf_w
    448 !$OMP THREADPRIVATE(dtvdf_x, dtvdf_w)
    449       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: dqvdf_x, dqvdf_w
    450 !$OMP THREADPRIVATE(dqvdf_x, dqvdf_w)
    451 ! Variables supplementaires dans physiq.F relative au splitting de la surface
    452       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: pbl_tke_input
    453 !$OMP THREADPRIVATE(pbl_tke_input)
    454 ! Entree supplementaire Thermiques :
    455       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: t_therm, q_therm, u_therm, v_therm
    456 !$OMP THREADPRIVATE(t_therm, q_therm, u_therm, v_therm)
    457       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: cdragh_x, cdragh_w
    458 !$OMP THREADPRIVATE(cdragh_x, cdragh_w)
    459       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: cdragm_x, cdragm_w
    460 !$OMP THREADPRIVATE(cdragm_x, cdragm_w)
    461       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: kh, kh_x, kh_w
    462 !$OMP THREADPRIVATE(kh, kh_x, kh_w)
     427  !
     428  !jyg+nrlmd<
     429  !!!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     430  !                                                                          c
     431  !       Declarations liees a la couche limite differentiee w-x             c
     432  !                                                                          c
     433  !!!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     434  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: sens_x, sens_w
     435  !$OMP THREADPRIVATE(sens_x, sens_w)
     436  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxfluxlat_x, zxfluxlat_w
     437  !$OMP THREADPRIVATE(zxfluxlat_x, zxfluxlat_w)
     438  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: delta_qsurf
     439  !$OMP THREADPRIVATE(delta_qsurf)
     440  !jyg<
     441  !!! Entrees supplementaires couche-limite
     442  !!      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: t_x, t_w
     443  !!!$OMP THREADPRIVATE(t_x, t_w)
     444  !!      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: q_x, q_w
     445  !!!$OMP THREADPRIVATE(q_x, q_w)
     446  !>jyg
     447  !!! Sorties ferret
     448  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: dtvdf_x, dtvdf_w
     449  !$OMP THREADPRIVATE(dtvdf_x, dtvdf_w)
     450  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: dqvdf_x, dqvdf_w
     451  !$OMP THREADPRIVATE(dqvdf_x, dqvdf_w)
     452  ! Variables supplementaires dans physiq.F relative au splitting de la surface
     453  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: pbl_tke_input
     454  !$OMP THREADPRIVATE(pbl_tke_input)
     455  ! Entree supplementaire Thermiques :
     456  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: t_therm, q_therm, u_therm, v_therm
     457  !$OMP THREADPRIVATE(t_therm, q_therm, u_therm, v_therm)
     458  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: cdragh_x, cdragh_w
     459  !$OMP THREADPRIVATE(cdragh_x, cdragh_w)
     460  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: cdragm_x, cdragm_w
     461  !$OMP THREADPRIVATE(cdragm_x, cdragm_w)
     462  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: kh, kh_x, kh_w
     463  !$OMP THREADPRIVATE(kh, kh_x, kh_w)
    463464#ifdef ISO
    464465      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: dxtvdf_x, dxtvdf_w
     
    467468!$OMP THREADPRIVATE(xt_therm)
    468469#endif
    469 !!!
    470 !!!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    471       LOGICAL, SAVE, ALLOCATABLE :: ptconv(:,:)
    472       !$OMP THREADPRIVATE(ptconv)
    473       REAL, SAVE, ALLOCATABLE :: ratqsc(:,:)
    474       !$OMP THREADPRIVATE(ratqsc)
    475 !>jyg+nrlmd
     470  !!!
     471  !!!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     472  LOGICAL, SAVE, ALLOCATABLE :: ptconv(:, :)
     473  !$OMP THREADPRIVATE(ptconv)
     474  REAL, SAVE, ALLOCATABLE :: ratqsc(:, :)
     475  !$OMP THREADPRIVATE(ratqsc)
     476  !>jyg+nrlmd
    476477  !
    477       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: wbeff, convoccur, zmax_th, zq2m, zt2m
    478 !$OMP THREADPRIVATE(wbeff, convoccur, zmax_th, zq2m, zt2m)
    479       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zt2m_min_mon, zt2m_max_mon
    480 !$OMP THREADPRIVATE(zt2m_min_mon, zt2m_max_mon)
    481       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: t2m_min_mon, t2m_max_mon
    482 !$OMP THREADPRIVATE(t2m_min_mon, t2m_max_mon)
    483       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: weak_inversion
    484 !$OMP THREADPRIVATE(weak_inversion)
    485       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: alp_bl_conv,alp_bl_det
    486 !$OMP THREADPRIVATE(alp_bl_conv,alp_bl_det)
    487       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: alp_bl_fluct_m,alp_bl_fluct_tke
    488 !$OMP THREADPRIVATE(alp_bl_fluct_m,alp_bl_fluct_tke)
    489       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: alp_bl_stat, n2, s2, strig, zcong, zlcl_th
    490 !$OMP THREADPRIVATE(alp_bl_stat, n2, s2, strig, zcong, zlcl_th)
    491       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: proba_notrig, random_notrig
    492 !$OMP THREADPRIVATE(proba_notrig, random_notrig)
    493       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: fsolsw, wfbils
    494 !$OMP THREADPRIVATE(fsolsw, wfbils)
    495       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: wfevap
    496 !$OMP THREADPRIVATE(wfevap)
    497       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: t2m, fluxlat, fsollw,evap_pot
    498 !$OMP THREADPRIVATE(t2m, fluxlat, fsollw,evap_pot)
    499       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: dnwd0, omega
    500 !$OMP THREADPRIVATE(dnwd0, omega)
    501       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: epmax_diag ! epmax_cape
    502 !$OMP THREADPRIVATE(epmax_diag)
    503 !
    504 !  Deep convective variables used in phytrac
    505       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: ep ! epmax_cape
    506 !$OMP THREADPRIVATE(ep)
    507       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: dnwd, upwd
    508 !$OMP THREADPRIVATE(dnwd, upwd)
    509       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: pmflxr, pmflxs
    510 !$OMP THREADPRIVATE(pmflxr, pmflxs)
    511       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: wdtrainA, wdtrainS, wdtrainM
    512 !$OMP THREADPRIVATE(wdtrainA, wdtrainS, wdtrainM)
    513       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: da, mp
    514 !$OMP THREADPRIVATE(da, mp)
    515       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: wght_cvfd
    516 !$OMP THREADPRIVATE(wght_cvfd)
    517       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:):: phi, phi2, elij, epmlmMm
    518 !$OMP THREADPRIVATE(phi, phi2, elij, epmlmMm)
    519       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: d1a, dam
    520 !$OMP THREADPRIVATE(d1a, dam)
    521       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: ev
    522 !$OMP THREADPRIVATE(ev)
    523       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: qtaa
    524 !$OMP THREADPRIVATE(qtaa)
    525       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: clw
    526 !$OMP THREADPRIVATE(clw)
    527       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: eplaMm
    528 !$OMP THREADPRIVATE(eplaMm)
    529       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:):: sij
    530 !$OMP THREADPRIVATE(sij)
     478  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: wbeff, convoccur, zmax_th, zq2m, zt2m
     479  !$OMP THREADPRIVATE(wbeff, convoccur, zmax_th, zq2m, zt2m)
     480  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zt2m_min_mon, zt2m_max_mon
     481  !$OMP THREADPRIVATE(zt2m_min_mon, zt2m_max_mon)
     482  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: t2m_min_mon, t2m_max_mon
     483  !$OMP THREADPRIVATE(t2m_min_mon, t2m_max_mon)
     484  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: weak_inversion
     485  !$OMP THREADPRIVATE(weak_inversion)
     486  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: alp_bl_conv, alp_bl_det
     487  !$OMP THREADPRIVATE(alp_bl_conv,alp_bl_det)
     488  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: alp_bl_fluct_m, alp_bl_fluct_tke
     489  !$OMP THREADPRIVATE(alp_bl_fluct_m,alp_bl_fluct_tke)
     490  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: alp_bl_stat, n2, s2, strig, zcong, zlcl_th
     491  !$OMP THREADPRIVATE(alp_bl_stat, n2, s2, strig, zcong, zlcl_th)
     492  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: proba_notrig, random_notrig
     493  !$OMP THREADPRIVATE(proba_notrig, random_notrig)
     494  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: fsolsw, wfbils
     495  !$OMP THREADPRIVATE(fsolsw, wfbils)
     496  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: wfevap
     497  !$OMP THREADPRIVATE(wfevap)
     498  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: t2m, fluxlat, fsollw, evap_pot
     499  !$OMP THREADPRIVATE(t2m, fluxlat, fsollw,evap_pot)
     500  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: dnwd0, omega
     501  !$OMP THREADPRIVATE(dnwd0, omega)
     502  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: epmax_diag ! epmax_cape
     503  !$OMP THREADPRIVATE(epmax_diag)
     504  !
     505  !  Deep convective variables used in phytrac
     506  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: ep ! epmax_cape
     507  !$OMP THREADPRIVATE(ep)
     508  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: dnwd, upwd
     509  !$OMP THREADPRIVATE(dnwd, upwd)
     510  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: pmflxr, pmflxs
     511  !$OMP THREADPRIVATE(pmflxr, pmflxs)
     512  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: wdtrainA, wdtrainS, wdtrainM
     513  !$OMP THREADPRIVATE(wdtrainA, wdtrainS, wdtrainM)
     514  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: da, mp
     515  !$OMP THREADPRIVATE(da, mp)
     516  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: wght_cvfd
     517  !$OMP THREADPRIVATE(wght_cvfd)
     518  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: phi, phi2, elij, epmlmMm
     519  !$OMP THREADPRIVATE(phi, phi2, elij, epmlmMm)
     520  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: d1a, dam
     521  !$OMP THREADPRIVATE(d1a, dam)
     522  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: ev
     523  !$OMP THREADPRIVATE(ev)
     524  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: qtaa
     525  !$OMP THREADPRIVATE(qtaa)
     526  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: clw
     527  !$OMP THREADPRIVATE(clw)
     528  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: eplaMm
     529  !$OMP THREADPRIVATE(eplaMm)
     530  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: sij
     531  !$OMP THREADPRIVATE(sij)
    531532#ifdef ISO
    532533      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:)  :: xtwdtrainA
     
    575576#endif
    576577#endif
    577 !
    578 !      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: coefh, coefm, lambda_th
    579       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: lambda_th
    580 !$OMP THREADPRIVATE(lambda_th)
    581       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: cldemi, cldfra, cldtau, fiwc, fl, re, flwc
    582 !$OMP THREADPRIVATE(cldemi, cldfra, cldtau, fiwc, fl, re, flwc)
    583       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: qlth, qith, qsith, wiceth
    584 !$OMP THREADPRIVATE(qlth, qith, qsith, wiceth)
    585       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: ref_liq, ref_ice, theta, zphi
    586 !$OMP THREADPRIVATE(ref_liq, ref_ice, theta, zphi)
    587       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: ref_liq_pi, ref_ice_pi
    588 !$OMP THREADPRIVATE(ref_liq_pi, ref_ice_pi)
    589       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: zx_rh, zx_rhl, zx_rhi
    590 !$OMP THREADPRIVATE(zx_rh, zx_rhl, zx_rhi)
    591       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: prfl, psfl, fraca, bsfl
    592 !$OMP THREADPRIVATE(prfl, psfl, fraca, bsfl)
    593       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: Vprecip, zw2
    594 !$OMP THREADPRIVATE(Vprecip, zw2)
    595       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: pmfd, pmfu
    596 !$OMP THREADPRIVATE(pmfd, pmfu)
    597       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: fluxt, fluxu, fluxv
    598 !$OMP THREADPRIVATE(fluxt, fluxu, fluxv)
    599       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: uwriteSTD, vwriteSTD, wwriteSTD
    600 !$OMP THREADPRIVATE(uwriteSTD, vwriteSTD, wwriteSTD)
    601       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: phiwriteSTD, qwriteSTD, twriteSTD, rhwriteSTD
    602 !$OMP THREADPRIVATE(phiwriteSTD, qwriteSTD, twriteSTD, rhwriteSTD)
    603 
    604 
    605 ! ug et d'autres encore:
    606       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: beta_prec
    607 !$OMP THREADPRIVATE(beta_prec)
    608       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: rneb,rnebjn,rneblsvol
    609 !$OMP THREADPRIVATE(rneb,rnebjn,rneblsvol)
    610       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: pfraclr,pfracld
    611 !$OMP THREADPRIVATE(pfraclr,pfracld)
    612       REAL, SAVE, ALLOCATABLE :: cldfraliq(:,:)
    613 !$OMP THREADPRIVATE(cldfraliq)
    614       REAL, SAVE, ALLOCATABLE ::mean_icefracturb(:,:)
    615 !$OMP THREADPRIVATE(mean_icefracturb)
    616       REAL, SAVE, ALLOCATABLE :: sigma2_icefracturb(:,:)
    617 !$OMP THREADPRIVATE(sigma2_icefracturb)
    618 
    619 ! variables de sorties MM
    620       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxsnow,snowhgt,qsnow,to_ice
    621       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: sissnow,runoff,albsol3_lic
    622 !$OMP THREADPRIVATE(zxsnow,snowhgt,qsnow,to_ice)
    623 !$OMP THREADPRIVATE(sissnow,runoff,albsol3_lic)
     578  !
     579  !      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: coefh, coefm, lambda_th
     580  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: lambda_th
     581  !$OMP THREADPRIVATE(lambda_th)
     582  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: cldemi, cldfra, cldtau, fiwc, fl, re, flwc
     583  !$OMP THREADPRIVATE(cldemi, cldfra, cldtau, fiwc, fl, re, flwc)
     584  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: qlth, qith, qsith, wiceth
     585  !$OMP THREADPRIVATE(qlth, qith, qsith, wiceth)
     586  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: ref_liq, ref_ice, theta, zphi
     587  !$OMP THREADPRIVATE(ref_liq, ref_ice, theta, zphi)
     588  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: ref_liq_pi, ref_ice_pi
     589  !$OMP THREADPRIVATE(ref_liq_pi, ref_ice_pi)
     590  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: zx_rh, zx_rhl, zx_rhi
     591  !$OMP THREADPRIVATE(zx_rh, zx_rhl, zx_rhi)
     592  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: prfl, psfl, fraca, bsfl
     593  !$OMP THREADPRIVATE(prfl, psfl, fraca, bsfl)
     594  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: Vprecip, zw2
     595  !$OMP THREADPRIVATE(Vprecip, zw2)
     596  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: pmfd, pmfu
     597  !$OMP THREADPRIVATE(pmfd, pmfu)
     598  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: fluxt, fluxu, fluxv
     599  !$OMP THREADPRIVATE(fluxt, fluxu, fluxv)
     600  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: uwriteSTD, vwriteSTD, wwriteSTD
     601  !$OMP THREADPRIVATE(uwriteSTD, vwriteSTD, wwriteSTD)
     602  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: phiwriteSTD, qwriteSTD, twriteSTD, rhwriteSTD
     603  !$OMP THREADPRIVATE(phiwriteSTD, qwriteSTD, twriteSTD, rhwriteSTD)
     604
     605
     606  ! ug et d'autres encore:
     607  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: beta_prec
     608  !$OMP THREADPRIVATE(beta_prec)
     609  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: rneb, rnebjn, rneblsvol
     610  !$OMP THREADPRIVATE(rneb,rnebjn,rneblsvol)
     611  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: pfraclr, pfracld
     612  !$OMP THREADPRIVATE(pfraclr,pfracld)
     613  REAL, SAVE, ALLOCATABLE :: cldfraliq(:, :)
     614  !$OMP THREADPRIVATE(cldfraliq)
     615  REAL, SAVE, ALLOCATABLE :: mean_icefracturb(:, :)
     616  !$OMP THREADPRIVATE(mean_icefracturb)
     617  REAL, SAVE, ALLOCATABLE :: sigma2_icefracturb(:, :)
     618  !$OMP THREADPRIVATE(sigma2_icefracturb)
     619
     620  ! variables de sorties MM
     621  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: zxsnow, snowhgt, qsnow, to_ice
     622  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: sissnow, runoff, albsol3_lic
     623  !$OMP THREADPRIVATE(zxsnow,snowhgt,qsnow,to_ice)
     624  !$OMP THREADPRIVATE(sissnow,runoff,albsol3_lic)
    624625#ifdef ISO
    625626      REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: zxxtsnow
     
    631632#endif
    632633
    633       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: p_tropopause, z_tropopause, t_tropopause
    634 !$OMP THREADPRIVATE(p_tropopause, z_tropopause, t_tropopause)
    635 
    636       INTEGER,ALLOCATABLE,SAVE,DIMENSION(:,:) :: zn2mout
    637 !$OMP THREADPRIVATE(zn2mout)
    638 
    639       REAL, SAVE, ALLOCATABLE :: qclr(:,:)
    640       !$OMP THREADPRIVATE(qclr)
    641       REAL, SAVE, ALLOCATABLE :: qcld(:,:)
    642       !$OMP THREADPRIVATE(qcld)
    643       REAL, SAVE, ALLOCATABLE :: qss(:,:)
    644       !$OMP THREADPRIVATE(qss)
    645       REAL, SAVE, ALLOCATABLE :: qvc(:,:)
    646       !$OMP THREADPRIVATE(qvc)
    647       REAL, SAVE, ALLOCATABLE :: rnebclr(:,:)
    648       !$OMP THREADPRIVATE(rnebclr)
    649       REAL, SAVE, ALLOCATABLE :: rnebss(:,:)
    650       !$OMP THREADPRIVATE(rnebss)
    651       REAL, SAVE, ALLOCATABLE :: gamma_ss(:,:)
    652       !$OMP THREADPRIVATE(gamma_ss)
    653       REAL, SAVE, ALLOCATABLE :: N1_ss(:,:)
    654       !$OMP THREADPRIVATE(N1_ss)
    655       REAL, SAVE, ALLOCATABLE :: N2_ss(:,:)
    656       !$OMP THREADPRIVATE(N2_ss)
    657       REAL, SAVE, ALLOCATABLE :: drneb_sub(:,:)
    658       !$OMP THREADPRIVATE(drneb_sub)
    659       REAL, SAVE, ALLOCATABLE :: drneb_con(:,:)
    660       !$OMP THREADPRIVATE(drneb_con)
    661       REAL, SAVE, ALLOCATABLE :: drneb_tur(:,:)
    662       !$OMP THREADPRIVATE(drneb_tur)
    663       REAL, SAVE, ALLOCATABLE :: drneb_avi(:,:)
    664       !$OMP THREADPRIVATE(drneb_avi)
    665       REAL, SAVE, ALLOCATABLE :: zqsatl(:,:)
    666       !$OMP THREADPRIVATE(zqsatl)
    667       REAL, SAVE, ALLOCATABLE :: zqsats(:,:)
    668       !$OMP THREADPRIVATE(zqsats)
    669       REAL, SAVE, ALLOCATABLE :: Tcontr(:,:)
    670       !$OMP THREADPRIVATE(Tcontr)
    671       REAL, SAVE, ALLOCATABLE :: qcontr(:,:)
    672       !$OMP THREADPRIVATE(qcontr)
    673       REAL, SAVE, ALLOCATABLE :: qcontr2(:,:)
    674       !$OMP THREADPRIVATE(qcontr2)
    675       REAL, SAVE, ALLOCATABLE :: fcontrN(:,:)
    676       !$OMP THREADPRIVATE(fcontrN)
    677       REAL, SAVE, ALLOCATABLE :: fcontrP(:,:)
    678       !$OMP THREADPRIVATE(fcontrP)
    679       REAL, SAVE, ALLOCATABLE :: distcltop(:,:)
    680       !$OMP THREADPRIVATE(distcltop)
    681       REAL, SAVE, ALLOCATABLE :: temp_cltop(:,:)
    682       !$OMP THREADPRIVATE(temp_cltop)
    683 
    684 
    685 !--POPRECIP variables
    686       REAL, SAVE, ALLOCATABLE :: qraindiag(:,:)
    687       !$OMP THREADPRIVATE(qraindiag)
    688       REAL, SAVE, ALLOCATABLE :: qsnowdiag(:,:)
    689       !$OMP THREADPRIVATE(qsnowdiag)
    690       REAL, SAVE, ALLOCATABLE :: dqreva(:,:)
    691       !$OMP THREADPRIVATE(dqreva)
    692       REAL, SAVE, ALLOCATABLE :: dqrauto(:,:)
    693       !$OMP THREADPRIVATE(dqrauto)
    694       REAL, SAVE, ALLOCATABLE :: dqrcol(:,:)
    695       !$OMP THREADPRIVATE(dqrcol)
    696       REAL, SAVE, ALLOCATABLE :: dqrmelt(:,:)
    697       !$OMP THREADPRIVATE(dqrmelt)
    698        REAL, SAVE, ALLOCATABLE :: dqrfreez(:,:)
    699       !$OMP THREADPRIVATE(dqrfreez)
    700       REAL, SAVE, ALLOCATABLE :: dqssub(:,:)
    701       !$OMP THREADPRIVATE(dqssub)
    702       REAL, SAVE, ALLOCATABLE :: dqsauto(:,:)
    703       !$OMP THREADPRIVATE(dqsauto)
    704       REAL, SAVE, ALLOCATABLE :: dqsagg(:,:)
    705       !$OMP THREADPRIVATE(dqsagg)
    706       REAL, SAVE, ALLOCATABLE :: dqsrim(:,:)
    707       !$OMP THREADPRIVATE(dqsrim)
    708       REAL, SAVE, ALLOCATABLE :: dqsmelt(:,:)
    709       !$OMP THREADPRIVATE(dqsmelt)
    710       REAL, SAVE, ALLOCATABLE :: dqsfreez(:,:)
    711       !$OMP THREADPRIVATE(dqsfreez)
    712 
    713 
    714      
    715 
    716 
    717 #ifdef CPP_StratAer
    718 !
    719 ! variables for stratospheric aerosol
    720       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: d_q_emiss
    721 !$OMP THREADPRIVATE(d_q_emiss)
    722       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: R2SO4
    723 !$OMP THREADPRIVATE(R2SO4)
    724       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: DENSO4
    725 !$OMP THREADPRIVATE(DENSO4)
    726       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: f_r_wet
    727 !$OMP THREADPRIVATE(f_r_wet)
    728       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: decfluxaer
    729 !$OMP THREADPRIVATE(decfluxaer)
    730       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: mdw
    731 !$OMP THREADPRIVATE(mdw)
    732       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: OCS_lifetime
    733 !$OMP THREADPRIVATE(OCS_lifetime)
    734       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: SO2_lifetime
    735 !$OMP THREADPRIVATE(SO2_lifetime)
    736       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: H2SO4_lifetime
    737 !$OMP THREADPRIVATE(H2SO4_lifetime)
    738       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: O3_clim
    739 !$OMP THREADPRIVATE(O3_clim)
    740       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: alpha_bin
    741 !$OMP THREADPRIVATE(alpha_bin)
    742       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: piz_bin
    743 !$OMP THREADPRIVATE(piz_bin)
    744       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: cg_bin
    745 !$OMP THREADPRIVATE(cg_bin)
    746       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: tau_strat_550
    747 !$OMP THREADPRIVATE(tau_strat_550)
    748       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: tau_strat_1020
    749 !$OMP THREADPRIVATE(tau_strat_1020)
    750       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: tausum_strat
    751 !$OMP THREADPRIVATE(tausum_strat)
    752       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: surf_PM25_sulf
    753 !$OMP THREADPRIVATE(surf_PM25_sulf)
    754       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: vsed_aer
    755 !$OMP THREADPRIVATE(vsed_aer)
    756 !
    757 !---3D budget variables
    758       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: budg_3D_nucl
    759 !$OMP THREADPRIVATE(budg_3D_nucl)
    760       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: budg_3D_cond_evap
    761 !$OMP THREADPRIVATE(budg_3D_cond_evap)
    762       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: budg_3D_ocs_to_so2
    763 !$OMP THREADPRIVATE(budg_3D_ocs_to_so2)
    764       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: budg_3D_so2_to_h2so4
    765 !$OMP THREADPRIVATE(budg_3D_so2_to_h2so4)
    766       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: budg_3D_backgr_ocs
    767 !$OMP THREADPRIVATE(budg_3D_backgr_ocs)
    768       REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: budg_3D_backgr_so2
    769 !$OMP THREADPRIVATE(budg_3D_backgr_so2)
    770 !
    771 !---2D budget variables
    772       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_ocs
    773       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_so2
    774       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_h2so4
    775       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_part
    776 !$OMP THREADPRIVATE(budg_dep_dry_ocs,budg_dep_dry_so2,budg_dep_dry_h2so4,budg_dep_dry_part)
    777       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_ocs
    778       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_so2
    779       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_h2so4
    780       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_part
    781 !$OMP THREADPRIVATE(budg_dep_wet_ocs,budg_dep_wet_so2,budg_dep_wet_h2so4,budg_dep_wet_part)
    782       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_ocs
    783       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_so2
    784       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_h2so4
    785       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_part
    786 !$OMP THREADPRIVATE(budg_emi_ocs,budg_emi_so2,budg_emi_h2so4,budg_emi_part)
    787       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_ocs_to_so2
    788       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_so2_to_h2so4
    789       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_h2so4_to_part
    790 !$OMP THREADPRIVATE(budg_ocs_to_so2,budg_so2_to_h2so4,budg_h2so4_to_part)
    791       REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_sed_part
    792 !$OMP THREADPRIVATE(budg_sed_part)
    793 #endif
     634  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: p_tropopause, z_tropopause, t_tropopause
     635  !$OMP THREADPRIVATE(p_tropopause, z_tropopause, t_tropopause)
     636
     637  INTEGER, ALLOCATABLE, SAVE, DIMENSION(:, :) :: zn2mout
     638  !$OMP THREADPRIVATE(zn2mout)
     639
     640  REAL, SAVE, ALLOCATABLE :: qclr(:, :)
     641  !$OMP THREADPRIVATE(qclr)
     642  REAL, SAVE, ALLOCATABLE :: qcld(:, :)
     643  !$OMP THREADPRIVATE(qcld)
     644  REAL, SAVE, ALLOCATABLE :: qss(:, :)
     645  !$OMP THREADPRIVATE(qss)
     646  REAL, SAVE, ALLOCATABLE :: qvc(:, :)
     647  !$OMP THREADPRIVATE(qvc)
     648  REAL, SAVE, ALLOCATABLE :: rnebclr(:, :)
     649  !$OMP THREADPRIVATE(rnebclr)
     650  REAL, SAVE, ALLOCATABLE :: rnebss(:, :)
     651  !$OMP THREADPRIVATE(rnebss)
     652  REAL, SAVE, ALLOCATABLE :: gamma_ss(:, :)
     653  !$OMP THREADPRIVATE(gamma_ss)
     654  REAL, SAVE, ALLOCATABLE :: N1_ss(:, :)
     655  !$OMP THREADPRIVATE(N1_ss)
     656  REAL, SAVE, ALLOCATABLE :: N2_ss(:, :)
     657  !$OMP THREADPRIVATE(N2_ss)
     658  REAL, SAVE, ALLOCATABLE :: drneb_sub(:, :)
     659  !$OMP THREADPRIVATE(drneb_sub)
     660  REAL, SAVE, ALLOCATABLE :: drneb_con(:, :)
     661  !$OMP THREADPRIVATE(drneb_con)
     662  REAL, SAVE, ALLOCATABLE :: drneb_tur(:, :)
     663  !$OMP THREADPRIVATE(drneb_tur)
     664  REAL, SAVE, ALLOCATABLE :: drneb_avi(:, :)
     665  !$OMP THREADPRIVATE(drneb_avi)
     666  REAL, SAVE, ALLOCATABLE :: zqsatl(:, :)
     667  !$OMP THREADPRIVATE(zqsatl)
     668  REAL, SAVE, ALLOCATABLE :: zqsats(:, :)
     669  !$OMP THREADPRIVATE(zqsats)
     670  REAL, SAVE, ALLOCATABLE :: Tcontr(:, :)
     671  !$OMP THREADPRIVATE(Tcontr)
     672  REAL, SAVE, ALLOCATABLE :: qcontr(:, :)
     673  !$OMP THREADPRIVATE(qcontr)
     674  REAL, SAVE, ALLOCATABLE :: qcontr2(:, :)
     675  !$OMP THREADPRIVATE(qcontr2)
     676  REAL, SAVE, ALLOCATABLE :: fcontrN(:, :)
     677  !$OMP THREADPRIVATE(fcontrN)
     678  REAL, SAVE, ALLOCATABLE :: fcontrP(:, :)
     679  !$OMP THREADPRIVATE(fcontrP)
     680  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :, :) :: DENSO4B
     681  !$OMP THREADPRIVATE(DENSO4B)
     682  REAL, SAVE, ALLOCATABLE :: distcltop(:, :)
     683  !$OMP THREADPRIVATE(distcltop)
     684  REAL, SAVE, ALLOCATABLE :: temp_cltop(:, :)
     685  !$OMP THREADPRIVATE(temp_cltop)
     686
     687
     688  !--POPRECIP variables
     689  REAL, SAVE, ALLOCATABLE :: qraindiag(:, :)
     690  !$OMP THREADPRIVATE(qraindiag)
     691  REAL, SAVE, ALLOCATABLE :: qsnowdiag(:, :)
     692  !$OMP THREADPRIVATE(qsnowdiag)
     693  REAL, SAVE, ALLOCATABLE :: dqreva(:, :)
     694  !$OMP THREADPRIVATE(dqreva)
     695  REAL, SAVE, ALLOCATABLE :: dqrauto(:, :)
     696  !$OMP THREADPRIVATE(dqrauto)
     697  REAL, SAVE, ALLOCATABLE :: dqrcol(:, :)
     698  !$OMP THREADPRIVATE(dqrcol)
     699  REAL, SAVE, ALLOCATABLE :: dqrmelt(:, :)
     700  !$OMP THREADPRIVATE(dqrmelt)
     701  REAL, SAVE, ALLOCATABLE :: dqrfreez(:, :)
     702  !$OMP THREADPRIVATE(dqrfreez)
     703  REAL, SAVE, ALLOCATABLE :: dqssub(:, :)
     704  !$OMP THREADPRIVATE(dqssub)
     705  REAL, SAVE, ALLOCATABLE :: dqsauto(:, :)
     706  !$OMP THREADPRIVATE(dqsauto)
     707  REAL, SAVE, ALLOCATABLE :: dqsagg(:, :)
     708  !$OMP THREADPRIVATE(dqsagg)
     709  REAL, SAVE, ALLOCATABLE :: dqsrim(:, :)
     710  !$OMP THREADPRIVATE(dqsrim)
     711  REAL, SAVE, ALLOCATABLE :: dqsmelt(:, :)
     712  !$OMP THREADPRIVATE(dqsmelt)
     713  REAL, SAVE, ALLOCATABLE :: dqsfreez(:, :)
     714  !$OMP THREADPRIVATE(dqsfreez)
     715
     716
     717
     718
     719
     720  !
     721  ! variables for stratospheric aerosol
     722  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: d_q_emiss
     723  !$OMP THREADPRIVATE(d_q_emiss)
     724  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: R2SO4
     725  !$OMP THREADPRIVATE(R2SO4)
     726  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: DENSO4
     727  !$OMP THREADPRIVATE(DENSO4)
     728  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: f_r_wet
     729  !$OMP THREADPRIVATE(f_r_wet)
     730  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: decfluxaer
     731  !$OMP THREADPRIVATE(decfluxaer)
     732  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: mdw
     733  !$OMP THREADPRIVATE(mdw)
     734  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: OCS_lifetime
     735  !$OMP THREADPRIVATE(OCS_lifetime)
     736  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: SO2_lifetime
     737  !$OMP THREADPRIVATE(SO2_lifetime)
     738  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: H2SO4_lifetime
     739  !$OMP THREADPRIVATE(H2SO4_lifetime)
     740  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: O3_clim
     741  !$OMP THREADPRIVATE(O3_clim)
     742  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: alpha_bin
     743  !$OMP THREADPRIVATE(alpha_bin)
     744  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: piz_bin
     745  !$OMP THREADPRIVATE(piz_bin)
     746  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: cg_bin
     747  !$OMP THREADPRIVATE(cg_bin)
     748  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: tau_strat_550
     749  !$OMP THREADPRIVATE(tau_strat_550)
     750  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: tau_strat_1020
     751  !$OMP THREADPRIVATE(tau_strat_1020)
     752  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: tausum_strat
     753  !$OMP THREADPRIVATE(tausum_strat)
     754  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: surf_PM25_sulf
     755  !$OMP THREADPRIVATE(surf_PM25_sulf)
     756  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: vsed_aer
     757  !$OMP THREADPRIVATE(vsed_aer)
     758  !
     759  !---3D budget variables
     760  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_nucl
     761  !$OMP THREADPRIVATE(budg_3D_nucl)
     762  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_cond_evap
     763  !$OMP THREADPRIVATE(budg_3D_cond_evap)
     764  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_ocs_to_so2
     765  !$OMP THREADPRIVATE(budg_3D_ocs_to_so2)
     766  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_so2_to_h2so4
     767  !$OMP THREADPRIVATE(budg_3D_so2_to_h2so4)
     768  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_backgr_ocs
     769  !$OMP THREADPRIVATE(budg_3D_backgr_ocs)
     770  REAL, ALLOCATABLE, SAVE, DIMENSION(:, :) :: budg_3D_backgr_so2
     771  !$OMP THREADPRIVATE(budg_3D_backgr_so2)
     772  !
     773  !---2D budget variables
     774  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_ocs
     775  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_so2
     776  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_h2so4
     777  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_dry_part
     778  !$OMP THREADPRIVATE(budg_dep_dry_ocs,budg_dep_dry_so2,budg_dep_dry_h2so4,budg_dep_dry_part)
     779  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_ocs
     780  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_so2
     781  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_h2so4
     782  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_dep_wet_part
     783  !$OMP THREADPRIVATE(budg_dep_wet_ocs,budg_dep_wet_so2,budg_dep_wet_h2so4,budg_dep_wet_part)
     784  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_ocs
     785  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_so2
     786  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_h2so4
     787  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_emi_part
     788  !$OMP THREADPRIVATE(budg_emi_ocs,budg_emi_so2,budg_emi_h2so4,budg_emi_part)
     789  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_ocs_to_so2
     790  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_so2_to_h2so4
     791  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_h2so4_to_part
     792  !$OMP THREADPRIVATE(budg_ocs_to_so2,budg_so2_to_h2so4,budg_h2so4_to_part)
     793  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: budg_sed_part
     794  !$OMP THREADPRIVATE(budg_sed_part)
    794795#ifdef REPROBUS
    795796      REAL,SAVE,ALLOCATABLE    :: d_q_emiss(:,:)
     
    799800CONTAINS
    800801
    801 !======================================================================
    802 SUBROUTINE phys_local_var_init
    803 USE dimphy
    804 USE infotrac_phy, ONLY : nbtr,nqtot
     802  !======================================================================
     803  SUBROUTINE phys_local_var_init
     804    USE dimphy
     805    USE infotrac_phy, ONLY : nbtr, nqtot
    805806#ifdef ISO
    806807USE infotrac_phy, ONLY : ntraciso=>ntiso,niso
    807808#endif
    808 USE aero_mod
    809 USE indice_sol_mod
    810 USE phys_output_var_mod
    811 USE phys_state_var_mod
    812 
    813 IMPLICIT NONE
    814       ALLOCATE(t_seri(klon,klev),q_seri(klon,klev),ql_seri(klon,klev),qs_seri(klon,klev), qbs_seri(klon,klev))
    815       ALLOCATE(qx_seri(klon,klev,nqtot))
    816       ALLOCATE(u_seri(klon,klev),v_seri(klon,klev))
    817       ALLOCATE(l_mixmin(klon,klev+1,nbsrf),l_mix(klon,klev+1,nbsrf),wprime(klon,klev+1,nbsrf))
    818       ALLOCATE(pbl_eps(klon,klev+1,nbsrf+1))
    819       ALLOCATE(tke_shear(klon,klev+1,nbsrf), tke_buoy(klon,klev+1,nbsrf), tke_trans(klon,klev+1,nbsrf))
    820       pbl_eps(:,:,:)=0.
    821       tke_shear(:,:,:)=0.; tke_buoy(:,:,:)=0.; tke_trans(:,:,:)=0.
    822       l_mix(:,:,:)=0.;l_mixmin(:,:,:)=0.;wprime(:,:,:)=0. ! doit etre initialse car pas toujours remplis
    823       ALLOCATE(rhcl(klon,klev))
    824       ALLOCATE(tr_seri(klon,klev,nbtr))
    825       ALLOCATE(d_t_dyn(klon,klev),d_q_dyn(klon,klev))
    826       ALLOCATE(d_ql_dyn(klon,klev),d_qs_dyn(klon,klev), d_qbs_dyn(klon,klev))
    827       ALLOCATE(d_q_dyn2d(klon),d_ql_dyn2d(klon),d_qs_dyn2d(klon), d_qbs_dyn2d(klon))
    828       ALLOCATE(d_u_dyn(klon,klev),d_v_dyn(klon,klev))
    829       ALLOCATE(d_tr_dyn(klon,klev,nbtr))                   !RomP
    830       ALLOCATE(d_t_con(klon,klev),d_q_con(klon,klev),d_q_con_zmasse(klon,klev))
    831       ALLOCATE(d_u_con(klon,klev),d_v_con(klon,klev))
    832       ALLOCATE(d_t_wake(klon,klev),d_q_wake(klon,klev))
    833       ALLOCATE(d_t_lsc(klon,klev),d_q_lsc(klon,klev))
    834       ALLOCATE(d_t_lwr(klon,klev),d_t_lw0(klon,klev))
    835       ALLOCATE(d_t_swr(klon,klev),d_t_sw0(klon,klev))
    836       ALLOCATE(d_ql_lsc(klon,klev),d_qi_lsc(klon,klev))
    837       ALLOCATE(d_t_ajsb(klon,klev),d_q_ajsb(klon,klev))
    838       ALLOCATE(d_t_ajs(klon,klev),d_q_ajs(klon,klev))
    839 !nrlmd<
    840       ALLOCATE(d_t_ajs_w(klon,klev),d_q_ajs_w(klon,klev))
    841       ALLOCATE(d_t_ajs_x(klon,klev),d_q_ajs_x(klon,klev))
    842 !>nrlmd
    843       ALLOCATE(d_u_ajs(klon,klev),d_v_ajs(klon,klev))
    844       ALLOCATE(d_t_eva(klon,klev),d_q_eva(klon,klev))
    845       ALLOCATE(d_qx_eva(klon,klev,nqtot))
    846       ALLOCATE(d_ql_eva(klon,klev),d_qi_eva(klon,klev))
    847       ALLOCATE(d_t_lscst(klon,klev),d_q_lscst(klon,klev))
    848       ALLOCATE(d_t_lscth(klon,klev),d_q_lscth(klon,klev))
    849       ALLOCATE(plul_st(klon),plul_th(klon))
    850       ALLOCATE(d_t_vdf(klon,klev),d_q_vdf(klon,klev),d_t_diss(klon,klev))
    851       ALLOCATE (d_qbs_vdf(klon,klev))
    852       ALLOCATE(d_t_bsss(klon,klev),d_q_bsss(klon,klev),d_qbs_bsss(klon,klev))
    853       ALLOCATE(d_t_vdf_w(klon,klev),d_q_vdf_w(klon,klev))
    854       ALLOCATE(d_t_vdf_x(klon,klev),d_q_vdf_x(klon,klev))
     809    USE aero_mod
     810    USE indice_sol_mod
     811    USE phys_output_var_mod
     812    USE phys_state_var_mod
     813
     814    IMPLICIT NONE
     815    ALLOCATE(t_seri(klon, klev), q_seri(klon, klev), ql_seri(klon, klev), qs_seri(klon, klev), qbs_seri(klon, klev))
     816    ALLOCATE(qx_seri(klon, klev, nqtot))
     817    ALLOCATE(u_seri(klon, klev), v_seri(klon, klev))
     818    ALLOCATE(l_mixmin(klon, klev + 1, nbsrf), l_mix(klon, klev + 1, nbsrf), wprime(klon, klev + 1, nbsrf))
     819    ALLOCATE(pbl_eps(klon, klev + 1, nbsrf + 1))
     820    ALLOCATE(tke_shear(klon, klev + 1, nbsrf), tke_buoy(klon, klev + 1, nbsrf), tke_trans(klon, klev + 1, nbsrf))
     821    pbl_eps(:, :, :) = 0.
     822    tke_shear(:, :, :) = 0.; tke_buoy(:, :, :) = 0.; tke_trans(:, :, :) = 0.
     823    l_mix(:, :, :) = 0.;l_mixmin(:, :, :) = 0.;wprime(:, :, :) = 0. ! doit etre initialse car pas toujours remplis
     824    ALLOCATE(rhcl(klon, klev))
     825    ALLOCATE(tr_seri(klon, klev, nbtr))
     826    ALLOCATE(d_t_dyn(klon, klev), d_q_dyn(klon, klev))
     827    ALLOCATE(d_ql_dyn(klon, klev), d_qs_dyn(klon, klev), d_qbs_dyn(klon, klev))
     828    ALLOCATE(d_q_dyn2d(klon), d_ql_dyn2d(klon), d_qs_dyn2d(klon), d_qbs_dyn2d(klon))
     829    ALLOCATE(d_u_dyn(klon, klev), d_v_dyn(klon, klev))
     830    ALLOCATE(d_tr_dyn(klon, klev, nbtr))                   !RomP
     831    ALLOCATE(d_t_con(klon, klev), d_q_con(klon, klev), d_q_con_zmasse(klon, klev))
     832    ALLOCATE(d_u_con(klon, klev), d_v_con(klon, klev))
     833    ALLOCATE(d_t_wake(klon, klev), d_q_wake(klon, klev))
     834    ALLOCATE(d_t_lsc(klon, klev), d_q_lsc(klon, klev))
     835    ALLOCATE(d_t_lwr(klon, klev), d_t_lw0(klon, klev))
     836    ALLOCATE(d_t_swr(klon, klev), d_t_sw0(klon, klev))
     837    ALLOCATE(d_ql_lsc(klon, klev), d_qi_lsc(klon, klev))
     838    ALLOCATE(d_t_ajsb(klon, klev), d_q_ajsb(klon, klev))
     839    ALLOCATE(d_t_ajs(klon, klev), d_q_ajs(klon, klev))
     840    !nrlmd<
     841    ALLOCATE(d_t_ajs_w(klon, klev), d_q_ajs_w(klon, klev))
     842    ALLOCATE(d_t_ajs_x(klon, klev), d_q_ajs_x(klon, klev))
     843    !>nrlmd
     844    ALLOCATE(d_u_ajs(klon, klev), d_v_ajs(klon, klev))
     845    ALLOCATE(d_t_eva(klon, klev), d_q_eva(klon, klev))
     846    ALLOCATE(d_qx_eva(klon, klev, nqtot))
     847    ALLOCATE(d_ql_eva(klon, klev), d_qi_eva(klon, klev))
     848    ALLOCATE(d_t_lscst(klon, klev), d_q_lscst(klon, klev))
     849    ALLOCATE(d_t_lscth(klon, klev), d_q_lscth(klon, klev))
     850    ALLOCATE(plul_st(klon), plul_th(klon))
     851    ALLOCATE(d_t_vdf(klon, klev), d_q_vdf(klon, klev), d_t_diss(klon, klev))
     852    ALLOCATE (d_qbs_vdf(klon, klev))
     853    ALLOCATE(d_t_bsss(klon, klev), d_q_bsss(klon, klev), d_qbs_bsss(klon, klev))
     854    ALLOCATE(d_t_vdf_w(klon, klev), d_q_vdf_w(klon, klev))
     855    ALLOCATE(d_t_vdf_x(klon, klev), d_q_vdf_x(klon, klev))
    855856#ifdef ISO
    856857      allocate(xt_seri(ntraciso,klon,klev))
     
    883884#endif
    884885
    885       ALLOCATE(d_u_vdf(klon,klev),d_v_vdf(klon,klev))
    886       ALLOCATE(d_t_oli(klon,klev),d_t_oro(klon,klev))
    887       ALLOCATE(d_u_oli(klon,klev),d_v_oli(klon,klev))
    888       ALLOCATE(d_u_oro(klon,klev),d_v_oro(klon,klev))
    889       ALLOCATE(d_u_oro_gw(klon,klev),d_v_oro_gw(klon,klev))
    890       ALLOCATE(d_t_oro_gw(klon,klev))
    891       ALLOCATE(d_t_lif(klon,klev),d_t_ec(klon,klev))
    892       ALLOCATE(d_u_lif(klon,klev),d_v_lif(klon,klev))
    893       ALLOCATE(d_ts(klon,nbsrf), d_tr(klon,klev,nbtr))
    894 
    895 ! aerosols
    896       ALLOCATE(m_allaer(klon,klev,naero_tot))
    897 ! Special RRTM
    898       ALLOCATE(ZLWFT0_i(klon,klev+1),ZSWFT0_i(klon,klev+1),ZFLDN0(klon,klev+1))
    899       ZFLDN0= 0.
    900       ALLOCATE(ZFLUP0(klon,klev+1),ZFSDN0(klon,klev+1),ZFSUP0(klon,klev+1))
    901 !
    902       ALLOCATE(topswad_aero(klon), solswad_aero(klon))
    903       ALLOCATE(topswai_aero(klon), solswai_aero(klon))
    904       ALLOCATE(topswad0_aero(klon), solswad0_aero(klon))
    905       ALLOCATE(toplwad_aero(klon), sollwad_aero(klon))
    906       ALLOCATE(toplwai_aero(klon), sollwai_aero(klon))
    907       ALLOCATE(toplwad0_aero(klon), sollwad0_aero(klon))
    908       ALLOCATE(topsw_aero(klon,naero_grp), solsw_aero(klon,naero_grp))
    909       ALLOCATE(topsw0_aero(klon,naero_grp), solsw0_aero(klon,naero_grp))
    910       ALLOCATE(topswcf_aero(klon,3), solswcf_aero(klon,3))
    911       ALLOCATE(du_gwd_hines(klon,klev),dv_gwd_hines(klon,klev))
    912       ALLOCATE(dv_gwd_rando(klon,klev),dv_gwd_front(klon,klev))
    913       ALLOCATE(east_gwstress(klon,klev),west_gwstress(klon,klev))
    914       east_gwstress(:,:)=0 !ym missing init
    915       west_gwstress(:,:)=0 !ym missing init
    916       ALLOCATE(d_t_hin(klon,klev))
    917       ALLOCATE(d_q_ch4(klon,klev))
    918       ALLOCATE(stratomask(klon,klev))
    919       ALLOCATE(tausum_aero(klon,nwave,naero_tot))
    920       ALLOCATE(drytausum_aero(klon,naero_tot))
    921       ALLOCATE(tau3d_aero(klon,klev,nwave,naero_tot))
    922       ALLOCATE(dNovrN(klon))
    923       ALLOCATE(zfice(klon, klev))
    924       ALLOCATE(od443aer(klon))
    925       ALLOCATE(od550aer(klon))
    926       ALLOCATE(od865aer(klon))
    927       ALLOCATE(dryod550aer(klon))
    928       dryod550aer(:) = 0.
    929       ALLOCATE(abs550aer(klon))
    930       abs550aer(:) = 0.
    931       ALLOCATE(ec550aer(klon,klev))
    932       ALLOCATE(od550lt1aer(klon))
    933       ALLOCATE(sconcso4(klon))
    934       ALLOCATE(sconcno3(klon))
    935       ALLOCATE(sconcoa(klon))
    936       ALLOCATE(sconcbc(klon))
    937       ALLOCATE(sconcss(klon))
    938       ALLOCATE(sconcdust(klon))
    939       ALLOCATE(concso4(klon,klev))
    940       ALLOCATE(concno3(klon,klev))
    941       ALLOCATE(concoa(klon,klev))
    942       ALLOCATE(concbc(klon,klev))
    943       ALLOCATE(concss(klon,klev))
    944       ALLOCATE(concdust(klon,klev))
    945       ALLOCATE(loadso4(klon))
    946       ALLOCATE(loadoa(klon))
    947       ALLOCATE(loadbc(klon))
    948       ALLOCATE(loadss(klon))
    949       ALLOCATE(loaddust(klon))
    950       ALLOCATE(loadno3(klon))
    951       ALLOCATE(load_tmp1(klon))
    952       ALLOCATE(load_tmp2(klon))
    953       ALLOCATE(load_tmp3(klon))
    954       ALLOCATE(load_tmp4(klon))
    955       ALLOCATE(load_tmp5(klon))
    956       ALLOCATE(load_tmp6(klon))
    957       ALLOCATE(load_tmp7(klon))
    958       ALLOCATE(load_tmp8(klon))
    959       ALLOCATE(load_tmp9(klon))
    960       ALLOCATE(load_tmp10(klon))
    961 
    962 !IM ajout variables CFMIP2/CMIP5
    963       ALLOCATE(topswad_aerop(klon), solswad_aerop(klon))
    964       ALLOCATE(topswai_aerop(klon), solswai_aerop(klon))
    965       ALLOCATE(topswad0_aerop(klon), solswad0_aerop(klon))
    966       ALLOCATE(topsw_aerop(klon,naero_grp), topsw0_aerop(klon,naero_grp))
    967       ALLOCATE(solsw_aerop(klon,naero_grp), solsw0_aerop(klon,naero_grp))
    968       ALLOCATE(topswcf_aerop(klon,naero_grp), solswcf_aerop(klon,naero_grp))
    969 
    970 ! additional LW variables CK
    971       ALLOCATE(toplwad_aerop(klon), sollwad_aerop(klon))
    972       ALLOCATE(toplwai_aerop(klon), sollwai_aerop(klon))
    973       ALLOCATE(toplwad0_aerop(klon), sollwad0_aerop(klon))
    974 
    975 !AI Ajout Ecrad (3Deffect)
    976       ALLOCATE(topswad_aero_s2(klon), solswad_aero_s2(klon))
    977       ALLOCATE(topswai_aero_s2(klon), solswai_aero_s2(klon))
    978       ALLOCATE(topswad0_aero_s2(klon), solswad0_aero_s2(klon))
    979       ALLOCATE(topsw_aero_s2(klon,naero_grp), topsw0_aero_s2(klon,naero_grp))
    980       ALLOCATE(solsw_aero_s2(klon,naero_grp), solsw0_aero_s2(klon,naero_grp))
    981       ALLOCATE(topswcf_aero_s2(klon,naero_grp), solswcf_aero_s2(klon,naero_grp))
    982 ! additional LW variables CK
    983       ALLOCATE(toplwad_aero_s2(klon), sollwad_aero_s2(klon))
    984       ALLOCATE(toplwai_aero_s2(klon), sollwai_aero_s2(klon))
    985       ALLOCATE(toplwad0_aero_s2(klon), sollwad0_aero_s2(klon))
    986 
    987 ! FH Ajout de celles necessaires au phys_output_write_mod
    988 
    989       ALLOCATE(tal1(klon), pal1(klon), pab1(klon), pab2(klon))
    990       ALLOCATE(ptstar(klon),pt0(klon),slp(klon))
    991 !!
    992 !!          Wake variables
    993       ALLOCATE(alp_wake(klon))
    994       ALLOCATE(wake_h(klon),wake_k(klon))
    995       ALLOCATE(wake_omg(klon, klev))
    996       ALLOCATE(d_deltat_wk(klon, klev), d_deltaq_wk(klon, klev))
    997       ALLOCATE(d_s_wk(klon), d_dens_a_wk(klon), d_dens_wk(klon))
    998       ALLOCATE(d_deltat_wk_gw(klon, klev), d_deltaq_wk_gw(klon, klev))
    999       ALLOCATE(d_deltat_vdf(klon, klev), d_deltaq_vdf(klon, klev))
    1000 !!      ALLOCATE( d_s_vdf(klon), d_dens_vdf(klon))
    1001       ALLOCATE(d_deltat_the(klon, klev), d_deltaq_the(klon, klev))
    1002 !!      ALLOCATE( d_s_the(klon), d_dens_the(klon))
    1003       ALLOCATE(d_deltat_ajs_cv(klon, klev), d_deltaq_ajs_cv(klon, klev))
     886    ALLOCATE(d_u_vdf(klon, klev), d_v_vdf(klon, klev))
     887    ALLOCATE(d_t_oli(klon, klev), d_t_oro(klon, klev))
     888    ALLOCATE(d_u_oli(klon, klev), d_v_oli(klon, klev))
     889    ALLOCATE(d_u_oro(klon, klev), d_v_oro(klon, klev))
     890    ALLOCATE(d_u_oro_gw(klon, klev), d_v_oro_gw(klon, klev))
     891    ALLOCATE(d_t_oro_gw(klon, klev))
     892    ALLOCATE(d_t_lif(klon, klev), d_t_ec(klon, klev))
     893    ALLOCATE(d_u_lif(klon, klev), d_v_lif(klon, klev))
     894    ALLOCATE(d_ts(klon, nbsrf), d_tr(klon, klev, nbtr))
     895
     896    ! aerosols
     897    ALLOCATE(m_allaer(klon, klev, naero_tot))
     898    ! Special RRTM
     899    ALLOCATE(ZLWFT0_i(klon, klev + 1), ZSWFT0_i(klon, klev + 1), ZFLDN0(klon, klev + 1))
     900    ZFLDN0 = 0.
     901    ALLOCATE(ZFLUP0(klon, klev + 1), ZFSDN0(klon, klev + 1), ZFSUP0(klon, klev + 1))
     902    !
     903    ALLOCATE(topswad_aero(klon), solswad_aero(klon))
     904    ALLOCATE(topswai_aero(klon), solswai_aero(klon))
     905    ALLOCATE(topswad0_aero(klon), solswad0_aero(klon))
     906    ALLOCATE(toplwad_aero(klon), sollwad_aero(klon))
     907    ALLOCATE(toplwai_aero(klon), sollwai_aero(klon))
     908    ALLOCATE(toplwad0_aero(klon), sollwad0_aero(klon))
     909    ALLOCATE(topsw_aero(klon, naero_grp), solsw_aero(klon, naero_grp))
     910    ALLOCATE(topsw0_aero(klon, naero_grp), solsw0_aero(klon, naero_grp))
     911    ALLOCATE(topswcf_aero(klon, 3), solswcf_aero(klon, 3))
     912    ALLOCATE(du_gwd_hines(klon, klev), dv_gwd_hines(klon, klev))
     913    ALLOCATE(dv_gwd_rando(klon, klev), dv_gwd_front(klon, klev))
     914    ALLOCATE(east_gwstress(klon, klev), west_gwstress(klon, klev))
     915    east_gwstress(:, :) = 0 !ym missing init
     916    west_gwstress(:, :) = 0 !ym missing init
     917    ALLOCATE(d_t_hin(klon, klev))
     918    ALLOCATE(d_q_ch4(klon, klev))
     919    ALLOCATE(stratomask(klon, klev))
     920    ALLOCATE(tausum_aero(klon, nwave, naero_tot))
     921    ALLOCATE(drytausum_aero(klon, naero_tot))
     922    ALLOCATE(tau3d_aero(klon, klev, nwave, naero_tot))
     923    ALLOCATE(dNovrN(klon))
     924    ALLOCATE(zfice(klon, klev))
     925    ALLOCATE(od443aer(klon))
     926    ALLOCATE(od550aer(klon))
     927    ALLOCATE(od865aer(klon))
     928    ALLOCATE(dryod550aer(klon))
     929    dryod550aer(:) = 0.
     930    ALLOCATE(abs550aer(klon))
     931    abs550aer(:) = 0.
     932    ALLOCATE(ec550aer(klon, klev))
     933    ALLOCATE(od550lt1aer(klon))
     934    ALLOCATE(sconcso4(klon))
     935    ALLOCATE(sconcno3(klon))
     936    ALLOCATE(sconcoa(klon))
     937    ALLOCATE(sconcbc(klon))
     938    ALLOCATE(sconcss(klon))
     939    ALLOCATE(sconcdust(klon))
     940    ALLOCATE(concso4(klon, klev))
     941    ALLOCATE(concno3(klon, klev))
     942    ALLOCATE(concoa(klon, klev))
     943    ALLOCATE(concbc(klon, klev))
     944    ALLOCATE(concss(klon, klev))
     945    ALLOCATE(concdust(klon, klev))
     946    ALLOCATE(loadso4(klon))
     947    ALLOCATE(loadoa(klon))
     948    ALLOCATE(loadbc(klon))
     949    ALLOCATE(loadss(klon))
     950    ALLOCATE(loaddust(klon))
     951    ALLOCATE(loadno3(klon))
     952    ALLOCATE(load_tmp1(klon))
     953    ALLOCATE(load_tmp2(klon))
     954    ALLOCATE(load_tmp3(klon))
     955    ALLOCATE(load_tmp4(klon))
     956    ALLOCATE(load_tmp5(klon))
     957    ALLOCATE(load_tmp6(klon))
     958    ALLOCATE(load_tmp7(klon))
     959    ALLOCATE(load_tmp8(klon))
     960    ALLOCATE(load_tmp9(klon))
     961    ALLOCATE(load_tmp10(klon))
     962
     963    !IM ajout variables CFMIP2/CMIP5
     964    ALLOCATE(topswad_aerop(klon), solswad_aerop(klon))
     965    ALLOCATE(topswai_aerop(klon), solswai_aerop(klon))
     966    ALLOCATE(topswad0_aerop(klon), solswad0_aerop(klon))
     967    ALLOCATE(topsw_aerop(klon, naero_grp), topsw0_aerop(klon, naero_grp))
     968    ALLOCATE(solsw_aerop(klon, naero_grp), solsw0_aerop(klon, naero_grp))
     969    ALLOCATE(topswcf_aerop(klon, naero_grp), solswcf_aerop(klon, naero_grp))
     970
     971    ! additional LW variables CK
     972    ALLOCATE(toplwad_aerop(klon), sollwad_aerop(klon))
     973    ALLOCATE(toplwai_aerop(klon), sollwai_aerop(klon))
     974    ALLOCATE(toplwad0_aerop(klon), sollwad0_aerop(klon))
     975
     976    !AI Ajout Ecrad (3Deffect)
     977    ALLOCATE(topswad_aero_s2(klon), solswad_aero_s2(klon))
     978    ALLOCATE(topswai_aero_s2(klon), solswai_aero_s2(klon))
     979    ALLOCATE(topswad0_aero_s2(klon), solswad0_aero_s2(klon))
     980    ALLOCATE(topsw_aero_s2(klon, naero_grp), topsw0_aero_s2(klon, naero_grp))
     981    ALLOCATE(solsw_aero_s2(klon, naero_grp), solsw0_aero_s2(klon, naero_grp))
     982    ALLOCATE(topswcf_aero_s2(klon, naero_grp), solswcf_aero_s2(klon, naero_grp))
     983    ! additional LW variables CK
     984    ALLOCATE(toplwad_aero_s2(klon), sollwad_aero_s2(klon))
     985    ALLOCATE(toplwai_aero_s2(klon), sollwai_aero_s2(klon))
     986    ALLOCATE(toplwad0_aero_s2(klon), sollwad0_aero_s2(klon))
     987
     988    ! FH Ajout de celles necessaires au phys_output_write_mod
     989
     990    ALLOCATE(tal1(klon), pal1(klon), pab1(klon), pab2(klon))
     991    ALLOCATE(ptstar(klon), pt0(klon), slp(klon))
     992    !!
     993    !!          Wake variables
     994    ALLOCATE(alp_wake(klon))
     995    ALLOCATE(wake_h(klon), wake_k(klon))
     996    ALLOCATE(wake_omg(klon, klev))
     997    ALLOCATE(d_deltat_wk(klon, klev), d_deltaq_wk(klon, klev))
     998    ALLOCATE(d_s_wk(klon), d_dens_a_wk(klon), d_dens_wk(klon))
     999    ALLOCATE(d_deltat_wk_gw(klon, klev), d_deltaq_wk_gw(klon, klev))
     1000    ALLOCATE(d_deltat_vdf(klon, klev), d_deltaq_vdf(klon, klev))
     1001    !!      ALLOCATE( d_s_vdf(klon), d_dens_vdf(klon))
     1002    ALLOCATE(d_deltat_the(klon, klev), d_deltaq_the(klon, klev))
     1003    !!      ALLOCATE( d_s_the(klon), d_dens_the(klon))
     1004    ALLOCATE(d_deltat_ajs_cv(klon, klev), d_deltaq_ajs_cv(klon, klev))
    10041005#ifdef ISO
    10051006      ALLOCATE(d_deltaxt_wk(ntraciso,klon, klev))
     
    10091010      ALLOCATE(d_deltaxt_ajs_cv(ntraciso,klon, klev))
    10101011#endif
    1011 !!         End of wake variables
    1012 !!
    1013       ALLOCATE(bils(klon))
    1014       ALLOCATE(cdragm(klon), cdragh(klon), cldh(klon), cldl(klon))
    1015       ALLOCATE(cldm(klon), cldq(klon), cldt(klon), qsat2m(klon))
    1016       ALLOCATE(JrNt(klon))
    1017       ALLOCATE(dthmin(klon), evap(klon), snowerosion(klon), fder(klon), plcl(klon), plfc(klon))
    1018       ALLOCATE(prw(klon), prlw(klon), prsw(klon), prbsw(klon), water_budget(klon), zustar(klon), zu10m(klon), zv10m(klon), rh2m(klon))
    1019       ALLOCATE(s_lcl(klon))
    1020       ALLOCATE(s_pblh(klon), s_pblt(klon), s_therm(klon))
    1021 !
    1022 !nrlmd+jyg<
    1023       ALLOCATE(s_pblh_x(klon), s_pblh_w(klon))
    1024       ALLOCATE(s_lcl_x(klon), s_lcl_w(klon))
    1025 !>nrlmd+jyg
    1026 !
    1027       ALLOCATE(slab_wfbils(klon), tpot(klon), tpote(klon), ue(klon))
    1028       ALLOCATE(uq(klon), ve(klon), vq(klon), zxffonte(klon))
    1029       ALLOCATE(uwat(klon), vwat(klon))
    1030       ALLOCATE(zxfqcalving(klon), zxfluxlat(klon))
    1031       ALLOCATE(zxtsol(klon), snow_lsc(klon), zxfqfonte(klon), zxqsurf(klon))
    1032       ALLOCATE(zxrunofflic(klon))
    1033       ALLOCATE(zxustartlic(klon), zxrhoslic(klon), zxqsaltlic(klon))
    1034       zxustartlic(:)=0. ; zxrhoslic(:)=0. ; zxqsaltlic(:)=0.
    1035       ALLOCATE(rain_lsc(klon))
    1036       ALLOCATE(rain_num(klon))
    1037       ALLOCATE(qlth(klon,klev), qith(klon,klev), qsith(klon,klev), wiceth(klon,klev))
    1038       !
     1012    !!         End of wake variables
     1013    !!
     1014    ALLOCATE(bils(klon))
     1015    ALLOCATE(cdragm(klon), cdragh(klon), cldh(klon), cldl(klon))
     1016    ALLOCATE(cldm(klon), cldq(klon), cldt(klon), qsat2m(klon))
     1017    ALLOCATE(JrNt(klon))
     1018    ALLOCATE(dthmin(klon), evap(klon), snowerosion(klon), fder(klon), plcl(klon), plfc(klon))
     1019    ALLOCATE(prw(klon), prlw(klon), prsw(klon), prbsw(klon), water_budget(klon), zustar(klon), zu10m(klon), zv10m(klon), rh2m(klon))
     1020    ALLOCATE(s_lcl(klon))
     1021    ALLOCATE(s_pblh(klon), s_pblt(klon), s_therm(klon))
     1022    !
     1023    !nrlmd+jyg<
     1024    ALLOCATE(s_pblh_x(klon), s_pblh_w(klon))
     1025    ALLOCATE(s_lcl_x(klon), s_lcl_w(klon))
     1026    !>nrlmd+jyg
     1027    !
     1028    ALLOCATE(slab_wfbils(klon), tpot(klon), tpote(klon), ue(klon))
     1029    ALLOCATE(uq(klon), ve(klon), vq(klon), zxffonte(klon))
     1030    ALLOCATE(uwat(klon), vwat(klon))
     1031    ALLOCATE(zxfqcalving(klon), zxfluxlat(klon))
     1032    ALLOCATE(zxtsol(klon), snow_lsc(klon), zxfqfonte(klon), zxqsurf(klon))
     1033    ALLOCATE(zxrunofflic(klon))
     1034    ALLOCATE(zxustartlic(klon), zxrhoslic(klon), zxqsaltlic(klon))
     1035    zxustartlic(:) = 0. ; zxrhoslic(:) = 0. ; zxqsaltlic(:) = 0.
     1036    ALLOCATE(rain_lsc(klon))
     1037    ALLOCATE(rain_num(klon))
     1038    ALLOCATE(qlth(klon, klev), qith(klon, klev), qsith(klon, klev), wiceth(klon, klev))
     1039    !
    10391040#ifdef ISO
    10401041      ALLOCATE(xtevap(ntraciso,klon))
     
    10491050      runoff_diag(:)=0. ; xtrunoff_diag(:,:)=0. ! because variables are only given values on knon grid points
    10501051#endif
    1051 !
    1052       ALLOCATE(sens_x(klon), sens_w(klon))
    1053       ALLOCATE(zxfluxlat_x(klon), zxfluxlat_w(klon))
    1054       ALLOCATE(delta_qsurf(klon))
    1055 !jyg<
    1056 !!      ALLOCATE(t_x(klon,klev), t_w(klon,klev))
    1057 !!      ALLOCATE(q_x(klon,klev), q_w(klon,klev))
    1058 !>jyg
    1059       ALLOCATE(dtvdf_x(klon,klev), dtvdf_w(klon,klev))
    1060       dtvdf_x = 0 ; dtvdf_w=0 ;   !ym missing init
    1061       ALLOCATE(dqvdf_x(klon,klev), dqvdf_w(klon,klev))
    1062       dqvdf_x = 0 ; dqvdf_w=0 ;   !ym missing init
    1063       ALLOCATE(pbl_tke_input(klon,klev+1,nbsrf))
    1064       ALLOCATE(t_therm(klon,klev), q_therm(klon,klev),u_therm(klon,klev), v_therm(klon,klev))
    1065       ALLOCATE(cdragh_x(klon), cdragh_w(klon))
    1066       ALLOCATE(cdragm_x(klon), cdragm_w(klon))
    1067       ALLOCATE(kh(klon), kh_x(klon), kh_w(klon))
     1052    !
     1053    ALLOCATE(sens_x(klon), sens_w(klon))
     1054    ALLOCATE(zxfluxlat_x(klon), zxfluxlat_w(klon))
     1055    ALLOCATE(delta_qsurf(klon))
     1056    !jyg<
     1057    !!      ALLOCATE(t_x(klon,klev), t_w(klon,klev))
     1058    !!      ALLOCATE(q_x(klon,klev), q_w(klon,klev))
     1059    !>jyg
     1060    ALLOCATE(dtvdf_x(klon, klev), dtvdf_w(klon, klev))
     1061    dtvdf_x = 0 ; dtvdf_w = 0 ;
     1062    !ym missing init
     1063    ALLOCATE(dqvdf_x(klon, klev), dqvdf_w(klon, klev))
     1064    dqvdf_x = 0 ; dqvdf_w = 0 ;
     1065    !ym missing init
     1066    ALLOCATE(pbl_tke_input(klon, klev + 1, nbsrf))
     1067    ALLOCATE(t_therm(klon, klev), q_therm(klon, klev), u_therm(klon, klev), v_therm(klon, klev))
     1068    ALLOCATE(cdragh_x(klon), cdragh_w(klon))
     1069    ALLOCATE(cdragm_x(klon), cdragm_w(klon))
     1070    ALLOCATE(kh(klon), kh_x(klon), kh_w(klon))
    10681071#ifdef ISO
    10691072      ALLOCATE(dxtvdf_x(ntraciso,klon,klev), dxtvdf_w(ntraciso,klon,klev))
    10701073      ALLOCATE(xt_therm(ntraciso,klon,klev))
    10711074#endif
    1072 !
    1073       ALLOCATE(ptconv(klon,klev))
    1074       ALLOCATE(ratqsc(klon,klev))
    1075 !
    1076       ALLOCATE(wbeff(klon), convoccur(klon), zmax_th(klon))
    1077       ALLOCATE(zq2m(klon), zt2m(klon), weak_inversion(klon))
    1078       ALLOCATE(zt2m_min_mon(klon), zt2m_max_mon(klon))
    1079       ALLOCATE(t2m_min_mon(klon), t2m_max_mon(klon))
    1080       ALLOCATE(sens(klon), flwp(klon), fiwp(klon))
    1081       ALLOCATE(alp_bl_conv(klon), alp_bl_det(klon))
    1082       alp_bl_conv(:)=0 ;  alp_bl_det(:)=0
    1083       ALLOCATE(alp_bl_fluct_m(klon), alp_bl_fluct_tke(klon))
    1084       alp_bl_fluct_m(:)=0 ; alp_bl_fluct_tke(:)= 0.
    1085       ALLOCATE(alp_bl_stat(klon), n2(klon), s2(klon), strig(klon), zcong(klon), zlcl_th(klon))
    1086       alp_bl_stat(:)=0
    1087       ALLOCATE(proba_notrig(klon), random_notrig(klon))
    1088 
    1089       ALLOCATE(dnwd0(klon, klev))
    1090 !      ALLOCATE(upwd(klon, klev), omega(klon, klev), coefh(klon, klev))
    1091       ALLOCATE(omega(klon, klev))
    1092       ALLOCATE(epmax_diag(klon)) ! epmax_cape
    1093 !      ALLOCATE(coefm(klon, klev), lambda_th(klon, klev), cldemi(klon, klev))
    1094       ALLOCATE(lambda_th(klon, klev), cldemi(klon, klev))
    1095       ALLOCATE(cldfra(klon, klev), cldtau(klon, klev), fiwc(klon, klev))
    1096       ALLOCATE(fl(klon, klev), re(klon, klev), flwc(klon, klev))
    1097       ALLOCATE(ref_liq(klon, klev), ref_ice(klon, klev), theta(klon, klev))
    1098       ALLOCATE(ref_liq_pi(klon, klev), ref_ice_pi(klon, klev))
    1099       ALLOCATE(zphi(klon, klev), zx_rh(klon, klev), zx_rhl(klon,klev), zx_rhi(klon,klev))
    1100       zx_rhl(:,:)=0.; zx_rhi(:,:)=0. ! because not always defined
    1101       ALLOCATE(pmfd(klon, klev), pmfu(klon, klev))
    1102 
    1103       ALLOCATE(t2m(klon, nbsrf), fluxlat(klon, nbsrf))
    1104       ALLOCATE(fsollw(klon, nbsrf))
    1105       ALLOCATE(fsolsw(klon, nbsrf), wfbils(klon, nbsrf))
    1106       ALLOCATE(wfevap(klon, nbsrf))
    1107       ALLOCATE(evap_pot(klon, nbsrf))
    1108 ! FC
    1109       ALLOCATE(zxfluxq(klon,klev),zxfluxt(klon,klev))
    1110 !
    1111 !
    1112 !  Deep convective variables used in phytrac
    1113       ALLOCATE(pmflxr(klon, klev+1), pmflxs(klon, klev+1))
    1114       ALLOCATE(wdtrainA(klon,klev),wdtrainS(klon,klev),wdtrainM(klon,klev))
    1115       ALLOCATE(dnwd(klon, klev), upwd(klon, klev))
    1116       ALLOCATE(ep(klon,klev))                          ! epmax_cape
    1117       ALLOCATE(da(klon,klev), mp(klon,klev))
    1118       ALLOCATE(phi(klon,klev,klev))
    1119       ALLOCATE(wght_cvfd(klon,klev))
    1120       ALLOCATE(phi2(klon,klev,klev))
    1121       ALLOCATE(d1a(klon,klev), dam(klon,klev))
    1122       ALLOCATE(ev(klon,klev))
    1123       ALLOCATE(elij(klon,klev,klev))
    1124       ALLOCATE(qtaa(klon,klev))
    1125       ALLOCATE(clw(klon,klev))
    1126       ALLOCATE(epmlmMm(klon,klev,klev), eplaMm(klon,klev))
    1127       ALLOCATE(sij(klon,klev,klev))
     1075    !
     1076    ALLOCATE(ptconv(klon, klev))
     1077    ALLOCATE(ratqsc(klon, klev))
     1078    !
     1079    ALLOCATE(wbeff(klon), convoccur(klon), zmax_th(klon))
     1080    ALLOCATE(zq2m(klon), zt2m(klon), weak_inversion(klon))
     1081    ALLOCATE(zt2m_min_mon(klon), zt2m_max_mon(klon))
     1082    ALLOCATE(t2m_min_mon(klon), t2m_max_mon(klon))
     1083    ALLOCATE(sens(klon), flwp(klon), fiwp(klon))
     1084    ALLOCATE(alp_bl_conv(klon), alp_bl_det(klon))
     1085    alp_bl_conv(:) = 0 ;  alp_bl_det(:) = 0
     1086    ALLOCATE(alp_bl_fluct_m(klon), alp_bl_fluct_tke(klon))
     1087    alp_bl_fluct_m(:) = 0 ; alp_bl_fluct_tke(:) = 0.
     1088    ALLOCATE(alp_bl_stat(klon), n2(klon), s2(klon), strig(klon), zcong(klon), zlcl_th(klon))
     1089    alp_bl_stat(:) = 0
     1090    ALLOCATE(proba_notrig(klon), random_notrig(klon))
     1091
     1092    ALLOCATE(dnwd0(klon, klev))
     1093    !      ALLOCATE(upwd(klon, klev), omega(klon, klev), coefh(klon, klev))
     1094    ALLOCATE(omega(klon, klev))
     1095    ALLOCATE(epmax_diag(klon)) ! epmax_cape
     1096    !      ALLOCATE(coefm(klon, klev), lambda_th(klon, klev), cldemi(klon, klev))
     1097    ALLOCATE(lambda_th(klon, klev), cldemi(klon, klev))
     1098    ALLOCATE(cldfra(klon, klev), cldtau(klon, klev), fiwc(klon, klev))
     1099    ALLOCATE(fl(klon, klev), re(klon, klev), flwc(klon, klev))
     1100    ALLOCATE(ref_liq(klon, klev), ref_ice(klon, klev), theta(klon, klev))
     1101    ALLOCATE(ref_liq_pi(klon, klev), ref_ice_pi(klon, klev))
     1102    ALLOCATE(zphi(klon, klev), zx_rh(klon, klev), zx_rhl(klon, klev), zx_rhi(klon, klev))
     1103    zx_rhl(:, :) = 0.; zx_rhi(:, :) = 0. ! because not always defined
     1104    ALLOCATE(pmfd(klon, klev), pmfu(klon, klev))
     1105
     1106    ALLOCATE(t2m(klon, nbsrf), fluxlat(klon, nbsrf))
     1107    ALLOCATE(fsollw(klon, nbsrf))
     1108    ALLOCATE(fsolsw(klon, nbsrf), wfbils(klon, nbsrf))
     1109    ALLOCATE(wfevap(klon, nbsrf))
     1110    ALLOCATE(evap_pot(klon, nbsrf))
     1111    ! FC
     1112    ALLOCATE(zxfluxq(klon, klev), zxfluxt(klon, klev))
     1113    !
     1114    !
     1115    !  Deep convective variables used in phytrac
     1116    ALLOCATE(pmflxr(klon, klev + 1), pmflxs(klon, klev + 1))
     1117    ALLOCATE(wdtrainA(klon, klev), wdtrainS(klon, klev), wdtrainM(klon, klev))
     1118    ALLOCATE(dnwd(klon, klev), upwd(klon, klev))
     1119    ALLOCATE(ep(klon, klev))                          ! epmax_cape
     1120    ALLOCATE(da(klon, klev), mp(klon, klev))
     1121    ALLOCATE(phi(klon, klev, klev))
     1122    ALLOCATE(wght_cvfd(klon, klev))
     1123    ALLOCATE(phi2(klon, klev, klev))
     1124    ALLOCATE(d1a(klon, klev), dam(klon, klev))
     1125    ALLOCATE(ev(klon, klev))
     1126    ALLOCATE(elij(klon, klev, klev))
     1127    ALLOCATE(qtaa(klon, klev))
     1128    ALLOCATE(clw(klon, klev))
     1129    ALLOCATE(epmlmMm(klon, klev, klev), eplaMm(klon, klev))
     1130    ALLOCATE(sij(klon, klev, klev))
    11281131#ifdef ISO
    11291132      ALLOCATE(xtwdtrainA(ntraciso,klon,klev))
     
    11501153#endif
    11511154
    1152       ALLOCATE(prfl(klon, klev+1))
    1153       ALLOCATE(psfl(klon, klev+1), fraca(klon, klev+1), Vprecip(klon, klev+1))
    1154       ALLOCATE(bsfl(klon,klev+1))
    1155       ALLOCATE(zw2(klon, klev+1))
    1156 
    1157       ALLOCATE(fluxu(klon, klev, nbsrf), fluxv(klon, klev, nbsrf))
    1158       ALLOCATE(fluxt(klon, klev, nbsrf))
    1159 
    1160       ALLOCATE(uwriteSTD(klon,nlevSTD,nfiles), vwriteSTD(klon,nlevSTD,nfiles))
    1161       ALLOCATE(wwriteSTD(klon,nlevSTD,nfiles), phiwriteSTD(klon,nlevSTD,nfiles))
    1162       ALLOCATE(qwriteSTD(klon,nlevSTD,nfiles), twriteSTD(klon,nlevSTD,nfiles))
    1163       ALLOCATE(rhwriteSTD(klon,nlevSTD,nfiles))
    1164 
    1165 ! ug et d'autres encore:
    1166       ALLOCATE(beta_prec(klon,klev))
    1167       ALLOCATE(rneb(klon,klev),rnebjn(klon,klev),rneblsvol(klon,klev))
    1168       ALLOCATE(pfraclr(klon,klev),pfracld(klon,klev))
    1169       pfraclr(:,:)=0. ; pfracld(:,:)=0. ! because not always defined
    1170       ALLOCATE(cldfraliq(klon,klev))
    1171       ALLOCATE(sigma2_icefracturb(klon,klev))
    1172       ALLOCATE(mean_icefracturb(klon,klev))
    1173       ALLOCATE(distcltop(klon,klev))
    1174       ALLOCATE(temp_cltop(klon,klev))
    1175 
    1176       ALLOCATE (zxsnow(klon),snowhgt(klon),qsnow(klon),to_ice(klon))
    1177       ALLOCATE (sissnow(klon),runoff(klon),albsol3_lic(klon))
     1155    ALLOCATE(prfl(klon, klev + 1))
     1156    ALLOCATE(psfl(klon, klev + 1), fraca(klon, klev + 1), Vprecip(klon, klev + 1))
     1157    ALLOCATE(bsfl(klon, klev + 1))
     1158    ALLOCATE(zw2(klon, klev + 1))
     1159
     1160    ALLOCATE(fluxu(klon, klev, nbsrf), fluxv(klon, klev, nbsrf))
     1161    ALLOCATE(fluxt(klon, klev, nbsrf))
     1162
     1163    ALLOCATE(uwriteSTD(klon, nlevSTD, nfiles), vwriteSTD(klon, nlevSTD, nfiles))
     1164    ALLOCATE(wwriteSTD(klon, nlevSTD, nfiles), phiwriteSTD(klon, nlevSTD, nfiles))
     1165    ALLOCATE(qwriteSTD(klon, nlevSTD, nfiles), twriteSTD(klon, nlevSTD, nfiles))
     1166    ALLOCATE(rhwriteSTD(klon, nlevSTD, nfiles))
     1167
     1168    ! ug et d'autres encore:
     1169    ALLOCATE(beta_prec(klon, klev))
     1170    ALLOCATE(rneb(klon, klev), rnebjn(klon, klev), rneblsvol(klon, klev))
     1171    ALLOCATE(pfraclr(klon, klev), pfracld(klon, klev))
     1172    pfraclr(:, :) = 0. ; pfracld(:, :) = 0. ! because not always defined
     1173    ALLOCATE(cldfraliq(klon, klev))
     1174    ALLOCATE(sigma2_icefracturb(klon, klev))
     1175    ALLOCATE(mean_icefracturb(klon, klev))
     1176    ALLOCATE(distcltop(klon, klev))
     1177    ALLOCATE(temp_cltop(klon, klev))
     1178
     1179    ALLOCATE (zxsnow(klon), snowhgt(klon), qsnow(klon), to_ice(klon))
     1180    ALLOCATE (sissnow(klon), runoff(klon), albsol3_lic(klon))
    11781181#ifdef ISO
    11791182      ALLOCATE (zxxtsnow(niso,klon))
     
    11821185#endif
    11831186
    1184       ALLOCATE (p_tropopause(klon))
    1185       ALLOCATE (z_tropopause(klon))
    1186       ALLOCATE (t_tropopause(klon))
    1187 
    1188       ALLOCATE(zn2mout(klon,6))
    1189 
    1190 ! Supersaturation
    1191       ALLOCATE(rneb_seri(klon,klev))
    1192       ALLOCATE(d_rneb_dyn(klon,klev))
    1193       ALLOCATE(qclr(klon,klev), qcld(klon,klev), qss(klon,klev), qvc(klon,klev))
    1194       ALLOCATE(rnebclr(klon,klev), rnebss(klon,klev), gamma_ss(klon,klev))
    1195       ALLOCATE(N1_ss(klon,klev), N2_ss(klon,klev))
    1196       ALLOCATE(drneb_sub(klon,klev), drneb_con(klon,klev), drneb_tur(klon,klev), drneb_avi(klon,klev))
    1197       ALLOCATE(zqsatl(klon,klev), zqsats(klon,klev))
    1198       ALLOCATE(Tcontr(klon,klev), qcontr(klon,klev), qcontr2(klon,klev), fcontrN(klon,klev), fcontrP(klon,klev))
    1199 
    1200 !--POPRECIP variables
    1201       ALLOCATE(qraindiag(klon,klev), qsnowdiag(klon,klev))
    1202       ALLOCATE(dqreva(klon,klev), dqssub(klon,klev))
    1203       ALLOCATE(dqrauto(klon,klev), dqrcol(klon,klev), dqrmelt(klon,klev), dqrfreez(klon,klev))
    1204       ALLOCATE(dqsauto(klon,klev), dqsagg(klon,klev), dqsrim(klon,klev), dqsmelt(klon,klev), dqsfreez(klon,klev))
    1205 
    1206 #ifdef CPP_StratAer
    1207       ALLOCATE (d_q_emiss(klon,klev))
    1208       ALLOCATE (R2SO4(klon,klev))
    1209       ALLOCATE (DENSO4(klon,klev))
    1210       ALLOCATE (f_r_wet(klon,klev))
    1211       ALLOCATE (decfluxaer(klon,nbtr))
     1187    ALLOCATE (p_tropopause(klon))
     1188    ALLOCATE (z_tropopause(klon))
     1189    ALLOCATE (t_tropopause(klon))
     1190
     1191    ALLOCATE(zn2mout(klon, 6))
     1192
     1193    ! Supersaturation
     1194    ALLOCATE(rneb_seri(klon, klev))
     1195    ALLOCATE(d_rneb_dyn(klon, klev))
     1196    ALLOCATE(qclr(klon, klev), qcld(klon, klev), qss(klon, klev), qvc(klon, klev))
     1197    ALLOCATE(rnebclr(klon, klev), rnebss(klon, klev), gamma_ss(klon, klev))
     1198    ALLOCATE(N1_ss(klon, klev), N2_ss(klon, klev))
     1199    ALLOCATE(drneb_sub(klon, klev), drneb_con(klon, klev), drneb_tur(klon, klev), drneb_avi(klon, klev))
     1200    ALLOCATE(zqsatl(klon, klev), zqsats(klon, klev))
     1201    ALLOCATE(Tcontr(klon, klev), qcontr(klon, klev), qcontr2(klon, klev), fcontrN(klon, klev), fcontrP(klon, klev))
     1202
     1203    !--POPRECIP variables
     1204    ALLOCATE(qraindiag(klon, klev), qsnowdiag(klon, klev))
     1205    ALLOCATE(dqreva(klon, klev), dqssub(klon, klev))
     1206    ALLOCATE(dqrauto(klon, klev), dqrcol(klon, klev), dqrmelt(klon, klev), dqrfreez(klon, klev))
     1207    ALLOCATE(dqsauto(klon, klev), dqsagg(klon, klev), dqsrim(klon, klev), dqsmelt(klon, klev), dqsfreez(klon, klev))
     1208
     1209    IF (CPPKEY_STRATAER) THEN
     1210      ALLOCATE (d_q_emiss(klon, klev))
     1211      ALLOCATE (R2SO4(klon, klev))
     1212      ALLOCATE (DENSO4(klon, klev))
     1213      ALLOCATE (f_r_wet(klon, klev))
     1214      ALLOCATE (decfluxaer(klon, nbtr))
    12121215      ALLOCATE (mdw(nbtr))
    1213       ALLOCATE (budg_3D_nucl(klon,klev))
    1214       ALLOCATE (budg_3D_cond_evap(klon,klev))
    1215       ALLOCATE (budg_3D_ocs_to_so2(klon,klev))
    1216       ALLOCATE (budg_3D_so2_to_h2so4(klon,klev))
    1217       ALLOCATE (budg_3D_backgr_ocs(klon,klev))
    1218       ALLOCATE (budg_3D_backgr_so2(klon,klev))
    1219       ALLOCATE (OCS_lifetime(klon,klev))
    1220       ALLOCATE (SO2_lifetime(klon,klev))
    1221       ALLOCATE (H2SO4_lifetime(klon,klev))
    1222       ALLOCATE (O3_clim(klon,klev))
    1223       ALLOCATE (alpha_bin(nbands_sw_rrtm+nbands_lw_rrtm+nwave,nbtr))
    1224       ALLOCATE (piz_bin(nbands_sw_rrtm+nbands_lw_rrtm+nwave,nbtr))
    1225       ALLOCATE (cg_bin(nbands_sw_rrtm+nbands_lw_rrtm+nwave,nbtr))
    1226       ALLOCATE (tau_strat_550(klon,klev))
    1227       ALLOCATE (tau_strat_1020(klon,klev))
    1228       ALLOCATE (tausum_strat(klon,3))
     1216      ALLOCATE (budg_3D_nucl(klon, klev))
     1217      ALLOCATE (budg_3D_cond_evap(klon, klev))
     1218      ALLOCATE (budg_3D_ocs_to_so2(klon, klev))
     1219      ALLOCATE (budg_3D_so2_to_h2so4(klon, klev))
     1220      ALLOCATE (budg_3D_backgr_ocs(klon, klev))
     1221      ALLOCATE (budg_3D_backgr_so2(klon, klev))
     1222      ALLOCATE (OCS_lifetime(klon, klev))
     1223      ALLOCATE (SO2_lifetime(klon, klev))
     1224      ALLOCATE (H2SO4_lifetime(klon, klev))
     1225      ALLOCATE (O3_clim(klon, klev))
     1226      ALLOCATE (alpha_bin(nbands_sw_rrtm + nbands_lw_rrtm + nwave, nbtr))
     1227      ALLOCATE (piz_bin(nbands_sw_rrtm + nbands_lw_rrtm + nwave, nbtr))
     1228      ALLOCATE (cg_bin(nbands_sw_rrtm + nbands_lw_rrtm + nwave, nbtr))
     1229      ALLOCATE (tau_strat_550(klon, klev))
     1230      ALLOCATE (tau_strat_1020(klon, klev))
     1231      ALLOCATE (tausum_strat(klon, 3))
    12291232      ALLOCATE (budg_dep_dry_ocs(klon))
    12301233      ALLOCATE (budg_dep_wet_ocs(klon))
     
    12441247      ALLOCATE (budg_sed_part(klon))
    12451248      ALLOCATE (surf_PM25_sulf(klon))
    1246       ALLOCATE (vsed_aer(klon,klev))
    1247 #endif
    1248 
    1249 END SUBROUTINE phys_local_var_init
    1250 
    1251 !======================================================================
    1252 SUBROUTINE phys_local_var_end
    1253 USE dimphy
    1254 USE indice_sol_mod
    1255 IMPLICIT NONE
    1256       DEALLOCATE(t_seri,q_seri,ql_seri,qs_seri, qbs_seri,qx_seri)
    1257       DEALLOCATE(u_seri,v_seri)
    1258       DEALLOCATE(l_mixmin,l_mix,wprime)
    1259       DEALLOCATE(tke_shear,tke_buoy,tke_trans)
    1260       DEALLOCATE(pbl_eps)
    1261       DEALLOCATE(rhcl)
    1262       DEALLOCATE(tr_seri)
    1263       DEALLOCATE(d_t_dyn,d_q_dyn)
    1264       DEALLOCATE(d_ql_dyn,d_qs_dyn, d_qbs_dyn)
    1265       DEALLOCATE(d_q_dyn2d,d_ql_dyn2d,d_qs_dyn2d, d_qbs_dyn2d)
    1266       DEALLOCATE(d_u_dyn,d_v_dyn)
    1267       DEALLOCATE(d_tr_dyn)                      !RomP
    1268       DEALLOCATE(d_t_con,d_q_con,d_q_con_zmasse)
    1269       DEALLOCATE(d_u_con,d_v_con)
    1270       DEALLOCATE(d_t_wake,d_q_wake)
    1271       DEALLOCATE(d_t_lsc,d_q_lsc)
    1272       DEALLOCATE(d_t_lwr,d_t_lw0)
    1273       DEALLOCATE(d_t_swr,d_t_sw0)
    1274       DEALLOCATE(d_ql_lsc,d_qi_lsc)
    1275       DEALLOCATE(d_t_ajsb,d_q_ajsb)
    1276       DEALLOCATE(d_t_ajs,d_q_ajs)
    1277 !nrlmd<
    1278       DEALLOCATE(d_t_ajs_w,d_q_ajs_w)
    1279       DEALLOCATE(d_t_ajs_x,d_q_ajs_x)
    1280 !>nrlmd
    1281       DEALLOCATE(d_u_ajs,d_v_ajs)
    1282       DEALLOCATE(d_t_eva,d_q_eva)
    1283       DEALLOCATE(d_qx_eva)
    1284       DEALLOCATE(d_ql_eva,d_qi_eva)
    1285       DEALLOCATE(d_t_lscst,d_q_lscst)
    1286       DEALLOCATE(d_t_lscth,d_q_lscth)
    1287       DEALLOCATE(plul_st,plul_th)
    1288       DEALLOCATE(d_t_vdf,d_q_vdf,d_t_diss)
    1289       DEALLOCATE(d_qbs_vdf)
    1290       DEALLOCATE(d_t_bsss,d_q_bsss,d_qbs_bsss)
     1249      ALLOCATE (vsed_aer(klon, klev))
     1250    END IF
     1251
     1252  END SUBROUTINE phys_local_var_init
     1253
     1254  !======================================================================
     1255  SUBROUTINE phys_local_var_end
     1256    USE dimphy
     1257    USE indice_sol_mod
     1258    IMPLICIT NONE
     1259    DEALLOCATE(t_seri, q_seri, ql_seri, qs_seri, qbs_seri, qx_seri)
     1260    DEALLOCATE(u_seri, v_seri)
     1261    DEALLOCATE(l_mixmin, l_mix, wprime)
     1262    DEALLOCATE(tke_shear, tke_buoy, tke_trans)
     1263    DEALLOCATE(pbl_eps)
     1264    DEALLOCATE(rhcl)
     1265    DEALLOCATE(tr_seri)
     1266    DEALLOCATE(d_t_dyn, d_q_dyn)
     1267    DEALLOCATE(d_ql_dyn, d_qs_dyn, d_qbs_dyn)
     1268    DEALLOCATE(d_q_dyn2d, d_ql_dyn2d, d_qs_dyn2d, d_qbs_dyn2d)
     1269    DEALLOCATE(d_u_dyn, d_v_dyn)
     1270    DEALLOCATE(d_tr_dyn)                      !RomP
     1271    DEALLOCATE(d_t_con, d_q_con, d_q_con_zmasse)
     1272    DEALLOCATE(d_u_con, d_v_con)
     1273    DEALLOCATE(d_t_wake, d_q_wake)
     1274    DEALLOCATE(d_t_lsc, d_q_lsc)
     1275    DEALLOCATE(d_t_lwr, d_t_lw0)
     1276    DEALLOCATE(d_t_swr, d_t_sw0)
     1277    DEALLOCATE(d_ql_lsc, d_qi_lsc)
     1278    DEALLOCATE(d_t_ajsb, d_q_ajsb)
     1279    DEALLOCATE(d_t_ajs, d_q_ajs)
     1280    !nrlmd<
     1281    DEALLOCATE(d_t_ajs_w, d_q_ajs_w)
     1282    DEALLOCATE(d_t_ajs_x, d_q_ajs_x)
     1283    !>nrlmd
     1284    DEALLOCATE(d_u_ajs, d_v_ajs)
     1285    DEALLOCATE(d_t_eva, d_q_eva)
     1286    DEALLOCATE(d_qx_eva)
     1287    DEALLOCATE(d_ql_eva, d_qi_eva)
     1288    DEALLOCATE(d_t_lscst, d_q_lscst)
     1289    DEALLOCATE(d_t_lscth, d_q_lscth)
     1290    DEALLOCATE(plul_st, plul_th)
     1291    DEALLOCATE(d_t_vdf, d_q_vdf, d_t_diss)
     1292    DEALLOCATE(d_qbs_vdf)
     1293    DEALLOCATE(d_t_bsss, d_q_bsss, d_qbs_bsss)
    12911294#ifdef ISO
    12921295      deallocate(xt_seri,xtl_seri,xts_seri,xtbs_seri)
     
    13111314#endif
    13121315
    1313       DEALLOCATE(d_u_vdf,d_v_vdf)
    1314       DEALLOCATE(d_t_oli,d_t_oro)
    1315       DEALLOCATE(d_u_oli,d_v_oli)
    1316       DEALLOCATE(d_u_oro,d_v_oro)
    1317       DEALLOCATE(d_t_oro_gw)
    1318       DEALLOCATE(d_u_oro_gw,d_v_oro_gw)
    1319       DEALLOCATE(d_t_lif,d_t_ec)
    1320       DEALLOCATE(d_u_lif,d_v_lif)
    1321       DEALLOCATE(d_ts, d_tr)
    1322       DEALLOCATE(topswad_aero,solswad_aero)
    1323       DEALLOCATE(topswai_aero,solswai_aero)
    1324       DEALLOCATE(topswad0_aero,solswad0_aero)
    1325       DEALLOCATE(toplwad_aero,sollwad_aero)
    1326       DEALLOCATE(toplwai_aero,sollwai_aero)
    1327       DEALLOCATE(toplwad0_aero,sollwad0_aero)
    1328       DEALLOCATE(topsw_aero,solsw_aero)
    1329       DEALLOCATE(topsw0_aero,solsw0_aero)
    1330       DEALLOCATE(topswcf_aero,solswcf_aero)
    1331       DEALLOCATE(stratomask)
    1332       DEALLOCATE(tausum_aero)
    1333       DEALLOCATE(drytausum_aero)
    1334       DEALLOCATE(tau3d_aero)
    1335       DEALLOCATE(dNovrN)
    1336       DEALLOCATE(zfice)
    1337       DEALLOCATE(od443aer)
    1338       DEALLOCATE(od550aer)
    1339       DEALLOCATE(od865aer)
    1340       DEALLOCATE(dryod550aer)
    1341       DEALLOCATE(abs550aer)
    1342       DEALLOCATE(ec550aer)
    1343       DEALLOCATE(od550lt1aer)
    1344       DEALLOCATE(sconcso4)
    1345       DEALLOCATE(sconcno3)
    1346       DEALLOCATE(sconcoa)
    1347       DEALLOCATE(sconcbc)
    1348       DEALLOCATE(sconcss)
    1349       DEALLOCATE(sconcdust)
    1350       DEALLOCATE(concso4)
    1351       DEALLOCATE(concno3)
    1352       DEALLOCATE(concoa)
    1353       DEALLOCATE(concbc)
    1354       DEALLOCATE(concss)
    1355       DEALLOCATE(concdust)
    1356       DEALLOCATE(loadso4)
    1357       DEALLOCATE(loadoa)
    1358       DEALLOCATE(loadbc)
    1359       DEALLOCATE(loadss)
    1360       DEALLOCATE(loaddust)
    1361       DEALLOCATE(loadno3)
    1362       DEALLOCATE(load_tmp1)
    1363       DEALLOCATE(load_tmp2)
    1364       DEALLOCATE(load_tmp3)
    1365       DEALLOCATE(load_tmp4)
    1366       DEALLOCATE(load_tmp5)
    1367       DEALLOCATE(load_tmp6)
    1368       DEALLOCATE(load_tmp7)
    1369       DEALLOCATE(load_tmp8)
    1370       DEALLOCATE(load_tmp9)
    1371       DEALLOCATE(load_tmp10)
    1372       DEALLOCATE(du_gwd_hines,dv_gwd_hines,d_t_hin)
    1373       DEALLOCATE(d_q_ch4)
    1374       DEALLOCATE(dv_gwd_rando,dv_gwd_front)
    1375       DEALLOCATE(east_gwstress,west_gwstress)
    1376 
    1377 !IM ajout variables CFMIP2/CMIP5
    1378       DEALLOCATE(topswad_aerop, solswad_aerop)
    1379       DEALLOCATE(topswai_aerop, solswai_aerop)
    1380       DEALLOCATE(topswad0_aerop, solswad0_aerop)
    1381       DEALLOCATE(topsw_aerop, topsw0_aerop)
    1382       DEALLOCATE(solsw_aerop, solsw0_aerop)
    1383       DEALLOCATE(topswcf_aerop, solswcf_aerop)
    1384 !AI Aerosols
    1385       DEALLOCATE(m_allaer)
    1386 !CK LW diagnostics
    1387       DEALLOCATE(toplwad_aerop, sollwad_aerop)
    1388       DEALLOCATE(toplwai_aerop, sollwai_aerop)
    1389       DEALLOCATE(toplwad0_aerop, sollwad0_aerop)
    1390 
    1391 !AI Ajout pour Ecrad (3Deffect)
    1392       DEALLOCATE(topswad_aero_s2, solswad_aero_s2)
    1393       DEALLOCATE(topswai_aero_s2, solswai_aero_s2)
    1394       DEALLOCATE(topswad0_aero_s2, solswad0_aero_s2)
    1395       DEALLOCATE(topsw_aero_s2, topsw0_aero_s2)
    1396       DEALLOCATE(solsw_aero_s2, solsw0_aero_s2)
    1397       DEALLOCATE(topswcf_aero_s2, solswcf_aero_s2)
    1398 !CK LW diagnostics
    1399       DEALLOCATE(toplwad_aero_s2, sollwad_aero_s2)
    1400       DEALLOCATE(toplwai_aero_s2, sollwai_aero_s2)
    1401       DEALLOCATE(toplwad0_aero_s2, sollwad0_aero_s2)     
    1402 
    1403 ! FH Ajout de celles necessaires au phys_output_write_mod
    1404       DEALLOCATE(tal1, pal1, pab1, pab2)
    1405       DEALLOCATE(ptstar, pt0, slp)
    1406 !
    1407       DEALLOCATE(alp_wake)
    1408       DEALLOCATE(wake_h,wake_k)
    1409       DEALLOCATE(wake_omg)
    1410       DEALLOCATE(d_deltat_wk, d_deltaq_wk)
    1411       DEALLOCATE(d_s_wk, d_dens_a_wk, d_dens_wk)
    1412       DEALLOCATE(d_deltat_wk_gw, d_deltaq_wk_gw)
    1413       DEALLOCATE(d_deltat_vdf, d_deltaq_vdf)
    1414 !!      DEALLOCATE( d_s_vdf, d_dens_vdf)
    1415       DEALLOCATE(d_deltat_the, d_deltaq_the)
    1416 !!      DEALLOCATE( d_s_the, d_dens_the)
    1417       DEALLOCATE(d_deltat_ajs_cv, d_deltaq_ajs_cv)
     1316    DEALLOCATE(d_u_vdf, d_v_vdf)
     1317    DEALLOCATE(d_t_oli, d_t_oro)
     1318    DEALLOCATE(d_u_oli, d_v_oli)
     1319    DEALLOCATE(d_u_oro, d_v_oro)
     1320    DEALLOCATE(d_t_oro_gw)
     1321    DEALLOCATE(d_u_oro_gw, d_v_oro_gw)
     1322    DEALLOCATE(d_t_lif, d_t_ec)
     1323    DEALLOCATE(d_u_lif, d_v_lif)
     1324    DEALLOCATE(d_ts, d_tr)
     1325    DEALLOCATE(topswad_aero, solswad_aero)
     1326    DEALLOCATE(topswai_aero, solswai_aero)
     1327    DEALLOCATE(topswad0_aero, solswad0_aero)
     1328    DEALLOCATE(toplwad_aero, sollwad_aero)
     1329    DEALLOCATE(toplwai_aero, sollwai_aero)
     1330    DEALLOCATE(toplwad0_aero, sollwad0_aero)
     1331    DEALLOCATE(topsw_aero, solsw_aero)
     1332    DEALLOCATE(topsw0_aero, solsw0_aero)
     1333    DEALLOCATE(topswcf_aero, solswcf_aero)
     1334    DEALLOCATE(stratomask)
     1335    DEALLOCATE(tausum_aero)
     1336    DEALLOCATE(drytausum_aero)
     1337    DEALLOCATE(tau3d_aero)
     1338    DEALLOCATE(dNovrN)
     1339    DEALLOCATE(zfice)
     1340    DEALLOCATE(od443aer)
     1341    DEALLOCATE(od550aer)
     1342    DEALLOCATE(od865aer)
     1343    DEALLOCATE(dryod550aer)
     1344    DEALLOCATE(abs550aer)
     1345    DEALLOCATE(ec550aer)
     1346    DEALLOCATE(od550lt1aer)
     1347    DEALLOCATE(sconcso4)
     1348    DEALLOCATE(sconcno3)
     1349    DEALLOCATE(sconcoa)
     1350    DEALLOCATE(sconcbc)
     1351    DEALLOCATE(sconcss)
     1352    DEALLOCATE(sconcdust)
     1353    DEALLOCATE(concso4)
     1354    DEALLOCATE(concno3)
     1355    DEALLOCATE(concoa)
     1356    DEALLOCATE(concbc)
     1357    DEALLOCATE(concss)
     1358    DEALLOCATE(concdust)
     1359    DEALLOCATE(loadso4)
     1360    DEALLOCATE(loadoa)
     1361    DEALLOCATE(loadbc)
     1362    DEALLOCATE(loadss)
     1363    DEALLOCATE(loaddust)
     1364    DEALLOCATE(loadno3)
     1365    DEALLOCATE(load_tmp1)
     1366    DEALLOCATE(load_tmp2)
     1367    DEALLOCATE(load_tmp3)
     1368    DEALLOCATE(load_tmp4)
     1369    DEALLOCATE(load_tmp5)
     1370    DEALLOCATE(load_tmp6)
     1371    DEALLOCATE(load_tmp7)
     1372    DEALLOCATE(load_tmp8)
     1373    DEALLOCATE(load_tmp9)
     1374    DEALLOCATE(load_tmp10)
     1375    DEALLOCATE(du_gwd_hines, dv_gwd_hines, d_t_hin)
     1376    DEALLOCATE(d_q_ch4)
     1377    DEALLOCATE(dv_gwd_rando, dv_gwd_front)
     1378    DEALLOCATE(east_gwstress, west_gwstress)
     1379
     1380    !IM ajout variables CFMIP2/CMIP5
     1381    DEALLOCATE(topswad_aerop, solswad_aerop)
     1382    DEALLOCATE(topswai_aerop, solswai_aerop)
     1383    DEALLOCATE(topswad0_aerop, solswad0_aerop)
     1384    DEALLOCATE(topsw_aerop, topsw0_aerop)
     1385    DEALLOCATE(solsw_aerop, solsw0_aerop)
     1386    DEALLOCATE(topswcf_aerop, solswcf_aerop)
     1387    !AI Aerosols
     1388    DEALLOCATE(m_allaer)
     1389    !CK LW diagnostics
     1390    DEALLOCATE(toplwad_aerop, sollwad_aerop)
     1391    DEALLOCATE(toplwai_aerop, sollwai_aerop)
     1392    DEALLOCATE(toplwad0_aerop, sollwad0_aerop)
     1393
     1394    !AI Ajout pour Ecrad (3Deffect)
     1395    DEALLOCATE(topswad_aero_s2, solswad_aero_s2)
     1396    DEALLOCATE(topswai_aero_s2, solswai_aero_s2)
     1397    DEALLOCATE(topswad0_aero_s2, solswad0_aero_s2)
     1398    DEALLOCATE(topsw_aero_s2, topsw0_aero_s2)
     1399    DEALLOCATE(solsw_aero_s2, solsw0_aero_s2)
     1400    DEALLOCATE(topswcf_aero_s2, solswcf_aero_s2)
     1401    !CK LW diagnostics
     1402    DEALLOCATE(toplwad_aero_s2, sollwad_aero_s2)
     1403    DEALLOCATE(toplwai_aero_s2, sollwai_aero_s2)
     1404    DEALLOCATE(toplwad0_aero_s2, sollwad0_aero_s2)
     1405
     1406    ! FH Ajout de celles necessaires au phys_output_write_mod
     1407    DEALLOCATE(tal1, pal1, pab1, pab2)
     1408    DEALLOCATE(ptstar, pt0, slp)
     1409    !
     1410    DEALLOCATE(alp_wake)
     1411    DEALLOCATE(wake_h, wake_k)
     1412    DEALLOCATE(wake_omg)
     1413    DEALLOCATE(d_deltat_wk, d_deltaq_wk)
     1414    DEALLOCATE(d_s_wk, d_dens_a_wk, d_dens_wk)
     1415    DEALLOCATE(d_deltat_wk_gw, d_deltaq_wk_gw)
     1416    DEALLOCATE(d_deltat_vdf, d_deltaq_vdf)
     1417    !!      DEALLOCATE( d_s_vdf, d_dens_vdf)
     1418    DEALLOCATE(d_deltat_the, d_deltaq_the)
     1419    !!      DEALLOCATE( d_s_the, d_dens_the)
     1420    DEALLOCATE(d_deltat_ajs_cv, d_deltaq_ajs_cv)
    14181421#ifdef ISO
    14191422      DEALLOCATE(d_deltaxt_wk)
     
    14221425      DEALLOCATE(d_deltaxt_vdf)
    14231426#endif
    1424 !
    1425       DEALLOCATE(bils)
    1426       DEALLOCATE(cdragm, cdragh, cldh, cldl)
    1427       DEALLOCATE(cldm, cldq, cldt, qsat2m)
    1428       DEALLOCATE(JrNt)
    1429       DEALLOCATE(dthmin, evap, snowerosion, fder, plcl, plfc)
    1430       DEALLOCATE(prw, prlw, prsw, prbsw, water_budget, zustar, zu10m, zv10m, rh2m, s_lcl)
    1431       DEALLOCATE(s_pblh, s_pblt, s_therm)
    1432 !
    1433 !nrlmd+jyg<
    1434       DEALLOCATE(s_pblh_x, s_pblh_w)
    1435       DEALLOCATE(s_lcl_x, s_lcl_w)
    1436 !>nrlmd+jyg
    1437 !
    1438       DEALLOCATE(slab_wfbils, tpot, tpote, ue)
    1439       DEALLOCATE(uq, ve, vq, zxffonte)
    1440       DEALLOCATE(uwat, vwat)
    1441       DEALLOCATE(zxfqcalving, zxfluxlat)
    1442       DEALLOCATE(zxrunofflic)
    1443       DEALLOCATE(zxustartlic, zxrhoslic, zxqsaltlic)
    1444       DEALLOCATE(zxtsol, snow_lsc, zxfqfonte, zxqsurf)
    1445       DEALLOCATE(rain_lsc)
    1446       DEALLOCATE(rain_num)
    1447       DEALLOCATE(qlth, qith, qsith, wiceth)
    1448 !
    1449       DEALLOCATE(sens_x, sens_w)
    1450       DEALLOCATE(zxfluxlat_x, zxfluxlat_w)
    1451       DEALLOCATE(delta_qsurf)
    1452 !jyg<
    1453 !!      DEALLOCATE(t_x, t_w)
    1454 !!      DEALLOCATE(q_x, q_w)
    1455 !>jyg
    1456       DEALLOCATE(d_t_vdf_x, d_t_vdf_w)
    1457       DEALLOCATE(d_q_vdf_x, d_q_vdf_w)
    1458       DEALLOCATE(pbl_tke_input)
    1459       DEALLOCATE(t_therm, q_therm, u_therm, v_therm)
    1460       DEALLOCATE(cdragh_x, cdragh_w)
    1461       DEALLOCATE(cdragm_x, cdragm_w)
    1462       DEALLOCATE(kh, kh_x, kh_w)
     1427    !
     1428    DEALLOCATE(bils)
     1429    DEALLOCATE(cdragm, cdragh, cldh, cldl)
     1430    DEALLOCATE(cldm, cldq, cldt, qsat2m)
     1431    DEALLOCATE(JrNt)
     1432    DEALLOCATE(dthmin, evap, snowerosion, fder, plcl, plfc)
     1433    DEALLOCATE(prw, prlw, prsw, prbsw, water_budget, zustar, zu10m, zv10m, rh2m, s_lcl)
     1434    DEALLOCATE(s_pblh, s_pblt, s_therm)
     1435    !
     1436    !nrlmd+jyg<
     1437    DEALLOCATE(s_pblh_x, s_pblh_w)
     1438    DEALLOCATE(s_lcl_x, s_lcl_w)
     1439    !>nrlmd+jyg
     1440    !
     1441    DEALLOCATE(slab_wfbils, tpot, tpote, ue)
     1442    DEALLOCATE(uq, ve, vq, zxffonte)
     1443    DEALLOCATE(uwat, vwat)
     1444    DEALLOCATE(zxfqcalving, zxfluxlat)
     1445    DEALLOCATE(zxrunofflic)
     1446    DEALLOCATE(zxustartlic, zxrhoslic, zxqsaltlic)
     1447    DEALLOCATE(zxtsol, snow_lsc, zxfqfonte, zxqsurf)
     1448    DEALLOCATE(rain_lsc)
     1449    DEALLOCATE(rain_num)
     1450    DEALLOCATE(qlth, qith, qsith, wiceth)
     1451    !
     1452    DEALLOCATE(sens_x, sens_w)
     1453    DEALLOCATE(zxfluxlat_x, zxfluxlat_w)
     1454    DEALLOCATE(delta_qsurf)
     1455    !jyg<
     1456    !!      DEALLOCATE(t_x, t_w)
     1457    !!      DEALLOCATE(q_x, q_w)
     1458    !>jyg
     1459    DEALLOCATE(d_t_vdf_x, d_t_vdf_w)
     1460    DEALLOCATE(d_q_vdf_x, d_q_vdf_w)
     1461    DEALLOCATE(pbl_tke_input)
     1462    DEALLOCATE(t_therm, q_therm, u_therm, v_therm)
     1463    DEALLOCATE(cdragh_x, cdragh_w)
     1464    DEALLOCATE(cdragm_x, cdragm_w)
     1465    DEALLOCATE(kh, kh_x, kh_w)
    14631466#ifdef ISO
    14641467      DEALLOCATE(xtevap,xtprw)
     
    14711474      DEALLOCATE(h1_diag,runoff_diag,xtrunoff_diag)
    14721475#endif
    1473 !
    1474       DEALLOCATE(ptconv)
    1475       DEALLOCATE(ratqsc)
    1476 !
    1477       DEALLOCATE(wbeff, convoccur, zmax_th)
    1478       DEALLOCATE(zq2m, zt2m, weak_inversion)
    1479       DEALLOCATE(zt2m_min_mon, zt2m_max_mon)
    1480       DEALLOCATE(t2m_min_mon, t2m_max_mon)
    1481       DEALLOCATE(sens, flwp, fiwp)
    1482       DEALLOCATE(alp_bl_conv,alp_bl_det)
    1483       DEALLOCATE(alp_bl_fluct_m,alp_bl_fluct_tke)
    1484       DEALLOCATE(alp_bl_stat, n2, s2, strig, zcong, zlcl_th)
    1485       DEALLOCATE(proba_notrig, random_notrig)
    1486 !FC
    1487       DEALLOCATE(zxfluxq,zxfluxt)
    1488 
    1489       DEALLOCATE(dnwd0)
    1490 !      DEALLOCATE(upwd, omega, coefh)
    1491       DEALLOCATE(omega)
    1492       DEALLOCATE(epmax_diag)
    1493 !      DEALLOCATE(coefm, lambda_th, cldemi)
    1494       DEALLOCATE(lambda_th, cldemi)
    1495       DEALLOCATE(cldfra, cldtau, fiwc)
    1496       DEALLOCATE(fl, re, flwc)
    1497       DEALLOCATE(ref_liq, ref_ice, theta)
    1498       DEALLOCATE(ref_liq_pi, ref_ice_pi)
    1499       DEALLOCATE(zphi, zx_rh, zx_rhl, zx_rhi)
    1500       DEALLOCATE(pmfd, pmfu)
    1501 
    1502       DEALLOCATE(t2m, fluxlat)
    1503       DEALLOCATE(fsollw, evap_pot)
    1504       DEALLOCATE(fsolsw, wfbils)
    1505       DEALLOCATE(wfevap)
    1506 
    1507       DEALLOCATE(pmflxr, pmflxs)
    1508       DEALLOCATE(wdtrainA, wdtrainS, wdtrainM)
    1509       DEALLOCATE(upwd, dnwd)
    1510       DEALLOCATE(ep)
    1511       DEALLOCATE(da, mp)
    1512       DEALLOCATE(phi)
    1513       DEALLOCATE(wght_cvfd)
    1514       DEALLOCATE(phi2)
    1515       DEALLOCATE(d1a, dam)
    1516       DEALLOCATE(ev)
    1517       DEALLOCATE(elij)
    1518       DEALLOCATE(qtaa)
    1519       DEALLOCATE(clw)
    1520       DEALLOCATE(epmlmMm, eplaMm)
    1521       DEALLOCATE(sij)
     1476    !
     1477    DEALLOCATE(ptconv)
     1478    DEALLOCATE(ratqsc)
     1479    !
     1480    DEALLOCATE(wbeff, convoccur, zmax_th)
     1481    DEALLOCATE(zq2m, zt2m, weak_inversion)
     1482    DEALLOCATE(zt2m_min_mon, zt2m_max_mon)
     1483    DEALLOCATE(t2m_min_mon, t2m_max_mon)
     1484    DEALLOCATE(sens, flwp, fiwp)
     1485    DEALLOCATE(alp_bl_conv, alp_bl_det)
     1486    DEALLOCATE(alp_bl_fluct_m, alp_bl_fluct_tke)
     1487    DEALLOCATE(alp_bl_stat, n2, s2, strig, zcong, zlcl_th)
     1488    DEALLOCATE(proba_notrig, random_notrig)
     1489    !FC
     1490    DEALLOCATE(zxfluxq, zxfluxt)
     1491
     1492    DEALLOCATE(dnwd0)
     1493    !      DEALLOCATE(upwd, omega, coefh)
     1494    DEALLOCATE(omega)
     1495    DEALLOCATE(epmax_diag)
     1496    !      DEALLOCATE(coefm, lambda_th, cldemi)
     1497    DEALLOCATE(lambda_th, cldemi)
     1498    DEALLOCATE(cldfra, cldtau, fiwc)
     1499    DEALLOCATE(fl, re, flwc)
     1500    DEALLOCATE(ref_liq, ref_ice, theta)
     1501    DEALLOCATE(ref_liq_pi, ref_ice_pi)
     1502    DEALLOCATE(zphi, zx_rh, zx_rhl, zx_rhi)
     1503    DEALLOCATE(pmfd, pmfu)
     1504
     1505    DEALLOCATE(t2m, fluxlat)
     1506    DEALLOCATE(fsollw, evap_pot)
     1507    DEALLOCATE(fsolsw, wfbils)
     1508    DEALLOCATE(wfevap)
     1509
     1510    DEALLOCATE(pmflxr, pmflxs)
     1511    DEALLOCATE(wdtrainA, wdtrainS, wdtrainM)
     1512    DEALLOCATE(upwd, dnwd)
     1513    DEALLOCATE(ep)
     1514    DEALLOCATE(da, mp)
     1515    DEALLOCATE(phi)
     1516    DEALLOCATE(wght_cvfd)
     1517    DEALLOCATE(phi2)
     1518    DEALLOCATE(d1a, dam)
     1519    DEALLOCATE(ev)
     1520    DEALLOCATE(elij)
     1521    DEALLOCATE(qtaa)
     1522    DEALLOCATE(clw)
     1523    DEALLOCATE(epmlmMm, eplaMm)
     1524    DEALLOCATE(sij)
    15221525#ifdef ISO
    15231526      DEALLOCATE(xtwdtrainA)
     
    15451548
    15461549
    1547       DEALLOCATE(prfl, psfl, bsfl, fraca, Vprecip)
    1548       DEALLOCATE(zw2)
    1549 
    1550       DEALLOCATE(fluxu, fluxv)
    1551       DEALLOCATE(fluxt)
    1552 
    1553       DEALLOCATE(uwriteSTD, vwriteSTD)
    1554       DEALLOCATE(wwriteSTD, phiwriteSTD)
    1555       DEALLOCATE(qwriteSTD, twriteSTD, rhwriteSTD)
    1556 
    1557 ! ug et d'autres encore:
    1558       DEALLOCATE(beta_prec)
    1559       DEALLOCATE(rneb)
    1560       DEALLOCATE(pfraclr,pfracld)
    1561       DEALLOCATE(cldfraliq)
    1562       DEALLOCATE(sigma2_icefracturb)
    1563       DEALLOCATE(mean_icefracturb)
    1564       DEALLOCATE (zxsnow,snowhgt,qsnow,to_ice,sissnow,runoff,albsol3_lic)
    1565       DEALLOCATE(distcltop)
    1566       DEALLOCATE(temp_cltop)
     1550    DEALLOCATE(prfl, psfl, bsfl, fraca, Vprecip)
     1551    DEALLOCATE(zw2)
     1552
     1553    DEALLOCATE(fluxu, fluxv)
     1554    DEALLOCATE(fluxt)
     1555
     1556    DEALLOCATE(uwriteSTD, vwriteSTD)
     1557    DEALLOCATE(wwriteSTD, phiwriteSTD)
     1558    DEALLOCATE(qwriteSTD, twriteSTD, rhwriteSTD)
     1559
     1560    ! ug et d'autres encore:
     1561    DEALLOCATE(beta_prec)
     1562    DEALLOCATE(rneb)
     1563    DEALLOCATE(pfraclr, pfracld)
     1564    DEALLOCATE(cldfraliq)
     1565    DEALLOCATE(sigma2_icefracturb)
     1566    DEALLOCATE(mean_icefracturb)
     1567    DEALLOCATE (zxsnow, snowhgt, qsnow, to_ice, sissnow, runoff, albsol3_lic)
     1568    DEALLOCATE(distcltop)
     1569    DEALLOCATE(temp_cltop)
    15671570#ifdef ISO
    15681571      DEALLOCATE (zxxtsnow,xtVprecip,xtVprecipi,pxtrfl,pxtsfl)
    15691572#endif
    15701573
    1571       DEALLOCATE (p_tropopause)
    1572       DEALLOCATE (z_tropopause)
    1573       DEALLOCATE (t_tropopause)
    1574       DEALLOCATE(zn2mout)
    1575 
    1576 ! Supersaturation
    1577       DEALLOCATE(rneb_seri)
    1578       DEALLOCATE(d_rneb_dyn)
    1579       DEALLOCATE(qclr, qcld, qss, qvc)
    1580       DEALLOCATE(rnebclr, rnebss, gamma_ss)
    1581       DEALLOCATE(N1_ss, N2_ss)
    1582       DEALLOCATE(drneb_sub, drneb_con, drneb_tur, drneb_avi)
    1583       DEALLOCATE(zqsatl, zqsats)
    1584       DEALLOCATE(Tcontr, qcontr, qcontr2, fcontrN, fcontrP)
    1585 
    1586 !--POPRECIP variables
    1587       DEALLOCATE(qraindiag, qsnowdiag)
    1588       DEALLOCATE(dqreva, dqssub)
    1589       DEALLOCATE(dqrauto, dqrcol, dqrmelt, dqrfreez)
    1590       DEALLOCATE(dqsauto, dqsagg, dqsrim, dqsmelt, dqsfreez)
    1591 
    1592 #ifdef CPP_StratAer
    1593 ! variables for strat. aerosol CK
     1574    DEALLOCATE (p_tropopause)
     1575    DEALLOCATE (z_tropopause)
     1576    DEALLOCATE (t_tropopause)
     1577    DEALLOCATE(zn2mout)
     1578
     1579    ! Supersaturation
     1580    DEALLOCATE(rneb_seri)
     1581    DEALLOCATE(d_rneb_dyn)
     1582    DEALLOCATE(qclr, qcld, qss, qvc)
     1583    DEALLOCATE(rnebclr, rnebss, gamma_ss)
     1584    DEALLOCATE(N1_ss, N2_ss)
     1585    DEALLOCATE(drneb_sub, drneb_con, drneb_tur, drneb_avi)
     1586    DEALLOCATE(zqsatl, zqsats)
     1587    DEALLOCATE(Tcontr, qcontr, qcontr2, fcontrN, fcontrP)
     1588
     1589    !--POPRECIP variables
     1590    DEALLOCATE(qraindiag, qsnowdiag)
     1591    DEALLOCATE(dqreva, dqssub)
     1592    DEALLOCATE(dqrauto, dqrcol, dqrmelt, dqrfreez)
     1593    DEALLOCATE(dqsauto, dqsagg, dqsrim, dqsmelt, dqsfreez)
     1594
     1595    IF (CPPKEY_STRATAER) THEN
     1596      ! variables for strat. aerosol CK
    15941597      DEALLOCATE (d_q_emiss)
    15951598      DEALLOCATE (R2SO4)
     
    16321635      DEALLOCATE (budg_h2so4_to_part)
    16331636      DEALLOCATE (budg_sed_part)
    1634 #endif
    1635 
    1636 END SUBROUTINE phys_local_var_end
     1637    END IF
     1638
     1639  END SUBROUTINE phys_local_var_end
    16371640
    16381641END MODULE phys_local_var_mod
  • LMDZ6/branches/Amaury_dev/libf/phylmdiso/phys_output_ctrlout_mod.F90

    r5039 r5098  
    14401440    'flx_co2_land_cor', 'correction of the CO2 flux from the land', 'kg CO2 m-2 s-1', (/ ('', i=1, 10) /))
    14411441
    1442 #ifdef CPP_StratAer
    14431442!--extinction coefficient
    14441443  TYPE(ctrl_out), SAVE :: o_ext_strat_550 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 1/), &
     
    15111510  TYPE(ctrl_out), SAVE :: o_surf_PM25_sulf = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 1/), &
    15121511    'surf_PM25_sulf', 'Sulfate PM2.5 concentration at the surface', 'ug/m3', (/ ('', i=1, 10) /))
    1513 #endif
    15141512
    15151513!!!!!!!!!!!!!!!!!!!!!! 3D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  • LMDZ6/branches/Amaury_dev/libf/phylmdiso/phys_output_mod.F90

    r5082 r5098  
    77  USE phys_output_write_mod, ONLY : phys_output_write
    88  REAL, DIMENSION(nfiles),SAVE :: ecrit_files
     9  USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_STRATAER
    910
    1011! Abderrahmane 12 2007
     
    228229    clef_files(8) = ok_histNMC(2)
    229230    clef_files(9) = ok_histNMC(3)
    230 #ifdef CPP_StratAer
    231     clef_files(10)= .TRUE.
    232 #else
    233     clef_files(10)= .FALSE.
    234 #endif
     231    clef_files(10)= CPPKEY_StratAer
    235232
    236233    !sortir des fichiers "stations" si clef_stations(:)=.TRUE.
  • LMDZ6/branches/Amaury_dev/libf/phylmdiso/physiq_mod.F90

    r5091 r5098  
    9595    USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_INCA
    9696
     97    USE geometry_mod,      ONLY: longitude, latitude, boundslon, boundslat, ind_cell_glo
     98    USE time_phylmdz_mod,  ONLY: ndays
     99    USE infotrac_phy,      ONLY: nqCO2
     100
     101    USE time_phylmdz_mod,    ONLY: annee_ref, day_ini, day_ref, start_time
     102    USE vertical_layers_mod, ONLY: aps, bps, ap, bp
     103
     104    USE lmdz_xios, ONLY: xios_update_calendar, xios_context_finalize, xios_get_field_attr, &
     105            xios_field_is_active, xios_context, xios_set_current_context
     106    USE wxios, ONLY: missing_val, using_xios
     107    USE paramLMDZ_phy_mod
     108
    97109
    98110    !USE cmp_seri_mod
     
    111123#endif
    112124
    113 
    114     USE geometry_mod,      ONLY: longitude, latitude, boundslon, boundslat, ind_cell_glo
    115     USE time_phylmdz_mod,  ONLY: ndays
    116     USE infotrac_phy,      ONLY: nqCO2
    117125#ifdef REPROBUS
    118126    USE chem_rep, ONLY: Init_chem_rep_xjour, d_q_rep, d_ql_rep, d_qi_rep, &
     
    121129    USE strataer_emiss_mod, ONLY: strataer_emiss_init
    122130#endif
    123     USE time_phylmdz_mod,    ONLY: annee_ref, day_ini, day_ref, start_time
    124     USE vertical_layers_mod, ONLY: aps, bps, ap, bp
    125 
    126131
    127132#ifdef CPP_RRTM
     
    131136
    132137
    133 #ifdef CPP_StratAer
    134138    USE phys_local_var_mod, ONLY: d_q_emiss
    135139    USE strataer_local_var_mod
    136140    USE strataer_nuc_mod, ONLY: strataer_nuc_init
    137141    USE strataer_emiss_mod, ONLY: strataer_emiss_init
    138 #endif
    139 
    140     USE lmdz_xios, ONLY: xios_update_calendar, xios_context_finalize
    141     USE lmdz_xios, ONLY: xios_get_field_attr, xios_field_is_active, xios_context
    142     USE lmdz_xios, ONLY: xios_set_current_context
    143     USE wxios, ONLY: missing_val, using_xios
    144 
    145 #ifndef CPP_XIOS
    146     USE paramLMDZ_phy_mod
    147 #endif
    148 
    149142
    150143#ifdef ISO
     
    15101503#endif
    15111504
    1512 #ifdef CPP_StratAer
     1505IF (CPPKEY_STRATAER) THEN
    15131506       CALL strataer_init
    15141507       CALL strataer_nuc_init
    15151508       CALL strataer_emiss_init
    1516 #endif
     1509END IF
    15171510
    15181511       print*, '================================================='
     
    19281921       WRITE(lunout,*)'OK freq_outNMC(3)=',freq_outNMC(3)
    19291922
    1930 #ifndef CPP_XIOS
     1923    IF (.NOT. using_xios) THEN
    19311924       CALL ini_paramLMDZ_phy(phys_tstep,nid_ctesGCM)
    1932 #endif
     1925END IF
    19331926
    19341927#endif
     
    58005793          ELSE
    58015794#ifdef CPP_RRTM
    5802 #ifndef CPP_StratAer
     5795IF (.NOT. CPPKEY_STRATAER) THEN
    58035796          !--prescribed strat aerosols
    58045797          !--only in the case of non-interactive strat aerosols
     
    58115804             CALL abort_physic(modname,abort_message,1)
    58125805            ENDIF
    5813 #endif
     5806END IF
    58145807#else
    58155808             abort_message='You should compile with -rrtm if running ' &
     
    58235816!
    58245817#ifdef CPP_RRTM
    5825 #ifdef CPP_StratAer
     5818IF (CPPKEY_STRATER) THEN
    58265819       !--compute stratospheric mask
    58275820       CALL stratosphere_mask(missing_val, pphis, t_seri, pplay, latitude_deg)
    58285821       !--interactive strat aerosols
    58295822       CALL calcaerosolstrato_rrtm(pplay,t_seri,paprs,debut)
    5830 #endif
     5823END IF
    58315824#endif
    58325825       !--fin STRAT AEROSOL
     
    64706463    IF (ok_qch4) THEN
    64716464!      d_q_ch4: H2O source from CH4 in MMR/s (mass mixing ratio/s or kg H2O/kg air/s)
    6472 #ifdef CPP_StratAer
     6465IF (CPPKEY_STRATER) THEN
    64736466       CALL stratH2O_methox(debut,paprs,d_q_ch4)
    6474 #else
     6467ELSE
    64756468!      ECMWF routine METHOX
    64766469       CALL METHOX(1,klon,klon,klev,q_seri,d_q_ch4,pplay)
    6477 #endif
     6470END IF
    64786471       ! add humidity tendency due to methane
    64796472       d_q_ch4_dtime(:,:) = d_q_ch4(:,:)*phys_tstep
     
    64946487    !
    64956488    !
    6496 #ifdef CPP_StratAer
     6489IF (CPPKEY_STRATER) THEN
    64976490    IF (ok_qemiss) THEN
    64986491       flh2o=1
     
    65376530       END SELECT ! emission scenario (flag_emit)
    65386531    ENDIF
    6539 #endif
     6532END IF
    65406533
    65416534!===============================================================
     
    69976990    ENDDO
    69986991
    6999 #ifdef CPP_StratAer
     6992IF (CPPKEY_STRATER) THEN
    70006993    IF (ok_qemiss) THEN
    70016994       DO k = 1, klev
     
    70036996       ENDDO
    70046997    ENDIF
    7005 #endif
     6998END IF
    70066999    IF (ok_qch4) THEN
    70077000       DO k = 1, klev
     
    73347327#endif
    73357328
    7336 #ifndef CPP_XIOS
     7329    IF (.NOT. using_xios) THEN
    73377330      CALL write_paramLMDZ_phy(itap,nid_ctesGCM,ok_sync)
    7338 #endif
     7331END IF
    73397332
    73407333#endif
Note: See TracChangeset for help on using the changeset viewer.