Index: codes/icosagcm/devel/src/base/earth_const.f90
===================================================================
--- codes/icosagcm/devel/src/base/earth_const.f90	(revision 833)
+++ codes/icosagcm/devel/src/base/earth_const.f90	(revision 834)
@@ -1,47 +1,118 @@
 MODULE earth_const
-  USE prec
-  USE math_const
-  
-  REAL(rstd),SAVE :: radius=6.37122E6
-  REAL(rstd),SAVE :: g=9.80616
+  USE prec, ONLY : rstd
+  IMPLICIT NONE
+  SAVE
+
+! init_earth_const is called from icosa_init outside of an OMP PARALLEL section
+! hence the variables set here are not THREADPRIVATE
+
+  REAL(rstd) :: g=9.80616
+  REAL(rstd) :: radius=6.37122E6
+  REAL(rstd) :: omega=7.292E-5
+  REAL(rstd) :: scale_factor=1.
   REAL(rstd),PARAMETER :: daysec=86400
-  REAL(rstd),SAVE :: omega=7.292E-5
-  REAL(rstd),SAVE :: kappa=0.2857143
-  REAL(rstd),SAVE :: cpp=1004.70885
-  REAL(rstd),SAVE :: cppv=1860.
-  REAL(rstd),SAVE :: Rv=461.5
-  REAL(rstd),SAVE :: Treff=273.
-  REAL(rstd),SAVE :: preff=101325.
-  REAL(rstd),SAVE :: pa=50000. ! default value set to preff/2 by disvert_std
-  REAL(rstd),SAVE :: scale_height=8000. ! atmospheric scale height (m)
-  REAL(rstd),SAVE :: scale_factor=1.
-  REAL(rstd),SAVE :: gas_constant = 8.3144621 
-  REAL(rstd),SAVE :: mu                 ! molar mass of the atmosphere
+
+  REAL(rstd) :: kappa=0.2857143
+  REAL(rstd) :: cpp=1004.70885
+  REAL(rstd) :: nu=0.35 ! exponent in variable-Cp law Cp=cpp*(T/Treff)^nu
+  REAL(rstd) :: cppv=1860.
+  REAL(rstd) :: Rv=461.5
+  REAL(rstd) :: Treff=273.
+  REAL(rstd) :: preff=101325.
+  REAL(rstd) :: pa=50000. ! default value set to preff/2 by disvert_std
+  REAL(rstd) :: scale_height=8000. ! atmospheric scale height (m)
+  REAL(rstd) :: gas_constant = 8.3144621 
+  REAL(rstd) :: Rd, mu             ! specific perfect gas constant and molar mass (?)
+
+  INTEGER, PUBLIC, PARAMETER :: thermo_none=-99, thermo_theta=1, thermo_entropy=2, thermo_variable_Cp=3, &
+       thermo_moist=4, thermo_boussinesq=5, thermo_dry=10, thermo_fake_moist=11, thermo_moist_debug=100
+  LOGICAL, PUBLIC :: boussinesq
+  INTEGER, PUBLIC :: caldyn_thermo, physics_thermo
 
 CONTAINS
   
   SUBROUTINE init_earth_const
-  USE getin_mod
-  IMPLICIT NONE
-  REAL(rstd) :: X=1
-  
+    USE getin_mod, ONLY : getin
+    USE grid_param, ONLY : nqdyn
+    USE omp_para, ONLY : is_master
+    USE mpipara, ONLY : is_mpi_root
+    CHARACTER(len=255) :: def
+
+    CALL getin("g",g)
     CALL getin("radius",radius)
-    CALL getin("g",g)
+    CALL getin("omega",omega)  
     CALL getin("scale_factor",scale_factor)
-    CALL getin("omega",omega)  
-    CALL getin("kappa",kappa)  
-    CALL getin("cpp",cpp)  
+    radius=radius/scale_factor
+    omega=omega*scale_factor
+
+    CALL getin("kappa",kappa)
+    CALL getin("cpp",cpp)
     CALL getin("cppv",cppv)
     CALL getin("Rv",Rv)
-    CALL getin("preff",preff)  
-    CALL getin("Treff",Treff)  
+    CALL getin("preff",preff)
+    CALL getin("Treff",Treff)
     CALL getin("scale_height",scale_height)
-    
-    mu=kappa/cpp
-    radius=radius/scale_factor
-    omega=omega*scale_factor
-    
+    Rd = kappa*cpp ! kappa = Rd/Cp
+    mu = kappa/cpp ! FIXME ??
+
+    nqdyn=1
+    physics_thermo = thermo_none
+
+    def='theta'
+    CALL getin('thermo',def)
+    SELECT CASE(TRIM(def))
+    CASE('boussinesq')
+       boussinesq=.TRUE.
+       caldyn_thermo=thermo_boussinesq
+    CASE('theta')
+       caldyn_thermo=thermo_theta
+       physics_thermo=thermo_dry
+    CASE('entropy')
+       caldyn_thermo=thermo_entropy
+       physics_thermo=thermo_dry
+    CASE('variable_Cp')
+       caldyn_thermo=thermo_variable_Cp
+       physics_thermo=thermo_variable_Cp
+       CALL getin("nu",nu)
+    CASE('theta_fake_moist')
+       caldyn_thermo=thermo_theta
+       physics_thermo=thermo_fake_moist
+    CASE('entropy_fake_moist')
+       caldyn_thermo=thermo_entropy
+       physics_thermo=thermo_fake_moist
+    CASE('moist')
+       caldyn_thermo=thermo_moist_debug
+       physics_thermo=thermo_moist
+       nqdyn = 2
+    CASE DEFAULT
+       IF (is_mpi_root) PRINT *,'Bad selector for variable caldyn_thermo : <', &
+            TRIM(def),'> options are <theta>, <entropy>'
+       STOP
+    END SELECT
+
+    IF(is_master) THEN
+       SELECT CASE(caldyn_thermo)
+       CASE(thermo_theta)
+          PRINT *, 'caldyn_thermo = thermo_theta'
+       CASE(thermo_entropy)
+          PRINT *, 'caldyn_thermo = thermo_entropy'
+       CASE(thermo_moist_debug)
+          PRINT *, 'caldyn_thermo = thermo_moist_debug'
+       CASE DEFAULT
+          STOP
+       END SELECT
+
+       SELECT CASE(physics_thermo)
+       CASE(thermo_dry)
+          PRINT *, 'physics_thermo = thermo_dry'
+       CASE(thermo_fake_moist)
+          PRINT *, 'physics_thermo = thermo_fake_moist'
+       CASE(thermo_moist)
+          PRINT *, 'physics_thermo = thermo_moist'
+       END SELECT
+
+    END IF
+
   END SUBROUTINE init_earth_const
-  
-  
+
 END MODULE earth_const
Index: codes/icosagcm/devel/src/dynamics/caldyn_vars.f90
===================================================================
--- codes/icosagcm/devel/src/dynamics/caldyn_vars.f90	(revision 833)
+++ codes/icosagcm/devel/src/dynamics/caldyn_vars.f90	(revision 834)
@@ -1,4 +1,4 @@
 MODULE caldyn_vars_mod
-  USE icosa
+  USE field_mod
   USE transfert_mod
   IMPLICIT NONE
@@ -8,13 +8,11 @@
   INTEGER, PUBLIC, PARAMETER :: conserv_energy=1, conserv_enstrophy=2, conserv_gassmann=3, &
        kinetic_trisk=1, kinetic_consistent=2, &
-       caldyn_vert_noncons=1, caldyn_vert_cons=2, &
-       thermo_none=-99, thermo_theta=1, thermo_entropy=2, &
-       thermo_moist=3, thermo_boussinesq=4, thermo_dry=10, thermo_fake_moist=11, thermo_moist_debug=100
+       caldyn_vert_noncons=1, caldyn_vert_cons=2
 
-  INTEGER, PUBLIC :: caldyn_conserv, caldyn_kinetic, caldyn_thermo, caldyn_vert_variant, physics_thermo
-  !$OMP THREADPRIVATE(caldyn_conserv, caldyn_kinetic, caldyn_thermo, caldyn_vert_variant, physics_thermo)
+  INTEGER, PUBLIC :: caldyn_conserv, caldyn_kinetic, caldyn_vert_variant
+  !$OMP THREADPRIVATE(caldyn_conserv, caldyn_kinetic, caldyn_vert_variant)
 
-  LOGICAL, PUBLIC :: boussinesq, hydrostatic
-  !$OMP THREADPRIVATE(boussinesq, hydrostatic)
+  LOGICAL, PUBLIC :: hydrostatic
+  !$OMP THREADPRIVATE(hydrostatic)
 
   LOGICAL, PUBLIC :: dysl, dysl_geopot, dysl_pvort_only, dysl_caldyn_fast, dysl_caldyn_coriolis, dysl_slow_hydro, dysl_caldyn_vert
Index: codes/icosagcm/devel/src/initial/etat0_dcmip4.f90
===================================================================
--- codes/icosagcm/devel/src/initial/etat0_dcmip4.f90	(revision 833)
+++ codes/icosagcm/devel/src/initial/etat0_dcmip4.f90	(revision 834)
@@ -1,4 +1,4 @@
 MODULE etat0_dcmip4_mod
-  USE icosa
+  USE icosa, ignore_Rd=>Rd ! avoid name conflict with Rd from earth_const
   IMPLICIT NONE
   PRIVATE
Index: codes/icosagcm/devel/src/initial/etat0_dcmip5.f90
===================================================================
--- codes/icosagcm/devel/src/initial/etat0_dcmip5.f90	(revision 833)
+++ codes/icosagcm/devel/src/initial/etat0_dcmip5.f90	(revision 834)
@@ -1,4 +1,4 @@
 MODULE etat0_dcmip5_mod
-  USE icosa
+  USE icosa, ignore_Rd=>Rd ! avoid name conflict with Rd from earth_const                                                                                                                                  
   IMPLICIT NONE
   PRIVATE
Index: codes/icosagcm/devel/src/initial/etat0_jablonowsky06.f90
===================================================================
--- codes/icosagcm/devel/src/initial/etat0_jablonowsky06.f90	(revision 833)
+++ codes/icosagcm/devel/src/initial/etat0_jablonowsky06.f90	(revision 834)
@@ -1,5 +1,4 @@
 MODULE etat0_jablonowsky06_mod
-  USE icosa
-  PRIVATE
+  USE icosa, ignore_Rd=>Rd ! avoid name conflict with Rd from earth_const                                                                                                                                    PRIVATE
   REAL(rstd),PARAMETER :: eta0=0.252
   REAL(rstd),PARAMETER :: etat=0.2
