MODULE dimphy
  
  INTEGER,SAVE :: klon
  INTEGER,SAVE :: kdlon
  INTEGER,SAVE :: kfdia
  INTEGER,SAVE :: kidia
  INTEGER,SAVE :: klev ! number of atmospheric layers
  INTEGER,SAVE :: klevp1
  INTEGER,SAVE :: klevm1
  INTEGER,SAVE :: nsoil ! number of surbsurface layers

!$OMP THREADPRIVATE(klon,kfdia,kidia,kdlon)

CONTAINS
  
  SUBROUTINE init_dimphy(klon0,klev0)
  IMPLICIT NONE
! to have access to nsoilmw ... should be improved...
#include"dimensions.h"
#include"dimphys.h"  
    INTEGER, INTENT(in) :: klon0
    INTEGER, INTENT(in) :: klev0
    
    klon=klon0
    
    kdlon=klon
    kidia=1
    kfdia=klon
!$OMP MASTER 
    klev=klev0
    klevp1=klev+1
    klevm1=klev-1
    nsoil=nsoilmx
!$OMP END MASTER    
    
  END SUBROUTINE init_dimphy

  
END MODULE dimphy
