Index: /LMDZ5/trunk/libf/bibio/arth.F90
===================================================================
--- /LMDZ5/trunk/libf/bibio/arth.F90	(revision 2227)
+++ /LMDZ5/trunk/libf/bibio/arth.F90	(revision 2228)
@@ -7,9 +7,9 @@
   INTERFACE arth
      ! Returns an arithmetic progression, given a first term "first", an
-     ! increment and a number of terms "n".
+     ! increment and a number of terms "n" (including "first").
 
      MODULE PROCEDURE arth_r, arth_i
-     ! The difference between the procedures is the type of
-     ! arguments "first" and "increment" and of function result.
+     ! The difference between the procedures is the kind and type of
+     ! arguments first and increment and of function result.
   END INTERFACE
 
@@ -22,8 +22,7 @@
     REAL, INTENT(IN) :: first,increment
     INTEGER, INTENT(IN) :: n
-    REAL, DIMENSION(n) :: arth_r
+    REAL arth_r(n)
 
-    ! Variables local to the procedure:
-
+    ! Local:
     INTEGER :: k,k2
     REAL :: temp
@@ -50,4 +49,5 @@
        end do
     end if
+
   END FUNCTION arth_r
 
@@ -57,6 +57,11 @@
 
     INTEGER, INTENT(IN) :: first,increment,n
-    INTEGER, DIMENSION(n) :: arth_i
+    INTEGER arth_i(n)
+
+    ! Local:
     INTEGER :: k,k2,temp
+
+    !---------------------------------------
+
     if (n > 0) arth_i(1)=first
     if (n <= NPAR_ARTH) then
@@ -78,4 +83,5 @@
        end do
     end if
+
   END FUNCTION arth_i
 
Index: /LMDZ5/trunk/libf/bibio/nrtype.F90
===================================================================
--- /LMDZ5/trunk/libf/bibio/nrtype.F90	(revision 2227)
+++ /LMDZ5/trunk/libf/bibio/nrtype.F90	(revision 2228)
@@ -3,5 +3,5 @@
   implicit none
 
-  integer, parameter:: wp = kind(0.) ! working precision for real type
+  integer, parameter:: k8 = selected_real_kind(13)
 
   ! Frequently used mathematical constants (with precision to spare):
@@ -13,27 +13,10 @@
   REAL, PARAMETER :: EULER=0.5772156649015328606065120900824024310422
 
-  DOUBLE PRECISION, PARAMETER:: &
-       PI_D = 3.141592653589793238462643383279502884197d0
-  DOUBLE PRECISION, PARAMETER:: &
-       PIO2_D=1.57079632679489661923132169163975144209858d0
-  DOUBLE PRECISION, PARAMETER:: &
-       TWOPI_D=6.283185307179586476925286766559005768394d0
-
-  ! Derived data types for sparse matrices, single and double
-  ! precision (see use in Chapter B2):
-
-  TYPE sprs2_sp
-     INTEGER :: n,len
-     REAL, DIMENSION(:), POINTER :: val
-     INTEGER, DIMENSION(:), POINTER :: irow
-     INTEGER, DIMENSION(:), POINTER :: jcol
-  END TYPE sprs2_sp
-
-  TYPE sprs2_dp
-     INTEGER :: n,len
-     DOUBLE PRECISION, DIMENSION(:), POINTER :: val
-     INTEGER, DIMENSION(:), POINTER :: irow
-     INTEGER, DIMENSION(:), POINTER :: jcol
-  END TYPE sprs2_dp
+  REAL(K8), PARAMETER:: &
+       PI_D = 3.141592653589793238462643383279502884197_k8
+  REAL(K8), PARAMETER:: &
+       PIO2_D=1.57079632679489661923132169163975144209858_k8
+  REAL(K8), PARAMETER:: &
+       TWOPI_D=6.283185307179586476925286766559005768394_k8
 
 END MODULE nrtype
Index: /LMDZ5/trunk/libf/dyn3d_common/coefpoly_m.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3d_common/coefpoly_m.F90	(revision 2227)
+++ /LMDZ5/trunk/libf/dyn3d_common/coefpoly_m.F90	(revision 2228)
@@ -25,9 +25,11 @@
     ! a0, a1, a2, a3.
 
-    DOUBLE PRECISION, intent(in):: xf1, xf2, xprim1, xprim2, xtild1, xtild2
-    DOUBLE PRECISION, intent(out):: a0, a1, a2, a3
+    use nrtype, only: k8
+
+    REAL(K8), intent(in):: xf1, xf2, xprim1, xprim2, xtild1, xtild2
+    REAL(K8), intent(out):: a0, a1, a2, a3
 
     ! Local:
-    DOUBLE PRECISION xtil1car, xtil2car, derr, x1x2car
+    REAL(K8) xtil1car, xtil2car, derr, x1x2car
 
     !------------------------------------------------------------
Index: /LMDZ5/trunk/libf/dyn3d_common/fxhyp_m.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3d_common/fxhyp_m.F90	(revision 2227)
+++ /LMDZ5/trunk/libf/dyn3d_common/fxhyp_m.F90	(revision 2228)
@@ -20,5 +20,5 @@
     use arth_m, only: arth
     use invert_zoom_x_m, only: invert_zoom_x, nmax
-    use nrtype, only: pi, pi_d, twopi, twopi_d
+    use nrtype, only: pi, pi_d, twopi, twopi_d, k8
     use principal_cshift_m, only: principal_cshift
 
@@ -36,10 +36,10 @@
     REAL dzoom, step
     real d_rlonv(iim)
-    DOUBLE PRECISION xtild(0:2 * nmax)
-    DOUBLE PRECISION fhyp(nmax:2 * nmax), ffdx, beta, Xprimt(0:2 * nmax)
-    DOUBLE PRECISION Xf(0:2 * nmax), xxpr(2 * nmax)
-    DOUBLE PRECISION fa, fb
+    REAL(K8) xtild(0:2 * nmax)
+    REAL(K8) fhyp(nmax:2 * nmax), ffdx, beta, Xprimt(0:2 * nmax)
+    REAL(K8) Xf(0:2 * nmax), xxpr(2 * nmax)
+    REAL(K8) fa, fb
     INTEGER i, is2
-    DOUBLE PRECISION xmoy, fxm
+    REAL(K8) xmoy, fxm
 
     !----------------------------------------------------------------------
@@ -175,11 +175,11 @@
 
           call invert_zoom_x(xf, xtild, Xprimt, rlonm025(:iim), &
-               xprimm025(:iim), xuv = - 0.25d0)
+               xprimm025(:iim), xuv = - 0.25_k8)
           call invert_zoom_x(xf, xtild, Xprimt, rlonv(:iim), xprimv(:iim), &
-               xuv = 0d0)
+               xuv = 0._k8)
           call invert_zoom_x(xf, xtild, Xprimt, rlonu(:iim), xprimu(:iim), &
-               xuv = 0.5d0)
+               xuv = 0.5_k8)
           call invert_zoom_x(xf, xtild, Xprimt, rlonp025(:iim), &
-               xprimp025(:iim), xuv = 0.25d0)
+               xprimp025(:iim), xuv = 0.25_k8)
        end if test_grossismx
 
Index: /LMDZ5/trunk/libf/dyn3d_common/fyhyp_m.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3d_common/fyhyp_m.F90	(revision 2227)
+++ /LMDZ5/trunk/libf/dyn3d_common/fyhyp_m.F90	(revision 2228)
@@ -17,4 +17,5 @@
 
     use coefpoly_m, only: coefpoly
+    use nrtype, only: k8
 
     include "dimensions.h"
@@ -30,20 +31,20 @@
     ! Local: 
 
-    DOUBLE PRECISION champmin, champmax
+    REAL(K8) champmin, champmax
     INTEGER, PARAMETER:: nmax=30000, nmax2=2*nmax
     REAL dzoom ! distance totale de la zone du zoom (en radians)
-    DOUBLE PRECISION ylat(jjm + 1), yprim(jjm + 1)
-    DOUBLE PRECISION yuv
-    DOUBLE PRECISION, save:: yt(0:nmax2)
-    DOUBLE PRECISION fhyp(0:nmax2), beta
-    DOUBLE PRECISION, save:: ytprim(0:nmax2)
-    DOUBLE PRECISION fxm(0:nmax2)
-    DOUBLE PRECISION, save:: yf(0:nmax2)
-    DOUBLE PRECISION yypr(0:nmax2)
-    DOUBLE PRECISION yvrai(jjm + 1), yprimm(jjm + 1), ylatt(jjm + 1)
-    DOUBLE PRECISION pi, pis2, epsilon, y0, pisjm
-    DOUBLE PRECISION yo1, yi, ylon2, ymoy, yprimin
-    DOUBLE PRECISION yfi, yf1, ffdy
-    DOUBLE PRECISION ypn, deply, y00
+    REAL(K8) ylat(jjm + 1), yprim(jjm + 1)
+    REAL(K8) yuv
+    REAL(K8), save:: yt(0:nmax2)
+    REAL(K8) fhyp(0:nmax2), beta
+    REAL(K8), save:: ytprim(0:nmax2)
+    REAL(K8) fxm(0:nmax2)
+    REAL(K8), save:: yf(0:nmax2)
+    REAL(K8) yypr(0:nmax2)
+    REAL(K8) yvrai(jjm + 1), yprimm(jjm + 1), ylatt(jjm + 1)
+    REAL(K8) pi, pis2, epsilon, y0, pisjm
+    REAL(K8) yo1, yi, ylon2, ymoy, yprimin
+    REAL(K8) yfi, yf1, ffdy
+    REAL(K8) ypn, deply, y00
     SAVE y00, deply
 
@@ -51,9 +52,9 @@
     INTEGER jpn, jjpn
     SAVE jpn
-    DOUBLE PRECISION a0, a1, a2, a3, yi2, heavyy0, heavyy0m
-    DOUBLE PRECISION fa(0:nmax2), fb(0:nmax2)
+    REAL(K8) a0, a1, a2, a3, yi2, heavyy0, heavyy0m
+    REAL(K8) fa(0:nmax2), fb(0:nmax2)
     REAL y0min, y0max
 
-    DOUBLE PRECISION heavyside
+    REAL(K8) heavyside
 
     !-------------------------------------------------------------------
Index: /LMDZ5/trunk/libf/dyn3d_common/invert_zoom_x_m.F90
===================================================================
--- /LMDZ5/trunk/libf/dyn3d_common/invert_zoom_x_m.F90	(revision 2227)
+++ /LMDZ5/trunk/libf/dyn3d_common/invert_zoom_x_m.F90	(revision 2228)
@@ -10,5 +10,5 @@
 
     use coefpoly_m, only: coefpoly
-    use nrtype, only: pi, pi_d, twopi_d
+    use nrtype, only: pi, pi_d, twopi_d, k8
 
     include "dimensions.h"
@@ -18,17 +18,17 @@
     ! for clon
 
-    DOUBLE PRECISION, intent(in):: Xf(0:), xtild(0:), Xprimt(0:) ! (0:2 * nmax)
+    REAL(K8), intent(in):: Xf(0:), xtild(0:), Xprimt(0:) ! (0:2 * nmax)
     real, intent(out):: xlon(:), xprimm(:) ! (iim)
 
-    DOUBLE PRECISION, intent(in):: xuv
+    REAL(K8), intent(in):: xuv
     ! 0. si calcul aux points scalaires 
     ! 0.5 si calcul aux points U 
 
     ! Local:
-    DOUBLE PRECISION xo1, Xfi, a0, a1, a2, a3, Xf1, Xprimin
+    REAL(K8) xo1, Xfi, a0, a1, a2, a3, Xf1, Xprimin
     integer i, it, iter
-    DOUBLE PRECISION, parameter:: my_eps = 1d-6
+    REAL(K8), parameter:: my_eps = 1e-6_k8
 
-    DOUBLE PRECISION xxprim(iim), xvrai(iim) 
+    REAL(K8) xxprim(iim), xvrai(iim) 
     ! intermediary variables because xlon and xprimm are simple precision
 
@@ -36,5 +36,5 @@
 
     DO i = 1, iim
-       Xfi = - pi_d + (i + xuv - 0.75d0) * twopi_d / iim
+       Xfi = - pi_d + (i + xuv - 0.75_k8) * twopi_d / iim
 
        it = 2 * nmax
@@ -54,5 +54,5 @@
             xtild(it), xtild(it + 1), a0, a1, a2, a3)
        Xf1 = Xf(it)
-       Xprimin = a1 + xvrai(i) * (2d0 * a2 + xvrai(i) * 3d0 * a3)
+       Xprimin = a1 + xvrai(i) * (2._k8 * a2 + xvrai(i) * 3._k8 * a3)
        xo1 = xvrai(i)
        iter = 1
@@ -63,5 +63,5 @@
           xo1 = xvrai(i)
           Xf1 = a0 + xvrai(i) * (a1 + xvrai(i) * (a2 + xvrai(i) * a3))
-          Xprimin = a1 + xvrai(i) * (2d0 * a2 + xvrai(i) * 3d0 * a3)
+          Xprimin = a1 + xvrai(i) * (2._k8 * a2 + xvrai(i) * 3._k8 * a3)
        end DO
 
