Index: codes/icosagcm/devel/src/base/field.f90
===================================================================
--- codes/icosagcm/devel/src/base/field.f90	(revision 838)
+++ codes/icosagcm/devel/src/base/field.f90	(revision 839)
@@ -85,7 +85,7 @@
 
   SUBROUTINE allocate_field_(field,field_type,data_type,dim1,dim2,name)
-  USE domain_mod
-  USE omp_para
-  IMPLICIT NONE
+    USE domain_mod
+    USE omp_para
+    USE grid_param
     TYPE(t_field) :: field(:)
     INTEGER,INTENT(IN) :: field_type
@@ -94,5 +94,5 @@
     CHARACTER(*), OPTIONAL :: name
     INTEGER :: ind
-    INTEGER :: ii_size,jj_size
+    INTEGER :: ij_size
 
     DO ind=1,ndomain
@@ -119,30 +119,56 @@
       field(ind)%data_type=data_type
       field(ind)%field_type=field_type
-    
-      IF (field_type==field_T) THEN 
-        jj_size=domain(ind)%jjm
-      ELSE IF (field_type==field_U) THEN 
-        jj_size=3*domain(ind)%jjm
-      ELSE IF (field_type==field_Z) THEN 
-        jj_size=2*domain(ind)%jjm
-      ENDIF
-      
-      ii_size=domain(ind)%iim
+      
+      SELECT CASE(grid_type)
+         CASE(grid_ico)
+            ij_size=domain(ind)%iim
+            IF (field_type==field_T) THEN 
+               ij_size=ij_size*domain(ind)%jjm
+            ELSE IF (field_type==field_U) THEN 
+               ij_size=3*ij_size*domain(ind)%jjm
+            ELSE IF (field_type==field_Z) THEN 
+               ij_size=2*ij_size*domain(ind)%jjm
+            ENDIF     
         
-      IF (field(ind)%ndim==4) THEN
-        IF (data_type==type_integer) ALLOCATE(field(ind)%ival4d(ii_size*jj_size,dim1,dim2))
-        IF (data_type==type_real)    ALLOCATE(field(ind)%rval4d(ii_size*jj_size,dim1,dim2))
-        IF (data_type==type_logical) ALLOCATE(field(ind)%lval4d(ii_size*jj_size,dim1,dim2))
-      ELSE IF (field(ind)%ndim==3) THEN
-        IF (data_type==type_integer) ALLOCATE(field(ind)%ival3d(ii_size*jj_size,dim1))
-        IF (data_type==type_real)    ALLOCATE(field(ind)%rval3d(ii_size*jj_size,dim1))
-        IF (data_type==type_logical) ALLOCATE(field(ind)%lval3d(ii_size*jj_size,dim1))
-      ELSE IF (field(ind)%ndim==2) THEN
-        IF (data_type==type_integer) ALLOCATE(field(ind)%ival2d(ii_size*jj_size))
-        IF (data_type==type_real)    ALLOCATE(field(ind)%rval2d(ii_size*jj_size))
-        IF (data_type==type_logical) ALLOCATE(field(ind)%lval2d(ii_size*jj_size))
-      ENDIF
-      
-   ENDDO
+            IF (field(ind)%ndim==4) THEN
+               IF (data_type==type_integer) ALLOCATE(field(ind)%ival4d(ij_size,dim1,dim2))
+               IF (data_type==type_real)    ALLOCATE(field(ind)%rval4d(ij_size,dim1,dim2))
+               IF (data_type==type_logical) ALLOCATE(field(ind)%lval4d(ij_size,dim1,dim2))
+            ELSE IF (field(ind)%ndim==3) THEN
+               IF (data_type==type_integer) ALLOCATE(field(ind)%ival3d(ij_size,dim1))
+               IF (data_type==type_real)    ALLOCATE(field(ind)%rval3d(ij_size,dim1))
+               IF (data_type==type_logical) ALLOCATE(field(ind)%lval3d(ij_size,dim1))
+            ELSE IF (field(ind)%ndim==2) THEN
+               IF (data_type==type_integer) ALLOCATE(field(ind)%ival2d(ij_size))
+               IF (data_type==type_real)    ALLOCATE(field(ind)%rval2d(ij_size))
+               IF (data_type==type_logical) ALLOCATE(field(ind)%lval2d(ij_size))
+            ENDIF
+
+         CASE(grid_unst)
+            PRINT *, 'Allocating field ', field(ind)%name
+            IF (field_type==field_T) THEN 
+               ij_size=primal_num
+            ELSE IF (field_type==field_U) THEN 
+               ij_size=edge_num
+            ELSE IF (field_type==field_Z) THEN 
+               ij_size=dual_num
+            ENDIF     
+
+            IF (field(ind)%ndim==4) THEN
+               IF (data_type==type_integer) ALLOCATE(field(ind)%ival4d(dim1,ij_size,dim2))
+               IF (data_type==type_real)    ALLOCATE(field(ind)%rval4d(dim1,ij_size,dim2))
+               IF (data_type==type_logical) ALLOCATE(field(ind)%lval4d(dim1,ij_size,dim2))
+            ELSE IF (field(ind)%ndim==3) THEN
+               IF (data_type==type_integer) ALLOCATE(field(ind)%ival3d(dim1,ij_size))
+               IF (data_type==type_real)    ALLOCATE(field(ind)%rval3d(dim1,ij_size))
+               IF (data_type==type_logical) ALLOCATE(field(ind)%lval3d(dim1,ij_size))
+            ELSE IF (field(ind)%ndim==2) THEN
+               IF (data_type==type_integer) ALLOCATE(field(ind)%ival2d(ij_size))
+               IF (data_type==type_real)    ALLOCATE(field(ind)%rval2d(ij_size))
+               IF (data_type==type_logical) ALLOCATE(field(ind)%lval2d(ij_size))
+            ENDIF
+
+         END SELECT
+      ENDDO
 !$OMP BARRIER
    
Index: codes/icosagcm/devel/src/base/grid_param.f90
===================================================================
--- codes/icosagcm/devel/src/base/grid_param.f90	(revision 838)
+++ codes/icosagcm/devel/src/base/grid_param.f90	(revision 839)
@@ -1,5 +1,9 @@
 MODULE grid_param
+  USE ISO_C_BINDING
   IMPLICIT NONE
   SAVE
+
+! Some variable are BIND(C) to be accessible from Python                                                                                                                                                   ! They are declared using C sizes
+
   INTEGER  :: iim_glo=40
   INTEGER  :: jjm_glo
@@ -7,6 +11,12 @@
   INTEGER, PARAMETER :: grid_unst=1, grid_ico = 2
   INTEGER  :: grid_type ! unstructured or icosahedral
-  INTEGER, BIND(C) :: llm=19
+
+  INTEGER(C_INT), BIND(C) :: llm=19, &  ! number of vertical levels
+                             nqdyn      ! number of dynamical tracers : 1 if dry, more if moist
+
   INTEGER  :: nqtot ! number of tracers handled by advection scheme
-  INTEGER, BIND(C) :: nqdyn ! number of dynamical tracers : 1 if dry, more if moist
+
+  INTEGER(C_INT), BIND(C) :: edge_num, primal_num, dual_num, &
+       max_primal_deg, max_dual_deg, max_trisk_deg
+
 END MODULE grid_param
