Index: /LMDZ6/trunk/libf/phylmd/pbl_surface_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/pbl_surface_mod.F90	(revision 4568)
+++ /LMDZ6/trunk/libf/phylmd/pbl_surface_mod.F90	(revision 4569)
@@ -1388,8 +1388,8 @@
 !   Provisional : set ybeta to standard values
        IF (nsrf .NE. is_ter) THEN
-           ybeta(:) = 1.
+           ybeta(1:knon) = 1.
        ELSE
            IF (iflag_split .EQ. 0) THEN
-              ybeta(:) = 1.
+              ybeta(1:knon) = 1.
            ELSE
              DO j = 1, knon
@@ -1613,5 +1613,5 @@
      ENDIF
 
-        IF (prt_level >=10) print *,'clcdrag -> ycdragh ', ycdragh
+        IF (prt_level >=10) print *,'cdrag -> ycdragh ', ycdragh(1:knon)
        ELSE  !(iflag_split .eq.0)
 
@@ -1661,5 +1661,6 @@
             ycdragm_w, ycdragh_w, zri1_w, pref_w )
 !
-        zgeo1(:) = wake_s(:)*zgeo1_w(:) + (1.-wake_s(:))*zgeo1_x(:)
+!!!bug !!        zgeo1(:) = wake_s(:)*zgeo1_w(:) + (1.-wake_s(:))*zgeo1_x(:)
+        zgeo1(1:knon) = wake_s(1:knon)*zgeo1_w(1:knon) + (1.-wake_s(1:knon))*zgeo1_x(1:knon)
 
 ! --- special Dice. JYG+MPL 25112013 puis BOMEX
@@ -1687,14 +1688,14 @@
 !!! nrlmd & jyg les 02/05/2011, 13/06/2011, 05/02/2012
       IF (prt_level >=10) THEN
-      print *,' args coef_diff_turb: yu ',  yu  
-      print *,' args coef_diff_turb: yv ',  yv  
-      print *,' args coef_diff_turb: yq ',  yq  
-      print *,' args coef_diff_turb: yt ',  yt  
-      print *,' args coef_diff_turb: yts ', yts  
-      print *,' args coef_diff_turb: yz0m ', yz0m  
-      print *,' args coef_diff_turb: yqsurf ', yqsurf  
-      print *,' args coef_diff_turb: ycdragm ', ycdragm
-      print *,' args coef_diff_turb: ycdragh ', ycdragh
-      print *,' args coef_diff_turb: ytke ', ytke
+      print *,' args coef_diff_turb: yu ',  yu(1:knon,:)  
+      print *,' args coef_diff_turb: yv ',  yv(1:knon,:)    
+      print *,' args coef_diff_turb: yq ',  yq(1:knon,:)    
+      print *,' args coef_diff_turb: yt ',  yt(1:knon,:)    
+      print *,' args coef_diff_turb: yts ', yts(1:knon)
+      print *,' args coef_diff_turb: yz0m ', yz0m(1:knon)
+      print *,' args coef_diff_turb: yqsurf ', yqsurf(1:knon)  
+      print *,' args coef_diff_turb: ycdragm ', ycdragm(1:knon)
+      print *,' args coef_diff_turb: ycdragh ', ycdragh(1:knon)
+      print *,' args coef_diff_turb: ytke ', ytke(1:knon,:)    
        ENDIF
 
@@ -1724,5 +1725,5 @@
        ENDIF ! iflag_pbl >= 50
 
-        IF (prt_level >=10) print *,'coef_diff_turb -> ycoefh ',ycoefh
+        IF (prt_level >=10) print *,'coef_diff_turb -> ycoefh ',ycoefh(1:knon,:)
 
 
@@ -1731,13 +1732,13 @@
       
       IF (prt_level >=10) THEN
-      print *,' args coef_diff_turb: yu_x ',  yu_x  
-      print *,' args coef_diff_turb: yv_x ',  yv_x  
-      print *,' args coef_diff_turb: yq_x ',  yq_x  
-      print *,' args coef_diff_turb: yt_x ',  yt_x  
-      print *,' args coef_diff_turb: yts_x ', yts_x  
-      print *,' args coef_diff_turb: yqsurf ', yqsurf  
-      print *,' args coef_diff_turb: ycdragm_x ', ycdragm_x
-      print *,' args coef_diff_turb: ycdragh_x ', ycdragh_x
-      print *,' args coef_diff_turb: ytke_x ', ytke_x
+      print *,' args coef_diff_turb: yu_x ',  yu_x(1:knon,:)      
+      print *,' args coef_diff_turb: yv_x ',  yv_x(1:knon,:)      
+      print *,' args coef_diff_turb: yq_x ',  yq_x(1:knon,:)      
+      print *,' args coef_diff_turb: yt_x ',  yt_x(1:knon,:)      
+      print *,' args coef_diff_turb: yts_x ', yts_x(1:knon)
+      print *,' args coef_diff_turb: yqsurf ', yqsurf(1:knon)  
+      print *,' args coef_diff_turb: ycdragm_x ', ycdragm_x(1:knon)
+      print *,' args coef_diff_turb: ycdragh_x ', ycdragh_x(1:knon)
+      print *,' args coef_diff_turb: ytke_x ', ytke_x(1:knon,:)    
       ENDIF
 
@@ -1768,16 +1769,16 @@
         ENDIF ! iflag_pbl >= 50
 
-        IF (prt_level >=10) print *,'coef_diff_turb -> ycoefh_x ',ycoefh_x
+        IF (prt_level >=10) print *,'coef_diff_turb -> ycoefh_x ',ycoefh_x(1:knon,:)
 !
       IF (prt_level >=10) THEN
-      print *,' args coef_diff_turb: yu_w ',  yu_w  
-      print *,' args coef_diff_turb: yv_w ',  yv_w  
-      print *,' args coef_diff_turb: yq_w ',  yq_w  
-      print *,' args coef_diff_turb: yt_w ',  yt_w  
-      print *,' args coef_diff_turb: yts_w ', yts_w  
-      print *,' args coef_diff_turb: yqsurf ', yqsurf  
-      print *,' args coef_diff_turb: ycdragm_w ', ycdragm_w
-      print *,' args coef_diff_turb: ycdragh_w ', ycdragh_w
-      print *,' args coef_diff_turb: ytke_w ', ytke_w
+      print *,' args coef_diff_turb: yu_w ',  yu_w(1:knon,:)
+      print *,' args coef_diff_turb: yv_w ',  yv_w(1:knon,:)  
+      print *,' args coef_diff_turb: yq_w ',  yq_w(1:knon,:)  
+      print *,' args coef_diff_turb: yt_w ',  yt_w(1:knon,:)  
+      print *,' args coef_diff_turb: yts_w ', yts_w(1:knon)
+      print *,' args coef_diff_turb: yqsurf ', yqsurf(1:knon)  
+      print *,' args coef_diff_turb: ycdragm_w ', ycdragm_w(1:knon)
+      print *,' args coef_diff_turb: ycdragh_w ', ycdragh_w(1:knon)
+      print *,' args coef_diff_turb: ytke_w ', ytke_w(1:knon,:)
       ENDIF
       
@@ -1807,5 +1808,5 @@
 
 
-        IF (prt_level >=10) print *,'coef_diff_turb -> ycoefh_w ',ycoefh_w
+        IF (prt_level >=10) print *,'coef_diff_turb -> ycoefh_w ',ycoefh_w(1:knon,:)
 
 !!!jyg le 10/04/2013
@@ -2043,12 +2044,14 @@
 !!!
        IF (prt_level >=10) THEN
-         PRINT *,'pbl_surface (merge->): yt(1,:) ',yt(1,:)
-         PRINT *,'pbl_surface (merge->): yq(1,:) ',yq(1,:)
-         PRINT *,'pbl_surface (merge->): yu(1,:) ',yu(1,:)
-         PRINT *,'pbl_surface (merge->): yv(1,:) ',yv(1,:)
-         PRINT *,'pbl_surface (merge->): AcoefH(1), AcoefQ(1), AcoefU(1), AcoefV(1) ', &
-                                         AcoefH(1), AcoefQ(1), AcoefU(1), AcoefV(1)
-         PRINT *,'pbl_surface (merge->): BcoefH(1), BcoefQ(1), BcoefU(1), BcoefV(1) ', &
-                                         BcoefH(1), BcoefQ(1), BcoefU(1), BcoefV(1)
+         DO i = 1, min(1,knon)
+           PRINT *,'pbl_surface (merge->): yt(1,:) ',yt(i,:)
+           PRINT *,'pbl_surface (merge->): yq(1,:) ',yq(i,:)
+           PRINT *,'pbl_surface (merge->): yu(1,:) ',yu(i,:)
+           PRINT *,'pbl_surface (merge->): yv(1,:) ',yv(i,:)
+           PRINT *,'pbl_surface (merge->): AcoefH(1), AcoefQ(1), AcoefU(1), AcoefV(1) ', &
+                                           AcoefH(i), AcoefQ(i), AcoefU(i), AcoefV(i)
+           PRINT *,'pbl_surface (merge->): BcoefH(1), BcoefQ(1), BcoefU(1), BcoefV(1) ', &
+                                           BcoefH(i), BcoefQ(i), BcoefU(i), BcoefV(i)
+         ENDDO
 
        ENDIF
@@ -2202,17 +2205,17 @@
                ydt_ds(:knon), ytkt(:knon), ytks(:knon), ytaur(:knon), ysss)
       IF (prt_level >=10) THEN
-          print *,'arg de surf_ocean: ycdragh ',ycdragh
-          print *,'arg de surf_ocean: ycdragm ',ycdragm
-          print *,'arg de surf_ocean: yt ', yt
-          print *,'arg de surf_ocean: yq ', yq
-          print *,'arg de surf_ocean: yts ', yts
-          print *,'arg de surf_ocean: AcoefH ',AcoefH
-          print *,'arg de surf_ocean: AcoefQ ',AcoefQ
-          print *,'arg de surf_ocean: BcoefH ',BcoefH
-          print *,'arg de surf_ocean: BcoefQ ',BcoefQ
-          print *,'arg de surf_ocean: yevap ',yevap
-          print *,'arg de surf_ocean: yfluxsens ',yfluxsens
-          print *,'arg de surf_ocean: yfluxlat ',yfluxlat
-          print *,'arg de surf_ocean: ytsurf_new ',ytsurf_new
+          print *,'arg de surf_ocean: ycdragh ',ycdragh(1:knon)
+          print *,'arg de surf_ocean: ycdragm ',ycdragm(1:knon)
+          print *,'arg de surf_ocean: yt ', yt(1:knon,:)
+          print *,'arg de surf_ocean: yq ', yq(1:knon,:)
+          print *,'arg de surf_ocean: yts ', yts(1:knon)
+          print *,'arg de surf_ocean: AcoefH ',AcoefH(1:knon)
+          print *,'arg de surf_ocean: AcoefQ ',AcoefQ(1:knon)
+          print *,'arg de surf_ocean: BcoefH ',BcoefH(1:knon)
+          print *,'arg de surf_ocean: BcoefQ ',BcoefQ(1:knon)
+          print *,'arg de surf_ocean: yevap ',yevap(1:knon)
+          print *,'arg de surf_ocean: yfluxsens ',yfluxsens(1:knon)
+          print *,'arg de surf_ocean: yfluxlat ',yfluxlat(1:knon)
+          print *,'arg de surf_ocean: ytsurf_new ',ytsurf_new(1:knon)
        ENDIF
 ! Special DICE MPL 05082013 puis BOMEX MPL 20150410
@@ -2264,6 +2267,6 @@
 
        IF (evap0>=0.) THEN
-          yevap(:)=evap0
-          yevap(:)=RLVTT*evap0
+          yevap(1:knon)=evap0
+          yevap(1:knon)=RLVTT*evap0
        ENDIF
 
@@ -2472,5 +2475,5 @@
        IF (prt_level >= 10) THEN
          print *,'pbl_surface, ybeta , yevap, yevap_pot ', &
-                               ybeta , yevap, yevap_pot
+                               ybeta(1:knon) , yevap(1:knon), yevap_pot(1:knon)
        ENDIF  ! (prt_level >= 10)
 !
@@ -2957,5 +2960,5 @@
        IF (prt_level >=10) THEN
          print *, 'pbl_surface tendencies for w: d_t_w, d_t_x, d_t ', &
-          d_t_w(:,1), d_t_x(:,1), d_t(:,1)
+          d_t_w(1:knon,1), d_t_x(1:knon,1), d_t(1:knon,1)
        ENDIF
 
@@ -3203,5 +3206,5 @@
        IF (prt_level >=10) THEN
          print *, 'T2m, q2m, RH2m ', &
-          t2m, q2m, rh2m
+          t2m(1:knon,:), q2m(1:knon,:), rh2m(1:knon)
        ENDIF
 
@@ -3216,15 +3219,15 @@
             ytherm,ytrmb1,ytrmb2,ytrmb3,ylcl)
           IF (prt_level >=10) THEN
-       print *,' Arg. de HBTM: yt2m ',yt2m
-       print *,' Arg. de HBTM: yt10m ',yt10m
-       print *,' Arg. de HBTM: yq2m ',yq2m
-       print *,' Arg. de HBTM: yq10m ',yq10m
-       print *,' Arg. de HBTM: yustar ',yustar
-       print *,' Arg. de HBTM: y_flux_t ',y_flux_t
-       print *,' Arg. de HBTM: y_flux_q ',y_flux_q
-       print *,' Arg. de HBTM: yu ',yu
-       print *,' Arg. de HBTM: yv ',yv
-       print *,' Arg. de HBTM: yt ',yt
-       print *,' Arg. de HBTM: yq ',yq
+       print *,' Arg. de HBTM: yt2m ',yt2m(1:knon)
+       print *,' Arg. de HBTM: yt10m ',yt10m(1:knon)
+       print *,' Arg. de HBTM: yq2m ',yq2m(1:knon)
+       print *,' Arg. de HBTM: yq10m ',yq10m(1:knon)
+       print *,' Arg. de HBTM: yustar ',yustar(1:knon)
+       print *,' Arg. de HBTM: y_flux_t ',y_flux_t(1:knon,:)
+       print *,' Arg. de HBTM: y_flux_q ',y_flux_q(1:knon,:)
+       print *,' Arg. de HBTM: yu ',yu(1:knon,:)
+       print *,' Arg. de HBTM: yv ',yv(1:knon,:)
+       print *,' Arg. de HBTM: yt ',yt(1:knon,:)
+       print *,' Arg. de HBTM: yq ',yq(1:knon,:)
           ENDIF
        ELSE  ! (iflag_split .eq.0)
@@ -3235,15 +3238,15 @@
             ytherm_x,ytrmb1_x,ytrmb2_x,ytrmb3_x,ylcl_x)
           IF (prt_level >=10) THEN
-       print *,' Arg. de HBTM: yt2m_x ',yt2m_x
-       print *,' Arg. de HBTM: yt10m_x ',yt10m_x
-       print *,' Arg. de HBTM: yq2m_x ',yq2m_x
-       print *,' Arg. de HBTM: yq10m_x ',yq10m_x
-       print *,' Arg. de HBTM: yustar_x ',yustar_x
-       print *,' Arg. de HBTM: y_flux_t_x ',y_flux_t_x
-       print *,' Arg. de HBTM: y_flux_q_x ',y_flux_q_x
-       print *,' Arg. de HBTM: yu_x ',yu_x
-       print *,' Arg. de HBTM: yv_x ',yv_x
-       print *,' Arg. de HBTM: yt_x ',yt_x
-       print *,' Arg. de HBTM: yq_x ',yq_x
+       print *,' Arg. de HBTM: yt2m_x ',yt2m_x(1:knon)
+       print *,' Arg. de HBTM: yt10m_x ',yt10m_x(1:knon)
+       print *,' Arg. de HBTM: yq2m_x ',yq2m_x(1:knon)
+       print *,' Arg. de HBTM: yq10m_x ',yq10m_x(1:knon)
+       print *,' Arg. de HBTM: yustar_x ',yustar_x(1:knon)
+       print *,' Arg. de HBTM: y_flux_t_x ',y_flux_t_x(1:knon,:)
+       print *,' Arg. de HBTM: y_flux_q_x ',y_flux_q_x(1:knon,:)
+       print *,' Arg. de HBTM: yu_x ',yu_x(1:knon,:)
+       print *,' Arg. de HBTM: yv_x ',yv_x(1:knon,:)
+       print *,' Arg. de HBTM: yt_x ',yt_x(1:knon,:)
+       print *,' Arg. de HBTM: yq_x ',yq_x(1:knon,:)
           ENDIF
         CALL HBTM(knon, ypaprs, ypplay, &
@@ -3274,7 +3277,7 @@
         ENDDO
         IF (prt_level >=10) THEN
-          print *, 'After HBTM: pblh ', pblh
-          print *, 'After HBTM: plcl ', plcl
-          print *, 'After HBTM: cteiCL ', cteiCL
+          print *, 'After HBTM: pblh ', pblh(1:knon,:)
+          print *, 'After HBTM: plcl ', plcl(1:knon,:)
+          print *, 'After HBTM: cteiCL ', cteiCL(1:knon,:)
         ENDIF
        ELSE  !(iflag_split .eq.0)
@@ -3294,7 +3297,7 @@
         ENDDO
         IF (prt_level >=10) THEN
-          print *, 'After HBTM: pblh_x ', pblh_x
-          print *, 'After HBTM: plcl_x ', plcl_x
-          print *, 'After HBTM: cteiCL_x ', cteiCL_x
+          print *, 'After HBTM: pblh_x ', pblh_x(1:knon,:)
+          print *, 'After HBTM: plcl_x ', plcl_x(1:knon,:)
+          print *, 'After HBTM: cteiCL_x ', cteiCL_x(1:knon,:)
         ENDIF
         DO j=1, knon
@@ -3313,7 +3316,7 @@
         ENDDO
         IF (prt_level >=10) THEN
-          print *, 'After HBTM: pblh_w ', pblh_w
-          print *, 'After HBTM: plcl_w ', plcl_w
-          print *, 'After HBTM: cteiCL_w ', cteiCL_w
+          print *, 'After HBTM: pblh_w ', pblh_w(1:knon,:)
+          print *, 'After HBTM: plcl_w ', plcl_w(1:knon,:)
+          print *, 'After HBTM: cteiCL_w ', cteiCL_w(1:knon,:)
         ENDIF
 !!!
