Index: codes/icosagcm/trunk/src/caldyn.f90
===================================================================
--- codes/icosagcm/trunk/src/caldyn.f90	(revision 349)
+++ codes/icosagcm/trunk/src/caldyn.f90	(revision 350)
@@ -31,16 +31,16 @@
   END SUBROUTINE init_caldyn
 
-  SUBROUTINE caldyn_BC(f_phis, f_wflux)
+  SUBROUTINE caldyn_BC(f_phis, f_geopot, f_wflux)
     USE caldyn_gcm_mod, ONLY : caldyn_gcm_BC=>caldyn_BC
     IMPLICIT NONE
-    TYPE(t_field), POINTER :: f_phis(:), f_wflux(:)
+    TYPE(t_field), POINTER :: f_phis(:), f_geopot(:), f_wflux(:)
     SELECT CASE (TRIM(caldyn_type))
     CASE('gcm')
-       CALL caldyn_gcm_BC(f_phis, f_wflux)
+       CALL caldyn_gcm_BC(f_phis, f_geopot, f_wflux)
     END SELECT
   END SUBROUTINE caldyn_BC
   
   SUBROUTINE caldyn(write_out,f_phis, f_ps, f_mass, f_theta_rhodz, f_u, f_q, &
-       f_hflux, f_wflux, f_dps, f_dmass, f_dtheta_rhodz, f_du)
+       f_geopot, f_hflux, f_wflux, f_dps, f_dmass, f_dtheta_rhodz, f_du)
   USE icosa
   USE caldyn_gcm_mod, ONLY : caldyn_gcm=>caldyn
@@ -54,4 +54,5 @@
   TYPE(t_field),POINTER :: f_u(:)
   TYPE(t_field),POINTER :: f_q(:)
+  TYPE(t_field),POINTER :: f_geopot(:)
   TYPE(t_field),POINTER :: f_hflux(:)
   TYPE(t_field),POINTER :: f_wflux(:)
@@ -64,5 +65,5 @@
       CASE('gcm')
         CALL caldyn_gcm(write_out,f_phis, f_ps, f_mass, f_theta_rhodz, f_u, f_q, &
-             f_hflux, f_wflux, f_dps, f_dmass, f_dtheta_rhodz, f_du)
+             f_geopot, f_hflux, f_wflux, f_dps, f_dmass, f_dtheta_rhodz, f_du)
       CASE('adv')
         CALL caldyn_adv(write_out,f_phis, f_ps, f_theta_rhodz, f_u, f_q, &
Index: codes/icosagcm/trunk/src/caldyn_gcm.f90
===================================================================
--- codes/icosagcm/trunk/src/caldyn_gcm.f90	(revision 349)
+++ codes/icosagcm/trunk/src/caldyn_gcm.f90	(revision 350)
@@ -2,4 +2,5 @@
   USE icosa
   USE transfert_mod
+  IMPLICIT NONE
   PRIVATE
 
@@ -15,5 +16,4 @@
   TYPE(t_field),POINTER :: f_theta(:)
   TYPE(t_field),POINTER :: f_pk(:)
-  TYPE(t_field),POINTER :: f_geopot(:)
   TYPE(t_field),POINTER :: f_wwuu(:)
   TYPE(t_field),POINTER :: f_planetvel(:)
@@ -83,5 +83,4 @@
     CALL allocate_field(f_theta, field_t,type_real,llm,  name='theta')   ! potential temperature
     CALL allocate_field(f_pk,    field_t,type_real,llm,  name='pk')
-    CALL allocate_field(f_geopot,field_t,type_real,llm+1,name='geopot')  ! geopotential
     CALL allocate_field(f_wwuu,  field_u,type_real,llm+1,name='wwuu')
     CALL allocate_field(f_planetvel,  field_u,type_real, name='planetvel') ! planetary velocity at r=a
@@ -89,10 +88,10 @@
   END SUBROUTINE allocate_caldyn
 
-  SUBROUTINE caldyn_BC(f_phis, f_wflux)
+  SUBROUTINE caldyn_BC(f_phis, f_geopot, f_wflux)
     USE icosa
     USE mpipara
     USE omp_para
-    IMPLICIT NONE
     TYPE(t_field),POINTER :: f_phis(:)
+    TYPE(t_field),POINTER :: f_geopot(:)
     TYPE(t_field),POINTER :: f_wflux(:)
     REAL(rstd),POINTER  :: phis(:)
@@ -133,5 +132,5 @@
    
   SUBROUTINE caldyn(write_out,f_phis, f_ps, f_mass, f_theta_rhodz, f_u, f_q, &
-       f_hflux, f_wflux, f_dps, f_dmass, f_dtheta_rhodz, f_du)
+       f_geopot, f_hflux, f_wflux, f_dps, f_dmass, f_dtheta_rhodz, f_du)
     USE icosa
     USE disvert_mod, ONLY : caldyn_eta, eta_mass
@@ -153,4 +152,5 @@
     TYPE(t_field),POINTER :: f_u(:)
     TYPE(t_field),POINTER :: f_q(:)
+    TYPE(t_field),POINTER :: f_geopot(:)
     TYPE(t_field),POINTER :: f_hflux(:), f_wflux(:)
     TYPE(t_field),POINTER :: f_dps(:)
@@ -329,11 +329,11 @@
   INTEGER :: ij
   DO ij=ij_begin_ext,ij_end_ext
-     ulon(ij+u_right)=a*omega*cos(lat_e(ij+u_right))
+     ulon(ij+u_right)=radius*omega*cos(lat_e(ij+u_right))
      ulat(ij+u_right)=0
 
-     ulon(ij+u_lup)=a*omega*cos(lat_e(ij+u_lup))
+     ulon(ij+u_lup)=radius*omega*cos(lat_e(ij+u_lup))
      ulat(ij+u_lup)=0
 
-     ulon(ij+u_ldown)=a*omega*cos(lat_e(ij+u_ldown))
+     ulon(ij+u_ldown)=radius*omega*cos(lat_e(ij+u_ldown))
      ulat(ij+u_ldown)=0
   END DO
@@ -959,9 +959,9 @@
          f_buf_i(:), f_buf_v(:), f_buf_i3(:), f_buf1_i(:), f_buf2_i(:), f_buf_s(:), f_buf_p(:)
     
-    REAL(rstd) :: out_pression_lev
+    REAL(rstd) :: out_pression_level
     CHARACTER(LEN=255) :: str_pression
     CHARACTER(LEN=255) :: physics_type
     
-    out_pression_level=0
+    out_pression_level=0.
     CALL getin("out_pression_level",out_pression_level) 
     WRITE(str_pression,*) INT(out_pression_level/100)
@@ -1015,5 +1015,5 @@
     CALL thetarhodz2geopot(f_ps,f_phis,f_theta_rhodz, f_buf_s,f_buf_p,f_buf1_i,f_buf2_i,f_buf_i)
     CALL writefield("p",f_buf_p)
-    CALL writefield("phi",f_geopot)   ! geopotential
+!    CALL writefield("phi",f_geopot)   ! geopotential
     CALL writefield("theta",f_buf1_i) ! potential temperature
     CALL writefield("pk",f_buf2_i)    ! Exner pressure
Index: codes/icosagcm/trunk/src/field.f90
===================================================================
--- codes/icosagcm/trunk/src/field.f90	(revision 349)
+++ codes/icosagcm/trunk/src/field.f90	(revision 350)
@@ -1,4 +1,5 @@
 MODULE field_mod
   USE genmod
+  IMPLICIT NONE
   
   INTEGER,PARAMETER :: field_T=1
@@ -43,4 +44,5 @@
   END INTERFACE
 
+  PRIVATE :: allocate_field_
 
 CONTAINS
@@ -49,6 +51,42 @@
   USE domain_mod
   USE omp_para
-  IMPLICIT NONE
     TYPE(t_field),POINTER :: field(:)
+    INTEGER,INTENT(IN) :: field_type
+    INTEGER,INTENT(IN) :: data_type
+    INTEGER,OPTIONAL :: dim1,dim2
+    CHARACTER(*), OPTIONAL :: name
+!$OMP BARRIER
+!$OMP MASTER
+    ALLOCATE(field(ndomain))
+!$OMP END MASTER
+!$OMP BARRIER
+    CALL allocate_field_(field,field_type,data_type,dim1,dim2,name)
+  END SUBROUTINE allocate_field
+
+  SUBROUTINE allocate_fields(nfield,field,field_type,data_type,dim1,dim2,name)
+  USE domain_mod
+  USE omp_para
+    INTEGER,INTENT(IN) :: nfield
+    TYPE(t_field),POINTER :: field(:,:)
+    INTEGER,INTENT(IN) :: field_type
+    INTEGER,INTENT(IN) :: data_type
+    INTEGER,OPTIONAL :: dim1,dim2
+    CHARACTER(*), OPTIONAL :: name
+    INTEGER :: i
+!$OMP BARRIER
+!$OMP MASTER
+    ALLOCATE(field(ndomain,nfield))
+!$OMP END MASTER
+!$OMP BARRIER
+    DO i=1,nfield
+       CALL allocate_field_(field(:,i),field_type,data_type,dim1,dim2,name)
+    END DO
+  END SUBROUTINE allocate_fields
+
+  SUBROUTINE allocate_field_(field,field_type,data_type,dim1,dim2,name)
+  USE domain_mod
+  USE omp_para
+  IMPLICIT NONE
+    TYPE(t_field) :: field(:)
     INTEGER,INTENT(IN) :: field_type
     INTEGER,INTENT(IN) :: data_type
@@ -57,10 +95,4 @@
     INTEGER :: ind
     INTEGER :: ii_size,jj_size
-
-!$OMP BARRIER
-!$OMP MASTER
-    ALLOCATE(field(ndomain))
-!$OMP END MASTER
-!$OMP BARRIER
 
     DO ind=1,ndomain
@@ -115,5 +147,5 @@
 !$OMP BARRIER
    
-  END SUBROUTINE allocate_field
+ END SUBROUTINE allocate_field_
 
   SUBROUTINE allocate_field_glo(field,field_type,data_type,dim1,dim2,name)
@@ -181,12 +213,41 @@
 
   SUBROUTINE deallocate_field(field)
+    USE domain_mod
+    USE omp_para
+    IMPLICIT NONE
+    TYPE(t_field),POINTER :: field(:)
+    !$OMP BARRIER
+    CALL deallocate_field_(field)
+    !$OMP BARRIER
+    !$OMP MASTER
+    DEALLOCATE(field)
+    !$OMP END MASTER
+    !$OMP BARRIER
+  END SUBROUTINE deallocate_field
+  
+  SUBROUTINE deallocate_fields(field)
+    USE domain_mod
+    USE omp_para
+    IMPLICIT NONE
+    TYPE(t_field),POINTER :: field(:,:)
+    INTEGER :: i
+    !$OMP BARRIER
+    DO i=1,SIZE(field,2)
+       CALL deallocate_field_(field(:,i))
+    END DO
+    !$OMP BARRIER
+    !$OMP MASTER
+    DEALLOCATE(field)
+    !$OMP END MASTER
+    !$OMP BARRIER
+  END SUBROUTINE deallocate_fields
+
+  SUBROUTINE deallocate_field_(field)
   USE domain_mod
   USE omp_para
   IMPLICIT NONE
-    TYPE(t_field),POINTER :: field(:)
+    TYPE(t_field) :: field(:)
     INTEGER :: data_type
     INTEGER :: ind
-
-!$OMP BARRIER
     DO ind=1,ndomain
       IF (.NOT. assigned_domain(ind)  .OR. .NOT. is_omp_level_master) CYCLE
@@ -209,11 +270,5 @@
       
    ENDDO
-!$OMP BARRIER
-!$OMP MASTER
-   DEALLOCATE(field)
-!$OMP END MASTER
-!$OMP BARRIER
-       
-  END SUBROUTINE deallocate_field
+  END SUBROUTINE deallocate_field_
 
   SUBROUTINE deallocate_field_glo(field)
Index: codes/icosagcm/trunk/src/timeloop_gcm.f90
===================================================================
--- codes/icosagcm/trunk/src/timeloop_gcm.f90	(revision 349)
+++ codes/icosagcm/trunk/src/timeloop_gcm.f90	(revision 350)
@@ -2,4 +2,5 @@
   USE transfert_mod
   USE icosa
+  IMPLICIT NONE
   PRIVATE
   
@@ -13,4 +14,5 @@
   TYPE(t_message),SAVE :: req_ps0, req_mass0, req_theta_rhodz0, req_u0, req_q0
 
+  TYPE(t_field),POINTER,SAVE :: f_geopot(:)
   TYPE(t_field),POINTER,SAVE :: f_q(:)
   TYPE(t_field),POINTER,SAVE :: f_rhodz(:), f_mass(:), f_massm1(:), f_massm2(:), f_dmass(:)
@@ -43,7 +45,6 @@
   USE theta2theta_rhodz_mod
   USE sponge_mod
-  IMPLICIT NONE
-
-    CHARACTER(len=255) :: def
+
+  CHARACTER(len=255) :: def
 
 
@@ -58,4 +59,5 @@
 ! Model state at current time step (RK/MLF/Euler)
     CALL allocate_field(f_ps,field_t,type_real, name='ps')
+    CALL allocate_field(f_geopot,field_t,type_real,llm+1,name='geopot')
     CALL allocate_field(f_mass,field_t,type_real,llm,name='mass')
     CALL allocate_field(f_u,field_u,type_real,llm,name='u')
@@ -189,5 +191,5 @@
    
     CALL switch_omp_distrib_level
-    CALL caldyn_BC(f_phis, f_wflux) ! set constant values in first/last interfaces
+    CALL caldyn_BC(f_phis, f_geopot, f_wflux) ! set constant values in first/last interfaces
     
 !$OMP BARRIER
@@ -251,5 +253,5 @@
        CALL caldyn((stage==1) .AND. (MOD(it,itau_out)==0), &
             f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q, &
-            f_hflux, f_wflux, f_dps, f_dmass, f_dtheta_rhodz, f_du)
+            f_geopot, f_hflux, f_wflux, f_dps, f_dmass, f_dtheta_rhodz, f_du)
 !       CALL checksum(f_dps)
 !       CALL checksum(f_dtheta_rhodz)
