Index: LMDZ.3.3/branches/rel-LF/libf/phylmd/oasis.psmile
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/phylmd/oasis.psmile	(revision 500)
+++ LMDZ.3.3/branches/rel-LF/libf/phylmd/oasis.psmile	(revision 544)
@@ -20,8 +20,8 @@
    integer, dimension(jpfldo2a), save              :: in_var_id
    integer, dimension(jpflda2o1+jpflda2o2), save  :: il_out_var_id
-   CHARACTER (len=8), dimension(jpmaxfld), save   :: cl_writ, cl_read
+   CHARACTER (len=8), dimension(jpmaxfld), public, save   :: cl_writ, cl_read
    CHARACTER (len=8), dimension(jpmaxfld), save   :: cl_f_writ, cl_f_read
 
-CONTAINS
+	CONTAINS
 
 !****
@@ -58,9 +58,9 @@
 !
    integer                                  :: comp_id
-   integer                                  :: ierror
+   integer                                  :: ierror, il_commlocal
    integer                                  :: il_part_id
    integer, dimension(:), allocatable       :: ig_paral
-   integer, dimension(jpfldo2a)             :: in_var_id
-   integer, dimension(jpflda2o1+jpflda2o2)  :: il_out_var_id
+!   integer, dimension(jpfldo2a)             :: in_var_id
+!   integer, dimension(jpflda2o1+jpflda2o2)  :: il_out_var_id
    integer, dimension(2)                    :: il_var_nodims
    integer, dimension(4)                    :: il_var_actual_shape
@@ -103,4 +103,7 @@
    ENDIF
 
+! PSMILe attribution of local communicator
+!
+   call prism_get_localcomm_proto (il_commlocal, ierror)
 !
 ! and domain decomposition
@@ -108,9 +111,14 @@
 ! monoproc case
 !
-   allocate(ig_paral(3))
-   ig_paral(1) = 0
-   ig_paral(2) = 0
-   ig_paral(3) = im * jm
-
+!   allocate(ig_paral(3))
+!   ig_paral(1) = 0
+!   ig_paral(2) = 0
+!   ig_paral(3) = im * jm
+   allocate(ig_paral(5))
+   ig_paral (1) = 2
+   ig_paral (2) = 0
+   ig_paral (3) = im
+   ig_paral (4) = jm
+   ig_paral (5) = im
    call prism_def_partition_proto (il_part_id, ig_paral, ierror)
    deallocate(ig_paral)
@@ -238,5 +246,8 @@
 
    call prism_get_proto(in_var_id(1), kt, sst, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Recvd .and. &
+ &     ierror.ne.PRISM_FromRest &
+ &     .and. ierror.ne.PRISM_Input .and. ierror.ne.PRISM_RecvOut &
+ &     .and. ierror.ne.PRISM_FromRestOut ) THEN
      WRITE (nuout,*)  cl_read(1), kt   
      abort_message=' Probleme dans prism_get_proto '
@@ -244,5 +255,8 @@
    endif
    call prism_get_proto(in_var_id(2), kt, gla, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Recvd .and. &
+ &     ierror.ne.PRISM_FromRest &
+ &     .and. ierror.ne.PRISM_Input .and. ierror.ne.PRISM_RecvOut &
+ &     .and. ierror.ne.PRISM_FromRestOut ) THEN
      WRITE (nuout,*)  cl_read(2), kt   
      abort_message=' Probleme dans prism_get_proto '
@@ -250,5 +264,8 @@
    endif
    call prism_get_proto(in_var_id(3), kt, albedo, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Recvd .and. &
+ &     ierror.ne.PRISM_FromRest &
+ &     .and. ierror.ne.PRISM_Input .and. ierror.ne.PRISM_RecvOut &
+ &     .and. ierror.ne.PRISM_FromRestOut ) THEN
      WRITE (nuout,*)  cl_read(3), kt   
      abort_message=' Probleme dans prism_get_proto '
@@ -256,5 +273,8 @@
    endif
    call prism_get_proto(in_var_id(4), kt, tice, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Recvd .and. &
+ &     ierror.ne.PRISM_FromRest &
+ &     .and. ierror.ne.PRISM_Input .and. ierror.ne.PRISM_RecvOut &
+ &     .and. ierror.ne.PRISM_FromRestOut ) THEN
      WRITE (nuout,*)  cl_read(4), kt   
      abort_message=' Probleme dans prism_get_proto '
@@ -306,5 +326,7 @@
 
    call prism_put_proto(il_out_var_id(1), kt, fsolice, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(1), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -312,5 +334,7 @@
    endif
    call prism_put_proto(il_out_var_id(2), kt, fsolwat, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(2), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -318,5 +342,7 @@
    endif
    call prism_put_proto(il_out_var_id(3), kt, fnsolice, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(3), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -324,5 +350,7 @@
    endif
    call prism_put_proto(il_out_var_id(4), kt, fnsolwat, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(4), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -330,5 +358,7 @@
    endif
    call prism_put_proto(il_out_var_id(5), kt, fnsicedt, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(5), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -336,5 +366,7 @@
    endif
    call prism_put_proto(il_out_var_id(6), kt, evice, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(6), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -342,5 +374,7 @@
    endif
    call prism_put_proto(il_out_var_id(7), kt, evwat, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(7), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -348,5 +382,7 @@
    endif
    call prism_put_proto(il_out_var_id(8), kt, lpre, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(8), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -354,5 +390,7 @@
    endif
    call prism_put_proto(il_out_var_id(9), kt, spre, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(9), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -360,5 +398,7 @@
    endif
    call prism_put_proto(il_out_var_id(10), kt, dirunoff, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(10), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -366,5 +406,7 @@
    endif
    call prism_put_proto(il_out_var_id(11), kt, rivrunoff, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(11), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -372,5 +414,7 @@
    endif
    call prism_put_proto(il_out_var_id(12), kt, calving, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(12), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -378,5 +422,7 @@
    endif
    call prism_put_proto(il_out_var_id(13), kt, tauxx_u, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(13), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -384,5 +430,7 @@
    endif
    call prism_put_proto(il_out_var_id(14), kt, tauyy_u, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(14), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -390,5 +438,7 @@
    endif
    call prism_put_proto(il_out_var_id(15), kt, tauzz_u, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(15), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -396,5 +446,7 @@
    endif
    call prism_put_proto(il_out_var_id(16), kt, tauxx_v, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(16), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -402,5 +454,7 @@
    endif
    call prism_put_proto(il_out_var_id(17), kt, tauyy_v, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(17), kt   
      abort_message=' Probleme dans prism_put_proto '
@@ -408,5 +462,7 @@
    endif
    call prism_put_proto(il_out_var_id(18), kt, tauzz_v, ierror)
-   IF (ierror .ne. PRISM_Ok) THEN
+   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
+ &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
+ &     ierror.ne.PRISM_SentOut .and. ierror.ne.PRISM_ToRestOut ) THEN
      WRITE (nuout,*)  cl_writ(18), kt   
      abort_message=' Probleme dans prism_put_proto '
