Index: codes/icosagcm/devel/src/dynamics/caldyn_gcm.F90
===================================================================
--- codes/icosagcm/devel/src/dynamics/caldyn_gcm.F90	(revision 824)
+++ codes/icosagcm/devel/src/dynamics/caldyn_gcm.F90	(revision 827)
@@ -16,4 +16,7 @@
   
   SUBROUTINE init_caldyn
+    USE compute_mod, ONLY : compute_pvort_only
+    USE compute_pvort_only_mod, ONLY : compute_pvort_only_hex
+
     CHARACTER(len=255) :: def
     INTEGER            :: ind
@@ -154,4 +157,6 @@
        CALL compute_planetvel(planetvel)
     END DO
+
+    compute_pvort_only => compute_pvort_only_hex
 
   END SUBROUTINE init_caldyn
Index: codes/icosagcm/devel/src/dynamics/caldyn_hevi.f90
===================================================================
--- codes/icosagcm/devel/src/dynamics/caldyn_hevi.f90	(revision 824)
+++ codes/icosagcm/devel/src/dynamics/caldyn_hevi.f90	(revision 827)
@@ -26,4 +26,5 @@
     USE output_field_mod
     USE checksum_mod
+    USE compute_mod, ONLY : compute_pvort_only
     IMPLICIT NONE
     LOGICAL,INTENT(IN)    :: write_out
Index: codes/icosagcm/devel/src/dynamics/caldyn_kernels_hevi.F90
===================================================================
--- codes/icosagcm/devel/src/dynamics/caldyn_kernels_hevi.F90	(revision 824)
+++ codes/icosagcm/devel/src/dynamics/caldyn_kernels_hevi.F90	(revision 827)
@@ -13,5 +13,5 @@
   LOGICAL, SAVE :: debug_hevi_solver = .FALSE.
 
-  PUBLIC :: compute_theta, compute_pvort_only, compute_caldyn_Kv, compute_caldyn_Coriolis, &
+  PUBLIC :: compute_theta, compute_caldyn_Kv, compute_caldyn_Coriolis, &
        compute_caldyn_slow_hydro, compute_caldyn_slow_NH, &
        compute_caldyn_solver, compute_caldyn_fast
@@ -49,57 +49,4 @@
     CALL trace_end("compute_theta")
   END SUBROUTINE compute_theta
-
-  SUBROUTINE compute_pvort_only(u,rhodz,qu,qv,hv_)
-    REAL(rstd),INTENT(IN)  :: u(iim*3*jjm,llm)
-    REAL(rstd),INTENT(INOUT) :: rhodz(iim*jjm,llm)
-    REAL(rstd),INTENT(OUT) :: qu(iim*3*jjm,llm)
-    REAL(rstd),INTENT(OUT) :: qv(iim*2*jjm,llm)
-    REAL(rstd),INTENT(OUT) :: hv_(iim*2*jjm,llm)
-
-    INTEGER :: ij,l
-    REAL(rstd) :: etav,hv,radius_m2
-
-    CALL trace_start("compute_pvort_only")  
-!!! Compute shallow-water potential vorticity
-    IF(dysl_pvort_only) THEN
-#include "../kernels_hex/pvort_only.k90"
-    ELSE
-
-    radius_m2=radius**(-2)
-    DO l = ll_begin,ll_end
-       !DIR$ SIMD
-       DO ij=ij_begin_ext,ij_end_ext
-          etav= 1./Av(ij+z_up)*(  ne_rup  * u(ij+u_rup,l)   &
-                  + ne_left * u(ij+t_rup+u_left,l)          &
-                  - ne_lup  * u(ij+u_lup,l) )                               
-          hv =   Riv2(ij,vup)          * rhodz(ij,l)        &
-               + Riv2(ij+t_rup,vldown) * rhodz(ij+t_rup,l)  &
-               + Riv2(ij+t_lup,vrdown) * rhodz(ij+t_lup,l)
-          qv(ij+z_up,l) = ( etav+fv(ij+z_up) )/hv
-          hv_(ij+z_up,l) = hv
-          
-          etav = 1./Av(ij+z_down)*(  ne_ldown * u(ij+u_ldown,l)   &
-               + ne_right * u(ij+t_ldown+u_right,l)               &
-               - ne_rdown * u(ij+u_rdown,l) )
-          hv =   Riv2(ij,vdown)        * rhodz(ij,l)              &
-               + Riv2(ij+t_ldown,vrup) * rhodz(ij+t_ldown,l)      &
-               + Riv2(ij+t_rdown,vlup) * rhodz(ij+t_rdown,l)
-          qv(ij+z_down,l) =( etav+fv(ij+z_down) )/hv
-          hv_(ij+z_down,l) = hv
-       ENDDO
-
-       !DIR$ SIMD
-       DO ij=ij_begin,ij_end
-          qu(ij+u_right,l) = 0.5*(qv(ij+z_rdown,l)+qv(ij+z_rup,l))  
-          qu(ij+u_lup,l) = 0.5*(qv(ij+z_up,l)+qv(ij+z_lup,l))  
-          qu(ij+u_ldown,l) = 0.5*(qv(ij+z_ldown,l)+qv(ij+z_down,l))  
-       END DO
-
-    ENDDO
-   
-    END IF ! dysl
-    CALL trace_end("compute_pvort_only")
-
-  END SUBROUTINE compute_pvort_only
 
   SUBROUTINE compute_caldyn_kv(ue, Kv)
Index: codes/icosagcm/devel/src/dynamics/caldyn_vars.f90
===================================================================
--- codes/icosagcm/devel/src/dynamics/caldyn_vars.f90	(revision 824)
+++ codes/icosagcm/devel/src/dynamics/caldyn_vars.f90	(revision 827)
@@ -3,8 +3,8 @@
   USE transfert_mod
   IMPLICIT NONE
-  PUBLIC
+  PRIVATE
   SAVE
 
-  INTEGER, PARAMETER :: conserv_energy=1, conserv_enstrophy=2, conserv_gassmann=3, &
+  INTEGER, PUBLIC, PARAMETER :: conserv_energy=1, conserv_enstrophy=2, conserv_gassmann=3, &
        kinetic_trisk=1, kinetic_consistent=2, &
        caldyn_vert_noncons=1, caldyn_vert_cons=2, &
@@ -12,19 +12,19 @@
        thermo_moist=3, thermo_boussinesq=4, thermo_dry=10, thermo_fake_moist=11, thermo_moist_debug=100
 
-  INTEGER :: caldyn_conserv, caldyn_kinetic, caldyn_thermo, caldyn_vert_variant, physics_thermo
+  INTEGER, PUBLIC :: caldyn_conserv, caldyn_kinetic, caldyn_thermo, caldyn_vert_variant, physics_thermo
   !$OMP THREADPRIVATE(caldyn_conserv, caldyn_kinetic, caldyn_thermo, caldyn_vert_variant, physics_thermo)
 
-  LOGICAL :: boussinesq, hydrostatic
+  LOGICAL, PUBLIC :: boussinesq, hydrostatic
   !$OMP THREADPRIVATE(boussinesq, hydrostatic)
 
-  LOGICAL :: dysl, dysl_geopot, dysl_pvort_only, dysl_caldyn_fast, dysl_caldyn_coriolis, dysl_slow_hydro, dysl_caldyn_vert
+  LOGICAL, PUBLIC :: dysl, dysl_geopot, dysl_pvort_only, dysl_caldyn_fast, dysl_caldyn_coriolis, dysl_slow_hydro, dysl_caldyn_vert
   !$OMP THREADPRIVATE(dysl, dysl_geopot, dysl_pvort_only, dysl_caldyn_fast, dysl_caldyn_coriolis, dysl_slow_hydro, dysl_caldyn_vert)
 
   ! temporary shared variables for caldyn
-  TYPE(t_field),POINTER :: f_qu(:), f_qv(:), f_Kv(:), f_hv(:), &
+  TYPE(t_field),POINTER, PUBLIC :: f_qu(:), f_qv(:), f_Kv(:), f_hv(:), &
                            f_pk(:),f_wwuu(:),f_planetvel(:), &
                            f_Fel(:), f_gradPhi2(:), f_wil(:), f_Wetadot(:)
 
-  TYPE(t_message) :: req_ps, req_mass, req_theta_rhodz, req_u, req_qu, req_geopot, req_w, req_Kv
+  TYPE(t_message), PUBLIC :: req_ps, req_mass, req_theta_rhodz, req_u, req_qu, req_geopot, req_w, req_Kv
 
 END MODULE caldyn_vars_mod
Index: codes/icosagcm/devel/src/dynamics/compute.f90
===================================================================
--- codes/icosagcm/devel/src/dynamics/compute.f90	(revision 827)
+++ codes/icosagcm/devel/src/dynamics/compute.f90	(revision 827)
@@ -0,0 +1,20 @@
+MODULE compute_mod
+  IMPLICIT NONE
+  SAVE
+
+  INTERFACE
+
+    SUBROUTINE comp_pvort_only(u,rhodz,qu,qv, hv_)
+      USE prec, ONLY : rstd
+      REAL(rstd),INTENT(IN)  :: u(1,1)
+      REAL(rstd),INTENT(INOUT) :: rhodz(1,1)
+      REAL(rstd),INTENT(OUT) :: qu(1,1)
+      REAL(rstd),INTENT(OUT) :: qv(1,1)
+      REAL(rstd),INTENT(OUT) :: hv_(1,1)
+    END SUBROUTINE comp_pvort_only
+
+  END INTERFACE
+
+  PROCEDURE(comp_pvort_only), POINTER :: compute_pvort_only => NULL()
+
+END MODULE compute_mod
Index: codes/icosagcm/devel/src/dynamics/compute_pvort_only.F90
===================================================================
--- codes/icosagcm/devel/src/dynamics/compute_pvort_only.F90	(revision 827)
+++ codes/icosagcm/devel/src/dynamics/compute_pvort_only.F90	(revision 827)
@@ -0,0 +1,91 @@
+MODULE compute_pvort_only_mod
+  USE compute_mod, ONLY : comp_pvort_only
+  USE grid_param, ONLY : llm
+  IMPLICIT NONE
+  PRIVATE
+
+#include "../unstructured/unstructured.h90"
+
+  PROCEDURE(comp_pvort_only), POINTER :: &
+       ptr1 => compute_pvort_only_unst, &
+       ptr2 => compute_pvort_only_hex
+  
+  PUBLIC :: compute_pvort_only_hex, compute_pvort_only_unst
+
+CONTAINS
+  
+  SUBROUTINE compute_pvort_only_unst(u,rhodz,qu,qv, hv_)
+    USE ISO_C_BINDING, only : C_DOUBLE, C_FLOAT
+    USE data_unstructured_mod, ONLY : enter_trace, exit_trace, &
+         id_pvort_only, primal_num, dual_num, edge_num, &
+         dual_deg, dual_edge, dual_ne, dual_vertex, up, down, Av, fv, Riv2
+    FIELD_MASS :: rhodz
+    FIELD_U    :: u,qu
+    FIELD_Z    :: qv, hv_
+    DECLARE_INDICES
+    DECLARE_EDGES
+    DECLARE_VERTICES
+    NUM :: etav, hv
+    START_TRACE(id_pvort_only, 1,1,2) ! primal, dual, edge
+#include "../kernels_unst/pvort_only.k90"
+    STOP_TRACE
+  END SUBROUTINE compute_pvort_only_unst
+
+  SUBROUTINE compute_pvort_only_hex(u,rhodz,qu,qv,hv_)
+    USE icosa
+    USE trace, ONLY : trace_start, trace_end
+    USE caldyn_vars_mod, ONLY : dysl_pvort_only
+    USE omp_para, ONLY : ll_begin, ll_end
+    REAL(rstd),INTENT(IN)  :: u(iim*3*jjm,llm)
+    REAL(rstd),INTENT(INOUT) :: rhodz(iim*jjm,llm)
+    REAL(rstd),INTENT(OUT) :: qu(iim*3*jjm,llm)
+    REAL(rstd),INTENT(OUT) :: qv(iim*2*jjm,llm)
+    REAL(rstd),INTENT(OUT) :: hv_(iim*2*jjm,llm)
+
+    INTEGER :: ij,l
+    REAL(rstd) :: etav,hv,radius_m2
+
+    CALL trace_start("compute_pvort_only")  
+!!! Compute shallow-water potential vorticity
+    IF(dysl_pvort_only) THEN
+#include "../kernels_hex/pvort_only.k90"
+    ELSE
+
+    radius_m2=radius**(-2)
+    DO l = ll_begin,ll_end
+       !DIR$ SIMD
+       DO ij=ij_begin_ext,ij_end_ext
+          etav= 1./Av(ij+z_up)*(  ne_rup  * u(ij+u_rup,l)   &
+                  + ne_left * u(ij+t_rup+u_left,l)          &
+                  - ne_lup  * u(ij+u_lup,l) )                               
+          hv =   Riv2(ij,vup)          * rhodz(ij,l)        &
+               + Riv2(ij+t_rup,vldown) * rhodz(ij+t_rup,l)  &
+               + Riv2(ij+t_lup,vrdown) * rhodz(ij+t_lup,l)
+          qv(ij+z_up,l) = ( etav+fv(ij+z_up) )/hv
+          hv_(ij+z_up,l) = hv
+          
+          etav = 1./Av(ij+z_down)*(  ne_ldown * u(ij+u_ldown,l)   &
+               + ne_right * u(ij+t_ldown+u_right,l)               &
+               - ne_rdown * u(ij+u_rdown,l) )
+          hv =   Riv2(ij,vdown)        * rhodz(ij,l)              &
+               + Riv2(ij+t_ldown,vrup) * rhodz(ij+t_ldown,l)      &
+               + Riv2(ij+t_rdown,vlup) * rhodz(ij+t_rdown,l)
+          qv(ij+z_down,l) =( etav+fv(ij+z_down) )/hv
+          hv_(ij+z_down,l) = hv
+       ENDDO
+
+       !DIR$ SIMD
+       DO ij=ij_begin,ij_end
+          qu(ij+u_right,l) = 0.5*(qv(ij+z_rdown,l)+qv(ij+z_rup,l))  
+          qu(ij+u_lup,l) = 0.5*(qv(ij+z_up,l)+qv(ij+z_lup,l))  
+          qu(ij+u_ldown,l) = 0.5*(qv(ij+z_ldown,l)+qv(ij+z_down,l))  
+       END DO
+
+    ENDDO
+   
+    END IF ! dysl
+    CALL trace_end("compute_pvort_only")
+
+  END SUBROUTINE compute_pvort_only_hex
+
+END MODULE compute_pvort_only_mod
