Index: LMDZ4/branches/LMDZ4-dev/libf/phylmd/cpl_mod.F90
===================================================================
--- LMDZ4/branches/LMDZ4-dev/libf/phylmd/cpl_mod.F90	(revision 1227)
+++ LMDZ4/branches/LMDZ4-dev/libf/phylmd/cpl_mod.F90	(revision 1274)
@@ -47,12 +47,12 @@
   REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_snow, cpl_evap, cpl_tsol
   !$OMP THREADPRIVATE(cpl_snow,cpl_evap,cpl_tsol)
-  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_fder, cpl_albe, cpl_taux
-  !$OMP THREADPRIVATE(cpl_fder,cpl_albe,cpl_taux)
+  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_fder, cpl_albe, cpl_taux, cpl_tauy
+  !$OMP THREADPRIVATE(cpl_fder,cpl_albe,cpl_taux,cpl_tauy)
   REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_windsp
   !$OMP THREADPRIVATE(cpl_windsp)
+  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_taumod
+  !$OMP THREADPRIVATE(cpl_taumod)
   REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_atm_co2
   !$OMP THREADPRIVATE(cpl_atm_co2)
-  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_tauy
-  !$OMP THREADPRIVATE(cpl_tauy)
   REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_rriv2D, cpl_rcoa2D, cpl_rlic2D
   !$OMP THREADPRIVATE(cpl_rriv2D,cpl_rcoa2D,cpl_rlic2D)
@@ -85,4 +85,6 @@
   REAL, ALLOCATABLE, DIMENSION(:,:,:), SAVE :: cpl_taux2D, cpl_tauy2D
   !$OMP THREADPRIVATE(cpl_taux2D, cpl_tauy2D)
+  REAL, ALLOCATABLE, DIMENSION(:,:,:), SAVE :: cpl_taumod2D
+  !$OMP THREADPRIVATE(cpl_taumod2D)
   REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_windsp2D
   !$OMP THREADPRIVATE(cpl_windsp2D)
@@ -161,7 +163,9 @@
     ALLOCATE(cpl_taux(klon,2), stat = error)
     sum_error = sum_error + error
+    ALLOCATE(cpl_tauy(klon,2), stat = error)
+    sum_error = sum_error + error
     ALLOCATE(cpl_windsp(klon,2), stat = error)
     sum_error = sum_error + error
-    ALLOCATE(cpl_tauy(klon,2), stat = error)
+    ALLOCATE(cpl_taumod(klon,2), stat = error)
     sum_error = sum_error + error
     ALLOCATE(cpl_rriv2D(iim,jj_nb), stat=error)
@@ -213,7 +217,5 @@
     idtime = INT(dtime)
 #ifdef CPP_COUPLE
-!$OMP MASTER    
     CALL inicma
-!$OMP END MASTER
 #endif
 
@@ -317,5 +319,5 @@
     is_modified=.FALSE.
 
-! Check if right moment to recevie from coupler
+! Check if right moment to receive from coupler
     IF (MOD(itime, nexca) == 1) THEN
        is_modified=.TRUE.
@@ -571,4 +573,5 @@
        cpl_tauy(1:knon,cpl_index) = 0.0
        cpl_windsp(1:knon,cpl_index) = 0.0
+       cpl_taumod(1:knon,cpl_index) = 0.0
        IF (carbon_cycle_cpl) cpl_atm_co2(1:knon,cpl_index) = 0.0
     ENDIF
@@ -600,5 +603,7 @@
             tauy(ig)        / FLOAT(nexca)      
        cpl_windsp(ig,cpl_index) = cpl_windsp(ig,cpl_index) + &
-            windsp(ig)      / FLOAT(nexca) 
+            windsp(ig)      / FLOAT(nexca)
+       cpl_taumod(ig,cpl_index) =   cpl_taumod(ig,cpl_index) + &
+          SQRT ( taux(ig)*taux(ig)+tauy(ig)*tauy(ig) ) / FLOAT (nexca)
 
        IF (carbon_cycle_cpl) THEN
@@ -639,4 +644,6 @@
           sum_error = sum_error + error
           ALLOCATE(cpl_windsp2D(iim,jj_nb), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_taumod2D(iim,jj_nb,2), stat=error)
           sum_error = sum_error + error
           
@@ -687,4 +694,7 @@
 
        CALL gath2cpl(cpl_windsp(:,cpl_index), cpl_windsp2D(:,:), &
+            knon, knindex)
+
+       CALL gath2cpl(cpl_taumod(:,cpl_index), cpl_taumod2D(:,:,cpl_index), &
             knon, knindex)
 
@@ -758,4 +768,5 @@
        cpl_taux(1:knon,cpl_index) = 0.0
        cpl_tauy(1:knon,cpl_index) = 0.0
+       cpl_taumod(1:knon,cpl_index) = 0.0
     ENDIF
        
@@ -784,5 +795,7 @@
             taux(ig)        / FLOAT(nexca)
        cpl_tauy(ig,cpl_index) = cpl_tauy(ig,cpl_index) + &
-            tauy(ig)        / FLOAT(nexca)      
+            tauy(ig)        / FLOAT(nexca)     
+       cpl_taumod(ig,cpl_index) = cpl_taumod(ig,cpl_index) + &
+            SQRT ( taux(ig)*taux(ig)+tauy(ig)*tauy(ig) ) / FLOAT(nexca) 
     ENDDO
 
@@ -816,4 +829,6 @@
           sum_error = sum_error + error
           ALLOCATE(cpl_windsp2D(iim,jj_nb), stat=error)
+          sum_error = sum_error + error
+          ALLOCATE(cpl_taumod2D(iim,jj_nb,2), stat=error)
           sum_error = sum_error + error
 
@@ -864,4 +879,7 @@
 
        CALL gath2cpl(cpl_tauy(:,cpl_index), cpl_tauy2D(:,:,cpl_index), &
+            knon, knindex)
+
+       CALL gath2cpl(cpl_taumod(:,cpl_index), cpl_taumod2D(:,:,cpl_index), &
             knon, knindex)
 
@@ -1129,4 +1147,5 @@
           tab_flds(:,:,ids_totsno) = 0.0
           tab_flds(:,:,ids_toteva) = 0.0
+          tab_flds(:,:,ids_taumod) = 0.0
   
           tmp_taux(:,:)    = 0.0
@@ -1138,5 +1157,5 @@
              tmp_tauy = cpl_tauy2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
                   cpl_tauy2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
-             
+
              tab_flds(:,:,ids_shftot) = cpl_sols2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
                   cpl_sols2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
@@ -1149,4 +1168,7 @@
              tab_flds(:,:,ids_toteva) = cpl_evap2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
                   cpl_evap2D(:,:,2)  * pctsrf2D(:,:,is_sic) / deno(:,:)
+             tab_flds(:,:,ids_taumod) = cpl_taumod2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
+                  cpl_taumod2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
+             
          ENDWHERE
 
@@ -1246,5 +1268,5 @@
     DEALLOCATE(cpl_evap2D, cpl_tsol2D, cpl_fder2D, cpl_albe2D, stat=error )
     sum_error = sum_error + error
-    DEALLOCATE(cpl_taux2D, cpl_tauy2D, cpl_windsp2D, stat=error )
+    DEALLOCATE(cpl_taux2D, cpl_tauy2D, cpl_windsp2D, cpl_taumod2D, stat=error )
     sum_error = sum_error + error
     
