Index: codes/icosagcm/devel/src/unstructured/caldyn_unstructured.F90
===================================================================
--- codes/icosagcm/devel/src/unstructured/caldyn_unstructured.F90	(revision 792)
+++ codes/icosagcm/devel/src/unstructured/caldyn_unstructured.F90	(revision 796)
@@ -10,20 +10,5 @@
 #include "unstructured.h90"
 
-#define INDICES1 ij,l,iq,iedge,edge,ivertex,vertex,ij_left,ij_right
-#define INDICES2 ij_up,ij_down,itrisk,edge_trisk,kup,kdown
-#define EDGES edge1,edge2,edge3,edge4,edge5,edge6
-#define VERTICES vertex1,vertex2,vertex3,vertex4,vertex5,vertex6
-#define SIGNS sign1,sign2,sign3,sign4,sign5,sign6
-#define EDGE_ENDS ij_up1,ij_up2,ij_up3,ij_up4,ij_up5,ij_up6,ij_down1,ij_down2,ij_down3,ij_down4,ij_down5,ij_down6
-#define LENGTHS le_de1,le_de2,le_de3,le_de4,le_de5,le_de6
-#define DECLARE_INDICES INTEGER INDICES1,INDICES2
-#define DECLARE_EDGES NUM SIGNS,LENGTHS ; INTEGER EDGES, EDGE_ENDS
-#define DECLARE_VERTICES INTEGER VERTICES
 #define PHI_BOT(ij) Phi_bot
-
-#define HASNAN(field) (ANY(.NOT.ABS(field)<1e20))
-
-#define START_TRACE(id,nprimal,ndual,nedge) CALL enter_trace(id, 8*llm*((nprimal)*primal_num+(ndual)*dual_num+(nedge)*edge_num) )
-#define STOP_TRACE CALL exit_trace()
 
 !----------------------------- Non-Hydrostatic -----------------------------
Index: codes/icosagcm/devel/src/unstructured/data_unstructured.F90
===================================================================
--- codes/icosagcm/devel/src/unstructured/data_unstructured.F90	(revision 792)
+++ codes/icosagcm/devel/src/unstructured/data_unstructured.F90	(revision 796)
@@ -39,6 +39,6 @@
   NUM1(max_nb_stage), BIND(C)              :: tauj       ! diagonal of fast Butcher tableau
   NUM2(max_nb_stage,max_nb_stage), BIND(C) :: cslj, cflj ! slow and fast modified Butcher tableaus
-  NUM1(:), ALLOCATABLE            :: le_de, fv, Av, Ai
-  NUM2(:,:), ALLOCATABLE          :: Riv2, wee, ap,bp, mass_bl, mass_dak, mass_dbk
+  NUM1(:), ALLOCATABLE            :: le, le_de, fv, Av, Ai
+  NUM2(:,:), ALLOCATABLE          :: centroid, xyz_v, Riv2, wee, ap,bp, mass_bl, mass_dak, mass_dbk
 
   INTEGER(C_INT), BIND(C) :: comm_icosa, dynamico_mpi_rank=0
Index: codes/icosagcm/devel/src/unstructured/diags_unstructured.F90
===================================================================
--- codes/icosagcm/devel/src/unstructured/diags_unstructured.F90	(revision 796)
+++ codes/icosagcm/devel/src/unstructured/diags_unstructured.F90	(revision 796)
@@ -0,0 +1,36 @@
+MODULE diags_unstructured_mod
+  USE ISO_C_BINDING
+  USE OMP_LIB
+  USE data_unstructured_mod
+  USE transfer_unstructured_mod
+  IMPLICIT NONE
+  PRIVATE
+  SAVE
+
+CONTAINS
+
+#include "unstructured.h90"
+
+#define HASNAN(field) (ANY(.NOT.ABS(field)<1e20))
+
+   SUBROUTINE wind_centered(un, uxyz) BINDC(wind_centered)
+     FIELD_THETA  :: uxyz ! OUT
+     FIELD_U      :: un    ! IN, normal components
+     !$OMP PARALLEL NUM_THREADS(nb_threads)
+     CALL update_halo(transfer_edge, un)
+     CALL compute_wind_centered(un,uxyz)
+     !$OMP END PARALLEL
+   END SUBROUTINE wind_centered
+
+   SUBROUTINE compute_wind_centered(ue, ucenter)
+     FIELD_THETA  :: ucenter ! OUT
+     FIELD_U      :: ue    ! IN, normal components
+     DECLARE_INDICES
+     DECLARE_EDGES
+     NUM :: cx, cy, cz, ux, uy, uz, ue_le, fac
+     NUM, parameter :: scale = 1.
+#include "../kernels_unst/wind_centered.k90"
+   END SUBROUTINE compute_wind_centered
+
+   
+ END MODULE diags_unstructured_mod
Index: codes/icosagcm/devel/src/unstructured/unstructured.h90
===================================================================
--- codes/icosagcm/devel/src/unstructured/unstructured.h90	(revision 792)
+++ codes/icosagcm/devel/src/unstructured/unstructured.h90	(revision 796)
@@ -30,2 +30,17 @@
 #define BINDC_(thename) BIND(C, name=#thename)
 #define BINDC(thename) BINDC_(dynamico_ ## thename)
+
+#define INDICES1 ij,l,iq,iedge,edge,ivertex,vertex,ij_left,ij_right
+#define INDICES2 ij_up,ij_down,itrisk,edge_trisk,kup,kdown
+#define EDGES edge1,edge2,edge3,edge4,edge5,edge6
+#define VERTICES vertex1,vertex2,vertex3,vertex4,vertex5,vertex6
+#define SIGNS sign1,sign2,sign3,sign4,sign5,sign6
+#define EDGE_ENDS ij_up1,ij_up2,ij_up3,ij_up4,ij_up5,ij_up6,ij_down1,ij_down2,ij_down3,ij_down4,ij_down5,ij_down6
+#define LENGTHS le_de1,le_de2,le_de3,le_de4,le_de5,le_de6
+#define DECLARE_INDICES INTEGER INDICES1,INDICES2
+#define DECLARE_EDGES NUM SIGNS,LENGTHS ; INTEGER EDGES, EDGE_ENDS
+#define DECLARE_VERTICES INTEGER VERTICES
+
+#define START_TRACE(id,nprimal,ndual,nedge) CALL enter_trace(id, 8*llm*((nprimal)*primal_num+(ndual)*dual_num+(nedge)*edge_num) )
+#define STOP_TRACE CALL exit_trace()
+
