Index: LMDZ6/trunk/libf/phylmd/lmdz_thermcell_ini.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/lmdz_thermcell_ini.F90	(revision 4664)
+++ LMDZ6/trunk/libf/phylmd/lmdz_thermcell_ini.F90	(revision 4690)
@@ -5,33 +5,45 @@
 save
 
-   integer :: dvdq=1,dqimpl=-1,prt_level=0,lunout
-   real    :: RG,RD,RCPD,RKAPPA,RLVTT,RLvCp,RETV
-   real    :: r_aspect_thermals,tau_thermals,fact_thermals_ed_dz
-   integer :: iflag_thermals_ed,iflag_thermals_optflux,iflag_thermals_closure
-   integer :: iflag_thermals_down
-   real    :: fact_thermals_down
+
+integer, protected :: dvdq=1,dqimpl=-1,prt_level=0,lunout
+real   , protected :: RG,RD,RCPD,RKAPPA,RLVTT,RLvCp,RETV
 
 !$OMP THREADPRIVATE(dvdq,dqimpl,prt_level,lunout)
 !$OMP THREADPRIVATE(RG,RD,RCPD,RKAPPA,RLVTT,RLvCp)
+
+
+! Parameters that can be modified directly by a getin call
+real,    protected :: r_aspect_thermals=2.       ! Aspect ratio for thermal celles
+real,    protected :: tau_thermals = 0.          ! relaxation time constant
+real,    protected :: fact_thermals_ed_dz = 0.1  ! bouyancy computed with a delta
+real,    protected :: betalpha=0.9               !
+real,    protected :: afact=2./3.                !
+real,    protected :: fact_shell=1.              !
+real,    protected :: detr_min=1.e-5             !
+real,    protected :: entr_min=1.e-5             !
+real,    protected :: detr_q_coef=0.012          !
+real,    protected :: detr_q_power=0.5           !
+real,    protected :: mix0=0.                    !
+integer, protected :: iflag_thermals_ed = 0      !
+integer, protected :: iflag_thermals_optflux = 0 !
+integer, protected :: iflag_thermals_closure = 1 !
+integer, protected :: iflag_thermals_down = 0    !
+integer, protected :: fact_thermals_down = 0.5   !
+integer, protected :: thermals_flag_alim=0       !
+integer, protected :: iflag_thermals_tenv=0      ! 
+
+   ! WARNING !!! fact_epsilon is not protected. It can be modified in thermcell_plume*
+   ! depending on other flags.
+
+   real               :: fact_epsilon=0.002
+
 !$OMP THREADPRIVATE(r_aspect_thermals,tau_thermals,fact_thermals_ed_dz)
 !$OMP THREADPRIVATE(iflag_thermals_ed,iflag_thermals_optflux,iflag_thermals_closure)
 !$OMP THREADPRIVATE(iflag_thermals_down)
 !$OMP THREADPRIVATE(fact_thermals_down)
-
-
-   REAL, SAVE :: fact_epsilon=0.002
-   REAL, SAVE :: betalpha=0.9
-   REAL, SAVE :: afact=2./3.
-   REAL, SAVE :: fact_shell=1.
-   REAL,SAVE :: detr_min=1.e-5
-   REAL,SAVE :: entr_min=1.e-5
-   REAL,SAVE :: detr_q_coef=0.012
-   REAL,SAVE :: detr_q_power=0.5
-   REAL,SAVE :: mix0=0.
-   INTEGER,SAVE :: thermals_flag_alim=0
-
 !$OMP THREADPRIVATE(fact_epsilon, betalpha, afact, fact_shell)
 !$OMP THREADPRIVATE(detr_min, entr_min, detr_q_coef, detr_q_power)
 !$OMP THREADPRIVATE( mix0, thermals_flag_alim)
+!$OMP THREADPRIVATE(iflag_thermals_tenv)
 
 
@@ -70,41 +82,23 @@
 !=====================================================================
 
-   r_aspect_thermals=2.
    CALL getin_p('r_aspect_thermals',r_aspect_thermals)
-   
-   tau_thermals = 0.
    CALL getin_p('tau_thermals',tau_thermals)
-   
-   fact_thermals_ed_dz = 0.1
    CALL getin_p('fact_thermals_ed_dz',fact_thermals_ed_dz)
-   
-   fact_thermals_ed_dz = 0.1
-   CALL getin_p('fact_thermals_ed_dz',fact_thermals_ed_dz)
-   
-   iflag_thermals_ed = 0
    CALL getin_p('iflag_thermals_ed',iflag_thermals_ed)
-   
-   iflag_thermals_optflux = 0
    CALL getin_p('iflag_thermals_optflux',iflag_thermals_optflux)
-   
-   iflag_thermals_closure = 1
    CALL getin_p('iflag_thermals_closure',iflag_thermals_closure)
-
-   iflag_thermals_down = 0
    CALL getin_p('iflag_thermals_down',iflag_thermals_down)
-
-   fact_thermals_down = 0.5
    CALL getin_p('fact_thermals_down',fact_thermals_down)
-
-     CALL getin_p('thermals_fact_epsilon',fact_epsilon)
-     CALL getin_p('thermals_betalpha',betalpha)
-     CALL getin_p('thermals_afact',afact)
-     CALL getin_p('thermals_fact_shell',fact_shell)
-     CALL getin_p('thermals_detr_min',detr_min)
-     CALL getin_p('thermals_entr_min',entr_min)
-     CALL getin_p('thermals_detr_q_coef',detr_q_coef)
-     CALL getin_p('thermals_detr_q_power',detr_q_power)
-     CALL getin_p('thermals_mix0',mix0)
-     CALL getin_p('thermals_flag_alim',thermals_flag_alim)
+   CALL getin_p('thermals_fact_epsilon',fact_epsilon)
+   CALL getin_p('thermals_betalpha',betalpha)
+   CALL getin_p('thermals_afact',afact)
+   CALL getin_p('thermals_fact_shell',fact_shell)
+   CALL getin_p('thermals_detr_min',detr_min)
+   CALL getin_p('thermals_entr_min',entr_min)
+   CALL getin_p('thermals_detr_q_coef',detr_q_coef)
+   CALL getin_p('thermals_detr_q_power',detr_q_power)
+   CALL getin_p('thermals_mix0',mix0)
+   CALL getin_p('thermals_flag_alim',thermals_flag_alim)
+   CALL getin_p('iflag_thermals_tenv',iflag_thermals_tenv)
 
 
@@ -139,4 +133,5 @@
 write(lunout,*) 'thermcell_ini ,mix0                     =',  mix0                    
 write(lunout,*) 'thermcell_ini ,thermals_flag_alim       =',  thermals_flag_alim
+write(lunout,*) 'thermcell_ini ,iflag_thermals_tenv      =',  iflag_thermals_tenv
 
  RETURN
