Index: LMDZ5/trunk/libf/phylmd/iophy.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/iophy.F90	(revision 3002)
+++ LMDZ5/trunk/libf/phylmd/iophy.F90	(revision 3003)
@@ -921,5 +921,5 @@
 ! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE
   SUBROUTINE histwrite2d_phy(var,field, STD_iff)
-  USE dimphy, ONLY: klon
+  USE dimphy, ONLY: klon, klev
   USE mod_phys_lmdz_para, ONLY: gather_omp, grid1dto2d_mpi, &
                                 jj_nb, klon_mpi, klon_mpi_begin, &
@@ -984,11 +984,15 @@
 
     !Et sinon on.... écrit
-    IF (SIZE(field)/=klon) CALL abort_physic('iophy::histwrite2d_phy','Field first DIMENSION not equal to klon',1)
-    
+    IF (SIZE(field)/=klon .AND. SIZE(field)/=klev) CALL abort_physic('iophy::histwrite2d_phy','Field first DIMENSION not equal to klon/klev',1)    
     IF (prt_level >= 10) THEn
       WRITE (lunout,*)"histwrite2d_phy: .not.vars_defined ; time to gather and write ", trim(var%name)
     ENDIF
     
-    CALL Gather_omp(field,buffer_omp)
+    
+    IF (SIZE(field) == klon) then
+        CALL Gather_omp(field,buffer_omp)
+    ELSE
+        buffer_omp(:)=0.
+    ENDIF
 !$OMP MASTER
     CALL grid1Dto2D_mpi(buffer_omp,Field2d)
@@ -1002,5 +1006,9 @@
              write(lunout,*)'Dans iophy histwrite2D,var%name ', trim(var%name)                       
           ENDIF
-          CALL xios_send_field(var%name, Field2d)
+          IF (SIZE(field) == klon) then
+              CALL xios_send_field(var%name, Field2d)
+          ELSE
+             CALL xios_send_field(var%name, field)
+          ENDIF 
           IF (prt_level >= 10) THEN
              WRITE (lunout,*)'Dans iophy histwrite2D,var%name apres xios_send ', trim(var%name)                       
@@ -1019,5 +1027,9 @@
                      WRITE (lunout,*)"histwrite2d_phy:.NOT.clef_stations(iff)and iff==iff_beg, call xios_send_field"
                   ENDIF
-                  CALL xios_send_field(var%name, Field2d)
+                  IF (SIZE(field) == klon) then
+                     CALL xios_send_field(var%name, Field2d)
+                  ELSE
+                     CALL xios_send_field(var%name, field)
+                  ENDIF
                   firstx=.false.
                ENDIF
@@ -1129,5 +1141,7 @@
   ELSE
     !Et sinon on.... écrit
-    IF (SIZE(field,1)/=klon) CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
+
+    IF (SIZE(field,1)/=klon .AND. SIZE(field,1)/=klev) CALL abort_physic('iophy::histwrite3d_xios','Field first DIMENSION not equal to klon/klev',1)
+
     nlev=SIZE(field,2)
     IF (nlev.EQ.klev+1) THEN
@@ -1137,5 +1151,9 @@
     ENDIF
 
-    CALL Gather_omp(field,buffer_omp)
+    IF (SIZE(field,1) == klon) then
+        CALL Gather_omp(field,buffer_omp)
+    ELSE
+        buffer_omp(:,:)=0.
+    ENDIF
 !$OMP MASTER
     CALL grid1Dto2D_mpi(buffer_omp,field3d)
@@ -1151,5 +1169,9 @@
                              trim(var%name)                       
           ENDIF
-          CALL xios_send_field(var%name, Field3d(:,:,1:nlevx))
+          IF (SIZE(field,1) == klon) then
+             CALL xios_send_field(var%name, Field3d(:,:,1:nlevx))
+          ELSE
+             CALL xios_send_field(var%name, field)
+          ENDIF
 #else
         CALL abort_physic ('iophy','cannot have ok_all_xml = .T. without CPP_XIOS defined' ,1)
@@ -1169,6 +1191,10 @@
                                   nbp_lon,jj_nb,nlevx
                 ENDIF
-                CALL xios_send_field(var%name, Field3d(:,:,1:nlevx))
-                            firstx=.false.
+                IF (SIZE(field,1) == klon) then
+                    CALL xios_send_field(var%name, Field3d(:,:,1:nlevx))
+                ELSE
+                     CALL xios_send_field(var%name, field)
+                ENDIF
+                firstx=.false.
               ENDIF
 #endif
@@ -1226,5 +1252,5 @@
 #ifdef CPP_XIOS
   SUBROUTINE histwrite2d_xios(field_name,field)
-  USE dimphy, ONLY: klon
+  USE dimphy, ONLY: klon, klev
   USE mod_phys_lmdz_para, ONLY: gather_omp, grid1Dto2D_mpi, &
                                 is_sequential, klon_mpi_begin, klon_mpi_end, &
@@ -1249,9 +1275,14 @@
 
     !Et sinon on.... écrit
-    IF (SIZE(field)/=klon) CALL abort_physic('iophy::histwrite2d_xios','Field first DIMENSION not equal to klon',1)
-    
-    CALL Gather_omp(field,buffer_omp)    
+    IF (SIZE(field)/=klon .AND. SIZE(field)/=klev) CALL abort_physic('iophy::histwrite2d_xios','Field first DIMENSION not equal to klon/klev',1)
+    
+    IF (SIZE(field) == klev) then
 !$OMP MASTER
-    CALL grid1Dto2D_mpi(buffer_omp,Field2d)
+        CALL xios_send_field(field_name,field)
+!$OMP END MASTER   
+    ELSE
+        CALL Gather_omp(field,buffer_omp)    
+!$OMP MASTER
+        CALL grid1Dto2D_mpi(buffer_omp,Field2d)
     
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -1259,34 +1290,35 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     !IF(.NOT.clef_stations(iff)) THEN
-    IF (.TRUE.) THEN
-        ALLOCATE(index2d(nbp_lon*jj_nb))
-        ALLOCATE(fieldok(nbp_lon*jj_nb))
-
-
-        CALL xios_send_field(field_name, Field2d)
-
-    ELSE 
-        ALLOCATE(fieldok(npstn))
-        ALLOCATE(index2d(npstn))
-
-        IF (is_sequential) THEN
-            DO ip=1, npstn
-                fieldok(ip)=buffer_omp(nptabij(ip))
-            ENDDO
-        ELSE
-            DO ip=1, npstn
-                PRINT*,'histwrite2d_xios is_sequential npstn ip namenptabij',npstn,ip,field_name,nptabij(ip)
-                IF(nptabij(ip).GE.klon_mpi_begin.AND. &
-                nptabij(ip).LE.klon_mpi_end) THEN
-                    fieldok(ip)=buffer_omp(nptabij(ip)-klon_mpi_begin+1)
-                ENDIF
-            ENDDO
+        IF (.TRUE.) THEN
+            ALLOCATE(index2d(nbp_lon*jj_nb))
+            ALLOCATE(fieldok(nbp_lon*jj_nb))
+    
+    
+            CALL xios_send_field(field_name, Field2d)
+    
+        ELSE 
+            ALLOCATE(fieldok(npstn))
+            ALLOCATE(index2d(npstn))
+    
+            IF (is_sequential) THEN
+                DO ip=1, npstn
+                    fieldok(ip)=buffer_omp(nptabij(ip))
+                ENDDO
+            ELSE
+                DO ip=1, npstn
+                    PRINT*,'histwrite2d_xios is_sequential npstn ip namenptabij',npstn,ip,field_name,nptabij(ip)
+                    IF(nptabij(ip).GE.klon_mpi_begin.AND. &
+                    nptabij(ip).LE.klon_mpi_end) THEN
+                        fieldok(ip)=buffer_omp(nptabij(ip)-klon_mpi_begin+1)
+                    ENDIF
+                ENDDO
+            ENDIF
+    
         ENDIF
-
-    ENDIF
                   
-    DEALLOCATE(index2d)
-    DEALLOCATE(fieldok)
+        DEALLOCATE(index2d)
+        DEALLOCATE(fieldok)
 !$OMP END MASTER   
+    ENDIF
 
   IF (prt_level >= 10) WRITE(lunout,*)'End histrwrite2d_xios ',field_name
@@ -1318,11 +1350,17 @@
 
     !Et on.... écrit
-    IF (SIZE(field,1)/=klon) CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
-    nlev=SIZE(field,2)
-
-
-    CALL Gather_omp(field,buffer_omp)
+    IF (SIZE(field,1)/=klon .AND. SIZE(field,1)/=klev) CALL abort_physic('iophy::histwrite3d_xios','Field first DIMENSION not equal to klon/klev',1)
+    
+    IF (SIZE(field,1) == klev) then
 !$OMP MASTER
-    CALL grid1Dto2D_mpi(buffer_omp,field3d)
+        CALL xios_send_field(field_name,field)
+!$OMP END MASTER   
+    ELSE
+        nlev=SIZE(field,2)
+
+
+        CALL Gather_omp(field,buffer_omp)
+!$OMP MASTER
+        CALL grid1Dto2D_mpi(buffer_omp,field3d)
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -1330,34 +1368,35 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     !IF (.NOT.clef_stations(iff)) THEN
-    IF(.TRUE.)THEN
-        ALLOCATE(index3d(nbp_lon*jj_nb*nlev))
-        ALLOCATE(fieldok(nbp_lon*jj_nb,nlev))
-        CALL xios_send_field(field_name, Field3d(:,:,1:nlev))
-                        
-    ELSE 
-        nlev=size(field,2)
-        ALLOCATE(index3d(npstn*nlev))
-        ALLOCATE(fieldok(npstn,nlev))
-
-        IF (is_sequential) THEN
-            DO n=1, nlev
-                DO ip=1, npstn
-                    fieldok(ip,n)=buffer_omp(nptabij(ip),n)
+        IF(.TRUE.)THEN
+            ALLOCATE(index3d(nbp_lon*jj_nb*nlev))
+            ALLOCATE(fieldok(nbp_lon*jj_nb,nlev))
+            CALL xios_send_field(field_name, Field3d(:,:,1:nlev))
+                            
+        ELSE 
+            nlev=size(field,2)
+            ALLOCATE(index3d(npstn*nlev))
+            ALLOCATE(fieldok(npstn,nlev))
+    
+            IF (is_sequential) THEN
+                DO n=1, nlev
+                    DO ip=1, npstn
+                        fieldok(ip,n)=buffer_omp(nptabij(ip),n)
+                    ENDDO
                 ENDDO
-            ENDDO
-        ELSE
-            DO n=1, nlev
-                DO ip=1, npstn
-                    IF(nptabij(ip).GE.klon_mpi_begin.AND. &
-                    nptabij(ip).LE.klon_mpi_end) THEN
-                        fieldok(ip,n)=buffer_omp(nptabij(ip)-klon_mpi_begin+1,n)
-                    ENDIF
+            ELSE
+                DO n=1, nlev
+                    DO ip=1, npstn
+                        IF(nptabij(ip).GE.klon_mpi_begin.AND. &
+                        nptabij(ip).LE.klon_mpi_end) THEN
+                            fieldok(ip,n)=buffer_omp(nptabij(ip)-klon_mpi_begin+1,n)
+                        ENDIF
+                    ENDDO
                 ENDDO
-            ENDDO
-        ENDIF
-    ENDIF 
-    DEALLOCATE(index3d)
-    DEALLOCATE(fieldok)
+            ENDIF
+        ENDIF 
+        DEALLOCATE(index3d)
+        DEALLOCATE(fieldok)
 !$OMP END MASTER   
+    ENDIF
 
   IF (prt_level >= 10) write(lunout,*)'End histrwrite3d_xios ',field_name
Index: LMDZ5/trunk/libf/phylmd/phys_output_ctrlout_mod.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/phys_output_ctrlout_mod.F90	(revision 3002)
+++ LMDZ5/trunk/libf/phylmd/phys_output_ctrlout_mod.F90	(revision 3003)
@@ -18,9 +18,13 @@
 
 !!! Comosantes de la coordonnee sigma-hybride
-!!! Ap et Bp
+!!! Ap et Bp et interfaces
   TYPE(ctrl_out), SAVE :: o_Ahyb = ctrl_out((/ 1, 1, 1, 1, 1, 1, 11, 11, 11, 11/), &
-    'Ap', '', '', (/ ('', i=1, 10) /))
+    'Ahyb', '', '', (/ ('once', i=1, 10) /))
   TYPE(ctrl_out), SAVE :: o_Bhyb = ctrl_out((/ 1, 1, 1, 1, 1, 1, 11, 11, 11, 11/), &
-    'Bp', '', '', (/ ('', i=1, 10) /))
+    'Bhyb', '', '', (/ ('once', i=1, 10) /))
+  TYPE(ctrl_out), SAVE :: o_Ahyb_inter = ctrl_out((/ 1, 1, 1, 1, 1, 1, 11, 11, 11, 11/), &
+    'Ahyb_inter', '', '', (/ ('once', i=1, 10) /))
+  TYPE(ctrl_out), SAVE :: o_Bhyb_inter = ctrl_out((/ 1, 1, 1, 1, 1, 1, 11, 11, 11, 11/), &
+    'Bhyb_inter', '', '', (/ ('once', i=1, 10) /))
   TYPE(ctrl_out), SAVE :: o_Alt = ctrl_out((/ 1, 1, 1, 1, 1, 1, 11, 11, 11, 11/), &
     'Alt', '', '', (/ ('', i=1, 10) /))
Index: LMDZ5/trunk/libf/phylmd/phys_output_mod.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/phys_output_mod.F90	(revision 3002)
+++ LMDZ5/trunk/libf/phylmd/phys_output_mod.F90	(revision 3003)
@@ -126,5 +126,8 @@
                                                                       -90.,  -90.,  -90.,  -90.,  -90. /)
     REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmax        = (/   90.,   90.,   90.,   90.,   90., &
-                                                                       90.,   90.,   90.,   90.,   90. /)                        
+                                                                       90.,   90.,   90.,   90.,   90. /)
+    REAL, DIMENSION(klev,2) :: Ahyb_bounds, Bhyb_bounds
+    REAL, DIMENSION(klev)   :: lev_index
+                
 #ifdef CPP_XIOS
     ! ug Variables utilis\'ees pour r\'ecup\'erer le calendrier pour xios
@@ -137,4 +140,12 @@
     WRITE(lunout,*) 'Debut phys_output_mod.F90'
     ! Initialisations (Valeurs par defaut
+
+    DO ilev=1,klev
+      Ahyb_bounds(ilev,1) = ap(ilev)
+      Ahyb_bounds(ilev,2) = ap(ilev+1)
+      Bhyb_bounds(ilev,1) = bp(ilev)
+      Bhyb_bounds(ilev,2) = bp(ilev+1)
+      lev_index(ilev) = REAL(ilev)
+    END DO
 
     IF (.NOT. ALLOCATED(o_trac)) ALLOCATE(o_trac(nqtot))
@@ -327,12 +338,19 @@
       print*,'phys_output_open: Declare vertical axes for each file'
     ENDIF
+
    IF (iff.LE.6.OR.iff.EQ.10) THEN
     CALL wxios_add_vaxis("presnivs", &
             levmax(iff) - levmin(iff) + 1, presnivs(levmin(iff):levmax(iff)))
     CALL wxios_add_vaxis("Ahyb", &
-            levmax(iff) - levmin(iff) + 1, aps)
+            levmax(iff) - levmin(iff) + 1, aps(levmin(iff):levmax(iff)), positif='down', &
+            bnds=Ahyb_bounds(levmin(iff):levmax(iff),:))
     CALL wxios_add_vaxis("Bhyb", &
-            levmax(iff) - levmin(iff) + 1, bps)
-    CALL wxios_add_vaxis("Alt", &
+            levmax(iff) - levmin(iff) + 1, bps(levmin(iff):levmax(iff)), positif='down', &
+            bnds=Bhyb_bounds(levmin(iff):levmax(iff),:))
+    CALL wxios_add_vaxis("klev", levmax(iff) - levmin(iff) + 1, &
+                          lev_index(levmin(iff):levmax(iff)))
+    CALL wxios_add_vaxis("bnds", 2, (/1.,2./))
+
+     CALL wxios_add_vaxis("Alt", &
             levmax(iff) - levmin(iff) + 1, pseudoalt)
    ELSE
Index: LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90	(revision 3002)
+++ LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90	(revision 3003)
@@ -29,5 +29,7 @@
     USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat
     USE time_phylmdz_mod, ONLY: day_step_phy, start_time, itau_phy
+    USE vertical_layers_mod, ONLY : ap, bp, aps, bps
     USE phys_output_ctrlout_mod, ONLY: o_phis, o_aire, is_ter, is_lic, is_oce, &
+         o_Ahyb, o_Bhyb,o_Ahyb_inter, o_Bhyb_inter, & 
          is_ave, is_sic, o_contfracATM, o_contfracOR, &
          o_aireTER, o_flat, o_slp, o_ptstar, o_pt0, o_tsol, &
@@ -392,4 +394,6 @@
     REAL, PARAMETER :: dobson_u = 2.1415e-05 ! Dobson unit, in kg m-2
 !   REAL, PARAMETER :: missing_val=nf90_fill_real
+    REAL, DIMENSION(klev,2) :: Ahyb_bounds, Bhyb_bounds
+    INTEGER :: ilev
 #ifndef CPP_XIOS
     REAL :: missing_val
@@ -418,4 +422,11 @@
        iinitend = 1
     ENDIF
+
+    DO ilev=1,klev
+      Ahyb_bounds(ilev,1) = ap(ilev)
+      Ahyb_bounds(ilev,2) = ap(ilev+1)
+      Bhyb_bounds(ilev,1) = bp(ilev)
+      Bhyb_bounds(ilev,2) = bp(ilev+1)
+    END DO
 
 #ifdef CPP_XIOS
@@ -531,4 +542,8 @@
        CALL histwrite_phy("R_incl",R_incl)
        CALL histwrite_phy("solaire",solaire)
+       CALL histwrite_phy(o_Ahyb, aps)
+       CALL histwrite_phy(o_Bhyb, bps)
+       CALL histwrite_phy(o_Ahyb_inter, Ahyb_bounds)
+       CALL histwrite_phy(o_Bhyb_inter, Bhyb_bounds)
 !
 #ifdef CPP_RRTM
