Index: /dynamico_lmdz/simple_physics/phyparam/dynphy_lonlat/iniphysiq_mod.F90
===================================================================
--- /dynamico_lmdz/simple_physics/phyparam/dynphy_lonlat/iniphysiq_mod.F90	(revision 4221)
+++ /dynamico_lmdz/simple_physics/phyparam/dynphy_lonlat/iniphysiq_mod.F90	(revision 4222)
@@ -3,92 +3,135 @@
 !
 MODULE iniphysiq_mod
+  IMPLICIT NONE
+  
+CONTAINS
+  
+  SUBROUTINE iniphysiq(iim,jjm,nlayer, &
+       &               nbp, communicator, &
+       &               punjours, pdayref,ptimestep, &
+       &               rlatu,rlatv,rlonu,rlonv,aire,cu,cv, &
+       &               prad,pg,pr,pcpp,iflag_phys)
+    USE dimphy, ONLY: init_dimphy
+    USE inigeomphy_mod, ONLY: inigeomphy
+    USE iniphyparam_mod, ONLY : iniphyparam
+    USE mod_phys_lmdz_para, ONLY: klon_omp ! number of columns (on local omp grid)
+    USE infotrac, ONLY: nqtot, type_trac
+    USE infotrac_phy, ONLY: init_infotrac_phy
+    USE inifis_mod, ONLY: inifis
+    USE phyaqua_mod, ONLY: iniaqua
+    USE nrtype, ONLY: pi
+    
+    !
+    !=======================================================================
+    !   Initialisation of the physical constants and some positional and 
+    !   geometrical arrays for the physics
+    !=======================================================================    
+    
+    include "iniprint.h"
+    
+    REAL,INTENT(IN) :: prad ! radius of the planet (m)
+    REAL,INTENT(IN) :: pg ! gravitational acceleration (m/s2)
+    REAL,INTENT(IN) :: pr ! ! reduced gas constant R/mu
+    REAL,INTENT(IN) :: pcpp ! specific heat Cp
+    REAL,INTENT(IN) :: punjours ! length (in s) of a standard day
+    INTEGER, INTENT (IN) :: nlayer ! number of atmospheric layers
+    INTEGER, INTENT (IN) :: iim ! number of atmospheric coulumns along longitudes
+    INTEGER, INTENT (IN) :: jjm  ! number of atompsheric columns along latitudes
+    INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process
+    INTEGER, INTENT(IN) :: communicator ! MPI communicator
+    REAL, INTENT (IN) :: rlatu(jjm+1) ! latitudes of the physics grid
+    REAL, INTENT (IN) :: rlatv(jjm) ! latitude boundaries of the physics grid
+    REAL, INTENT (IN) :: rlonv(iim+1) ! longitudes of the physics grid
+    REAL, INTENT (IN) :: rlonu(iim+1) ! longitude boundaries of the physics grid
+    REAL, INTENT (IN) :: aire(iim+1,jjm+1) ! area of the dynamics grid (m2)
+    REAL, INTENT (IN) :: cu((iim+1)*(jjm+1)) ! cu coeff. (u_covariant = cu * u)
+    REAL, INTENT (IN) :: cv((iim+1)*jjm) ! cv coeff. (v_covariant = cv * v)
+    INTEGER, INTENT (IN) :: pdayref ! reference day of for the simulation
+    REAL,INTENT(IN) :: ptimestep !physics time step (s)
+    INTEGER,INTENT(IN) :: iflag_phys ! type of physics to be called
+    
+    INTEGER :: ibegin,iend,offset
+    INTEGER :: i,j,k
+    CHARACTER (LEN=20) :: modname='iniphysiq'
+    CHARACTER (LEN=80) :: abort_message
+    
+    
+    print*,'INInnn   iniphysiq_mod'
+    
+    ! --> initialize physics distribution, global fields and geometry
+    ! (i.e. things in phy_common or dynphy_lonlat)
+    CALL inigeomphy(iim,jjm,nlayer, &
+         nbp, communicator, &
+         rlatu,rlatv, &
+         rlonu,rlonv, &
+         aire,cu,cv)
+    
+    ! --> now initialize things specific to the phydev physics package
+    
+    !$OMP PARALLEL 
+    
+    ! Initialize physical constants in physics:
+    CALL inifis(prad,pg,pr,pcpp)
+    
+    ! Initialize tracer names, numbers, etc. for physics
+    CALL init_infotrac_phy(nqtot,type_trac)
+    
+    ! Additional initializations for aquaplanets 
+    IF (iflag_phys>=100) THEN
+       CALL iniaqua(klon_omp,iflag_phys)
+    ENDIF
 
-CONTAINS
+    CALL setup_phyparam
 
-SUBROUTINE iniphysiq(iim,jjm,nlayer, &
-                     nbp, communicator, &
-                     punjours, pdayref,ptimestep, &
-                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv, &
-                     prad,pg,pr,pcpp,iflag_phys)
-  USE dimphy, ONLY: init_dimphy
-  USE inigeomphy_mod, ONLY: inigeomphy
-  USE iniphyparam_mod, ONLY : iniphyparam
-  USE mod_phys_lmdz_para, ONLY: klon_omp ! number of columns (on local omp grid)
-  USE infotrac, ONLY: nqtot, type_trac
-  USE infotrac_phy, ONLY: init_infotrac_phy
-  USE inifis_mod, ONLY: inifis
-  USE phyaqua_mod, ONLY: iniaqua
-  USE nrtype, ONLY: pi
-  IMPLICIT NONE
+    CALL iniphyparam(klon_omp,nlayer, &
+         punjours, &
+         pdayref,ptimestep, &
+         prad,pg,pr,pcpp)
+    
+    !$OMP END PARALLEL
+   
+    
+  END SUBROUTINE iniphysiq
+  
+  SUBROUTINE setup_phyparam
+    USE comgeomfi,          ONLY : nlayermx, init_comgeomfi
+    USE dimphy,             ONLY : klon, klev
+    USE mod_grid_phy_lmdz,  ONLY : klon_glo
+    USE mod_phys_lmdz_para, ONLY : klon_omp
+    USE geometry_mod,       ONLY : longitude,latitude
+    USE read_param_mod
+    USE phyparam_plugins_lmdz
 
-  !
-  !=======================================================================
-  !   Initialisation of the physical constants and some positional and 
-  !   geometrical arrays for the physics
-  !=======================================================================
- 
- 
-  include "iniprint.h"
+    read_paramr_plugin => read_paramr
+    read_parami_plugin => read_parami
+    read_paramb_plugin => read_paramb
 
-  REAL,INTENT(IN) :: prad ! radius of the planet (m)
-  REAL,INTENT(IN) :: pg ! gravitational acceleration (m/s2)
-  REAL,INTENT(IN) :: pr ! ! reduced gas constant R/mu
-  REAL,INTENT(IN) :: pcpp ! specific heat Cp
-  REAL,INTENT(IN) :: punjours ! length (in s) of a standard day
-  INTEGER, INTENT (IN) :: nlayer ! number of atmospheric layers
-  INTEGER, INTENT (IN) :: iim ! number of atmospheric coulumns along longitudes
-  INTEGER, INTENT (IN) :: jjm  ! number of atompsheric columns along latitudes
-  INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process
-  INTEGER, INTENT(IN) :: communicator ! MPI communicator
-  REAL, INTENT (IN) :: rlatu(jjm+1) ! latitudes of the physics grid
-  REAL, INTENT (IN) :: rlatv(jjm) ! latitude boundaries of the physics grid
-  REAL, INTENT (IN) :: rlonv(iim+1) ! longitudes of the physics grid
-  REAL, INTENT (IN) :: rlonu(iim+1) ! longitude boundaries of the physics grid
-  REAL, INTENT (IN) :: aire(iim+1,jjm+1) ! area of the dynamics grid (m2)
-  REAL, INTENT (IN) :: cu((iim+1)*(jjm+1)) ! cu coeff. (u_covariant = cu * u)
-  REAL, INTENT (IN) :: cv((iim+1)*jjm) ! cv coeff. (v_covariant = cv * v)
-  INTEGER, INTENT (IN) :: pdayref ! reference day of for the simulation
-  REAL,INTENT(IN) :: ptimestep !physics time step (s)
-  INTEGER,INTENT(IN) :: iflag_phys ! type of physics to be called
+    CALL init_comgeomfi(klon_omp, klev, longitude, latitude)
 
-  INTEGER :: ibegin,iend,offset
-  INTEGER :: i,j,k
-  CHARACTER (LEN=20) :: modname='iniphysiq'
-  CHARACTER (LEN=80) :: abort_message
+    IF (klon.NE.klon_omp) THEN
+       PRINT*,'STOP in setup_phyparam'
+       PRINT*,'Probleme de dimensions :'
+       PRINT*,'klon     = ',klon
+       PRINT*,'klon_omp   = ',klon_omp
+       STOP
+    ENDIF
 
+    IF (klev.NE.nlayermx) THEN
+       PRINT*,'STOP in setup_phyparam'
+       PRINT*,'Probleme de dimensions :'
+       PRINT*,'nlayer     = ',klev
+       PRINT*,'nlayermx   = ',nlayermx
+       STOP
+    ENDIF
 
-  print*,'INInnn   iniphysiq_mod'
+    IF (klon_omp.NE.klon_glo) THEN
+       PRINT*,'STOP in setup_phyparam'
+       PRINT*,'Probleme de dimensions :'
+       PRINT*,'ngrid     = ', klon_omp
+       PRINT*,'ngridmax   = ',klon_glo
+       STOP
+    ENDIF
 
-  ! --> initialize physics distribution, global fields and geometry
-  ! (i.e. things in phy_common or dynphy_lonlat)
-  CALL inigeomphy(iim,jjm,nlayer, &
-               nbp, communicator, &
-               rlatu,rlatv, &
-               rlonu,rlonv, &
-               aire,cu,cv)
-
-  ! --> now initialize things specific to the phydev physics package
-
-!$OMP PARALLEL 
-
-  ! Initialize physical constants in physics:
-  CALL inifis(prad,pg,pr,pcpp)
+  END SUBROUTINE setup_phyparam
   
-  ! Initialize tracer names, numbers, etc. for physics
-  CALL init_infotrac_phy(nqtot,type_trac)
-
-  ! Additional initializations for aquaplanets 
-  IF (iflag_phys>=100) THEN
-    CALL iniaqua(klon_omp,iflag_phys)
-  ENDIF
-  CALL iniphyparam(klon_omp,nlayer, &
-             punjours, &
-             pdayref,ptimestep, &
-             prad,pg,pr,pcpp)
-
-!$OMP END PARALLEL
-   
-
-END SUBROUTINE iniphysiq
-
 END MODULE iniphysiq_mod
Index: /dynamico_lmdz/simple_physics/phyparam/param/iniphyparam.F90
===================================================================
--- /dynamico_lmdz/simple_physics/phyparam/param/iniphyparam.F90	(revision 4221)
+++ /dynamico_lmdz/simple_physics/phyparam/param/iniphyparam.F90	(revision 4222)
@@ -3,5 +3,5 @@
   PRIVATE
 
-  REAL, PARAMETER :: perfect_gas_const = 8134.
+  REAL, PARAMETER :: perfect_gas_const = 8314.46261815324 ! NB using g instead of kg for mass
 
   PUBLIC :: iniphyparam
@@ -13,11 +13,5 @@
        &           pdayref,ptimestep,     &
        &           prad,pg,pr,pcpp)
-    use getparam
-    use dimphy
-    USE mod_grid_phy_lmdz
-    USE mod_phys_lmdz_para
     USE callkeys
-    use comgeomfi
-    USE geometry_mod, ONLY : longitude,latitude
     USE phys_const, ONLY : planet_rad,g,r,cpp,rcp,dtphys,unjours,mugaz
     USE planet, ONLY : coefir, coefvis
@@ -26,61 +20,22 @@
     USE surface
     USE read_param_mod
-    USE phyparam_plugins_lmdz
 
-    IMPLICIT NONE
-    
-    !    ngrid                 Size of the horizontal grid.
-    !                          All internal loops are performed on that grid.
-    !    nlayer                Number of vertical layers.
-    !    pdayref               Day of reference for the simulation
-    !    firstcall             True at the first call
-    !    lastcall              True at the last call
-    !    pday                  Number of days counted from the North. Spring
-    !                          equinox
-
-    REAL prad,pg,pr,pcpp,punjours
-    
-    INTEGER ngrid, nlayer, pdayref
-    
-    REAL ptimestep
+    INTEGER, INTENT(IN) :: &
+         ngrid, &       ! Size of the horizontal grid
+         nlayer, &      ! Number of vertical layers.
+         pdayref        ! Day of reference for the simulation
+    REAL, INTENT(IN)  :: ptimestep, prad, pg, pr, pcpp, punjours
     
     print*,'INIPHYPARAM'
-    
-    read_paramr_plugin => read_paramr
-    read_parami_plugin => read_parami
-    read_paramb_plugin => read_paramb
+    print*,'Avant les getpar '
 
-    CALL init_comgeomfi(klon_omp, klev, longitude, latitude)
-    
-    IF (klon.NE.klon_omp) THEN
-       PRINT*,'STOP in iniphyparam'
-       PRINT*,'Probleme de dimensions :'
-       PRINT*,'klon     = ',klon
-       PRINT*,'klon_omp   = ',klon_omp
-       STOP
-    ENDIF
-    
-    IF (nlayer.NE.nlayermx) THEN
-       PRINT*,'STOP in iniphyparam'
-       PRINT*,'Probleme de dimensions :'
-       PRINT*,'nlayer     = ',nlayer
-       PRINT*,'nlayermx   = ',nlayermx
-       STOP
-    ENDIF
-    
-    IF (ngrid.NE.klon_glo) THEN
-       PRINT*,'STOP in iniphyparam'
-       PRINT*,'Probleme de dimensions :'
-       PRINT*,'ngrid     = ',ngrid
-       PRINT*,'ngridmax   = ',klon_glo
-       STOP
-    ENDIF
-    
-    print*,'Avant les getpar '
     CALL read_param('unjours', 86400., unjours,'unjours')
-    CALL read_param('planet_rad',6.4e6,planet_rad,'planet_rad')
+    CALL read_param('planet_rad',prad,planet_rad,'planet_rad')
     CALL read_param('g',9.8           ,g,'g')
     CALL read_param('cpp',1004.       ,cpp,'cpp')
     CALL read_param('mugaz',28.       ,mugaz,'mugaz')
+    r=perfect_gas_const/mugaz
+    rcp=r/cpp
+
     CALL read_param('year_day',360.   ,year_day,'year_day')
     CALL read_param('periheli',150.   ,periheli,'periheli')
@@ -111,5 +66,12 @@
     CALL read_param('period_sort',1.,period_sort,'period sorties en jour')
     
+    CALL check_mismatch('unjours', punjours, unjours)
+    CALL check_mismatch('rad', prad, planet_rad)
+    CALL check_mismatch('g', pg, g)
+    CALL check_mismatch('R', pr, r)
+    CALL check_mismatch('cpp', pcpp, cpp)
+    
     print*,'Activation de la physique:'
+    print*,' R=',r
     print*,' Rayonnement ',callrad
     print*,' Diffusion verticale turbulente ', calldifv
@@ -129,21 +91,16 @@
          &   iradia,' physical time-step or each ', &
          &   iradia*ptimestep,' seconds'
-    
-    !-----------------------------------------------------------------------
-    
-    print*,'latitude0  ohe',latitude(1:3),latitude(klon_omp)
-    print*,'OK17 AAA'
-    
-    prad=planet_rad
-    pg=g
-    r=perfect_gas_const/mugaz
-    print*,'R=',r
-    pr=r
-    pcpp=cpp
-    rcp=r/cpp
+
     dtphys=ptimestep
-    punjours=unjours
-    
+
   END SUBROUTINE iniphyparam
-  
+
+  SUBROUTINE check_mismatch(name, a,b)
+    CHARACTER(*), INTENT(IN) :: name
+    REAL, INTENT(IN) :: a,b
+    IF(a /= b) THEN
+       PRINT *, 'Phys/dyn mismatch for ', name, ' : ',a,b
+    END IF
+  END SUBROUTINE check_mismatch
+
 END MODULE iniphyparam_mod
