Index: CONFIG_DEVT/LMDZOR_V6.2_work_ENSEMBLES/modeles/ORCHIDEE/src_parallel/mod_orchidee_ensemble.F90
===================================================================
--- CONFIG_DEVT/LMDZOR_V6.2_work_ENSEMBLES/modeles/ORCHIDEE/src_parallel/mod_orchidee_ensemble.F90	(revision 5493)
+++ CONFIG_DEVT/LMDZOR_V6.2_work_ENSEMBLES/modeles/ORCHIDEE/src_parallel/mod_orchidee_ensemble.F90	(revision 5493)
@@ -0,0 +1,55 @@
+MODULE mod_orchidee_ensemble
+  
+  LOGICAL,SAVE :: ensemble_management         ! true if ensemble is managed
+                                              ! that's mean one additionnal dimension is added to output
+  INTEGER,SAVE :: COMM_ORCHIDEE_ENSEMBLE      ! MPI communicator for the ensemble pool
+  INTEGER,SAVE :: whole_ensemble_size         ! number of members in whole ensemble
+  INTEGER,SAVE :: whole_ensemble_rank         ! local member number in whole ensemble
+  
+  
+CONTAINS
+
+  SUBROUTINE init_orchidee_ensemble(ensemble_communicator, member_communicator)
+  USE ioipsl
+  USE mod_orchidee_para_var
+  IMPLICIT NONE
+    INTEGER, INTENT(IN)  :: ensemble_communicator          ! communicator of pool ensemble
+    INTEGER, INTENT(OUT) :: member_communicator            ! returned communicator for local member
+    INTEGER              :: ensemble_comm_size
+    INTEGER              :: ensemble_comm_rank
+    INTEGER              :: ensemble_pool_rank
+    INTEGER              :: ensemble_pool_size
+    INTEGER              :: member_size
+    INTEGER              :: ensemble_rank
+    INTEGER              :: ierr
+ 
+  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
+  !! SPLIT COMMUNICATOR FOR ENSEMBLE         !!!
+  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+     PRINT*,"initialize ensemble"
+     COMM_ORCHIDEE_ENSEMBLE = ensemble_communicator
+     ensemble_pool_size = 1
+     CALL getin("ensemble_pool_size", ensemble_pool_size)
+     whole_ensemble_size=ensemble_pool_size
+     CALL getin("whole_ensemble_size", whole_ensemble_size)
+     ensemble_management=.FALSE.
+     IF (whole_ensemble_size==1) ensemble_management=.TRUE. 
+     ensemble_pool_rank=0
+     CALL getin("ensemble_pool_rank", ensemble_pool_rank)
+     
+     CALL MPI_COMM_SIZE(COMM_ORCHIDEE_ENSEMBLE,ensemble_comm_size,ierr)
+     CALL MPI_COMM_RANK(COMM_ORCHIDEE_ENSEMBLE,ensemble_comm_rank,ierr)
+     PRINT*,ensemble_comm_size,ensemble_comm_rank
+     IF (MOD(ensemble_comm_size,ensemble_pool_size)/=0) THEN
+      WRITE(numout,*) 'init_orchidee_ensemble : Nb of MPI processes in whole ensemble is not divisible by the size of ensemble'
+      STOP 'init_orchidee_ensemble'
+     ENDIF  
+     member_size = ensemble_comm_size/ensemble_pool_size
+     ensemble_rank = ensemble_comm_rank/member_size
+     CALL MPI_COMM_SPLIT(COMM_ORCHIDEE_ENSEMBLE, ensemble_rank, ensemble_comm_rank, member_communicator,ierr)
+     whole_ensemble_rank = ensemble_pool_rank*ensemble_pool_size + ensemble_rank       
+   
+   END SUBROUTINE  init_orchidee_ensemble
+
+
+END MODULE mod_orchidee_ensemble
Index: CONFIG_DEVT/LMDZOR_V6.2_work_ENSEMBLES/modeles/ORCHIDEE/src_parallel/mod_orchidee_para.F90
===================================================================
--- CONFIG_DEVT/LMDZOR_V6.2_work_ENSEMBLES/modeles/ORCHIDEE/src_parallel/mod_orchidee_para.F90	(revision 5492)
+++ CONFIG_DEVT/LMDZOR_V6.2_work_ENSEMBLES/modeles/ORCHIDEE/src_parallel/mod_orchidee_para.F90	(revision 5493)
@@ -128,6 +128,6 @@
   !! \n
   !_ ============================================================================================================================== 
-  SUBROUTINE Init_orchidee_data_para(nbp,kindex,arg_offset,arg_omp_size,arg_omp_rank,COMM)
-
+  SUBROUTINE Init_orchidee_data_para(nbp,kindex,arg_offset,arg_omp_size,arg_omp_rank, COMM_ENSEMBLE)
+    USE mod_orchidee_ensemble
     IMPLICIT NONE
     INTEGER,INTENT(IN)     :: nbp
@@ -136,5 +136,5 @@
     INTEGER,INTENT(IN)     :: arg_omp_size
     INTEGER,INTENT(IN)     :: arg_omp_rank
-    INTEGER,INTENT(IN)     :: COMM
+    INTEGER,INTENT(IN)     :: COMM_ENSEMBLE
     
     INTEGER,SAVE              :: arg_nbp_mpi
@@ -144,5 +144,10 @@
     INTEGER                   :: mpi_rank
     INTEGER                   :: ierr
-        
+    INTEGER,SAVE              :: COMM
+       
+    
+    IF (arg_omp_rank==0) CALL init_orchidee_ensemble(COMM_ENSEMBLE,COMM)
+    CALL barrier2_omp()
+
 #ifdef CPP_PARA
     CALL MPI_COMM_SIZE(COMM,mpi_size,ierr)
Index: CONFIG_DEVT/LMDZOR_V6.2_work_ENSEMBLES/modeles/ORCHIDEE/src_parallel/xios_orchidee.f90
===================================================================
--- CONFIG_DEVT/LMDZOR_V6.2_work_ENSEMBLES/modeles/ORCHIDEE/src_parallel/xios_orchidee.f90	(revision 5492)
+++ CONFIG_DEVT/LMDZOR_V6.2_work_ENSEMBLES/modeles/ORCHIDEE/src_parallel/xios_orchidee.f90	(revision 5493)
@@ -130,4 +130,5 @@
     USE grid, ONLY : grid_type, unstructured, regular_lonlat, regular_xy, nvertex, &
                      longitude, latitude, bounds_lon, bounds_lat, ind_cell_glo
+    USE mod_orchidee_ensemble, ONLY : ensemble_management, whole_ensemble_size, whole_ensemble_rank, COMM_ORCHIDEE_ENSEMBLE
     IMPLICIT NONE
     !
@@ -271,5 +272,5 @@
        !! 2. Context initialization
        !
-       CALL xios_context_initialize("orchidee",MPI_COMM_ORCH)
+       CALL xios_context_initialize("orchidee",COMM_ORCHIDEE_ENSEMBLE)
        CALL xios_get_handle("orchidee",ctx_hdl_orchidee)
        CALL xios_set_current_context(ctx_hdl_orchidee)
@@ -352,4 +353,6 @@
        !! 4. Axis definition
        !
+       CALL xios_set_axis_attr("ensemble",n_glo=whole_ensemble_size,begin=whole_ensemble_rank, n=1)
+ 
        CALL xios_set_axis_attr("nvm",n_glo=nvm ,VALUE=(/(REAL(i,r_std),i=1,nvm)/))
        CALL xios_set_axis_attr("nlut",n_glo=nlut ,VALUE=(/(REAL(i,r_std),i=1,nlut)/))
