Index: /palm/trunk/SOURCE/advec_s_bc.f90
===================================================================
--- /palm/trunk/SOURCE/advec_s_bc.f90	(revision 1352)
+++ /palm/trunk/SOURCE/advec_s_bc.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -170,15 +170,15 @@
 !-- Array sk_p requires 2 extra elements for each dimension
     ALLOCATE( sk_p(nzb-2:nzt+3,nys-3:nyn+3,nxl-3:nxr+3) )
-    sk_p = 0.0
+    sk_p = 0.0_wp
 
 !
 !-- Assign reciprocal values in order to avoid divisions later
-    f2    = 0.5
-    f4    = 0.25
-    f8    = 0.125
-    f12   = 0.8333333333333333E-01
-    f24   = 0.4166666666666666E-01
-    f48   = 0.2083333333333333E-01
-    f1920 = 0.5208333333333333E-03
+    f2    = 0.5_wp
+    f4    = 0.25_wp
+    f8    = 0.125_wp
+    f12   = 0.8333333333333333E-01_wp
+    f24   = 0.4166666666666666E-01_wp
+    f48   = 0.2083333333333333E-01_wp
+    f1920 = 0.5208333333333333E-03_wp
 
 !
@@ -236,13 +236,13 @@
 !
 !-- Initialise control density
-    d = 0.0
+    d = 0.0_wp
 
 !
 !-- Determine maxima of the first and second derivative in x-direction
-    fmax_l = 0.0
+    fmax_l = 0.0_wp
     DO  i = nxl, nxr
        DO  j = nys, nyn
           DO  k = nzb+1, nzt
-             numera = ABS( sk_p(k,j,i+1) - 2.0 * sk_p(k,j,i) + sk_p(k,j,i-1) )
+             numera = ABS( sk_p(k,j,i+1) - 2.0_wp * sk_p(k,j,i) + sk_p(k,j,i-1) )
              denomi  = ABS( sk_p(k,j,i+1) - sk_p(k,j,i-1) )
              fmax_l(1) = MAX( fmax_l(1) , numera )
@@ -258,5 +258,5 @@
 #endif
 
-    fmax = 0.04 * fmax
+    fmax = 0.04_wp * fmax
 
 !
@@ -271,5 +271,5 @@
               sw(nzb+1:nzt,nxl-1:nxr+1)                                        &
             )
-    imme = 0.0; impe = 0.0; ipme = 0.0; ippe = 0.0
+    imme = 0.0_wp; impe = 0.0_wp; ipme = 0.0_wp; ippe = 0.0_wp
 
 !
@@ -287,16 +287,16 @@
        DO  i = nxl-1, nxr+1
           DO  k = nzb+1, nzt
-             a12(k,i) = 0.5 * ( sk_p(k,j,i+1) - sk_p(k,j,i-1) )
-             a22(k,i) = 0.5 * ( sk_p(k,j,i+1) - 2.0 * sk_p(k,j,i)              &
-                                              + sk_p(k,j,i-1) )
-             a0(k,i) = ( 9.0 * sk_p(k,j,i+2) - 116.0 * sk_p(k,j,i+1)           &
-                         + 2134.0 * sk_p(k,j,i) - 116.0 * sk_p(k,j,i-1)        &
-                         + 9.0 * sk_p(k,j,i-2) ) * f1920
-             a1(k,i) = ( -5.0 * sk_p(k,j,i+2) + 34.0 * sk_p(k,j,i+1)           &
-                         - 34.0 * sk_p(k,j,i-1) + 5.0 * sk_p(k,j,i-2)          &
+             a12(k,i) = 0.5_wp * ( sk_p(k,j,i+1) - sk_p(k,j,i-1) )
+             a22(k,i) = 0.5_wp * ( sk_p(k,j,i+1) - 2.0_wp * sk_p(k,j,i)        &
+                                                 + sk_p(k,j,i-1) )
+             a0(k,i) = ( 9.0_wp * sk_p(k,j,i+2)    - 116.0_wp * sk_p(k,j,i+1)  &
+                         + 2134.0_wp * sk_p(k,j,i) - 116.0_wp * sk_p(k,j,i-1)  &
+                         + 9.0_wp * sk_p(k,j,i-2) ) * f1920
+             a1(k,i) = ( -5.0_wp * sk_p(k,j,i+2)   + 34.0_wp * sk_p(k,j,i+1)   &
+                         - 34.0_wp * sk_p(k,j,i-1) + 5.0_wp * sk_p(k,j,i-2)    &
                        ) * f48
-             a2(k,i) = ( -3.0 * sk_p(k,j,i+2) + 36.0 * sk_p(k,j,i+1)           &
-                         - 66.0 * sk_p(k,j,i) + 36.0 * sk_p(k,j,i-1)           &
-                         - 3.0 * sk_p(k,j,i-2) ) * f48
+             a2(k,i) = ( -3.0_wp * sk_p(k,j,i+2) + 36.0_wp * sk_p(k,j,i+1)     &
+                         - 66.0_wp * sk_p(k,j,i) + 36.0_wp * sk_p(k,j,i-1)     &
+                         - 3.0_wp * sk_p(k,j,i-2) ) * f48
           ENDDO
        ENDDO
@@ -309,31 +309,31 @@
              cip  =  MAX( 0.0_wp, ( u(k,j,i+1) - u_gtrans ) * dt_3d * ddx )
              cim  = -MIN( 0.0_wp, ( u(k,j,i+1) - u_gtrans ) * dt_3d * ddx )
-             cipf = 1.0 - 2.0 * cip
-             cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k,i)   * f2  * ( 1.0 - cipf )                         &
-                    + a1(k,i)   * f8  * ( 1.0 - cipf*cipf )                    &
-                    + a2(k,i)   * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k,i+1) * f2  * ( 1.0 - cimf )                         &
-                    - a1(k,i+1) * f8  * ( 1.0 - cimf*cimf )                    &
-                    + a2(k,i+1) * f24 * ( 1.0 - cimf*cimf*cimf )
+             cipf = 1.0_wp - 2.0_wp * cip
+             cimf = 1.0_wp - 2.0_wp * cim
+             ip   =   a0(k,i)   * f2  * ( 1.0_wp - cipf )                      &
+                    + a1(k,i)   * f8  * ( 1.0_wp - cipf*cipf )                 &
+                    + a2(k,i)   * f24 * ( 1.0_wp - cipf*cipf*cipf )
+             im   =   a0(k,i+1) * f2  * ( 1.0_wp - cimf )                      &
+                    - a1(k,i+1) * f8  * ( 1.0_wp - cimf*cimf )                 &
+                    + a2(k,i+1) * f24 * ( 1.0_wp - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0_wp )
              im   = MAX( im, 0.0_wp )
-             ippb(k,i) = ip * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15) )
-             impb(k,i) = im * MIN( 1.0_wp, sk_p(k,j,i+1) / (ip+im+1E-15) )
+             ippb(k,i) = ip * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15_wp) )
+             impb(k,i) = im * MIN( 1.0_wp, sk_p(k,j,i+1) / (ip+im+1E-15_wp) )
 
              cip  =  MAX( 0.0_wp, ( u(k,j,i) - u_gtrans ) * dt_3d * ddx )
              cim  = -MIN( 0.0_wp, ( u(k,j,i) - u_gtrans ) * dt_3d * ddx )
-             cipf = 1.0 - 2.0 * cip
-             cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k,i-1) * f2  * ( 1.0 - cipf )                         &
-                    + a1(k,i-1) * f8  * ( 1.0 - cipf*cipf )                    &
-                    + a2(k,i-1) * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k,i)   * f2  * ( 1.0 - cimf )                         &
-                    - a1(k,i)   * f8  * ( 1.0 - cimf*cimf )                    &
-                    + a2(k,i)   * f24 * ( 1.0 - cimf*cimf*cimf )
+             cipf = 1.0_wp - 2.0_wp * cip
+             cimf = 1.0_wp - 2.0_wp * cim
+             ip   =   a0(k,i-1) * f2  * ( 1.0_wp - cipf )                      &
+                    + a1(k,i-1) * f8  * ( 1.0_wp - cipf*cipf )                 &
+                    + a2(k,i-1) * f24 * ( 1.0_wp - cipf*cipf*cipf )
+             im   =   a0(k,i)   * f2  * ( 1.0_wp - cimf )                      &
+                    - a1(k,i)   * f8  * ( 1.0_wp - cimf*cimf )                 &
+                    + a2(k,i)   * f24 * ( 1.0_wp - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0_wp )
              im   = MAX( im, 0.0_wp )
-             ipmb(k,i) = ip * MIN( 1.0_wp, sk_p(k,j,i-1) / (ip+im+1E-15) )
-             immb(k,i) = im * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15) )
+             ipmb(k,i) = ip * MIN( 1.0_wp, sk_p(k,j,i-1) / (ip+im+1E-15_wp) )
+             immb(k,i) = im * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15_wp) )
           ENDDO
        ENDDO
@@ -343,13 +343,13 @@
        DO  i = nxl-2, nxr+2
           DO  k = nzb+1, nzt
-             m1z = ABS( sk_p(k,j,i+1) - 2.0 * sk_p(k,j,i) + sk_p(k,j,i-1) )
+             m1z = ABS( sk_p(k,j,i+1) - 2.0_wp * sk_p(k,j,i) + sk_p(k,j,i-1) )
              m1n = ABS( sk_p(k,j,i+1) - sk_p(k,j,i-1) )
-             IF ( m1n /= 0.0  .AND.  m1n >= m1z )  THEN
+             IF ( m1n /= 0.0_wp  .AND.  m1n >= m1z )  THEN
                 m1(k,i) = m1z / m1n
-                IF ( m1(k,i) /= 2.0  .AND.  m1n < fmax(2) )  m1(k,i) = 0.0
+                IF ( m1(k,i) /= 2.0_wp  .AND.  m1n < fmax(2) )  m1(k,i) = 0.0_wp
              ELSEIF ( m1n < m1z )  THEN
-                m1(k,i) = -1.0
+                m1(k,i) = -1.0_wp
              ELSE
-                m1(k,i) = 0.0
+                m1(k,i) = 0.0_wp
              ENDIF
           ENDDO
@@ -358,25 +358,25 @@
 !
 !--    Compute switch sw
-       sw = 0.0
+       sw = 0.0_wp
        DO  i = nxl-1, nxr+1
           DO  k = nzb+1, nzt
-             m2 = 2.0 * ABS( a1(k,i) - a12(k,i) ) /                            &
+             m2 = 2.0_wp * ABS( a1(k,i) - a12(k,i) ) /                         &
                   MAX( ABS( a1(k,i) + a12(k,i) ), 1E-35_wp )
-             IF ( ABS( a1(k,i) + a12(k,i) ) < fmax(2) )  m2 = 0.0
-
-             m3 = 2.0 * ABS( a2(k,i) - a22(k,i) ) /                            &
+             IF ( ABS( a1(k,i) + a12(k,i) ) < fmax(2) )  m2 = 0.0_wp
+
+             m3 = 2.0_wp * ABS( a2(k,i) - a22(k,i) ) /                         &
                   MAX( ABS( a2(k,i) + a22(k,i) ), 1E-35_wp )
-             IF ( ABS( a2(k,i) + a22(k,i) ) < fmax(1) )  m3 = 0.0
-
-             t1 = 0.35
-             t2 = 0.35
-             IF ( m1(k,i) == -1.0 )  t2 = 0.12
+             IF ( ABS( a2(k,i) + a22(k,i) ) < fmax(1) )  m3 = 0.0_wp
+
+             t1 = 0.35_wp
+             t2 = 0.35_wp
+             IF ( m1(k,i) == -1.0_wp )  t2 = 0.12_wp
 
 !--          *VOCL STMT,IF(10)
-             IF ( m1(k,i-1) == 1.0 .OR. m1(k,i) == 1.0 .OR. m1(k,i+1) == 1.0   &
-                  .OR.  m2 > t2  .OR.  m3 > t2  .OR.                           &
-                  ( m1(k,i) > t1  .AND.  m1(k,i-1) /= -1.0  .AND.              &
-                    m1(k,i) /= -1.0  .AND.  m1(k,i+1) /= -1.0 )                &
-                )  sw(k,i) = 1.0
+             IF ( m1(k,i-1) == 1.0_wp .OR. m1(k,i) == 1.0_wp                   &
+                  .OR. m1(k,i+1) == 1.0_wp .OR.  m2 > t2  .OR.  m3 > t2  .OR.  &
+                  ( m1(k,i) > t1  .AND.  m1(k,i-1) /= -1.0_wp  .AND.           &
+                    m1(k,i) /= -1.0_wp  .AND.  m1(k,i+1) /= -1.0_wp )          &
+                )  sw(k,i) = 1.0_wp
           ENDDO
        ENDDO
@@ -389,7 +389,7 @@
 
 !--          *VOCL STMT,IF(10)
-             IF ( sw(k,i) == 1.0 )  THEN
+             IF ( sw(k,i) == 1.0_wp )  THEN
                 snenn = sk_p(k,j,i+1) - sk_p(k,j,i-1)
-                IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
+                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k,j,i) - sk_p(k,j,i-1) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -402,12 +402,13 @@
                 ippe(k,i) = sk_p(k,j,i-1) * cip + snenn * (                    &
                             aex(ix) * cip + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0 - 2.0 * cip ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cip ) )  &
                                                                 )              &
                                                           )
-                IF ( sterm == 0.0001 )  ippe(k,i) = sk_p(k,j,i) * cip
-                IF ( sterm == 0.9999 )  ippe(k,i) = sk_p(k,j,i) * cip
+                IF ( sterm == 0.0001_wp )  ippe(k,i) = sk_p(k,j,i) * cip
+                IF ( sterm == 0.9999_wp )  ippe(k,i) = sk_p(k,j,i) * cip
 
                 snenn = sk_p(k,j,i-1) - sk_p(k,j,i+1)
-                IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
+                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k,j,i) - sk_p(k,j,i+1) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -420,15 +421,16 @@
                 imme(k,i) = sk_p(k,j,i+1) * cim + snenn * (                    &
                             aex(ix) * cim + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0 - 2.0 * cim ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cim ) )  &
                                                                 )              &
                                                           )
-                IF ( sterm == 0.0001 )  imme(k,i) = sk_p(k,j,i) * cim
-                IF ( sterm == 0.9999 )  imme(k,i) = sk_p(k,j,i) * cim
+                IF ( sterm == 0.0001_wp )  imme(k,i) = sk_p(k,j,i) * cim
+                IF ( sterm == 0.9999_wp )  imme(k,i) = sk_p(k,j,i) * cim
              ENDIF
 
 !--          *VOCL STMT,IF(10)
-             IF ( sw(k,i+1) == 1.0 )  THEN
+             IF ( sw(k,i+1) == 1.0_wp )  THEN
                 snenn = sk_p(k,j,i) - sk_p(k,j,i+2)
-                IF ( ABS( snenn ) .LT. 1E-9 )  snenn = 1E-9
+                IF ( ABS( snenn ) .LT. 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k,j,i+1) - sk_p(k,j,i+2) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -441,5 +443,6 @@
                 impe(k,i) = sk_p(k,j,i+2) * cim + snenn * (                    &
                             aex(ix) * cim + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0 - 2.0 * cim ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cim ) )  &
                                                                 )              &
                                                           )
@@ -449,7 +452,7 @@
 
 !--          *VOCL STMT,IF(10)
-             IF ( sw(k,i-1) == 1.0 )  THEN
+             IF ( sw(k,i-1) == 1.0_wp )  THEN
                 snenn = sk_p(k,j,i) - sk_p(k,j,i-2)
-                IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
+                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k,j,i-1) - sk_p(k,j,i-2) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -462,5 +465,6 @@
                 ipme(k,i) = sk_p(k,j,i-2) * cip + snenn * (                    &
                             aex(ix) * cip + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0_wp - 2.0 * cip ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cip ) )  &
                                                                 )              &
                                                           )
@@ -538,9 +542,9 @@
 !
 !-- Determine the maxima of the first and second derivative in y-direction
-    fmax_l = 0.0
+    fmax_l = 0.0_wp
     DO  i = nxl, nxr
        DO  j = nys, nyn
           DO  k = nzb+1, nzt
-             numera = ABS( sk_p(k,j+1,i) - 2.0 * sk_p(k,j,i) + sk_p(k,j-1,i) )
+             numera = ABS( sk_p(k,j+1,i) - 2.0_wp * sk_p(k,j,i) + sk_p(k,j-1,i) )
              denomi  = ABS( sk_p(k,j+1,i) - sk_p(k,j-1,i) )
              fmax_l(1) = MAX( fmax_l(1) , numera )
@@ -556,5 +560,5 @@
 #endif
 
-    fmax = 0.04 * fmax
+    fmax = 0.04_wp * fmax
 
 !
@@ -569,5 +573,5 @@
               sw(nzb+1:nzt,nys-1:nyn+1)                                        &
             )
-    imme = 0.0; impe = 0.0; ipme = 0.0; ippe = 0.0
+    imme = 0.0_wp; impe = 0.0_wp; ipme = 0.0_wp; ippe = 0.0_wp
 
 !
@@ -579,16 +583,16 @@
        DO  j = nys-1, nyn+1
           DO  k = nzb+1, nzt
-             a12(k,j) = 0.5 * ( sk_p(k,j+1,i) - sk_p(k,j-1,i) )
-             a22(k,j) = 0.5 * ( sk_p(k,j+1,i) - 2.0 * sk_p(k,j,i)              &
-                                              + sk_p(k,j-1,i) )
-             a0(k,j) = ( 9.0 * sk_p(k,j+2,i) - 116.0 * sk_p(k,j+1,i)           &
-                         + 2134.0 * sk_p(k,j,i) - 116.0 * sk_p(k,j-1,i)        &
-                         + 9.0 * sk_p(k,j-2,i) ) * f1920
-             a1(k,j) = ( -5.0 * sk_p(k,j+2,i) + 34.0 * sk_p(k,j+1,i)           &
-                         - 34.0 * sk_p(k,j-1,i) + 5.0 * sk_p(k,j-2,i)          &
+             a12(k,j) = 0.5_wp * ( sk_p(k,j+1,i) - sk_p(k,j-1,i) )
+             a22(k,j) = 0.5_wp * ( sk_p(k,j+1,i) - 2.0_wp * sk_p(k,j,i)        &
+                                                 + sk_p(k,j-1,i) )
+             a0(k,j) = ( 9.0_wp * sk_p(k,j+2,i)    - 116.0_wp * sk_p(k,j+1,i)  &
+                         + 2134.0_wp * sk_p(k,j,i) - 116.0_wp * sk_p(k,j-1,i)  &
+                         + 9.0_wp * sk_p(k,j-2,i) ) * f1920
+             a1(k,j) = ( -5.0_wp   * sk_p(k,j+2,i) + 34.0_wp * sk_p(k,j+1,i)   &
+                         - 34.0_wp * sk_p(k,j-1,i) + 5.0_wp  * sk_p(k,j-2,i)   &
                        ) * f48
-             a2(k,j) = ( -3.0 * sk_p(k,j+2,i) + 36.0 * sk_p(k,j+1,i)           &
-                         - 66.0 * sk_p(k,j,i) + 36.0 * sk_p(k,j-1,i)           &
-                         - 3.0 * sk_p(k,j-2,i) ) * f48
+             a2(k,j) = ( -3.0_wp * sk_p(k,j+2,i) + 36.0_wp * sk_p(k,j+1,i)     &
+                         - 66.0_wp * sk_p(k,j,i) + 36.0_wp * sk_p(k,j-1,i)     &
+                         - 3.0_wp * sk_p(k,j-2,i) ) * f48
           ENDDO
        ENDDO
@@ -601,31 +605,31 @@
              cip  =  MAX( 0.0_wp, ( v(k,j+1,i) - v_gtrans ) * dt_3d * ddy )
              cim  = -MIN( 0.0_wp, ( v(k,j+1,i) - v_gtrans ) * dt_3d * ddy )
-             cipf = 1.0 - 2.0 * cip
-             cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k,j)   * f2  * ( 1.0 - cipf )                         &
-                    + a1(k,j)   * f8  * ( 1.0 - cipf*cipf )                    &
-                    + a2(k,j)   * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k,j+1) * f2  * ( 1.0 - cimf )                         &
-                    - a1(k,j+1) * f8  * ( 1.0 - cimf*cimf )                    &
-                    + a2(k,j+1) * f24 * ( 1.0 - cimf*cimf*cimf )
+             cipf = 1.0_wp - 2.0_wp * cip
+             cimf = 1.0_wp - 2.0_wp * cim
+             ip   =   a0(k,j)   * f2  * ( 1.0_wp - cipf )                      &
+                    + a1(k,j)   * f8  * ( 1.0_wp - cipf*cipf )                 &
+                    + a2(k,j)   * f24 * ( 1.0_wp - cipf*cipf*cipf )
+             im   =   a0(k,j+1) * f2  * ( 1.0_wp - cimf )                      &
+                    - a1(k,j+1) * f8  * ( 1.0_wp - cimf*cimf )                 &
+                    + a2(k,j+1) * f24 * ( 1.0_wp - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0_wp )
              im   = MAX( im, 0.0_wp )
-             ippb(k,j) = ip * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15) )
-             impb(k,j) = im * MIN( 1.0_wp, sk_p(k,j+1,i) / (ip+im+1E-15) )
+             ippb(k,j) = ip * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15_wp) )
+             impb(k,j) = im * MIN( 1.0_wp, sk_p(k,j+1,i) / (ip+im+1E-15_wp) )
 
              cip  =  MAX( 0.0_wp, ( v(k,j,i) - v_gtrans ) * dt_3d * ddy )
              cim  = -MIN( 0.0_wp, ( v(k,j,i) - v_gtrans ) * dt_3d * ddy )
-             cipf = 1.0 - 2.0 * cip
-             cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k,j-1) * f2  * ( 1.0 - cipf )                         &
-                    + a1(k,j-1) * f8  * ( 1.0 - cipf*cipf )                    &
-                    + a2(k,j-1) * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k,j)   * f2  * ( 1.0 - cimf )                         &
-                    - a1(k,j)   * f8  * ( 1.0 - cimf*cimf )                    &
-                    + a2(k,j)   * f24 * ( 1.0 - cimf*cimf*cimf )
+             cipf = 1.0_wp - 2.0_wp * cip
+             cimf = 1.0_wp - 2.0_wp * cim
+             ip   =   a0(k,j-1) * f2  * ( 1.0_wp - cipf )                      &
+                    + a1(k,j-1) * f8  * ( 1.0_wp - cipf*cipf )                 &
+                    + a2(k,j-1) * f24 * ( 1.0_wp - cipf*cipf*cipf )
+             im   =   a0(k,j)   * f2  * ( 1.0_wp - cimf )                      &
+                    - a1(k,j)   * f8  * ( 1.0_wp - cimf*cimf )                 &
+                    + a2(k,j)   * f24 * ( 1.0_wp - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0_wp )
              im   = MAX( im, 0.0_wp )
-             ipmb(k,j) = ip * MIN( 1.0_wp, sk_p(k,j-1,i) / (ip+im+1E-15) )
-             immb(k,j) = im * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15) )
+             ipmb(k,j) = ip * MIN( 1.0_wp, sk_p(k,j-1,i) / (ip+im+1E-15_wp) )
+             immb(k,j) = im * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15_wp) )
           ENDDO
        ENDDO
@@ -635,13 +639,13 @@
        DO  j = nys-2, nyn+2
           DO  k = nzb+1, nzt
-             m1z = ABS( sk_p(k,j+1,i) - 2.0 * sk_p(k,j,i) + sk_p(k,j-1,i) )
+             m1z = ABS( sk_p(k,j+1,i) - 2.0_wp * sk_p(k,j,i) + sk_p(k,j-1,i) )
              m1n = ABS( sk_p(k,j+1,i) - sk_p(k,j-1,i) )
-             IF ( m1n /= 0.0  .AND.  m1n >= m1z )  THEN
+             IF ( m1n /= 0.0_wp  .AND.  m1n >= m1z )  THEN
                 m1(k,j) = m1z / m1n
-                IF ( m1(k,j) /= 2.0  .AND.  m1n < fmax(2) )  m1(k,j) = 0.0
+                IF ( m1(k,j) /= 2.0_wp  .AND.  m1n < fmax(2) )  m1(k,j) = 0.0_wp
              ELSEIF ( m1n < m1z )  THEN
-                m1(k,j) = -1.0
+                m1(k,j) = -1.0_wp
              ELSE
-                m1(k,j) = 0.0
+                m1(k,j) = 0.0_wp
              ENDIF
           ENDDO
@@ -650,25 +654,25 @@
 !
 !--    Compute switch sw
-       sw = 0.0
+       sw = 0.0_wp
        DO  j = nys-1, nyn+1
           DO  k = nzb+1, nzt
-             m2 = 2.0 * ABS( a1(k,j) - a12(k,j) ) /                            &
+             m2 = 2.0_wp * ABS( a1(k,j) - a12(k,j) ) /                            &
                   MAX( ABS( a1(k,j) + a12(k,j) ), 1E-35_wp )
-             IF ( ABS( a1(k,j) + a12(k,j) ) < fmax(2) )  m2 = 0.0
-
-             m3 = 2.0 * ABS( a2(k,j) - a22(k,j) ) /                            &
+             IF ( ABS( a1(k,j) + a12(k,j) ) < fmax(2) )  m2 = 0.0_wp
+
+             m3 = 2.0_wp * ABS( a2(k,j) - a22(k,j) ) /                            &
                   MAX( ABS( a2(k,j) + a22(k,j) ), 1E-35_wp )
-             IF ( ABS( a2(k,j) + a22(k,j) ) < fmax(1) )  m3 = 0.0
-
-             t1 = 0.35
-             t2 = 0.35
-             IF ( m1(k,j) == -1.0 )  t2 = 0.12
+             IF ( ABS( a2(k,j) + a22(k,j) ) < fmax(1) )  m3 = 0.0_wp
+
+             t1 = 0.35_wp
+             t2 = 0.35_wp
+             IF ( m1(k,j) == -1.0_wp )  t2 = 0.12_wp
 
 !--          *VOCL STMT,IF(10)
-             IF ( m1(k,j-1) == 1.0 .OR. m1(k,j) == 1.0 .OR. m1(k,j+1) == 1.0   &
-                  .OR.  m2 > t2  .OR.  m3 > t2  .OR.                           &
-                  ( m1(k,j) > t1  .AND.  m1(k,j-1) /= -1.0  .AND.              &
-                    m1(k,j) /= -1.0  .AND.  m1(k,j+1) /= -1.0 )                &
-                )  sw(k,j) = 1.0
+             IF ( m1(k,j-1) == 1.0_wp .OR. m1(k,j) == 1.0_wp                   &
+                  .OR. m1(k,j+1) == 1.0_wp .OR.  m2 > t2  .OR.  m3 > t2  .OR.  &
+                  ( m1(k,j) > t1  .AND.  m1(k,j-1) /= -1.0_wp  .AND.           &
+                    m1(k,j) /= -1.0_wp  .AND.  m1(k,j+1) /= -1.0_wp )          &
+                )  sw(k,j) = 1.0_wp
           ENDDO
        ENDDO
@@ -681,7 +685,7 @@
 
 !--          *VOCL STMT,IF(10)
-             IF ( sw(k,j) == 1.0 )  THEN
+             IF ( sw(k,j) == 1.0_wp )  THEN
                 snenn = sk_p(k,j+1,i) - sk_p(k,j-1,i)
-                IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
+                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k,j,i) - sk_p(k,j-1,i) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -694,5 +698,6 @@
                 ippe(k,j) = sk_p(k,j-1,i) * cip + snenn * (                    &
                             aex(ix) * cip + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0 - 2.0 * cip ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cip ) )  &
                                                                 )              &
                                                           )
@@ -701,5 +706,5 @@
 
                 snenn = sk_p(k,j-1,i) - sk_p(k,j+1,i)
-                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9
+                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k,j,i) - sk_p(k,j+1,i) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -712,5 +717,6 @@
                 imme(k,j) = sk_p(k,j+1,i) * cim + snenn * (                    &
                             aex(ix) * cim + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0 - 2.0 * cim ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cim ) )  &
                                                                 )              &
                                                           )
@@ -720,7 +726,7 @@
 
 !--          *VOCL STMT,IF(10)
-             IF ( sw(k,j+1) == 1.0 )  THEN
+             IF ( sw(k,j+1) == 1.0_wp )  THEN
                 snenn = sk_p(k,j,i) - sk_p(k,j+2,i)
-                IF ( ABS( snenn ) .LT. 1E-9 )  snenn = 1E-9
+                IF ( ABS( snenn ) .LT. 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k,j+1,i) - sk_p(k,j+2,i) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -733,5 +739,6 @@
                 impe(k,j) = sk_p(k,j+2,i) * cim + snenn * (                    &
                             aex(ix) * cim + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0 - 2.0 * cim ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cim ) )  &
                                                                 )              &
                                                           )
@@ -741,7 +748,7 @@
 
 !--          *VOCL STMT,IF(10)
-             IF ( sw(k,j-1) == 1.0 )  THEN
+             IF ( sw(k,j-1) == 1.0_wp )  THEN
                 snenn = sk_p(k,j,i) - sk_p(k,j-2,i)
-                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9
+                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k,j-1,i) - sk_p(k,j-2,i) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -754,5 +761,6 @@
                 ipme(k,j) = sk_p(k,j-2,i) * cip + snenn * (                    &
                             aex(ix) * cip + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0 - 2.0 * cip ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cip ) )  &
                                                                 )              &
                                                           )
@@ -769,8 +777,8 @@
        DO  j = nys, nyn
           DO  k = nzb+1, nzt
-             fplus  = ( 1.0 - sw(k,j)   ) * ippb(k,j) + sw(k,j)   * ippe(k,j)  &
-                    - ( 1.0 - sw(k,j+1) ) * impb(k,j) - sw(k,j+1) * impe(k,j)
-             fminus = ( 1.0 - sw(k,j-1) ) * ipmb(k,j) + sw(k,j-1) * ipme(k,j)  &
-                    - ( 1.0 - sw(k,j)   ) * immb(k,j) - sw(k,j)   * imme(k,j)
+             fplus  = ( 1.0_wp - sw(k,j)   ) * ippb(k,j) + sw(k,j)   * ippe(k,j) &
+                    - ( 1.0_wp - sw(k,j+1) ) * impb(k,j) - sw(k,j+1) * impe(k,j)
+             fminus = ( 1.0_wp - sw(k,j-1) ) * ipmb(k,j) + sw(k,j-1) * ipme(k,j) &
+                    - ( 1.0_wp - sw(k,j)   ) * immb(k,j) - sw(k,j)   * imme(k,j)
              tendcy = fplus - fminus
 !
@@ -781,6 +789,6 @@
 !--          Density correction because of possible remaining divergences
              d_new = d(k,j,i) - ( v(k,j+1,i) - v(k,j,i) ) * dt_3d * ddy
-             sk_p(k,j,i) = ( ( 1.0 + d(k,j,i) ) * sk_p(k,j,i) - tendcy ) /    &
-                           ( 1.0 + d_new )
+             sk_p(k,j,i) = ( ( 1.0_wp + d(k,j,i) ) * sk_p(k,j,i) - tendcy ) /  &
+                           ( 1.0_wp + d_new )
              d(k,j,i)  = d_new
           ENDDO
@@ -800,5 +808,5 @@
 !-- Initialise for the computation of heat fluxes (see below; required in
 !-- UP flow_statistics)
-    IF ( sk_char == 'pt' )  sums_wsts_bc_l = 0.0
+    IF ( sk_char == 'pt' )  sums_wsts_bc_l = 0.0_wp
 
 !
@@ -939,9 +947,9 @@
 !
 !-- Determine the maxima of the first and second derivative in z-direction
-    fmax_l = 0.0
+    fmax_l = 0.0_wp
     DO  i = nxl, nxr
        DO  j = nys, nyn
           DO  k = nzb, nzt+1
-             numera = ABS( sk_p(k+1,j,i) - 2.0 * sk_p(k,j,i) + sk_p(k-1,j,i) )
+             numera = ABS( sk_p(k+1,j,i) - 2.0_wp * sk_p(k,j,i) + sk_p(k-1,j,i) )
              denomi  = ABS( sk_p(k+1,j,i+1) - sk_p(k-1,j,i) )
              fmax_l(1) = MAX( fmax_l(1) , numera )
@@ -957,5 +965,5 @@
 #endif
 
-    fmax = 0.04 * fmax
+    fmax = 0.04_wp * fmax
 
 !
@@ -970,5 +978,5 @@
               sw(nzb:nzt+1,nys:nyn)                                            &
             )
-    imme = 0.0; impe = 0.0; ipme = 0.0; ippe = 0.0
+    imme = 0.0_wp; impe = 0.0_wp; ipme = 0.0_wp; ippe = 0.0_wp
 
 !
@@ -980,16 +988,16 @@
        DO  j = nys, nyn
           DO  k = nzb, nzt+1
-             a12(k,j) = 0.5 * ( sk_p(k+1,j,i) - sk_p(k-1,j,i) )
-             a22(k,j) = 0.5 * ( sk_p(k+1,j,i) - 2.0 * sk_p(k,j,i)              &
-                                              + sk_p(k-1,j,i) )
-             a0(k,j) = ( 9.0 * sk_p(k+2,j,i) - 116.0 * sk_p(k+1,j,i)           &
-                         + 2134.0 * sk_p(k,j,i) - 116.0 * sk_p(k-1,j,i)        &
-                         + 9.0 * sk_p(k-2,j,i) ) * f1920
-             a1(k,j) = ( -5.0 * sk_p(k+2,j,i) + 34.0 * sk_p(k+1,j,i)           &
-                         - 34.0 * sk_p(k-1,j,i) + 5.0 * sk_p(k-2,j,i)          &
+             a12(k,j) = 0.5_wp * ( sk_p(k+1,j,i) - sk_p(k-1,j,i) )
+             a22(k,j) = 0.5_wp * ( sk_p(k+1,j,i) - 2.0_wp * sk_p(k,j,i)        &
+                                                 + sk_p(k-1,j,i) )
+             a0(k,j) = ( 9.0_wp * sk_p(k+2,j,i)    - 116.0_wp * sk_p(k+1,j,i)  &
+                         + 2134.0_wp * sk_p(k,j,i) - 116.0_wp * sk_p(k-1,j,i)  &
+                         + 9.0_wp * sk_p(k-2,j,i) ) * f1920
+             a1(k,j) = ( -5.0_wp   * sk_p(k+2,j,i) + 34.0_wp * sk_p(k+1,j,i)   &
+                         - 34.0_wp * sk_p(k-1,j,i) + 5.0_wp  * sk_p(k-2,j,i)   &
                        ) * f48
-             a2(k,j) = ( -3.0 * sk_p(k+2,j,i) + 36.0 * sk_p(k+1,j,i)           &
-                         - 66.0 * sk_p(k,j,i) + 36.0 * sk_p(k-1,j,i)           &
-                         - 3.0 * sk_p(k-2,j,i) ) * f48
+             a2(k,j) = ( -3.0_wp * sk_p(k+2,j,i) + 36.0_wp * sk_p(k+1,j,i)     &
+                         - 66.0_wp * sk_p(k,j,i) + 36.0_wp * sk_p(k-1,j,i)     &
+                         - 3.0_wp * sk_p(k-2,j,i) ) * f48
           ENDDO
        ENDDO
@@ -1002,31 +1010,31 @@
              cip  =  MAX( 0.0_wp, w(k,j,i) * dt_3d * ddzw(k) )
              cim  = -MIN( 0.0_wp, w(k,j,i) * dt_3d * ddzw(k) )
-             cipf = 1.0 - 2.0 * cip
-             cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k,j)   * f2  * ( 1.0 - cipf )                         &
-                    + a1(k,j)   * f8  * ( 1.0 - cipf*cipf )                    &
-                    + a2(k,j)   * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k+1,j) * f2  * ( 1.0 - cimf )                         &
-                    - a1(k+1,j) * f8  * ( 1.0 - cimf*cimf )                    &
-                    + a2(k+1,j) * f24 * ( 1.0 - cimf*cimf*cimf )
+             cipf = 1.0_wp - 2.0_wp * cip
+             cimf = 1.0_wp - 2.0_wp * cim
+             ip   =   a0(k,j)   * f2  * ( 1.0_wp - cipf )                      &
+                    + a1(k,j)   * f8  * ( 1.0_wp - cipf*cipf )                 &
+                    + a2(k,j)   * f24 * ( 1.0_wp - cipf*cipf*cipf )
+             im   =   a0(k+1,j) * f2  * ( 1.0_wp - cimf )                      &
+                    - a1(k+1,j) * f8  * ( 1.0_wp - cimf*cimf )                 &
+                    + a2(k+1,j) * f24 * ( 1.0_wp - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0_wp )
              im   = MAX( im, 0.0_wp )
-             ippb(k,j) = ip * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15) )
-             impb(k,j) = im * MIN( 1.0_wp, sk_p(k+1,j,i) / (ip+im+1E-15) )
+             ippb(k,j) = ip * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15_wp) )
+             impb(k,j) = im * MIN( 1.0_wp, sk_p(k+1,j,i) / (ip+im+1E-15_wp) )
 
              cip  =  MAX( 0.0_wp, w(k-1,j,i) * dt_3d * ddzw(k) )
              cim  = -MIN( 0.0_wp, w(k-1,j,i) * dt_3d * ddzw(k) )
-             cipf = 1.0 - 2.0 * cip
-             cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k-1,j) * f2  * ( 1.0 - cipf )                         &
-                    + a1(k-1,j) * f8  * ( 1.0 - cipf*cipf )                    &
-                    + a2(k-1,j) * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k,j)   * f2  * ( 1.0 - cimf )                         &
-                    - a1(k,j)   * f8  * ( 1.0 - cimf*cimf )                    &
-                    + a2(k,j)   * f24 * ( 1.0 - cimf*cimf*cimf )
+             cipf = 1.0_wp - 2.0_wp * cip
+             cimf = 1.0_wp - 2.0_wp * cim
+             ip   =   a0(k-1,j) * f2  * ( 1.0_wp - cipf )                      &
+                    + a1(k-1,j) * f8  * ( 1.0_wp - cipf*cipf )                 &
+                    + a2(k-1,j) * f24 * ( 1.0_wp - cipf*cipf*cipf )
+             im   =   a0(k,j)   * f2  * ( 1.0_wp - cimf )                      &
+                    - a1(k,j)   * f8  * ( 1.0_wp - cimf*cimf )                 &
+                    + a2(k,j)   * f24 * ( 1.0_wp - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0_wp )
              im   = MAX( im, 0.0_wp )
-             ipmb(k,j) = ip * MIN( 1.0_wp, sk_p(k-1,j,i) / (ip+im+1E-15) )
-             immb(k,j) = im * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15) )
+             ipmb(k,j) = ip * MIN( 1.0_wp, sk_p(k-1,j,i) / (ip+im+1E-15_wp) )
+             immb(k,j) = im * MIN( 1.0_wp, sk_p(k,j,i)   / (ip+im+1E-15_wp) )
           ENDDO
        ENDDO
@@ -1036,13 +1044,13 @@
        DO  j = nys, nyn
           DO  k = nzb-1, nzt+2
-             m1z = ABS( sk_p(k+1,j,i) - 2.0 * sk_p(k,j,i) + sk_p(k-1,j,i) )
+             m1z = ABS( sk_p(k+1,j,i) - 2.0_wp * sk_p(k,j,i) + sk_p(k-1,j,i) )
              m1n = ABS( sk_p(k+1,j,i) - sk_p(k-1,j,i) )
-             IF ( m1n /= 0.0  .AND.  m1n >= m1z )  THEN
+             IF ( m1n /= 0.0_wp  .AND.  m1n >= m1z )  THEN
                 m1(k,j) = m1z / m1n
-                IF ( m1(k,j) /= 2.0  .AND.  m1n < fmax(2) )  m1(k,j) = 0.0
+                IF ( m1(k,j) /= 2.0_wp  .AND.  m1n < fmax(2) )  m1(k,j) = 0.0_wp
              ELSEIF ( m1n < m1z )  THEN
-                m1(k,j) = -1.0
+                m1(k,j) = -1.0_wp
              ELSE
-                m1(k,j) = 0.0
+                m1(k,j) = 0.0_wp
              ENDIF
           ENDDO
@@ -1051,25 +1059,25 @@
 !
 !--    Compute switch sw
-       sw = 0.0
+       sw = 0.0_wp
        DO  j = nys, nyn
           DO  k = nzb, nzt+1
-             m2 = 2.0 * ABS( a1(k,j) - a12(k,j) ) /                            &
+             m2 = 2.0_wp * ABS( a1(k,j) - a12(k,j) ) /                         &
                   MAX( ABS( a1(k,j) + a12(k,j) ), 1E-35_wp )
-             IF ( ABS( a1(k,j) + a12(k,j) ) < fmax(2) )  m2 = 0.0
-
-             m3 = 2.0 * ABS( a2(k,j) - a22(k,j) ) /                            &
+             IF ( ABS( a1(k,j) + a12(k,j) ) < fmax(2) )  m2 = 0.0_wp
+
+             m3 = 2.0_wp * ABS( a2(k,j) - a22(k,j) ) /                         &
                   MAX( ABS( a2(k,j) + a22(k,j) ), 1E-35_wp )
-             IF ( ABS( a2(k,j) + a22(k,j) ) < fmax(1) )  m3 = 0.0
-
-             t1 = 0.35
-             t2 = 0.35
-             IF ( m1(k,j) == -1.0 )  t2 = 0.12
+             IF ( ABS( a2(k,j) + a22(k,j) ) < fmax(1) )  m3 = 0.0_wp
+
+             t1 = 0.35_wp
+             t2 = 0.35_wp
+             IF ( m1(k,j) == -1.0_wp )  t2 = 0.12_wp
 
 !--          *VOCL STMT,IF(10)
-             IF ( m1(k-1,j) == 1.0 .OR. m1(k,j) == 1.0 .OR. m1(k+1,j) == 1.0   &
-                  .OR.  m2 > t2  .OR.  m3 > t2  .OR.                           &
-                  ( m1(k,j) > t1  .AND.  m1(k-1,j) /= -1.0  .AND.              &
-                    m1(k,j) /= -1.0  .AND.  m1(k+1,j) /= -1.0 )                &
-                )  sw(k,j) = 1.0
+             IF ( m1(k-1,j) == 1.0_wp .OR. m1(k,j) == 1.0_wp                   &
+                  .OR. m1(k+1,j) == 1.0_wp .OR.  m2 > t2  .OR.  m3 > t2  .OR.  &
+                  ( m1(k,j) > t1  .AND.  m1(k-1,j) /= -1.0_wp  .AND.           &
+                    m1(k,j) /= -1.0_wp  .AND.  m1(k+1,j) /= -1.0_wp )          &
+                )  sw(k,j) = 1.0_wp
           ENDDO
        ENDDO
@@ -1082,7 +1090,7 @@
 
 !--          *VOCL STMT,IF(10)
-             IF ( sw(k,j) == 1.0 )  THEN
+             IF ( sw(k,j) == 1.0_wp )  THEN
                 snenn = sk_p(k+1,j,i) - sk_p(k-1,j,i)
-                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9
+                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k,j,i) - sk_p(k-1,j,i) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -1095,12 +1103,13 @@
                 ippe(k,j) = sk_p(k-1,j,i) * cip + snenn * (                    &
                             aex(ix) * cip + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0 - 2.0 * cip ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cip ) )  &
                                                                 )              &
                                                           )
-                IF ( sterm == 0.0001 )  ippe(k,j) = sk_p(k,j,i) * cip
-                IF ( sterm == 0.9999 )  ippe(k,j) = sk_p(k,j,i) * cip
+                IF ( sterm == 0.0001_wp )  ippe(k,j) = sk_p(k,j,i) * cip
+                IF ( sterm == 0.9999_wp )  ippe(k,j) = sk_p(k,j,i) * cip
 
                 snenn = sk_p(k-1,j,i) - sk_p(k+1,j,i)
-                IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
+                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k,j,i) - sk_p(k+1,j,i) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -1113,5 +1122,6 @@
                 imme(k,j) = sk_p(k+1,j,i) * cim + snenn * (                    &
                             aex(ix) * cim + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0 - 2.0 * cim ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cim ) ) &
                                                                 )              &
                                                           )
@@ -1121,7 +1131,7 @@
 
 !--          *VOCL STMT,IF(10)
-             IF ( sw(k+1,j) == 1.0 )  THEN
+             IF ( sw(k+1,j) == 1.0_wp )  THEN
                 snenn = sk_p(k,j,i) - sk_p(k+2,j,i)
-                IF ( ABS( snenn ) .LT. 1E-9 )  snenn = 1E-9
+                IF ( ABS( snenn ) .LT. 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k+1,j,i) - sk_p(k+2,j,i) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -1134,5 +1144,6 @@
                 impe(k,j) = sk_p(k+2,j,i) * cim + snenn * (                    &
                             aex(ix) * cim + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0 - 2.0 * cim ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cim ) )  &
                                                                 )              &
                                                           )
@@ -1142,7 +1153,7 @@
 
 !--          *VOCL STMT,IF(10)
-             IF ( sw(k-1,j) == 1.0 )  THEN
+             IF ( sw(k-1,j) == 1.0_wp )  THEN
                 snenn = sk_p(k,j,i) - sk_p(k-2,j,i)
-                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9
+                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9_wp
                 sterm = ( sk_p(k-1,j,i) - sk_p(k-2,j,i) ) / snenn
                 sterm = MIN( sterm, 0.9999_wp )
@@ -1155,5 +1166,6 @@
                 ipme(k,j) = sk_p(k-2,j,i) * cip + snenn * (                    &
                             aex(ix) * cip + bex(ix) / dex(ix) * (              &
-                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0 - 2.0 * cip ) ) &
+                            eex(ix) -                                          &
+                            EXP( dex(ix)*0.5_wp * ( 1.0_wp - 2.0_wp * cip ) )  &
                                                                 )              &
                                                           )
@@ -1170,8 +1182,8 @@
        DO  j = nys, nyn
           DO  k = nzb+1, nzt
-             fplus  = ( 1.0 - sw(k,j)   ) * ippb(k,j) + sw(k,j)   * ippe(k,j)  &
-                    - ( 1.0 - sw(k+1,j) ) * impb(k,j) - sw(k+1,j) * impe(k,j)
-             fminus = ( 1.0 - sw(k-1,j) ) * ipmb(k,j) + sw(k-1,j) * ipme(k,j)  &
-                    - ( 1.0 - sw(k,j)   ) * immb(k,j) - sw(k,j)   * imme(k,j)
+             fplus  = ( 1.0_wp - sw(k,j)   ) * ippb(k,j) + sw(k,j)   * ippe(k,j) &
+                    - ( 1.0_wp - sw(k+1,j) ) * impb(k,j) - sw(k+1,j) * impe(k,j)
+             fminus = ( 1.0_wp - sw(k-1,j) ) * ipmb(k,j) + sw(k-1,j) * ipme(k,j) &
+                    - ( 1.0_wp - sw(k,j)   ) * immb(k,j) - sw(k,j)   * imme(k,j)
              tendcy = fplus - fminus
 !
@@ -1182,6 +1194,6 @@
 !--          Density correction because of possible remaining divergences
              d_new = d(k,j,i) - ( w(k,j,i) - w(k-1,j,i) ) * dt_3d * ddzw(k)
-             sk_p(k,j,i) = ( ( 1.0 + d(k,j,i) ) * sk_p(k,j,i) - tendcy ) /    &
-                           ( 1.0 + d_new )
+             sk_p(k,j,i) = ( ( 1.0_wp + d(k,j,i) ) * sk_p(k,j,i) - tendcy ) /  &
+                           ( 1.0_wp + d_new )
 !
 !--          Store heat flux for subsequent statistics output.
Index: /palm/trunk/SOURCE/advec_s_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_s_pw.f90	(revision 1352)
+++ /palm/trunk/SOURCE/advec_s_pw.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -102,13 +102,13 @@
              DO  k = nzb_s_inner(j,i)+1, nzt
                 tend(k,j,i) = tend(k,j,i)                                      &
-              -0.5 * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
-                     - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
-                     ) * ddx                                                   &
-              -0.5 * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
-                     - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
-                     ) * ddy                                                   &
-              -      (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
-                     -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
-                     ) * dd2zu(k)
+              -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
+                        - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
+                        ) * ddx                                                   &
+              -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
+                        - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
+                        ) * ddy                                                   &
+              -         (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
+                        -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
+                        ) * dd2zu(k)
              ENDDO
           ENDDO
@@ -153,13 +153,13 @@
        DO  k = nzb_s_inner(j,i)+1, nzt
           tend(k,j,i) = tend(k,j,i)                                            &
-              -0.5 * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
-                     - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
-                     ) * ddx                                                   &
-              -0.5 * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
-                     - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
-                     ) * ddy                                                   &
-              -      (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
-                     -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
-                     ) * dd2zu(k)
+              -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
+                        - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
+                        ) * ddx                                                   &
+              -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
+                        - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
+                        ) * ddy                                                   &
+              -         (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
+                        -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
+                        ) * dd2zu(k)
        ENDDO
 
Index: /palm/trunk/SOURCE/advec_s_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_s_up.f90	(revision 1352)
+++ /palm/trunk/SOURCE/advec_s_up.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -106,6 +106,6 @@
 !
 !--             x-direction
-                ukomp = 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - u_gtrans
-                IF ( ukomp > 0.0 )  THEN
+                ukomp = 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - u_gtrans
+                IF ( ukomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                          ( sk(k,j,i) - sk(k,j,i-1) ) * ddx
@@ -116,6 +116,6 @@
 !
 !--             y-direction
-                vkomp = 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - v_gtrans
-                IF ( vkomp > 0.0 )  THEN
+                vkomp = 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - v_gtrans
+                IF ( vkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( sk(k,j,i) - sk(k,j-1,i) ) * ddy
@@ -126,6 +126,6 @@
 !
 !--             z-direction
-                wkomp = 0.5 * ( w(k,j,i) + w(k-1,j,i) )
-                IF ( wkomp > 0.0 )  THEN
+                wkomp = 0.5_wp * ( w(k,j,i) + w(k-1,j,i) )
+                IF ( wkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - wkomp *                         &
                                          ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k)
@@ -182,6 +182,6 @@
 !
 !--       x-direction
-          ukomp = 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - u_gtrans
-          IF ( ukomp > 0.0 )  THEN
+          ukomp = 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - u_gtrans
+          IF ( ukomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( sk(k,j,i) - sk(k,j,i-1) ) * ddx
@@ -192,6 +192,6 @@
 !
 !--       y-direction
-          vkomp = 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - v_gtrans
-          IF ( vkomp > 0.0 )  THEN
+          vkomp = 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - v_gtrans
+          IF ( vkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( sk(k,j,i) - sk(k,j-1,i) ) * ddy
@@ -202,6 +202,6 @@
 !
 !--       z-direction
-          wkomp = 0.5 * ( w(k,j,i) + w(k-1,j,i) )
-          IF ( wkomp > 0.0 )  THEN
+          wkomp = 0.5_wp * ( w(k,j,i) + w(k-1,j,i) )
+          IF ( wkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - wkomp *                               &
                                          ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k)
Index: /palm/trunk/SOURCE/advec_u_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_u_pw.f90	(revision 1352)
+++ /palm/trunk/SOURCE/advec_u_pw.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -89,10 +89,10 @@
        REAL(wp)    ::  gv !:
  
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
        DO  i = nxlu, nxr
           DO  j = nys, nyn
              DO  k = nzb_u_inner(j,i)+1, nzt
-                tend(k,j,i) = tend(k,j,i) - 0.25 * (                           &
+                tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                        &
                          ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu )         &
                          - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx &
@@ -102,5 +102,5 @@
                          - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) )        &
                                                                   * ddzw(k)    &
-                                                   )
+                                                      )
              ENDDO
           ENDDO
@@ -139,8 +139,8 @@
        REAL(wp)    ::  gv !:
 
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
        DO  k = nzb_u_inner(j,i)+1, nzt
-          tend(k,j,i) = tend(k,j,i) - 0.25 * (                                 &
+          tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                              &
                          ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu )         &
                          - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx &
@@ -150,5 +150,5 @@
                          - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) )        &
                                                                   * ddzw(k)    &
-                                             )
+                                                )
        ENDDO
 
Index: /palm/trunk/SOURCE/advec_u_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_u_up.f90	(revision 1352)
+++ /palm/trunk/SOURCE/advec_u_up.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -96,5 +96,5 @@
 !--             x-direction
                 ukomp = u(k,j,i) - u_gtrans
-                IF ( ukomp > 0.0 )  THEN
+                IF ( ukomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                          ( u(k,j,i) - u(k,j,i-1) ) * ddx
@@ -105,7 +105,7 @@
 !
 !--             y-direction
-                vkomp = 0.25 * ( v(k,j,i)   + v(k,j+1,i) +                     &
+                vkomp = 0.25_wp * ( v(k,j,i)   + v(k,j+1,i) +                  &
                                  v(k,j,i-1) + v(k,j+1,i-1) ) - v_gtrans
-                IF ( vkomp > 0.0 )  THEN
+                IF ( vkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( u(k,j,i) - u(k,j-1,i) ) * ddy
@@ -116,7 +116,7 @@
 !
 !--             z-direction
-                wkomp = 0.25 * ( w(k,j,i)   + w(k-1,j,i) +                     &
+                wkomp = 0.25_wp * ( w(k,j,i)   + w(k-1,j,i) +                  &
                                  w(k,j,i-1) + w(k-1,j,i-1) )
-                IF ( wkomp > 0.0 )  THEN
+                IF ( wkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - wkomp *                         &
                                          ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k)
@@ -168,5 +168,5 @@
 !--       x-direction
           ukomp = u(k,j,i) - u_gtrans
-          IF ( ukomp > 0.0 )  THEN
+          IF ( ukomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( u(k,j,i) - u(k,j,i-1) ) * ddx
@@ -177,7 +177,7 @@
 !
 !--       y-direction
-          vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + v(k,j,i-1) + v(k,j+1,i-1)   &
+          vkomp = 0.25_wp * ( v(k,j,i) + v(k,j+1,i) + v(k,j,i-1) + v(k,j+1,i-1) &
                          ) - v_gtrans
-          IF ( vkomp > 0.0 )  THEN
+          IF ( vkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( u(k,j,i) - u(k,j-1,i) ) * ddy
@@ -188,6 +188,6 @@
 !
 !--       z-direction
-          wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + w(k,j,i-1) + w(k-1,j,i-1) )
-          IF ( wkomp > 0.0 )  THEN
+          wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + w(k,j,i-1) + w(k-1,j,i-1) )
+          IF ( wkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - wkomp *                               &
                                          ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k)
Index: /palm/trunk/SOURCE/advec_v_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_v_pw.f90	(revision 1352)
+++ /palm/trunk/SOURCE/advec_v_pw.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -90,10 +90,10 @@
  
 
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
        DO  i = nxl, nxr
           DO  j = nysv, nyn
              DO  k = nzb_v_inner(j,i)+1, nzt
-                tend(k,j,i) = tend(k,j,i) - 0.25 * (                           &
+                tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                        &
                          ( v(k,j,i+1) * ( u(k,j-1,i+1) + u(k,j,i+1) - gu )     &
                          - v(k,j,i-1) * ( u(k,j-1,i) + u(k,j,i) - gu ) ) * ddx &
@@ -103,5 +103,5 @@
                          - v(k-1,j,i) * ( w(k-1,j-1,i) + w(k-1,j,i) ) )        &
                                                                   * ddzw(k)    &
-                                                   )
+                                                      )
              ENDDO
           ENDDO
@@ -141,8 +141,8 @@
 
 
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
        DO  k = nzb_v_inner(j,i)+1, nzt
-          tend(k,j,i) = tend(k,j,i) - 0.25 * (                                 &
+          tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                              &
                          ( v(k,j,i+1) * ( u(k,j-1,i+1) + u(k,j,i+1) - gu )     &
                          - v(k,j,i-1) * ( u(k,j-1,i) + u(k,j,i) - gu ) ) * ddx &
@@ -152,5 +152,5 @@
                          - v(k-1,j,i) * ( w(k-1,j-1,i) + w(k-1,j,i) ) )        &
                                                                   * ddzw(k)    &
-                                             )
+                                                )
        ENDDO
  
Index: /palm/trunk/SOURCE/advec_v_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_v_up.f90	(revision 1352)
+++ /palm/trunk/SOURCE/advec_v_up.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -95,7 +95,7 @@
 !
 !--             x-direction
-                ukomp = 0.25 * ( u(k,j,i)   + u(k,j-1,i) +                     &
+                ukomp = 0.25_wp * ( u(k,j,i)   + u(k,j-1,i) +                  &
                                  u(k,j,i+1) + u(k,j-1,i+1) ) - u_gtrans
-                IF ( ukomp > 0.0 )  THEN
+                IF ( ukomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                          ( v(k,j,i) - v(k,j,i-1) ) * ddx
@@ -107,5 +107,5 @@
 !--             y-direction
                 vkomp = v(k,j,i) - v_gtrans
-                IF ( vkomp > 0.0 )  THEN
+                IF ( vkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( v(k,j,i) - v(k,j-1,i) ) * ddy
@@ -116,7 +116,7 @@
 !
 !--             z-direction
-                wkomp = 0.25 * ( w(k,j,i)  + w(k-1,j,i) +                      &
+                wkomp = 0.25_wp * ( w(k,j,i)  + w(k-1,j,i) +                   &
                                  w(k,j-1,i) + w(k-1,j-1,i) )
-                IF ( wkomp > 0.0 )  THEN
+                IF ( wkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - wkomp *                         &
                                          ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)
@@ -167,7 +167,7 @@
 !
 !--       x-direction
-          ukomp = 0.25 * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1)   &
+          ukomp = 0.25_wp * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1) &
                          ) - u_gtrans
-          IF ( ukomp > 0.0 )  THEN
+          IF ( ukomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( v(k,j,i) - v(k,j,i-1) ) * ddx
@@ -179,5 +179,5 @@
 !--       y-direction
           vkomp = v(k,j,i) - v_gtrans
-          IF ( vkomp > 0.0 )  THEN
+          IF ( vkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( v(k,j,i) - v(k,j-1,i) ) * ddy
@@ -188,6 +188,6 @@
 !
 !--       z-direction
-          wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) )
-          IF ( wkomp > 0.0 )  THEN
+          wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) )
+          IF ( wkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - wkomp *                               &
                                          ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)
Index: /palm/trunk/SOURCE/advec_w_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_w_pw.f90	(revision 1352)
+++ /palm/trunk/SOURCE/advec_w_pw.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -90,10 +90,10 @@
 
  
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
        DO  i = nxl, nxr
           DO  j = nys, nyn
              DO  k = nzb_w_inner(j,i)+1, nzt
-                tend(k,j,i) = tend(k,j,i) - 0.25 * (                           &
+                tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                        &
                          ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu )     &
                          - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx &
@@ -103,5 +103,5 @@
                          - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) )            &
                                                                   * ddzu(k+1)  &
-                                                   )
+                                                      )
              ENDDO
           ENDDO
@@ -140,8 +140,8 @@
        REAL(wp)    ::  gv !:
 
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
        DO  k = nzb_w_inner(j,i)+1, nzt
-          tend(k,j,i) = tend(k,j,i) - 0.25 * (                                 &
+          tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                              &
                          ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu )     &
                          - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx &
Index: /palm/trunk/SOURCE/advec_w_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_w_up.f90	(revision 1352)
+++ /palm/trunk/SOURCE/advec_w_up.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -94,7 +94,7 @@
 !
 !--             x-direction
-                ukomp = 0.25 * ( u(k,j,i)   + u(k,j,i+1) +                     &
+                ukomp = 0.25_wp * ( u(k,j,i)   + u(k,j,i+1) +                  &
                                  u(k+1,j,i) + u(k+1,j,i+1) ) - u_gtrans
-                IF ( ukomp > 0.0 )  THEN
+                IF ( ukomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                          ( w(k,j,i) - w(k,j,i-1) ) * ddx
@@ -105,7 +105,7 @@
 !
 !--             y-direction
-                vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) +                       &
+                vkomp = 0.25_wp * ( v(k,j,i) + v(k,j+1,i) +                    &
                                  v(k+1,j,i) + v(k+1,j+1,i) ) - v_gtrans
-                IF ( vkomp > 0.0 )  THEN
+                IF ( vkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( w(k,j,i) - w(k,j-1,i) ) * ddy
@@ -116,5 +116,5 @@
 !
 !--             z-direction
-                IF ( w(k,j,i) > 0.0 )  THEN
+                IF ( w(k,j,i) > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - w(k,j,i) *                      &
                                          ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k)
@@ -164,7 +164,7 @@
 !
 !--       x-direction
-          ukomp = 0.25 * ( u(k,j,i) + u(k,j,i+1) + u(k+1,j,i) + u(k+1,j,i+1)   &
+          ukomp = 0.25_wp * ( u(k,j,i) + u(k,j,i+1) + u(k+1,j,i) + u(k+1,j,i+1) &
                          ) - u_gtrans
-          IF ( ukomp > 0.0 )  THEN
+          IF ( ukomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( w(k,j,i) - w(k,j,i-1) ) * ddx
@@ -175,7 +175,7 @@
 !
 !--       y-direction
-          vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + v(k+1,j,i) + v(k+1,j+1,i)   &
+          vkomp = 0.25_wp * ( v(k,j,i) + v(k,j+1,i) + v(k+1,j,i) + v(k+1,j+1,i) &
                          ) - v_gtrans
-          IF ( vkomp > 0.0 )  THEN
+          IF ( vkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( w(k,j,i) - w(k,j-1,i) ) * ddy
@@ -186,5 +186,5 @@
 !
 !--       z-direction
-          IF ( w(k,j,i) > 0.0 )  THEN
+          IF ( w(k,j,i) > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - w(k,j,i) *                            &
                                          ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k)
Index: /palm/trunk/SOURCE/advec_ws.f90
===================================================================
--- /palm/trunk/SOURCE/advec_ws.f90	(revision 1352)
+++ /palm/trunk/SOURCE/advec_ws.f90	(revision 1353)
@@ -20,5 +20,7 @@
 ! Current revisions:
 ! ------------------
-!
+! REAL constants provided with KIND-attribute,
+! module kinds added
+! some formatting adjustments
 !
 ! Former revisions:
@@ -116,6 +118,6 @@
 
     PRIVATE
-    PUBLIC   advec_s_ws, advec_s_ws_acc, advec_u_ws, advec_u_ws_acc, &
-             advec_v_ws, advec_v_ws_acc, advec_w_ws, advec_w_ws_acc, &
+    PUBLIC   advec_s_ws, advec_s_ws_acc, advec_u_ws, advec_u_ws_acc,          &
+             advec_v_ws, advec_v_ws_acc, advec_w_ws, advec_w_ws_acc,          &
              ws_init, ws_statistics
 
@@ -187,5 +189,7 @@
 
        USE indices,                                                            &
-           ONLY:  nyn, nys, nzb, nzt  
+           ONLY:  nyn, nys, nzb, nzt
+
+       USE kinds
        
        USE pegrid
@@ -214,9 +218,9 @@
                     sums_ws2_ws_l(nzb:nzt+1,0:threads_per_task-1) )
 
-          sums_wsus_ws_l = 0.0
-          sums_wsvs_ws_l = 0.0
-          sums_us2_ws_l  = 0.0
-          sums_vs2_ws_l  = 0.0
-          sums_ws2_ws_l  = 0.0
+          sums_wsus_ws_l = 0.0_wp
+          sums_wsvs_ws_l = 0.0_wp
+          sums_us2_ws_l  = 0.0_wp
+          sums_vs2_ws_l  = 0.0_wp
+          sums_ws2_ws_l  = 0.0_wp
 
        ENDIF
@@ -225,9 +229,9 @@
 
           ALLOCATE( sums_wspts_ws_l(nzb:nzt+1,0:threads_per_task-1) )
-          sums_wspts_ws_l = 0.0
+          sums_wspts_ws_l = 0.0_wp
 
           IF ( humidity  .OR.  passive_scalar )  THEN
              ALLOCATE( sums_wsqs_ws_l(nzb:nzt+1,0:threads_per_task-1) )
-             sums_wsqs_ws_l = 0.0
+             sums_wsqs_ws_l = 0.0_wp
           ENDIF
 
@@ -236,11 +240,11 @@
              ALLOCATE( sums_wsqrs_ws_l(nzb:nzt+1,0:threads_per_task-1) )
              ALLOCATE( sums_wsnrs_ws_l(nzb:nzt+1,0:threads_per_task-1) )
-             sums_wsqrs_ws_l = 0.0
-             sums_wsnrs_ws_l = 0.0
+             sums_wsqrs_ws_l = 0.0_wp
+             sums_wsnrs_ws_l = 0.0_wp
           ENDIF
 
           IF ( ocean )  THEN
              ALLOCATE( sums_wssas_ws_l(nzb:nzt+1,0:threads_per_task-1) )
-             sums_wssas_ws_l = 0.0
+             sums_wssas_ws_l = 0.0_wp
           ENDIF
 
@@ -324,4 +328,6 @@
                   precipitation, ocean, ws_scheme_mom, ws_scheme_sca
 
+       USE kinds
+
        USE statistics,                                                         &
            ONLY:  sums_us2_ws_l, sums_vs2_ws_l, sums_ws2_ws_l, sums_wsnrs_ws_l,&
@@ -335,20 +341,20 @@
 !--    beginning of prognostic_equations.
        IF ( ws_scheme_mom )  THEN
-          sums_wsus_ws_l = 0.0
-          sums_wsvs_ws_l = 0.0
-          sums_us2_ws_l  = 0.0
-          sums_vs2_ws_l  = 0.0
-          sums_ws2_ws_l  = 0.0
+          sums_wsus_ws_l = 0.0_wp
+          sums_wsvs_ws_l = 0.0_wp
+          sums_us2_ws_l  = 0.0_wp
+          sums_vs2_ws_l  = 0.0_wp
+          sums_ws2_ws_l  = 0.0_wp
        ENDIF
 
        IF ( ws_scheme_sca )  THEN
-          sums_wspts_ws_l = 0.0
-          IF ( humidity  .OR.  passive_scalar )  sums_wsqs_ws_l = 0.0
+          sums_wspts_ws_l = 0.0_wp
+          IF ( humidity  .OR.  passive_scalar )  sums_wsqs_ws_l = 0.0_wp
           IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.                 &
                precipitation )  THEN
-             sums_wsqrs_ws_l = 0.0
-             sums_wsnrs_ws_l = 0.0
+             sums_wsqrs_ws_l = 0.0_wp
+             sums_wsnrs_ws_l = 0.0_wp
           ENDIF
-          IF ( ocean )  sums_wssas_ws_l = 0.0
+          IF ( ocean )  sums_wssas_ws_l = 0.0_wp
 
        ENDIF
@@ -446,32 +452,32 @@
 
              v_comp                  = v(k,j,i) - v_gtrans
-             swap_flux_y_local(k,tn) = v_comp * (                             &
-                                                  ( 37.0 * ibit5 * adv_sca_5  &
-                                               +     7.0 * ibit4 * adv_sca_3  &
-                                               +           ibit3 * adv_sca_1  &
-                                                  ) *                         &
+             swap_flux_y_local(k,tn) = v_comp *         (                     &
+                                               ( 37.0_wp * ibit5 * adv_sca_5  &
+                                            +     7.0_wp * ibit4 * adv_sca_3  &
+                                            +              ibit3 * adv_sca_1  &
+                                               ) *                            &
                                            ( sk(k,j,i)  + sk(k,j-1,i)     )   &
-                                            -     (  8.0 * ibit5 * adv_sca_5  &
-                                               +           ibit4 * adv_sca_3  &
-                                                   ) *                        &
+                                         -     (  8.0_wp * ibit5 * adv_sca_5  &
+                                            +              ibit4 * adv_sca_3  &
+                                                ) *                           &
                                            ( sk(k,j+1,i) + sk(k,j-2,i)    )   &
-                                           +      (        ibit5 * adv_sca_5  &
-                                                  ) *                         &
+                                         +     (           ibit5 * adv_sca_5  &
+                                               ) *                            &
                                            ( sk(k,j+2,i) + sk(k,j-3,i)    )   &
-                                                )
+                                                        )
 
              swap_diss_y_local(k,tn) = -ABS( v_comp ) * (                     &
-                                                  ( 10.0 * ibit5 * adv_sca_5  &
-                                               +     3.0 * ibit4 * adv_sca_3  &
-                                               +           ibit3 * adv_sca_1  &
-                                                  ) *                         &
-                                            ( sk(k,j,i)   - sk(k,j-1,i)    )  &
-                                           -      (  5.0 * ibit5 * adv_sca_5  &
-                                               +           ibit4 * adv_sca_3  &
+                                               ( 10.0_wp * ibit5 * adv_sca_5  &
+                                            +     3.0_wp * ibit4 * adv_sca_3  &
+                                            +              ibit3 * adv_sca_1  &
+                                               ) *                            &
+                                            ( sk(k,j,i)   - sk(k,j-1,i)  )    &
+                                        -      (  5.0_wp * ibit5 * adv_sca_5  &
+                                            +              ibit4 * adv_sca_3  &
                                             ) *                               &
                                             ( sk(k,j+1,i) - sk(k,j-2,i)  )    &
-                                           +      (        ibit5 * adv_sca_5  &
-                                                  ) *                         &
-                                            ( sk(k,j+2,i) - sk(k,j-3,i) )     &
+                                        +      (           ibit5 * adv_sca_5  &
+                                               ) *                            &
+                                            ( sk(k,j+2,i) - sk(k,j-3,i)  )    &
                                                         )
 
@@ -482,14 +488,14 @@
 
              v_comp                  = v(k,j,i) - v_gtrans
-             swap_flux_y_local(k,tn) = v_comp * (                            &
-                                    37.0 * ( sk(k,j,i)   + sk(k,j-1,i) )     &
-                                  -  8.0 * ( sk(k,j+1,i) + sk(k,j-2,i) )     &
-                                  +        ( sk(k,j+2,i) + sk(k,j-3,i) )     &
-                                             ) * adv_sca_5
-              swap_diss_y_local(k,tn) = -ABS( v_comp ) * (                   &
-                                    10.0 * ( sk(k,j,i)   - sk(k,j-1,i) )     &
-                                  -  5.0 * ( sk(k,j+1,i) - sk(k,j-2,i) )     &
-                                  +          sk(k,j+2,i) - sk(k,j-3,i)       &
-                                                        ) * adv_sca_5
+             swap_flux_y_local(k,tn) = v_comp * (                             &
+                                    37.0_wp * ( sk(k,j,i)   + sk(k,j-1,i) )   &
+                                  -  8.0_wp * ( sk(k,j+1,i) + sk(k,j-2,i) )   &
+                                  +           ( sk(k,j+2,i) + sk(k,j-3,i) )   &
+                                                ) * adv_sca_5
+              swap_diss_y_local(k,tn) = -ABS( v_comp ) * (                    &
+                                    10.0_wp * ( sk(k,j,i)   - sk(k,j-1,i) )   &
+                                  -  5.0_wp * ( sk(k,j+1,i) - sk(k,j-2,i) )   &
+                                  +             sk(k,j+2,i) - sk(k,j-3,i)     &
+                                                         ) * adv_sca_5
 
           ENDDO
@@ -508,31 +514,31 @@
              u_comp                     = u(k,j,i) - u_gtrans
              swap_flux_x_local(k,j,tn) = u_comp * (                           &
-                                                  ( 37.0 * ibit2 * adv_sca_5  &
-                                               +     7.0 * ibit1 * adv_sca_3  &
-                                               +           ibit0 * adv_sca_1  &
-                                                  ) *                         &
+                                               ( 37.0_wp * ibit2 * adv_sca_5  &
+                                            +     7.0_wp * ibit1 * adv_sca_3  &
+                                            +              ibit0 * adv_sca_1  &
+                                               ) *                            &
                                             ( sk(k,j,i)   + sk(k,j,i-1)    )  &
-                                           -      (  8.0 * ibit2 * adv_sca_5  &
-                                               +           ibit1 * adv_sca_3  &
-                                                  ) *                         &
+                                        -      (  8.0_wp * ibit2 * adv_sca_5  &
+                                            +              ibit1 * adv_sca_3  &
+                                               ) *                            &
                                             ( sk(k,j,i+1) + sk(k,j,i-2)    )  &
-                                           +      (        ibit2 * adv_sca_5  &
-                                                  ) *                         &
+                                        +      (           ibit2 * adv_sca_5  &
+                                               ) *                            &
                                             ( sk(k,j,i+2) + sk(k,j,i-3)    )  &
                                                   )
 
               swap_diss_x_local(k,j,tn) = -ABS( u_comp ) * (                  &
-                                                  ( 10.0 * ibit2 * adv_sca_5  &
-                                               +     3.0 * ibit1 * adv_sca_3  &
-                                               +           ibit0 * adv_sca_1  &
-                                                  ) *                         &
+                                               ( 10.0_wp * ibit2 * adv_sca_5  &
+                                            +     3.0_wp * ibit1 * adv_sca_3  &
+                                            +              ibit0 * adv_sca_1  &
+                                               ) *                            &
                                             ( sk(k,j,i)   - sk(k,j,i-1)    )  &
-                                           -      (  5.0 * ibit2 * adv_sca_5  &
-                                               +           ibit1 * adv_sca_3  &
-                                                  ) *                         &
-                                            ( sk(k,j,i+1) - sk(k,j,i-2)  )    &
-                                           +      (        ibit2 * adv_sca_5  &
-                                                  ) *                         &
-                                            ( sk(k,j,i+2) - sk(k,j,i-3) )     &
+                                        -      (  5.0_wp * ibit2 * adv_sca_5  &
+                                            +              ibit1 * adv_sca_3  &
+                                               ) *                            &
+                                            ( sk(k,j,i+1) - sk(k,j,i-2)    )  &
+                                        +      (           ibit2 * adv_sca_5  &
+                                               ) *                            &
+                                            ( sk(k,j,i+2) - sk(k,j,i-3)    )  &
                                                            )
 
@@ -542,14 +548,14 @@
 
              u_comp                 = u(k,j,i) - u_gtrans
-             swap_flux_x_local(k,j,tn) = u_comp * (                          &
-                                      37.0 * ( sk(k,j,i)   + sk(k,j,i-1) )   &
-                                    -  8.0 * ( sk(k,j,i+1) + sk(k,j,i-2) )   &
-                                    +        ( sk(k,j,i+2) + sk(k,j,i-3) )   &
+             swap_flux_x_local(k,j,tn) = u_comp * (                           &
+                                      37.0_wp * ( sk(k,j,i)   + sk(k,j,i-1) ) &
+                                    -  8.0_wp * ( sk(k,j,i+1) + sk(k,j,i-2) ) &
+                                    +           ( sk(k,j,i+2) + sk(k,j,i-3) ) &
                                                   ) * adv_sca_5
 
-             swap_diss_x_local(k,j,tn) = -ABS( u_comp ) * (                  &
-                                      10.0 * ( sk(k,j,i)   - sk(k,j,i-1) )   &
-                                    -  5.0 * ( sk(k,j,i+1) - sk(k,j,i-2) )   &
-                                    +        ( sk(k,j,i+2) - sk(k,j,i-3) )   &
+             swap_diss_x_local(k,j,tn) = -ABS( u_comp ) * (                   &
+                                      10.0_wp * ( sk(k,j,i)   - sk(k,j,i-1) ) &
+                                    -  5.0_wp * ( sk(k,j,i+1) - sk(k,j,i-2) ) &
+                                    +           ( sk(k,j,i+2) - sk(k,j,i-3) ) &
                                                           ) * adv_sca_5
 
@@ -558,8 +564,8 @@
        ENDIF
 
-       flux_t(0) = 0.0
-       diss_t(0) = 0.0
-       flux_d    = 0.0
-       diss_d    = 0.0
+       flux_t(0) = 0.0_wp
+       diss_t(0) = 0.0_wp
+       flux_d    = 0.0_wp
+       diss_d    = 0.0_wp
 !        
 !--    Now compute the fluxes and tendency terms for the horizontal and
@@ -576,32 +582,32 @@
 
           u_comp    = u(k,j,i+1) - u_gtrans
-          flux_r(k) = u_comp * (                                            &
-                     ( 37.0 * ibit2 * adv_sca_5                             &
-                  +     7.0 * ibit1 * adv_sca_3                             &
-                  +           ibit0 * adv_sca_1                             &
-                     ) *                                                    &
-                             ( sk(k,j,i+1) + sk(k,j,i)   )                  &
-              -      (  8.0 * ibit2 * adv_sca_5                             &
-                  +           ibit1 * adv_sca_3                             &
-                     ) *                                                    &
-                             ( sk(k,j,i+2) + sk(k,j,i-1) )                  &
-              +      (        ibit2 * adv_sca_5                             &
-                     ) *                                                    &
-                             ( sk(k,j,i+3) + sk(k,j,i-2) )                  &
+          flux_r(k) = u_comp * (                                              &
+                     ( 37.0_wp * ibit2 * adv_sca_5                            &
+                  +     7.0_wp * ibit1 * adv_sca_3                            &
+                  +              ibit0 * adv_sca_1                            &
+                     ) *                                                      &
+                             ( sk(k,j,i+1) + sk(k,j,i)   )                    &
+              -      (  8.0_wp * ibit2 * adv_sca_5                            &
+                  +              ibit1 * adv_sca_3                            &
+                     ) *                                                      &
+                             ( sk(k,j,i+2) + sk(k,j,i-1) )                    &
+              +      (           ibit2 * adv_sca_5                            &
+                     ) *                                                      &
+                             ( sk(k,j,i+3) + sk(k,j,i-2) )                    &
                                )
 
-          diss_r(k) = -ABS( u_comp ) * (                                    &
-                     ( 10.0 * ibit2 * adv_sca_5                             &
-                  +     3.0 * ibit1 * adv_sca_3                             &
-                  +           ibit0 * adv_sca_1                             &
-                     ) *                                                    &
-                             ( sk(k,j,i+1) - sk(k,j,i)  )                   &
-              -      (  5.0 * ibit2 * adv_sca_5                             &
-                  +           ibit1 * adv_sca_3                             &
-                     ) *                                                    &
-                             ( sk(k,j,i+2) - sk(k,j,i-1) )                  &
-              +      (        ibit2 * adv_sca_5                             &
-                     ) *                                                    &
-                             ( sk(k,j,i+3) - sk(k,j,i-2) )                  &
+          diss_r(k) = -ABS( u_comp ) * (                                      &
+                     ( 10.0_wp * ibit2 * adv_sca_5                            &
+                  +     3.0_wp * ibit1 * adv_sca_3                            &
+                  +              ibit0 * adv_sca_1                            &
+                     ) *                                                      &
+                             ( sk(k,j,i+1) - sk(k,j,i)  )                     &
+              -      (  5.0_wp * ibit2 * adv_sca_5                            &
+                  +              ibit1 * adv_sca_3                            &
+                     ) *                                                      &
+                             ( sk(k,j,i+2) - sk(k,j,i-1) )                    &
+              +      (           ibit2 * adv_sca_5                            &
+                     ) *                                                      &
+                             ( sk(k,j,i+3) - sk(k,j,i-2) )                    &
                                        )
 
@@ -611,32 +617,32 @@
 
           v_comp    = v(k,j+1,i) - v_gtrans
-          flux_n(k) = v_comp * (                                            &
-                     ( 37.0 * ibit5 * adv_sca_5                             &
-                  +     7.0 * ibit4 * adv_sca_3                             &
-                  +           ibit3 * adv_sca_1                             &
-                     ) *                                                    &
-                             ( sk(k,j+1,i) + sk(k,j,i)   )                  &
-              -      (  8.0 * ibit5 * adv_sca_5                             &
-                  +           ibit4 * adv_sca_3                             &
-                     ) *                                                    &
-                             ( sk(k,j+2,i) + sk(k,j-1,i) )                  &
-              +      (        ibit5 * adv_sca_5                             &
-                     ) *                                                    &
-                             ( sk(k,j+3,i) + sk(k,j-2,i) )                  &
+          flux_n(k) = v_comp * (                                              &
+                     ( 37.0_wp * ibit5 * adv_sca_5                            &
+                  +     7.0_wp * ibit4 * adv_sca_3                            &
+                  +              ibit3 * adv_sca_1                            &
+                     ) *                                                      &
+                             ( sk(k,j+1,i) + sk(k,j,i)   )                    &
+              -      (  8.0_wp * ibit5 * adv_sca_5                            &
+                  +              ibit4 * adv_sca_3                            &
+                     ) *                                                      &
+                             ( sk(k,j+2,i) + sk(k,j-1,i) )                    &
+              +      (           ibit5 * adv_sca_5                            &
+                     ) *                                                      &
+                             ( sk(k,j+3,i) + sk(k,j-2,i) )                    &
                                )
 
-          diss_n(k) = -ABS( v_comp ) * (                                    &
-                     ( 10.0 * ibit5 * adv_sca_5                             &
-                  +     3.0 * ibit4 * adv_sca_3                             &
-                  +           ibit3 * adv_sca_1                             &
-                     ) *                                                    &
-                             ( sk(k,j+1,i) - sk(k,j,i)    )                 &
-              -      (  5.0 * ibit5 * adv_sca_5                             &
-                  +           ibit4 * adv_sca_3                             &
-                     ) *                                                    &
-                             ( sk(k,j+2,i) - sk(k,j-1,i)  )                 &
-              +      (        ibit5 * adv_sca_5                             &
-                     ) *                                                    &
-                             ( sk(k,j+3,i) - sk(k,j-2,i) )                  &
+          diss_n(k) = -ABS( v_comp ) * (                                      &
+                     ( 10.0_wp * ibit5 * adv_sca_5                            &
+                  +     3.0_wp * ibit4 * adv_sca_3                            &
+                  +              ibit3 * adv_sca_1                            &
+                     ) *                                                      &
+                             ( sk(k,j+1,i) - sk(k,j,i)   )                    &
+              -      (  5.0_wp * ibit5 * adv_sca_5                            &
+                  +              ibit4 * adv_sca_3                            &
+                     ) *                                                      &
+                             ( sk(k,j+2,i) - sk(k,j-1,i) )                    &
+              +      (           ibit5 * adv_sca_5                            &
+                     ) *                                                      &
+                             ( sk(k,j+3,i) - sk(k,j-2,i) )                    &
                                        )
 !
@@ -652,31 +658,31 @@
 
 
-          flux_t(k) = w(k,j,i) * (                                          &
-                     ( 37.0 * ibit8 * adv_sca_5                             &
-                  +     7.0 * ibit7 * adv_sca_3                             &
-                  +           ibit6 * adv_sca_1                             &
-                     ) *                                                    &
-                             ( sk(k+1,j,i)  + sk(k,j,i)   )                 &
-              -      (  8.0 * ibit8 * adv_sca_5                             &
-                  +           ibit7 * adv_sca_3                             &
-                     ) *                                                    &
-                             ( sk(k_pp,j,i) + sk(k-1,j,i) )                 &
-              +      (        ibit8 * adv_sca_5                             &
-                     ) *     ( sk(k_ppp,j,i)+ sk(k_mm,j,i) )                &
+          flux_t(k) = w(k,j,i) * (                                            &
+                     ( 37.0_wp * ibit8 * adv_sca_5                            &
+                  +     7.0_wp * ibit7 * adv_sca_3                            &
+                  +              ibit6 * adv_sca_1                            &
+                     ) *                                                      &
+                             ( sk(k+1,j,i)  + sk(k,j,i)    )                  &
+              -      (  8.0_wp * ibit8 * adv_sca_5                            &
+                  +              ibit7 * adv_sca_3                            &
+                     ) *                                                      &
+                             ( sk(k_pp,j,i) + sk(k-1,j,i)  )                  &
+              +      (           ibit8 * adv_sca_5                            &
+                     ) *     ( sk(k_ppp,j,i)+ sk(k_mm,j,i) )                  &
                                  )
 
-          diss_t(k) = -ABS( w(k,j,i) ) * (                                  &
-                     ( 10.0 * ibit8 * adv_sca_5                             &
-                  +     3.0 * ibit7 * adv_sca_3                             &
-                  +           ibit6 * adv_sca_1                             &
-                     ) *                                                    &
-                             ( sk(k+1,j,i)   - sk(k,j,i)    )               &
-              -      (  5.0 * ibit8 * adv_sca_5                             &
-                  +           ibit7 * adv_sca_3                             &
-                     ) *                                                    &
-                             ( sk(k_pp,j,i)  - sk(k-1,j,i)  )               &
-              +      (        ibit8 * adv_sca_5                             &
-                     ) *                                                    &
-                             ( sk(k_ppp,j,i) - sk(k_mm,j,i) )               &
+          diss_t(k) = -ABS( w(k,j,i) ) * (                                    &
+                     ( 10.0_wp * ibit8 * adv_sca_5                            &
+                  +     3.0_wp * ibit7 * adv_sca_3                            &
+                  +              ibit6 * adv_sca_1                            &
+                     ) *                                                      &
+                             ( sk(k+1,j,i)   - sk(k,j,i)    )                 &
+              -      (  5.0_wp * ibit8 * adv_sca_5                            &
+                  +              ibit7 * adv_sca_3                            &
+                     ) *                                                      &
+                             ( sk(k_pp,j,i)  - sk(k-1,j,i)  )                 &
+              +      (           ibit8 * adv_sca_5                            &
+                     ) *                                                      &
+                             ( sk(k_ppp,j,i) - sk(k_mm,j,i) )                 &
                                          )
 !
@@ -712,22 +718,22 @@
 
           u_comp    = u(k,j,i+1) - u_gtrans
-          flux_r(k) = u_comp * (                                            &
-                      37.0 * ( sk(k,j,i+1) + sk(k,j,i)   )                  &
-                    -  8.0 * ( sk(k,j,i+2) + sk(k,j,i-1) )                  &
-                    +        ( sk(k,j,i+3) + sk(k,j,i-2) ) ) * adv_sca_5
-          diss_r(k) = -ABS( u_comp ) * (                                    &
-                      10.0 * ( sk(k,j,i+1) - sk(k,j,i)   )                  &
-                    -  5.0 * ( sk(k,j,i+2) - sk(k,j,i-1) )                  &
-                    +        ( sk(k,j,i+3) - sk(k,j,i-2) ) ) * adv_sca_5
+          flux_r(k) = u_comp * (                                              &
+                      37.0_wp * ( sk(k,j,i+1) + sk(k,j,i)   )                 &
+                    -  8.0_wp * ( sk(k,j,i+2) + sk(k,j,i-1) )                 &
+                    +           ( sk(k,j,i+3) + sk(k,j,i-2) ) ) * adv_sca_5
+          diss_r(k) = -ABS( u_comp ) * (                                      &
+                      10.0_wp * ( sk(k,j,i+1) - sk(k,j,i)   )                 &
+                    -  5.0_wp * ( sk(k,j,i+2) - sk(k,j,i-1) )                 &
+                    +           ( sk(k,j,i+3) - sk(k,j,i-2) ) ) * adv_sca_5
 
           v_comp    = v(k,j+1,i) - v_gtrans
-          flux_n(k) = v_comp * (                                            &
-                      37.0 * ( sk(k,j+1,i) + sk(k,j,i)   )                  &
-                    -  8.0 * ( sk(k,j+2,i) + sk(k,j-1,i) )                  &
-                    +        ( sk(k,j+3,i) + sk(k,j-2,i) ) ) * adv_sca_5
-          diss_n(k) = -ABS( v_comp ) * (                                    &
-                      10.0 * ( sk(k,j+1,i) - sk(k,j,i)   )                  &
-                    -  5.0 * ( sk(k,j+2,i) - sk(k,j-1,i) )                  &
-                    +        ( sk(k,j+3,i) - sk(k,j-2,i) ) ) * adv_sca_5
+          flux_n(k) = v_comp * (                                              &
+                      37.0_wp * ( sk(k,j+1,i) + sk(k,j,i)   )                 &
+                    -  8.0_wp * ( sk(k,j+2,i) + sk(k,j-1,i) )                 &
+                    +           ( sk(k,j+3,i) + sk(k,j-2,i) ) ) * adv_sca_5
+          diss_n(k) = -ABS( v_comp ) * (                                      &
+                      10.0_wp * ( sk(k,j+1,i) - sk(k,j,i)   )                 &
+                    -  5.0_wp * ( sk(k,j+2,i) - sk(k,j-1,i) )                 &
+                    +           ( sk(k,j+3,i) - sk(k,j-2,i) ) ) * adv_sca_5
 !
 !--       k index has to be modified near bottom and top, else array
@@ -742,31 +748,31 @@
 
 
-          flux_t(k) = w(k,j,i) * (                                          &
-                     ( 37.0 * ibit8 * adv_sca_5                             &
-                  +     7.0 * ibit7 * adv_sca_3                             &
-                  +           ibit6 * adv_sca_1                             &
-                     ) *                                                    &
-                             ( sk(k+1,j,i)  + sk(k,j,i)   )                 &
-              -      (  8.0 * ibit8 * adv_sca_5                             &
-                  +           ibit7 * adv_sca_3                             &
-                     ) *                                                    &
-                             ( sk(k_pp,j,i) + sk(k-1,j,i) )                 &
-              +      (        ibit8 * adv_sca_5                             &
-                     ) *     ( sk(k_ppp,j,i)+ sk(k_mm,j,i) )                &
+          flux_t(k) = w(k,j,i) * (                                            &
+                    ( 37.0_wp * ibit8 * adv_sca_5                             &
+                 +     7.0_wp * ibit7 * adv_sca_3                             &
+                 +              ibit6 * adv_sca_1                             &
+                    ) *                                                       &
+                             ( sk(k+1,j,i)  + sk(k,j,i)   )                   &
+              -     (  8.0_wp * ibit8 * adv_sca_5                             &
+                  +              ibit7 * adv_sca_3                            &
+                    ) *                                                       &
+                             ( sk(k_pp,j,i) + sk(k-1,j,i) )                   &
+              +     (           ibit8 * adv_sca_5                             &
+                    ) *     ( sk(k_ppp,j,i)+ sk(k_mm,j,i) )                   &
                                  )
 
-          diss_t(k) = -ABS( w(k,j,i) ) * (                                  &
-                     ( 10.0 * ibit8 * adv_sca_5                             &
-                  +     3.0 * ibit7 * adv_sca_3                             &
-                  +           ibit6 * adv_sca_1                             &
-                     ) *                                                    &
-                             ( sk(k+1,j,i)   - sk(k,j,i)    )               &
-              -      (  5.0 * ibit8 * adv_sca_5                             &
-                  +           ibit7 * adv_sca_3                             &
-                     ) *                                                    &
-                             ( sk(k_pp,j,i)  - sk(k-1,j,i)  )               &
-              +      (        ibit8 * adv_sca_5                             &
-                     ) *                                                    &
-                             ( sk(k_ppp,j,i) - sk(k_mm,j,i) )               &
+          diss_t(k) = -ABS( w(k,j,i) ) * (                                    &
+                    ( 10.0_wp * ibit8 * adv_sca_5                             &
+                 +     3.0_wp * ibit7 * adv_sca_3                             &
+                 +              ibit6 * adv_sca_1                             &
+                    ) *                                                       &
+                             ( sk(k+1,j,i)   - sk(k,j,i)    )                 &
+              -     (  5.0_wp * ibit8 * adv_sca_5                             &
+                 +              ibit7 * adv_sca_3                             &
+                    ) *                                                       &
+                             ( sk(k_pp,j,i)  - sk(k-1,j,i)  )                 &
+              +     (           ibit8 * adv_sca_5                             &
+                    ) *                                                       &
+                             ( sk(k_ppp,j,i) - sk(k_mm,j,i) )                 &
                                          )
 !
@@ -803,6 +809,6 @@
 
              DO  k = nzb, nzt
-                sums_wspts_ws_l(k,tn) = sums_wspts_ws_l(k,tn) +                &
-                                       ( flux_t(k) + diss_t(k) )               &
+                sums_wspts_ws_l(k,tn) = sums_wspts_ws_l(k,tn) +               &
+                                       ( flux_t(k) + diss_t(k) )              &
                                  * weight_substep(intermediate_timestep_count)
              ENDDO
@@ -811,6 +817,6 @@
 
              DO  k = nzb, nzt
-                sums_wssas_ws_l(k,tn) = sums_wssas_ws_l(k,tn) +                &
-                                       ( flux_t(k) + diss_t(k) )               &
+                sums_wssas_ws_l(k,tn) = sums_wssas_ws_l(k,tn) +               &
+                                       ( flux_t(k) + diss_t(k) )              &
                                  * weight_substep(intermediate_timestep_count)
              ENDDO
@@ -819,6 +825,6 @@
 
              DO  k = nzb, nzt
-                sums_wsqs_ws_l(k,tn)  = sums_wsqs_ws_l(k,tn) +                 &
-                                      ( flux_t(k) + diss_t(k) )                &
+                sums_wsqs_ws_l(k,tn)  = sums_wsqs_ws_l(k,tn) +                &
+                                      ( flux_t(k) + diss_t(k) )               &
                                  * weight_substep(intermediate_timestep_count)
              ENDDO
@@ -827,6 +833,6 @@
 
              DO  k = nzb, nzt
-                sums_wsqrs_ws_l(k,tn)  = sums_wsqrs_ws_l(k,tn) +               &
-                                      ( flux_t(k) + diss_t(k) )                &
+                sums_wsqrs_ws_l(k,tn)  = sums_wsqrs_ws_l(k,tn) +              &
+                                      ( flux_t(k) + diss_t(k) )               &
                                  * weight_substep(intermediate_timestep_count)
              ENDDO
@@ -835,6 +841,6 @@
 
              DO  k = nzb, nzt
-                sums_wsnrs_ws_l(k,tn)  = sums_wsnrs_ws_l(k,tn) +               &
-                                      ( flux_t(k) + diss_t(k) )                &
+                sums_wsnrs_ws_l(k,tn)  = sums_wsnrs_ws_l(k,tn) +              &
+                                      ( flux_t(k) + diss_t(k) )               &
                                  * weight_substep(intermediate_timestep_count)
              ENDDO
@@ -852,22 +858,22 @@
     SUBROUTINE advec_u_ws_ij( i, j, i_omp, tn )
 
-       USE arrays_3d,                                                          &
+       USE arrays_3d,                                                         &
            ONLY:  ddzw, diss_l_u, diss_s_u, flux_l_u, flux_s_u, tend, u, v, w
 
-       USE constants,                                                          &
+       USE constants,                                                         &
            ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
 
-       USE control_parameters,                                                 &
+       USE control_parameters,                                                &
            ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
 
-       USE grid_variables,                                                     &
+       USE grid_variables,                                                    &
            ONLY:  ddx, ddy
 
-       USE indices,                                                            &
+       USE indices,                                                           &
            ONLY:  nxl, nxr, nyn, nys, nzb, nzb_max, nzt, wall_flags_0
 
        USE kinds
 
-       USE statistics,                                                         &
+       USE statistics,                                                        &
            ONLY:  hom, sums_us2_ws_l, sums_wsus_ws_l, weight_substep
 
@@ -909,6 +915,6 @@
        REAL(wp), DIMENSION(nzb:nzt+1) ::  u_comp !:
 
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
 !
 !--    Compute southside fluxes for the respective boundary of PE
@@ -923,31 +929,31 @@
              v_comp      = v(k,j,i) + v(k,j,i-1) - gv
              flux_s_u(k,tn) = v_comp * (                                      &
-                            ( 37.0 * ibit14 * adv_mom_5                       &
-                         +     7.0 * ibit13 * adv_mom_3                       &
-                         +           ibit12 * adv_mom_1                       &
+                            ( 37.0_wp * ibit14 * adv_mom_5                    &
+                         +     7.0_wp * ibit13 * adv_mom_3                    &
+                         +              ibit12 * adv_mom_1                    &
                             ) *                                               &
-                                     ( u(k,j,i)   + u(k,j-1,i) )              &
-                     -      (  8.0 * ibit14 * adv_mom_5                       &
-                         +           ibit13 * adv_mom_3                       &
+                                        ( u(k,j,i)   + u(k,j-1,i) )           &
+                     -      (  8.0_wp * ibit14 * adv_mom_5                    &
+                         +              ibit13 * adv_mom_3                    &
                             ) *                                               &
-                                     ( u(k,j+1,i) + u(k,j-2,i) )              &
-                     +      (        ibit14 * adv_mom_5                       &
+                                        ( u(k,j+1,i) + u(k,j-2,i) )           &
+                     +      (           ibit14 * adv_mom_5                    &
                             ) *                                               &
-                                     ( u(k,j+2,i) + u(k,j-3,i) )              &
+                                        ( u(k,j+2,i) + u(k,j-3,i) )           &
                                        )
 
              diss_s_u(k,tn) = - ABS ( v_comp ) * (                            &
-                            ( 10.0 * ibit14 * adv_mom_5                       &
-                         +     3.0 * ibit13 * adv_mom_3                       &
-                         +           ibit12 * adv_mom_1                       &
+                            ( 10.0_wp * ibit14 * adv_mom_5                    &
+                         +     3.0_wp * ibit13 * adv_mom_3                    &
+                         +              ibit12 * adv_mom_1                    &
                             ) *                                               &
-                                     ( u(k,j,i)   - u(k,j-1,i) )              &
-                     -      (  5.0 * ibit14 * adv_mom_5                       &
-                         +           ibit13 * adv_mom_3                       &
+                                        ( u(k,j,i)   - u(k,j-1,i) )           &
+                     -      (  5.0_wp * ibit14 * adv_mom_5                    &
+                         +              ibit13 * adv_mom_3                    &
                             ) *                                               &
-                                     ( u(k,j+1,i) - u(k,j-2,i) )              &
-                     +      (        ibit14 * adv_mom_5                       &
+                                        ( u(k,j+1,i) - u(k,j-2,i) )           &
+                     +      (           ibit14 * adv_mom_5                    &
                             ) *                                               &
-                                     ( u(k,j+2,i) - u(k,j-3,i) )              &
+                                        ( u(k,j+2,i) - u(k,j-3,i) )           &
                                                  )
 
@@ -958,11 +964,11 @@
              v_comp         = v(k,j,i) + v(k,j,i-1) - gv
              flux_s_u(k,tn) = v_comp * (                                      &
-                           37.0 * ( u(k,j,i) + u(k,j-1,i)   )                 &
-                         -  8.0 * ( u(k,j+1,i) + u(k,j-2,i) )                 &
-                         +        ( u(k,j+2,i) + u(k,j-3,i) ) ) * adv_mom_5
+                           37.0_wp * ( u(k,j,i) + u(k,j-1,i)   )              &
+                         -  8.0_wp * ( u(k,j+1,i) + u(k,j-2,i) )              &
+                         +           ( u(k,j+2,i) + u(k,j-3,i) ) ) * adv_mom_5
              diss_s_u(k,tn) = - ABS(v_comp) * (                               &
-                           10.0 * ( u(k,j,i) - u(k,j-1,i)   )                 &
-                         -  5.0 * ( u(k,j+1,i) - u(k,j-2,i) )                 &
-                         +        ( u(k,j+2,i) - u(k,j-3,i) ) ) * adv_mom_5
+                           10.0_wp * ( u(k,j,i) - u(k,j-1,i)   )              &
+                         -  5.0_wp * ( u(k,j+1,i) - u(k,j-2,i) )              &
+                         +           ( u(k,j+2,i) - u(k,j-3,i) ) ) * adv_mom_5
 
           ENDDO
@@ -980,32 +986,32 @@
 
              u_comp_l         = u(k,j,i) + u(k,j,i-1) - gu
-             flux_l_u(k,j,tn) = u_comp_l * (                                   &
-                              ( 37.0 * ibit11 * adv_mom_5                      &
-                           +     7.0 * ibit10 * adv_mom_3                      &
-                           +           ibit9  * adv_mom_1                      &
-                              ) *                                              &
-                                     ( u(k,j,i)   + u(k,j,i-1) )               &
-                       -      (  8.0 * ibit11 * adv_mom_5                      &
-                           +           ibit10 * adv_mom_3                      &
-                              ) *                                              &
-                                     ( u(k,j,i+1) + u(k,j,i-2) )               &
-                       +      (        ibit11 * adv_mom_5                      &
-                              ) *                                              &
-                                     ( u(k,j,i+2) + u(k,j,i-3) )               &
+             flux_l_u(k,j,tn) = u_comp_l * (                                  &
+                              ( 37.0_wp * ibit11 * adv_mom_5                  &
+                           +     7.0_wp * ibit10 * adv_mom_3                  &
+                           +              ibit9  * adv_mom_1                  &
+                              ) *                                             &
+                                          ( u(k,j,i)   + u(k,j,i-1) )         &
+                       -      (  8.0_wp * ibit11 * adv_mom_5                  &
+                           +              ibit10 * adv_mom_3                  &
+                              ) *                                             &
+                                          ( u(k,j,i+1) + u(k,j,i-2) )         &
+                       +      (           ibit11 * adv_mom_5                  &
+                              ) *                                             &
+                                          ( u(k,j,i+2) + u(k,j,i-3) )         &
                                            )
 
-              diss_l_u(k,j,tn) = - ABS( u_comp_l ) * (                         &
-                              ( 10.0 * ibit11 * adv_mom_5                      &
-                           +     3.0 * ibit10 * adv_mom_3                      &
-                           +           ibit9  * adv_mom_1                      &
-                              ) *                                              &
-                                     ( u(k,j,i)   - u(k,j,i-1) )               &
-                       -      (  5.0 * ibit11 * adv_mom_5                      &
-                           +           ibit10 * adv_mom_3                      &
-                              ) *                                              &
-                                     ( u(k,j,i+1) - u(k,j,i-2) )               &
-                       +      (        ibit11 * adv_mom_5                      &
-                              ) *                                              &
-                                     ( u(k,j,i+2) - u(k,j,i-3) )               &
+              diss_l_u(k,j,tn) = - ABS( u_comp_l ) * (                        &
+                              ( 10.0_wp * ibit11 * adv_mom_5                  &
+                           +     3.0_wp * ibit10 * adv_mom_3                  &
+                           +              ibit9  * adv_mom_1                  &
+                              ) *                                             &
+                                        ( u(k,j,i)   - u(k,j,i-1) )           &
+                       -      (  5.0_wp * ibit11 * adv_mom_5                  &
+                           +              ibit10 * adv_mom_3                  &
+                              ) *                                             &
+                                        ( u(k,j,i+1) - u(k,j,i-2) )           &
+                       +      (           ibit11 * adv_mom_5                  &
+                              ) *                                             &
+                                        ( u(k,j,i+2) - u(k,j,i-3) )           &
                                                      )
 
@@ -1016,11 +1022,11 @@
              u_comp_l         = u(k,j,i) + u(k,j,i-1) - gu
              flux_l_u(k,j,tn) = u_comp_l * (                                   &
-                             37.0 * ( u(k,j,i) + u(k,j,i-1)   )                &
-                           -  8.0 * ( u(k,j,i+1) + u(k,j,i-2) )                &
-                           +        ( u(k,j,i+2) + u(k,j,i-3) ) ) * adv_mom_5
+                             37.0_wp * ( u(k,j,i) + u(k,j,i-1)   )             &
+                           -  8.0_wp * ( u(k,j,i+1) + u(k,j,i-2) )             &
+                           +           ( u(k,j,i+2) + u(k,j,i-3) ) ) * adv_mom_5
              diss_l_u(k,j,tn) = - ABS(u_comp_l) * (                            &
-                             10.0 * ( u(k,j,i) - u(k,j,i-1)   )                &
-                           -  5.0 * ( u(k,j,i+1) - u(k,j,i-2) )                &
-                           +        ( u(k,j,i+2) - u(k,j,i-3) ) ) * adv_mom_5
+                             10.0_wp * ( u(k,j,i) - u(k,j,i-1)   )             &
+                           -  5.0_wp * ( u(k,j,i+1) - u(k,j,i-2) )             &
+                           +           ( u(k,j,i+2) - u(k,j,i-3) ) ) * adv_mom_5
 
           ENDDO
@@ -1028,8 +1034,8 @@
        ENDIF
 
-       flux_t(0) = 0.0
-       diss_t(0) = 0.0
-       flux_d    = 0.0
-       diss_d    = 0.0
+       flux_t(0) = 0.0_wp
+       diss_t(0) = 0.0_wp
+       flux_d    = 0.0_wp
+       diss_d    = 0.0_wp
 !
 !--    Now compute the fluxes tendency terms for the horizontal and
@@ -1042,32 +1048,32 @@
 
           u_comp(k) = u(k,j,i+1) + u(k,j,i)
-          flux_r(k) = ( u_comp(k) - gu ) * (                                 &
-                     ( 37.0 * ibit11 * adv_mom_5                             &
-                  +     7.0 * ibit10 * adv_mom_3                             &
-                  +           ibit9  * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( u(k,j,i+1) + u(k,j,i)   )                 &
-              -      (  8.0 * ibit11 * adv_mom_5                             &
-                  +           ibit10 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( u(k,j,i+2) + u(k,j,i-1) )                 &
-              +      (        ibit11 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( u(k,j,i+3) + u(k,j,i-2) )                 &
+          flux_r(k) = ( u_comp(k) - gu ) * (                                  &
+                     ( 37.0_wp * ibit11 * adv_mom_5                           &
+                  +     7.0_wp * ibit10 * adv_mom_3                           &
+                  +              ibit9  * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( u(k,j,i+1) + u(k,j,i)   )               &
+              -      (  8.0_wp * ibit11 * adv_mom_5                           &
+                  +              ibit10 * adv_mom_3                           & 
+                     ) *                                                      &
+                                    ( u(k,j,i+2) + u(k,j,i-1) )               &
+              +      (           ibit11 * adv_mom_5                           &
+                     ) *                                                      &
+                                    ( u(k,j,i+3) + u(k,j,i-2) )               &
                                            )
 
-          diss_r(k) = - ABS( u_comp(k) - gu ) * (                            &
-                     ( 10.0 * ibit11 * adv_mom_5                             &
-                  +     3.0 * ibit10 * adv_mom_3                             &
-                  +           ibit9  * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( u(k,j,i+1) - u(k,j,i)  )                  &
-              -      (  5.0 * ibit11 * adv_mom_5                             &
-                  +           ibit10 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( u(k,j,i+2) - u(k,j,i-1) )                 &
-              +      (        ibit11 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( u(k,j,i+3) - u(k,j,i-2) )                 &
+          diss_r(k) = - ABS( u_comp(k) - gu ) * (                             &
+                     ( 10.0_wp * ibit11 * adv_mom_5                           &
+                  +     3.0_wp * ibit10 * adv_mom_3                           &
+                  +              ibit9  * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( u(k,j,i+1) - u(k,j,i)   )               &
+              -      (  5.0_wp * ibit11 * adv_mom_5                           &
+                  +              ibit10 * adv_mom_3                           &
+                     ) *                                                      &
+                                    ( u(k,j,i+2) - u(k,j,i-1) )               &
+              +      (           ibit11 * adv_mom_5                           &
+                     ) *                                                      &
+                                    ( u(k,j,i+3) - u(k,j,i-2) )               &
                                                 )
 
@@ -1077,32 +1083,32 @@
 
           v_comp    = v(k,j+1,i) + v(k,j+1,i-1) - gv
-          flux_n(k) = v_comp * (                                             &
-                     ( 37.0 * ibit14 * adv_mom_5                             &
-                  +     7.0 * ibit13 * adv_mom_3                             &
-                  +           ibit12 * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( u(k,j+1,i) + u(k,j,i)   )                 &
-              -      (  8.0 * ibit14 * adv_mom_5                             &
-                  +           ibit13 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( u(k,j+2,i) + u(k,j-1,i) )                 &
-              +      (        ibit14 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( u(k,j+3,i) + u(k,j-2,i) )                 &
+          flux_n(k) = v_comp * (                                              &
+                     ( 37.0_wp * ibit14 * adv_mom_5                           &
+                  +     7.0_wp * ibit13 * adv_mom_3                           &
+                  +              ibit12 * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( u(k,j+1,i) + u(k,j,i)   )               &
+              -      (  8.0_wp * ibit14 * adv_mom_5                           &
+                  +              ibit13 * adv_mom_3                           &
+                     ) *                                                      &
+                                    ( u(k,j+2,i) + u(k,j-1,i) )               &
+              +      (           ibit14 * adv_mom_5                           &
+                     ) *                                                      &
+                                    ( u(k,j+3,i) + u(k,j-2,i) )               &
                                )
 
-          diss_n(k) = - ABS ( v_comp ) * (                                   &
-                     ( 10.0 * ibit14 * adv_mom_5                             &
-                  +     3.0 * ibit13 * adv_mom_3                             &
-                  +           ibit12 * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( u(k,j+1,i) - u(k,j,i)  )                  &
-              -      (  5.0 * ibit14 * adv_mom_5                             &
-                  +           ibit13 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( u(k,j+2,i) - u(k,j-1,i) )                 &
-              +      (        ibit14 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( u(k,j+3,i) - u(k,j-2,i) )                 &
+          diss_n(k) = - ABS ( v_comp ) * (                                    &
+                     ( 10.0_wp * ibit14 * adv_mom_5                           &
+                  +     3.0_wp * ibit13 * adv_mom_3                           &
+                  +              ibit12 * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( u(k,j+1,i) - u(k,j,i)   )               &
+              -      (  5.0_wp * ibit14 * adv_mom_5                           &
+                  +              ibit13 * adv_mom_3                           &
+                     ) *                                                      &
+                                    ( u(k,j+2,i) - u(k,j-1,i) )               &
+              +      (           ibit14 * adv_mom_5                           &
+                     ) *                                                      &
+                                    ( u(k,j+3,i) - u(k,j-2,i) )               &
                                          )
 !
@@ -1118,32 +1124,32 @@
 
           w_comp    = w(k,j,i) + w(k,j,i-1)
-          flux_t(k) = w_comp  * (                                            &
-                     ( 37.0 * ibit17 * adv_mom_5                             &
-                  +     7.0 * ibit16 * adv_mom_3                             &
-                  +           ibit15 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( u(k+1,j,i)  + u(k,j,i)     )                  &
-              -      (  8.0 * ibit17 * adv_mom_5                             &
-                  +           ibit16 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( u(k_pp,j,i) + u(k-1,j,i)   )                  &
-              +      (        ibit17 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( u(k_ppp,j,i) + u(k_mm,j,i) )                  &
+          flux_t(k) = w_comp  * (                                             &
+                     ( 37.0_wp * ibit17 * adv_mom_5                           &
+                  +     7.0_wp * ibit16 * adv_mom_3                           &
+                  +              ibit15 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( u(k+1,j,i)  + u(k,j,i)     )                &
+              -      (  8.0_wp * ibit17 * adv_mom_5                           &
+                  +              ibit16 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( u(k_pp,j,i) + u(k-1,j,i)   )                &
+              +      (           ibit17 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( u(k_ppp,j,i) + u(k_mm,j,i) )                &
                                  )
 
-          diss_t(k) = - ABS( w_comp ) * (                                    &
-                     ( 10.0 * ibit17 * adv_mom_5                             &
-                  +     3.0 * ibit16 * adv_mom_3                             &
-                  +           ibit15 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( u(k+1,j,i)   - u(k,j,i)    )                  &
-              -      (  5.0 * ibit17 * adv_mom_5                             &
-                  +           ibit16 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( u(k_pp,j,i)  - u(k-1,j,i)  )                  &
-              +      (        ibit17 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( u(k_ppp,j,i) - u(k_mm,j,i) )                  &
+          diss_t(k) = - ABS( w_comp ) * (                                     &
+                     ( 10.0_wp * ibit17 * adv_mom_5                           &
+                  +     3.0_wp * ibit16 * adv_mom_3                           &
+                  +              ibit15 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( u(k+1,j,i)   - u(k,j,i)    )                &
+              -      (  5.0_wp * ibit17 * adv_mom_5                           &
+                  +              ibit16 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( u(k_pp,j,i)  - u(k-1,j,i)  )                &
+              +      (           ibit17 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( u(k_ppp,j,i) - u(k_mm,j,i) )                &
                                          )
 !
@@ -1151,8 +1157,8 @@
 !--       correction is needed to overcome numerical instabilities introduced
 !--       by a not sufficient reduction of divergences near topography. 
-          div = ( ( u_comp(k)   - ( u(k,j,i)   + u(k,j,i-1)   ) ) * ddx      &
-               +  ( v_comp + gv - ( v(k,j,i)   + v(k,j,i-1 )  ) ) * ddy      &
-               +  ( w_comp      - ( w(k-1,j,i) + w(k-1,j,i-1) ) ) * ddzw(k)  &
-                ) * 0.5
+          div = ( ( u_comp(k)   - ( u(k,j,i)   + u(k,j,i-1)   ) ) * ddx       &
+               +  ( v_comp + gv - ( v(k,j,i)   + v(k,j,i-1 )  ) ) * ddy       &
+               +  ( w_comp      - ( w(k-1,j,i) + w(k-1,j,i-1) ) ) * ddzw(k)   &
+                ) * 0.5_wp
 
           tend(k,j,i) = tend(k,j,i) - (                                       &
@@ -1176,8 +1182,8 @@
            sums_us2_ws_l(k,tn) = sums_us2_ws_l(k,tn)                          &
                               + ( flux_r(k) *                                 &
-                                ( u_comp(k) - 2.0 * hom(k,1,1,0) )            &
+                                ( u_comp(k) - 2.0_wp * hom(k,1,1,0) )         &
                               / ( u_comp(k) - gu + 1.0E-20_wp   )             &
                               +   diss_r(k) *                                 &
-                                  ABS( u_comp(k) - 2.0 * hom(k,1,1,0) )       &
+                                  ABS( u_comp(k) - 2.0_wp * hom(k,1,1,0) )    &
                               / ( ABS( u_comp(k) - gu ) + 1.0E-20_wp ) )      &
                               *   weight_substep(intermediate_timestep_count)
@@ -1193,21 +1199,21 @@
           u_comp(k) = u(k,j,i+1) + u(k,j,i)
           flux_r(k) = ( u_comp(k) - gu ) * (                                  &
-                         37.0 * ( u(k,j,i+1) + u(k,j,i)   )                   &
-                       -  8.0 * ( u(k,j,i+2) + u(k,j,i-1) )                   &
-                       +        ( u(k,j,i+3) + u(k,j,i-2) ) ) * adv_mom_5
+                         37.0_wp * ( u(k,j,i+1) + u(k,j,i)   )                &
+                       -  8.0_wp * ( u(k,j,i+2) + u(k,j,i-1) )                &
+                       +           ( u(k,j,i+3) + u(k,j,i-2) ) ) * adv_mom_5
              diss_r(k) = - ABS( u_comp(k) - gu ) * (                          &
-                         10.0 * ( u(k,j,i+1) - u(k,j,i)   )                   &
-                       -  5.0 * ( u(k,j,i+2) - u(k,j,i-1) )                   &
-                       +        ( u(k,j,i+3) - u(k,j,i-2) ) ) * adv_mom_5
+                         10.0_wp * ( u(k,j,i+1) - u(k,j,i)   )                &
+                       -  5.0_wp * ( u(k,j,i+2) - u(k,j,i-1) )                &
+                       +           ( u(k,j,i+3) - u(k,j,i-2) ) ) * adv_mom_5
 
              v_comp    = v(k,j+1,i) + v(k,j+1,i-1) - gv
              flux_n(k) = v_comp * (                                           &
-                         37.0 * ( u(k,j+1,i) + u(k,j,i)   )                   &
-                       -  8.0 * ( u(k,j+2,i) + u(k,j-1,i) )                   &
-                       +        ( u(k,j+3,i) + u(k,j-2,i) ) ) * adv_mom_5
+                         37.0_wp * ( u(k,j+1,i) + u(k,j,i)   )                &
+                       -  8.0_wp * ( u(k,j+2,i) + u(k,j-1,i) )                &
+                       +           ( u(k,j+3,i) + u(k,j-2,i) ) ) * adv_mom_5
              diss_n(k) = - ABS( v_comp ) * (                                  &
-                         10.0 * ( u(k,j+1,i) - u(k,j,i)   )                   &
-                       -  5.0 * ( u(k,j+2,i) - u(k,j-1,i) )                   &
-                       +        ( u(k,j+3,i) - u(k,j-2,i) ) ) * adv_mom_5
+                         10.0_wp * ( u(k,j+1,i) - u(k,j,i)   )                &
+                       -  5.0_wp * ( u(k,j+2,i) - u(k,j-1,i) )                &
+                       +           ( u(k,j+3,i) - u(k,j-2,i) ) ) * adv_mom_5
 !
 !--       k index has to be modified near bottom and top, else array
@@ -1222,32 +1228,32 @@
 
           w_comp    = w(k,j,i) + w(k,j,i-1)
-          flux_t(k) = w_comp  * (                                            &
-                     ( 37.0 * ibit17 * adv_mom_5                             &
-                  +     7.0 * ibit16 * adv_mom_3                             &
-                  +           ibit15 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( u(k+1,j,i)  + u(k,j,i)     )                  &
-              -      (  8.0 * ibit17 * adv_mom_5                             &
-                  +           ibit16 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( u(k_pp,j,i) + u(k-1,j,i)   )                  &
-              +      (        ibit17 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( u(k_ppp,j,i) + u(k_mm,j,i) )                  &
+          flux_t(k) = w_comp  * (                                             &
+                     ( 37.0_wp * ibit17 * adv_mom_5                           &
+                  +     7.0_wp * ibit16 * adv_mom_3                           &
+                  +              ibit15 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( u(k+1,j,i)  + u(k,j,i)     )                &
+              -      (  8.0_wp * ibit17 * adv_mom_5                           &
+                  +              ibit16 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( u(k_pp,j,i) + u(k-1,j,i)   )                &
+              +      (           ibit17 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( u(k_ppp,j,i) + u(k_mm,j,i) )                &
                                  )
 
-          diss_t(k) = - ABS( w_comp ) * (                                    &
-                     ( 10.0 * ibit17 * adv_mom_5                             &
-                  +     3.0 * ibit16 * adv_mom_3                             &
-                  +           ibit15 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( u(k+1,j,i)   - u(k,j,i)    )                  &
-              -      (  5.0 * ibit17 * adv_mom_5                             &
-                  +           ibit16 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( u(k_pp,j,i)  - u(k-1,j,i)  )                  &
-              +      (        ibit17 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( u(k_ppp,j,i) - u(k_mm,j,i) )                  &
+          diss_t(k) = - ABS( w_comp ) * (                                     &
+                     ( 10.0_wp * ibit17 * adv_mom_5                           &
+                  +     3.0_wp * ibit16 * adv_mom_3                           &
+                  +              ibit15 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( u(k+1,j,i)   - u(k,j,i)    )                &
+              -      (  5.0_wp * ibit17 * adv_mom_5                           &
+                  +              ibit16 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( u(k_pp,j,i)  - u(k-1,j,i)  )                &
+              +      (           ibit17 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( u(k_ppp,j,i) - u(k_mm,j,i) )                &
                                          )
 !
@@ -1255,8 +1261,8 @@
 !--       correction is needed to overcome numerical instabilities introduced
 !--       by a not sufficient reduction of divergences near topography.
-          div = ( ( u_comp(k)   - ( u(k,j,i)   + u(k,j,i-1)   ) ) * ddx      &
-               +  ( v_comp + gv - ( v(k,j,i)   + v(k,j,i-1 )  ) ) * ddy      &
-               +  ( w_comp      - ( w(k-1,j,i) + w(k-1,j,i-1) ) ) * ddzw(k)  &
-                ) * 0.5
+          div = ( ( u_comp(k)   - ( u(k,j,i)   + u(k,j,i-1)   ) ) * ddx       &
+               +  ( v_comp + gv - ( v(k,j,i)   + v(k,j,i-1 )  ) ) * ddy       &
+               +  ( w_comp      - ( w(k-1,j,i) + w(k-1,j,i-1) ) ) * ddzw(k)   &
+                ) * 0.5_wp
 
           tend(k,j,i) = tend(k,j,i) - (                                       &
@@ -1280,8 +1286,8 @@
            sums_us2_ws_l(k,tn) = sums_us2_ws_l(k,tn)                          &
                               + ( flux_r(k) *                                 &
-                                ( u_comp(k) - 2.0 * hom(k,1,1,0) )            &
-                              / ( u_comp(k) - gu + 1.0E-20_wp   )             &
+                                ( u_comp(k) - 2.0_wp * hom(k,1,1,0)      )    &
+                              / ( u_comp(k) - gu + 1.0E-20_wp          )      &
                               +   diss_r(k) *                                 &
-                                  ABS( u_comp(k) - 2.0 * hom(k,1,1,0) )       &
+                                  ABS( u_comp(k) - 2.0_wp * hom(k,1,1,0) )    &
                               / ( ABS( u_comp(k) - gu ) + 1.0E-20_wp ) )      &
                               *   weight_substep(intermediate_timestep_count)
@@ -1363,6 +1369,6 @@
        REAL(wp), DIMENSION(nzb:nzt+1)  ::  v_comp !:
 
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
 
 !       
@@ -1377,32 +1383,32 @@
 
              u_comp           = u(k,j-1,i) + u(k,j,i) - gu
-             flux_l_v(k,j,tn) = u_comp * (                                     &
-                              ( 37.0 * ibit20 * adv_mom_5                      &
-                           +     7.0 * ibit19 * adv_mom_3                      &
-                           +           ibit18 * adv_mom_1                      &
-                              ) *                                              &
-                                     ( v(k,j,i)   + v(k,j,i-1) )               &
-                       -      (  8.0 * ibit20 * adv_mom_5                      &
-                           +           ibit19 * adv_mom_3                      &
-                              ) *                                              &
-                                     ( v(k,j,i+1) + v(k,j,i-2) )               &
-                       +      (        ibit20 * adv_mom_5                      &
-                              ) *                                              &
-                                     ( v(k,j,i+2) + v(k,j,i-3) )               &
+             flux_l_v(k,j,tn) = u_comp * (                                    &
+                              ( 37.0_wp * ibit20 * adv_mom_5                  &
+                           +     7.0_wp * ibit19 * adv_mom_3                  &
+                           +              ibit18 * adv_mom_1                  &
+                              ) *                                             &
+                                        ( v(k,j,i)   + v(k,j,i-1) )           &
+                       -      (  8.0_wp * ibit20 * adv_mom_5                  &
+                           +              ibit19 * adv_mom_3                  &
+                              ) *                                             &
+                                        ( v(k,j,i+1) + v(k,j,i-2) )           &
+                       +      (           ibit20 * adv_mom_5                  &
+                              ) *                                             &
+                                        ( v(k,j,i+2) + v(k,j,i-3) )           &
                                          )
 
-              diss_l_v(k,j,tn) = - ABS( u_comp ) * (                           &
-                              ( 10.0 * ibit20 * adv_mom_5                      &
-                           +     3.0 * ibit19 * adv_mom_3                      &
-                           +           ibit18 * adv_mom_1                      &
-                              ) *                                              &
-                                     ( v(k,j,i)   - v(k,j,i-1) )               &
-                       -      (  5.0 * ibit20 * adv_mom_5                      &
-                           +           ibit19 * adv_mom_3                      &
-                              ) *                                              &
-                                     ( v(k,j,i+1) - v(k,j,i-2) )               &
-                       +      (        ibit20 * adv_mom_5                      &
-                              ) *                                              &
-                                     ( v(k,j,i+2) - v(k,j,i-3) )               &
+              diss_l_v(k,j,tn) = - ABS( u_comp ) * (                          &
+                              ( 10.0_wp * ibit20 * adv_mom_5                  &
+                           +     3.0_wp * ibit19 * adv_mom_3                  &
+                           +              ibit18 * adv_mom_1                  &
+                              ) *                                             &
+                                        ( v(k,j,i)   - v(k,j,i-1) )           &
+                       -      (  5.0_wp * ibit20 * adv_mom_5                  &
+                           +              ibit19 * adv_mom_3                  &
+                              ) *                                             &
+                                        ( v(k,j,i+1) - v(k,j,i-2) )           &
+                       +      (           ibit20 * adv_mom_5                  &
+                              ) *                                             &
+                                        ( v(k,j,i+2) - v(k,j,i-3) )           &
                                                    )
 
@@ -1413,11 +1419,11 @@
              u_comp           = u(k,j-1,i) + u(k,j,i) - gu
              flux_l_v(k,j,tn) = u_comp * (                                    &
-                             37.0 * ( v(k,j,i) + v(k,j,i-1)   )               &
-                           -  8.0 * ( v(k,j,i+1) + v(k,j,i-2) )               &
-                           +        ( v(k,j,i+2) + v(k,j,i-3) ) ) * adv_mom_5
+                             37.0_wp * ( v(k,j,i) + v(k,j,i-1)   )            &
+                           -  8.0_wp * ( v(k,j,i+1) + v(k,j,i-2) )            &
+                           +           ( v(k,j,i+2) + v(k,j,i-3) ) ) * adv_mom_5
              diss_l_v(k,j,tn) = - ABS( u_comp ) * (                           &
-                             10.0 * ( v(k,j,i) - v(k,j,i-1)   )               &
-                           -  5.0 * ( v(k,j,i+1) - v(k,j,i-2) )               &
-                           +        ( v(k,j,i+2) - v(k,j,i-3) ) ) * adv_mom_5
+                             10.0_wp * ( v(k,j,i) - v(k,j,i-1)   )            &
+                           -  5.0_wp * ( v(k,j,i+1) - v(k,j,i-2) )            &
+                           +           ( v(k,j,i+2) - v(k,j,i-3) ) ) * adv_mom_5
 
           ENDDO
@@ -1436,32 +1442,32 @@
              v_comp_l       = v(k,j,i) + v(k,j-1,i) - gv
              flux_s_v(k,tn) = v_comp_l * (                                    &
-                            ( 37.0 * ibit23 * adv_mom_5                       &
-                         +     7.0 * ibit22 * adv_mom_3                       &
-                         +           ibit21 * adv_mom_1                       &
+                            ( 37.0_wp * ibit23 * adv_mom_5                    &
+                         +     7.0_wp * ibit22 * adv_mom_3                    &
+                         +              ibit21 * adv_mom_1                    &
                             ) *                                               &
-                                     ( v(k,j,i)   + v(k,j-1,i) )              &
-                     -      (  8.0 * ibit23 * adv_mom_5                       &
-                         +           ibit22 * adv_mom_3                       &
+                                        ( v(k,j,i)   + v(k,j-1,i) )           &
+                     -      (  8.0_wp * ibit23 * adv_mom_5                    &
+                         +              ibit22 * adv_mom_3                    &
                             ) *                                               &
-                                     ( v(k,j+1,i) + v(k,j-2,i) )              &
-                     +      (        ibit23 * adv_mom_5                       &
+                                        ( v(k,j+1,i) + v(k,j-2,i) )           &
+                     +      (           ibit23 * adv_mom_5                    &
                             ) *                                               &
-                                     ( v(k,j+2,i) + v(k,j-3,i) )              &
+                                        ( v(k,j+2,i) + v(k,j-3,i) )           &
                                          )
 
              diss_s_v(k,tn) = - ABS( v_comp_l ) * (                           &
-                            ( 10.0 * ibit23 * adv_mom_5                       &
-                         +     3.0 * ibit22 * adv_mom_3                       &
-                         +           ibit21 * adv_mom_1                       &
+                            ( 10.0_wp * ibit23 * adv_mom_5                    &
+                         +     3.0_wp * ibit22 * adv_mom_3                    &
+                         +              ibit21 * adv_mom_1                    &
                             ) *                                               &
-                                     ( v(k,j,i)   - v(k,j-1,i) )              &
-                     -      (  5.0 * ibit23 * adv_mom_5                       &
-                         +           ibit22 * adv_mom_3                       &
+                                        ( v(k,j,i)   - v(k,j-1,i) )           &
+                     -      (  5.0_wp * ibit23 * adv_mom_5                    &
+                         +              ibit22 * adv_mom_3                    &
                             ) *                                               &
-                                     ( v(k,j+1,i) - v(k,j-2,i) )              &
-                     +      (        ibit23 * adv_mom_5                       &
+                                        ( v(k,j+1,i) - v(k,j-2,i) )           &
+                     +      (           ibit23 * adv_mom_5                    &
                             ) *                                               &
-                                     ( v(k,j+2,i) - v(k,j-3,i) )              &
-                                                 )
+                                        ( v(k,j+2,i) - v(k,j-3,i) )           &
+                                                  )
 
           ENDDO
@@ -1471,11 +1477,11 @@
              v_comp_l       = v(k,j,i) + v(k,j-1,i) - gv
              flux_s_v(k,tn) = v_comp_l * (                                    &
-                           37.0 * ( v(k,j,i) + v(k,j-1,i)   )                 &
-                         -  8.0 * ( v(k,j+1,i) + v(k,j-2,i) )                 &
-                         +        ( v(k,j+2,i) + v(k,j-3,i) ) ) * adv_mom_5
+                           37.0_wp * ( v(k,j,i) + v(k,j-1,i)   )              &
+                         -  8.0_wp * ( v(k,j+1,i) + v(k,j-2,i) )              &
+                         +           ( v(k,j+2,i) + v(k,j-3,i) ) ) * adv_mom_5
              diss_s_v(k,tn) = - ABS( v_comp_l ) * (                           &
-                           10.0 * ( v(k,j,i) - v(k,j-1,i)   )                 &
-                         -  5.0 * ( v(k,j+1,i) - v(k,j-2,i) )                 &
-                         +        ( v(k,j+2,i) - v(k,j-3,i) ) ) * adv_mom_5
+                           10.0_wp * ( v(k,j,i) - v(k,j-1,i)   )              &
+                         -  5.0_wp * ( v(k,j+1,i) - v(k,j-2,i) )              &
+                         +           ( v(k,j+2,i) - v(k,j-3,i) ) ) * adv_mom_5
 
           ENDDO
@@ -1483,8 +1489,8 @@
        ENDIF
 
-       flux_t(0) = 0.0
-       diss_t(0) = 0.0
-       flux_d    = 0.0
-       diss_d    = 0.0
+       flux_t(0) = 0.0_wp
+       diss_t(0) = 0.0_wp
+       flux_d    = 0.0_wp
+       diss_d    = 0.0_wp
 !
 !--    Now compute the fluxes and tendency terms for the horizontal and
@@ -1497,32 +1503,32 @@
  
           u_comp    = u(k,j-1,i+1) + u(k,j,i+1) - gu
-          flux_r(k) = u_comp * (                                             &
-                     ( 37.0 * ibit20 * adv_mom_5                             &
-                  +     7.0 * ibit19 * adv_mom_3                             &
-                  +           ibit18 * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( v(k,j,i+1) + v(k,j,i)   )                 &
-              -      (  8.0 * ibit20 * adv_mom_5                             &
-                  +           ibit19 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( v(k,j,i+2) + v(k,j,i-1) )                 &
-              +      (        ibit20 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( v(k,j,i+3) + v(k,j,i-2) )                 &
+          flux_r(k) = u_comp * (                                              &
+                     ( 37.0_wp * ibit20 * adv_mom_5                           &
+                  +     7.0_wp * ibit19 * adv_mom_3                           &
+                  +              ibit18 * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( v(k,j,i+1) + v(k,j,i)   )               &
+              -      (  8.0_wp * ibit20 * adv_mom_5                           &
+                  +              ibit19 * adv_mom_3                           &
+                     ) *                                                      &
+                                    ( v(k,j,i+2) + v(k,j,i-1) )               &
+              +      (           ibit20 * adv_mom_5                           &
+                     ) *                                                      &
+                                    ( v(k,j,i+3) + v(k,j,i-2) )               &
                                )
 
-          diss_r(k) = - ABS( u_comp ) * (                                    &
-                     ( 10.0 * ibit20 * adv_mom_5                             &
-                  +     3.0 * ibit19 * adv_mom_3                             &
-                  +           ibit18 * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( v(k,j,i+1) - v(k,j,i)  )                  &
-              -      (  5.0 * ibit20 * adv_mom_5                             &
-                  +           ibit19 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( v(k,j,i+2) - v(k,j,i-1) )                 &
-              +      (        ibit20 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( v(k,j,i+3) - v(k,j,i-2) )                 &
+          diss_r(k) = - ABS( u_comp ) * (                                     &
+                     ( 10.0_wp * ibit20 * adv_mom_5                           &
+                  +     3.0_wp * ibit19 * adv_mom_3                           &
+                  +              ibit18 * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( v(k,j,i+1) - v(k,j,i)  )                &
+              -      (  5.0_wp * ibit20 * adv_mom_5                           &
+                  +              ibit19 * adv_mom_3                           &
+                     ) *                                                      &
+                                    ( v(k,j,i+2) - v(k,j,i-1) )               &
+              +      (           ibit20 * adv_mom_5                           &
+                     ) *                                                      &
+                                    ( v(k,j,i+3) - v(k,j,i-2) )               &
                                         )
 
@@ -1533,33 +1539,33 @@
 
           v_comp(k) = v(k,j+1,i) + v(k,j,i)
-          flux_n(k) = ( v_comp(k) - gv ) * (                                 &
-                     ( 37.0 * ibit23 * adv_mom_5                             &
-                  +     7.0 * ibit22 * adv_mom_3                             &
-                  +           ibit21 * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( v(k,j+1,i) + v(k,j,i)   )                 &
-              -      (  8.0 * ibit23 * adv_mom_5                             &
-                  +           ibit22 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( v(k,j+2,i) + v(k,j-1,i) )                 &
-              +      (        ibit23 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( v(k,j+3,i) + v(k,j-2,i) )                 &
-                               )
-
-          diss_n(k) = - ABS( v_comp(k) - gv ) * (                            &
-                     ( 10.0 * ibit23 * adv_mom_5                             &
-                  +     3.0 * ibit22 * adv_mom_3                             &
-                  +           ibit21 * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( v(k,j+1,i) - v(k,j,i)  )                  &
-              -      (  5.0 * ibit23 * adv_mom_5                             &
-                  +           ibit22 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( v(k,j+2,i) - v(k,j-1,i) )                 &
-              +      (        ibit23 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( v(k,j+3,i) - v(k,j-2,i) )                 &
-                                        )
+          flux_n(k) = ( v_comp(k) - gv ) * (                                  &
+                     ( 37.0_wp * ibit23 * adv_mom_5                           &
+                  +     7.0_wp * ibit22 * adv_mom_3                           &
+                  +              ibit21 * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( v(k,j+1,i) + v(k,j,i)   )               &
+              -      (  8.0_wp * ibit23 * adv_mom_5                           &
+                  +              ibit22 * adv_mom_3                           &
+                     ) *                                                      &
+                                    ( v(k,j+2,i) + v(k,j-1,i) )               &
+              +      (           ibit23 * adv_mom_5                           &
+                     ) *                                                      &
+                                    ( v(k,j+3,i) + v(k,j-2,i) )               &
+                                           )
+
+          diss_n(k) = - ABS( v_comp(k) - gv ) * (                             &
+                     ( 10.0_wp * ibit23 * adv_mom_5                           &
+                  +     3.0_wp * ibit22 * adv_mom_3                           &
+                  +              ibit21 * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( v(k,j+1,i) - v(k,j,i)   )               &
+              -      (  5.0_wp * ibit23 * adv_mom_5                           &
+                  +              ibit22 * adv_mom_3                           &
+                     ) *                                                      &
+                                    ( v(k,j+2,i) - v(k,j-1,i) )               &
+              +      (           ibit23 * adv_mom_5                           &
+                     ) *                                                      &
+                                    ( v(k,j+3,i) - v(k,j-2,i) )               &
+                                                )
 !
 !--       k index has to be modified near bottom and top, else array
@@ -1574,32 +1580,32 @@
 
           w_comp    = w(k,j-1,i) + w(k,j,i)
-          flux_t(k) = w_comp  * (                                            &
-                     ( 37.0 * ibit26 * adv_mom_5                             &
-                  +     7.0 * ibit25 * adv_mom_3                             &
-                  +           ibit24 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( v(k+1,j,i)   + v(k,j,i)    )                  &
-              -      (  8.0 * ibit26 * adv_mom_5                             &
-                  +           ibit25 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( v(k_pp,j,i)  + v(k-1,j,i)  )                  &
-              +      (        ibit26 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( v(k_ppp,j,i) + v(k_mm,j,i) )                  &
+          flux_t(k) = w_comp  * (                                             &
+                     ( 37.0_wp * ibit26 * adv_mom_5                           &
+                  +     7.0_wp * ibit25 * adv_mom_3                           &
+                  +              ibit24 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( v(k+1,j,i)   + v(k,j,i)    )                &
+              -      (  8.0_wp * ibit26 * adv_mom_5                           &
+                  +              ibit25 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( v(k_pp,j,i)  + v(k-1,j,i)  )                &
+              +      (           ibit26 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( v(k_ppp,j,i) + v(k_mm,j,i) )                &
                                  )
 
-          diss_t(k) = - ABS( w_comp ) * (                                    &
-                     ( 10.0 * ibit26 * adv_mom_5                             &
-                  +     3.0 * ibit25 * adv_mom_3                             &
-                  +           ibit24 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( v(k+1,j,i)   - v(k,j,i)    )                  &
-              -      (  5.0 * ibit26 * adv_mom_5                             &
-                  +           ibit25 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( v(k_pp,j,i)  - v(k-1,j,i)  )                  &
-              +      (        ibit26 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( v(k_ppp,j,i) - v(k_mm,j,i) )                  &
+          diss_t(k) = - ABS( w_comp ) * (                                     &
+                     ( 10.0_wp * ibit26 * adv_mom_5                           &
+                  +     3.0_wp * ibit25 * adv_mom_3                           &
+                  +              ibit24 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( v(k+1,j,i)   - v(k,j,i)    )                &
+              -      (  5.0_wp * ibit26 * adv_mom_5                           &
+                  +              ibit25 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( v(k_pp,j,i)  - v(k-1,j,i)  )                &
+              +      (           ibit26 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( v(k_ppp,j,i) - v(k_mm,j,i) )                &
                                          )
 !
@@ -1607,8 +1613,8 @@
 !--       correction is needed to overcome numerical instabilities introduced
 !--       by a not sufficient reduction of divergences near topography. 
-          div = ( ( u_comp + gu - ( u(k,j-1,i)   + u(k,j,i)   ) ) * ddx      &
-               +  ( v_comp(k)   - ( v(k,j,i)     + v(k,j-1,i) ) ) * ddy      &
-               +  ( w_comp      - ( w(k-1,j-1,i) + w(k-1,j,i) ) ) * ddzw(k)  &
-                ) * 0.5
+          div = ( ( u_comp + gu - ( u(k,j-1,i)   + u(k,j,i)   ) ) * ddx       &
+               +  ( v_comp(k)   - ( v(k,j,i)     + v(k,j-1,i) ) ) * ddy       &
+               +  ( w_comp      - ( w(k-1,j-1,i) + w(k-1,j,i) ) ) * ddzw(k)   &
+                ) * 0.5_wp
 
           tend(k,j,i) = tend(k,j,i) - (                                       &
@@ -1633,8 +1639,8 @@
            sums_vs2_ws_l(k,tn) = sums_vs2_ws_l(k,tn)                          &
              + ( flux_n(k)                                                    &
-             * ( v_comp(k) - 2.0 * hom(k,1,2,0) )                             &
-             / ( v_comp(k) - gv + 1.0E-20_wp )                                &
+             * ( v_comp(k) - 2.0_wp * hom(k,1,2,0)      )                     &
+             / ( v_comp(k) - gv + 1.0E-20_wp       )                          &
              +   diss_n(k)                                                    &
-             *   ABS( v_comp(k) - 2.0 * hom(k,1,2,0) )                        &
+             *   ABS( v_comp(k) - 2.0_wp * hom(k,1,2,0) )                     &
              / ( ABS( v_comp(k) - gv ) +1.0E-20_wp ) )                        &
              *   weight_substep(intermediate_timestep_count)
@@ -1650,25 +1656,25 @@
 
           u_comp    = u(k,j-1,i+1) + u(k,j,i+1) - gu
-          flux_r(k) = u_comp * (                                           &
-                      37.0 * ( v(k,j,i+1) + v(k,j,i)   )                   &
-                    -  8.0 * ( v(k,j,i+2) + v(k,j,i-1) )                   &
-                    +        ( v(k,j,i+3) + v(k,j,i-2) ) ) * adv_mom_5
-
-          diss_r(k) = - ABS( u_comp ) * (                                  &
-                      10.0 * ( v(k,j,i+1) - v(k,j,i) )                     &
-                    -  5.0 * ( v(k,j,i+2) - v(k,j,i-1) )                   &
-                    +        ( v(k,j,i+3) - v(k,j,i-2) ) ) * adv_mom_5
+          flux_r(k) = u_comp * (                                              &
+                      37.0_wp * ( v(k,j,i+1) + v(k,j,i)   )                   &
+                    -  8.0_wp * ( v(k,j,i+2) + v(k,j,i-1) )                   &
+                    +           ( v(k,j,i+3) + v(k,j,i-2) ) ) * adv_mom_5
+
+          diss_r(k) = - ABS( u_comp ) * (                                     &
+                      10.0_wp * ( v(k,j,i+1) - v(k,j,i) )                     &
+                    -  5.0_wp * ( v(k,j,i+2) - v(k,j,i-1) )                   &
+                    +           ( v(k,j,i+3) - v(k,j,i-2) ) ) * adv_mom_5
 
 
           v_comp(k) = v(k,j+1,i) + v(k,j,i)
-          flux_n(k) = ( v_comp(k) - gv ) * (                               &
-                      37.0 * ( v(k,j+1,i) + v(k,j,i)   )                   &
-                    -  8.0 * ( v(k,j+2,i) + v(k,j-1,i) )                   &
-                      +      ( v(k,j+3,i) + v(k,j-2,i) ) ) * adv_mom_5
-
-          diss_n(k) = - ABS( v_comp(k) - gv ) * (                          &
-                      10.0 * ( v(k,j+1,i) - v(k,j,i)   )                   &
-                    -  5.0 * ( v(k,j+2,i) - v(k,j-1,i) )                   &
-                    +        ( v(k,j+3,i) - v(k,j-2,i) ) ) * adv_mom_5
+          flux_n(k) = ( v_comp(k) - gv ) * (                                  &
+                      37.0_wp * ( v(k,j+1,i) + v(k,j,i)   )                   &
+                    -  8.0_wp * ( v(k,j+2,i) + v(k,j-1,i) )                   &
+                      +         ( v(k,j+3,i) + v(k,j-2,i) ) ) * adv_mom_5
+
+          diss_n(k) = - ABS( v_comp(k) - gv ) * (                             &
+                      10.0_wp * ( v(k,j+1,i) - v(k,j,i)   )                   &
+                    -  5.0_wp * ( v(k,j+2,i) - v(k,j-1,i) )                   &
+                    +           ( v(k,j+3,i) - v(k,j-2,i) ) ) * adv_mom_5
 !
 !--       k index has to be modified near bottom and top, else array
@@ -1683,32 +1689,32 @@
 
           w_comp    = w(k,j-1,i) + w(k,j,i)
-          flux_t(k) = w_comp  * (                                            &
-                     ( 37.0 * ibit26 * adv_mom_5                             &
-                  +     7.0 * ibit25 * adv_mom_3                             &
-                  +           ibit24 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( v(k+1,j,i)   + v(k,j,i)    )                  &
-              -      (  8.0 * ibit26 * adv_mom_5                             &
-                  +           ibit25 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( v(k_pp,j,i)  + v(k-1,j,i)  )                  &
-              +      (        ibit26 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( v(k_ppp,j,i) + v(k_mm,j,i) )                  &
+          flux_t(k) = w_comp  * (                                             &
+                     ( 37.0_wp * ibit26 * adv_mom_5                           &
+                  +     7.0_wp * ibit25 * adv_mom_3                           &
+                  +              ibit24 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( v(k+1,j,i)   + v(k,j,i)    )                &
+              -      (  8.0_wp * ibit26 * adv_mom_5                           &
+                  +              ibit25 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( v(k_pp,j,i)  + v(k-1,j,i)  )                &
+              +      (           ibit26 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( v(k_ppp,j,i) + v(k_mm,j,i) )                &
                                  )
 
-          diss_t(k) = - ABS( w_comp ) * (                                    &
-                     ( 10.0 * ibit26 * adv_mom_5                             &
-                  +     3.0 * ibit25 * adv_mom_3                             &
-                  +           ibit24 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( v(k+1,j,i)   - v(k,j,i)    )                  &
-              -      (  5.0 * ibit26 * adv_mom_5                             &
-                  +           ibit25 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( v(k_pp,j,i)  - v(k-1,j,i)  )                  &
-              +      (        ibit26 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( v(k_ppp,j,i) - v(k_mm,j,i) )                  &
+          diss_t(k) = - ABS( w_comp ) * (                                     &
+                     ( 10.0_wp * ibit26 * adv_mom_5                           &
+                  +     3.0_wp * ibit25 * adv_mom_3                           &
+                  +              ibit24 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( v(k+1,j,i)   - v(k,j,i)    )                &
+              -      (  5.0_wp * ibit26 * adv_mom_5                           &
+                  +              ibit25 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( v(k_pp,j,i)  - v(k-1,j,i)  )                &
+              +      (           ibit26 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( v(k_ppp,j,i) - v(k_mm,j,i) )                &
                                          )
 !
@@ -1716,8 +1722,8 @@
 !--       correction is needed to overcome numerical instabilities introduced
 !--       by a not sufficient reduction of divergences near topography.
-          div = ( ( u_comp + gu - ( u(k,j-1,i)   + u(k,j,i)   ) ) * ddx      &
-               +  ( v_comp(k)   - ( v(k,j,i)     + v(k,j-1,i) ) ) * ddy      &
-               +  ( w_comp      - ( w(k-1,j-1,i) + w(k-1,j,i) ) ) * ddzw(k)  &
-                ) * 0.5
+          div = ( ( u_comp + gu - ( u(k,j-1,i)   + u(k,j,i)   ) ) * ddx       &
+               +  ( v_comp(k)   - ( v(k,j,i)     + v(k,j-1,i) ) ) * ddy       &
+               +  ( w_comp      - ( w(k-1,j-1,i) + w(k-1,j,i) ) ) * ddzw(k)   &
+                ) * 0.5_wp
 
           tend(k,j,i) = tend(k,j,i) - (                                       &
@@ -1742,14 +1748,14 @@
            sums_vs2_ws_l(k,tn) = sums_vs2_ws_l(k,tn)                          &
              + ( flux_n(k)                                                    &
-             * ( v_comp(k) - 2.0 * hom(k,1,2,0) )                             &
-             / ( v_comp(k) - gv + 1.0E-20_wp )                                &
+             * ( v_comp(k) - 2.0_wp * hom(k,1,2,0)      )                     &
+             / ( v_comp(k) - gv + 1.0E-20_wp       )                          &
              +   diss_n(k)                                                    &
-             *   ABS( v_comp(k) - 2.0 * hom(k,1,2,0) )                        &
+             *   ABS( v_comp(k) - 2.0_wp * hom(k,1,2,0) )                     &
              / ( ABS( v_comp(k) - gv ) +1.0E-20_wp ) )                        &
              *   weight_substep(intermediate_timestep_count)
 !
 !--        Statistical Evaluation of w'v'.
-           sums_wsvs_ws_l(k,tn) = sums_wsvs_ws_l(k,tn)                         &
-                              + ( flux_t(k) + diss_t(k) )                      &
+           sums_wsvs_ws_l(k,tn) = sums_wsvs_ws_l(k,tn)                        &
+                              + ( flux_t(k) + diss_t(k) )                     &
                               *   weight_substep(intermediate_timestep_count)
 
@@ -1767,23 +1773,23 @@
     SUBROUTINE advec_w_ws_ij( i, j, i_omp, tn )
 
-       USE arrays_3d,                                                          &
+       USE arrays_3d,                                                         &
            ONLY:  ddzu, diss_l_w, diss_s_w, flux_l_w, flux_s_w, tend, u, v, w
 
-       USE constants,                                                          &
+       USE constants,                                                         &
            ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
 
-       USE control_parameters,                                                 &
+       USE control_parameters,                                                &
            ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
 
-       USE grid_variables,                                                     &
+       USE grid_variables,                                                    &
            ONLY:  ddx, ddy
 
-       USE indices,                                                            &
-           ONLY:  nxl, nxr, nyn, nys, nzb, nzb_max, nzt, wall_flags_0,         &
+       USE indices,                                                           &
+           ONLY:  nxl, nxr, nyn, nys, nzb, nzb_max, nzt, wall_flags_0,        &
                   wall_flags_00
 
        USE kinds
        
-       USE statistics,                                                         &
+       USE statistics,                                                        &
            ONLY:  hom, sums_ws2_ws_l, weight_substep
 
@@ -1824,6 +1830,6 @@
        REAL(wp), DIMENSION(nzb:nzt+1)  ::  flux_t !:
 
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
 
 !
@@ -1838,32 +1844,32 @@
              v_comp         = v(k+1,j,i) + v(k,j,i) - gv
              flux_s_w(k,tn) = v_comp * (                                      &
-                            ( 37.0 * ibit32 * adv_mom_5                       &
-                         +     7.0 * ibit31 * adv_mom_3                       &
-                         +           ibit30 * adv_mom_1                       &
+                            ( 37.0_wp * ibit32 * adv_mom_5                    &
+                         +     7.0_wp * ibit31 * adv_mom_3                    &
+                         +              ibit30 * adv_mom_1                    &
                             ) *                                               &
-                                     ( w(k,j,i)   + w(k,j-1,i) )              &
-                     -      (  8.0 * ibit32 * adv_mom_5                       &
-                         +           ibit31 * adv_mom_3                       &
+                                        ( w(k,j,i)   + w(k,j-1,i) )           &
+                     -      (  8.0_wp * ibit32 * adv_mom_5                    &
+                         +              ibit31 * adv_mom_3                    &
                             ) *                                               &
-                                     ( w(k,j+1,i) + w(k,j-2,i) )              &
-                     +      (        ibit32 * adv_mom_5                       &
+                                        ( w(k,j+1,i) + w(k,j-2,i) )           &
+                     +      (           ibit32 * adv_mom_5                    &
                             ) *                                               &
-                                     ( w(k,j+2,i) + w(k,j-3,i) )              &
-                                         )
+                                        ( w(k,j+2,i) + w(k,j-3,i) )           &
+                                       )
 
              diss_s_w(k,tn) = - ABS( v_comp ) * (                             &
-                            ( 10.0 * ibit32 * adv_mom_5                       &
-                         +     3.0 * ibit31 * adv_mom_3                       &
-                         +           ibit30 * adv_mom_1                       &
+                            ( 10.0_wp * ibit32 * adv_mom_5                    &
+                         +     3.0_wp * ibit31 * adv_mom_3                    &
+                         +              ibit30 * adv_mom_1                    &
                             ) *                                               &
-                                     ( w(k,j,i)   - w(k,j-1,i) )              &
-                     -      (  5.0 * ibit32 * adv_mom_5                       &
-                         +           ibit31 * adv_mom_3                       &
+                                        ( w(k,j,i)   - w(k,j-1,i) )           &
+                     -      (  5.0_wp * ibit32 * adv_mom_5                    &
+                         +              ibit31 * adv_mom_3                    &
                             ) *                                               &
-                                     ( w(k,j+1,i) - w(k,j-2,i) )              &
-                     +      (        ibit32 * adv_mom_5                       &
+                                        ( w(k,j+1,i) - w(k,j-2,i) )           &
+                     +      (           ibit32 * adv_mom_5                    &
                             ) *                                               &
-                                     ( w(k,j+2,i) - w(k,j-3,i) )              &
-                                                 )
+                                        ( w(k,j+2,i) - w(k,j-3,i) )           &
+                                                )
 
           ENDDO
@@ -1873,11 +1879,11 @@
              v_comp         = v(k+1,j,i) + v(k,j,i) - gv
              flux_s_w(k,tn) = v_comp * (                                      &
-                           37.0 * ( w(k,j,i) + w(k,j-1,i)   )                 &
-                         -  8.0 * ( w(k,j+1,i) +w(k,j-2,i)  )                 &
-                         +        ( w(k,j+2,i) + w(k,j-3,i) ) ) * adv_mom_5
+                           37.0_wp * ( w(k,j,i) + w(k,j-1,i)   )              &
+                         -  8.0_wp * ( w(k,j+1,i) +w(k,j-2,i)  )              &
+                         +           ( w(k,j+2,i) + w(k,j-3,i) ) ) * adv_mom_5
              diss_s_w(k,tn) = - ABS( v_comp ) * (                             &
-                           10.0 * ( w(k,j,i) - w(k,j-1,i)   )                 &
-                         -  5.0 * ( w(k,j+1,i) - w(k,j-2,i) )                 &
-                         +        ( w(k,j+2,i) - w(k,j-3,i) ) ) * adv_mom_5
+                           10.0_wp * ( w(k,j,i) - w(k,j-1,i)   )              &
+                         -  5.0_wp * ( w(k,j+1,i) - w(k,j-2,i) )              &
+                         +           ( w(k,j+2,i) - w(k,j-3,i) ) ) * adv_mom_5
 
           ENDDO
@@ -1895,32 +1901,32 @@
 
              u_comp           = u(k+1,j,i) + u(k,j,i) - gu
-             flux_l_w(k,j,tn) = u_comp * (                                     &
-                             ( 37.0 * ibit29 * adv_mom_5                       &
-                          +     7.0 * ibit28 * adv_mom_3                       &
-                          +           ibit27 * adv_mom_1                       &
-                             ) *                                               &
-                                     ( w(k,j,i)   + w(k,j,i-1) )               &
-                      -      (  8.0 * ibit29 * adv_mom_5                       &
-                          +           ibit28 * adv_mom_3                       &
-                             ) *                                               &
-                                     ( w(k,j,i+1) + w(k,j,i-2) )               &
-                      +      (        ibit29 * adv_mom_5                       &
-                             ) *                                               &
-                                     ( w(k,j,i+2) + w(k,j,i-3) )               &
+             flux_l_w(k,j,tn) = u_comp * (                                    &
+                             ( 37.0_wp * ibit29 * adv_mom_5                   &
+                          +     7.0_wp * ibit28 * adv_mom_3                   &
+                          +              ibit27 * adv_mom_1                   &
+                             ) *                                              &
+                                        ( w(k,j,i)   + w(k,j,i-1) )           &
+                      -      (  8.0_wp * ibit29 * adv_mom_5                   &
+                          +              ibit28 * adv_mom_3                   &
+                             ) *                                              &
+                                        ( w(k,j,i+1) + w(k,j,i-2) )           &
+                      +      (           ibit29 * adv_mom_5                   &
+                             ) *                                              &
+                                        ( w(k,j,i+2) + w(k,j,i-3) )           &
                                          )
 
-               diss_l_w(k,j,tn) = - ABS( u_comp ) * (                          &
-                             ( 10.0 * ibit29 * adv_mom_5                       &
-                          +     3.0 * ibit28 * adv_mom_3                       &
-                          +           ibit27 * adv_mom_1                       &
-                             ) *                                               &
-                                     ( w(k,j,i)   - w(k,j,i-1) )               &
-                      -      (  5.0 * ibit29 * adv_mom_5                       &
-                          +           ibit28 * adv_mom_3                       &
-                             ) *                                               &
-                                     ( w(k,j,i+1) - w(k,j,i-2) )               &
-                      +      (        ibit29 * adv_mom_5                       &
-                             ) *                                               &
-                                     ( w(k,j,i+2) - w(k,j,i-3) )               &
+               diss_l_w(k,j,tn) = - ABS( u_comp ) * (                         &
+                             ( 10.0_wp * ibit29 * adv_mom_5                   &
+                          +     3.0_wp * ibit28 * adv_mom_3                   &
+                          +              ibit27 * adv_mom_1                   &
+                             ) *                                              &
+                                        ( w(k,j,i)   - w(k,j,i-1) )           &
+                      -      (  5.0_wp * ibit29 * adv_mom_5                   &
+                          +              ibit28 * adv_mom_3                   &
+                             ) *                                              &
+                                        ( w(k,j,i+1) - w(k,j,i-2) )           &
+                      +      (           ibit29 * adv_mom_5                   &
+                             ) *                                              &
+                                        ( w(k,j,i+2) - w(k,j,i-3) )           &
                                                     )
 
@@ -1931,11 +1937,11 @@
              u_comp           = u(k+1,j,i) + u(k,j,i) - gu
              flux_l_w(k,j,tn) = u_comp * (                                    &
-                            37.0 * ( w(k,j,i) + w(k,j,i-1)   )                &
-                          -  8.0 * ( w(k,j,i+1) + w(k,j,i-2) )                &
-                          +        ( w(k,j,i+2) + w(k,j,i-3) ) ) * adv_mom_5
+                            37.0_wp * ( w(k,j,i) + w(k,j,i-1)   )             &
+                          -  8.0_wp * ( w(k,j,i+1) + w(k,j,i-2) )             &
+                          +           ( w(k,j,i+2) + w(k,j,i-3) ) ) * adv_mom_5
              diss_l_w(k,j,tn) = - ABS( u_comp ) * (                           &
-                            10.0 * ( w(k,j,i) - w(k,j,i-1)   )                &
-                          -  5.0 * ( w(k,j,i+1) - w(k,j,i-2) )                &
-                          +        ( w(k,j,i+2) - w(k,j,i-3) ) ) * adv_mom_5 
+                            10.0_wp * ( w(k,j,i) - w(k,j,i-1)   )             &
+                          -  5.0_wp * ( w(k,j,i+1) - w(k,j,i-2) )             &
+                          +           ( w(k,j,i+2) - w(k,j,i-3) ) ) * adv_mom_5 
 
           ENDDO
@@ -1962,32 +1968,32 @@
 
           u_comp    = u(k+1,j,i+1) + u(k,j,i+1) - gu
-          flux_r(k) = u_comp * (                                             &
-                     ( 37.0 * ibit29 * adv_mom_5                             &
-                  +     7.0 * ibit28 * adv_mom_3                             &
-                  +           ibit27 * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( w(k,j,i+1) + w(k,j,i)   )                 &
-              -      (  8.0 * ibit29 * adv_mom_5                             &
-                  +           ibit28 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( w(k,j,i+2) + w(k,j,i-1) )                 &
-              +      (        ibit29 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( w(k,j,i+3) + w(k,j,i-2) )                 &
-                                )
-
-          diss_r(k) = - ABS( u_comp ) * (                                    &
-                     ( 10.0 * ibit29 * adv_mom_5                             &
-                  +     3.0 * ibit28 * adv_mom_3                             &
-                  +           ibit27 * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( w(k,j,i+1) - w(k,j,i)  )                  &
-              -      (  5.0 * ibit29 * adv_mom_5                             &
-                  +           ibit28 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( w(k,j,i+2) - w(k,j,i-1) )                 &
-              +      (        ibit29 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( w(k,j,i+3) - w(k,j,i-2) )                 &
+          flux_r(k) = u_comp * (                                              &
+                     ( 37.0_wp * ibit29 * adv_mom_5                           &
+                  +     7.0_wp * ibit28 * adv_mom_3                           &
+                  +              ibit27 * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( w(k,j,i+1) + w(k,j,i)   )               &
+              -      (  8.0_wp * ibit29 * adv_mom_5                           &
+                  +              ibit28 * adv_mom_3                           &
+                     ) *                                                      &
+                                    ( w(k,j,i+2) + w(k,j,i-1) )               &
+              +      (           ibit29 * adv_mom_5                           &
+                     ) *                                                      &
+                                    ( w(k,j,i+3) + w(k,j,i-2) )               &
+                               )
+
+          diss_r(k) = - ABS( u_comp ) * (                                     &
+                     ( 10.0_wp * ibit29 * adv_mom_5                           &
+                  +     3.0_wp * ibit28 * adv_mom_3                           &
+                  +              ibit27 * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( w(k,j,i+1) - w(k,j,i)   )               &
+              -      (  5.0_wp * ibit29 * adv_mom_5                           &
+                  +              ibit28 * adv_mom_3                           &
+                     ) *                                                      &
+                                    ( w(k,j,i+2) - w(k,j,i-1) )               &
+              +      (           ibit29 * adv_mom_5                           &
+                     ) *                                                      &
+                                    ( w(k,j,i+3) - w(k,j,i-2) )               &
                                         )
 
@@ -1997,32 +2003,32 @@
 
           v_comp    = v(k+1,j+1,i) + v(k,j+1,i) - gv
-          flux_n(k) = v_comp * (                                             &
-                     ( 37.0 * ibit32 * adv_mom_5                             &
-                  +     7.0 * ibit31 * adv_mom_3                             &
-                  +           ibit30 * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( w(k,j+1,i) + w(k,j,i)   )                 &
-              -      (  8.0 * ibit32 * adv_mom_5                             &
-                  +           ibit31 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( w(k,j+2,i) + w(k,j-1,i) )                 &
-              +      (        ibit32 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( w(k,j+3,i) + w(k,j-2,i) )                 &
+          flux_n(k) = v_comp * (                                              &
+                     ( 37.0_wp * ibit32 * adv_mom_5                           &
+                  +     7.0_wp * ibit31 * adv_mom_3                           &
+                  +              ibit30 * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( w(k,j+1,i) + w(k,j,i)   )               &
+              -      (  8.0_wp * ibit32 * adv_mom_5                           &
+                  +              ibit31 * adv_mom_3                           &
+                     ) *                                                      &
+                                    ( w(k,j+2,i) + w(k,j-1,i) )               &
+              +      (           ibit32 * adv_mom_5                           &
+                     ) *                                                      &
+                                    ( w(k,j+3,i) + w(k,j-2,i) )               &
                                )
 
-          diss_n(k) = - ABS( v_comp ) * (                                    &
-                     ( 10.0 * ibit32 * adv_mom_5                             &
-                  +     3.0 * ibit31 * adv_mom_3                             &
-                  +           ibit30 * adv_mom_1                             &
-                     ) *                                                     &
-                                 ( w(k,j+1,i) - w(k,j,i)  )                  &
-              -      (  5.0 * ibit32 * adv_mom_5                             &
-                  +           ibit31 * adv_mom_3                             &
-                     ) *                                                     &
-                                 ( w(k,j+2,i) - w(k,j-1,i) )                 &
-              +      (        ibit32 * adv_mom_5                             &
-                     ) *                                                     &
-                                 ( w(k,j+3,i) - w(k,j-2,i) )                 &
+          diss_n(k) = - ABS( v_comp ) * (                                     &
+                     ( 10.0_wp * ibit32 * adv_mom_5                           &
+                  +     3.0_wp * ibit31 * adv_mom_3                           &
+                  +              ibit30 * adv_mom_1                           &
+                     ) *                                                      &
+                                    ( w(k,j+1,i) - w(k,j,i)  )                &
+              -      (  5.0_wp * ibit32 * adv_mom_5                           &
+                  +              ibit31 * adv_mom_3                           &
+                     ) *                                                      &
+                                   ( w(k,j+2,i) - w(k,j-1,i) )                &
+              +      (           ibit32 * adv_mom_5                           &
+                     ) *                                                      &
+                                   ( w(k,j+3,i) - w(k,j-2,i) )                &
                                         )
 !
@@ -2038,33 +2044,33 @@
 
           w_comp    = w(k+1,j,i) + w(k,j,i)
-          flux_t(k) = w_comp  * (                                            &
-                     ( 37.0 * ibit35 * adv_mom_5                             &
-                  +     7.0 * ibit34 * adv_mom_3                             &
-                  +           ibit33 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( w(k+1,j,i)  + w(k,j,i)     )                  &
-              -      (  8.0 * ibit35 * adv_mom_5                             &
-                  +           ibit34 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( w(k_pp,j,i)  + w(k-1,j,i)  )                  &
-              +      (        ibit35 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( w(k_ppp,j,i) + w(k_mm,j,i) )                  &
-                                 )
-
-          diss_t(k) = - ABS( w_comp ) * (                                    &
-                     ( 10.0 * ibit35 * adv_mom_5                             &
-                  +     3.0 * ibit34 * adv_mom_3                             &
-                  +           ibit33 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( w(k+1,j,i)   - w(k,j,i)    )                  &
-              -      (  5.0 * ibit35 * adv_mom_5                             &
-                  +           ibit34 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( w(k_pp,j,i)  - w(k-1,j,i)  )                  &
-              +      (        ibit35 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( w(k_ppp,j,i) - w(k_mm,j,i) )                  &
-                                         )
+          flux_t(k) = w_comp  * (                                             &
+                     ( 37.0_wp * ibit35 * adv_mom_5                           &
+                  +     7.0_wp * ibit34 * adv_mom_3                           &
+                  +              ibit33 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( w(k+1,j,i)  + w(k,j,i)     )                &
+              -      (  8.0_wp * ibit35 * adv_mom_5                           &
+                  +              ibit34 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( w(k_pp,j,i)  + w(k-1,j,i)  )                &
+              +      (           ibit35 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( w(k_ppp,j,i) + w(k_mm,j,i) )                &
+                                )
+
+          diss_t(k) = - ABS( w_comp ) * (                                     &
+                     ( 10.0_wp * ibit35 * adv_mom_5                           &
+                  +     3.0_wp * ibit34 * adv_mom_3                           &
+                  +              ibit33 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( w(k+1,j,i)   - w(k,j,i)    )                &
+              -      (  5.0_wp * ibit35 * adv_mom_5                           &
+                  +              ibit34 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( w(k_pp,j,i)  - w(k-1,j,i)  )                &
+              +      (           ibit35 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( w(k_ppp,j,i) - w(k_mm,j,i) )                &
+                                        )
 
 !
@@ -2075,5 +2081,5 @@
               +   ( v_comp + gv - ( v(k+1,j,i) + v(k,j,i)   ) ) * ddy         &
               +   ( w_comp      - ( w(k,j,i)   + w(k-1,j,i) ) ) * ddzu(k+1)   &
-                ) * 0.5
+                ) * 0.5_wp
 
           tend(k,j,i) = tend(k,j,i) - (                                       &
@@ -2094,6 +2100,6 @@
 !
 !--        Statistical Evaluation of w'w'.
-          sums_ws2_ws_l(k,tn)  = sums_ws2_ws_l(k,tn)                         &
-                             + ( flux_t(k) + diss_t(k) )                     &
+          sums_ws2_ws_l(k,tn)  = sums_ws2_ws_l(k,tn)                          &
+                             + ( flux_t(k) + diss_t(k) )                      &
                              *   weight_substep(intermediate_timestep_count)
 
@@ -2103,24 +2109,24 @@
 
           u_comp    = u(k+1,j,i+1) + u(k,j,i+1) - gu
-          flux_r(k) = u_comp * (                                            &
-                      37.0 * ( w(k,j,i+1) + w(k,j,i)   )                    &
-                    -  8.0 * ( w(k,j,i+2) + w(k,j,i-1) )                    &
-                    +        ( w(k,j,i+3) + w(k,j,i-2) ) ) * adv_mom_5
-
-          diss_r(k) = - ABS( u_comp ) * (                                   &
-                      10.0 * ( w(k,j,i+1) - w(k,j,i)   )                    &
-                    -  5.0 * ( w(k,j,i+2) - w(k,j,i-1) )                    &
-                    +        ( w(k,j,i+3) - w(k,j,i-2) ) ) * adv_mom_5
+          flux_r(k) = u_comp * (                                              &
+                      37.0_wp * ( w(k,j,i+1) + w(k,j,i)   )                   &
+                    -  8.0_wp * ( w(k,j,i+2) + w(k,j,i-1) )                   &
+                    +           ( w(k,j,i+3) + w(k,j,i-2) ) ) * adv_mom_5
+
+          diss_r(k) = - ABS( u_comp ) * (                                     &
+                      10.0_wp * ( w(k,j,i+1) - w(k,j,i)   )                   &
+                    -  5.0_wp * ( w(k,j,i+2) - w(k,j,i-1) )                   &
+                    +           ( w(k,j,i+3) - w(k,j,i-2) ) ) * adv_mom_5
 
           v_comp    = v(k+1,j+1,i) + v(k,j+1,i) - gv
-          flux_n(k) = v_comp * (                                            &
-                      37.0 * ( w(k,j+1,i) + w(k,j,i)   )                    &
-                    -  8.0 * ( w(k,j+2,i) + w(k,j-1,i) )                    &
-                    +        ( w(k,j+3,i) + w(k,j-2,i) ) ) * adv_mom_5
-
-          diss_n(k) = - ABS( v_comp ) * (                                   &
-                      10.0 * ( w(k,j+1,i) - w(k,j,i)   )                    &
-                    -  5.0 * ( w(k,j+2,i) - w(k,j-1,i) )                    &
-                    +        ( w(k,j+3,i) - w(k,j-2,i) ) ) * adv_mom_5
+          flux_n(k) = v_comp * (                                              &
+                      37.0_wp * ( w(k,j+1,i) + w(k,j,i)   )                   &
+                    -  8.0_wp * ( w(k,j+2,i) + w(k,j-1,i) )                   &
+                    +           ( w(k,j+3,i) + w(k,j-2,i) ) ) * adv_mom_5
+
+          diss_n(k) = - ABS( v_comp ) * (                                     &
+                      10.0_wp * ( w(k,j+1,i) - w(k,j,i)   )                   &
+                    -  5.0_wp * ( w(k,j+2,i) - w(k,j-1,i) )                   &
+                    +           ( w(k,j+3,i) - w(k,j-2,i) ) ) * adv_mom_5
 !
 !--       k index has to be modified near bottom and top, else array
@@ -2135,33 +2141,33 @@
 
           w_comp    = w(k+1,j,i) + w(k,j,i)
-          flux_t(k) = w_comp  * (                                            &
-                     ( 37.0 * ibit35 * adv_mom_5                             &
-                  +     7.0 * ibit34 * adv_mom_3                             &
-                  +           ibit33 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( w(k+1,j,i)  + w(k,j,i)     )                  &
-              -      (  8.0 * ibit35 * adv_mom_5                             &
-                  +           ibit34 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( w(k_pp,j,i)  + w(k-1,j,i)  )                  &
-              +      (        ibit35 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( w(k_ppp,j,i) + w(k_mm,j,i) )                  &
-                                 )
-
-          diss_t(k) = - ABS( w_comp ) * (                                    &
-                     ( 10.0 * ibit35 * adv_mom_5                             &
-                  +     3.0 * ibit34 * adv_mom_3                             &
-                  +           ibit33 * adv_mom_1                             &
-                     ) *                                                     &
-                             ( w(k+1,j,i)   - w(k,j,i)    )                  &
-              -      (  5.0 * ibit35 * adv_mom_5                             &
-                  +           ibit34 * adv_mom_3                             &
-                     ) *                                                     &
-                             ( w(k_pp,j,i)  - w(k-1,j,i)  )                  &
-              +      (        ibit35 * adv_mom_5                             &
-                     ) *                                                     &
-                             ( w(k_ppp,j,i) - w(k_mm,j,i) )                  &
-                                         )
+          flux_t(k) = w_comp  * (                                             &
+                     ( 37.0_wp * ibit35 * adv_mom_5                           &
+                  +     7.0_wp * ibit34 * adv_mom_3                           &
+                  +              ibit33 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( w(k+1,j,i)  + w(k,j,i)     )                &
+              -      (  8.0_wp * ibit35 * adv_mom_5                           &
+                  +              ibit34 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( w(k_pp,j,i)  + w(k-1,j,i)  )                &
+              +      (           ibit35 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( w(k_ppp,j,i) + w(k_mm,j,i) )                &
+                                )
+
+          diss_t(k) = - ABS( w_comp ) * (                                     &
+                     ( 10.0_wp * ibit35 * adv_mom_5                           &
+                  +     3.0_wp * ibit34 * adv_mom_3                           &
+                  +              ibit33 * adv_mom_1                           &
+                     ) *                                                      &
+                                ( w(k+1,j,i)   - w(k,j,i)    )                &
+              -      (  5.0_wp * ibit35 * adv_mom_5                           &
+                  +              ibit34 * adv_mom_3                           &
+                     ) *                                                      &
+                                ( w(k_pp,j,i)  - w(k-1,j,i)  )                &
+              +      (           ibit35 * adv_mom_5                           &
+                     ) *                                                      &
+                                ( w(k_ppp,j,i) - w(k_mm,j,i) )                &
+                                        )
 !
 !--       Calculate the divergence of the velocity field. A respective
@@ -2171,5 +2177,5 @@
               +   ( v_comp + gv - ( v(k+1,j,i) + v(k,j,i)   ) ) * ddy         &
               +   ( w_comp      - ( w(k,j,i)   + w(k-1,j,i) ) ) * ddzu(k+1)   &
-                ) * 0.5
+                ) * 0.5_wp
 
           tend(k,j,i) = tend(k,j,i) - (                                       &
@@ -2190,6 +2196,6 @@
 !
 !--        Statistical Evaluation of w'w'.
-          sums_ws2_ws_l(k,tn)  = sums_ws2_ws_l(k,tn)                         &
-                             + ( flux_t(k) + diss_t(k) )                     &
+          sums_ws2_ws_l(k,tn)  = sums_ws2_ws_l(k,tn)                          &
+                             + ( flux_t(k) + diss_t(k) )                      &
                              *   weight_substep(intermediate_timestep_count)
 
@@ -2205,23 +2211,23 @@
     SUBROUTINE advec_s_ws( sk, sk_char )
 
-       USE arrays_3d,                                                          &
+       USE arrays_3d,                                                         &
            ONLY:  ddzw, tend, u, v, w
 
-       USE constants,                                                          &
+       USE constants,                                                         &
            ONLY:  adv_sca_1, adv_sca_3, adv_sca_5
 
-       USE control_parameters,                                                 &
+       USE control_parameters,                                                &
            ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans 
 
-       USE grid_variables,                                                     &
+       USE grid_variables,                                                    &
            ONLY:  ddx, ddy
 
-       USE indices,                                                            &
+       USE indices,                                                           &
            ONLY:  nxl, nxr, nyn, nys, nzb, nzb_max, nzt, wall_flags_0
            
        USE kinds
        
-       USE statistics,                                                         &
-           ONLY:  sums_wspts_ws_l, sums_wsqs_ws_l, sums_wssas_ws_l,            &
+       USE statistics,                                                        &
+           ONLY:  sums_wspts_ws_l, sums_wsqs_ws_l, sums_wssas_ws_l,           &
                   weight_substep
 
@@ -2286,31 +2292,31 @@
              u_comp                 = u(k,j,i) - u_gtrans
              swap_flux_x_local(k,j) = u_comp * (                              &
-                                                  ( 37.0 * ibit2 * adv_sca_5  &
-                                               +     7.0 * ibit1 * adv_sca_3  &
-                                               +           ibit0 * adv_sca_1  &
-                                                  ) *                         &
-                                            ( sk(k,j,i)   + sk(k,j,i-1)    )  &
-                                           -      (  8.0 * ibit2 * adv_sca_5  &
-                                               +           ibit1 * adv_sca_3  &
-                                                  ) *                         &
-                                            ( sk(k,j,i+1) + sk(k,j,i-2)    )  &
-                                           +      (        ibit2 * adv_sca_5  &
-                                                  ) *                         &
-                                            ( sk(k,j,i+2) + sk(k,j,i-3)    )  &
+                                             ( 37.0_wp * ibit2 * adv_sca_5    &
+                                          +     7.0_wp * ibit1 * adv_sca_3    &
+                                          +              ibit0 * adv_sca_1    &
+                                             ) *                              &
+                                          ( sk(k,j,i)   + sk(k,j,i-1)    )    &
+                                      -      (  8.0_wp * ibit2 * adv_sca_5    &
+                                          +              ibit1 * adv_sca_3    &
+                                             ) *                              &
+                                          ( sk(k,j,i+1) + sk(k,j,i-2)    )    &
+                                      +      (           ibit2 * adv_sca_5    & 
+                                             ) *                              &
+                                          ( sk(k,j,i+2) + sk(k,j,i-3)    )    &
                                                )
 
               swap_diss_x_local(k,j) = -ABS( u_comp ) * (                     &
-                                                  ( 10.0 * ibit2 * adv_sca_5  &
-                                               +     3.0 * ibit1 * adv_sca_3  &
-                                               +           ibit0 * adv_sca_1  &
-                                                  ) *                         &
-                                            ( sk(k,j,i)   - sk(k,j,i-1)    )  &
-                                           -      (  5.0 * ibit2 * adv_sca_5  &
-                                               +           ibit1 * adv_sca_3  &
-                                                  ) *                         &
-                                            ( sk(k,j,i+1) - sk(k,j,i-2)  )    &
-                                           +      (        ibit2 * adv_sca_5  &
-                                                  ) *                         &
-                                            ( sk(k,j,i+2) - sk(k,j,i-3) )     &
+                                             ( 10.0_wp * ibit2 * adv_sca_5    &
+                                          +     3.0_wp * ibit1 * adv_sca_3    &
+                                          +              ibit0 * adv_sca_1    &
+                                             ) *                              &
+                                          ( sk(k,j,i)   - sk(k,j,i-1) )       &
+                                      -      (  5.0_wp * ibit2 * adv_sca_5    &
+                                          +              ibit1 * adv_sca_3    &
+                                             ) *                              &
+                                         ( sk(k,j,i+1) - sk(k,j,i-2)  )       &
+                                      +      (           ibit2 * adv_sca_5    &
+                                             ) *                              &
+                                          ( sk(k,j,i+2) - sk(k,j,i-3) )       &
                                                         )
 
@@ -2320,14 +2326,14 @@
 
              u_comp                 = u(k,j,i) - u_gtrans
-             swap_flux_x_local(k,j) = u_comp * (                             &
-                                      37.0 * ( sk(k,j,i)   + sk(k,j,i-1) )   &
-                                    -  8.0 * ( sk(k,j,i+1) + sk(k,j,i-2) )   &
-                                    +        ( sk(k,j,i+2) + sk(k,j,i-3) )   &
+             swap_flux_x_local(k,j) = u_comp * (                              &
+                                      37.0_wp * ( sk(k,j,i)   + sk(k,j,i-1) ) &
+                                    -  8.0_wp * ( sk(k,j,i+1) + sk(k,j,i-2) ) &
+                                    +           ( sk(k,j,i+2) + sk(k,j,i-3) ) &
                                                ) * adv_sca_5
 
-             swap_diss_x_local(k,j) = -ABS( u_comp ) * (                     &
-                                      10.0 * ( sk(k,j,i)   - sk(k,j,i-1) )   &
-                                    -  5.0 * ( sk(k,j,i+1) - sk(k,j,i-2) )   &
-                                    +        ( sk(k,j,i+2) - sk(k,j,i-3) )   &
+             swap_diss_x_local(k,j) = -ABS( u_comp ) * (                      &
+                                      10.0_wp * ( sk(k,j,i)   - sk(k,j,i-1) ) &
+                                    -  5.0_wp * ( sk(k,j,i+1) - sk(k,j,i-2) ) &
+                                    +           ( sk(k,j,i+2) - sk(k,j,i-3) ) &
                                                        ) * adv_sca_5
 
@@ -2347,31 +2353,31 @@
              v_comp               = v(k,j,i) - v_gtrans
              swap_flux_y_local(k) = v_comp * (                                &
-                                                  ( 37.0 * ibit5 * adv_sca_5  &
-                                               +     7.0 * ibit4 * adv_sca_3  &
-                                               +           ibit3 * adv_sca_1  &
-                                                  ) *                         &
-                                           ( sk(k,j,i)  + sk(k,j-1,i)     )   &
-                                            -     (  8.0 * ibit5 * adv_sca_5  &
-                                               +           ibit4 * adv_sca_3  &
-                                                   ) *                        &
-                                           ( sk(k,j+1,i) + sk(k,j-2,i)    )   &
-                                           +      (        ibit5 * adv_sca_5  &
-                                                  ) *                         &
-                                           ( sk(k,j+2,i) + sk(k,j-3,i)    )   &
+                                             ( 37.0_wp * ibit5 * adv_sca_5    &
+                                          +     7.0_wp * ibit4 * adv_sca_3    &
+                                          +              ibit3 * adv_sca_1    &
+                                             ) *                              &
+                                         ( sk(k,j,i)  + sk(k,j-1,i)     )     &
+                                       -     (  8.0_wp * ibit5 * adv_sca_5    &
+                                          +              ibit4 * adv_sca_3    &
+                                              ) *                             &
+                                         ( sk(k,j+1,i) + sk(k,j-2,i)    )     &
+                                      +      (           ibit5 * adv_sca_5    &
+                                             ) *                              &
+                                        ( sk(k,j+2,i) + sk(k,j-3,i)     )     &
                                              )
 
              swap_diss_y_local(k) = -ABS( v_comp ) * (                        &
-                                                  ( 10.0 * ibit5 * adv_sca_5  &
-                                               +     3.0 * ibit4 * adv_sca_3  &
-                                               +           ibit3 * adv_sca_1  &
-                                                  ) *                         &
-                                            ( sk(k,j,i)   - sk(k,j-1,i)    )  &
-                                           -      (  5.0 * ibit5 * adv_sca_5  &
-                                               +           ibit4 * adv_sca_3  &
-                                            ) *                               &
-                                            ( sk(k,j+1,i) - sk(k,j-2,i)  )    &
-                                           +      (        ibit5 * adv_sca_5  &
-                                                  ) *                         &
-                                            ( sk(k,j+2,i) - sk(k,j-3,i) )     &
+                                             ( 10.0_wp * ibit5 * adv_sca_5    &
+                                          +     3.0_wp * ibit4 * adv_sca_3    &
+                                          +              ibit3 * adv_sca_1    &
+                                             ) *                              &
+                                          ( sk(k,j,i)   - sk(k,j-1,i)    )    &
+                                      -      (  5.0_wp * ibit5 * adv_sca_5    &
+                                          +              ibit4 * adv_sca_3    &
+                                             ) *                              &
+                                          ( sk(k,j+1,i) - sk(k,j-2,i)    )    &
+                                      +      (           ibit5 * adv_sca_5    &
+                                             ) *                              &
+                                          ( sk(k,j+2,i) - sk(k,j-3,i)    )    &
                                                      )
 
@@ -2383,12 +2389,12 @@
              v_comp               = v(k,j,i) - v_gtrans
              swap_flux_y_local(k) = v_comp * (                               &
-                                    37.0 * ( sk(k,j,i)   + sk(k,j-1,i) )     &
-                                  -  8.0 * ( sk(k,j+1,i) + sk(k,j-2,i) )     &
-                                  +        ( sk(k,j+2,i) + sk(k,j-3,i) )     &
+                                    37.0_wp * ( sk(k,j,i)   + sk(k,j-1,i) )  &
+                                  -  8.0_wp * ( sk(k,j+1,i) + sk(k,j-2,i) )  &
+                                  +           ( sk(k,j+2,i) + sk(k,j-3,i) )  &
                                              ) * adv_sca_5
               swap_diss_y_local(k) = -ABS( v_comp ) * (                      &
-                                    10.0 * ( sk(k,j,i)   - sk(k,j-1,i) )     &
-                                  -  5.0 * ( sk(k,j+1,i) - sk(k,j-2,i) )     &
-                                  +          sk(k,j+2,i) - sk(k,j-3,i)       &
+                                    10.0_wp * ( sk(k,j,i)   - sk(k,j-1,i) )  &
+                                  -  5.0_wp * ( sk(k,j+1,i) - sk(k,j-2,i) )  &
+                                  +             sk(k,j+2,i) - sk(k,j-3,i)    &
                                                       ) * adv_sca_5
 
@@ -2397,8 +2403,8 @@
           DO  j = nys, nyn
 
-             flux_t(0) = 0.0
-             diss_t(0) = 0.0
-             flux_d    = 0.0
-             diss_d    = 0.0
+             flux_t(0) = 0.0_wp
+             diss_t(0) = 0.0_wp
+             flux_d    = 0.0_wp
+             diss_d    = 0.0_wp
 
              DO  k = nzb+1, nzb_max
@@ -2409,32 +2415,32 @@
 
                 u_comp    = u(k,j,i+1) - u_gtrans
-                flux_r(k) = u_comp * (                                      &
-                          ( 37.0 * ibit2 * adv_sca_5                        &
-                      +      7.0 * ibit1 * adv_sca_3                        &
-                      +           ibit0 * adv_sca_1                         &
-                          ) *                                               &
-                             ( sk(k,j,i+1) + sk(k,j,i)   )                  &
-                   -      (  8.0 * ibit2 * adv_sca_5                        &
-                       +           ibit1 * adv_sca_3                        &
-                          ) *                                               &
-                             ( sk(k,j,i+2) + sk(k,j,i-1) )                  &
-                   +      (        ibit2 * adv_sca_5                        &
-                          ) *                                               &
-                             ( sk(k,j,i+3) + sk(k,j,i-2) )                  &
+                flux_r(k) = u_comp * (                                        &
+                          ( 37.0_wp * ibit2 * adv_sca_5                       &
+                      +      7.0_wp * ibit1 * adv_sca_3                       &
+                      +               ibit0 * adv_sca_1                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+1) + sk(k,j,i)   )                    &
+                   -      (  8.0_wp * ibit2 * adv_sca_5                       &
+                       +              ibit1 * adv_sca_3                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+2) + sk(k,j,i-1) )                    &
+                   +      (           ibit2 * adv_sca_5                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+3) + sk(k,j,i-2) )                    &
                                      )
 
-                diss_r(k) = -ABS( u_comp ) * (                              &
-                          ( 10.0 * ibit2 * adv_sca_5                        &
-                       +     3.0 * ibit1 * adv_sca_3                        &
-                       +           ibit0 * adv_sca_1                        &
-                          ) *                                               &
-                             ( sk(k,j,i+1) - sk(k,j,i)  )                   &
-                   -      (  5.0 * ibit2 * adv_sca_5                        &
-                       +           ibit1 * adv_sca_3                        &
-                          ) *                                               &
-                             ( sk(k,j,i+2) - sk(k,j,i-1) )                  &
-                   +      (        ibit2 * adv_sca_5                        &
-                          ) *                                               &
-                             ( sk(k,j,i+3) - sk(k,j,i-2) )                  &
+                diss_r(k) = -ABS( u_comp ) * (                                &
+                          ( 10.0_wp * ibit2 * adv_sca_5                       &
+                       +     3.0_wp * ibit1 * adv_sca_3                       &
+                       +              ibit0 * adv_sca_1                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+1) - sk(k,j,i)   )                    &
+                   -      (  5.0_wp * ibit2 * adv_sca_5                       &
+                       +              ibit1 * adv_sca_3                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+2) - sk(k,j,i-1) )                    &
+                   +      (           ibit2 * adv_sca_5                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+3) - sk(k,j,i-2) )                    &
                                              )
 
@@ -2444,32 +2450,32 @@
 
                 v_comp    = v(k,j+1,i) - v_gtrans
-                flux_n(k) = v_comp * (                                      &
-                          ( 37.0 * ibit5 * adv_sca_5                        &
-                       +     7.0 * ibit4 * adv_sca_3                        &
-                       +           ibit3 * adv_sca_1                        &
-                          ) *                                               &
-                             ( sk(k,j+1,i) + sk(k,j,i)   )                  &
-                   -      (  8.0 * ibit5 * adv_sca_5                        &
-                       +           ibit4 * adv_sca_3                        &
-                          ) *                                               &
-                             ( sk(k,j+2,i) + sk(k,j-1,i) )                  &
-                   +      (        ibit5 * adv_sca_5                        &
-                          ) *                                               &
-                             ( sk(k,j+3,i) + sk(k,j-2,i) )                  &
+                flux_n(k) = v_comp * (                                        &
+                          ( 37.0_wp * ibit5 * adv_sca_5                       &
+                       +     7.0_wp * ibit4 * adv_sca_3                       &
+                       +              ibit3 * adv_sca_1                       &
+                          ) *                                                 &
+                             ( sk(k,j+1,i) + sk(k,j,i)   )                    &
+                   -      (  8.0_wp * ibit5 * adv_sca_5                       &
+                       +              ibit4 * adv_sca_3                       &
+                          ) *                                                 &
+                             ( sk(k,j+2,i) + sk(k,j-1,i) )                    &
+                   +      (           ibit5 * adv_sca_5                       &
+                          ) *                                                 &
+                             ( sk(k,j+3,i) + sk(k,j-2,i) )                    &
                                      )
 
-                diss_n(k) = -ABS( v_comp ) * (                              &
-                          ( 10.0 * ibit5 * adv_sca_5                        &
-                       +     3.0 * ibit4 * adv_sca_3                        &
-                       +           ibit3 * adv_sca_1                        &
-                          ) *                                               &
-                             ( sk(k,j+1,i) - sk(k,j,i)    )                 &
-                   -      (  5.0 * ibit5 * adv_sca_5                        &
-                       +           ibit4 * adv_sca_3                        &
-                          ) *                                               &
-                             ( sk(k,j+2,i) - sk(k,j-1,i)  )                 &
-                   +      (        ibit5 * adv_sca_5                        &
-                          ) *                                               &
-                             ( sk(k,j+3,i) - sk(k,j-2,i) )                  &
+                diss_n(k) = -ABS( v_comp ) * (                                &
+                          ( 10.0_wp * ibit5 * adv_sca_5                       &
+                       +     3.0_wp * ibit4 * adv_sca_3                       &
+                       +              ibit3 * adv_sca_1                       &
+                          ) *                                                 &
+                             ( sk(k,j+1,i) - sk(k,j,i)    )                   &
+                   -      (  5.0_wp * ibit5 * adv_sca_5                       &
+                       +              ibit4 * adv_sca_3                       &
+                          ) *                                                 &
+                             ( sk(k,j+2,i) - sk(k,j-1,i)  )                   &
+                   +      (           ibit5 * adv_sca_5                       &
+                          ) *                                                 &
+                             ( sk(k,j+3,i) - sk(k,j-2,i) )                    &
                                              )
 !
@@ -2486,31 +2492,31 @@
 
                 flux_t(k) = w(k,j,i) * (                                      &
-                           ( 37.0 * ibit8 * adv_sca_5                         &
-                        +     7.0 * ibit7 * adv_sca_3                         &
+                           ( 37.0_wp * ibit8 * adv_sca_5                      &
+                        +     7.0_wp * ibit7 * adv_sca_3                      &
                         +           ibit6 * adv_sca_1                         &
                            ) *                                                &
-                                   ( sk(k+1,j,i)  + sk(k,j,i)   )             &
-                          -      (  8.0 * ibit8 * adv_sca_5                   &
-                        +           ibit7 * adv_sca_3                         &
+                                   ( sk(k+1,j,i)  + sk(k,j,i)    )            &
+                    -      (  8.0_wp * ibit8 * adv_sca_5                      &
+                        +              ibit7 * adv_sca_3                      &
                            ) *                                                &
-                                   ( sk(k_pp,j,i) + sk(k-1,j,i) )             &
-                    +      (        ibit8 * adv_sca_5                         &
+                                   ( sk(k_pp,j,i) + sk(k-1,j,i)  )            &
+                    +      (           ibit8 * adv_sca_5                      &
                            ) *     ( sk(k_ppp,j,i)+ sk(k_mm,j,i) )            &
                                        )
 
                 diss_t(k) = -ABS( w(k,j,i) ) * (                              &
-                           ( 10.0 * ibit8 * adv_sca_5                         &
-                        +     3.0 * ibit7 * adv_sca_3                         &
-                        +           ibit6 * adv_sca_1                         &
+                           ( 10.0_wp * ibit8 * adv_sca_5                      &
+                        +     3.0_wp * ibit7 * adv_sca_3                      &
+                        +              ibit6 * adv_sca_1                      &
                            ) *                                                &
                                    ( sk(k+1,j,i)   - sk(k,j,i)    )           &
-                    -      (  5.0 * ibit8 * adv_sca_5                         &
-                        +           ibit7 * adv_sca_3                         &
+                    -      (  5.0_wp * ibit8 * adv_sca_5                      &
+                        +              ibit7 * adv_sca_3                      &
                            ) *                                                &
                                    ( sk(k_pp,j,i)  - sk(k-1,j,i)  )           &
-                    +      (        ibit8 * adv_sca_5                         &
+                    +      (           ibit8 * adv_sca_5                      &
                            ) *                                                &
                                    ( sk(k_ppp,j,i) - sk(k_mm,j,i) )           &
-                                         )
+                                               )
 !
 !--             Calculate the divergence of the velocity field. A respective
@@ -2542,22 +2548,22 @@
 
                 u_comp    = u(k,j,i+1) - u_gtrans
-                flux_r(k) = u_comp * (                                      &
-                      37.0 * ( sk(k,j,i+1) + sk(k,j,i)   )                  &
-                    -  8.0 * ( sk(k,j,i+2) + sk(k,j,i-1) )                  &
-                    +        ( sk(k,j,i+3) + sk(k,j,i-2) ) ) * adv_sca_5
-                diss_r(k) = -ABS( u_comp ) * (                              &
-                      10.0 * ( sk(k,j,i+1) - sk(k,j,i)   )                  &
-                    -  5.0 * ( sk(k,j,i+2) - sk(k,j,i-1) )                  &
-                    +        ( sk(k,j,i+3) - sk(k,j,i-2) ) ) * adv_sca_5
+                flux_r(k) = u_comp * (                                        &
+                      37.0_wp * ( sk(k,j,i+1) + sk(k,j,i)   )                 &
+                    -  8.0_wp * ( sk(k,j,i+2) + sk(k,j,i-1) )                 &
+                    +           ( sk(k,j,i+3) + sk(k,j,i-2) ) ) * adv_sca_5
+                diss_r(k) = -ABS( u_comp ) * (                                &
+                      10.0_wp * ( sk(k,j,i+1) - sk(k,j,i)   )                 &
+                    -  5.0_wp * ( sk(k,j,i+2) - sk(k,j,i-1) )                 &
+                    +           ( sk(k,j,i+3) - sk(k,j,i-2) ) ) * adv_sca_5
 
                 v_comp    = v(k,j+1,i) - v_gtrans
-                flux_n(k) = v_comp * (                                      &
-                      37.0 * ( sk(k,j+1,i) + sk(k,j,i)   )                  &
-                    -  8.0 * ( sk(k,j+2,i) + sk(k,j-1,i) )                  &
-                    +        ( sk(k,j+3,i) + sk(k,j-2,i) ) ) * adv_sca_5
-                diss_n(k) = -ABS( v_comp ) * (                              &
-                      10.0 * ( sk(k,j+1,i) - sk(k,j,i)   )                  &
-                    -  5.0 * ( sk(k,j+2,i) - sk(k,j-1,i) )                  &
-                    +        ( sk(k,j+3,i) - sk(k,j-2,i) ) ) * adv_sca_5
+                flux_n(k) = v_comp * (                                        &
+                      37.0_wp * ( sk(k,j+1,i) + sk(k,j,i)   )                 &
+                    -  8.0_wp * ( sk(k,j+2,i) + sk(k,j-1,i) )                 &
+                    +           ( sk(k,j+3,i) + sk(k,j-2,i) ) ) * adv_sca_5
+                diss_n(k) = -ABS( v_comp ) * (                                &
+                      10.0_wp * ( sk(k,j+1,i) - sk(k,j,i)   )                 &
+                    -  5.0_wp * ( sk(k,j+2,i) - sk(k,j-1,i) )                 &
+                    +           ( sk(k,j+3,i) - sk(k,j-2,i) ) ) * adv_sca_5
 !
 !--             k index has to be modified near bottom and top, else array
@@ -2573,31 +2579,31 @@
 
                 flux_t(k) = w(k,j,i) * (                                      &
-                           ( 37.0 * ibit8 * adv_sca_5                         &
-                        +     7.0 * ibit7 * adv_sca_3                         &
-                        +           ibit6 * adv_sca_1                         &
+                           ( 37.0_wp * ibit8 * adv_sca_5                      &
+                        +     7.0_wp * ibit7 * adv_sca_3                      &
+                        +              ibit6 * adv_sca_1                      &
                            ) *                                                &
-                                   ( sk(k+1,j,i)  + sk(k,j,i)   )             &
-                          -      (  8.0 * ibit8 * adv_sca_5                   &
-                        +           ibit7 * adv_sca_3                         &
+                                   ( sk(k+1,j,i)  + sk(k,j,i)     )           &
+                    -      (  8.0_wp * ibit8 * adv_sca_5                      &
+                        +              ibit7 * adv_sca_3                      &
                            ) *                                                &
-                                   ( sk(k_pp,j,i) + sk(k-1,j,i) )             &
-                    +      (        ibit8 * adv_sca_5                         &
-                           ) *     ( sk(k_ppp,j,i)+ sk(k_mm,j,i) )            &
+                                   ( sk(k_pp,j,i) + sk(k-1,j,i)   )           &
+                    +      (           ibit8 * adv_sca_5                      &
+                           ) *     ( sk(k_ppp,j,i)+ sk(k_mm,j,i)  )           &
                                        )
 
                 diss_t(k) = -ABS( w(k,j,i) ) * (                              &
-                           ( 10.0 * ibit8 * adv_sca_5                         &
-                        +     3.0 * ibit7 * adv_sca_3                         &
-                        +           ibit6 * adv_sca_1                         &
+                           ( 10.0_wp * ibit8 * adv_sca_5                      &
+                        +     3.0_wp * ibit7 * adv_sca_3                      &
+                        +              ibit6 * adv_sca_1                      &
                            ) *                                                &
                                    ( sk(k+1,j,i)   - sk(k,j,i)    )           &
-                    -      (  5.0 * ibit8 * adv_sca_5                         &
-                        +           ibit7 * adv_sca_3                         &
+                    -      (  5.0_wp * ibit8 * adv_sca_5                      &
+                        +              ibit7 * adv_sca_3                      &
                            ) *                                                &
                                    ( sk(k_pp,j,i)  - sk(k-1,j,i)  )           &
-                    +      (        ibit8 * adv_sca_5                         &
+                    +      (           ibit8 * adv_sca_5                      &
                            ) *                                                &
                                    ( sk(k_ppp,j,i) - sk(k_mm,j,i) )           &
-                                         )
+                                               )
 !
 !--             Calculate the divergence of the velocity field. A respective
@@ -2661,18 +2667,18 @@
     SUBROUTINE advec_s_ws_acc ( sk, sk_char )
 
-       USE arrays_3d,                                                          &
+       USE arrays_3d,                                                         &
            ONLY:  ddzw, tend, u, v, w
 
-       USE constants,                                                          &
+       USE constants,                                                         &
            ONLY:  adv_sca_1, adv_sca_3, adv_sca_5
 
-       USE control_parameters,                                                 &
+       USE control_parameters,                                                &
            ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
 
-       USE grid_variables,                                                     &
+       USE grid_variables,                                                    &
            ONLY:  ddx, ddy
 
-       USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nxlg, nxrg, nyng, nysg,   &
+       USE indices,                                                           &
+           ONLY:  i_left, i_right, j_north, j_south, nxlg, nxrg, nyng, nysg,  &
                   nzb, nzb_max, nzt, wall_flags_0
 
@@ -2735,63 +2741,63 @@
 
                 u_comp              = u(k,j,i) - u_gtrans
-                flux_l              = u_comp * (                           &
-                                               ( 37.0 * ibit2 * adv_sca_5  &
-                                            +     7.0 * ibit1 * adv_sca_3  &
-                                            +           ibit0 * adv_sca_1  &
-                                               ) *                         &
-                                         ( sk(k,j,i)   + sk(k,j,i-1)    )  &
-                                        -      (  8.0 * ibit2 * adv_sca_5  &
-                                            +           ibit1 * adv_sca_3  &
-                                               ) *                         &
-                                         ( sk(k,j,i+1) + sk(k,j,i-2)    )  &
-                                        +      (        ibit2 * adv_sca_5  &
-                                               ) *                         &
-                                         ( sk(k,j,i+2) + sk(k,j,i-3)    )  &
-                                            )
-
-                diss_l              = -ABS( u_comp ) * (                   &
-                                               ( 10.0 * ibit2 * adv_sca_5  &
-                                            +     3.0 * ibit1 * adv_sca_3  &
-                                            +           ibit0 * adv_sca_1  &
-                                               ) *                         &
-                                         ( sk(k,j,i)   - sk(k,j,i-1)    )  &
-                                        -      (  5.0 * ibit2 * adv_sca_5  &
-                                            +           ibit1 * adv_sca_3  &
-                                               ) *                         &
-                                         ( sk(k,j,i+1) - sk(k,j,i-2)  )    &
-                                        +      (        ibit2 * adv_sca_5  &
-                                               ) *                         &
-                                         ( sk(k,j,i+2) - sk(k,j,i-3) )     &
-                                                    )
+                flux_l              = u_comp * (                              &
+                                               ( 37.0_wp * ibit2 * adv_sca_5  &
+                                            +     7.0_wp * ibit1 * adv_sca_3  &
+                                            +              ibit0 * adv_sca_1  &
+                                               ) *                            &
+                                         ( sk(k,j,i)   + sk(k,j,i-1)    )     &
+                                        -      (  8.0_wp * ibit2 * adv_sca_5  &
+                                            +              ibit1 * adv_sca_3  &
+                                               ) *                            &
+                                         ( sk(k,j,i+1) + sk(k,j,i-2)    )     &
+                                        +      (           ibit2 * adv_sca_5  &
+                                               ) *                            &
+                                         ( sk(k,j,i+2) + sk(k,j,i-3)    )     &
+                                               )
+
+                diss_l              = -ABS( u_comp ) * (                      &
+                                               ( 10.0_wp * ibit2 * adv_sca_5  &
+                                            +     3.0_wp * ibit1 * adv_sca_3  &
+                                            +              ibit0 * adv_sca_1  &
+                                               ) *                            &
+                                         ( sk(k,j,i)   - sk(k,j,i-1)    )     &
+                                        -      (  5.0_wp * ibit2 * adv_sca_5  &
+                                            +              ibit1 * adv_sca_3  &
+                                               ) *                            &
+                                         ( sk(k,j,i+1) - sk(k,j,i-2)    )     &
+                                        +      (           ibit2 * adv_sca_5  &
+                                               ) *                            &
+                                         ( sk(k,j,i+2) - sk(k,j,i-3)    )     &
+                                                        )
 
                 u_comp    = u(k,j,i+1) - u_gtrans
-                flux_r    = u_comp * (                                      &
-                          ( 37.0 * ibit2 * adv_sca_5                        &
-                      +      7.0 * ibit1 * adv_sca_3                        &
-                      +            ibit0 * adv_sca_1                        &
-                          ) *                                               &
-                             ( sk(k,j,i+1) + sk(k,j,i)   )                  &
-                   -      (  8.0 * ibit2 * adv_sca_5                        &
-                       +           ibit1 * adv_sca_3                        &
-                          ) *                                               &
-                             ( sk(k,j,i+2) + sk(k,j,i-1) )                  &
-                   +      (        ibit2 * adv_sca_5                        &
-                          ) *                                               &
-                             ( sk(k,j,i+3) + sk(k,j,i-2) )                  &
+                flux_r    = u_comp * (                                        &
+                          ( 37.0_wp * ibit2 * adv_sca_5                       &
+                      +      7.0_wp * ibit1 * adv_sca_3                       &
+                      +               ibit0 * adv_sca_1                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+1) + sk(k,j,i)   )                    &
+                   -      (  8.0_wp * ibit2 * adv_sca_5                       &
+                       +              ibit1 * adv_sca_3                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+2) + sk(k,j,i-1) )                    &
+                   +      (           ibit2 * adv_sca_5                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+3) + sk(k,j,i-2) )                    &
                                      )
 
-                diss_r    = -ABS( u_comp ) * (                              &
-                          ( 10.0 * ibit2 * adv_sca_5                        &
-                       +     3.0 * ibit1 * adv_sca_3                        &
-                       +           ibit0 * adv_sca_1                        &
-                          ) *                                               &
-                             ( sk(k,j,i+1) - sk(k,j,i)  )                   &
-                   -      (  5.0 * ibit2 * adv_sca_5                        &
-                       +           ibit1 * adv_sca_3                        &
-                          ) *                                               &
-                             ( sk(k,j,i+2) - sk(k,j,i-1) )                  &
-                   +      (        ibit2 * adv_sca_5                        &
-                          ) *                                               &
-                             ( sk(k,j,i+3) - sk(k,j,i-2) )                  &
+                diss_r    = -ABS( u_comp ) * (                                &
+                          ( 10.0_wp * ibit2 * adv_sca_5                       &
+                       +     3.0_wp * ibit1 * adv_sca_3                       &
+                       +              ibit0 * adv_sca_1                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+1) - sk(k,j,i)   )                    &
+                   -      (  5.0_wp * ibit2 * adv_sca_5                       &
+                       +              ibit1 * adv_sca_3                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+2) - sk(k,j,i-1) )                    &
+                   +      (           ibit2 * adv_sca_5                       &
+                          ) *                                                 &
+                             ( sk(k,j,i+3) - sk(k,j,i-2) )                    &
                                              )
 
@@ -2800,65 +2806,65 @@
                 ibit3 = IBITS(wall_flags_0(k,j,i),3,1)
 
-                v_comp               = v(k,j,i) - v_gtrans
-                flux_s               = v_comp * (                             &
-                                                  ( 37.0 * ibit5 * adv_sca_5  &
-                                               +     7.0 * ibit4 * adv_sca_3  &
-                                               +           ibit3 * adv_sca_1  &
-                                                  ) *                         &
-                                           ( sk(k,j,i)  + sk(k,j-1,i)     )   &
-                                            -     (  8.0 * ibit5 * adv_sca_5  &
-                                               +           ibit4 * adv_sca_3  &
-                                                   ) *                        &
-                                           ( sk(k,j+1,i) + sk(k,j-2,i)    )   &
-                                           +      (        ibit5 * adv_sca_5  &
-                                                  ) *                         &
-                                           ( sk(k,j+2,i) + sk(k,j-3,i)    )   &
+                v_comp    = v(k,j,i) - v_gtrans
+                flux_s    = v_comp * (                                        &
+                          ( 37.0_wp * ibit5 * adv_sca_5                       &
+                       +     7.0_wp * ibit4 * adv_sca_3                       &
+                       +              ibit3 * adv_sca_1                       &
+                          ) *                                                 &
+                             ( sk(k,j,i)  + sk(k,j-1,i)     )                 &
+                    -     (  8.0_wp * ibit5 * adv_sca_5                       &
+                       +              ibit4 * adv_sca_3                       &
+                          ) *                                                 &
+                             ( sk(k,j+1,i) + sk(k,j-2,i)    )                 &
+                   +      (           ibit5 * adv_sca_5                       &
+                          ) *                                                 &
+                             ( sk(k,j+2,i) + sk(k,j-3,i)    )                 &
+                                     )
+
+                diss_s    = -ABS( v_comp ) * (                                &
+                          ( 10.0_wp * ibit5 * adv_sca_5                       &
+                       +     3.0_wp * ibit4 * adv_sca_3                       &
+                       +              ibit3 * adv_sca_1                       &
+                          ) *                                                 &
+                             ( sk(k,j,i)   - sk(k,j-1,i)  )                   &
+                   -      (  5.0_wp * ibit5 * adv_sca_5                       &
+                       +              ibit4 * adv_sca_3                       &
+                          ) *                                                 &
+                             ( sk(k,j+1,i) - sk(k,j-2,i)  )                   &
+                   +      (           ibit5 * adv_sca_5                       &
+                          ) *                                                 &
+                             ( sk(k,j+2,i) - sk(k,j-3,i)  )                   &
                                              )
 
-                diss_s               = -ABS( v_comp ) * (                     &
-                                                  ( 10.0 * ibit5 * adv_sca_5  &
-                                               +     3.0 * ibit4 * adv_sca_3  &
-                                               +           ibit3 * adv_sca_1  &
-                                                  ) *                         &
-                                            ( sk(k,j,i)   - sk(k,j-1,i)    )  &
-                                           -      (  5.0 * ibit5 * adv_sca_5  &
-                                               +           ibit4 * adv_sca_3  &
-                                            ) *                               &
-                                            ( sk(k,j+1,i) - sk(k,j-2,i)  )    &
-                                           +      (        ibit5 * adv_sca_5  &
-                                                  ) *                         &
-                                            ( sk(k,j+2,i) - sk(k,j-3,i) )     &
-                                                     )
-
 
                 v_comp    = v(k,j+1,i) - v_gtrans
-                flux_n    = v_comp * (                                      &
-                          ( 37.0 * ibit5 * adv_sca_5                        &
-                       +     7.0 * ibit4 * adv_sca_3                        &
-                       +           ibit3 * adv_sca_1                        &
-                          ) *                                               &
-                             ( sk(k,j+1,i) + sk(k,j,i)   )                  &
-                   -      (  8.0 * ibit5 * adv_sca_5                        &
-                       +           ibit4 * adv_sca_3                        &
-                          ) *                                               &
-                             ( sk(k,j+2,i) + sk(k,j-1,i) )                  &
-                   +      (        ibit5 * adv_sca_5                        &
-                          ) *                                               &
-                             ( sk(k,j+3,i) + sk(k,j-2,i) )                  &
+                flux_n    = v_comp * (                                        &
+                          ( 37.0_wp * ibit5 * adv_sca_5                       &
+                       +     7.0_wp * ibit4 * adv_sca_3                       &
+                       +              ibit3 * adv_sca_1                       &
+                          ) *                                                 &
+                             ( sk(k,j+1,i) + sk(k,j,i)   )                    &
+                   -      (  8.0_wp * ibit5 * adv_sca_5                       &
+                       +              ibit4 * adv_sca_3                       &
+                          ) *                                                 &
+                             ( sk(k,j+2,i) + sk(k,j-1,i) )                    &
+                   +      (           ibit5 * adv_sca_5                       &
+                          ) *                                                 &
+                             ( sk(k,j+3,i) + sk(k,j-2,i) )                    &
                                      )
 
-                diss_n    = -ABS( v_comp ) * (                              &
-                          ( 10.0 * ibit5 * adv_sca_5                        &
-                       +     3.0 * ibit4 * adv_sca_3                        &
-                       +           ibit3 * adv_sca_1                        &
-                          ) *                                               &
-                             ( sk(k,j+1,i) - sk(k,j,i)    )                 &
-                   -      (  5.0 * ibit5 * adv_sca_5                        &
-                       +           ibit4 * adv_sca_3                        &
-                          ) *                                               &
-                             ( sk(k,j+2,i) - sk(k,j-1,i)  )                 &
-                   +      (        ibit5 * adv_sca_5                        &
-                          ) *                                               &
-                             ( sk(k,j+3,i) - sk(k,j-2,i) )                  &
+                diss_n    = -ABS( v_comp ) * (                                &
+                          ( 10.0_wp * ibit5 * adv_sca_5                       &
+                       +     3.0_wp * ibit4 * adv_sca_3                       &
+                       +              ibit3 * adv_sca_1                       &
+                          ) *                                                 &
+                             ( sk(k,j+1,i) - sk(k,j,i)    )                   &
+                   -      (  5.0_wp * ibit5 * adv_sca_5                       &
+                       +              ibit4 * adv_sca_3                       &
+                          ) *                                                 &
+                             ( sk(k,j+2,i) - sk(k,j-1,i)  )                   &
+                   +      (           ibit5 * adv_sca_5                       &
+                          ) *                                                 &
+                             ( sk(k,j+3,i) - sk(k,j-2,i)  )                   &
                                              )
 
@@ -2874,31 +2880,31 @@
 
                 flux_d    = w(k-1,j,i) * (                                    &
-                           ( 37.0 * ibit8 * adv_sca_5                         &
-                        +     7.0 * ibit7 * adv_sca_3                         &
-                        +           ibit6 * adv_sca_1                         &
+                           ( 37.0_wp * ibit8 * adv_sca_5                      &
+                        +     7.0_wp * ibit7 * adv_sca_3                      &
+                        +              ibit6 * adv_sca_1                      &
                            ) *                                                &
-                                   ( sk(k,j,i)    + sk(k-1,j,i) )             &
-                          -      (  8.0 * ibit8 * adv_sca_5                   &
-                          +               ibit7 * adv_sca_3                   &
+                                   ( sk(k,j,i)    + sk(k-1,j,i)  )            &
+                    -      (  8.0_wp * ibit8 * adv_sca_5                      &
+                          +            ibit7 * adv_sca_3                      &
                            ) *                                                &
-                                   ( sk(k+1,j,i) + sk(k_mm,j,i) )             &
-                    +      (        ibit8 * adv_sca_5                         &
+                                   ( sk(k+1,j,i) + sk(k_mm,j,i)  )            &
+                    +      (           ibit8 * adv_sca_5                      &
                            ) *     ( sk(k_pp,j,i)+ sk(k_mmm,j,i) )            &
-                                       )
+                                         )
 
                 diss_d    = -ABS( w(k-1,j,i) ) * (                            &
-                           ( 10.0 * ibit8 * adv_sca_5                         &
-                        +     3.0 * ibit7 * adv_sca_3                         &
-                        +           ibit6 * adv_sca_1                         &
+                           ( 10.0_wp * ibit8 * adv_sca_5                      &
+                        +     3.0_wp * ibit7 * adv_sca_3                      &
+                        +              ibit6 * adv_sca_1                      &
                            ) *                                                &
                                    ( sk(k,j,i)    - sk(k-1,j,i)   )           &
-                    -      (  5.0 * ibit8 * adv_sca_5                         &
-                        +           ibit7 * adv_sca_3                         &
+                    -      (  5.0_wp * ibit8 * adv_sca_5                      &
+                        +              ibit7 * adv_sca_3                      &
                            ) *                                                &
                                    ( sk(k+1,j,i)  - sk(k_mm,j,i)  )           &
-                    +      (        ibit8 * adv_sca_5                         &
+                    +      (           ibit8 * adv_sca_5                      &
                            ) *                                                &
                                    ( sk(k_pp,j,i) - sk(k_mmm,j,i) )           &
-                                         )
+                                                 )
 
                 ibit8 = IBITS(wall_flags_0(k,j,i),8,1)
@@ -2911,28 +2917,28 @@
 
                 flux_t    = w(k,j,i) * (                                      &
-                           ( 37.0 * ibit8 * adv_sca_5                         &
-                        +     7.0 * ibit7 * adv_sca_3                         &
-                        +           ibit6 * adv_sca_1                         &
+                           ( 37.0_wp * ibit8 * adv_sca_5                      &
+                        +     7.0_wp * ibit7 * adv_sca_3                      &
+                        +              ibit6 * adv_sca_1                      &
                            ) *                                                &
-                                   ( sk(k+1,j,i)  + sk(k,j,i)   )             &
-                          -      (  8.0 * ibit8 * adv_sca_5                   &
-                        +                 ibit7 * adv_sca_3                   &
+                                   ( sk(k+1,j,i)  + sk(k,j,i)    )            &
+                    -      (  8.0_wp * ibit8 * adv_sca_5                      &
+                        +              ibit7 * adv_sca_3                      &
                            ) *                                                &
-                                   ( sk(k_pp,j,i) + sk(k-1,j,i) )             &
-                    +      (        ibit8 * adv_sca_5                         &
+                                   ( sk(k_pp,j,i) + sk(k-1,j,i)  )            &
+                    +      (           ibit8 * adv_sca_5                      &
                            ) *     ( sk(k_ppp,j,i)+ sk(k_mm,j,i) )            &
                                        )
 
                 diss_t    = -ABS( w(k,j,i) ) * (                              &
-                           ( 10.0 * ibit8 * adv_sca_5                         &
-                        +     3.0 * ibit7 * adv_sca_3                         &
-                        +           ibit6 * adv_sca_1                         &
+                           ( 10.0_wp * ibit8 * adv_sca_5                      &
+                        +     3.0_wp * ibit7 * adv_sca_3                      &
+                        +              ibit6 * adv_sca_1                      &
                            ) *                                                &
                                    ( sk(k+1,j,i)   - sk(k,j,i)    )           &
-                    -      (  5.0 * ibit8 * adv_sca_5                         &
-                        +           ibit7 * adv_sca_3                         &
+                    -      (  5.0_wp * ibit8 * adv_sca_5                      &
+                        +              ibit7 * adv_sca_3                      &
                            ) *                                                &
                                    ( sk(k_pp,j,i)  - sk(k-1,j,i)  )           &
-                    +      (        ibit8 * adv_sca_5                         &
+                    +      (           ibit8 * adv_sca_5                      &
                            ) *                                                &
                                    ( sk(k_ppp,j,i) - sk(k_mm,j,i) )           &
@@ -3045,6 +3051,6 @@
        REAL(wp), DIMENSION(nzb:nzt) ::  u_comp !:
  
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
 
 !
@@ -3060,14 +3066,14 @@
              u_comp(k)                = u(k,j,i) + u(k,j,i-1) - gu
              swap_flux_x_local_u(k,j) = u_comp(k) * (                          &
-                                       ( 37.0 * ibit11 * adv_mom_5             &
-                                    +     7.0 * ibit10 * adv_mom_3             &
-                                    +           ibit9  * adv_mom_1             &
+                                       ( 37.0_wp * ibit11 * adv_mom_5             &
+                                    +     7.0_wp * ibit10 * adv_mom_3             &
+                                    +              ibit9  * adv_mom_1             &
                                        ) *                                     &
                                      ( u(k,j,i)   + u(k,j,i-1) )               &
-                                -      (  8.0 * ibit11 * adv_mom_5             &
-                                    +           ibit10 * adv_mom_3             &
+                                -      (  8.0_wp * ibit11 * adv_mom_5             &
+                                    +              ibit10 * adv_mom_3             &
                                        ) *                                     &
                                      ( u(k,j,i+1) + u(k,j,i-2) )               &
-                                +      (        ibit11 * adv_mom_5             &
+                                +      (           ibit11 * adv_mom_5             &
                                        ) *                                     &
                                      ( u(k,j,i+2) + u(k,j,i-3) )               &
@@ -3075,14 +3081,14 @@
 
               swap_diss_x_local_u(k,j) = - ABS( u_comp(k) ) * (                &
-                                       ( 10.0 * ibit11 * adv_mom_5             &
-                                    +     3.0 * ibit10 * adv_mom_3             &
-                                    +           ibit9  * adv_mom_1             &
+                                       ( 10.0_wp * ibit11 * adv_mom_5             &
+                                    +     3.0_wp * ibit10 * adv_mom_3             &
+                                    +              ibit9  * adv_mom_1             &
                                        ) *                                     &
                                      ( u(k,j,i)   - u(k,j,i-1) )               &
-                                -      (  5.0 * ibit11 * adv_mom_5             &
-                                    +           ibit10 * adv_mom_3             &
+                                -      (  5.0_wp * ibit11 * adv_mom_5             &
+                                    +              ibit10 * adv_mom_3             &
                                        ) *                                     &
                                      ( u(k,j,i+1) - u(k,j,i-2) )               &
-                                +      (        ibit11 * adv_mom_5             &
+                                +      (           ibit11 * adv_mom_5             &
                                        ) *                                     &
                                      ( u(k,j,i+2) - u(k,j,i-3) )               &
@@ -3095,11 +3101,11 @@
              u_comp(k)         = u(k,j,i) + u(k,j,i-1) - gu
              swap_flux_x_local_u(k,j) = u_comp(k) * (                          &
-                             37.0 * ( u(k,j,i) + u(k,j,i-1)   )                &
-                           -  8.0 * ( u(k,j,i+1) + u(k,j,i-2) )                &
-                           +        ( u(k,j,i+2) + u(k,j,i-3) ) ) * adv_mom_5
+                             37.0_wp * ( u(k,j,i) + u(k,j,i-1)   )                &
+                           -  8.0_wp * ( u(k,j,i+1) + u(k,j,i-2) )                &
+                           +           ( u(k,j,i+2) + u(k,j,i-3) ) ) * adv_mom_5
              swap_diss_x_local_u(k,j) = - ABS(u_comp(k)) * (                   &
-                             10.0 * ( u(k,j,i) - u(k,j,i-1)   )                &
-                           -  5.0 * ( u(k,j,i+1) - u(k,j,i-2) )                &
-                           +        ( u(k,j,i+2) - u(k,j,i-3) ) ) * adv_mom_5
+                             10.0_wp * ( u(k,j,i) - u(k,j,i-1)   )                &
+                           -  5.0_wp * ( u(k,j,i+1) - u(k,j,i-2) )                &
+                           +           ( u(k,j,i+2) - u(k,j,i-3) ) ) * adv_mom_5
 
           ENDDO
@@ -3118,14 +3124,14 @@
              v_comp                 = v(k,j,i) + v(k,j,i-1) - gv
              swap_flux_y_local_u(k) = v_comp * (                              &
-                                   ( 37.0 * ibit14 * adv_mom_5                &
-                                +     7.0 * ibit13 * adv_mom_3                &
-                                +           ibit12 * adv_mom_1                &
+                                   ( 37.0_wp * ibit14 * adv_mom_5                &
+                                +     7.0_wp * ibit13 * adv_mom_3                &
+                                +              ibit12 * adv_mom_1                &
                                    ) *                                        &
                                      ( u(k,j,i)   + u(k,j-1,i) )              &
-                            -      (  8.0 * ibit14 * adv_mom_5                &
-                            +           ibit13 * adv_mom_3                    &
+                            -      (  8.0_wp * ibit14 * adv_mom_5                &
+                            +                  ibit13 * adv_mom_3                    &
                                    ) *                                        &
                                      ( u(k,j+1,i) + u(k,j-2,i) )              &
-                        +      (        ibit14 * adv_mom_5                    &
+                        +      (               ibit14 * adv_mom_5                    &
                                ) *                                            &
                                      ( u(k,j+2,i) + u(k,j-3,i) )              &
@@ -3133,14 +3139,14 @@
 
              swap_diss_y_local_u(k) = - ABS ( v_comp ) * (                    &
-                                   ( 10.0 * ibit14 * adv_mom_5                &
-                                +     3.0 * ibit13 * adv_mom_3                &
-                                +           ibit12 * adv_mom_1                &
+                                   ( 10.0_wp * ibit14 * adv_mom_5                &
+                                +     3.0_wp * ibit13 * adv_mom_3                &
+                                +              ibit12 * adv_mom_1                &
                                    ) *                                        &
                                      ( u(k,j,i)   - u(k,j-1,i) )              &
-                            -      (  5.0 * ibit14 * adv_mom_5                &
-                                +           ibit13 * adv_mom_3                &
+                            -      (  5.0_wp * ibit14 * adv_mom_5                &
+                                +              ibit13 * adv_mom_3                &
                                    ) *                                        &
                                      ( u(k,j+1,i) - u(k,j-2,i) )              &
-                            +      (        ibit14 * adv_mom_5                &
+                            +      (           ibit14 * adv_mom_5                &
                                    ) *                                        &
                                      ( u(k,j+2,i) - u(k,j-3,i) )              &
@@ -3153,11 +3159,11 @@
              v_comp                 = v(k,j,i) + v(k,j,i-1) - gv
              swap_flux_y_local_u(k) = v_comp * (                              &
-                           37.0 * ( u(k,j,i) + u(k,j-1,i)   )                 &
-                         -  8.0 * ( u(k,j+1,i) + u(k,j-2,i) )                 &
-                         +        ( u(k,j+2,i) + u(k,j-3,i) ) ) * adv_mom_5
+                           37.0_wp * ( u(k,j,i) + u(k,j-1,i)   )                 &
+                         -  8.0_wp * ( u(k,j+1,i) + u(k,j-2,i) )                 &
+                         +           ( u(k,j+2,i) + u(k,j-3,i) ) ) * adv_mom_5
              swap_diss_y_local_u(k) = - ABS(v_comp) * (                       &
-                           10.0 * ( u(k,j,i) - u(k,j-1,i)   )                 &
-                         -  5.0 * ( u(k,j+1,i) - u(k,j-2,i) )                 &
-                         +        ( u(k,j+2,i) - u(k,j-3,i) ) ) * adv_mom_5
+                           10.0_wp * ( u(k,j,i) - u(k,j-1,i)   )                 &
+                         -  5.0_wp * ( u(k,j+1,i) - u(k,j-2,i) )                 &
+                         +           ( u(k,j+2,i) - u(k,j-3,i) ) ) * adv_mom_5
 
           ENDDO
@@ -3166,8 +3172,8 @@
           DO  j = nys, nyn
 
-             flux_t(0) = 0.0
-             diss_t(0) = 0.0
-             flux_d    = 0.0
-             diss_d    = 0.0
+             flux_t(0) = 0.0_wp
+             diss_t(0) = 0.0_wp
+             flux_d    = 0.0_wp
+             diss_d    = 0.0_wp
 
              DO  k = nzb+1, nzb_max
@@ -3179,14 +3185,14 @@
                 u_comp(k) = u(k,j,i+1) + u(k,j,i)
                 flux_r(k) = ( u_comp(k) - gu ) * (                           &
-                          ( 37.0 * ibit11 * adv_mom_5                        &
-                       +     7.0 * ibit10 * adv_mom_3                        &
-                       +           ibit9  * adv_mom_1                        &
+                          ( 37.0_wp * ibit11 * adv_mom_5                        &
+                       +     7.0_wp * ibit10 * adv_mom_3                        &
+                       +              ibit9  * adv_mom_1                        &
                           ) *                                                &
                                  ( u(k,j,i+1) + u(k,j,i)   )                 &
-                   -      (  8.0 * ibit11 * adv_mom_5                        &
-                       +           ibit10 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit11 * adv_mom_5                        &
+                       +              ibit10 * adv_mom_3                        &
                           ) *                                                &
                                  ( u(k,j,i+2) + u(k,j,i-1) )                 &
-                   +      (        ibit11 * adv_mom_5                        &
+                   +      (           ibit11 * adv_mom_5                        &
                           ) *                                                &
                                  ( u(k,j,i+3) + u(k,j,i-2) )                 &
@@ -3194,14 +3200,14 @@
 
                 diss_r(k) = - ABS( u_comp(k) - gu ) * (                      &
-                          ( 10.0 * ibit11 * adv_mom_5                        &
-                       +     3.0 * ibit10 * adv_mom_3                        & 
-                       +           ibit9  * adv_mom_1                        &
+                          ( 10.0_wp * ibit11 * adv_mom_5                        &
+                       +     3.0_wp * ibit10 * adv_mom_3                        & 
+                       +              ibit9  * adv_mom_1                        &
                           ) *                                                &
                                  ( u(k,j,i+1) - u(k,j,i)  )                  &
-                   -      (  5.0 * ibit11 * adv_mom_5                        &
-                       +           ibit10 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit11 * adv_mom_5                        &
+                       +              ibit10 * adv_mom_3                        &
                           ) *                                                &
                                  ( u(k,j,i+2) - u(k,j,i-1) )                 &
-                   +      (        ibit11 * adv_mom_5                        &
+                   +      (           ibit11 * adv_mom_5                        &
                           ) *                                                &
                                  ( u(k,j,i+3) - u(k,j,i-2) )                 &
@@ -3214,14 +3220,14 @@
                 v_comp    = v(k,j+1,i) + v(k,j+1,i-1) - gv
                 flux_n(k) = v_comp * (                                       &
-                          ( 37.0 * ibit14 * adv_mom_5                        &
-                       +     7.0 * ibit13 * adv_mom_3                        &
-                       +           ibit12 * adv_mom_1                        &
+                          ( 37.0_wp * ibit14 * adv_mom_5                        &
+                       +     7.0_wp * ibit13 * adv_mom_3                        &
+                       +              ibit12 * adv_mom_1                        &
                           ) *                                                &
                                  ( u(k,j+1,i) + u(k,j,i)   )                 &
-                   -      (  8.0 * ibit14 * adv_mom_5                        &
-                       +           ibit13 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit14 * adv_mom_5                        &
+                       +              ibit13 * adv_mom_3                        &
                           ) *                                                &
                                  ( u(k,j+2,i) + u(k,j-1,i) )                 &
-                   +      (        ibit14 * adv_mom_5                        & 
+                   +      (           ibit14 * adv_mom_5                        & 
                           ) *                                                &
                                  ( u(k,j+3,i) + u(k,j-2,i) )                 &
@@ -3229,14 +3235,14 @@
 
                 diss_n(k) = - ABS ( v_comp ) * (                             &
-                          ( 10.0 * ibit14 * adv_mom_5                        &
-                       +     3.0 * ibit13 * adv_mom_3                        &
-                       +           ibit12 * adv_mom_1                        &
+                          ( 10.0_wp * ibit14 * adv_mom_5                        &
+                       +     3.0_wp * ibit13 * adv_mom_3                        &
+                       +              ibit12 * adv_mom_1                        &
                           ) *                                                &
                                  ( u(k,j+1,i) - u(k,j,i)  )                  &
-                   -      (  5.0 * ibit14 * adv_mom_5                        &
-                       +           ibit13 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit14 * adv_mom_5                        &
+                       +              ibit13 * adv_mom_3                        &
                           ) *                                                &
                                  ( u(k,j+2,i) - u(k,j-1,i) )                 &
-                   +      (        ibit14 * adv_mom_5                        &
+                   +      (           ibit14 * adv_mom_5                        &
                           ) *                                                &
                                  ( u(k,j+3,i) - u(k,j-2,i) )                 &
@@ -3255,14 +3261,14 @@
                 w_comp    = w(k,j,i) + w(k,j,i-1)
                 flux_t(k) = w_comp  * (                                      &
-                          ( 37.0 * ibit17 * adv_mom_5                        &
-                       +     7.0 * ibit16 * adv_mom_3                        &
-                       +           ibit15 * adv_mom_1                        & 
+                          ( 37.0_wp * ibit17 * adv_mom_5                        &
+                       +     7.0_wp * ibit16 * adv_mom_3                        &
+                       +              ibit15 * adv_mom_1                        & 
                           ) *                                                &
                              ( u(k+1,j,i)  + u(k,j,i)     )                  &
-                   -      (  8.0 * ibit17 * adv_mom_5                        &
-                       +           ibit16 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit17 * adv_mom_5                        &
+                       +              ibit16 * adv_mom_3                        &
                           ) *                                                &
                              ( u(k_pp,j,i) + u(k-1,j,i)   )                  &
-                   +      (        ibit17 * adv_mom_5                        &
+                   +      (           ibit17 * adv_mom_5                        &
                           ) *                                                &
                              ( u(k_ppp,j,i) + u(k_mm,j,i) )                  &
@@ -3270,14 +3276,14 @@
 
                 diss_t(k) = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit17 * adv_mom_5                        &
-                       +     3.0 * ibit16 * adv_mom_3                        &
-                       +           ibit15 * adv_mom_1                        &
+                          ( 10.0_wp * ibit17 * adv_mom_5                        &
+                       +     3.0_wp * ibit16 * adv_mom_3                        &
+                       +              ibit15 * adv_mom_1                        &
                           ) *                                                &
                              ( u(k+1,j,i)   - u(k,j,i)    )                  &
-                   -      (  5.0 * ibit17 * adv_mom_5                        &
-                       +           ibit16 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit17 * adv_mom_5                        &
+                       +              ibit16 * adv_mom_3                        &
                           ) *                                                &
                              ( u(k_pp,j,i)  - u(k-1,j,i)  )                  &
-                   +      (        ibit17 * adv_mom_5                        &
+                   +      (           ibit17 * adv_mom_5                        &
                            ) *                                               &
                              ( u(k_ppp,j,i) - u(k_mm,j,i) )                  &
@@ -3291,5 +3297,5 @@
                      +  ( w_comp      - ( w(k-1,j,i) + w(k-1,j,i-1) ) )        &
                                                                     * ddzw(k)  &
-                      ) * 0.5
+                      ) * 0.5_wp
 
                 tend(k,j,i) = tend(k,j,i) - (                                  &
@@ -3314,8 +3320,8 @@
                 sums_us2_ws_l(k,tn) = sums_us2_ws_l(k,tn)                     &
                               + ( flux_r(k) *                                 &
-                                ( u_comp(k) - 2.0 * hom(k,1,1,0) )            &
+                                ( u_comp(k) - 2.0_wp * hom(k,1,1,0) )            &
                               / ( u_comp(k) - gu + 1.0E-20_wp    )            &
                               +   diss_r(k) *                                 &
-                                  ABS( u_comp(k) - 2.0 * hom(k,1,1,0) )       &
+                                  ABS( u_comp(k) - 2.0_wp * hom(k,1,1,0) )       &
                               / ( ABS( u_comp(k) - gu ) + 1.0E-20_wp ) )      &
                               *   weight_substep(intermediate_timestep_count)
@@ -3331,21 +3337,21 @@
                 u_comp(k) = u(k,j,i+1) + u(k,j,i)
                 flux_r(k) = ( u_comp(k) - gu ) * (                            &
-                         37.0 * ( u(k,j,i+1) + u(k,j,i)   )                   &
-                       -  8.0 * ( u(k,j,i+2) + u(k,j,i-1) )                   &
-                       +        ( u(k,j,i+3) + u(k,j,i-2) ) ) * adv_mom_5
+                         37.0_wp * ( u(k,j,i+1) + u(k,j,i)   )                   &
+                       -  8.0_wp * ( u(k,j,i+2) + u(k,j,i-1) )                   &
+                       +           ( u(k,j,i+3) + u(k,j,i-2) ) ) * adv_mom_5
                 diss_r(k) = - ABS( u_comp(k) - gu ) * (                       &
-                         10.0 * ( u(k,j,i+1) - u(k,j,i)   )                   &
-                       -  5.0 * ( u(k,j,i+2) - u(k,j,i-1) )                   &
-                       +        ( u(k,j,i+3) - u(k,j,i-2) ) ) * adv_mom_5
+                         10.0_wp * ( u(k,j,i+1) - u(k,j,i)   )                   &
+                       -  5.0_wp * ( u(k,j,i+2) - u(k,j,i-1) )                   &
+                       +           ( u(k,j,i+3) - u(k,j,i-2) ) ) * adv_mom_5
 
                 v_comp    = v(k,j+1,i) + v(k,j+1,i-1) - gv
                 flux_n(k) = v_comp * (                                        &
-                         37.0 * ( u(k,j+1,i) + u(k,j,i)   )                   &
-                       -  8.0 * ( u(k,j+2,i) + u(k,j-1,i) )                   &
-                       +        ( u(k,j+3,i) + u(k,j-2,i) ) ) * adv_mom_5
+                         37.0_wp * ( u(k,j+1,i) + u(k,j,i)   )                   &
+                       -  8.0_wp * ( u(k,j+2,i) + u(k,j-1,i) )                   &
+                       +           ( u(k,j+3,i) + u(k,j-2,i) ) ) * adv_mom_5
                 diss_n(k) = - ABS( v_comp ) * (                               &
-                         10.0 * ( u(k,j+1,i) - u(k,j,i)   )                   &
-                       -  5.0 * ( u(k,j+2,i) - u(k,j-1,i) )                   &
-                       +        ( u(k,j+3,i) - u(k,j-2,i) ) ) * adv_mom_5
+                         10.0_wp * ( u(k,j+1,i) - u(k,j,i)   )                   &
+                       -  5.0_wp * ( u(k,j+2,i) - u(k,j-1,i) )                   &
+                       +           ( u(k,j+3,i) - u(k,j-2,i) ) ) * adv_mom_5
 !
 !--             k index has to be modified near bottom and top, else array
@@ -3361,14 +3367,14 @@
                 w_comp    = w(k,j,i) + w(k,j,i-1)
                 flux_t(k) = w_comp  * (                                      &
-                          ( 37.0 * ibit17 * adv_mom_5                        &
-                       +     7.0 * ibit16 * adv_mom_3                        &
-                       +           ibit15 * adv_mom_1                        &
+                          ( 37.0_wp * ibit17 * adv_mom_5                        &
+                       +     7.0_wp * ibit16 * adv_mom_3                        &
+                       +              ibit15 * adv_mom_1                        &
                           ) *                                                &
                              ( u(k+1,j,i)  + u(k,j,i)     )                  &
-                   -      (  8.0 * ibit17 * adv_mom_5                        &
-                       +           ibit16 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit17 * adv_mom_5                        &
+                       +              ibit16 * adv_mom_3                        &
                           ) *                                                &
                              ( u(k_pp,j,i) + u(k-1,j,i)   )                  &
-                   +      (        ibit17 * adv_mom_5                        &
+                   +      (           ibit17 * adv_mom_5                        &
                           ) *                                                &
                              ( u(k_ppp,j,i) + u(k_mm,j,i) )                  &
@@ -3376,14 +3382,14 @@
 
                 diss_t(k) = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit17 * adv_mom_5                        &
-                       +     3.0 * ibit16 * adv_mom_3                        &
-                       +           ibit15 * adv_mom_1                        &
+                          ( 10.0_wp * ibit17 * adv_mom_5                        &
+                       +     3.0_wp * ibit16 * adv_mom_3                        &
+                       +              ibit15 * adv_mom_1                        &
                           ) *                                                &
                              ( u(k+1,j,i)   - u(k,j,i)    )                  &
-                   -      (  5.0 * ibit17 * adv_mom_5                        &
-                       +           ibit16 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit17 * adv_mom_5                        &
+                       +              ibit16 * adv_mom_3                        &
                           ) *                                                &
                              ( u(k_pp,j,i)  - u(k-1,j,i)  )                  &
-                   +      (        ibit17 * adv_mom_5                        &
+                   +      (           ibit17 * adv_mom_5                        &
                            ) *                                               &
                              ( u(k_ppp,j,i) - u(k_mm,j,i) )                  &
@@ -3397,5 +3403,5 @@
                      +  ( w_comp      - ( w(k-1,j,i) + w(k-1,j,i-1) ) )       &
                                                                     * ddzw(k) &
-                      ) * 0.5
+                      ) * 0.5_wp
 
                  tend(k,j,i) = tend(k,j,i) - (                                 &
@@ -3420,8 +3426,8 @@
                  sums_us2_ws_l(k,tn) = sums_us2_ws_l(k,tn)                    &
                               + ( flux_r(k) *                                 &
-                                ( u_comp(k) - 2.0 * hom(k,1,1,0) )            &
+                                ( u_comp(k) - 2.0_wp * hom(k,1,1,0) )            &
                               / ( u_comp(k) - gu + 1.0E-20_wp   )             &
                               +   diss_r(k) *                                 &
-                                  ABS( u_comp(k) - 2.0 * hom(k,1,1,0) )       &
+                                  ABS( u_comp(k) - 2.0_wp * hom(k,1,1,0) )       &
                               / ( ABS( u_comp(k) - gu ) + 1.0E-20_wp ) )      &
                               *   weight_substep(intermediate_timestep_count)
@@ -3508,6 +3514,6 @@
 
 
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
 
 !
@@ -3524,14 +3530,14 @@
                 u_comp_l           = u(k,j,i) + u(k,j,i-1) - gu
                 flux_l             = u_comp_l * (                          &
-                                    ( 37.0 * ibit11 * adv_mom_5             &
-                                 +     7.0 * ibit10 * adv_mom_3             &
-                                 +           ibit9  * adv_mom_1             &
+                                    ( 37.0_wp * ibit11 * adv_mom_5             &
+                                 +     7.0_wp * ibit10 * adv_mom_3             &
+                                 +              ibit9  * adv_mom_1             &
                                     ) *                                     &
                                   ( u(k,j,i)   + u(k,j,i-1) )               &
-                             -      (  8.0 * ibit11 * adv_mom_5             &
-                                 +           ibit10 * adv_mom_3             &
+                             -      (  8.0_wp * ibit11 * adv_mom_5             &
+                                 +              ibit10 * adv_mom_3             &
                                     ) *                                     &
                                   ( u(k,j,i+1) + u(k,j,i-2) )               &
-                             +      (        ibit11 * adv_mom_5             &
+                             +      (           ibit11 * adv_mom_5             &
                                     ) *                                     &
                                   ( u(k,j,i+2) + u(k,j,i-3) )               &
@@ -3539,14 +3545,14 @@
 
                 diss_l             = - ABS( u_comp_l ) * (                &
-                                   ( 10.0 * ibit11 * adv_mom_5             &
-                                +     3.0 * ibit10 * adv_mom_3             &
-                                +           ibit9  * adv_mom_1             &
+                                   ( 10.0_wp * ibit11 * adv_mom_5             &
+                                +     3.0_wp * ibit10 * adv_mom_3             &
+                                +              ibit9  * adv_mom_1             &
                                    ) *                                     &
                                  ( u(k,j,i)   - u(k,j,i-1) )               &
-                            -      (  5.0 * ibit11 * adv_mom_5             &
-                                +           ibit10 * adv_mom_3             &
+                            -      (  5.0_wp * ibit11 * adv_mom_5             &
+                                +              ibit10 * adv_mom_3             &
                                    ) *                                     &
                                  ( u(k,j,i+1) - u(k,j,i-2) )               &
-                            +      (        ibit11 * adv_mom_5             &
+                            +      (           ibit11 * adv_mom_5             &
                                    ) *                                     &
                                  ( u(k,j,i+2) - u(k,j,i-3) )               &
@@ -3555,14 +3561,14 @@
                 u_comp    = u(k,j,i+1) + u(k,j,i)
                 flux_r    = ( u_comp   - gu ) * (                           &
-                          ( 37.0 * ibit11 * adv_mom_5                        &
-                       +     7.0 * ibit10 * adv_mom_3                        &
-                       +           ibit9  * adv_mom_1                        &
+                          ( 37.0_wp * ibit11 * adv_mom_5                        &
+                       +     7.0_wp * ibit10 * adv_mom_3                        &
+                       +              ibit9  * adv_mom_1                        &
                           ) *                                                &
                                  ( u(k,j,i+1) + u(k,j,i)   )                 &
-                   -      (  8.0 * ibit11 * adv_mom_5                        &
-                       +           ibit10 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit11 * adv_mom_5                        &
+                       +              ibit10 * adv_mom_3                        &
                           ) *                                                &
                                  ( u(k,j,i+2) + u(k,j,i-1) )                 &
-                   +      (        ibit11 * adv_mom_5                        &
+                   +      (           ibit11 * adv_mom_5                        &
                           ) *                                                &
                                  ( u(k,j,i+3) + u(k,j,i-2) )                 &
@@ -3570,14 +3576,14 @@
 
                 diss_r    = - ABS( u_comp    - gu ) * (                      &
-                          ( 10.0 * ibit11 * adv_mom_5                        &
-                       +     3.0 * ibit10 * adv_mom_3                        &
-                       +           ibit9  * adv_mom_1                        &
+                          ( 10.0_wp * ibit11 * adv_mom_5                        &
+                       +     3.0_wp * ibit10 * adv_mom_3                        &
+                       +              ibit9  * adv_mom_1                        &
                           ) *                                                &
                                  ( u(k,j,i+1) - u(k,j,i)  )                  &
-                   -      (  5.0 * ibit11 * adv_mom_5                        &
-                       +           ibit10 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit11 * adv_mom_5                        &
+                       +              ibit10 * adv_mom_3                        &
                           ) *                                                &
                                  ( u(k,j,i+2) - u(k,j,i-1) )                 &
-                   +      (        ibit11 * adv_mom_5                        &
+                   +      (           ibit11 * adv_mom_5                        &
                           ) *                                                &
                                  ( u(k,j,i+3) - u(k,j,i-2) )                 &
@@ -3590,14 +3596,14 @@
                 v_comp_s                 = v(k,j,i) + v(k,j,i-1) - gv
                 flux_s                   = v_comp_s * (                       &
-                                   ( 37.0 * ibit14 * adv_mom_5                &
-                                +     7.0 * ibit13 * adv_mom_3                &
-                                +           ibit12 * adv_mom_1                &
-                                   ) *                                        &
+                                   ( 37.0_wp * ibit14 * adv_mom_5                &
+                                +     7.0_wp * ibit13 * adv_mom_3                &
+                                +              ibit12 * adv_mom_1                &
+                                   ) *                                         &
                                      ( u(k,j,i)   + u(k,j-1,i) )              &
-                            -      (  8.0 * ibit14 * adv_mom_5                &
-                            +           ibit13 * adv_mom_3                    &
+                            -      (  8.0_wp * ibit14 * adv_mom_5                &
+                            +                  ibit13 * adv_mom_3                    &
                                    ) *                                        &
                                      ( u(k,j+1,i) + u(k,j-2,i) )              &
-                        +      (        ibit14 * adv_mom_5                    &
+                        +      (               ibit14 * adv_mom_5                    &
                                ) *                                            &
                                      ( u(k,j+2,i) + u(k,j-3,i) )              &
@@ -3605,14 +3611,14 @@
 
                 diss_s                  = - ABS ( v_comp_s ) * (              &
-                                   ( 10.0 * ibit14 * adv_mom_5                &
-                                +     3.0 * ibit13 * adv_mom_3                &
-                                +           ibit12 * adv_mom_1                &
+                                   ( 10.0_wp * ibit14 * adv_mom_5                &
+                                +     3.0_wp * ibit13 * adv_mom_3                &
+                                +              ibit12 * adv_mom_1                &
                                    ) *                                        &
                                      ( u(k,j,i)   - u(k,j-1,i) )              &
-                            -      (  5.0 * ibit14 * adv_mom_5                &
-                                +           ibit13 * adv_mom_3                &
+                            -      (  5.0_wp * ibit14 * adv_mom_5                &
+                                +              ibit13 * adv_mom_3                &
                                    ) *                                        &
                                      ( u(k,j+1,i) - u(k,j-2,i) )              &
-                            +      (        ibit14 * adv_mom_5                &
+                            +      (           ibit14 * adv_mom_5                &
                                    ) *                                        &
                                      ( u(k,j+2,i) - u(k,j-3,i) )              &
@@ -3622,14 +3628,14 @@
                 v_comp    = v(k,j+1,i) + v(k,j+1,i-1) - gv
                 flux_n    = v_comp * (                                       &
-                          ( 37.0 * ibit14 * adv_mom_5                        &
-                       +     7.0 * ibit13 * adv_mom_3                        &
-                       +           ibit12 * adv_mom_1                        &
+                          ( 37.0_wp * ibit14 * adv_mom_5                        &
+                       +     7.0_wp * ibit13 * adv_mom_3                        &
+                       +              ibit12 * adv_mom_1                        &
                           ) *                                                &
                                  ( u(k,j+1,i) + u(k,j,i)   )                 &
-                   -      (  8.0 * ibit14 * adv_mom_5                        &
-                       +           ibit13 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit14 * adv_mom_5                        &
+                       +              ibit13 * adv_mom_3                        &
                           ) *                                                &
                                  ( u(k,j+2,i) + u(k,j-1,i) )                 &
-                   +      (        ibit14 * adv_mom_5                        &
+                   +      (           ibit14 * adv_mom_5                        &
                           ) *                                                &
                                  ( u(k,j+3,i) + u(k,j-2,i) )                 &
@@ -3637,14 +3643,14 @@
 
                 diss_n    = - ABS ( v_comp ) * (                             &
-                          ( 10.0 * ibit14 * adv_mom_5                        &
-                       +     3.0 * ibit13 * adv_mom_3                        &
-                       +           ibit12 * adv_mom_1                        &
+                          ( 10.0_wp * ibit14 * adv_mom_5                        &
+                       +     3.0_wp * ibit13 * adv_mom_3                        &
+                       +              ibit12 * adv_mom_1                        &
                           ) *                                                &
                                  ( u(k,j+1,i) - u(k,j,i)  )                  &
-                   -      (  5.0 * ibit14 * adv_mom_5                        &
-                       +           ibit13 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit14 * adv_mom_5                        &
+                       +              ibit13 * adv_mom_3                        &
                           ) *                                                &
                                  ( u(k,j+2,i) - u(k,j-1,i) )                 &
-                   +      (        ibit14 * adv_mom_5                        &
+                   +      (           ibit14 * adv_mom_5                        &
                           ) *                                                &
                                  ( u(k,j+3,i) - u(k,j-2,i) )                 &
@@ -3661,29 +3667,29 @@
                 w_comp    = w(k-1,j,i) + w(k-1,j,i-1)
                 flux_d    = w_comp  * (                                      &
-                          ( 37.0 * ibit17 * adv_mom_5                        &
-                       +     7.0 * ibit16 * adv_mom_3                        &
-                       +           ibit15 * adv_mom_1                        &
+                          ( 37.0_wp * ibit17 * adv_mom_5                        &
+                       +     7.0_wp * ibit16 * adv_mom_3                        &
+                       +              ibit15 * adv_mom_1                        &
                           ) *                                                &
                              ( u(k,j,i)    + u(k-1,j,i)   )                  &
-                   -      (  8.0 * ibit17 * adv_mom_5                        &
-                       +           ibit16 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit17 * adv_mom_5                        &
+                       +              ibit16 * adv_mom_3                        &
                           ) *                                                &
                              ( u(k+1,j,i) + u(k_mm,j,i)   )                  &
-                   +      (        ibit17 * adv_mom_5                        &
-                          ) *                                                &
+                   +      (           ibit17 * adv_mom_5                        &
+                          ) *                                                 &
                              ( u(k_pp,j,i) + u(k_mmm,j,i) )                  &
                                       )
 
                 diss_d    = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit17 * adv_mom_5                        &
-                       +     3.0 * ibit16 * adv_mom_3                        &
-                       +           ibit15 * adv_mom_1                        &
+                          ( 10.0_wp * ibit17 * adv_mom_5                        &
+                       +     3.0_wp * ibit16 * adv_mom_3                        &
+                       +              ibit15 * adv_mom_1                        &
                           ) *                                                &
                              ( u(k,j,i)     - u(k-1,j,i)  )                  &
-                   -      (  5.0 * ibit17 * adv_mom_5                        &
-                       +           ibit16 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit17 * adv_mom_5                        &
+                       +              ibit16 * adv_mom_3                        &
                           ) *                                                &
                              ( u(k+1,j,i)  - u(k_mm,j,i)  )                  &
-                   +      (        ibit17 * adv_mom_5                        &
+                   +      (           ibit17 * adv_mom_5                        &
                            ) *                                               &
                              ( u(k_pp,j,i) - u(k_mmm,j,i) )                  &
@@ -3702,14 +3708,14 @@
                 w_comp    = w(k,j,i) + w(k,j,i-1)
                 flux_t    = w_comp  * (                                      &
-                          ( 37.0 * ibit17 * adv_mom_5                        &
-                       +     7.0 * ibit16 * adv_mom_3                        &
-                       +           ibit15 * adv_mom_1                        &
+                          ( 37.0_wp * ibit17 * adv_mom_5                        &
+                       +     7.0_wp * ibit16 * adv_mom_3                        &
+                       +              ibit15 * adv_mom_1                        &
                           ) *                                                &
                              ( u(k+1,j,i)  + u(k,j,i)     )                  &
-                   -      (  8.0 * ibit17 * adv_mom_5                        &
-                       +           ibit16 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit17 * adv_mom_5                        &
+                       +              ibit16 * adv_mom_3                        &
                           ) *                                                &
                              ( u(k_pp,j,i) + u(k-1,j,i)   )                  &
-                   +      (        ibit17 * adv_mom_5                        &
+                   +      (           ibit17 * adv_mom_5                        &
                           ) *                                                &
                              ( u(k_ppp,j,i) + u(k_mm,j,i) )                  &
@@ -3717,14 +3723,14 @@
 
                 diss_t    = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit17 * adv_mom_5                        &
-                       +     3.0 * ibit16 * adv_mom_3                        &
-                       +           ibit15 * adv_mom_1                        &
+                          ( 10.0_wp * ibit17 * adv_mom_5                        &
+                       +     3.0_wp * ibit16 * adv_mom_3                        &
+                       +              ibit15 * adv_mom_1                        &
                           ) *                                                &
                              ( u(k+1,j,i)   - u(k,j,i)    )                  &
-                   -      (  5.0 * ibit17 * adv_mom_5                        &
-                       +           ibit16 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit17 * adv_mom_5                        &
+                       +              ibit16 * adv_mom_3                        &
                           ) *                                                &
                              ( u(k_pp,j,i)  - u(k-1,j,i)  )                  &
-                   +      (        ibit17 * adv_mom_5                        &
+                   +      (           ibit17 * adv_mom_5                        &
                            ) *                                               &
                              ( u(k_ppp,j,i) - u(k_mm,j,i) )                  &
@@ -3738,5 +3744,5 @@
                      +  ( w_comp      - ( w(k-1,j,i) + w(k-1,j,i-1) ) )        &
                                                                     * ddzw(k)  &
-                      ) * 0.5
+                      ) * 0.5_wp
 
                 tend(k,j,i) = - (                                              &
@@ -3751,8 +3757,8 @@
 !                sums_us2_ws_l(k,tn) = sums_us2_ws_l(k,tn)                     &
 !                              + ( flux_r    *                                 &
-!                                ( u_comp    - 2.0 * hom(k,1,1,0) )            &
+!                                ( u_comp    - 2.0_wp * hom(k,1,1,0) )            &
 !                              / ( u_comp    - gu + 1.0E-20_wp   )             &
 !                              +   diss_r    *                                 &
-!                                  ABS( u_comp    - 2.0 * hom(k,1,1,0) )       &
+!                                  ABS( u_comp    - 2.0_wp * hom(k,1,1,0) )       &
 !                              / ( ABS( u_comp    - gu ) + 1.0E-20_wp ) )      &
 !                              *   weight_substep(intermediate_timestep_count)
@@ -3840,6 +3846,6 @@
        REAL(wp), DIMENSION(nzb:nzt) ::  v_comp !:
 
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
 !
 !--    First compute the whole left boundary of the processor domain
@@ -3854,14 +3860,14 @@
              u_comp                   = u(k,j-1,i) + u(k,j,i) - gu
              swap_flux_x_local_v(k,j) = u_comp * (                             &
-                                      ( 37.0 * ibit20 * adv_mom_5              &
-                                   +     7.0 * ibit19 * adv_mom_3              &
-                                   +           ibit18 * adv_mom_1              &
+                                      ( 37.0_wp * ibit20 * adv_mom_5              &
+                                   +     7.0_wp * ibit19 * adv_mom_3              &
+                                   +              ibit18 * adv_mom_1              &
                                       ) *                                      &
                                      ( v(k,j,i)   + v(k,j,i-1) )               &
-                               -      (  8.0 * ibit20 * adv_mom_5              &
-                                   +           ibit19 * adv_mom_3              &
+                               -      (  8.0_wp * ibit20 * adv_mom_5              &
+                                   +              ibit19 * adv_mom_3              &
                                       ) *                                      &
                                      ( v(k,j,i+1) + v(k,j,i-2) )               &
-                               +      (        ibit20 * adv_mom_5              &
+                               +      (           ibit20 * adv_mom_5              &
                                       ) *                                      &
                                      ( v(k,j,i+2) + v(k,j,i-3) )               &
@@ -3869,14 +3875,14 @@
 
               swap_diss_x_local_v(k,j) = - ABS( u_comp ) * (                   &
-                                      ( 10.0 * ibit20 * adv_mom_5              &
-                                   +     3.0 * ibit19 * adv_mom_3              &
-                                   +           ibit18 * adv_mom_1              &
+                                      ( 10.0_wp * ibit20 * adv_mom_5              &
+                                   +     3.0_wp * ibit19 * adv_mom_3              &
+                                   +              ibit18 * adv_mom_1              &
                                       ) *                                      &
                                      ( v(k,j,i)   - v(k,j,i-1) )               &
-                               -      (  5.0 * ibit20 * adv_mom_5              &
-                                   +           ibit19 * adv_mom_3              &
+                               -      (  5.0_wp * ibit20 * adv_mom_5              &
+                                   +              ibit19 * adv_mom_3              &
                                       ) *                                      &
                                      ( v(k,j,i+1) - v(k,j,i-2) )               &
-                               +      (        ibit20 * adv_mom_5              &
+                               +      (           ibit20 * adv_mom_5              &
                                       ) *                                      &
                                      ( v(k,j,i+2) - v(k,j,i-3) )               &
@@ -3889,11 +3895,11 @@
              u_comp                   = u(k,j-1,i) + u(k,j,i) - gu
              swap_flux_x_local_v(k,j) = u_comp * (                            &
-                             37.0 * ( v(k,j,i) + v(k,j,i-1)   )               &
-                           -  8.0 * ( v(k,j,i+1) + v(k,j,i-2) )               &
-                           +        ( v(k,j,i+2) + v(k,j,i-3) ) ) * adv_mom_5
+                             37.0_wp * ( v(k,j,i) + v(k,j,i-1)   )               &
+                           -  8.0_wp * ( v(k,j,i+1) + v(k,j,i-2) )               &
+                           +           ( v(k,j,i+2) + v(k,j,i-3) ) ) * adv_mom_5
              swap_diss_x_local_v(k,j) = - ABS( u_comp ) * (                   &
-                             10.0 * ( v(k,j,i) - v(k,j,i-1)   )               &
-                           -  5.0 * ( v(k,j,i+1) - v(k,j,i-2) )               &
-                           +        ( v(k,j,i+2) - v(k,j,i-3) ) ) * adv_mom_5
+                             10.0_wp * ( v(k,j,i) - v(k,j,i-1)   )               &
+                           -  5.0_wp * ( v(k,j,i+1) - v(k,j,i-2) )               &
+                           +           ( v(k,j,i+2) - v(k,j,i-3) ) ) * adv_mom_5
 
           ENDDO
@@ -3912,14 +3918,14 @@
              v_comp(k)              = v(k,j,i) + v(k,j-1,i) - gv
              swap_flux_y_local_v(k) = v_comp(k) * (                           &
-                                   ( 37.0 * ibit23 * adv_mom_5                &
-                                +     7.0 * ibit22 * adv_mom_3                &
-                                +           ibit21 * adv_mom_1                &
+                                   ( 37.0_wp * ibit23 * adv_mom_5                &
+                                +     7.0_wp * ibit22 * adv_mom_3                &
+                                +              ibit21 * adv_mom_1                &
                                    ) *                                        &
                                      ( v(k,j,i)   + v(k,j-1,i) )              &
-                            -      (  8.0 * ibit23 * adv_mom_5                &
-                                +           ibit22 * adv_mom_3                &
+                            -      (  8.0_wp * ibit23 * adv_mom_5                &
+                                +              ibit22 * adv_mom_3                &
                                    ) *                                        &
                                      ( v(k,j+1,i) + v(k,j-2,i) )              &
-                            +      (        ibit23 * adv_mom_5                &
+                            +      (           ibit23 * adv_mom_5                &
                                    ) *                                        &
                                      ( v(k,j+2,i) + v(k,j-3,i) )              &
@@ -3927,14 +3933,14 @@
 
              swap_diss_y_local_v(k) = - ABS( v_comp(k) ) * (                  &
-                                   ( 10.0 * ibit23 * adv_mom_5                &
-                                +     3.0 * ibit22 * adv_mom_3                &
-                                +           ibit21 * adv_mom_1                &
+                                   ( 10.0_wp * ibit23 * adv_mom_5                &
+                                +     3.0_wp * ibit22 * adv_mom_3                &
+                                +              ibit21 * adv_mom_1                &
                                    ) *                                        &
                                      ( v(k,j,i)   - v(k,j-1,i) )              &
-                            -      (  5.0 * ibit23 * adv_mom_5                &
-                                +           ibit22 * adv_mom_3                &
+                            -      (  5.0_wp * ibit23 * adv_mom_5                &
+                                +              ibit22 * adv_mom_3                &
                                    ) *                                        &
                                      ( v(k,j+1,i) - v(k,j-2,i) )              &
-                            +      (        ibit23 * adv_mom_5                &
+                            +      (           ibit23 * adv_mom_5                &
                                    ) *                                        &
                                      ( v(k,j+2,i) - v(k,j-3,i) )              &
@@ -3947,11 +3953,11 @@
              v_comp(k)              = v(k,j,i) + v(k,j-1,i) - gv
              swap_flux_y_local_v(k) = v_comp(k) * (                           &
-                           37.0 * ( v(k,j,i) + v(k,j-1,i)   )                 &
-                         -  8.0 * ( v(k,j+1,i) + v(k,j-2,i) )                 &
-                         +        ( v(k,j+2,i) + v(k,j-3,i) ) ) * adv_mom_5
+                           37.0_wp * ( v(k,j,i) + v(k,j-1,i)   )                 &
+                         -  8.0_wp * ( v(k,j+1,i) + v(k,j-2,i) )                 &
+                         +           ( v(k,j+2,i) + v(k,j-3,i) ) ) * adv_mom_5
              swap_diss_y_local_v(k) = - ABS( v_comp(k) ) * (                  &
-                           10.0 * ( v(k,j,i) - v(k,j-1,i)   )                 &
-                         -  5.0 * ( v(k,j+1,i) - v(k,j-2,i) )                 &
-                         +        ( v(k,j+2,i) - v(k,j-3,i) ) ) * adv_mom_5
+                           10.0_wp * ( v(k,j,i) - v(k,j-1,i)   )                 &
+                         -  5.0_wp * ( v(k,j+1,i) - v(k,j-2,i) )                 &
+                         +           ( v(k,j+2,i) - v(k,j-3,i) ) ) * adv_mom_5
 
           ENDDO
@@ -3959,8 +3965,8 @@
           DO  j = nysv, nyn
 
-             flux_t(0) = 0.0
-             diss_t(0) = 0.0
-             flux_d    = 0.0
-             diss_d    = 0.0
+             flux_t(0) = 0.0_wp
+             diss_t(0) = 0.0_wp
+             flux_d    = 0.0_wp
+             diss_d    = 0.0_wp
 
              DO  k = nzb+1, nzb_max
@@ -3972,14 +3978,14 @@
                 u_comp    = u(k,j-1,i+1) + u(k,j,i+1) - gu
                 flux_r(k) = u_comp * (                                       &
-                          ( 37.0 * ibit20 * adv_mom_5                        &
-                       +     7.0 * ibit19 * adv_mom_3                        &
-                       +           ibit18 * adv_mom_1                        &
+                          ( 37.0_wp * ibit20 * adv_mom_5                        &
+                       +     7.0_wp * ibit19 * adv_mom_3                        &
+                       +              ibit18 * adv_mom_1                        &
                           ) *                                                &
                                  ( v(k,j,i+1) + v(k,j,i)   )                 &
-                   -      (  8.0 * ibit20 * adv_mom_5                        &
-                       +           ibit19 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit20 * adv_mom_5                        &
+                       +              ibit19 * adv_mom_3                        &
                           ) *                                                &
                                  ( v(k,j,i+2) + v(k,j,i-1) )                 &
-                   +      (        ibit20 * adv_mom_5                        &
+                   +      (           ibit20 * adv_mom_5                        &
                           ) *                                                &
                                  ( v(k,j,i+3) + v(k,j,i-2) )                 &
@@ -3987,14 +3993,14 @@
 
                 diss_r(k) = - ABS( u_comp ) * (                              &
-                          ( 10.0 * ibit20 * adv_mom_5                        &
-                       +     3.0 * ibit19 * adv_mom_3                        &
-                       +           ibit18 * adv_mom_1                        &
+                          ( 10.0_wp * ibit20 * adv_mom_5                        &
+                       +     3.0_wp * ibit19 * adv_mom_3                        &
+                       +              ibit18 * adv_mom_1                        &
                           ) *                                                &
                                  ( v(k,j,i+1) - v(k,j,i)  )                  &
-                   -      (  5.0 * ibit20 * adv_mom_5                        &
-                       +           ibit19 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit20 * adv_mom_5                        &
+                       +              ibit19 * adv_mom_3                        &
                           ) *                                                &
                                  ( v(k,j,i+2) - v(k,j,i-1) )                 &
-                   +      (        ibit20 * adv_mom_5                        &
+                   +      (           ibit20 * adv_mom_5                        &
                           ) *                                                &
                                  ( v(k,j,i+3) - v(k,j,i-2) )                 &
@@ -4007,14 +4013,14 @@
                 v_comp(k) = v(k,j+1,i) + v(k,j,i)
                 flux_n(k) = ( v_comp(k) - gv ) * (                           &
-                          ( 37.0 * ibit23 * adv_mom_5                        &
-                       +     7.0 * ibit22 * adv_mom_3                        &
-                       +           ibit21 * adv_mom_1                        &
+                          ( 37.0_wp * ibit23 * adv_mom_5                        &
+                       +     7.0_wp * ibit22 * adv_mom_3                        &
+                       +              ibit21 * adv_mom_1                        &
                           ) *                                                &
                                  ( v(k,j+1,i) + v(k,j,i)   )                 &
-                   -      (  8.0 * ibit23 * adv_mom_5                        &
-                       +           ibit22 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit23 * adv_mom_5                        &
+                       +              ibit22 * adv_mom_3                        &
                           ) *                                                &
                                  ( v(k,j+2,i) + v(k,j-1,i) )                 &
-                   +      (        ibit23 * adv_mom_5                        &
+                   +      (           ibit23 * adv_mom_5                        &
                           ) *                                                &
                                  ( v(k,j+3,i) + v(k,j-2,i) )                 &
@@ -4022,14 +4028,14 @@
 
                 diss_n(k) = - ABS( v_comp(k) - gv ) * (                      &
-                          ( 10.0 * ibit23 * adv_mom_5                        &
-                       +     3.0 * ibit22 * adv_mom_3                        &
-                       +           ibit21 * adv_mom_1                        &
+                          ( 10.0_wp * ibit23 * adv_mom_5                        &
+                       +     3.0_wp * ibit22 * adv_mom_3                        &
+                       +              ibit21 * adv_mom_1                        &
                           ) *                                                &
                                  ( v(k,j+1,i) - v(k,j,i)  )                  &
-                   -      (  5.0 * ibit23 * adv_mom_5                        &
-                       +           ibit22 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit23 * adv_mom_5                        &
+                       +              ibit22 * adv_mom_3                        &
                           ) *                                                &
                                  ( v(k,j+2,i) - v(k,j-1,i) )                 &
-                   +      (        ibit23 * adv_mom_5                        &
+                   +      (           ibit23 * adv_mom_5                        &
                           ) *                                                &
                                  ( v(k,j+3,i) - v(k,j-2,i) )                 &
@@ -4048,14 +4054,14 @@
                 w_comp    = w(k,j-1,i) + w(k,j,i)
                 flux_t(k) = w_comp  * (                                      &
-                          ( 37.0 * ibit26 * adv_mom_5                        &
-                       +     7.0 * ibit25 * adv_mom_3                        &
-                       +           ibit24 * adv_mom_1                        &
+                          ( 37.0_wp * ibit26 * adv_mom_5                        &
+                       +     7.0_wp * ibit25 * adv_mom_3                        &
+                       +              ibit24 * adv_mom_1                        &
                           ) *                                                &
                              ( v(k+1,j,i)   + v(k,j,i)    )                  &
-                   -      (  8.0 * ibit26 * adv_mom_5                        &
-                       +           ibit25 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit26 * adv_mom_5                        &
+                       +              ibit25 * adv_mom_3                        &
                           ) *                                                &
                              ( v(k_pp,j,i)  + v(k-1,j,i)  )                  &
-                   +      (        ibit26 * adv_mom_5                        &
+                   +      (           ibit26 * adv_mom_5                        &
                           ) *                                                &
                              ( v(k_ppp,j,i) + v(k_mm,j,i) )                  &
@@ -4063,14 +4069,14 @@
 
                 diss_t(k) = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit26 * adv_mom_5                        &
-                       +     3.0 * ibit25 * adv_mom_3                        &
-                       +           ibit24 * adv_mom_1                        &
+                          ( 10.0_wp * ibit26 * adv_mom_5                        &
+                       +     3.0_wp * ibit25 * adv_mom_3                        &
+                       +              ibit24 * adv_mom_1                        &
                           ) *                                                &
                              ( v(k+1,j,i)   - v(k,j,i)    )                  &
-                   -      (  5.0 * ibit26 * adv_mom_5                        &
-                       +           ibit25 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit26 * adv_mom_5                        &
+                       +              ibit25 * adv_mom_3                        &
                           ) *                                                &
                              ( v(k_pp,j,i)  - v(k-1,j,i)  )                  &
-                   +      (        ibit26 * adv_mom_5                        &
+                   +      (           ibit26 * adv_mom_5                        &
                           ) *                                                &
                              ( v(k_ppp,j,i) - v(k_mm,j,i) )                  &
@@ -4084,5 +4090,5 @@
                      +  ( w_comp      - ( w(k-1,j-1,i) + w(k-1,j,i) )         &
                                                                   ) * ddzw(k) &
-                      ) * 0.5
+                      ) * 0.5_wp
 
                 tend(k,j,i) = tend(k,j,i) - (                                 &
@@ -4110,8 +4116,8 @@
                 sums_vs2_ws_l(k,tn) = sums_vs2_ws_l(k,tn)                     &
                       + ( flux_n(k)                                           &
-                      * ( v_comp(k) - 2.0 * hom(k,1,2,0) )                    &
+                      * ( v_comp(k) - 2.0_wp * hom(k,1,2,0) )                    &
                       / ( v_comp(k) - gv + 1.0E-20_wp )                       &
                       +   diss_n(k)                                           &
-                      *   ABS( v_comp(k) - 2.0 * hom(k,1,2,0) )               &
+                      *   ABS( v_comp(k) - 2.0_wp * hom(k,1,2,0) )               &
                       / ( ABS( v_comp(k) - gv ) +1.0E-20_wp ) )               &
                       *   weight_substep(intermediate_timestep_count)
@@ -4128,24 +4134,24 @@
                 u_comp    = u(k,j-1,i+1) + u(k,j,i+1) - gu
                 flux_r(k) = u_comp * (                                        &
-                      37.0 * ( v(k,j,i+1) + v(k,j,i)   )                      &
-                    -  8.0 * ( v(k,j,i+2) + v(k,j,i-1) )                      &
-                    +        ( v(k,j,i+3) + v(k,j,i-2) ) ) * adv_mom_5
+                      37.0_wp * ( v(k,j,i+1) + v(k,j,i)   )                      &
+                    -  8.0_wp * ( v(k,j,i+2) + v(k,j,i-1) )                      &
+                    +           ( v(k,j,i+3) + v(k,j,i-2) ) ) * adv_mom_5
 
                 diss_r(k) = - ABS( u_comp ) * (                               &
-                      10.0 * ( v(k,j,i+1) - v(k,j,i) )                        &
-                    -  5.0 * ( v(k,j,i+2) - v(k,j,i-1) )                      &
-                    +        ( v(k,j,i+3) - v(k,j,i-2) ) ) * adv_mom_5
+                      10.0_wp * ( v(k,j,i+1) - v(k,j,i) )                        &
+                    -  5.0_wp * ( v(k,j,i+2) - v(k,j,i-1) )                      &
+                    +           ( v(k,j,i+3) - v(k,j,i-2) ) ) * adv_mom_5
 
 
                 v_comp(k) = v(k,j+1,i) + v(k,j,i)
                 flux_n(k) = ( v_comp(k) - gv ) * (                            &
-                      37.0 * ( v(k,j+1,i) + v(k,j,i)   )                      &
-                    -  8.0 * ( v(k,j+2,i) + v(k,j-1,i) )                      &
-                      +      ( v(k,j+3,i) + v(k,j-2,i) ) ) * adv_mom_5
+                      37.0_wp * ( v(k,j+1,i) + v(k,j,i)   )                      &
+                    -  8.0_wp * ( v(k,j+2,i) + v(k,j-1,i) )                      &
+                      +         ( v(k,j+3,i) + v(k,j-2,i) ) ) * adv_mom_5
 
                 diss_n(k) = - ABS( v_comp(k) - gv ) * (                       &
-                      10.0 * ( v(k,j+1,i) - v(k,j,i)   )                      &
-                    -  5.0 * ( v(k,j+2,i) - v(k,j-1,i) )                      &
-                    +        ( v(k,j+3,i) - v(k,j-2,i) ) ) * adv_mom_5
+                      10.0_wp * ( v(k,j+1,i) - v(k,j,i)   )                      &
+                    -  5.0_wp * ( v(k,j+2,i) - v(k,j-1,i) )                      &
+                    +           ( v(k,j+3,i) - v(k,j-2,i) ) ) * adv_mom_5
 !
 !--             k index has to be modified near bottom and top, else array
@@ -4161,14 +4167,14 @@
                 w_comp    = w(k,j-1,i) + w(k,j,i)
                 flux_t(k) = w_comp  * (                                      &
-                          ( 37.0 * ibit26 * adv_mom_5                        &
-                       +     7.0 * ibit25 * adv_mom_3                        &
-                       +           ibit24 * adv_mom_1                        &
+                          ( 37.0_wp * ibit26 * adv_mom_5                        &
+                       +     7.0_wp * ibit25 * adv_mom_3                        &
+                       +              ibit24 * adv_mom_1                        &
                           ) *                                                &
                              ( v(k+1,j,i)   + v(k,j,i)    )                  &
-                   -      (  8.0 * ibit26 * adv_mom_5                        &
-                       +           ibit25 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit26 * adv_mom_5                        &
+                       +              ibit25 * adv_mom_3                        &
                           ) *                                                &
                              ( v(k_pp,j,i)  + v(k-1,j,i)  )                  &
-                   +      (        ibit26 * adv_mom_5                        &
+                   +      (           ibit26 * adv_mom_5                        &
                           ) *                                                &
                              ( v(k_ppp,j,i) + v(k_mm,j,i) )                  &
@@ -4176,14 +4182,14 @@
 
                 diss_t(k) = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit26 * adv_mom_5                        &
-                       +     3.0 * ibit25 * adv_mom_3                        &
-                       +           ibit24 * adv_mom_1                        &
+                          ( 10.0_wp * ibit26 * adv_mom_5                        &
+                       +     3.0_wp * ibit25 * adv_mom_3                        &
+                       +              ibit24 * adv_mom_1                        &
                           ) *                                                &
                              ( v(k+1,j,i)   - v(k,j,i)    )                  &
-                   -      (  5.0 * ibit26 * adv_mom_5                        &
-                       +           ibit25 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit26 * adv_mom_5                        &
+                       +              ibit25 * adv_mom_3                        &
                           ) *                                                &
                              ( v(k_pp,j,i)  - v(k-1,j,i)  )                  &
-                   +      (        ibit26 * adv_mom_5                        &
+                   +      (           ibit26 * adv_mom_5                        &
                           ) *                                                &
                              ( v(k_ppp,j,i) - v(k_mm,j,i) )                  &
@@ -4197,5 +4203,5 @@
                      +  ( w_comp      - ( w(k-1,j-1,i) + w(k-1,j,i) ) )       &
                                                                     * ddzw(k) &
-                      ) * 0.5
+                      ) * 0.5_wp
  
                 tend(k,j,i) = tend(k,j,i) - (                                 &
@@ -4223,8 +4229,8 @@
                 sums_vs2_ws_l(k,tn) = sums_vs2_ws_l(k,tn)                     &
                          + ( flux_n(k)                                        &
-                         * ( v_comp(k) - 2.0 * hom(k,1,2,0) )                 &
+                         * ( v_comp(k) - 2.0_wp * hom(k,1,2,0) )                 &
                          / ( v_comp(k) - gv + 1.0E-20_wp )                    &
                          +   diss_n(k)                                        &
-                         *   ABS( v_comp(k) - 2.0 * hom(k,1,2,0) )            &
+                         *   ABS( v_comp(k) - 2.0_wp * hom(k,1,2,0) )            &
                          / ( ABS( v_comp(k) - gv ) +1.0E-20_wp ) )            &
                          *   weight_substep(intermediate_timestep_count)
@@ -4312,6 +4318,6 @@
        REAL(wp)    ::  w_comp   !:
 
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
 
 !
@@ -4328,14 +4334,14 @@
                 u_comp_l                 = u(k,j-1,i) + u(k,j,i) - gu
                 flux_l                   = u_comp_l * (                          &
-                                      ( 37.0 * ibit20 * adv_mom_5              &
-                                   +     7.0 * ibit19 * adv_mom_3              &
-                                   +           ibit18 * adv_mom_1              &
+                                      ( 37.0_wp * ibit20 * adv_mom_5              &
+                                   +     7.0_wp * ibit19 * adv_mom_3              &
+                                   +              ibit18 * adv_mom_1              &
                                       ) *                                      &
                                      ( v(k,j,i)   + v(k,j,i-1) )               &
-                               -      (  8.0 * ibit20 * adv_mom_5              &
-                                   +           ibit19 * adv_mom_3              &
+                               -      (  8.0_wp * ibit20 * adv_mom_5              &
+                                   +              ibit19 * adv_mom_3              &
                                       ) *                                      &
                                      ( v(k,j,i+1) + v(k,j,i-2) )               &
-                               +      (        ibit20 * adv_mom_5              &
+                               +      (           ibit20 * adv_mom_5              &
                                       ) *                                      &
                                      ( v(k,j,i+2) + v(k,j,i-3) )               &
@@ -4343,14 +4349,14 @@
 
                 diss_l                   = - ABS( u_comp_l ) * (                 &
-                                      ( 10.0 * ibit20 * adv_mom_5              &
-                                   +     3.0 * ibit19 * adv_mom_3              &
-                                   +           ibit18 * adv_mom_1              &
+                                      ( 10.0_wp * ibit20 * adv_mom_5              &
+                                   +     3.0_wp * ibit19 * adv_mom_3              &
+                                   +              ibit18 * adv_mom_1              &
                                       ) *                                      &
                                      ( v(k,j,i)   - v(k,j,i-1) )               &
-                               -      (  5.0 * ibit20 * adv_mom_5              &
-                                   +           ibit19 * adv_mom_3              &
+                               -      (  5.0_wp * ibit20 * adv_mom_5              &
+                                   +              ibit19 * adv_mom_3              &
                                       ) *                                      &
                                      ( v(k,j,i+1) - v(k,j,i-2) )               &
-                               +      (        ibit20 * adv_mom_5              &
+                               +      (           ibit20 * adv_mom_5              &
                                       ) *                                      &
                                      ( v(k,j,i+2) - v(k,j,i-3) )               &
@@ -4359,14 +4365,14 @@
                 u_comp    = u(k,j-1,i+1) + u(k,j,i+1) - gu
                 flux_r    = u_comp * (                                       &
-                          ( 37.0 * ibit20 * adv_mom_5                        &
-                       +     7.0 * ibit19 * adv_mom_3                        &
-                       +           ibit18 * adv_mom_1                        &
+                          ( 37.0_wp * ibit20 * adv_mom_5                        &
+                       +     7.0_wp * ibit19 * adv_mom_3                        &
+                       +              ibit18 * adv_mom_1                        &
                           ) *                                                &
                                  ( v(k,j,i+1) + v(k,j,i)   )                 &
-                   -      (  8.0 * ibit20 * adv_mom_5                        &
-                       +           ibit19 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit20 * adv_mom_5                        &
+                       +              ibit19 * adv_mom_3                        &
                           ) *                                                &
                                  ( v(k,j,i+2) + v(k,j,i-1) )                 &
-                   +      (        ibit20 * adv_mom_5                        &
+                   +      (           ibit20 * adv_mom_5                        &
                           ) *                                                &
                                  ( v(k,j,i+3) + v(k,j,i-2) )                 &
@@ -4374,14 +4380,14 @@
 
                 diss_r    = - ABS( u_comp ) * (                              &
-                          ( 10.0 * ibit20 * adv_mom_5                        &
-                       +     3.0 * ibit19 * adv_mom_3                        &
-                       +           ibit18 * adv_mom_1                        &
+                          ( 10.0_wp * ibit20 * adv_mom_5                        &
+                       +     3.0_wp * ibit19 * adv_mom_3                        &
+                       +              ibit18 * adv_mom_1                        &
                           ) *                                                &
                                  ( v(k,j,i+1) - v(k,j,i)  )                  &
-                   -      (  5.0 * ibit20 * adv_mom_5                        &
-                       +           ibit19 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit20 * adv_mom_5                        &
+                       +              ibit19 * adv_mom_3                        &
                           ) *                                                &
                                  ( v(k,j,i+2) - v(k,j,i-1) )                 &
-                   +      (        ibit20 * adv_mom_5                        &
+                   +      (           ibit20 * adv_mom_5                        &
                           ) *                                                &
                                  ( v(k,j,i+3) - v(k,j,i-2) )                 &
@@ -4395,14 +4401,14 @@
                 v_comp_s              = v(k,j,i) + v(k,j-1,i) - gv
                 flux_s                = v_comp_s    * (                       &
-                                   ( 37.0 * ibit23 * adv_mom_5                &
-                                +     7.0 * ibit22 * adv_mom_3                &
-                                +           ibit21 * adv_mom_1                &
+                                   ( 37.0_wp * ibit23 * adv_mom_5                &
+                                +     7.0_wp * ibit22 * adv_mom_3                &
+                                +              ibit21 * adv_mom_1                &
                                    ) *                                        &
                                      ( v(k,j,i)   + v(k,j-1,i) )              &
-                            -      (  8.0 * ibit23 * adv_mom_5                &
-                                +           ibit22 * adv_mom_3                &
+                            -      (  8.0_wp * ibit23 * adv_mom_5                &
+                                +              ibit22 * adv_mom_3                &
                                    ) *                                        &
                                      ( v(k,j+1,i) + v(k,j-2,i) )              &
-                            +      (        ibit23 * adv_mom_5                &
+                            +      (           ibit23 * adv_mom_5                &
                                    ) *                                        &
                                      ( v(k,j+2,i) + v(k,j-3,i) )              &
@@ -4410,14 +4416,14 @@
 
                 diss_s                = - ABS( v_comp_s ) * (                 &
-                                   ( 10.0 * ibit23 * adv_mom_5                &
-                                +     3.0 * ibit22 * adv_mom_3                &
-                                +           ibit21 * adv_mom_1                &
+                                   ( 10.0_wp * ibit23 * adv_mom_5                &
+                                +     3.0_wp * ibit22 * adv_mom_3                &
+                                +              ibit21 * adv_mom_1                &
                                    ) *                                        &
                                      ( v(k,j,i)   - v(k,j-1,i) )              &
-                            -      (  5.0 * ibit23 * adv_mom_5                &
-                                +           ibit22 * adv_mom_3                &
+                            -      (  5.0_wp * ibit23 * adv_mom_5                &
+                                +              ibit22 * adv_mom_3                &
                                    ) *                                        &
                                      ( v(k,j+1,i) - v(k,j-2,i) )              &
-                            +      (        ibit23 * adv_mom_5                &
+                            +      (           ibit23 * adv_mom_5                &
                                    ) *                                        &
                                      ( v(k,j+2,i) - v(k,j-3,i) )              &
@@ -4426,14 +4432,14 @@
                 v_comp = v(k,j+1,i) + v(k,j,i)
                 flux_n = ( v_comp - gv ) * (                                 &
-                          ( 37.0 * ibit23 * adv_mom_5                        &
-                       +     7.0 * ibit22 * adv_mom_3                        &
-                       +           ibit21 * adv_mom_1                        &
+                          ( 37.0_wp * ibit23 * adv_mom_5                        &
+                       +     7.0_wp * ibit22 * adv_mom_3                        &
+                       +              ibit21 * adv_mom_1                        &
                           ) *                                                &
                                  ( v(k,j+1,i) + v(k,j,i)   )                 &
-                   -      (  8.0 * ibit23 * adv_mom_5                        &
-                       +           ibit22 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit23 * adv_mom_5                        &
+                       +              ibit22 * adv_mom_3                        &
                           ) *                                                &
                                  ( v(k,j+2,i) + v(k,j-1,i) )                 &
-                   +      (        ibit23 * adv_mom_5                        &
+                   +      (           ibit23 * adv_mom_5                        &
                           ) *                                                &
                                  ( v(k,j+3,i) + v(k,j-2,i) )                 &
@@ -4441,14 +4447,14 @@
 
                 diss_n = - ABS( v_comp - gv ) * (                         &
-                          ( 10.0 * ibit23 * adv_mom_5                        &
-                       +     3.0 * ibit22 * adv_mom_3                        &
-                       +           ibit21 * adv_mom_1                        &
+                          ( 10.0_wp * ibit23 * adv_mom_5                        &
+                       +     3.0_wp * ibit22 * adv_mom_3                        &
+                       +              ibit21 * adv_mom_1                        &
                           ) *                                                &
                                  ( v(k,j+1,i) - v(k,j,i)  )                  &
-                   -      (  5.0 * ibit23 * adv_mom_5                        &
-                       +           ibit22 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit23 * adv_mom_5                        &
+                       +              ibit22 * adv_mom_3                        &
                           ) *                                                &
                                  ( v(k,j+2,i) - v(k,j-1,i) )                 &
-                   +      (        ibit23 * adv_mom_5                        &
+                   +      (           ibit23 * adv_mom_5                        &
                           ) *                                                &
                                  ( v(k,j+3,i) - v(k,j-2,i) )                 &
@@ -4465,14 +4471,14 @@
                 w_comp    = w(k-1,j-1,i) + w(k-1,j,i)
                 flux_d    = w_comp  * (                                      &
-                          ( 37.0 * ibit26 * adv_mom_5                        &
-                       +     7.0 * ibit25 * adv_mom_3                        &
-                       +           ibit24 * adv_mom_1                        &
+                          ( 37.0_wp * ibit26 * adv_mom_5                        &
+                       +     7.0_wp * ibit25 * adv_mom_3                        &
+                       +              ibit24 * adv_mom_1                        &
                           ) *                                                &
                              ( v(k,j,i)     + v(k-1,j,i)  )                  &
-                   -      (  8.0 * ibit26 * adv_mom_5                        &
-                       +           ibit25 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit26 * adv_mom_5                        &
+                       +              ibit25 * adv_mom_3                        &
                           ) *                                                &
                              ( v(k+1,j,i)  + v(k_mm,j,i)  )                  &
-                   +      (        ibit26 * adv_mom_5                        &
+                   +      (           ibit26 * adv_mom_5                        &
                           ) *                                                &
                              ( v(k_pp,j,i) + v(k_mmm,j,i) )                  &
@@ -4480,14 +4486,14 @@
 
                 diss_d    = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit26 * adv_mom_5                        &
-                       +     3.0 * ibit25 * adv_mom_3                        &
-                       +           ibit24 * adv_mom_1                        &
+                          ( 10.0_wp * ibit26 * adv_mom_5                        &
+                       +     3.0_wp * ibit25 * adv_mom_3                        &
+                       +              ibit24 * adv_mom_1                        &
                           ) *                                                &
                              ( v(k,j,i)     - v(k-1,j,i)  )                  &
-                   -      (  5.0 * ibit26 * adv_mom_5                        &
-                       +           ibit25 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit26 * adv_mom_5                        &
+                       +              ibit25 * adv_mom_3                        &
                           ) *                                                &
                              ( v(k+1,j,i)  - v(k_mm,j,i)  )                  &
-                   +      (        ibit26 * adv_mom_5                        &
+                   +      (           ibit26 * adv_mom_5                        &
                           ) *                                                &
                              ( v(k_pp,j,i) - v(k_mmm,j,i) )                  &
@@ -4506,14 +4512,14 @@
                 w_comp    = w(k,j-1,i) + w(k,j,i)
                 flux_t    = w_comp  * (                                      &
-                          ( 37.0 * ibit26 * adv_mom_5                        &
-                       +     7.0 * ibit25 * adv_mom_3                        &
-                       +           ibit24 * adv_mom_1                        &
+                          ( 37.0_wp * ibit26 * adv_mom_5                        &
+                       +     7.0_wp * ibit25 * adv_mom_3                        &
+                       +              ibit24 * adv_mom_1                        &
                           ) *                                                &
                              ( v(k+1,j,i)   + v(k,j,i)    )                  &
-                   -      (  8.0 * ibit26 * adv_mom_5                        &
-                       +           ibit25 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit26 * adv_mom_5                        &
+                       +              ibit25 * adv_mom_3                        &
                           ) *                                                &
                              ( v(k_pp,j,i)  + v(k-1,j,i)  )                  &
-                   +      (        ibit26 * adv_mom_5                        &
+                   +      (           ibit26 * adv_mom_5                        &
                           ) *                                                &
                              ( v(k_ppp,j,i) + v(k_mm,j,i) )                  &
@@ -4521,14 +4527,14 @@
 
                 diss_t    = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit26 * adv_mom_5                        &
-                       +     3.0 * ibit25 * adv_mom_3                        &
-                       +           ibit24 * adv_mom_1                        &
+                          ( 10.0_wp * ibit26 * adv_mom_5                        &
+                       +     3.0_wp * ibit25 * adv_mom_3                        &
+                       +              ibit24 * adv_mom_1                        &
                           ) *                                                &
                              ( v(k+1,j,i)   - v(k,j,i)    )                  &
-                   -      (  5.0 * ibit26 * adv_mom_5                        &
-                       +           ibit25 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit26 * adv_mom_5                        &
+                       +              ibit25 * adv_mom_3                        &
                           ) *                                                &
                              ( v(k_pp,j,i)  - v(k-1,j,i)  )                  &
-                   +      (        ibit26 * adv_mom_5                        &
+                   +      (           ibit26 * adv_mom_5                        &
                           ) *                                                &
                              ( v(k_ppp,j,i) - v(k_mm,j,i) )                  &
@@ -4542,5 +4548,5 @@
                      +  ( w_comp      - ( w(k-1,j-1,i) + w(k-1,j,i) )         &
                                                                   ) * ddzw(k) &
-                      ) * 0.5
+                      ) * 0.5_wp
 
                 tend(k,j,i) = - (                                              &
@@ -4556,8 +4562,8 @@
 !                sums_vs2_ws_l(k,tn) = sums_vs2_ws_l(k,tn)                  &
 !                      + ( flux_n                                           &
-!                      * ( v_comp - 2.0 * hom(k,1,2,0) )                    &
+!                      * ( v_comp - 2.0_wp * hom(k,1,2,0) )                    &
 !                      / ( v_comp - gv + 1.0E-20_wp )                       &
 !                      +   diss_n                                           &
-!                      *   ABS( v_comp - 2.0 * hom(k,1,2,0) )               &
+!                      *   ABS( v_comp - 2.0_wp * hom(k,1,2,0) )               &
 !                      / ( ABS( v_comp - gv ) +1.0E-20_wp ) )               &
 !                      *   weight_substep(intermediate_timestep_count)
@@ -4646,6 +4652,6 @@
        REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  swap_flux_x_local_w !:
  
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
 !
 !--   compute the whole left boundary of the processor domain
@@ -4660,14 +4666,14 @@
              u_comp                   = u(k+1,j,i) + u(k,j,i) - gu
              swap_flux_x_local_w(k,j) = u_comp * (                             &
-                                      ( 37.0 * ibit29 * adv_mom_5              &
-                                   +     7.0 * ibit28 * adv_mom_3              &
-                                   +           ibit27 * adv_mom_1              &
+                                      ( 37.0_wp * ibit29 * adv_mom_5              &
+                                   +     7.0_wp * ibit28 * adv_mom_3              &
+                                   +              ibit27 * adv_mom_1              &
                                       ) *                                      &
                                      ( w(k,j,i)   + w(k,j,i-1) )               &
-                               -      (  8.0 * ibit29 * adv_mom_5              &
-                                   +           ibit28 * adv_mom_3              &
+                               -      (  8.0_wp * ibit29 * adv_mom_5              &
+                                   +              ibit28 * adv_mom_3              &
                                       ) *                                      &
                                      ( w(k,j,i+1) + w(k,j,i-2) )               &
-                               +      (        ibit29 * adv_mom_5              &
+                               +      (           ibit29 * adv_mom_5              &
                                       ) *                                      &
                                      ( w(k,j,i+2) + w(k,j,i-3) )               &
@@ -4675,14 +4681,14 @@
 
                swap_diss_x_local_w(k,j) = - ABS( u_comp ) * (                  &
-                                        ( 10.0 * ibit29 * adv_mom_5            &
-                                     +     3.0 * ibit28 * adv_mom_3            &
-                                     +           ibit27 * adv_mom_1            &
+                                        ( 10.0_wp * ibit29 * adv_mom_5            &
+                                     +     3.0_wp * ibit28 * adv_mom_3            &
+                                     +              ibit27 * adv_mom_1            &
                                         ) *                                    &
                                      ( w(k,j,i)   - w(k,j,i-1) )               &
-                                 -      (  5.0 * ibit29 * adv_mom_5            &
-                                     +           ibit28 * adv_mom_3            &
+                                 -      (  5.0_wp * ibit29 * adv_mom_5            &
+                                     +              ibit28 * adv_mom_3            &
                                         ) *                                    &
                                      ( w(k,j,i+1) - w(k,j,i-2) )               &
-                                 +      (        ibit29 * adv_mom_5            &
+                                 +      (           ibit29 * adv_mom_5            &
                                         ) *                                    &
                                      ( w(k,j,i+2) - w(k,j,i-3) )               &
@@ -4695,11 +4701,11 @@
              u_comp                   = u(k+1,j,i) + u(k,j,i) - gu
              swap_flux_x_local_w(k,j) = u_comp * (                             &
-                            37.0 * ( w(k,j,i) + w(k,j,i-1)   )                 &
-                          -  8.0 * ( w(k,j,i+1) + w(k,j,i-2) )                 &
-                          +        ( w(k,j,i+2) + w(k,j,i-3) ) ) * adv_mom_5
+                            37.0_wp * ( w(k,j,i) + w(k,j,i-1)   )                 &
+                          -  8.0_wp * ( w(k,j,i+1) + w(k,j,i-2) )                 &
+                          +           ( w(k,j,i+2) + w(k,j,i-3) ) ) * adv_mom_5
              swap_diss_x_local_w(k,j) = - ABS( u_comp ) * (                    &
-                            10.0 * ( w(k,j,i) - w(k,j,i-1)   )                 &
-                          -  5.0 * ( w(k,j,i+1) - w(k,j,i-2) )                 &
-                          +        ( w(k,j,i+2) - w(k,j,i-3) ) ) * adv_mom_5
+                            10.0_wp * ( w(k,j,i) - w(k,j,i-1)   )                 &
+                          -  5.0_wp * ( w(k,j,i+1) - w(k,j,i-2) )                 &
+                          +           ( w(k,j,i+2) - w(k,j,i-3) ) ) * adv_mom_5
 
           ENDDO
@@ -4718,14 +4724,14 @@
              v_comp                 = v(k+1,j,i) + v(k,j,i) - gv
              swap_flux_y_local_w(k) = v_comp * (                              &
-                                    ( 37.0 * ibit32 * adv_mom_5               &
-                                 +     7.0 * ibit31 * adv_mom_3               &
-                                 +           ibit30 * adv_mom_1               &
-                                    ) *                                       &
+                                    ( 37.0_wp * ibit32 * adv_mom_5               &
+                                 +     7.0_wp * ibit31 * adv_mom_3               &
+                                 +              ibit30 * adv_mom_1               &
+                                    ) *                                        &
                                      ( w(k,j,i)   + w(k,j-1,i) )              &
-                             -      (  8.0 * ibit32 * adv_mom_5               &
-                                 +           ibit31 * adv_mom_3               &
+                             -      (  8.0_wp * ibit32 * adv_mom_5               &
+                                 +              ibit31 * adv_mom_3               &
                                     ) *                                       &
                                      ( w(k,j+1,i) + w(k,j-2,i) )              &
-                             +      (        ibit32 * adv_mom_5               &
+                             +      (           ibit32 * adv_mom_5               &
                                     ) *                                       &
                                      ( w(k,j+2,i) + w(k,j-3,i) )              &
@@ -4733,14 +4739,14 @@
 
              swap_diss_y_local_w(k) = - ABS( v_comp ) * (                     &
-                                    ( 10.0 * ibit32 * adv_mom_5               &
-                                 +     3.0 * ibit31 * adv_mom_3               &
-                                 +           ibit30 * adv_mom_1               &
+                                    ( 10.0_wp * ibit32 * adv_mom_5               &
+                                 +     3.0_wp * ibit31 * adv_mom_3               &
+                                 +              ibit30 * adv_mom_1               &
                                     ) *                                       &
                                      ( w(k,j,i)   - w(k,j-1,i) )              &
-                             -      (  5.0 * ibit32 * adv_mom_5               &
-                                 +           ibit31 * adv_mom_3               &
+                             -      (  5.0_wp * ibit32 * adv_mom_5               &
+                                 +              ibit31 * adv_mom_3               &
                                     ) *                                       &
                                      ( w(k,j+1,i) - w(k,j-2,i) )              &
-                             +      (        ibit32 * adv_mom_5               &
+                             +      (           ibit32 * adv_mom_5               &
                                     ) *                                       &
                                      ( w(k,j+2,i) - w(k,j-3,i) )              &
@@ -4753,11 +4759,11 @@
              v_comp                 = v(k+1,j,i) + v(k,j,i) - gv
              swap_flux_y_local_w(k) = v_comp * (                              &
-                           37.0 * ( w(k,j,i) + w(k,j-1,i)   )                 &
-                         -  8.0 * ( w(k,j+1,i) +w(k,j-2,i)  )                 &
-                         +        ( w(k,j+2,i) + w(k,j-3,i) ) ) * adv_mom_5
+                           37.0_wp * ( w(k,j,i) + w(k,j-1,i)   )                 &
+                         -  8.0_wp * ( w(k,j+1,i) +w(k,j-2,i)  )                 &
+                         +           ( w(k,j+2,i) + w(k,j-3,i) ) ) * adv_mom_5
              swap_diss_y_local_w(k) = - ABS( v_comp ) * (                     &
-                           10.0 * ( w(k,j,i) - w(k,j-1,i)   )                 &
-                         -  5.0 * ( w(k,j+1,i) - w(k,j-2,i) )                 &
-                         +        ( w(k,j+2,i) - w(k,j-3,i) ) ) * adv_mom_5
+                           10.0_wp * ( w(k,j,i) - w(k,j-1,i)   )                 &
+                         -  5.0_wp * ( w(k,j+1,i) - w(k,j-2,i) )                 &
+                         +           ( w(k,j+2,i) - w(k,j-3,i) ) ) * adv_mom_5
 
           ENDDO
@@ -4784,14 +4790,14 @@
                 u_comp    = u(k+1,j,i+1) + u(k,j,i+1) - gu
                 flux_r(k) = u_comp * (                                       &
-                          ( 37.0 * ibit29 * adv_mom_5                        &
-                       +     7.0 * ibit28 * adv_mom_3                        &
-                       +           ibit27 * adv_mom_1                        &
+                          ( 37.0_wp * ibit29 * adv_mom_5                        &
+                       +     7.0_wp * ibit28 * adv_mom_3                        &
+                       +              ibit27 * adv_mom_1                        &
                           ) *                                                &
                                  ( w(k,j,i+1) + w(k,j,i)   )                 &
-                   -      (  8.0 * ibit29 * adv_mom_5                        &
-                       +           ibit28 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit29 * adv_mom_5                        &
+                       +              ibit28 * adv_mom_3                        &
                           ) *                                                &
                                  ( w(k,j,i+2) + w(k,j,i-1) )                 &
-                   +      (        ibit29 * adv_mom_5                        &
+                   +      (           ibit29 * adv_mom_5                        &
                           ) *                                                &
                                  ( w(k,j,i+3) + w(k,j,i-2) )                 &
@@ -4799,14 +4805,14 @@
 
                 diss_r(k) = - ABS( u_comp ) * (                              &
-                          ( 10.0 * ibit29 * adv_mom_5                        &
-                       +     3.0 * ibit28 * adv_mom_3                        &
-                       +           ibit27 * adv_mom_1                        &
+                          ( 10.0_wp * ibit29 * adv_mom_5                        &
+                       +     3.0_wp * ibit28 * adv_mom_3                        &
+                       +              ibit27 * adv_mom_1                        &
                           ) *                                                &
                                  ( w(k,j,i+1) - w(k,j,i)  )                  &
-                   -      (  5.0 * ibit29 * adv_mom_5                        &
-                       +           ibit28 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit29 * adv_mom_5                        &
+                       +              ibit28 * adv_mom_3                        &
                           ) *                                                &
                                  ( w(k,j,i+2) - w(k,j,i-1) )                 &
-                   +      (        ibit29 * adv_mom_5                        &
+                   +      (           ibit29 * adv_mom_5                        &
                           ) *                                                &
                                  ( w(k,j,i+3) - w(k,j,i-2) )                 &
@@ -4819,14 +4825,14 @@
                 v_comp    = v(k+1,j+1,i) + v(k,j+1,i) - gv
                 flux_n(k) = v_comp * (                                       &
-                          ( 37.0 * ibit32 * adv_mom_5                        &
-                       +     7.0 * ibit31 * adv_mom_3                        &
-                       +           ibit30 * adv_mom_1                        &
+                          ( 37.0_wp * ibit32 * adv_mom_5                        &
+                       +     7.0_wp * ibit31 * adv_mom_3                        &
+                       +              ibit30 * adv_mom_1                        &
                           ) *                                                &
                                  ( w(k,j+1,i) + w(k,j,i)   )                 &
-                   -      (  8.0 * ibit32 * adv_mom_5                        &
-                       +           ibit31 * adv_mom_3                        &
-                          ) *                                                &
+                   -      (  8.0_wp * ibit32 * adv_mom_5                        &
+                       +              ibit31 * adv_mom_3                        &
+                          ) *                                                 &
                                  ( w(k,j+2,i) + w(k,j-1,i) )                 &
-                   +      (        ibit32 * adv_mom_5                        &
+                   +      (           ibit32 * adv_mom_5                        &
                           ) *                                                &
                                  ( w(k,j+3,i) + w(k,j-2,i) )                 &
@@ -4834,14 +4840,14 @@
 
                 diss_n(k) = - ABS( v_comp ) * (                              &
-                          ( 10.0 * ibit32 * adv_mom_5                        &
-                       +     3.0 * ibit31 * adv_mom_3                        &
-                       +           ibit30 * adv_mom_1                        &
+                          ( 10.0_wp * ibit32 * adv_mom_5                        &
+                       +     3.0_wp * ibit31 * adv_mom_3                        &
+                       +              ibit30 * adv_mom_1                        &
                           ) *                                                &
                                  ( w(k,j+1,i) - w(k,j,i)  )                  &
-                   -      (  5.0 * ibit32 * adv_mom_5                        &
-                       +           ibit31 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit32 * adv_mom_5                        &
+                       +              ibit31 * adv_mom_3                        &
                           ) *                                                &
                                  ( w(k,j+2,i) - w(k,j-1,i) )                 &
-                   +      (        ibit32 * adv_mom_5                        &
+                   +      (           ibit32 * adv_mom_5                        &
                           ) *                                                &
                                  ( w(k,j+3,i) - w(k,j-2,i) )                 &
@@ -4860,14 +4866,14 @@
                 w_comp    = w(k+1,j,i) + w(k,j,i)
                 flux_t(k) = w_comp  * (                                      &
-                          ( 37.0 * ibit35 * adv_mom_5                        &
-                       +     7.0 * ibit34 * adv_mom_3                        &
-                       +           ibit33 * adv_mom_1                        &
+                          ( 37.0_wp * ibit35 * adv_mom_5                        &
+                       +     7.0_wp * ibit34 * adv_mom_3                        &
+                       +              ibit33 * adv_mom_1                        &
                           ) *                                                &
                              ( w(k+1,j,i)  + w(k,j,i)     )                  &
-                   -      (  8.0 * ibit35 * adv_mom_5                        &
-                       +           ibit34 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit35 * adv_mom_5                        &
+                       +              ibit34 * adv_mom_3                        &
                           ) *                                                &
                              ( w(k_pp,j,i)  + w(k-1,j,i)  )                  &
-                   +      (        ibit35 * adv_mom_5                        &
+                   +      (           ibit35 * adv_mom_5                        &
                           ) *                                                &
                              ( w(k_ppp,j,i) + w(k_mm,j,i) )                  &
@@ -4875,14 +4881,14 @@
 
                 diss_t(k) = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit35 * adv_mom_5                        &
-                       +     3.0 * ibit34 * adv_mom_3                        &
-                       +           ibit33 * adv_mom_1                        &
+                          ( 10.0_wp * ibit35 * adv_mom_5                        &
+                       +     3.0_wp * ibit34 * adv_mom_3                        &
+                       +              ibit33 * adv_mom_1                        &
                           ) *                                                &
                              ( w(k+1,j,i)   - w(k,j,i)    )                  &
-                   -      (  5.0 * ibit35 * adv_mom_5                        &
-                       +           ibit34 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit35 * adv_mom_5                        &
+                       +              ibit34 * adv_mom_3                        &
                           ) *                                                &
                              ( w(k_pp,j,i)  - w(k-1,j,i)  )                  &
-                   +      (        ibit35 * adv_mom_5                        &
+                   +      (           ibit35 * adv_mom_5                        &
                           ) *                                                &
                              ( w(k_ppp,j,i) - w(k_mm,j,i) )                  &
@@ -4896,5 +4902,5 @@
                     +   ( w_comp      - ( w(k,j,i)   + w(k-1,j,i) ) )        &
                                                                  * ddzu(k+1) &
-                      ) * 0.5
+                      ) * 0.5_wp
 
                 tend(k,j,i) = tend(k,j,i) - (                                 &
@@ -4927,23 +4933,23 @@
                 u_comp    = u(k+1,j,i+1) + u(k,j,i+1) - gu
                 flux_r(k) = u_comp * (                                      &
-                      37.0 * ( w(k,j,i+1) + w(k,j,i)   )                    &
-                    -  8.0 * ( w(k,j,i+2) + w(k,j,i-1) )                    &
-                    +        ( w(k,j,i+3) + w(k,j,i-2) ) ) * adv_mom_5
+                      37.0_wp * ( w(k,j,i+1) + w(k,j,i)   )                    &
+                    -  8.0_wp * ( w(k,j,i+2) + w(k,j,i-1) )                    &
+                    +           ( w(k,j,i+3) + w(k,j,i-2) ) ) * adv_mom_5
 
                 diss_r(k) = - ABS( u_comp ) * (                             &
-                      10.0 * ( w(k,j,i+1) - w(k,j,i)   )                    &
-                    -  5.0 * ( w(k,j,i+2) - w(k,j,i-1) )                    &
-                    +        ( w(k,j,i+3) - w(k,j,i-2) ) ) * adv_mom_5
+                      10.0_wp * ( w(k,j,i+1) - w(k,j,i)   )                    &
+                    -  5.0_wp * ( w(k,j,i+2) - w(k,j,i-1) )                    &
+                    +           ( w(k,j,i+3) - w(k,j,i-2) ) ) * adv_mom_5
 
                 v_comp    = v(k+1,j+1,i) + v(k,j+1,i) - gv
                 flux_n(k) = v_comp * (                                      &
-                      37.0 * ( w(k,j+1,i) + w(k,j,i)   )                    &
-                    -  8.0 * ( w(k,j+2,i) + w(k,j-1,i) )                    &
-                    +        ( w(k,j+3,i) + w(k,j-2,i) ) ) * adv_mom_5
+                      37.0_wp * ( w(k,j+1,i) + w(k,j,i)   )                    &
+                    -  8.0_wp * ( w(k,j+2,i) + w(k,j-1,i) )                    &
+                    +           ( w(k,j+3,i) + w(k,j-2,i) ) ) * adv_mom_5
 
                 diss_n(k) = - ABS( v_comp ) * (                             &
-                      10.0 * ( w(k,j+1,i) - w(k,j,i)   )                    &
-                    -  5.0 * ( w(k,j+2,i) - w(k,j-1,i) )                    &
-                    +        ( w(k,j+3,i) - w(k,j-2,i) ) ) * adv_mom_5
+                      10.0_wp * ( w(k,j+1,i) - w(k,j,i)   )                    &
+                    -  5.0_wp * ( w(k,j+2,i) - w(k,j-1,i) )                    &
+                    +           ( w(k,j+3,i) - w(k,j-2,i) ) ) * adv_mom_5
 !
 !--             k index has to be modified near bottom and top, else array
@@ -4959,14 +4965,14 @@
                 w_comp    = w(k+1,j,i) + w(k,j,i)
                 flux_t(k) = w_comp  * (                                      &
-                          ( 37.0 * ibit35 * adv_mom_5                        &
-                       +     7.0 * ibit34 * adv_mom_3                        &
-                       +           ibit33 * adv_mom_1                        &
+                          ( 37.0_wp * ibit35 * adv_mom_5                        &
+                       +     7.0_wp * ibit34 * adv_mom_3                        &
+                       +              ibit33 * adv_mom_1                        &
                           ) *                                                &
                              ( w(k+1,j,i)  + w(k,j,i)     )                  &
-                   -      (  8.0 * ibit35 * adv_mom_5                        &
-                       +           ibit34 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit35 * adv_mom_5                        &
+                       +              ibit34 * adv_mom_3                        &
                           ) *                                                &
                              ( w(k_pp,j,i)  + w(k-1,j,i)  )                  &
-                   +      (        ibit35 * adv_mom_5                        &
+                   +      (           ibit35 * adv_mom_5                        &
                           ) *                                                &
                              ( w(k_ppp,j,i) + w(k_mm,j,i) )                  &
@@ -4974,14 +4980,14 @@
 
                 diss_t(k) = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit35 * adv_mom_5                        &
-                       +     3.0 * ibit34 * adv_mom_3                        &
-                       +           ibit33 * adv_mom_1                        &
+                          ( 10.0_wp * ibit35 * adv_mom_5                        &
+                       +     3.0_wp * ibit34 * adv_mom_3                        &
+                       +              ibit33 * adv_mom_1                        &
                           ) *                                                &
                              ( w(k+1,j,i)   - w(k,j,i)    )                  &
-                   -      (  5.0 * ibit35 * adv_mom_5                        &
-                       +           ibit34 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit35 * adv_mom_5                        &
+                       +              ibit34 * adv_mom_3                        &
                           ) *                                                &
                              ( w(k_pp,j,i)  - w(k-1,j,i)  )                  &
-                   +      (        ibit35 * adv_mom_5                        &
+                   +      (           ibit35 * adv_mom_5                        &
                           ) *                                                &
                              ( w(k_ppp,j,i) - w(k_mm,j,i) )                  &
@@ -4995,5 +5001,5 @@
                     +   ( w_comp      - ( w(k,j,i)   + w(k-1,j,i) ) )        &
                                                                  * ddzu(k+1) &
-                      ) * 0.5
+                      ) * 0.5_wp
 
                 tend(k,j,i) = tend(k,j,i) - (                                 &
@@ -5094,6 +5100,6 @@
        REAL(wp)    ::  w_comp   !:
 
-       gu = 2.0 * u_gtrans
-       gv = 2.0 * v_gtrans
+       gu = 2.0_wp * u_gtrans
+       gv = 2.0_wp * v_gtrans
 
 
@@ -5111,14 +5117,14 @@
                 u_comp_l                 = u(k+1,j,i) + u(k,j,i) - gu
                 flux_l                   = u_comp_l * (                        &
-                                      ( 37.0 * ibit29 * adv_mom_5              &
-                                   +     7.0 * ibit28 * adv_mom_3              &
-                                   +           ibit27 * adv_mom_1              &
+                                      ( 37.0_wp * ibit29 * adv_mom_5              &
+                                   +     7.0_wp * ibit28 * adv_mom_3              &
+                                   +              ibit27 * adv_mom_1              &
                                       ) *                                      &
                                      ( w(k,j,i)   + w(k,j,i-1) )               &
-                               -      (  8.0 * ibit29 * adv_mom_5              &
-                                   +           ibit28 * adv_mom_3              &
+                               -      (  8.0_wp * ibit29 * adv_mom_5              &
+                                   +              ibit28 * adv_mom_3              &
                                       ) *                                      &
                                      ( w(k,j,i+1) + w(k,j,i-2) )               &
-                               +      (        ibit29 * adv_mom_5              &
+                               +      (           ibit29 * adv_mom_5              &
                                       ) *                                      &
                                      ( w(k,j,i+2) + w(k,j,i-3) )               &
@@ -5126,14 +5132,14 @@
 
                 diss_l                    = - ABS( u_comp_l ) * (              &
-                                        ( 10.0 * ibit29 * adv_mom_5            &
-                                     +     3.0 * ibit28 * adv_mom_3            &
-                                     +           ibit27 * adv_mom_1            &
+                                        ( 10.0_wp * ibit29 * adv_mom_5            &
+                                     +     3.0_wp * ibit28 * adv_mom_3            &
+                                     +              ibit27 * adv_mom_1            &
                                         ) *                                    &
                                      ( w(k,j,i)   - w(k,j,i-1) )               &
-                                 -      (  5.0 * ibit29 * adv_mom_5            &
-                                     +           ibit28 * adv_mom_3            &
+                                 -      (  5.0_wp * ibit29 * adv_mom_5            &
+                                     +              ibit28 * adv_mom_3            &
                                         ) *                                    &
                                      ( w(k,j,i+1) - w(k,j,i-2) )               &
-                                 +      (        ibit29 * adv_mom_5            &
+                                 +      (           ibit29 * adv_mom_5            &
                                         ) *                                    &
                                      ( w(k,j,i+2) - w(k,j,i-3) )               &
@@ -5142,14 +5148,14 @@
                 u_comp    = u(k+1,j,i+1) + u(k,j,i+1) - gu
                 flux_r    = u_comp * (                                       &
-                          ( 37.0 * ibit29 * adv_mom_5                        &
-                       +     7.0 * ibit28 * adv_mom_3                        &
-                       +           ibit27 * adv_mom_1                        &
+                          ( 37.0_wp * ibit29 * adv_mom_5                        &
+                       +     7.0_wp * ibit28 * adv_mom_3                        &
+                       +              ibit27 * adv_mom_1                        &
                           ) *                                                &
                                  ( w(k,j,i+1) + w(k,j,i)   )                 &
-                   -      (  8.0 * ibit29 * adv_mom_5                        &
-                       +           ibit28 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit29 * adv_mom_5                        &
+                       +              ibit28 * adv_mom_3                        &
                           ) *                                                &
                                  ( w(k,j,i+2) + w(k,j,i-1) )                 &
-                   +      (        ibit29 * adv_mom_5                        &
+                   +      (           ibit29 * adv_mom_5                        &
                           ) *                                                &
                                  ( w(k,j,i+3) + w(k,j,i-2) )                 &
@@ -5157,14 +5163,14 @@
 
                 diss_r    = - ABS( u_comp ) * (                              &
-                          ( 10.0 * ibit29 * adv_mom_5                        &
-                       +     3.0 * ibit28 * adv_mom_3                        &
-                       +           ibit27 * adv_mom_1                        &
+                          ( 10.0_wp * ibit29 * adv_mom_5                        &
+                       +     3.0_wp * ibit28 * adv_mom_3                        &
+                       +              ibit27 * adv_mom_1                        &
                           ) *                                                &
                                  ( w(k,j,i+1) - w(k,j,i)  )                  &
-                   -      (  5.0 * ibit29 * adv_mom_5                        &
-                       +           ibit28 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit29 * adv_mom_5                        &
+                       +              ibit28 * adv_mom_3                        &
                           ) *                                                &
                                  ( w(k,j,i+2) - w(k,j,i-1) )                 &
-                   +      (        ibit29 * adv_mom_5                        &
+                   +      (           ibit29 * adv_mom_5                        &
                           ) *                                                &
                                  ( w(k,j,i+3) - w(k,j,i-2) )                 &
@@ -5176,14 +5182,14 @@
                 v_comp_s               = v(k+1,j,i) + v(k,j,i) - gv
                 flux_s                 = v_comp_s * (                         &
-                                    ( 37.0 * ibit32 * adv_mom_5               &
-                                 +     7.0 * ibit31 * adv_mom_3               &
-                                 +           ibit30 * adv_mom_1               &
+                                    ( 37.0_wp * ibit32 * adv_mom_5               &
+                                 +     7.0_wp * ibit31 * adv_mom_3               &
+                                 +              ibit30 * adv_mom_1               &
                                     ) *                                       &
                                      ( w(k,j,i)   + w(k,j-1,i) )              &
-                             -      (  8.0 * ibit32 * adv_mom_5               &
-                                 +           ibit31 * adv_mom_3               &
+                             -      (  8.0_wp * ibit32 * adv_mom_5               &
+                                 +              ibit31 * adv_mom_3               &
                                     ) *                                       &
                                      ( w(k,j+1,i) + w(k,j-2,i) )              &
-                             +      (        ibit32 * adv_mom_5               &
+                             +      (           ibit32 * adv_mom_5               &
                                     ) *                                       &
                                      ( w(k,j+2,i) + w(k,j-3,i) )              &
@@ -5191,14 +5197,14 @@
 
                 diss_s                 = - ABS( v_comp_s ) * (                &
-                                    ( 10.0 * ibit32 * adv_mom_5               &
-                                 +     3.0 * ibit31 * adv_mom_3               &
-                                 +           ibit30 * adv_mom_1               &
+                                    ( 10.0_wp * ibit32 * adv_mom_5               &
+                                 +     3.0_wp * ibit31 * adv_mom_3               &
+                                 +              ibit30 * adv_mom_1               &
                                     ) *                                       &
                                      ( w(k,j,i)   - w(k,j-1,i) )              &
-                             -      (  5.0 * ibit32 * adv_mom_5               &
-                                 +           ibit31 * adv_mom_3               &
+                             -      (  5.0_wp * ibit32 * adv_mom_5               &
+                                 +              ibit31 * adv_mom_3               &
                                     ) *                                       &
                                      ( w(k,j+1,i) - w(k,j-2,i) )              &
-                             +      (        ibit32 * adv_mom_5               &
+                             +      (           ibit32 * adv_mom_5               &
                                     ) *                                       &
                                      ( w(k,j+2,i) - w(k,j-3,i) )              &
@@ -5207,14 +5213,14 @@
                 v_comp    = v(k+1,j+1,i) + v(k,j+1,i) - gv
                 flux_n    = v_comp * (                                       &
-                          ( 37.0 * ibit32 * adv_mom_5                        &
-                       +     7.0 * ibit31 * adv_mom_3                        &
-                       +           ibit30 * adv_mom_1                        &
-                          ) *                                                &
+                          ( 37.0_wp * ibit32 * adv_mom_5                        &
+                       +     7.0_wp * ibit31 * adv_mom_3                        &
+                       +              ibit30 * adv_mom_1                        &
+                          ) *                                                 &
                                  ( w(k,j+1,i) + w(k,j,i)   )                 &
-                   -      (  8.0 * ibit32 * adv_mom_5                        &
-                       +           ibit31 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit32 * adv_mom_5                        &
+                       +              ibit31 * adv_mom_3                        &
                           ) *                                                &
                                  ( w(k,j+2,i) + w(k,j-1,i) )                 &
-                   +      (        ibit32 * adv_mom_5                        &
+                   +      (           ibit32 * adv_mom_5                        &
                           ) *                                                &
                                  ( w(k,j+3,i) + w(k,j-2,i) )                 &
@@ -5222,14 +5228,14 @@
 
                 diss_n    = - ABS( v_comp ) * (                              &
-                          ( 10.0 * ibit32 * adv_mom_5                        &
-                       +     3.0 * ibit31 * adv_mom_3                        &
-                       +           ibit30 * adv_mom_1                        &
+                          ( 10.0_wp * ibit32 * adv_mom_5                        &
+                       +     3.0_wp * ibit31 * adv_mom_3                        &
+                       +              ibit30 * adv_mom_1                        &
                           ) *                                                &
                                  ( w(k,j+1,i) - w(k,j,i)  )                  &
-                   -      (  5.0 * ibit32 * adv_mom_5                        &
-                       +           ibit31 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit32 * adv_mom_5                        &
+                       +              ibit31 * adv_mom_3                        &
                           ) *                                                &
                                  ( w(k,j+2,i) - w(k,j-1,i) )                 &
-                   +      (        ibit32 * adv_mom_5                        &
+                   +      (           ibit32 * adv_mom_5                        &
                           ) *                                                &
                                  ( w(k,j+3,i) - w(k,j-2,i) )                 &
@@ -5246,14 +5252,14 @@
                 w_comp    = w(k,j,i) + w(k-1,j,i)
                 flux_d    = w_comp  * (                                      &
-                          ( 37.0 * ibit35 * adv_mom_5                        &
-                       +     7.0 * ibit34 * adv_mom_3                        &
-                       +           ibit33 * adv_mom_1                        &
+                          ( 37.0_wp * ibit35 * adv_mom_5                        &
+                       +     7.0_wp * ibit34 * adv_mom_3                        &
+                       +              ibit33 * adv_mom_1                        &
                           ) *                                                &
                              ( w(k,j,i)    + w(k-1,j,i)   )                  &
-                   -      (  8.0 * ibit35 * adv_mom_5                        &
-                       +           ibit34 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit35 * adv_mom_5                        &
+                       +              ibit34 * adv_mom_3                        &
                           ) *                                                &
                              ( w(k+1,j,i)  + w(k_mm,j,i)  )                  &
-                   +      (        ibit35 * adv_mom_5                        &
+                   +      (           ibit35 * adv_mom_5                        &
                           ) *                                                &
                              ( w(k_pp,j,i) + w(k_mmm,j,i) )                  &
@@ -5261,14 +5267,14 @@
 
                 diss_d    = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit35 * adv_mom_5                        &
-                       +     3.0 * ibit34 * adv_mom_3                        &
-                       +           ibit33 * adv_mom_1                        &
+                          ( 10.0_wp * ibit35 * adv_mom_5                        &
+                       +     3.0_wp * ibit34 * adv_mom_3                        &
+                       +              ibit33 * adv_mom_1                        &
                           ) *                                                &
                              ( w(k,j,i)    - w(k-1,j,i)   )                  &
-                   -      (  5.0 * ibit35 * adv_mom_5                        &
-                       +           ibit34 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit35 * adv_mom_5                        &
+                       +              ibit34 * adv_mom_3                        &
                           ) *                                                &
                              ( w(k+1,j,i)  - w(k_mm,j,i)  )                  &
-                   +      (        ibit35 * adv_mom_5                        &
+                   +      (           ibit35 * adv_mom_5                        &
                           ) *                                                &
                              ( w(k_pp,j,i) - w(k_mmm,j,i) )                  &
@@ -5288,14 +5294,14 @@
                 w_comp    = w(k+1,j,i) + w(k,j,i)
                 flux_t    = w_comp  * (                                      &
-                          ( 37.0 * ibit35 * adv_mom_5                        &
-                       +     7.0 * ibit34 * adv_mom_3                        &
-                       +           ibit33 * adv_mom_1                        &
+                          ( 37.0_wp * ibit35 * adv_mom_5                        &
+                       +     7.0_wp * ibit34 * adv_mom_3                        &
+                       +              ibit33 * adv_mom_1                        &
                           ) *                                                &
                              ( w(k+1,j,i)  + w(k,j,i)     )                  &
-                   -      (  8.0 * ibit35 * adv_mom_5                        &
-                       +           ibit34 * adv_mom_3                        &
+                   -      (  8.0_wp * ibit35 * adv_mom_5                        &
+                       +              ibit34 * adv_mom_3                        &
                           ) *                                                &
                              ( w(k_pp,j,i)  + w(k-1,j,i)  )                  &
-                   +      (        ibit35 * adv_mom_5                        &
+                   +      (           ibit35 * adv_mom_5                        &
                           ) *                                                &
                              ( w(k_ppp,j,i) + w(k_mm,j,i) )                  &
@@ -5303,14 +5309,14 @@
 
                 diss_t    = - ABS( w_comp ) * (                              &
-                          ( 10.0 * ibit35 * adv_mom_5                        &
-                       +     3.0 * ibit34 * adv_mom_3                        &
-                       +           ibit33 * adv_mom_1                        &
+                          ( 10.0_wp * ibit35 * adv_mom_5                        &
+                       +     3.0_wp * ibit34 * adv_mom_3                        &
+                       +              ibit33 * adv_mom_1                        &
                           ) *                                                &
                              ( w(k+1,j,i)   - w(k,j,i)    )                  &
-                   -      (  5.0 * ibit35 * adv_mom_5                        &
-                       +           ibit34 * adv_mom_3                        &
+                   -      (  5.0_wp * ibit35 * adv_mom_5                        &
+                       +              ibit34 * adv_mom_3                        &
                           ) *                                                &
                              ( w(k_pp,j,i)  - w(k-1,j,i)  )                  &
-                   +      (        ibit35 * adv_mom_5                        &
+                   +      (           ibit35 * adv_mom_5                        &
                           ) *                                                &
                              ( w(k_ppp,j,i) - w(k_mm,j,i) )                  &
@@ -5324,5 +5330,5 @@
                     +   ( w_comp      - ( w(k,j,i)   + w(k-1,j,i) ) )        &
                                                                  * ddzu(k+1) &
-                      ) * 0.5
+                      ) * 0.5_wp 
 
                 tend(k,j,i) = - (                                                &
Index: /palm/trunk/SOURCE/boundary_conds.f90
===================================================================
--- /palm/trunk/SOURCE/boundary_conds.f90	(revision 1352)
+++ /palm/trunk/SOURCE/boundary_conds.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !  
 ! Former revisions:
@@ -139,5 +139,5 @@
     DO  i = nxlg, nxrg
        DO  j = nysg, nyng
-          w_p(nzb_w_inner(j,i),j,i) = 0.0
+          w_p(nzb_w_inner(j,i),j,i) = 0.0_wp
        ENDDO
     ENDDO
@@ -162,5 +162,5 @@
     ENDIF
     !$acc kernels present( w_p )
-    w_p(nzt:nzt+1,:,:) = 0.0  ! nzt is not a prognostic level (but cf. pres)
+    w_p(nzt:nzt+1,:,:) = 0.0_wp  ! nzt is not a prognostic level (but cf. pres)
     !$acc end kernels
 
@@ -366,11 +366,11 @@
           c_max = dy / dt_3d
 
-          c_u_m_l = 0.0 
-          c_v_m_l = 0.0
-          c_w_m_l = 0.0
-
-          c_u_m = 0.0 
-          c_v_m = 0.0
-          c_w_m = 0.0
+          c_u_m_l = 0.0_wp 
+          c_v_m_l = 0.0_wp
+          c_w_m_l = 0.0_wp
+
+          c_u_m = 0.0_wp 
+          c_v_m = 0.0_wp
+          c_w_m = 0.0_wp
 
 !
@@ -382,8 +382,8 @@
                 denom = u_m_s(k,0,i) - u_m_s(k,1,i)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_u(k,i) = -c_max * ( u(k,0,i) - u_m_s(k,0,i) ) / ( denom * tsc(2) )
-                   IF ( c_u(k,i) < 0.0 )  THEN
-                      c_u(k,i) = 0.0
+                   IF ( c_u(k,i) < 0.0_wp )  THEN
+                      c_u(k,i) = 0.0_wp
                    ELSEIF ( c_u(k,i) > c_max )  THEN
                       c_u(k,i) = c_max
@@ -395,8 +395,8 @@
                 denom = v_m_s(k,1,i) - v_m_s(k,2,i)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_v(k,i) = -c_max * ( v(k,1,i) - v_m_s(k,1,i) ) / ( denom * tsc(2) )
-                   IF ( c_v(k,i) < 0.0 )  THEN
-                      c_v(k,i) = 0.0
+                   IF ( c_v(k,i) < 0.0_wp )  THEN
+                      c_v(k,i) = 0.0_wp
                    ELSEIF ( c_v(k,i) > c_max )  THEN
                       c_v(k,i) = c_max
@@ -408,8 +408,8 @@
                 denom = w_m_s(k,0,i) - w_m_s(k,1,i)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_w(k,i) = -c_max * ( w(k,0,i) - w_m_s(k,0,i) ) / ( denom * tsc(2) )
-                   IF ( c_w(k,i) < 0.0 )  THEN
-                      c_w(k,i) = 0.0
+                   IF ( c_w(k,i) < 0.0_wp )  THEN
+                      c_w(k,i) = 0.0_wp
                    ELSEIF ( c_w(k,i) > c_max )  THEN
                       c_w(k,i) = c_max
@@ -472,11 +472,11 @@
 !--       Bottom boundary at the outflow
           IF ( ibc_uv_b == 0 )  THEN
-             u_p(nzb,-1,:) = 0.0 
-             v_p(nzb,0,:)  = 0.0  
+             u_p(nzb,-1,:) = 0.0_wp 
+             v_p(nzb,0,:)  = 0.0_wp  
           ELSE                    
              u_p(nzb,-1,:) =  u_p(nzb+1,-1,:)
              v_p(nzb,0,:)  =  v_p(nzb+1,0,:)
           ENDIF
-          w_p(nzb,-1,:) = 0.0
+          w_p(nzb,-1,:) = 0.0_wp
 
 !
@@ -489,5 +489,5 @@
              v_p(nzt+1,0,:)  = v(nzt,0,:)
           ENDIF
-          w_p(nzt:nzt+1,-1,:) = 0.0
+          w_p(nzt:nzt+1,-1,:) = 0.0_wp
 
        ENDIF
@@ -505,11 +505,11 @@
           c_max = dy / dt_3d
 
-          c_u_m_l = 0.0 
-          c_v_m_l = 0.0
-          c_w_m_l = 0.0
-
-          c_u_m = 0.0 
-          c_v_m = 0.0
-          c_w_m = 0.0
+          c_u_m_l = 0.0_wp 
+          c_v_m_l = 0.0_wp
+          c_w_m_l = 0.0_wp
+
+          c_u_m = 0.0_wp 
+          c_v_m = 0.0_wp
+          c_w_m = 0.0_wp
 
 !
@@ -521,8 +521,8 @@
                 denom = u_m_n(k,ny,i) - u_m_n(k,ny-1,i)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_u(k,i) = -c_max * ( u(k,ny,i) - u_m_n(k,ny,i) ) / ( denom * tsc(2) )
-                   IF ( c_u(k,i) < 0.0 )  THEN
-                      c_u(k,i) = 0.0
+                   IF ( c_u(k,i) < 0.0_wp )  THEN
+                      c_u(k,i) = 0.0_wp
                    ELSEIF ( c_u(k,i) > c_max )  THEN
                       c_u(k,i) = c_max
@@ -534,8 +534,8 @@
                 denom = v_m_n(k,ny,i) - v_m_n(k,ny-1,i)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_v(k,i) = -c_max * ( v(k,ny,i) - v_m_n(k,ny,i) ) / ( denom * tsc(2) )
-                   IF ( c_v(k,i) < 0.0 )  THEN
-                      c_v(k,i) = 0.0
+                   IF ( c_v(k,i) < 0.0_wp )  THEN
+                      c_v(k,i) = 0.0_wp
                    ELSEIF ( c_v(k,i) > c_max )  THEN
                       c_v(k,i) = c_max
@@ -547,8 +547,8 @@
                 denom = w_m_n(k,ny,i) - w_m_n(k,ny-1,i)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_w(k,i) = -c_max * ( w(k,ny,i) - w_m_n(k,ny,i) ) / ( denom * tsc(2) )
-                   IF ( c_w(k,i) < 0.0 )  THEN
-                      c_w(k,i) = 0.0
+                   IF ( c_w(k,i) < 0.0_wp )  THEN
+                      c_w(k,i) = 0.0_wp
                    ELSEIF ( c_w(k,i) > c_max )  THEN
                       c_w(k,i) = c_max
@@ -611,11 +611,11 @@
 !--       Bottom boundary at the outflow
           IF ( ibc_uv_b == 0 )  THEN
-             u_p(nzb,ny+1,:) = 0.0 
-             v_p(nzb,ny+1,:) = 0.0   
+             u_p(nzb,ny+1,:) = 0.0_wp
+             v_p(nzb,ny+1,:) = 0.0_wp   
           ELSE                    
              u_p(nzb,ny+1,:) =  u_p(nzb+1,ny+1,:)
              v_p(nzb,ny+1,:) =  v_p(nzb+1,ny+1,:)
           ENDIF
-          w_p(nzb,ny+1,:) = 0.0
+          w_p(nzb,ny+1,:) = 0.0_wp
 
 !
@@ -628,5 +628,5 @@
              v_p(nzt+1,ny+1,:) = v_p(nzt,nyn+1,:)
           ENDIF
-          w_p(nzt:nzt+1,ny+1,:) = 0.0
+          w_p(nzt:nzt+1,ny+1,:) = 0.0_wp
 
        ENDIF
@@ -644,11 +644,11 @@
           c_max = dx / dt_3d
 
-          c_u_m_l = 0.0 
-          c_v_m_l = 0.0
-          c_w_m_l = 0.0
-
-          c_u_m = 0.0 
-          c_v_m = 0.0
-          c_w_m = 0.0
+          c_u_m_l = 0.0_wp 
+          c_v_m_l = 0.0_wp
+          c_w_m_l = 0.0_wp
+
+          c_u_m = 0.0_wp 
+          c_v_m = 0.0_wp
+          c_w_m = 0.0_wp
 
 !
@@ -660,8 +660,8 @@
                 denom = u_m_l(k,j,1) - u_m_l(k,j,2)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_u(k,j) = -c_max * ( u(k,j,1) - u_m_l(k,j,1) ) / ( denom * tsc(2) )
-                   IF ( c_u(k,j) < 0.0 )  THEN
-                      c_u(k,j) = 0.0
+                   IF ( c_u(k,j) < 0.0_wp )  THEN
+                      c_u(k,j) = 0.0_wp
                    ELSEIF ( c_u(k,j) > c_max )  THEN
                       c_u(k,j) = c_max
@@ -673,8 +673,8 @@
                 denom = v_m_l(k,j,0) - v_m_l(k,j,1)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_v(k,j) = -c_max * ( v(k,j,0) - v_m_l(k,j,0) ) / ( denom * tsc(2) )
-                   IF ( c_v(k,j) < 0.0 )  THEN
-                      c_v(k,j) = 0.0
+                   IF ( c_v(k,j) < 0.0_wp )  THEN
+                      c_v(k,j) = 0.0_wp
                    ELSEIF ( c_v(k,j) > c_max )  THEN
                       c_v(k,j) = c_max
@@ -686,8 +686,8 @@
                 denom = w_m_l(k,j,0) - w_m_l(k,j,1)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_w(k,j) = -c_max * ( w(k,j,0) - w_m_l(k,j,0) ) / ( denom * tsc(2) )
-                   IF ( c_w(k,j) < 0.0 )  THEN
-                      c_w(k,j) = 0.0
+                   IF ( c_w(k,j) < 0.0_wp )  THEN
+                      c_w(k,j) = 0.0_wp
                    ELSEIF ( c_w(k,j) > c_max )  THEN
                       c_w(k,j) = c_max
@@ -750,11 +750,11 @@
 !--       Bottom boundary at the outflow
           IF ( ibc_uv_b == 0 )  THEN
-             u_p(nzb,:,0)  = 0.0 
-             v_p(nzb,:,-1) = 0.0
+             u_p(nzb,:,0)  = 0.0_wp 
+             v_p(nzb,:,-1) = 0.0_wp
           ELSE                    
              u_p(nzb,:,0)  =  u_p(nzb+1,:,0)
              v_p(nzb,:,-1) =  v_p(nzb+1,:,-1)
           ENDIF
-          w_p(nzb,:,-1) = 0.0
+          w_p(nzb,:,-1) = 0.0_wp
 
 !
@@ -767,5 +767,5 @@
              v_p(nzt+1,:,-1) = v_p(nzt,:,-1)
           ENDIF
-          w_p(nzt:nzt+1,:,-1) = 0.0
+          w_p(nzt:nzt+1,:,-1) = 0.0_wp
 
        ENDIF
@@ -783,11 +783,11 @@
           c_max = dx / dt_3d
 
-          c_u_m_l = 0.0 
-          c_v_m_l = 0.0
-          c_w_m_l = 0.0
-
-          c_u_m = 0.0 
-          c_v_m = 0.0
-          c_w_m = 0.0
+          c_u_m_l = 0.0_wp 
+          c_v_m_l = 0.0_wp
+          c_w_m_l = 0.0_wp
+
+          c_u_m = 0.0_wp 
+          c_v_m = 0.0_wp
+          c_w_m = 0.0_wp
 
 !
@@ -799,8 +799,8 @@
                 denom = u_m_r(k,j,nx) - u_m_r(k,j,nx-1)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_u(k,j) = -c_max * ( u(k,j,nx) - u_m_r(k,j,nx) ) / ( denom * tsc(2) )
-                   IF ( c_u(k,j) < 0.0 )  THEN
-                      c_u(k,j) = 0.0
+                   IF ( c_u(k,j) < 0.0_wp )  THEN
+                      c_u(k,j) = 0.0_wp
                    ELSEIF ( c_u(k,j) > c_max )  THEN
                       c_u(k,j) = c_max
@@ -812,8 +812,8 @@
                 denom = v_m_r(k,j,nx) - v_m_r(k,j,nx-1)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_v(k,j) = -c_max * ( v(k,j,nx) - v_m_r(k,j,nx) ) / ( denom * tsc(2) )
-                   IF ( c_v(k,j) < 0.0 )  THEN
-                      c_v(k,j) = 0.0
+                   IF ( c_v(k,j) < 0.0_wp )  THEN
+                      c_v(k,j) = 0.0_wp
                    ELSEIF ( c_v(k,j) > c_max )  THEN
                       c_v(k,j) = c_max
@@ -825,8 +825,8 @@
                 denom = w_m_r(k,j,nx) - w_m_r(k,j,nx-1)
 
-                IF ( denom /= 0.0 )  THEN
+                IF ( denom /= 0.0_wp )  THEN
                    c_w(k,j) = -c_max * ( w(k,j,nx) - w_m_r(k,j,nx) ) / ( denom * tsc(2) )
-                   IF ( c_w(k,j) < 0.0 )  THEN
-                      c_w(k,j) = 0.0
+                   IF ( c_w(k,j) < 0.0_wp )  THEN
+                      c_w(k,j) = 0.0_wp
                    ELSEIF ( c_w(k,j) > c_max )  THEN
                       c_w(k,j) = c_max
@@ -889,11 +889,11 @@
 !--       Bottom boundary at the outflow
           IF ( ibc_uv_b == 0 )  THEN
-             u_p(nzb,:,nx+1) = 0.0
-             v_p(nzb,:,nx+1) = 0.0 
+             u_p(nzb,:,nx+1) = 0.0_wp
+             v_p(nzb,:,nx+1) = 0.0_wp 
           ELSE                    
              u_p(nzb,:,nx+1) =  u_p(nzb+1,:,nx+1)
              v_p(nzb,:,nx+1) =  v_p(nzb+1,:,nx+1)
           ENDIF
-          w_p(nzb,:,nx+1) = 0.0
+          w_p(nzb,:,nx+1) = 0.0_wp
 
 !
@@ -906,5 +906,5 @@
              v_p(nzt+1,:,nx+1) = v_p(nzt,:,nx+1)
           ENDIF
-          w(nzt:nzt+1,:,nx+1) = 0.0
+          w(nzt:nzt+1,:,nx+1) = 0.0_wp
 
        ENDIF
Index: /palm/trunk/SOURCE/buoyancy.f90
===================================================================
--- /palm/trunk/SOURCE/buoyancy.f90	(revision 1352)
+++ /palm/trunk/SOURCE/buoyancy.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -133,8 +133,9 @@
              DO  j = nys, nyn
                 DO  k = nzb_s_inner(j,i)+1, nzt-1
-                   tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5 * (  &
-                          ( var(k,j,i)   - ref_state(k) )   / ref_state(k) +   &
-                          ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1)   &
-                                                                            )
+                   tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5_wp * &
+                          (                                                    &
+                             ( var(k,j,i)   - ref_state(k) )   / ref_state(k) + &
+                             ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1) &
+                          )
                 ENDDO
              ENDDO
@@ -154,7 +155,7 @@
                    DO  k = nzb_s_inner(j,i)+1, nzt-1
                       tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *      &
-                           0.5 * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
-                                 - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
-                                 ) / pt_surface
+                           0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
+                                    - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
+                                    ) / pt_surface
                    ENDDO
                 ENDDO
@@ -167,7 +168,7 @@
                    DO  k = nzb_s_inner(j,i)+1, nzt-1
                       tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *      &
-                           0.5 * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
-                                 - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
-                                 ) / pt_surface
+                           0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
+                                    - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
+                                    ) / pt_surface
                    ENDDO
                 ENDDO
@@ -231,8 +232,9 @@
                 !$acc loop independent vector
                 DO  k = nzb_s_inner(j,i)+1, nzt-1
-                   tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5 * (  &
-                          ( var(k,j,i)   - ref_state(k) )   / ref_state(k) +   &
-                          ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1)   &
-                                                                            )
+                   tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5_wp * &
+                          (                                                    &
+                             ( var(k,j,i)   - ref_state(k) )   / ref_state(k) + &
+                             ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1) &
+                          )
                 ENDDO
              ENDDO
@@ -253,7 +255,7 @@
                    DO  k = nzb_s_inner(j,i)+1, nzt-1
                       tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *      &
-                           0.5 * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
-                                 - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
-                                 ) / pt_surface
+                           0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
+                                    - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
+                                    ) / pt_surface
                    ENDDO
                 ENDDO
@@ -266,7 +268,7 @@
                    DO  k = nzb_s_inner(j,i)+1, nzt-1
                       tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *      &
-                           0.5 * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
-                                 - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
-                                 ) / pt_surface
+                           0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
+                                    - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
+                                    ) / pt_surface
                    ENDDO
                 ENDDO
@@ -328,8 +330,8 @@
 !--       Normal case: horizontal surface
           DO  k = nzb_s_inner(j,i)+1, nzt-1
-              tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5 * (       &
+              tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5_wp * (    &
                         ( var(k,j,i)   - ref_state(k)   ) / ref_state(k)   +   &
                         ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1)     &
-                                                                       )
+                                                                          )
           ENDDO
 
@@ -345,7 +347,7 @@
              DO  k = nzb_s_inner(j,i)+1, nzt-1
                 tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *            &
-                           0.5 * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
-                                 - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
-                                 ) / pt_surface
+                           0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
+                                    - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
+                                    ) / pt_surface
              ENDDO
 
@@ -354,7 +356,7 @@
              DO  k = nzb_s_inner(j,i)+1, nzt-1
                 tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *            &
-                           0.5 * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
-                                 - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
-                                 ) / pt_surface
+                           0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
+                                    - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
+                                    ) / pt_surface
              ENDDO
 
@@ -430,5 +432,5 @@
           !$OMP PARALLEL PRIVATE( i, j, k, tn )
 !$        tn = omp_get_thread_num()
-          sums_l(:,pr,tn) = 0.0
+          sums_l(:,pr,tn) = 0.0_wp
           !$OMP DO
           DO  i = nxl, nxr
Index: /palm/trunk/SOURCE/calc_liquid_water_content.f90
===================================================================
--- /palm/trunk/SOURCE/calc_liquid_water_content.f90	(revision 1352)
+++ /palm/trunk/SOURCE/calc_liquid_water_content.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -97,44 +97,44 @@
 !
 !--          Compute saturation water vapor pressure at t_l
-             e_s = 610.78 * EXP( 17.269 * ( t_l - 273.16 ) /                   &
-                                          ( t_l - 35.86 ) )
+             e_s = 610.78_wp * EXP( 17.269_wp * ( t_l - 273.16_wp ) /          &
+                                                ( t_l - 35.86_wp ) )
 
 !
 !--          Compute approximation of saturation humidity
-             q_s = 0.622 * e_s / ( hyp(k) - 0.378 * e_s )
+             q_s = 0.622_wp * e_s / ( hyp(k) - 0.378_wp * e_s )
 
 !
 !--          Correction factor
-             alpha = 0.622 * l_d_r * l_d_cp / ( t_l * t_l )
+             alpha = 0.622_wp * l_d_r * l_d_cp / ( t_l * t_l )
 
 !
 !--          Correction of the approximated value
 !--          (see: Cuijpers + Duynkerke, 1993, JAS, 23)
-             q_s = q_s * ( 1.0 + alpha * q(k,j,i) ) / ( 1.0 + alpha * q_s )
+             q_s = q_s * ( 1.0_wp + alpha * q(k,j,i) ) / ( 1.0_wp + alpha * q_s )
 
 !
 !--          Compute the liquid water content
              IF ( icloud_scheme == 0  .AND.  precipitation)  THEN
-                IF ( ( q(k,j,i) - q_s - qr(k,j,i) ) > 0.0 ) THEN
+                IF ( ( q(k,j,i) - q_s - qr(k,j,i) ) > 0.0_wp ) THEN
                    qc(k,j,i) = q(k,j,i) - q_s - qr(k,j,i)
                    ql(k,j,i) = qc(k,j,i) + qr(k,j,i)
                 ELSE
                    IF ( q(k,j,i) < qr(k,j,i) )  q(k,j,i) = qr(k,j,i)
-                   qc(k,j,i) = 0.0 
+                   qc(k,j,i) = 0.0_wp 
                    ql(k,j,i) = qr(k,j,i)
                 ENDIF
              ELSEIF ( icloud_scheme == 0  .AND.  .NOT. precipitation )  THEN
-                IF ( ( q(k,j,i) - q_s ) > 0.0 ) THEN
+                IF ( ( q(k,j,i) - q_s ) > 0.0_wp ) THEN
                    qc(k,j,i) = q(k,j,i) - q_s
                    ql(k,j,i) = qc(k,j,i)
                 ELSE
-                   qc(k,j,i) = 0.0 
-                   ql(k,j,i) = 0.0
+                   qc(k,j,i) = 0.0_wp 
+                   ql(k,j,i) = 0.0_wp
                 ENDIF
              ELSE
-                IF ( ( q(k,j,i) - q_s ) > 0.0 ) THEN
+                IF ( ( q(k,j,i) - q_s ) > 0.0_wp ) THEN
                    ql(k,j,i) = q(k,j,i) - q_s
                 ELSE
-                   ql(k,j,i) = 0.0 
+                   ql(k,j,i) = 0.0_wp 
                 ENDIF
              ENDIF
Index: /palm/trunk/SOURCE/calc_precipitation.f90
===================================================================
--- /palm/trunk/SOURCE/calc_precipitation.f90	(revision 1352)
+++ /palm/trunk/SOURCE/calc_precipitation.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -90,5 +90,5 @@
        REAL(wp)    ::  dqdt_precip !:
 
-       precipitation_rate = 0.0
+       precipitation_rate = 0.0_wp
 
        DO  i = nxl, nxr
@@ -99,5 +99,5 @@
                    dqdt_precip = prec_time_const * ( ql(k,j,i) - ql_crit )
                 ELSE
-                   dqdt_precip = 0.0
+                   dqdt_precip = 0.0_wp
                 ENDIF
                 tend(k,j,i) = tend(k,j,i) - dqdt_precip
@@ -154,5 +154,5 @@
        REAL(wp)    ::  dqdt_precip !:       
 
-       precipitation_rate(j,i) = 0.0
+       precipitation_rate(j,i) = 0.0_wp
 
 !
@@ -164,5 +164,5 @@
              dqdt_precip = prec_time_const * ( ql(k,j,i) - ql_crit )
           ELSE
-             dqdt_precip = 0.0
+             dqdt_precip = 0.0_wp
           ENDIF
           tend(k,j,i) = tend(k,j,i) - dqdt_precip
Index: /palm/trunk/SOURCE/calc_radiation.f90
===================================================================
--- /palm/trunk/SOURCE/calc_radiation.f90	(revision 1352)
+++ /palm/trunk/SOURCE/calc_radiation.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -55,5 +55,5 @@
     
     LOGICAL, SAVE ::  first_call = .TRUE. !:
-    REAL(wp), SAVE ::  sigma = 5.67E-08   !:
+    REAL(wp), SAVE ::  sigma = 5.67E-08_wp   !:
 
     REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  lwp_ground         !:
@@ -126,5 +126,5 @@
 !--          Compute the liquid water path (LWP) and blackbody_emission
 !--          at all vertical levels
-             lwp_ground(nzb) = 0.0
+             lwp_ground(nzb) = 0.0_wp
              lwp_top(nzt+1)  = rho_surface * ql(nzt+1,j,i) * dzw(nzt+1)
 
@@ -156,5 +156,5 @@
 !
 !--          See Chlond '92, this is just a first guess
-             impinging_flux_at_top = blackbody_emission(nzb) - 100.0
+             impinging_flux_at_top = blackbody_emission(nzb) - 100.0_wp
 
              DO  k = nzb_2d(j,i)+1, nzt
@@ -162,15 +162,15 @@
 !--             Save some computational time, but this may cause load
 !--             imbalances if ql is not distributed uniformly
-                IF ( ql(k,j,i) /= 0.0 ) THEN
+                IF ( ql(k,j,i) /= 0.0_wp ) THEN
 !
 !--                Compute effective emissivities
-                   effective_emission_up_p   = 1.0 -                           &
-                                               EXP( -130.0 * lwp_ground(k+1) )
-                   effective_emission_up_m   = 1.0 -                           &
-                                               EXP( -130.0 * lwp_ground(k-1) )
-                   effective_emission_down_p = 1.0 -                           &
-                                               EXP( -158.0 * lwp_top(k+1) )
-                   effective_emission_down_m = 1.0 -                           &
-                                               EXP( -158.0 * lwp_top(k-1) )  
+                   effective_emission_up_p   = 1.0_wp -                        &
+                                               EXP( -130.0_wp * lwp_ground(k+1) )
+                   effective_emission_up_m   = 1.0_wp -                        &
+                                               EXP( -130.0_wp * lwp_ground(k-1) )
+                   effective_emission_down_p = 1.0_wp -                        &
+                                               EXP( -158.0_wp * lwp_top(k+1) )
+                   effective_emission_down_m = 1.0_wp -                        &
+                                               EXP( -158.0_wp * lwp_top(k-1) )  
 
 !
@@ -266,5 +266,5 @@
 !--    Compute the liquid water path (LWP) and blackbody_emission
 !--    at all vertical levels
-       lwp_ground(nzb) = 0.0
+       lwp_ground(nzb) = 0.0_wp
        lwp_top(nzt+1)  = rho_surface * ql(nzt+1,j,i) * dzw(nzt+1)
 
@@ -293,5 +293,5 @@
 !
 !--    See Chlond '92, this is just a first guess
-       impinging_flux_at_top = blackbody_emission(nzb) - 100.0
+       impinging_flux_at_top = blackbody_emission(nzb) - 100.0_wp
 
        DO  k = nzb_2d(j,i)+1, nzt
@@ -299,15 +299,15 @@
 !--       Store some computational time,
 !--       this may cause load imbalances if ql is not distributed uniformly
-          IF ( ql(k,j,i) /= 0.0 ) THEN
+          IF ( ql(k,j,i) /= 0.0_wp ) THEN
 !
 !--          Compute effective emissivities
-             effective_emission_up_p   = 1.0 -                                 &
-                                         EXP( -130.0 * lwp_ground(k+1) )
-             effective_emission_up_m   = 1.0 -                                 &
-                                         EXP( -130.0 * lwp_ground(k-1) )
-             effective_emission_down_p = 1.0 -                                 &
-                                         EXP( -158.0 * lwp_top(k+1) )
-             effective_emission_down_m = 1.0 -                                 &
-                                         EXP( -158.0 * lwp_top(k-1) )  
+             effective_emission_up_p   = 1.0_wp -                              &
+                                         EXP( -130.0_wp * lwp_ground(k+1) )
+             effective_emission_up_m   = 1.0_wp -                              &
+                                         EXP( -130.0_wp * lwp_ground(k-1) )
+             effective_emission_down_p = 1.0_wp -                              &
+                                         EXP( -158.0_wp * lwp_top(k+1) )
+             effective_emission_down_m = 1.0_wp -                              &
+                                         EXP( -158.0_wp * lwp_top(k-1) )  
              
 !
Index: /palm/trunk/SOURCE/check_for_restart.f90
===================================================================
--- /palm/trunk/SOURCE/check_for_restart.f90	(revision 1352)
+++ /palm/trunk/SOURCE/check_for_restart.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -125,5 +125,5 @@
 !
 !-- Set the stop flag also, if restart is forced by user
-    IF ( time_restart /= 9999999.9  .AND.                                      &
+    IF ( time_restart /= 9999999.9_wp  .AND.                                      &
          time_restart < time_since_reference_point )  THEN
 
@@ -136,8 +136,8 @@
 !--       Increment restart time, if forced by user, otherwise set restart
 !--       time to default (no user restart)
-          IF ( dt_restart /= 9999999.9 )  THEN
+          IF ( dt_restart /= 9999999.9_wp )  THEN
              time_restart = time_restart + dt_restart
           ELSE
-             time_restart = 9999999.9
+             time_restart = 9999999.9_wp
           ENDIF
 
@@ -156,5 +156,5 @@
                .AND.  terminate_coupled_remote == 0 )  THEN
 
-             IF ( dt_restart /= 9999999.9 )  THEN
+             IF ( dt_restart /= 9999999.9_wp )  THEN
                 terminate_coupled = 4
              ELSE
@@ -174,5 +174,5 @@
           ENDIF
        ELSE
-          time_restart = 9999999.9
+          time_restart = 9999999.9_wp
        ENDIF
     ENDIF
Index: /palm/trunk/SOURCE/check_open.f90
===================================================================
--- /palm/trunk/SOURCE/check_open.f90	(revision 1352)
+++ /palm/trunk/SOURCE/check_open.f90	(revision 1353)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute,
+! declaration for unused variables xkoor, ykoor, zkoor removed
 ! 
 ! Former revisions:
@@ -147,19 +148,16 @@
     LOGICAL ::  twoya = .TRUE.                !:
 
-    REAL(wp) ::  ansx = -999.999 !:
-    REAL(wp) ::  ansy = -999.999 !:
-    REAL(wp) ::  gwid = 0.1      !:
-    REAL(wp) ::  rlegfak = 1.5   !:
-    REAL(wp) ::  sizex = 250.0   !:
-    REAL(wp) ::  sizey = 40.0    !:
-    REAL(wp) ::  texfac = 1.5    !:
+    REAL(wp) ::  ansx = -999.999_wp !:
+    REAL(wp) ::  ansy = -999.999_wp !:
+    REAL(wp) ::  gwid = 0.1_wp      !:
+    REAL(wp) ::  rlegfak = 1.5_wp   !:
+    REAL(wp) ::  sizex = 250.0_wp   !:
+    REAL(wp) ::  sizey = 40.0_wp    !:
+    REAL(wp) ::  texfac = 1.5_wp    !:
 
     REAL(wp), DIMENSION(:), ALLOCATABLE      ::  eta !:
     REAL(wp), DIMENSION(:), ALLOCATABLE      ::  ho  !:
     REAL(wp), DIMENSION(:), ALLOCATABLE      ::  hu  !:
-    
-    REAL(sp), DIMENSION(:), ALLOCATABLE ::  xkoor !:
-    REAL(sp), DIMENSION(:), ALLOCATABLE ::  ykoor !:
-    REAL(sp), DIMENSION(:), ALLOCATABLE ::  zkoor !:  
+ 
 
 
@@ -363,11 +361,11 @@
 !--          Determine and write ISO2D coordiante header
              ALLOCATE( eta(0:ny+1), ho(0:nx+1), hu(0:nx+1) )
-             hu = 0.0
+             hu = 0.0_wp
              ho = (ny+1) * dy
              DO  i = 1, ny
-                eta(i) = REAL( i ) / ( ny + 1.0 )
+                eta(i) = REAL( i ) / ( ny + 1.0_wp )
              ENDDO
-             eta(0)    = 0.0
-             eta(ny+1) = 1.0
+             eta(0)    = 0.0_wp
+             eta(ny+1) = 1.0_wp
 
              WRITE (21)  dx,eta,hu,ho
@@ -396,11 +394,11 @@
 !--          Determine and write ISO2D coordinate header
              ALLOCATE( eta(0:nz+1), ho(0:nx+1), hu(0:nx+1) )
-             hu = 0.0
+             hu = 0.0_wp
              ho = zu(nz+1)
              DO  i = 1, nz
                 eta(i) = REAL( zu(i) ) / zu(nz+1)
              ENDDO
-             eta(0)    = 0.0
-             eta(nz+1) = 1.0
+             eta(0)    = 0.0_wp
+             eta(nz+1) = 1.0_wp
 
              WRITE (22)  dx,eta,hu,ho
@@ -429,11 +427,11 @@
 !--          Determine and write ISO2D coordiante header
              ALLOCATE( eta(0:nz+1), ho(0:ny+1), hu(0:ny+1) )
-             hu = 0.0
+             hu = 0.0_wp
              ho = zu(nz+1)
              DO  i = 1, nz
                 eta(i) = REAL( zu(i) ) / zu(nz+1)
              ENDDO
-             eta(0)    = 0.0
-             eta(nz+1) = 1.0
+             eta(0)    = 0.0_wp
+             eta(nz+1) = 1.0_wp
 
              WRITE (23)  dx,eta,hu,ho
Index: /palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- /palm/trunk/SOURCE/check_parameters.f90	(revision 1352)
+++ /palm/trunk/SOURCE/check_parameters.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -238,5 +238,5 @@
     
     REAL(wp)    ::  gradient                         !: 
-    REAL(wp)    ::  remote = 0.0                     !: 
+    REAL(wp)    ::  remote = 0.0_wp                  !: 
     REAL(wp)    ::  simulation_time_since_reference  !: 
 
@@ -307,5 +307,5 @@
           CALL message( 'check_parameters', 'PA0004', 1, 2, 0, 6, 0 )
        ENDIF
-       IF ( dt_coupling <= 0.0 )  THEN
+       IF ( dt_coupling <= 0.0_wp )  THEN
 #if ! defined( __check )
           IF ( myid == 0  ) THEN
@@ -505,5 +505,5 @@
 !
 !-- Check if vertical grid stretching is used together with particles
-    IF ( dz_stretch_level < 100000.0 .AND. particle_advection )  THEN
+    IF ( dz_stretch_level < 100000.0_wp .AND. particle_advection )  THEN
        message_string = 'Vertical grid stretching is not allowed together ' // &
                         'with particle advection.'
@@ -677,5 +677,5 @@
        CALL message( 'check_parameters', 'PA0024', 1, 2, 0, 6, 0 )
     ENDIF
-    IF ( scalar_advec == 'bc-scheme'  .AND.  loop_optimization == 'cache' ) &
+    IF ( scalar_advec == 'bc-scheme'  .AND.  loop_optimization == 'cache' )    &
     THEN
        message_string = 'advection_scheme scalar_advec = "' &
@@ -685,9 +685,9 @@
     ENDIF
 
-    IF ( use_sgs_for_particles  .AND.  .NOT. use_upstream_for_tke .AND.       &
+    IF ( use_sgs_for_particles  .AND.  .NOT. use_upstream_for_tke .AND.        &
          scalar_advec /= 'ws-scheme' )  THEN
        use_upstream_for_tke = .TRUE.
-       message_string = 'use_upstream_for_tke set .TRUE. because ' // &
-                        'use_sgs_for_particles = .TRUE. '          // &
+       message_string = 'use_upstream_for_tke set .TRUE. because ' //          &
+                        'use_sgs_for_particles = .TRUE. '          //          &
                         'and scalar_advec /= ws-scheme'
        CALL message( 'check_parameters', 'PA0025', 0, 1, 0, 6, 0 )
@@ -695,5 +695,5 @@
 
     IF ( use_sgs_for_particles  .AND.  curvature_solution_effects )  THEN
-       message_string = 'use_sgs_for_particles = .TRUE. not allowed with ' // &
+       message_string = 'use_sgs_for_particles = .TRUE. not allowed with ' //  &
                         'curvature_solution_effects = .TRUE.'
        CALL message( 'check_parameters', 'PA0349', 1, 2, 0, 6, 0 )
@@ -719,5 +719,5 @@
 
        CASE DEFAULT
-          message_string = 'unknown timestep scheme: timestep_scheme = "' // &
+          message_string = 'unknown timestep scheme: timestep_scheme = "' //   &
                            TRIM( timestep_scheme ) // '"'
           CALL message( 'check_parameters', 'PA0027', 1, 2, 0, 6, 0 )
@@ -725,5 +725,5 @@
     END SELECT
 
-    IF ( (momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme') &
+    IF ( (momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme')   &
          .AND. timestep_scheme(1:5) == 'runge' ) THEN
        message_string = 'momentum advection scheme "' // &
@@ -833,5 +833,5 @@
     ENDIF
 
-    IF ( plant_canopy .AND. ( drag_coefficient == 0.0 ) ) THEN
+    IF ( plant_canopy .AND. ( drag_coefficient == 0.0_wp ) ) THEN
        message_string = 'plant_canopy = .TRUE. requires a non-zero drag ' // &
                         'coefficient & given value is drag_coefficient = 0.0'
@@ -872,5 +872,5 @@
        IF ( ocean )           sa_init = sa_surface
        IF ( passive_scalar )  q_init  = s_surface
-       IF ( plant_canopy )    lad = 0.0
+       IF ( plant_canopy )    lad = 0.0_wp
 
 !
@@ -879,5 +879,5 @@
 !--    (component ug)
        i = 1
-       gradient = 0.0
+       gradient = 0.0_wp
 
        IF ( .NOT. ocean )  THEN
@@ -888,11 +888,11 @@
              IF ( i < 11 ) THEN
                 IF ( ug_vertical_gradient_level(i) < zu(k)  .AND. &
-                     ug_vertical_gradient_level(i) >= 0.0 )  THEN
-                   gradient = ug_vertical_gradient(i) / 100.0
+                     ug_vertical_gradient_level(i) >= 0.0_wp )  THEN
+                   gradient = ug_vertical_gradient(i) / 100.0_wp
                    ug_vertical_gradient_level_ind(i) = k - 1
                    i = i + 1
                 ENDIF
              ENDIF        
-             IF ( gradient /= 0.0 )  THEN
+             IF ( gradient /= 0.0_wp )  THEN
                 IF ( k /= 1 )  THEN
                    ug(k) = ug(k-1) + dzu(k) * gradient
@@ -912,16 +912,16 @@
              IF ( i < 11 ) THEN
                 IF ( ug_vertical_gradient_level(i) > zu(k)  .AND. &
-                     ug_vertical_gradient_level(i) <= 0.0 )  THEN
-                   gradient = ug_vertical_gradient(i) / 100.0
+                     ug_vertical_gradient_level(i) <= 0.0_wp )  THEN
+                   gradient = ug_vertical_gradient(i) / 100.0_wp
                    ug_vertical_gradient_level_ind(i) = k + 1
                    i = i + 1
                 ENDIF
              ENDIF
-             IF ( gradient /= 0.0 )  THEN
+             IF ( gradient /= 0.0_wp )  THEN
                 IF ( k /= nzt )  THEN
                    ug(k) = ug(k+1) - dzu(k+1) * gradient
                 ELSE
-                   ug(k)   = ug_surface - 0.5 * dzu(k+1) * gradient
-                   ug(k+1) = ug_surface + 0.5 * dzu(k+1) * gradient
+                   ug(k)   = ug_surface - 0.5_wp * dzu(k+1) * gradient
+                   ug(k+1) = ug_surface + 0.5_wp * dzu(k+1) * gradient
                 ENDIF
              ELSE
@@ -935,5 +935,5 @@
 !--    In case of no given gradients for ug, choose a zero gradient
        IF ( ug_vertical_gradient_level(1) == -9999999.9_wp )  THEN
-          ug_vertical_gradient_level(1) = 0.0
+          ug_vertical_gradient_level(1) = 0.0_wp
        ENDIF  
 
@@ -943,5 +943,5 @@
 !--    (component vg)
        i = 1
-       gradient = 0.0
+       gradient = 0.0_wp
 
        IF ( .NOT. ocean )  THEN
@@ -952,11 +952,11 @@
              IF ( i < 11 ) THEN 
                 IF ( vg_vertical_gradient_level(i) < zu(k)  .AND. &
-                     vg_vertical_gradient_level(i) >= 0.0 )  THEN
-                   gradient = vg_vertical_gradient(i) / 100.0
+                     vg_vertical_gradient_level(i) >= 0.0_wp )  THEN
+                   gradient = vg_vertical_gradient(i) / 100.0_wp
                    vg_vertical_gradient_level_ind(i) = k - 1
                    i = i + 1
                 ENDIF
              ENDIF
-             IF ( gradient /= 0.0 )  THEN
+             IF ( gradient /= 0.0_wp )  THEN
                 IF ( k /= 1 )  THEN
                    vg(k) = vg(k-1) + dzu(k) * gradient
@@ -976,16 +976,16 @@
              IF ( i < 11 ) THEN
                 IF ( vg_vertical_gradient_level(i) > zu(k)  .AND. &
-                     vg_vertical_gradient_level(i) <= 0.0 )  THEN
-                   gradient = vg_vertical_gradient(i) / 100.0
+                     vg_vertical_gradient_level(i) <= 0.0_wp )  THEN
+                   gradient = vg_vertical_gradient(i) / 100.0_wp
                    vg_vertical_gradient_level_ind(i) = k + 1
                    i = i + 1
                 ENDIF
              ENDIF
-             IF ( gradient /= 0.0 )  THEN
+             IF ( gradient /= 0.0_wp )  THEN
                 IF ( k /= nzt )  THEN
                    vg(k) = vg(k+1) - dzu(k+1) * gradient
                 ELSE
-                   vg(k)   = vg_surface - 0.5 * dzu(k+1) * gradient
-                   vg(k+1) = vg_surface + 0.5 * dzu(k+1) * gradient
+                   vg(k)   = vg_surface - 0.5_wp * dzu(k+1) * gradient
+                   vg(k+1) = vg_surface + 0.5_wp * dzu(k+1) * gradient
                 ENDIF
              ELSE
@@ -999,5 +999,5 @@
 !--    In case of no given gradients for vg, choose a zero gradient
        IF ( vg_vertical_gradient_level(1) == -9999999.9_wp )  THEN
-          vg_vertical_gradient_level(1) = 0.0
+          vg_vertical_gradient_level(1) = 0.0_wp
        ENDIF
 
@@ -1010,7 +1010,7 @@
           v_init = vg
 
-       ELSEIF ( u_profile(1) == 0.0  .AND.  v_profile(1) == 0.0 )  THEN
-
-          IF ( uv_heights(1) /= 0.0 )  THEN
+       ELSEIF ( u_profile(1) == 0.0_wp  .AND.  v_profile(1) == 0.0_wp )  THEN
+
+          IF ( uv_heights(1) /= 0.0_wp )  THEN
              message_string = 'uv_heights(1) must be 0.0'
              CALL message( 'check_parameters', 'PA0345', 1, 2, 0, 6, 0 )
@@ -1020,6 +1020,6 @@
 
           kk = 1
-          u_init(0) = 0.0
-          v_init(0) = 0.0
+          u_init(0) = 0.0_wp
+          v_init(0) = 0.0_wp
 
           DO  k = 1, nz+1
@@ -1058,5 +1058,5 @@
 
           i = 1
-          gradient = 0.0
+          gradient = 0.0_wp
 
           IF ( .NOT. ocean )  THEN
@@ -1066,11 +1066,11 @@
                 IF ( i < 11 ) THEN
                    IF ( pt_vertical_gradient_level(i) < zu(k)  .AND. &
-                        pt_vertical_gradient_level(i) >= 0.0 )  THEN
-                      gradient = pt_vertical_gradient(i) / 100.0
+                        pt_vertical_gradient_level(i) >= 0.0_wp )  THEN
+                      gradient = pt_vertical_gradient(i) / 100.0_wp
                       pt_vertical_gradient_level_ind(i) = k - 1
                       i = i + 1
                    ENDIF
                 ENDIF
-                IF ( gradient /= 0.0 )  THEN
+                IF ( gradient /= 0.0_wp )  THEN
                    IF ( k /= 1 )  THEN
                       pt_init(k) = pt_init(k-1) + dzu(k) * gradient
@@ -1089,16 +1089,16 @@
                 IF ( i < 11 ) THEN
                    IF ( pt_vertical_gradient_level(i) > zu(k)  .AND. &
-                        pt_vertical_gradient_level(i) <= 0.0 )  THEN
-                      gradient = pt_vertical_gradient(i) / 100.0
+                        pt_vertical_gradient_level(i) <= 0.0_wp )  THEN
+                      gradient = pt_vertical_gradient(i) / 100.0_wp
                       pt_vertical_gradient_level_ind(i) = k + 1
                       i = i + 1
                    ENDIF
                 ENDIF
-                IF ( gradient /= 0.0 )  THEN
+                IF ( gradient /= 0.0_wp )  THEN
                    IF ( k /= nzt )  THEN
                       pt_init(k) = pt_init(k+1) - dzu(k+1) * gradient
                    ELSE
-                      pt_init(k)   = pt_surface - 0.5 * dzu(k+1) * gradient
-                      pt_init(k+1) = pt_surface + 0.5 * dzu(k+1) * gradient
+                      pt_init(k)   = pt_surface - 0.5_wp * dzu(k+1) * gradient
+                      pt_init(k+1) = pt_surface + 0.5_wp * dzu(k+1) * gradient
                    ENDIF
                 ELSE
@@ -1115,5 +1115,5 @@
 !--    stratification
        IF ( pt_vertical_gradient_level(1) == -9999999.9_wp )  THEN
-          pt_vertical_gradient_level(1) = 0.0
+          pt_vertical_gradient_level(1) = 0.0_wp
        ENDIF
 
@@ -1141,16 +1141,16 @@
 
           i = 1
-          gradient = 0.0
+          gradient = 0.0_wp
           q_vertical_gradient_level_ind(1) = 0
           DO  k = 1, nzt+1
              IF ( i < 11 ) THEN
                 IF ( q_vertical_gradient_level(i) < zu(k)  .AND. &
-                     q_vertical_gradient_level(i) >= 0.0 )  THEN
-                   gradient = q_vertical_gradient(i) / 100.0
+                     q_vertical_gradient_level(i) >= 0.0_wp )  THEN
+                   gradient = q_vertical_gradient(i) / 100.0_wp
                    q_vertical_gradient_level_ind(i) = k - 1
                    i = i + 1
                 ENDIF
              ENDIF
-             IF ( gradient /= 0.0 )  THEN
+             IF ( gradient /= 0.0_wp )  THEN
                 IF ( k /= 1 )  THEN
                    q_init(k) = q_init(k-1) + dzu(k) * gradient
@@ -1163,6 +1163,6 @@
 !
 !--          Avoid negative humidities
-             IF ( q_init(k) < 0.0 )  THEN
-                q_init(k) = 0.0
+             IF ( q_init(k) < 0.0_wp )  THEN
+                q_init(k) = 0.0_wp
              ENDIF
           ENDDO
@@ -1171,6 +1171,6 @@
 !--       In case of no given humidity gradients, choose zero gradient
 !--       conditions
-          IF ( q_vertical_gradient_level(1) == -1.0 )  THEN
-             q_vertical_gradient_level(1) = 0.0
+          IF ( q_vertical_gradient_level(1) == -1.0_wp )  THEN
+             q_vertical_gradient_level(1) = 0.0_wp
           ENDIF
 !
@@ -1186,5 +1186,5 @@
 
           i = 1
-          gradient = 0.0
+          gradient = 0.0_wp
 
           sa_vertical_gradient_level_ind(1) = nzt+1
@@ -1192,16 +1192,16 @@
              IF ( i < 11 ) THEN
                 IF ( sa_vertical_gradient_level(i) > zu(k)  .AND. &
-                     sa_vertical_gradient_level(i) <= 0.0 )  THEN
-                   gradient = sa_vertical_gradient(i) / 100.0
+                     sa_vertical_gradient_level(i) <= 0.0_wp )  THEN
+                   gradient = sa_vertical_gradient(i) / 100.0_wp
                    sa_vertical_gradient_level_ind(i) = k + 1
                    i = i + 1
                 ENDIF
              ENDIF
-             IF ( gradient /= 0.0 )  THEN
+             IF ( gradient /= 0.0_wp )  THEN
                 IF ( k /= nzt )  THEN
                    sa_init(k) = sa_init(k+1) - dzu(k+1) * gradient
                 ELSE
-                   sa_init(k)   = sa_surface - 0.5 * dzu(k+1) * gradient
-                   sa_init(k+1) = sa_surface + 0.5 * dzu(k+1) * gradient
+                   sa_init(k)   = sa_surface - 0.5_wp * dzu(k+1) * gradient
+                   sa_init(k+1) = sa_surface + 0.5_wp * dzu(k+1) * gradient
                 ENDIF
              ELSE
@@ -1218,5 +1218,5 @@
        
           i = 1
-          gradient = 0.0
+          gradient = 0.0_wp
 
           IF ( .NOT. ocean ) THEN
@@ -1228,5 +1228,5 @@
                 IF ( i < 11 ) THEN
                    IF ( lad_vertical_gradient_level(i) < zu(k) .AND.  &
-                        lad_vertical_gradient_level(i) >= 0.0 ) THEN
+                        lad_vertical_gradient_level(i) >= 0.0_wp ) THEN
                       gradient = lad_vertical_gradient(i)
                       lad_vertical_gradient_level_ind(i) = k - 1
@@ -1234,5 +1234,5 @@
                    ENDIF
                 ENDIF
-                IF ( gradient /= 0.0 ) THEN
+                IF ( gradient /= 0.0_wp ) THEN
                    IF ( k /= 1 ) THEN
                       lad(k) = lad(k-1) + dzu(k) * gradient
@@ -1251,5 +1251,5 @@
 !--       gradient
           IF ( lad_vertical_gradient_level(1) == -9999999.9_wp ) THEN
-             lad_vertical_gradient_level(1) = 0.0
+             lad_vertical_gradient_level(1) = 0.0_wp
           ENDIF
 
@@ -1287,6 +1287,6 @@
 !
 !-- Compute Coriolis parameter
-    f  = 2.0 * omega * SIN( phi / 180.0 * pi )
-    fs = 2.0 * omega * COS( phi / 180.0 * pi )
+    f  = 2.0_wp * omega * SIN( phi / 180.0_wp * pi )
+    fs = 2.0_wp * omega * COS( phi / 180.0_wp * pi )
 
 !
@@ -1299,5 +1299,5 @@
        use_single_reference_value = .TRUE.
        IF ( pt_reference == 9999999.9_wp )  pt_reference = pt_surface
-       vpt_reference = pt_reference * ( 1.0 + 0.61 * q_surface )
+       vpt_reference = pt_reference * ( 1.0_wp + 0.61_wp * q_surface )
     ELSE
        message_string = 'illegal value for reference_state: "' // &
@@ -1315,5 +1315,5 @@
 !
 !-- Sign of buoyancy/stability terms
-    IF ( ocean )  atmos_ocean_sign = -1.0
+    IF ( ocean )  atmos_ocean_sign = -1.0_wp
 
 !
@@ -1326,6 +1326,6 @@
 !
 !-- In case of a given slope, compute the relevant quantities
-    IF ( alpha_surface /= 0.0 )  THEN
-       IF ( ABS( alpha_surface ) > 90.0 )  THEN
+    IF ( alpha_surface /= 0.0_wp )  THEN
+       IF ( ABS( alpha_surface ) > 90.0_wp )  THEN
           WRITE( message_string, * ) 'ABS( alpha_surface = ', alpha_surface, &
                                      ' ) must be < 90.0'
@@ -1333,12 +1333,12 @@
        ENDIF
        sloping_surface = .TRUE.
-       cos_alpha_surface = COS( alpha_surface / 180.0 * pi )
-       sin_alpha_surface = SIN( alpha_surface / 180.0 * pi )
+       cos_alpha_surface = COS( alpha_surface / 180.0_wp * pi )
+       sin_alpha_surface = SIN( alpha_surface / 180.0_wp * pi )
     ENDIF
 
 !
 !-- Check time step and cfl_factor
-    IF ( dt /= -1.0 )  THEN
-       IF ( dt <= 0.0  .AND.  dt /= -1.0 )  THEN
+    IF ( dt /= -1.0_wp )  THEN
+       IF ( dt <= 0.0_wp  .AND.  dt /= -1.0_wp )  THEN
           WRITE( message_string, * ) 'dt = ', dt , ' <= 0.0'
           CALL message( 'check_parameters', 'PA0044', 1, 2, 0, 6, 0 )
@@ -1348,12 +1348,12 @@
     ENDIF
 
-    IF ( cfl_factor <= 0.0  .OR.  cfl_factor > 1.0 )  THEN
-       IF ( cfl_factor == -1.0 )  THEN
+    IF ( cfl_factor <= 0.0_wp  .OR.  cfl_factor > 1.0_wp )  THEN
+       IF ( cfl_factor == -1.0_wp )  THEN
           IF ( timestep_scheme == 'runge-kutta-2' )  THEN
-             cfl_factor = 0.8
+             cfl_factor = 0.8_wp
           ELSEIF ( timestep_scheme == 'runge-kutta-3' )  THEN
-             cfl_factor = 0.9
+             cfl_factor = 0.9_wp
           ELSE
-             cfl_factor = 0.9
+             cfl_factor = 0.9_wp
           ENDIF
        ELSE
@@ -1371,8 +1371,8 @@
 !-- Store reference time for coupled runs and change the coupling flag,
 !-- if ...
-    IF ( simulated_time == 0.0 )  THEN
-       IF ( coupling_start_time == 0.0 )  THEN
-          time_since_reference_point = 0.0
-       ELSEIF ( time_since_reference_point < 0.0 )  THEN
+    IF ( simulated_time == 0.0_wp )  THEN
+       IF ( coupling_start_time == 0.0_wp )  THEN
+          time_since_reference_point = 0.0_wp
+       ELSEIF ( time_since_reference_point < 0.0_wp )  THEN
           run_coupled = .FALSE.
        ENDIF
@@ -1382,20 +1382,20 @@
 !-- Set wind speed in the Galilei-transformed system
     IF ( galilei_transformation )  THEN
-       IF ( use_ug_for_galilei_tr .AND.                  &
-            ug_vertical_gradient_level(1) == 0.0  .AND.  &
-            ug_vertical_gradient(1) == 0.0  .AND.        & 
-            vg_vertical_gradient_level(1) == 0.0  .AND.  &
-            vg_vertical_gradient(1) == 0.0 )  THEN
-          u_gtrans = ug_surface * 0.6
-          v_gtrans = vg_surface * 0.6
-       ELSEIF ( use_ug_for_galilei_tr  .AND.                  &
-                ( ug_vertical_gradient_level(1) /= 0.0  .OR.  &
-                ug_vertical_gradient(1) /= 0.0 ) )  THEN
+       IF ( use_ug_for_galilei_tr .AND.                     &
+            ug_vertical_gradient_level(1) == 0.0_wp  .AND.  &
+            ug_vertical_gradient(1) == 0.0_wp  .AND.        & 
+            vg_vertical_gradient_level(1) == 0.0_wp  .AND.  &
+            vg_vertical_gradient(1) == 0.0_wp )  THEN
+          u_gtrans = ug_surface * 0.6_wp
+          v_gtrans = vg_surface * 0.6_wp
+       ELSEIF ( use_ug_for_galilei_tr  .AND.                     &
+                ( ug_vertical_gradient_level(1) /= 0.0_wp  .OR.  &
+                ug_vertical_gradient(1) /= 0.0_wp ) )  THEN
           message_string = 'baroclinity (ug) not allowed simultaneously' // &
                            ' with galilei transformation'
           CALL message( 'check_parameters', 'PA0046', 1, 2, 0, 6, 0 )
-       ELSEIF ( use_ug_for_galilei_tr  .AND.                  &
-                ( vg_vertical_gradient_level(1) /= 0.0  .OR.  &
-                vg_vertical_gradient(1) /= 0.0 ) )  THEN
+       ELSEIF ( use_ug_for_galilei_tr  .AND.                     &
+                ( vg_vertical_gradient_level(1) /= 0.0_wp  .OR.  &
+                vg_vertical_gradient(1) /= 0.0_wp ) )  THEN
           message_string = 'baroclinity (vg) not allowed simultaneously' // &
                            ' with galilei transformation'
@@ -1561,5 +1561,5 @@
     IF ( neutral )  THEN
 
-       IF ( surface_heatflux /= 0.0  .AND.  surface_heatflux /= 9999999.9_wp ) &
+       IF ( surface_heatflux /= 0.0_wp  .AND.  surface_heatflux /= 9999999.9_wp ) &
        THEN
           message_string = 'heatflux must not be set for pure neutral flow'
@@ -1590,10 +1590,10 @@
 !-- forbidden.
     IF ( ibc_pt_b == 0  .AND.   constant_heatflux  .AND. &
-         surface_heatflux /= 0.0 )  THEN
+         surface_heatflux /= 0.0_wp )  THEN
        message_string = 'boundary_condition: bc_pt_b = "' // TRIM( bc_pt_b ) //&
                         '& is not allowed with constant_heatflux = .TRUE.'
        CALL message( 'check_parameters', 'PA0065', 1, 2, 0, 6, 0 )
     ENDIF
-    IF ( constant_heatflux  .AND.  pt_surface_initial_change /= 0.0 )  THEN
+    IF ( constant_heatflux  .AND.  pt_surface_initial_change /= 0.0_wp )  THEN
        WRITE ( message_string, * )  'constant_heatflux = .TRUE. is not allo', &
                'wed with pt_surface_initial_change (/=0) = ', &
@@ -1607,5 +1607,5 @@
 !-- forbidden.
     IF ( ibc_pt_t == 0  .AND.   constant_top_heatflux  .AND. &
-         top_heatflux /= 0.0 )  THEN
+         top_heatflux /= 0.0_wp )  THEN
        message_string = 'boundary_condition: bc_pt_t = "' // TRIM( bc_pt_t ) //&
                         '" is not allowed with constant_top_heatflux = .TRUE.'
@@ -1639,5 +1639,5 @@
 !--    forbidden.
        IF ( ibc_sa_t == 0  .AND.   constant_top_salinityflux  .AND. &
-            top_salinityflux /= 0.0 )  THEN
+            top_salinityflux /= 0.0_wp )  THEN
           message_string = 'boundary condition: bc_sa_t = "' // &
                            TRIM( bc_sa_t ) // '" is not allowed with ' // &
@@ -1706,5 +1706,5 @@
           CALL message( 'check_parameters', 'PA0073', 1, 2, 0, 6, 0 )
        ENDIF
-       IF ( constant_waterflux  .AND.  q_surface_initial_change /= 0.0 )  THEN
+       IF ( constant_waterflux  .AND.  q_surface_initial_change /= 0.0_wp )  THEN
           WRITE( message_string, * )  'a prescribed surface flux is not allo', &
                  'wed with ', sq, '_surface_initial_change (/=0) = ', &
@@ -1747,6 +1747,6 @@
 !--          Velocities for the initial u,v-profiles are set zero at the top
 !--          in case of dirichlet_0 conditions
-             u_init(nzt+1)    = 0.0
-             v_init(nzt+1)    = 0.0
+             u_init(nzt+1)    = 0.0_wp
+             v_init(nzt+1)    = 0.0_wp
           ENDIF
        ELSEIF ( bc_uv_t == 'neumann' )  THEN
@@ -1761,8 +1761,8 @@
 !
 !-- Compute and check, respectively, the Rayleigh Damping parameter
-    IF ( rayleigh_damping_factor == -1.0 )  THEN
-       rayleigh_damping_factor = 0.0
+    IF ( rayleigh_damping_factor == -1.0_wp )  THEN
+       rayleigh_damping_factor = 0.0_wp
     ELSE
-       IF ( rayleigh_damping_factor < 0.0 .OR. rayleigh_damping_factor > 1.0 ) &
+       IF ( rayleigh_damping_factor < 0.0 .OR. rayleigh_damping_factor > 1.0_wp ) &
        THEN
           WRITE( message_string, * )  'rayleigh_damping_factor = ', &
@@ -1772,13 +1772,13 @@
     ENDIF
 
-    IF ( rayleigh_damping_height == -1.0 )  THEN
+    IF ( rayleigh_damping_height == -1.0_wp )  THEN
        IF ( .NOT. ocean )  THEN
-          rayleigh_damping_height = 0.66666666666 * zu(nzt)
+          rayleigh_damping_height = 0.66666666666_wp * zu(nzt)
        ELSE
-          rayleigh_damping_height = 0.66666666666 * zu(nzb)
+          rayleigh_damping_height = 0.66666666666_wp * zu(nzb)
        ENDIF
     ELSE
        IF ( .NOT. ocean )  THEN
-          IF ( rayleigh_damping_height < 0.0  .OR. &
+          IF ( rayleigh_damping_height < 0.0_wp  .OR. &
                rayleigh_damping_height > zu(nzt) )  THEN
              WRITE( message_string, * )  'rayleigh_damping_height = ', &
@@ -1787,5 +1787,5 @@
           ENDIF
        ELSE
-          IF ( rayleigh_damping_height > 0.0  .OR. &
+          IF ( rayleigh_damping_height > 0.0_wp  .OR. &
                rayleigh_damping_height < zu(nzb) )  THEN
              WRITE( message_string, * )  'rayleigh_damping_height = ', &
@@ -1816,6 +1816,6 @@
 !-- Check the interval for sorting particles.
 !-- Using particles as cloud droplets requires sorting after each timestep.
-    IF ( dt_sort_particles /= 0.0  .AND.  cloud_droplets )  THEN
-       dt_sort_particles = 0.0
+    IF ( dt_sort_particles /= 0.0_wp  .AND.  cloud_droplets )  THEN
+       dt_sort_particles = 0.0_wp
        message_string = 'dt_sort_particles is reset to 0.0 because of cloud' //&
                         '_droplets = .TRUE.'
@@ -1899,5 +1899,5 @@
 !-- value (tries to minimize the number of calls of flow_statistics)
     IF ( dt_dots == 9999999.9_wp )  THEN
-       IF ( averaging_interval_pr == 0.0 )  THEN
+       IF ( averaging_interval_pr == 0.0_wp )  THEN
           dt_dots = MIN( dt_run_control, dt_dopr )
        ELSE
@@ -1983,5 +1983,5 @@
                    dopr_initial_index(i) = 7
                    hom(:,2,7,:)          = SPREAD( zu, 2, statistic_regions+1 )
-                   hom(nzb,2,7,:)        = 0.0    ! because zu(nzb) is negative
+                   hom(nzb,2,7,:)        = 0.0_wp    ! because zu(nzb) is negative
                    data_output_pr(i)     = data_output_pr(i)(2:)
                 ENDIF
@@ -1993,5 +1993,5 @@
                    dopr_initial_index(i) = 28
                    hom(:,2,28,:)         = SPREAD( zu, 2, statistic_regions+1 )
-                   hom(nzb,2,28,:)       = 0.0    ! because zu(nzb) is negative
+                   hom(nzb,2,28,:)       = 0.0_wp    ! because zu(nzb) is negative
                    data_output_pr(i)     = data_output_pr(i)(2:)
                 ENDIF
@@ -2002,5 +2002,5 @@
              dopr_unit(i)   = 'm2/s2'
              hom(:,2,8,:)   = SPREAD( zu, 2, statistic_regions+1 )
-             hom(nzb,2,8,:) = 0.0
+             hom(nzb,2,8,:) = 0.0_wp
 
           CASE ( 'km', '#km' )
@@ -2008,5 +2008,5 @@
              dopr_unit(i)   = 'm2/s'
              hom(:,2,9,:)   = SPREAD( zu, 2, statistic_regions+1 )
-             hom(nzb,2,9,:) = 0.0
+             hom(nzb,2,9,:) = 0.0_wp
              IF ( data_output_pr(i)(1:1) == '#' )  THEN
                 dopr_initial_index(i) = 23
@@ -2019,5 +2019,5 @@
              dopr_unit(i)    = 'm2/s'
              hom(:,2,10,:)   = SPREAD( zu, 2, statistic_regions+1 )
-             hom(nzb,2,10,:) = 0.0
+             hom(nzb,2,10,:) = 0.0_wp
              IF ( data_output_pr(i)(1:1) == '#' )  THEN
                 dopr_initial_index(i) = 24
@@ -2030,5 +2030,5 @@
              dopr_unit(i)    = 'm'
              hom(:,2,11,:)   = SPREAD( zu, 2, statistic_regions+1 )
-             hom(nzb,2,11,:) = 0.0
+             hom(nzb,2,11,:) = 0.0_wp
              IF ( data_output_pr(i)(1:1) == '#' )  THEN
                 dopr_initial_index(i) = 25
@@ -2109,5 +2109,5 @@
                    dopr_initial_index(i) = 26
                    hom(:,2,26,:)         = SPREAD( zu, 2, statistic_regions+1 )
-                   hom(nzb,2,26,:)       = 0.0    ! weil zu(nzb) negativ ist
+                   hom(nzb,2,26,:)       = 0.0_wp    ! because zu(nzb) is negative
                    data_output_pr(i)     = data_output_pr(i)(2:)
                 ENDIF
@@ -2182,5 +2182,5 @@
                    dopr_initial_index(i) = 26
                    hom(:,2,26,:)         = SPREAD( zu, 2, statistic_regions+1 )
-                   hom(nzb,2,26,:)       = 0.0    ! weil zu(nzb) negativ ist
+                   hom(nzb,2,26,:)       = 0.0_wp    ! because zu(nzb) is negative
                    data_output_pr(i)     = data_output_pr(i)(2:)
                 ENDIF
@@ -2200,5 +2200,5 @@
                    dopr_initial_index(i) = 26
                    hom(:,2,26,:)         = SPREAD( zu, 2, statistic_regions+1 )
-                   hom(nzb,2,26,:)       = 0.0    ! weil zu(nzb) negativ ist
+                   hom(nzb,2,26,:)       = 0.0_wp    ! because zu(nzb) is negative
                    data_output_pr(i)     = data_output_pr(i)(2:)
                 ENDIF
@@ -2213,5 +2213,5 @@
                    dopr_initial_index(i) = 26
                    hom(:,2,26,:)         = SPREAD( zu, 2, statistic_regions+1 )
-                   hom(nzb,2,26,:)       = 0.0    ! weil zu(nzb) negativ ist
+                   hom(nzb,2,26,:)       = 0.0_wp    ! because zu(nzb) is negative
                    data_output_pr(i)     = data_output_pr(i)(2:)
                 ENDIF
@@ -2223,5 +2223,5 @@
                    dopr_initial_index(i) = 27
                    hom(:,2,27,:)         = SPREAD( zu, 2, statistic_regions+1 )
-                   hom(nzb,2,27,:)       = 0.0    ! weil zu(nzb) negativ ist
+                   hom(nzb,2,27,:)       = 0.0_wp   ! because zu(nzb) is negative
                    data_output_pr(i)     = data_output_pr(i)(2:)
                 ENDIF
@@ -2241,5 +2241,5 @@
                    dopr_initial_index(i) = 7
                    hom(:,2,7,:)          = SPREAD( zu, 2, statistic_regions+1 )
-                   hom(nzb,2,7,:)        = 0.0    ! weil zu(nzb) negativ ist
+                   hom(nzb,2,7,:)        = 0.0_wp    ! because zu(nzb) is negative
                    data_output_pr(i)     = data_output_pr(i)(2:)
                 ENDIF
@@ -2253,5 +2253,5 @@
                 dopr_initial_index(i) = 29
                 hom(:,2,29,:)         = SPREAD( zu, 2, statistic_regions+1 )
-                hom(nzb,2,29,:)       = 0.0    ! weil zu(nzb) negativ ist
+                hom(nzb,2,29,:)       = 0.0_wp    ! because zu(nzb) is negative
                 data_output_pr(i)     = data_output_pr(i)(2:)
              ENDIF
@@ -2470,5 +2470,5 @@
                    dopr_initial_index(i) = 77
                    hom(:,2,77,:)         = SPREAD( zu, 2, statistic_regions+1 )
-                   hom(nzb,2,77,:)       = 0.0    ! because zu(nzb) is negative
+                   hom(nzb,2,77,:)       = 0.0_wp    ! because zu(nzb) is negative
                    data_output_pr(i)     = data_output_pr(i)(2:)
                 ENDIF
@@ -2977,5 +2977,5 @@
 !
 !-- Averaged 2d or 3d output requires that an averaging interval has been set
-    IF ( doav_n > 0  .AND.  averaging_interval == 0.0 )  THEN
+    IF ( doav_n > 0  .AND.  averaging_interval == 0.0_wp )  THEN
        WRITE( message_string, * )  'output of averaged quantity "',            &
                                    TRIM( doav(1) ), '_av" requires to set a ', &
@@ -3004,5 +3004,5 @@
 !
 !-- Upper plot limit for 2D vertical sections
-    IF ( z_max_do2d == -1.0 )  z_max_do2d = zu(nzt)
+    IF ( z_max_do2d == -1.0_wp )  z_max_do2d = zu(nzt)
     IF ( z_max_do2d < zu(nzb+1)  .OR.  z_max_do2d > zu(nzt) )  THEN
        WRITE( message_string, * )  'z_max_do2d = ', z_max_do2d, &
@@ -3066,5 +3066,5 @@
        mask_scale(2) = mask_scale_y
        mask_scale(3) = mask_scale_z
-       IF ( ANY( mask_scale <= 0.0 ) )  THEN
+       IF ( ANY( mask_scale <= 0.0_wp ) )  THEN
           WRITE( message_string, * )  &
                'illegal value: mask_scale_x, mask_scale_y and mask_scale_z', &
@@ -3151,10 +3151,10 @@
 !
 !-- Check, whether a constant diffusion coefficient shall be used
-    IF ( km_constant /= -1.0 )  THEN
-       IF ( km_constant < 0.0 )  THEN
+    IF ( km_constant /= -1.0_wp )  THEN
+       IF ( km_constant < 0.0_wp )  THEN
           WRITE( message_string, * )  'km_constant = ', km_constant, ' < 0.0'
           CALL message( 'check_parameters', 'PA0121', 1, 2, 0, 6, 0 )
        ELSE
-          IF ( prandtl_number < 0.0 )  THEN
+          IF ( prandtl_number < 0.0_wp )  THEN
              WRITE( message_string, * )  'prandtl_number = ', prandtl_number, &
                                          ' < 0.0'
@@ -3175,5 +3175,5 @@
 !-- potential temperature, check the width of the damping layer
     IF ( bc_lr /= 'cyclic' ) THEN
-       IF ( pt_damping_width < 0.0  .OR.  pt_damping_width > REAL( nx * dx ) )  THEN
+       IF ( pt_damping_width < 0.0_wp  .OR.  pt_damping_width > REAL( nx * dx ) )  THEN
           message_string = 'pt_damping_width out of range'
           CALL message( 'check_parameters', 'PA0124', 1, 2, 0, 6, 0 )
@@ -3182,5 +3182,5 @@
 
     IF ( bc_ns /= 'cyclic' )  THEN
-       IF ( pt_damping_width < 0.0  .OR.  pt_damping_width > REAL( ny * dy ) )  THEN
+       IF ( pt_damping_width < 0.0_wp  .OR.  pt_damping_width > REAL( ny * dy ) )  THEN
           message_string = 'pt_damping_width out of range'
           CALL message( 'check_parameters', 'PA0124', 1, 2, 0, 6, 0 )
@@ -3343,5 +3343,5 @@
 !
 !--       Set the default value for the width of the recycling domain
-          recycling_width = 0.1 * nx * dx
+          recycling_width = 0.1_wp * nx * dx
        ELSE
           IF ( recycling_width < dx  .OR.  recycling_width > nx * dx )  THEN
@@ -3368,8 +3368,8 @@
 !-- Determine damping level index for 1D model
     IF ( INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 )  THEN
-       IF ( damp_level_1d == -1.0 )  THEN
+       IF ( damp_level_1d == -1.0_wp )  THEN
           damp_level_1d     = zu(nzt+1)
           damp_level_ind_1d = nzt + 1
-       ELSEIF ( damp_level_1d < 0.0  .OR.  damp_level_1d > zu(nzt+1) )  THEN
+       ELSEIF ( damp_level_1d < 0.0_wp  .OR.  damp_level_1d > zu(nzt+1) )  THEN
           WRITE( message_string, * )  'damp_level_1d = ', damp_level_1d, &
                  ' must be > 0.0 and < ', zu(nzt+1), '(zu(nzt+1))'
@@ -3416,9 +3416,9 @@
 !
 !-- Set default value of the time needed to terminate a model run
-    IF ( termination_time_needed == -1.0 )  THEN
+    IF ( termination_time_needed == -1.0_wp )  THEN
        IF ( host(1:3) == 'ibm' )  THEN
-          termination_time_needed = 300.0
+          termination_time_needed = 300.0_wp
        ELSE
-          termination_time_needed = 35.0
+          termination_time_needed = 35.0_wp
        ENDIF
     ENDIF
@@ -3430,5 +3430,5 @@
 !--    Time needed must be at least 30 seconds on all CRAY machines, because
 !--    MPP_TREMAIN gives the remaining CPU time only in steps of 30 seconds
-       IF ( termination_time_needed <= 30.0 )  THEN
+       IF ( termination_time_needed <= 30.0_wp )  THEN
           WRITE( message_string, * )  'termination_time_needed = ', &
                  termination_time_needed, ' must be > 30.0 on host "', &
@@ -3441,5 +3441,5 @@
 !--    because the job time consumed before executing palm (for compiling,
 !--    copying of files, etc.) has to be regarded
-       IF ( termination_time_needed < 300.0 )  THEN
+       IF ( termination_time_needed < 300.0_wp )  THEN
           WRITE( message_string, * )  'termination_time_needed = ', &
                  termination_time_needed, ' should be >= 300.0 on host "', &
@@ -3462,5 +3462,5 @@
           CALL message( 'check_parameters', 'PA0151', 1, 2, 0, 6, 0 )
        ENDIF
-       IF ( .NOT. ANY( dpdxy /= 0.0 ) )  THEN
+       IF ( .NOT. ANY( dpdxy /= 0.0_wp ) )  THEN
           WRITE( message_string, * )  'dp_external is .TRUE. but dpdxy is ze', &
                'ro, i.e. the external pressure gradient & will not be applied'
@@ -3468,5 +3468,5 @@
        ENDIF
     ENDIF
-    IF ( ANY( dpdxy /= 0.0 ) .AND. .NOT. dp_external )  THEN
+    IF ( ANY( dpdxy /= 0.0_wp ) .AND. .NOT. dp_external )  THEN
        WRITE( message_string, * )  'dpdxy is nonzero but dp_external is ', &
             '.FALSE., i.e. the external pressure gradient & will not be applied'
@@ -3499,5 +3499,5 @@
        ENDIF
     ENDIF
-    IF ( ( u_bulk /= 0.0 .OR. v_bulk /= 0.0 ) .AND.  &
+    IF ( ( u_bulk /= 0.0_wp .OR. v_bulk /= 0.0_wp ) .AND.  &
          ( .NOT. conserve_volume_flow .OR.  &
          TRIM( conserve_volume_flow_mode ) /= 'bulk_velocity' ) )  THEN
Index: /palm/trunk/SOURCE/compute_vpt.f90
===================================================================
--- /palm/trunk/SOURCE/compute_vpt.f90	(revision 1352)
+++ /palm/trunk/SOURCE/compute_vpt.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -68,12 +68,12 @@
 
     IF ( .NOT. cloud_physics  .AND.  .NOT. cloud_droplets )  THEN
-       vpt = pt * ( 1.0 + 0.61 * q )
+       vpt = pt * ( 1.0_wp + 0.61_wp * q )
     ELSE IF (cloud_physics)  THEN
        DO  k = nzb, nzt+1
           vpt(k,:,:) = ( pt(k,:,:) + pt_d_t(k) * l_d_cp * ql(k,:,:) ) *        &
-                       ( 1.0 + 0.61 * q(k,:,:) - 1.61 * ql(k,:,:) ) 
+                       ( 1.0_wp + 0.61_wp * q(k,:,:) - 1.61_wp * ql(k,:,:) ) 
        ENDDO
     ELSE
-       vpt = pt * ( 1.0 + 0.61 * q - ql ) 
+       vpt = pt * ( 1.0_wp + 0.61_wp * q - ql ) 
     ENDIF
 
Index: /palm/trunk/SOURCE/coriolis.f90
===================================================================
--- /palm/trunk/SOURCE/coriolis.f90	(revision 1352)
+++ /palm/trunk/SOURCE/coriolis.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -106,8 +106,8 @@
                 DO  j = nys, nyn
                    DO  k = nzb_u_inner(j,i)+1, nzt
-                      tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25 *             &
+                      tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25_wp *          &
                                    ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +    &
                                      v(k,j+1,i) ) - vg(k) )                    &
-                                             - fs *    ( 0.25 *                &
+                                                - fs *    ( 0.25_wp *          &
                                    ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) +  &
                                      w(k,j,i)   ) &
@@ -123,5 +123,5 @@
                 DO  j = nysv, nyn
                    DO  k = nzb_v_inner(j,i)+1, nzt
-                      tend(k,j,i) = tend(k,j,i) - f *     ( 0.25 *             &
+                      tend(k,j,i) = tend(k,j,i) - f *     ( 0.25_wp *          &
                                    ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) +    &
                                      u(k,j,i+1) ) - ug(k) )
@@ -136,5 +136,5 @@
                 DO  j = nys, nyn
                    DO  k = nzb_w_inner(j,i)+1, nzt
-                      tend(k,j,i) = tend(k,j,i) + fs * 0.25 *                  &
+                      tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp *               &
                                    ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +      &
                                      u(k+1,j,i+1) )
@@ -190,8 +190,8 @@
                    DO  k = 1, nzt
                       IF  ( k > nzb_u_inner(j,i) )  THEN
-                         tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25 *          &
+                         tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25_wp *       &
                                       ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + &
                                         v(k,j+1,i) ) - vg(k) )                 &
-                                                - fs *    ( 0.25 *             &
+                                                   - fs *    ( 0.25_wp *       &
                                       ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) &
                                         + w(k,j,i)   )                         &
@@ -211,5 +211,5 @@
                    DO  k = 1, nzt
                       IF  ( k > nzb_v_inner(j,i) )  THEN
-                         tend(k,j,i) = tend(k,j,i) - f *     ( 0.25 *          &
+                         tend(k,j,i) = tend(k,j,i) - f *     ( 0.25_wp *       &
                                       ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + &
                                         u(k,j,i+1) ) - ug(k) )
@@ -228,5 +228,5 @@
                    DO  k = 1, nzt
                       IF  ( k > nzb_w_inner(j,i) )  THEN
-                         tend(k,j,i) = tend(k,j,i) + fs * 0.25 *               &
+                         tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp *            &
                                       ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +   &
                                         u(k+1,j,i+1) )
@@ -278,8 +278,8 @@
           CASE ( 1 )
              DO  k = nzb_u_inner(j,i)+1, nzt
-                tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25 *                   &
+                tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25_wp *                &
                                 ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +       &
                                   v(k,j+1,i) ) - vg(k) )                       &
-                                          - fs *    ( 0.25 *                   &
+                                          - fs *    ( 0.25_wp *                &
                                 ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) +     &
                                   w(k,j,i)   ) )
@@ -290,5 +290,5 @@
           CASE ( 2 )
              DO  k = nzb_v_inner(j,i)+1, nzt
-                tend(k,j,i) = tend(k,j,i) - f *     ( 0.25 *                   &
+                tend(k,j,i) = tend(k,j,i) - f *     ( 0.25_wp *                &
                                 ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) +       &
                                   u(k,j,i+1) ) - ug(k) )
@@ -299,5 +299,5 @@
           CASE ( 3 )
              DO  k = nzb_w_inner(j,i)+1, nzt
-                tend(k,j,i) = tend(k,j,i) + fs * 0.25 *                        &
+                tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp *                     &
                                 ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +         &
                                   u(k+1,j,i+1) )
Index: /palm/trunk/SOURCE/cpulog.f90
===================================================================
--- /palm/trunk/SOURCE/cpulog.f90	(revision 1352)
+++ /palm/trunk/SOURCE/cpulog.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -100,8 +100,10 @@
     END TYPE logpoint
 
-    TYPE(logpoint), DIMENSION(100) ::  log_point = logpoint( 0.0, 0.0, 0.0,   &
-                                       0.0, 0.0, 0.0, 0.0, 0, ' ' ),          &
-                                       log_point_s = logpoint( 0.0, 0.0, 0.0, &
-                                       0.0, 0.0, 0.0, 0.0, 0, ' ' )
+    TYPE(logpoint), DIMENSION(100) ::  log_point = logpoint( 0.0_wp, 0.0_wp,   &
+                                       0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, &
+                                       0, ' ' ),                               &
+                                       log_point_s = logpoint( 0.0_wp, 0.0_wp, &
+                                       0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, &
+                                       0, ' ' )
 
     SAVE
@@ -120,6 +122,6 @@
        LOGICAL, SAVE     ::  first = .TRUE.     !: 
        
-       REAL(wp)          ::  mtime = 0.0        !: 
-       REAL(wp)          ::   mtimevec = 0.0    !: 
+       REAL(wp)          ::  mtime = 0.0_wp     !: 
+       REAL(wp)          ::  mtimevec = 0.0_wp  !: 
        TYPE(logpoint)    ::  log_event          !: 
 
@@ -212,6 +214,6 @@
           log_event%vector   = log_event%vector + log_event%mtimevec
           log_event%counts   = log_event%counts + 1
-          log_event%isum     = 0.0
-          log_event%ivect    = 0.0
+          log_event%isum     = 0.0_wp
+          log_event%ivect    = 0.0_wp
        ELSE
           message_string = 'unknown modus of time measurement: ' // TRIM( modus )
@@ -239,5 +241,5 @@
        INTEGER(iwp)    ::  sender          !: 
        REAL(wp)       ::  average_cputime  !: 
-       REAL(wp), SAVE ::  norm = 1.0       !: 
+       REAL(wp), SAVE ::  norm = 1.0_wp    !: 
        REAL(wp), DIMENSION(:),   ALLOCATABLE ::  pe_max        !: 
        REAL(wp), DIMENSION(:),   ALLOCATABLE ::  pe_min        !: 
@@ -267,5 +269,5 @@
           pe_min = log_point%sum
           pe_max = log_point%sum    ! need to be set in case of 1 PE
-          pe_rms = 0.0
+          pe_rms = 0.0_wp
 
 #if defined( __parallel )
@@ -319,5 +321,5 @@
              sum = log_point%sum
           ELSEWHERE
-             sum = -1.0
+             sum = -1.0_wp
           ENDWHERE
 
@@ -328,5 +330,5 @@
                                REAL( nr_timesteps_this_run, KIND=wp ) * 1E6_wp  ! in micro-sec
           ELSE
-             average_cputime = -1.0
+             average_cputime = -1.0_wp
           ENDIF
 
@@ -354,10 +356,10 @@
              ii = MAXLOC( sum )
              i = ii(1)
-             IF ( sum(i) /= -1.0 )  THEN
+             IF ( sum(i) /= -1.0_wp )  THEN
                 WRITE ( 18, 102 ) &
-              log_point(i)%place, log_point(i)%sum,                &
-                   log_point(i)%sum / log_point(1)%sum * 100.0,         &
+              log_point(i)%place, log_point(i)%sum,                            &
+                   log_point(i)%sum / log_point(1)%sum * 100.0_wp,             &
                    log_point(i)%counts, pe_min(i), pe_max(i), pe_rms(i)
-                sum(i) = -1.0
+                sum(i) = -1.0_wp
              ELSE
                 EXIT
@@ -391,5 +393,5 @@
           pe_min = log_point_s%sum
           pe_max = log_point_s%sum    ! need to be set in case of 1 PE
-          pe_rms = 0.0
+          pe_rms = 0.0_wp
 
 #if defined( __parallel )
@@ -416,5 +418,5 @@
 !--          Calculate rms
              DO  i = 0, numprocs-1
-                pe_rms(iii) = pe_rms(iii) + ( &
+                pe_rms(iii) = pe_rms(iii) + (                                  &
                                     pe_log_points(iii,i) - log_point_s(iii)%sum &
                                             )**2
@@ -441,5 +443,5 @@
              sum = log_point_s%sum
           ELSEWHERE
-             sum = -1.0
+             sum = -1.0_wp
           ENDWHERE
 
@@ -450,10 +452,10 @@
              ii = MAXLOC( sum )
              i = ii(1)
-             IF ( sum(i) /= -1.0 )  THEN
-                WRITE ( 18, 102 ) &
-                   log_point_s(i)%place, log_point_s(i)%sum, &
-                   log_point_s(i)%sum / log_point(1)%sum * 100.0, &
+             IF ( sum(i) /= -1.0_wp )  THEN
+                WRITE ( 18, 102 )                                              &
+                   log_point_s(i)%place, log_point_s(i)%sum,                   &
+                   log_point_s(i)%sum / log_point(1)%sum * 100.0_wp,           &
                    log_point_s(i)%counts, pe_min(i), pe_max(i), pe_rms(i)
-                sum(i) = -1.0
+                sum(i) = -1.0_wp
              ELSE
                 EXIT
Index: /palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_2d.f90	(revision 1352)
+++ /palm/trunk/SOURCE/data_output_2d.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -235,5 +235,5 @@
              ns = ns - 1
              ALLOCATE( local_2d_sections(nxlg:nxrg,nysg:nyng,1:ns) )
-             local_2d_sections = 0.0
+             local_2d_sections = 0.0_wp
           ENDIF
 
@@ -266,5 +266,5 @@
              ALLOCATE( local_2d_sections(nxlg:nxrg,1:ns,nzb:nzt+1) )
              ALLOCATE( local_2d_sections_l(nxlg:nxrg,1:ns,nzb:nzt+1) )
-             local_2d_sections = 0.0; local_2d_sections_l = 0.0
+             local_2d_sections = 0.0_wp; local_2d_sections_l = 0.0_wp
           ENDIF
 
@@ -297,5 +297,5 @@
              ALLOCATE( local_2d_sections(1:ns,nysg:nyng,nzb:nzt+1) )
              ALLOCATE( local_2d_sections_l(1:ns,nysg:nyng,nzb:nzt+1) )
-             local_2d_sections = 0.0; local_2d_sections_l = 0.0
+             local_2d_sections = 0.0_wp; local_2d_sections_l = 0.0_wp
           ENDIF
 
@@ -400,5 +400,5 @@
                       CALL exchange_horiz( tend, nbgp )
                    ELSE
-                      tend = 0.0
+                      tend = 0.0_wp
                    ENDIF
                    DO  i = nxlg, nxrg
@@ -422,6 +422,6 @@
                             DO  k = nzb, nzt+1
                                psi = prt_start_index(k,j,i)
-                               s_r3 = 0.0
-                               s_r4 = 0.0
+                               s_r3 = 0.0_wp
+                               s_r4 = 0.0_wp
                                DO  n = psi, psi+prt_count(k,j,i)-1
                                   s_r3 = s_r3 + particles(n)%radius**3 *       &
@@ -430,8 +430,8 @@
                                                 particles(n)%weight_factor
                                ENDDO
-                               IF ( s_r3 /= 0.0 )  THEN
+                               IF ( s_r3 /= 0.0_wp )  THEN
                                   mean_r = s_r4 / s_r3
                                ELSE
-                                  mean_r = 0.0
+                                  mean_r = 0.0_wp
                                ENDIF
                                tend(k,j,i) = mean_r
@@ -441,5 +441,5 @@
                       CALL exchange_horiz( tend, nbgp )
                    ELSE
-                      tend = 0.0
+                      tend = 0.0_wp
                    END IF
                    DO  i = nxlg, nxrg
@@ -463,5 +463,5 @@
                    ENDDO
                 ENDDO
-                precipitation_amount = 0.0   ! reset for next integ. interval
+                precipitation_amount = 0.0_wp   ! reset for next integ. interval
                 resorted = .TRUE.
                 two_d = .TRUE.
@@ -608,5 +608,5 @@
                       CALL exchange_horiz( tend, nbgp )
                    ELSE
-                      tend = 0.0
+                      tend = 0.0_wp
                    END IF
                    DO  i = nxlg, nxrg
@@ -733,5 +733,5 @@
 !--             at the bottom boundary by the real surface values.
                 IF ( do2d(av,if) == 'u_xz'  .OR.  do2d(av,if) == 'u_yz' )  THEN
-                   IF ( ibc_uv_b == 0 )  local_pf(:,:,nzb) = 0.0
+                   IF ( ibc_uv_b == 0 )  local_pf(:,:,nzb) = 0.0_wp
                 ENDIF
 
@@ -765,5 +765,5 @@
 !--             at the bottom boundary by the real surface values.
                 IF ( do2d(av,if) == 'v_xz'  .OR.  do2d(av,if) == 'v_yz' )  THEN
-                   IF ( ibc_uv_b == 0 )  local_pf(:,:,nzb) = 0.0
+                   IF ( ibc_uv_b == 0 )  local_pf(:,:,nzb) = 0.0_wp
                 ENDIF
 
@@ -898,5 +898,5 @@
                    IF ( section(is,s) == -1  .AND.  .NOT. two_d )  THEN
 
-                      local_2d = 0.0
+                      local_2d = 0.0_wp
 !
 !--                   Carry out the averaging (all data are on the PE)
@@ -909,5 +909,5 @@
                       ENDDO
 
-                      local_2d = local_2d / ( nzt -nzb + 2.0)
+                      local_2d = local_2d / ( nzt -nzb + 2.0_wp)
 
                    ELSE
@@ -1089,5 +1089,5 @@
 
                       ALLOCATE( local_2d_l(nxlg:nxrg,nzb:nzt+1) )
-                      local_2d_l = 0.0
+                      local_2d_l = 0.0_wp
                       ngp = ( nxrg-nxlg+1 ) * ( nzt-nzb+2 )
 !
@@ -1111,5 +1111,5 @@
                       local_2d = local_2d_l
 #endif
-                      local_2d = local_2d / ( ny + 1.0 )
+                      local_2d = local_2d / ( ny + 1.0_wp )
 
                       DEALLOCATE( local_2d_l )
@@ -1308,5 +1308,5 @@
 
                       ALLOCATE( local_2d_l(nysg:nyng,nzb:nzt+1) )
-                      local_2d_l = 0.0
+                      local_2d_l = 0.0_wp
                       ngp = ( nyng-nysg+1 ) * ( nzt-nzb+2 )
 !
@@ -1330,5 +1330,5 @@
                       local_2d = local_2d_l
 #endif
-                      local_2d = local_2d / ( nx + 1.0 )
+                      local_2d = local_2d / ( nx + 1.0_wp )
 
                       DEALLOCATE( local_2d_l )
Index: /palm/trunk/SOURCE/data_output_3d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_3d.f90	(revision 1352)
+++ /palm/trunk/SOURCE/data_output_3d.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -257,6 +257,6 @@
                       DO  k = nzb, nz_do3d
                          psi = prt_start_index(k,j,i)
-                         s_r3 = 0.0
-                         s_r4 = 0.0
+                         s_r3 = 0.0_wp
+                         s_r4 = 0.0_wp
                          DO  n = psi, psi+prt_count(k,j,i)-1
                          s_r3 = s_r3 + particles(n)%radius**3 *                &
@@ -265,8 +265,8 @@
                                        particles(n)%weight_factor
                          ENDDO
-                         IF ( s_r3 /= 0.0 )  THEN
+                         IF ( s_r3 /= 0.0_wp )  THEN
                             mean_r = s_r4 / s_r3
                          ELSE
-                            mean_r = 0.0
+                            mean_r = 0.0_wp
                          ENDIF
                          tend(k,j,i) = mean_r
Index: /palm/trunk/SOURCE/data_output_dvrp.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_dvrp.f90	(revision 1352)
+++ /palm/trunk/SOURCE/data_output_dvrp.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -75,5 +75,5 @@
                  slicer_range_limits_dvrp(1,islice_dvrp) )
 
-       scale = MODULO( 180.0 + 180.0 * scale, 360.0_wp )
+       scale = MODULO( 180.0_wp + 180.0_wp * scale, 360.0_wp )
 
        color = (/ scale, 0.5_wp, 1.0_wp, 0.0_wp /)
@@ -231,5 +231,5 @@
 !--       Definition of characteristics of particle material
 !          tmp_r = 0.1;  tmp_g = 0.7;  tmp_b = 0.1;  tmp_t = 0.0
-          tmp_r = 0.0;  tmp_g = 0.0;  tmp_b = 0.0;  tmp_t = 0.0
+          tmp_r = 0.0_wp;  tmp_g = 0.0_wp;  tmp_b = 0.0_wp;  tmp_t = 0.0_wp
           CALL DVRP_MATERIAL_RGB( m-1, 1, tmp_r, tmp_g, tmp_b, tmp_t )
 
@@ -284,6 +284,7 @@
              ALLOCATE( psize(dvrp_nop), p_t(dvrp_nop), p_c(dvrp_nop), &
                        p_x(dvrp_nop), p_y(dvrp_nop), p_z(dvrp_nop) )
-             psize = 0.0;  p_t = 0;  p_c = 0.0;  p_x = 0.0;  p_y = 0.0
-             p_z   = 0.0
+             psize = 0.0_wp;  p_t = 0_wp;  p_c = 0.0_wp
+             p_x = 0.0_wp; p_y = 0.0_wp
+             p_z   = 0.0_wp
              k = 0
              DO  n = 1, number_of_particles
@@ -305,6 +306,7 @@
                        p_y(dvrp_not*maximum_number_of_tailpoints), &
                        p_z(dvrp_not*maximum_number_of_tailpoints) )
-             psize = 0.0;  p_t = 0;  p_c = 0.0;  p_x = 0.0;  p_y = 0.0
-             p_z   = 0.0;
+             psize = 0.0_wp;  p_t = 0_wp;  p_c = 0.0_wp
+             p_x = 0.0_wp;  p_y = 0.0_wp
+             p_z   = 0.0_wp
              i = 0
              k = 0
@@ -364,11 +366,11 @@
 
 
-       ELSEIF ( ( mode_dvrp(m)(1:10) == 'isosurface'  .OR.   &
-                  mode_dvrp(m)(1:6)  == 'slicer'           ) &
+       ELSEIF ( ( mode_dvrp(m)(1:10) == 'isosurface'  .OR.                     &
+                  mode_dvrp(m)(1:6)  == 'slicer'           )                   &
                   .AND.  output_variable /= ' ' )  THEN
 
 !
 !--       Create an intermediate array, properly dimensioned for plot-output 
-          ALLOCATE( local_pf(nxl_dvrp:nxr_dvrp+1,nys_dvrp:nyn_dvrp+1, &
+          ALLOCATE( local_pf(nxl_dvrp:nxr_dvrp+1,nys_dvrp:nyn_dvrp+1,          &
                              nzb:nz_do3d) )
 
@@ -390,7 +392,7 @@
 !--                Replace mirrored values at lower surface by real surface
 !--                values
-                   IF ( output_variable == 'u_xz'  .OR. &
+                   IF ( output_variable == 'u_xz'  .OR.                        &
                         output_variable == 'u_yz' )  THEN
-                      IF ( ibc_uv_b == 0 )  local_pf(:,:,nzb) = 0.0
+                      IF ( ibc_uv_b == 0 )  local_pf(:,:,nzb) = 0.0_wp
                    ENDIF
 
@@ -407,7 +409,7 @@
 !--                Replace mirrored values at lower surface by real surface
 !--                values
-                   IF ( output_variable == 'v_xz'  .OR. &
+                   IF ( output_variable == 'v_xz'  .OR.                        &
                         output_variable == 'v_yz' )  THEN
-                      IF ( ibc_uv_b == 0 )  local_pf(:,:,nzb) = 0.0
+                      IF ( ibc_uv_b == 0 )  local_pf(:,:,nzb) = 0.0_wp
                    ENDIF
 
@@ -453,5 +455,5 @@
                          DO  j = nys_dvrp, nyn_dvrp+1
                             DO  k = nzb, nz_do3d
-                               local_pf(i,j,k) = pt(k,j,i) + l_d_cp * &
+                               local_pf(i,j,k) = pt(k,j,i) + l_d_cp *          &
                                                  pt_d_t(k) * ql(k,j,i)
                             ENDDO
@@ -470,6 +472,6 @@
                       ENDDO            
                    ELSE                    
-                      message_string = 'if humidity/passive_scalar = '    // & 
-                            'FALSE output of ' // TRIM( output_variable ) // &
+                      message_string = 'if humidity/passive_scalar = '    //   & 
+                            'FALSE output of ' // TRIM( output_variable ) //   &
                             'is not provided' 
                       CALL message( 'data_output_dvrp', 'PA0183',&
@@ -487,6 +489,6 @@
                       ENDDO
                    ELSE                     
-                      message_string = 'if cloud_physics = FALSE '       // & 
-                                  'output of ' // TRIM( output_variable) // &
+                      message_string = 'if cloud_physics = FALSE '       //    & 
+                                  'output of ' // TRIM( output_variable) //    &
                                   'is not provided' 
                       CALL message( 'data_output_dvrp', 'PA0184',&
@@ -529,5 +531,5 @@
                 DO  j = nys_dvrp, nyn_dvrp+1
                    DO  k = nzb, nz_do3d
-                      local_pf(i,j,k) = 0.0
+                      local_pf(i,j,k) = 0.0_wp
                    ENDDO
                 ENDDO
@@ -547,10 +549,10 @@
              tmp_g = isosurface_color(2,n_isosurface)
              tmp_b = isosurface_color(3,n_isosurface)
-             tmp_t = 0.0
+             tmp_t = 0.0_wp
              CALL DVRP_MATERIAL_RGB( m-1, 1, tmp_r, tmp_g, tmp_b, tmp_t )
 
 !
 !--          Compute and plot isosurface in dvr-format
-             CALL DVRP_DATA( m-1, local_pf, 1, nx_dvrp, ny_dvrp, nz_dvrp, &
+             CALL DVRP_DATA( m-1, local_pf, 1, nx_dvrp, ny_dvrp, nz_dvrp,      &
                              cyclic_dvrp, cyclic_dvrp, cyclic_dvrp )
 
@@ -573,5 +575,5 @@
                 tmp_th = threshold(n_isosurface)
              ELSE
-                tmp_th = 1.0   ! nothing is plotted because array values are 0
+                tmp_th = 1.0_wp  ! nothing is plotted because array values are 0
              ENDIF
 
@@ -590,5 +592,5 @@
 !
 !--          Material and color definitions
-             tmp_r = 0.0;  tmp_g = 0.0;  tmp_b = 0.0;  tmp_t = 0.0
+             tmp_r = 0.0_wp;  tmp_g = 0.0_wp;  tmp_b = 0.0_wp;  tmp_t = 0.0_wp
              CALL DVRP_MATERIAL_RGB( m-1, 1, tmp_r, tmp_g, tmp_b, tmp_t )
 
@@ -610,11 +612,11 @@
              CALL user_dvrp_coltab( 'slicer', output_variable )
 
-             CALL DVRP_COLORTABLE_HLS( m-1, 1, interval_values_dvrp,     &
-                                       interval_h_dvrp, interval_l_dvrp, &
+             CALL DVRP_COLORTABLE_HLS( m-1, 1, interval_values_dvrp,           &
+                                       interval_h_dvrp, interval_l_dvrp,       &
                                        interval_s_dvrp, interval_a_dvrp )
 
 !
 !--          Compute and plot slicer in dvr-format
-             CALL DVRP_DATA( m-1, local_pf, 1, nx_dvrp, ny_dvrp, nz_dvrp, &
+             CALL DVRP_DATA( m-1, local_pf, 1, nx_dvrp, ny_dvrp, nz_dvrp,      &
                              cyclic_dvrp, cyclic_dvrp, cyclic_dvrp )
              tmp_pos = slicer_position
@@ -638,11 +640,11 @@
                    local_pfi(2,i,j,k) = v(k,j,i)
                    local_pfi(3,i,j,k) = w(k,j,i)
-                   tmp_norm           = SQRT( u(k,j,i) * u(k,j,i) + &
-                                              v(k,j,i) * v(k,j,i) + &
+                   tmp_norm           = SQRT( u(k,j,i) * u(k,j,i) +            &
+                                              v(k,j,i) * v(k,j,i) +            &
                                               w(k,j,i) * w(k,j,i) )
-                   tmp_alpha          = ACOS( 0.0 * u(k,j,i) / tmp_norm + &
-                                              0.0 * v(k,j,i) / tmp_norm - &
-                                              1.0 * w(k,j,i) / tmp_norm )
-                   tmp_alpha_w        = tmp_alpha / pi * 180.0
+                   tmp_alpha          = ACOS( 0.0_wp * u(k,j,i) / tmp_norm +   &
+                                              0.0_wp * v(k,j,i) / tmp_norm -   &
+                                              1.0_wp * w(k,j,i) / tmp_norm )
+                   tmp_alpha_w        = tmp_alpha / pi * 180.0_wp
                    local_pfi(4,i,j,k) = tmp_alpha_w
                 ENDDO
Index: /palm/trunk/SOURCE/data_output_mask.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_mask.f90	(revision 1352)
+++ /palm/trunk/SOURCE/data_output_mask.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -218,6 +218,6 @@
                       DO  k = nzb, nzt+1
                          psi = prt_start_index(k,j,i)
-                         s_r3 = 0.0
-                         s_r4 = 0.0
+                         s_r3 = 0.0_wp
+                         s_r4 = 0.0_wp
                          DO  n = psi, psi+prt_count(k,j,i)-1
                             s_r3 = s_r3 + particles(n)%radius**3 * &
@@ -226,8 +226,8 @@
                                           particles(n)%weight_factor
                          ENDDO
-                         IF ( s_r3 /= 0.0 )  THEN
+                         IF ( s_r3 /= 0.0_wp )  THEN
                             mean_r = s_r4 / s_r3
                          ELSE
-                            mean_r = 0.0
+                            mean_r = 0.0_wp
                          ENDIF
                          tend(k,j,i) = mean_r
Index: /palm/trunk/SOURCE/data_output_profiles.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_profiles.f90	(revision 1352)
+++ /palm/trunk/SOURCE/data_output_profiles.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -104,5 +104,5 @@
 !
 !-- If required, compute temporal average
-    IF ( averaging_interval_pr == 0.0 )  THEN
+    IF ( averaging_interval_pr == 0.0_wp )  THEN
        hom_sum(:,:,:) = hom(:,1,:,:)
     ELSE
@@ -308,5 +308,5 @@
 !
 !-- If averaging has been done above, the summation counter must be re-set.
-    IF ( averaging_interval_pr /= 0.0 )  THEN
+    IF ( averaging_interval_pr /= 0.0_wp )  THEN
        average_count_pr = 0
     ENDIF
Index: /palm/trunk/SOURCE/data_output_ptseries.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_ptseries.f90	(revision 1352)
+++ /palm/trunk/SOURCE/data_output_ptseries.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -111,6 +111,6 @@
               pts_value_l(0:number_of_particle_groups,dopts_num) )
 
-    pts_value_l = 0.0
-    pts_value_l(:,16) = 9999999.9    ! for calculation of minimum radius
+    pts_value_l = 0.0_wp
+    pts_value_l(:,16) = 9999999.9_wp    ! for calculation of minimum radius
 
 !
@@ -135,6 +135,6 @@
           pts_value_l(0,11) = pts_value_l(0,11) + particles(n)%rvar3 ! mean sgsw
        ENDIF
-       IF ( particles(n)%speed_z > 0.0 )  THEN
-          pts_value_l(0,12) = pts_value_l(0,12) + 1.0  ! # of upward moving prts
+       IF ( particles(n)%speed_z > 0.0_wp )  THEN
+          pts_value_l(0,12) = pts_value_l(0,12) + 1.0_wp  ! # of upward moving prts
           pts_value_l(0,13) = pts_value_l(0,13) + &
                                             particles(n)%speed_z ! mean w upw.
@@ -170,6 +170,6 @@
              pts_value_l(j,11) = pts_value_l(j,11) + particles(n)%rvar3
           ENDIF
-          IF ( particles(n)%speed_z > 0.0 )  THEN
-             pts_value_l(j,12) = pts_value_l(j,12) + 1.0
+          IF ( particles(n)%speed_z > 0.0_wp )  THEN
+             pts_value_l(j,12) = pts_value_l(j,12) + 1.0_wp
              pts_value_l(j,13) = pts_value_l(j,13) + particles(n)%speed_z
           ELSE
@@ -179,6 +179,6 @@
           pts_value_l(j,16) = MIN( pts_value(j,16), particles(n)%radius )
           pts_value_l(j,17) = MAX( pts_value(j,17), particles(n)%radius )
-          pts_value_l(j,18) = pts_value_l(j,18) + 1.0
-          pts_value_l(j,19) = pts_value_l(j,19) + 1.0
+          pts_value_l(j,18) = pts_value_l(j,18) + 1.0_wp
+          pts_value_l(j,19) = pts_value_l(j,19) + 1.0_wp
 
        ENDIF
@@ -221,14 +221,14 @@
     DO  j = 0, inum
 
-       IF ( pts_value(j,1) > 0.0 )  THEN
+       IF ( pts_value(j,1) > 0.0_wp )  THEN
 
           pts_value(j,2:15) = pts_value(j,2:15) / pts_value(j,1)
-          IF ( pts_value(j,12) > 0.0  .AND.  pts_value(j,12) < 1.0 )  THEN
+          IF ( pts_value(j,12) > 0.0_wp  .AND.  pts_value(j,12) < 1.0_wp )  THEN
              pts_value(j,13) = pts_value(j,13) / pts_value(j,12)
-             pts_value(j,14) = pts_value(j,14) / ( 1.0 - pts_value(j,12) )
-          ELSEIF ( pts_value(j,12) == 0.0 )  THEN
-             pts_value(j,13) = -1.0
+             pts_value(j,14) = pts_value(j,14) / ( 1.0_wp - pts_value(j,12) )
+          ELSEIF ( pts_value(j,12) == 0.0_wp )  THEN
+             pts_value(j,13) = -1.0_wp
           ELSE
-             pts_value(j,14) = -1.0
+             pts_value(j,14) = -1.0_wp
           ENDIF
 
@@ -323,5 +323,5 @@
     DO  j = 0, inum
 
-       IF ( pts_value(j,1) > 0.0 )  THEN
+       IF ( pts_value(j,1) > 0.0_wp )  THEN
           pts_value(j,20:28) = pts_value(j,20:28) / pts_value(j,1)
        ENDIF
Index: /palm/trunk/SOURCE/data_output_spectra.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_spectra.f90	(revision 1352)
+++ /palm/trunk/SOURCE/data_output_spectra.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -183,5 +183,5 @@
 !
 !--    Reset spectra values
-       spectrum_x = 0.0; spectrum_y = 0.0
+       spectrum_x = 0.0_wp; spectrum_y = 0.0_wp
 
     ENDIF
@@ -242,5 +242,5 @@
 
           DO  i = 1, nx/2
-             frequency = 2.0 * pi * i / ( dx * ( nx + 1 ) )
+             frequency = 2.0_wp * pi * i / ( dx * ( nx + 1 ) )
              netcdf_data_x(i) = frequency * spectrum_x(i,k,nsp)
           ENDDO
@@ -260,5 +260,5 @@
 
           DO  i = 1, ny/2
-             frequency = 2.0 * pi * i / ( dy * ( ny + 1 ) )
+             frequency = 2.0_wp * pi * i / ( dy * ( ny + 1 ) )
              netcdf_data_y(i) = frequency * spectrum_y(i,k,nsp)
           ENDDO
@@ -317,5 +317,5 @@
     LOGICAL            ::  frame_written   !:
     
-    REAL(wp)           ::  frequency = 0.0 !:
+    REAL(wp)           ::  frequency = 0.0_wp !:
 !
 !-- Variables needed for PROFIL-namelist
@@ -344,14 +344,14 @@
     LOGICAL ::  ylog = .TRUE.   !:
     
-    REAL(wp) ::  gwid = 0.1    !:
-    REAL(wp) ::  rlegfak = 0.7 !:
-    REAL(wp) ::  uxmin         !:
-    REAL(wp) ::  uxmax         !:
-    REAL(wp) ::  uymin         !:
-    REAL(wp) ::  uymax         !:
+    REAL(wp) ::  gwid = 0.1_wp    !:
+    REAL(wp) ::  rlegfak = 0.7_wp !:
+    REAL(wp) ::  uxmin            !:
+    REAL(wp) ::  uxmax            !:
+    REAL(wp) ::  uymin            !:
+    REAL(wp) ::  uymax            !:
      
-    REAL(wp), DIMENSION(1:100) ::  lwid = 0.6 !:
-    REAL(wp), DIMENSION(100)   ::  uyma       !:
-    REAL(wp), DIMENSION(100)   ::  uymi       !:
+    REAL(wp), DIMENSION(1:100) ::  lwid = 0.6_wp !:
+    REAL(wp), DIMENSION(100)   ::  uyma          !:
+    REAL(wp), DIMENSION(100)   ::  uymi          !:
 
     NAMELIST /RAHMEN/  cranz, datleg, rtext, swap
@@ -406,7 +406,7 @@
 !-- Write all data and calculate uymi and uyma. They serve to calculate
 !-- the CROSS-parameters uymin and uymax
-    uymi = 999.999; uyma = -999.999
+    uymi = 999.999_wp; uyma = -999.999_wp
     DO  i = 1, nx/2
-       frequency = 2.0 * pi * i / ( dx * ( nx + 1 ) )
+       frequency = 2.0_wp * pi * i / ( dx * ( nx + 1 ) )
        WRITE ( 82, 102 )  frequency, ( frequency * spectrum_x(i,k,m), k = 1, &
                           n_sp_x )
@@ -431,6 +431,6 @@
              klist(i) = k + klist_x
           ELSE
-             uymi(k) =  999.999
-             uyma(k) = -999.999
+             uymi(k) =  999.999_wp
+             uyma(k) = -999.999_wp
           ENDIF
           k = k + 1
@@ -438,15 +438,15 @@
        i = i + 1
     ENDDO
-    uymi(k:n_sp_x) =  999.999
-    uyma(k:n_sp_x) = -999.999
+    uymi(k:n_sp_x) =  999.999_wp
+    uyma(k:n_sp_x) = -999.999_wp
     utext = 'x'//utext_char( pr )
-    IF ( averaging_interval_sp /= 0.0 ) THEN
+    IF ( averaging_interval_sp /= 0.0_wp ) THEN
        WRITE ( atext, 104 )  averaging_interval_sp
        utext = TRIM(utext) // ',  ' // TRIM( atext )
     ENDIF
-    uxmin = 0.8 * 2.0 * pi        / ( dx * ( nx + 1 ) )
-    uxmax = 1.2 * 2.0 * pi * nx/2 / ( dx * ( nx + 1 ) )
-    uymin = 0.8 * MIN (  999.999, MINVAL ( uymi ) )
-    uymax = 1.2 * MAX ( -999.999, MAXVAL ( uyma ) )
+    uxmin = 0.8_wp * 2.0_wp * pi        / ( dx * ( nx + 1 ) )
+    uxmax = 1.2_wp * 2.0_wp * pi * nx/2 / ( dx * ( nx + 1 ) )
+    uymin = 0.8_wp * MIN (  999.999_wp, MINVAL ( uymi ) )
+    uymax = 1.2_wp * MAX ( -999.999_wp, MAXVAL ( uyma ) )
     ytext = ytext_char( pr )
 
@@ -520,5 +520,5 @@
     LOGICAL            :: frame_written   !:
     
-    REAL(wp)           :: frequency = 0.0 !:
+    REAL(wp)           :: frequency = 0.0_wp !:
 
 !
@@ -548,15 +548,15 @@
     LOGICAL ::  ylog = .TRUE.   !:
     
-    REAL(wp) ::  gwid = 0.1     !:
-    REAL(wp) ::  rlegfak = 0.7  !:
-    REAL(wp) ::  uxmin          !:
-    REAL(wp) ::  uxmax          !:
-    REAL(wp) ::  uymin          !:
-    REAL(wp) ::  uymax          !:
-    
-    REAL(wp), DIMENSION(1:100) ::  lwid = 0.6 !:
-    
-    REAL(wp), DIMENSION(100)   ::  uyma       !:
-    REAL(wp), DIMENSION(100)   ::  uymi       !:
+    REAL(wp) ::  gwid = 0.1_wp     !:
+    REAL(wp) ::  rlegfak = 0.7_wp  !:
+    REAL(wp) ::  uxmin             !:
+    REAL(wp) ::  uxmax             !:
+    REAL(wp) ::  uymin             !:
+    REAL(wp) ::  uymax             !:
+    
+    REAL(wp), DIMENSION(1:100) ::  lwid = 0.6_wp !:
+    
+    REAL(wp), DIMENSION(100)   ::  uyma          !:
+    REAL(wp), DIMENSION(100)   ::  uymi          !:
 
     NAMELIST /RAHMEN/  cranz, datleg, rtext, swap
@@ -611,7 +611,7 @@
 !-- Write all data and calculate uymi and uyma. They serve to calculate
 !-- the CROSS-parameters uymin and uymax
-    uymi = 999.999; uyma = -999.999
+    uymi = 999.999_wp; uyma = -999.999_wp
     DO  j = 1, ny/2
-       frequency = 2.0 * pi * j / ( dy * ( ny + 1 ) )
+       frequency = 2.0_wp * pi * j / ( dy * ( ny + 1 ) )
        WRITE ( 84, 102 ) frequency, ( frequency * spectrum_y(j,k,m), &
                                       k = 1, n_sp_y ) 
@@ -636,6 +636,6 @@
              klist(j) = k + klist_y
           ELSE
-             uymi(k) =  999.999
-             uyma(k) = -999.999
+             uymi(k) =  999.999_wp
+             uyma(k) = -999.999_wp
           ENDIF
           k = k + 1
@@ -643,15 +643,15 @@
        j = j + 1
     ENDDO
-    uymi(k:n_sp_y) =  999.999
-    uyma(k:n_sp_y) = -999.999
+    uymi(k:n_sp_y) =  999.999_wp
+    uyma(k:n_sp_y) = -999.999_wp
     utext = 'y'//utext_char( pr )
-    IF ( averaging_interval_sp /= 0.0 )  THEN
+    IF ( averaging_interval_sp /= 0.0_wp )  THEN
        WRITE ( atext, 104 )  averaging_interval_sp
        utext = TRIM(utext) // ',  ' // TRIM( atext )
     ENDIF
-    uxmin = 0.8 * 2.0 * pi        / ( dy * ( ny + 1 ) )
-    uxmax = 1.2 * 2.0 * pi * ny/2 / ( dy * ( ny + 1 ) )
-    uymin = 0.8 * MIN (  999.999, MINVAL ( uymi ) )
-    uymax = 1.2 * MAX ( -999.999, MAXVAL ( uyma ) )
+    uxmin = 0.8_wp * 2.0_wp * pi        / ( dy * ( ny + 1 ) )
+    uxmax = 1.2_wp * 2.0_wp * pi * ny/2 / ( dy * ( ny + 1 ) )
+    uymin = 0.8_wp * MIN (  999.999_wp, MINVAL ( uymi ) )
+    uymax = 1.2_wp * MAX ( -999.999_wp, MAXVAL ( uyma ) )
     ytext = ytext_char( pr )
 
Index: /palm/trunk/SOURCE/diffusion_w.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_w.f90	(revision 1352)
+++ /palm/trunk/SOURCE/diffusion_w.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute 
 ! 
 ! Former revisions:
Index: /palm/trunk/SOURCE/diffusivities.f90
===================================================================
--- /palm/trunk/SOURCE/diffusivities.f90	(revision 1352)
+++ /palm/trunk/SOURCE/diffusivities.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute 
 ! 
 ! Former revisions:
Index: /palm/trunk/SOURCE/disturb_field.f90
===================================================================
--- /palm/trunk/SOURCE/disturb_field.f90	(revision 1352)
+++ /palm/trunk/SOURCE/disturb_field.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-!
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -92,6 +92,6 @@
 !-- to store the disturbance
     ALLOCATE( dist2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-    dist1 = 0.0
-    dist2 = 0.0
+    dist1 = 0.0_wp
+    dist2 = 0.0_wp
 
 !
@@ -183,5 +183,5 @@
        DO  i = nxlg, nxrg
           DO  j = nysg, nyng
-             dist1(nzb:nzb_uv_inner(j,i)+1,j,i) = 0.0
+             dist1(nzb:nzb_uv_inner(j,i)+1,j,i) = 0.0_wp
           ENDDO
        ENDDO
Index: /palm/trunk/SOURCE/disturb_heatflux.f90
===================================================================
--- /palm/trunk/SOURCE/disturb_heatflux.f90	(revision 1352)
+++ /palm/trunk/SOURCE/disturb_heatflux.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-!
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
Index: /palm/trunk/SOURCE/eqn_state_seawater.f90
===================================================================
--- /palm/trunk/SOURCE/eqn_state_seawater.f90	(revision 1352)
+++ /palm/trunk/SOURCE/eqn_state_seawater.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -124,5 +124,5 @@
 !
 !--             Pressure is needed in dbar
-                p1 = hyp(k) * 1E-4
+                p1 = hyp(k) * 1E-4_wp
                 p2 = p1 * p1
                 p3 = p2 * p1
@@ -130,5 +130,5 @@
 !
 !--             Temperature needed in degree Celsius
-                pt1 = pt_p(k,j,i) - 273.15
+                pt1 = pt_p(k,j,i) - 273.15_wp
                 pt2 = pt1 * pt1
                 pt3 = pt1 * pt2
@@ -197,5 +197,5 @@
 !
 !--       Pressure is needed in dbar
-          p1 = hyp(k) * 1E-4
+          p1 = hyp(k) * 1E-4_wp
           p2 = p1 * p1
           p3 = p2 * p1
@@ -203,5 +203,5 @@
 !
 !--       Temperature needed in degree Celsius
-          pt1 = pt_p(k,j,i) - 273.15
+          pt1 = pt_p(k,j,i) - 273.15_wp
           pt2 = pt1 * pt1
           pt3 = pt1 * pt2
@@ -269,5 +269,5 @@
 !
 !--    Pressure is needed in dbar
-       p1 = p  * 1E-4
+       p1 = p  * 1E-4_wp
        p2 = p1 * p1
        p3 = p2 * p1
@@ -275,5 +275,5 @@
 !
 !--    Temperature needed in degree Celsius
-       pt1 = pt - 273.15
+       pt1 = pt - 273.15_wp
        pt2 = pt1 * pt1
        pt3 = pt1 * pt2
Index: /palm/trunk/SOURCE/fft_xy.f90
===================================================================
--- /palm/trunk/SOURCE/fft_xy.f90	(revision 1352)
+++ /palm/trunk/SOURCE/fft_xy.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute 
 ! 
 ! Former revisions:
Index: /palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- /palm/trunk/SOURCE/flow_statistics.f90	(revision 1352)
+++ /palm/trunk/SOURCE/flow_statistics.f90	(revision 1353)
@@ -21,5 +21,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -170,5 +170,5 @@
 !
 !--    Initialize (local) summation array
-       sums_l = 0.0
+       sums_l = 0.0_wp
 
 !
@@ -202,9 +202,9 @@
              sums_l(:,31,i) = sums_vs2_ws_l(:,i)        ! v*2 
              sums_l(:,32,i) = sums_ws2_ws_l(:,i)        ! w*2 
-             sums_l(:,34,i) = sums_l(:,34,i) + 0.5 *                           & 
+             sums_l(:,34,i) = sums_l(:,34,i) + 0.5_wp *                        & 
                               ( sums_us2_ws_l(:,i) + sums_vs2_ws_l(:,i) +      &
                                 sums_ws2_ws_l(:,i) )    ! e*
              DO  k = nzb, nzt
-                sums_l(nzb+5,pr_palm,i) = sums_l(nzb+5,pr_palm,i) + 0.5 * (    &
+                sums_l(nzb+5,pr_palm,i) = sums_l(nzb+5,pr_palm,i) + 0.5_wp * ( &
                                                       sums_us2_ws_l(k,i) +     &
                                                       sums_vs2_ws_l(k,i) +     &
@@ -446,5 +446,5 @@
        DO  i = nxl, nxr
           DO  j =  nys, nyn
-             sums_l_etot = 0.0
+             sums_l_etot = 0.0_wp
              DO  k = nzb_s_inner(j,i), nzt+1
 !
@@ -470,5 +470,5 @@
 
                 sums_l_etot  = sums_l_etot + &
-                                        0.5 * ( u(k,j,i)**2 + v(k,j,i)**2 +    &
+                                        0.5_wp * ( u(k,j,i)**2 + v(k,j,i)**2 + &
                                         w(k,j,i)**2 ) * rmask(j,i,sr)
              ENDDO
@@ -503,5 +503,5 @@
           DO  i = nxl, nxr
              DO  j =  nys, nyn
-                sums_l_eper = 0.0
+                sums_l_eper = 0.0_wp
                 DO  k = nzb_s_inner(j,i), nzt+1
                    u2   = u(k,j,i)**2
@@ -517,11 +517,11 @@
 !--             Perturbation energy
 
-                   sums_l(k,34,tn) = sums_l(k,34,tn) + 0.5 *       &
+                   sums_l(k,34,tn) = sums_l(k,34,tn) + 0.5_wp *                &
                                   ( ust2 + vst2 + w2 ) * rmask(j,i,sr)
-                   sums_l_eper  = sums_l_eper + &
-                                        0.5 * ( ust2+vst2+w2 ) * rmask(j,i,sr)
-
-                ENDDO
-                sums_l(nzb+5,pr_palm,tn) = sums_l(nzb+5,pr_palm,tn)   &
+                   sums_l_eper     = sums_l_eper +                             &
+                                     0.5_wp * ( ust2+vst2+w2 ) * rmask(j,i,sr)
+
+                ENDDO
+                sums_l(nzb+5,pr_palm,tn) = sums_l(nzb+5,pr_palm,tn)            &
                      + sums_l_eper
              ENDDO
@@ -547,5 +547,5 @@
 !
 !--             Momentum flux w"u"
-                sums_l(k,12,tn) = sums_l(k,12,tn) - 0.25 * (                   &
+                sums_l(k,12,tn) = sums_l(k,12,tn) - 0.25_wp * (                &
                                km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) &
                                                            ) * (               &
@@ -555,5 +555,5 @@
 !
 !--             Momentum flux w"v"
-                sums_l(k,14,tn) = sums_l(k,14,tn) - 0.25 * (                   &
+                sums_l(k,14,tn) = sums_l(k,14,tn) - 0.25_wp * (                &
                                km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) &
                                                            ) * (               &
@@ -564,5 +564,5 @@
 !--             Heat flux w"pt"
                 sums_l(k,16,tn) = sums_l(k,16,tn)                              &
-                                         - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )   &
+                                         - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )&
                                                * ( pt(k+1,j,i) - pt(k,j,i) )   &
                                                * ddzu(k+1) * rmask(j,i,sr)
@@ -573,5 +573,5 @@
                 IF ( ocean )  THEN
                    sums_l(k,65,tn) = sums_l(k,65,tn)                           &
-                                         - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )   &
+                                         - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )&
                                                * ( sa(k+1,j,i) - sa(k,j,i) )   &
                                                * ddzu(k+1) * rmask(j,i,sr)
@@ -582,9 +582,9 @@
                 IF ( humidity ) THEN
                    sums_l(k,45,tn) = sums_l(k,45,tn)                           &
-                                         - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )   &
+                                         - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )&
                                                * ( vpt(k+1,j,i) - vpt(k,j,i) ) &
                                                * ddzu(k+1) * rmask(j,i,sr)
                    sums_l(k,48,tn) = sums_l(k,48,tn)                           &
-                                         - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )   &
+                                         - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )&
                                                * ( q(k+1,j,i) - q(k,j,i) )     &
                                                * ddzu(k+1) * rmask(j,i,sr)
@@ -592,5 +592,5 @@
                    IF ( cloud_physics ) THEN
                       sums_l(k,51,tn) = sums_l(k,51,tn)                        &
-                                         - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )   &
+                                         - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )&
                                                * ( ( q(k+1,j,i) - ql(k+1,j,i) )&
                                                 - ( q(k,j,i) - ql(k,j,i) ) )   &
@@ -603,5 +603,5 @@
                 IF ( passive_scalar )  THEN
                    sums_l(k,48,tn) = sums_l(k,48,tn)                           &
-                                         - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )   &
+                                         - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )&
                                                * ( q(k+1,j,i) - q(k,j,i) )     &
                                                * ddzu(k+1) * rmask(j,i,sr)
@@ -620,7 +620,7 @@
                                     shf(j,i)  * rmask(j,i,sr)     ! w"pt"
                 sums_l(nzb,58,tn) = sums_l(nzb,58,tn) + &
-                                    0.0 * rmask(j,i,sr)           ! u"pt"
+                                    0.0_wp * rmask(j,i,sr)        ! u"pt"
                 sums_l(nzb,61,tn) = sums_l(nzb,61,tn) + &
-                                    0.0 * rmask(j,i,sr)           ! v"pt"
+                                    0.0_wp * rmask(j,i,sr)        ! v"pt"
                 IF ( ocean )  THEN
                    sums_l(nzb,65,tn) = sums_l(nzb,65,tn) + &
@@ -628,15 +628,15 @@
                 ENDIF
                 IF ( humidity )  THEN
-                   sums_l(nzb,48,tn) = sums_l(nzb,48,tn) + &
+                   sums_l(nzb,48,tn) = sums_l(nzb,48,tn) +                     &
                                        qsws(j,i) * rmask(j,i,sr)  ! w"q" (w"qv")
-                   sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (           &
-                                       ( 1.0 + 0.61 * q(nzb,j,i) ) *   &
-                                       shf(j,i) + 0.61 * pt(nzb,j,i) * &
+                   sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (                   &
+                                       ( 1.0_wp + 0.61_wp * q(nzb,j,i) ) *     &
+                                       shf(j,i) + 0.61_wp * pt(nzb,j,i) *      &
                                                   qsws(j,i) )
                    IF ( cloud_droplets )  THEN
-                      sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (        &
-                                         ( 1.0 + 0.61 * q(nzb,j,i) -   &
-                                           ql(nzb,j,i) ) * shf(j,i) +  &
-                                           0.61 * pt(nzb,j,i) * qsws(j,i) )
+                      sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (                &
+                                         ( 1.0_wp + 0.61_wp * q(nzb,j,i) -     &
+                                           ql(nzb,j,i) ) * shf(j,i) +          &
+                                           0.61_wp * pt(nzb,j,i) * qsws(j,i) )
                    ENDIF
                    IF ( cloud_physics )  THEN
@@ -663,7 +663,7 @@
                                     tswst(j,i)  * rmask(j,i,sr)   ! w"pt"
                 sums_l(nzt:nzt+1,58,tn) = sums_l(nzt:nzt+1,58,tn) + &
-                                    0.0 * rmask(j,i,sr)           ! u"pt"
+                                    0.0_wp * rmask(j,i,sr)        ! u"pt"
                 sums_l(nzt:nzt+1,61,tn) = sums_l(nzt:nzt+1,61,tn) + &
-                                    0.0 * rmask(j,i,sr)           ! v"pt" 
+                                    0.0_wp * rmask(j,i,sr)        ! v"pt" 
 
                 IF ( ocean )  THEN
@@ -672,15 +672,15 @@
                 ENDIF
                 IF ( humidity )  THEN
-                   sums_l(nzt,48,tn) = sums_l(nzt,48,tn) + &
+                   sums_l(nzt,48,tn) = sums_l(nzt,48,tn) +                     &
                                        qswst(j,i) * rmask(j,i,sr) ! w"q" (w"qv")
-                   sums_l(nzt,45,tn) = sums_l(nzt,45,tn) + (             &
-                                       ( 1.0 + 0.61 * q(nzt,j,i) ) *     &
-                                       tswst(j,i) + 0.61 * pt(nzt,j,i) * &
-                                                  qswst(j,i) )
+                   sums_l(nzt,45,tn) = sums_l(nzt,45,tn) + (                   &
+                                       ( 1.0_wp + 0.61_wp * q(nzt,j,i) ) *     &
+                                       tswst(j,i) + 0.61_wp * pt(nzt,j,i) *    &
+                                                             qswst(j,i) )
                    IF ( cloud_droplets )  THEN
-                      sums_l(nzt,45,tn) = sums_l(nzt,45,tn) + (           &
-                                          ( 1.0 + 0.61 * q(nzt,j,i) -     &
-                                            ql(nzt,j,i) ) * tswst(j,i) +  &
-                                            0.61 * pt(nzt,j,i) * qswst(j,i) )
+                      sums_l(nzt,45,tn) = sums_l(nzt,45,tn) + (                &
+                                          ( 1.0_wp + 0.61_wp * q(nzt,j,i) -    &
+                                            ql(nzt,j,i) ) * tswst(j,i) +       &
+                                            0.61_wp * pt(nzt,j,i) * qswst(j,i) )
                    ENDIF
                    IF ( cloud_physics )  THEN
@@ -703,15 +703,15 @@
 !--                rearranged according to the staggered grid.
              DO  k = nzb_s_inner(j,i), nzt
-                ust = 0.5 * ( u(k,j,i)   - hom(k,1,1,sr) + &
-                              u(k+1,j,i) - hom(k+1,1,1,sr) )
-                vst = 0.5 * ( v(k,j,i)   - hom(k,1,2,sr) + &
-                              v(k+1,j,i) - hom(k+1,1,2,sr) )
-                pts = 0.5 * ( pt(k,j,i)   - hom(k,1,4,sr) + &
-                              pt(k+1,j,i) - hom(k+1,1,4,sr) )
+                ust = 0.5_wp * ( u(k,j,i)   - hom(k,1,1,sr) +                  &
+                                 u(k+1,j,i) - hom(k+1,1,1,sr) )
+                vst = 0.5_wp * ( v(k,j,i)   - hom(k,1,2,sr) +                  &
+                                 v(k+1,j,i) - hom(k+1,1,2,sr) )
+                pts = 0.5_wp * ( pt(k,j,i)   - hom(k,1,4,sr) +                 &
+                                 pt(k+1,j,i) - hom(k+1,1,4,sr) )
 
 !--             Higher moments
-                sums_l(k,35,tn) = sums_l(k,35,tn) + pts * w(k,j,i)**2 * &
+                sums_l(k,35,tn) = sums_l(k,35,tn) + pts * w(k,j,i)**2 *        &
                                                     rmask(j,i,sr)
-                sums_l(k,36,tn) = sums_l(k,36,tn) + pts**2 * w(k,j,i) * &
+                sums_l(k,36,tn) = sums_l(k,36,tn) + pts**2 * w(k,j,i) *        &
                                                     rmask(j,i,sr)
 
@@ -721,12 +721,12 @@
                 IF ( ocean )  THEN
                    IF( .NOT. ws_scheme_sca .OR. sr /= 0 )  THEN
-                      pts = 0.5 * ( sa(k,j,i)   - hom(k,1,23,sr) + &
-                                 sa(k+1,j,i) - hom(k+1,1,23,sr) )
-                      sums_l(k,66,tn) = sums_l(k,66,tn) + pts * w(k,j,i) * &
+                      pts = 0.5_wp * ( sa(k,j,i)   - hom(k,1,23,sr) +          &
+                                       sa(k+1,j,i) - hom(k+1,1,23,sr) )
+                      sums_l(k,66,tn) = sums_l(k,66,tn) + pts * w(k,j,i) *     &
+                                        rmask(j,i,sr)
+                   ENDIF
+                   sums_l(k,64,tn) = sums_l(k,64,tn) + rho(k,j,i) *            &
                                                        rmask(j,i,sr)
-                   ENDIF
-                   sums_l(k,64,tn) = sums_l(k,64,tn) + rho(k,j,i) * &
-                                                       rmask(j,i,sr)
-                   sums_l(k,71,tn) = sums_l(k,71,tn) + prho(k,j,i) * &
+                   sums_l(k,71,tn) = sums_l(k,71,tn) + prho(k,j,i) *           &
                                                        rmask(j,i,sr)
                 ENDIF
@@ -737,10 +737,10 @@
                 IF ( humidity )  THEN
                    IF ( cloud_physics .OR. cloud_droplets )  THEN
-                      pts = 0.5 * ( vpt(k,j,i)   - hom(k,1,44,sr) +        &
+                      pts = 0.5_wp * ( vpt(k,j,i)   - hom(k,1,44,sr) +         &
                                     vpt(k+1,j,i) - hom(k+1,1,44,sr) )
-                      sums_l(k,46,tn) = sums_l(k,46,tn) + pts * w(k,j,i) * &
+                      sums_l(k,46,tn) = sums_l(k,46,tn) + pts * w(k,j,i) *     &
                                                           rmask(j,i,sr)
                       IF ( .NOT. cloud_droplets )  THEN
-                         pts = 0.5 *                                           &
+                         pts = 0.5_wp *                                        &
                               ( ( q(k,j,i) - ql(k,j,i) ) -                     &
                               hom(k,1,42,sr) +                                 &
@@ -772,12 +772,14 @@
                    ELSE
                       IF( .NOT. ws_scheme_sca .OR. sr /= 0 )  THEN
-                         pts = 0.5 * ( vpt(k,j,i)   - hom(k,1,44,sr) + &
-                                       vpt(k+1,j,i) - hom(k+1,1,44,sr) )
-                         sums_l(k,46,tn) = sums_l(k,46,tn) + pts * w(k,j,i) * &
+                         pts = 0.5_wp * ( vpt(k,j,i)   - hom(k,1,44,sr) +      &
+                                          vpt(k+1,j,i) - hom(k+1,1,44,sr) )
+                         sums_l(k,46,tn) = sums_l(k,46,tn) + pts * w(k,j,i) *  &
                                                              rmask(j,i,sr)
                       ELSE IF ( ws_scheme_sca .AND. sr == 0 )  THEN
-                         sums_l(k,46,tn) = ( 1.0 + 0.61 * hom(k,1,41,sr) ) *  &
-                                             sums_l(k,17,tn) +      &
-                                          0.61 * hom(k,1,4,sr) * sums_l(k,49,tn)
+                         sums_l(k,46,tn) = ( 1.0_wp + 0.61_wp *                & 
+                                             hom(k,1,41,sr) ) *                &
+                                           sums_l(k,17,tn) +                   &
+                                           0.61_wp * hom(k,1,4,sr) *           &
+                                           sums_l(k,49,tn)
                       END IF
                    END IF
@@ -785,9 +787,9 @@
 !
 !--             Passive scalar flux
-                IF ( passive_scalar .AND. ( .NOT. ws_scheme_sca   &
+                IF ( passive_scalar .AND. ( .NOT. ws_scheme_sca                &
                      .OR. sr /= 0 ) )  THEN
-                   pts = 0.5 * ( q(k,j,i)   - hom(k,1,41,sr) + &
-                                 q(k+1,j,i) - hom(k+1,1,41,sr) )
-                   sums_l(k,49,tn) = sums_l(k,49,tn) + pts * w(k,j,i) * &
+                   pts = 0.5_wp * ( q(k,j,i)   - hom(k,1,41,sr) +              &
+                                    q(k+1,j,i) - hom(k+1,1,41,sr) )
+                   sums_l(k,49,tn) = sums_l(k,49,tn) + pts * w(k,j,i) *        &
                                                        rmask(j,i,sr)
                 ENDIF
@@ -796,6 +798,6 @@
 !--             Energy flux w*e*
 !--             has to be adjusted
-                sums_l(k,37,tn) = sums_l(k,37,tn) + w(k,j,i) * 0.5 *          &
-                                             ( ust**2 + vst**2 + w(k,j,i)**2 )&
+                sums_l(k,37,tn) = sums_l(k,37,tn) + w(k,j,i) * 0.5_wp *        &
+                                             ( ust**2 + vst**2 + w(k,j,i)**2 ) &
                                              * rmask(j,i,sr)
              ENDDO
@@ -811,17 +813,17 @@
             DO  j = nys, nyn
                DO  k = nzb_diff_s_inner(j,i)-1, nzt_diff
-                  ust = 0.5 * ( u(k,j,i)   - hom(k,1,1,sr) + &
-                              u(k+1,j,i) - hom(k+1,1,1,sr) )
-                  vst = 0.5 * ( v(k,j,i)   - hom(k,1,2,sr) + &
-                              v(k+1,j,i) - hom(k+1,1,2,sr) )
+                  ust = 0.5_wp * ( u(k,j,i)   - hom(k,1,1,sr) +                &
+                                   u(k+1,j,i) - hom(k+1,1,1,sr) )
+                  vst = 0.5_wp * ( v(k,j,i)   - hom(k,1,2,sr) +                &
+                                   v(k+1,j,i) - hom(k+1,1,2,sr) )
 !
 !--               Momentum flux w*u*
-                  sums_l(k,13,tn) = sums_l(k,13,tn) + 0.5 *                   &
-                                                    ( w(k,j,i-1) + w(k,j,i) ) &
+                  sums_l(k,13,tn) = sums_l(k,13,tn) + 0.5_wp *                 &
+                                                    ( w(k,j,i-1) + w(k,j,i) )  &
                                                     * ust * rmask(j,i,sr)
 !
 !--               Momentum flux w*v*
-                  sums_l(k,15,tn) = sums_l(k,15,tn) + 0.5 *                   &
-                                                    ( w(k,j-1,i) + w(k,j,i) ) &
+                  sums_l(k,15,tn) = sums_l(k,15,tn) + 0.5_wp *                 &
+                                                    ( w(k,j-1,i) + w(k,j,i) )  &
                                                     * vst * rmask(j,i,sr)
                ENDDO
@@ -837,13 +839,13 @@
 !
 !--               Vertical heat flux
-                  sums_l(k,17,tn) = sums_l(k,17,tn) +  0.5 * &
-                           ( pt(k,j,i)   - hom(k,1,4,sr) + &
-                           pt(k+1,j,i) - hom(k+1,1,4,sr) ) &
+                  sums_l(k,17,tn) = sums_l(k,17,tn) + 0.5_wp *                 &
+                           ( pt(k,j,i)   - hom(k,1,4,sr) +                     &
+                             pt(k+1,j,i) - hom(k+1,1,4,sr) )                   &
                            * w(k,j,i) * rmask(j,i,sr)
                   IF ( humidity )  THEN
-                     pts = 0.5 * ( q(k,j,i)   - hom(k,1,41,sr) + &
-                                q(k+1,j,i) - hom(k+1,1,41,sr) )
-                     sums_l(k,49,tn) = sums_l(k,49,tn) + pts * w(k,j,i) * &
-                                                      rmask(j,i,sr)
+                     pts = 0.5_wp * ( q(k,j,i)   - hom(k,1,41,sr) +            &
+                                      q(k+1,j,i) - hom(k+1,1,41,sr) )
+                     sums_l(k,49,tn) = sums_l(k,49,tn) + pts * w(k,j,i) *      &
+                                       rmask(j,i,sr)
                   ENDIF
                ENDDO
@@ -865,7 +867,7 @@
 !--    First calculate the products, then the divergence.
 !--    Calculation is time consuming. Do it only, if profiles shall be plotted.
-       IF ( hom(nzb+1,2,55,0) /= 0.0  .OR.  hom(nzb+1,2,68,0) /= 0.0 )  THEN
-
-          sums_ll = 0.0  ! local array
+       IF ( hom(nzb+1,2,55,0) /= 0.0_wp  .OR.  hom(nzb+1,2,68,0) /= 0.0_wp )  THEN
+
+          sums_ll = 0.0_wp  ! local array
 
           !$OMP DO
@@ -874,14 +876,14 @@
                 DO  k = nzb_s_inner(j,i)+1, nzt
 
-                   sums_ll(k,1) = sums_ll(k,1) + 0.5 * w(k,j,i) * (        &
-                  ( 0.25 * ( u(k,j,i)+u(k+1,j,i)+u(k,j,i+1)+u(k+1,j,i+1)   &
-                           - 0.5 * ( hom(k,1,1,sr) + hom(k+1,1,1,sr) )     &
-                           ) )**2                                          &
-                + ( 0.25 * ( v(k,j,i)+v(k+1,j,i)+v(k,j+1,i)+v(k+1,j+1,i)   &
-                           - 0.5 * ( hom(k,1,2,sr) + hom(k+1,1,2,sr) )     &
-                           ) )**2                                          &
-                   + w(k,j,i)**2                                  )
-
-                   sums_ll(k,2) = sums_ll(k,2) + 0.5 * w(k,j,i) &
+                   sums_ll(k,1) = sums_ll(k,1) + 0.5_wp * w(k,j,i) * (         &
+                  ( 0.25_wp * ( u(k,j,i)+u(k+1,j,i)+u(k,j,i+1)+u(k+1,j,i+1)    &
+                            - 0.5_wp * ( hom(k,1,1,sr) + hom(k+1,1,1,sr) )     &
+                              ) )**2                                           &
+                + ( 0.25_wp * ( v(k,j,i)+v(k+1,j,i)+v(k,j+1,i)+v(k+1,j+1,i)    &
+                            - 0.5_wp * ( hom(k,1,2,sr) + hom(k+1,1,2,sr) )     &
+                              ) )**2                                           &
+                + w(k,j,i)**2                                        )
+
+                   sums_ll(k,2) = sums_ll(k,2) + 0.5_wp * w(k,j,i)             &
                                                * ( p(k,j,i) + p(k+1,j,i) )
 
@@ -889,8 +891,8 @@
              ENDDO
           ENDDO
-          sums_ll(0,1)     = 0.0    ! because w is zero at the bottom
-          sums_ll(nzt+1,1) = 0.0
-          sums_ll(0,2)     = 0.0
-          sums_ll(nzt+1,2) = 0.0
+          sums_ll(0,1)     = 0.0_wp    ! because w is zero at the bottom
+          sums_ll(nzt+1,1) = 0.0_wp
+          sums_ll(0,2)     = 0.0_wp
+          sums_ll(nzt+1,2) = 0.0_wp
 
           DO  k = nzb+1, nzt
@@ -901,5 +903,5 @@
           sums_l(nzb,55,tn) = sums_l(nzb+1,55,tn)
           sums_l(nzb,56,tn) = sums_l(nzb+1,56,tn)
-          sums_l(nzb,68,tn) = 0.0    ! because w* = 0 at nzb
+          sums_l(nzb,68,tn) = 0.0_wp    ! because w* = 0 at nzb
 
        ENDIF
@@ -907,5 +909,5 @@
 !
 !--    Divergence of vertical flux of SGS TKE and the flux itself (69)
-       IF ( hom(nzb+1,2,57,0) /= 0.0  .OR.  hom(nzb+1,2,69,0) /= 0.0 )  THEN
+       IF ( hom(nzb+1,2,57,0) /= 0.0_wp  .OR.  hom(nzb+1,2,69,0) /= 0.0_wp )  THEN
 
           !$OMP DO
@@ -914,12 +916,12 @@
                 DO  k = nzb_s_inner(j,i)+1, nzt
 
-                   sums_l(k,57,tn) = sums_l(k,57,tn) - 0.5 * (                 &
+                   sums_l(k,57,tn) = sums_l(k,57,tn) - 0.5_wp * (              &
                    (km(k,j,i)+km(k+1,j,i)) * (e(k+1,j,i)-e(k,j,i)) * ddzu(k+1) &
                  - (km(k-1,j,i)+km(k,j,i)) * (e(k,j,i)-e(k-1,j,i)) * ddzu(k)   &
-                                                             ) * ddzw(k)
-
-                   sums_l(k,69,tn) = sums_l(k,69,tn) - 0.5 * (                 &
+                                                                ) * ddzw(k)
+
+                   sums_l(k,69,tn) = sums_l(k,69,tn) - 0.5_wp * (              &
                    (km(k,j,i)+km(k+1,j,i)) * (e(k+1,j,i)-e(k,j,i)) * ddzu(k+1) &
-                                                              )
+                                                                )
 
                 ENDDO
@@ -934,5 +936,5 @@
 !--    Horizontal heat fluxes (subgrid, resolved, total). 
 !--    Do it only, if profiles shall be plotted. 
-       IF ( hom(nzb+1,2,58,0) /= 0.0 ) THEN
+       IF ( hom(nzb+1,2,58,0) /= 0.0_wp ) THEN
 
           !$OMP DO
@@ -942,9 +944,9 @@
 !
 !--                Subgrid horizontal heat fluxes u"pt", v"pt"
-                   sums_l(k,58,tn) = sums_l(k,58,tn) - 0.5 *                   &
+                   sums_l(k,58,tn) = sums_l(k,58,tn) - 0.5_wp *                &
                                                    ( kh(k,j,i) + kh(k,j,i-1) ) &
                                                  * ( pt(k,j,i-1) - pt(k,j,i) ) &
                                                  * ddx * rmask(j,i,sr)
-                   sums_l(k,61,tn) = sums_l(k,61,tn) - 0.5 *                   &
+                   sums_l(k,61,tn) = sums_l(k,61,tn) - 0.5_wp *                &
                                                    ( kh(k,j,i) + kh(k,j-1,i) ) &
                                                  * ( pt(k,j-1,i) - pt(k,j,i) ) &
@@ -954,11 +956,11 @@
                    sums_l(k,59,tn) = sums_l(k,59,tn) +                         &
                                                   ( u(k,j,i) - hom(k,1,1,sr) ) &
-                                       * 0.5 * ( pt(k,j,i-1) - hom(k,1,4,sr) + &
+                                    * 0.5_wp * ( pt(k,j,i-1) - hom(k,1,4,sr) + &
                                                  pt(k,j,i)   - hom(k,1,4,sr) )
-                   pts = 0.5 * ( pt(k,j-1,i) - hom(k,1,4,sr) + &
-                                 pt(k,j,i)   - hom(k,1,4,sr) )
+                   pts = 0.5_wp * ( pt(k,j-1,i) - hom(k,1,4,sr) +              &
+                                    pt(k,j,i)   - hom(k,1,4,sr) )
                    sums_l(k,62,tn) = sums_l(k,62,tn) +                         &
                                                   ( v(k,j,i) - hom(k,1,2,sr) ) &
-                                       * 0.5 * ( pt(k,j-1,i) - hom(k,1,4,sr) + &
+                                    * 0.5_wp * ( pt(k,j-1,i) - hom(k,1,4,sr) + &
                                                  pt(k,j,i)   - hom(k,1,4,sr) )
                 ENDDO
@@ -967,10 +969,10 @@
 !
 !--       Fluxes at the surface must be zero (e.g. due to the Prandtl-layer)
-          sums_l(nzb,58,tn) = 0.0
-          sums_l(nzb,59,tn) = 0.0
-          sums_l(nzb,60,tn) = 0.0
-          sums_l(nzb,61,tn) = 0.0
-          sums_l(nzb,62,tn) = 0.0
-          sums_l(nzb,63,tn) = 0.0
+          sums_l(nzb,58,tn) = 0.0_wp
+          sums_l(nzb,59,tn) = 0.0_wp
+          sums_l(nzb,60,tn) = 0.0_wp
+          sums_l(nzb,61,tn) = 0.0_wp
+          sums_l(nzb,62,tn) = 0.0_wp
+          sums_l(nzb,63,tn) = 0.0_wp
 
        ENDIF
@@ -1086,5 +1088,5 @@
        hom(:,1,37,sr) = sums(:,37)     ! w*e*
        hom(:,1,38,sr) = sums(:,38)     ! w*3
-       hom(:,1,39,sr) = sums(:,38) / ( abs( sums(:,32) ) + 1E-20 )**1.5   ! Sw
+       hom(:,1,39,sr) = sums(:,38) / ( abs( sums(:,32) ) + 1E-20_wp )**1.5_wp   ! Sw
        hom(:,1,40,sr) = sums(:,40)     ! p
        hom(:,1,45,sr) = sums(:,45)     ! w"vpt"
@@ -1115,5 +1117,5 @@
        hom(:,1,70,sr) = sums(:,70)     ! q*2
        hom(:,1,71,sr) = sums(:,71)     ! prho
-       hom(:,1,72,sr) = hyp * 1E-4     ! hyp in dbar
+       hom(:,1,72,sr) = hyp * 1E-4_wp  ! hyp in dbar
        hom(:,1,73,sr) = sums(:,73)     ! nr
        hom(:,1,74,sr) = sums(:,74)     ! qr
@@ -1143,18 +1145,18 @@
 !--    is less than 1.5 times the height where the heat flux becomes negative
 !--    (positive) for the first time.
-       z_i(1) = 0.0
+       z_i(1) = 0.0_wp
        first = .TRUE.
 
        IF ( ocean )  THEN
           DO  k = nzt, nzb+1, -1
-             IF ( first .AND. hom(k,1,18,sr) < 0.0 &
-                .AND. abs(hom(k,1,18,sr)) > 1.0E-8)  THEN
+             IF ( first .AND. hom(k,1,18,sr) < 0.0_wp                          &
+                .AND. abs(hom(k,1,18,sr)) > 1.0E-8_wp)  THEN
                 first = .FALSE.
                 height = zw(k)
              ENDIF
-             IF ( hom(k,1,18,sr) < 0.0  .AND. &
-                  abs(hom(k,1,18,sr)) > 1.0E-8 .AND. &
+             IF ( hom(k,1,18,sr) < 0.0_wp  .AND.                               &
+                  abs(hom(k,1,18,sr)) > 1.0E-8_wp .AND.                        &
                   hom(k-1,1,18,sr) > hom(k,1,18,sr) )  THEN
-                IF ( zw(k) < 1.5 * height )  THEN
+                IF ( zw(k) < 1.5_wp * height )  THEN
                    z_i(1) = zw(k)
                 ELSE
@@ -1166,13 +1168,13 @@
        ELSE
           DO  k = nzb, nzt-1
-             IF ( first .AND. hom(k,1,18,sr) < 0.0 &
-                .AND. abs(hom(k,1,18,sr)) > 1.0E-8 )  THEN
+             IF ( first .AND. hom(k,1,18,sr) < 0.0_wp                          &
+                .AND. abs(hom(k,1,18,sr)) > 1.0E-8_wp )  THEN
                 first = .FALSE.
                 height = zw(k)
              ENDIF
-             IF ( hom(k,1,18,sr) < 0.0  .AND. & 
-                  abs(hom(k,1,18,sr)) > 1.0E-8 .AND. &
+             IF ( hom(k,1,18,sr) < 0.0_wp  .AND.                               & 
+                  abs(hom(k,1,18,sr)) > 1.0E-8_wp .AND.                        &
                   hom(k+1,1,18,sr) > hom(k,1,18,sr) )  THEN
-                IF ( zw(k) < 1.5 * height )  THEN
+                IF ( zw(k) < 1.5_wp * height )  THEN
                    z_i(1) = zw(k)
                 ELSE
@@ -1192,5 +1194,5 @@
 !--    WARNING: The threshold value of 0.2K/100m must be adjusted for the
 !--             ocean case! 
-       z_i(2) = 0.0
+       z_i(2) = 0.0_wp
        DO  k = nzb+1, nzt+1
           dptdz(k) = ( hom(k,1,4,sr) - hom(k-1,1,4,sr) ) * ddzu(k)
@@ -1225,14 +1227,14 @@
 !--    the characteristic convective boundary layer temperature.
 !--    The horizontal average at nzb+1 is input for the average temperature.
-       IF ( hom(nzb,1,18,sr) > 0.0 .AND. abs(hom(nzb,1,18,sr)) > 1.0E-8 &
-           .AND.  z_i(1) /= 0.0 )  THEN
-          hom(nzb+8,1,pr_palm,sr)  = ( g / hom(nzb+1,1,4,sr) * &
-                                       hom(nzb,1,18,sr) *      &
-                                       ABS( z_i(1) ) )**0.333333333
+       IF ( hom(nzb,1,18,sr) > 0.0_wp .AND. abs(hom(nzb,1,18,sr)) > 1.0E-8_wp  &
+           .AND.  z_i(1) /= 0.0_wp )  THEN
+          hom(nzb+8,1,pr_palm,sr)  = ( g / hom(nzb+1,1,4,sr) *                 &
+                                       hom(nzb,1,18,sr) *                      &
+                                       ABS( z_i(1) ) )**0.333333333_wp
 !--       so far this only works if Prandtl layer is used
           hom(nzb+11,1,pr_palm,sr) = hom(nzb,1,16,sr) / hom(nzb+8,1,pr_palm,sr)
        ELSE
-          hom(nzb+8,1,pr_palm,sr)  = 0.0
-          hom(nzb+11,1,pr_palm,sr) = 0.0
+          hom(nzb+8,1,pr_palm,sr)  = 0.0_wp
+          hom(nzb+11,1,pr_palm,sr) = 0.0_wp
        ENDIF
 
@@ -1261,9 +1263,9 @@
        ts_value(21,sr) = hom(nzb,1,48,sr)           ! w"q"    at k=0
 
-       IF ( ts_value(5,sr) /= 0.0 )  THEN
+       IF ( ts_value(5,sr) /= 0.0_wp )  THEN
           ts_value(22,sr) = ts_value(4,sr)**2 / &
                             ( kappa * g * ts_value(5,sr) / ts_value(18,sr) ) ! L
        ELSE
-          ts_value(22,sr) = 10000.0
+          ts_value(22,sr) = 10000.0_wp
        ENDIF
 
@@ -1278,5 +1280,5 @@
 !-- If required, sum up horizontal averages for subsequent time averaging
     IF ( do_sum )  THEN
-       IF ( average_count_pr == 0 )  hom_sum = 0.0
+       IF ( average_count_pr == 0 )  hom_sum = 0.0_wp
        hom_sum = hom_sum + hom(:,1,:,:)
        average_count_pr = average_count_pr + 1
@@ -1389,5 +1391,5 @@
 !
 !--    Initialize (local) summation array
-       sums_l = 0.0
+       sums_l = 0.0_wp
 
 !
@@ -1421,12 +1423,12 @@
              sums_l(:,31,i) = sums_vs2_ws_l(:,i)        ! v*2
              sums_l(:,32,i) = sums_ws2_ws_l(:,i)        ! w*2
-             sums_l(:,34,i) = sums_l(:,34,i) + 0.5 *                        &
-                              ( sums_us2_ws_l(:,i) + sums_vs2_ws_l(:,i) +   &
+             sums_l(:,34,i) = sums_l(:,34,i) + 0.5_wp *                        &
+                              ( sums_us2_ws_l(:,i) + sums_vs2_ws_l(:,i) +      &
                                 sums_ws2_ws_l(:,i) )    ! e*
              DO  k = nzb, nzt
-                sums_l(nzb+5,pr_palm,i) = sums_l(nzb+5,pr_palm,i) + 0.5 * ( &
-                                                      sums_us2_ws_l(k,i) +  &
-                                                      sums_vs2_ws_l(k,i) +  &
-                                                      sums_ws2_ws_l(k,i) )
+                sums_l(nzb+5,pr_palm,i) = sums_l(nzb+5,pr_palm,i) + 0.5_wp * ( &
+                                                      sums_us2_ws_l(k,i) +     &
+                                                      sums_vs2_ws_l(k,i) +     &
+                                                      sums_ws2_ws_l(k,i)     )
              ENDDO
           ENDDO
@@ -1593,30 +1595,30 @@
        !$acc update host( sums_l )
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( sums_l(nzb,1,0), sums(nzb,1), nzt+2-nzb, MPI_REAL, &
+       CALL MPI_ALLREDUCE( sums_l(nzb,1,0), sums(nzb,1), nzt+2-nzb, MPI_REAL,  &
                            MPI_SUM, comm2d, ierr )
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( sums_l(nzb,2,0), sums(nzb,2), nzt+2-nzb, MPI_REAL, &
+       CALL MPI_ALLREDUCE( sums_l(nzb,2,0), sums(nzb,2), nzt+2-nzb, MPI_REAL,  &
                            MPI_SUM, comm2d, ierr )
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( sums_l(nzb,4,0), sums(nzb,4), nzt+2-nzb, MPI_REAL, &
+       CALL MPI_ALLREDUCE( sums_l(nzb,4,0), sums(nzb,4), nzt+2-nzb, MPI_REAL,  &
                            MPI_SUM, comm2d, ierr )
        IF ( ocean )  THEN
           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,23,0), sums(nzb,23), nzt+2-nzb, &
+          CALL MPI_ALLREDUCE( sums_l(nzb,23,0), sums(nzb,23), nzt+2-nzb,       &
                               MPI_REAL, MPI_SUM, comm2d, ierr )
        ENDIF
        IF ( humidity ) THEN
           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,44,0), sums(nzb,44), nzt+2-nzb, &
+          CALL MPI_ALLREDUCE( sums_l(nzb,44,0), sums(nzb,44), nzt+2-nzb,       &
                               MPI_REAL, MPI_SUM, comm2d, ierr )
           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,41,0), sums(nzb,41), nzt+2-nzb, &
+          CALL MPI_ALLREDUCE( sums_l(nzb,41,0), sums(nzb,41), nzt+2-nzb,       &
                               MPI_REAL, MPI_SUM, comm2d, ierr )
           IF ( cloud_physics ) THEN
              IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-             CALL MPI_ALLREDUCE( sums_l(nzb,42,0), sums(nzb,42), nzt+2-nzb, &
+             CALL MPI_ALLREDUCE( sums_l(nzb,42,0), sums(nzb,42), nzt+2-nzb,    &
                                  MPI_REAL, MPI_SUM, comm2d, ierr )
              IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-             CALL MPI_ALLREDUCE( sums_l(nzb,43,0), sums(nzb,43), nzt+2-nzb, &
+             CALL MPI_ALLREDUCE( sums_l(nzb,43,0), sums(nzb,43), nzt+2-nzb,    &
                                  MPI_REAL, MPI_SUM, comm2d, ierr )
           ENDIF
@@ -1625,5 +1627,5 @@
        IF ( passive_scalar )  THEN
           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,41,0), sums(nzb,41), nzt+2-nzb, &
+          CALL MPI_ALLREDUCE( sums_l(nzb,41,0), sums(nzb,41), nzt+2-nzb,       &
                               MPI_REAL, MPI_SUM, comm2d, ierr )
        ENDIF
@@ -1781,5 +1783,6 @@
           DO  j =  nys, nyn
              DO  k = nzb, nzt+1
-                s1 = s1 + 0.5 * ( u(k,j,i)**2 + v(k,j,i)**2 + w(k,j,i)**2 ) * &
+                s1 = s1 + 0.5_wp *                                             & 
+                          ( u(k,j,i)**2 + v(k,j,i)**2 + w(k,j,i)**2 ) *        &
                           rmask(j,i,sr) * rflags_invers(j,i,k+1)
              ENDDO
@@ -1842,5 +1845,5 @@
 !
 !--                Perturbation energy
-                   s4 = s4 + 0.5 * ( ust2 + vst2 + w2 ) * rmask(j,i,sr) * &
+                   s4 = s4 + 0.5_wp * ( ust2 + vst2 + w2 ) * rmask(j,i,sr) *   &
                              rflags_invers(j,i,k+1)
                 ENDDO
@@ -1889,5 +1892,5 @@
 !
 !--             Momentum flux w"u"
-                s1 = s1 - 0.25 * (                   &
+                s1 = s1 - 0.25_wp * (                                          &
                                km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) &
                                                            ) * (               &
@@ -1898,5 +1901,5 @@
 !
 !--             Momentum flux w"v"
-                s2 = s2 - 0.25 * (                   &
+                s2 = s2 - 0.25_wp * (                                          &
                                km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) &
                                                            ) * (               &
@@ -1907,7 +1910,8 @@
 !
 !--             Heat flux w"pt"
-                s3 = s3 - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )   &
-                              * ( pt(k+1,j,i) - pt(k,j,i) )   &
-                              * ddzu(k+1) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                s3 = s3 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )                 &
+                                 * ( pt(k+1,j,i) - pt(k,j,i) )                 &
+                                 * ddzu(k+1) * rmask(j,i,sr)                   &
+                                 * rflags_invers(j,i,k+1)
              ENDDO
           ENDDO
@@ -1926,7 +1930,8 @@
              DO  i = nxl, nxr
                 DO  j = nys, nyn
-                   s1 = s1 - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )   &
-                                 * ( sa(k+1,j,i) - sa(k,j,i) )   &
-                                 * ddzu(k+1) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                   s1 = s1 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )              &
+                                    * ( sa(k+1,j,i) - sa(k,j,i) )              &
+                                    * ddzu(k+1) * rmask(j,i,sr)                & 
+                                    * rflags_invers(j,i,k+1)
                 ENDDO
              ENDDO
@@ -1945,10 +1950,12 @@
              DO  i = nxl, nxr
                 DO  j = nys, nyn
-                   s1 = s1 - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )   &
-                                 * ( vpt(k+1,j,i) - vpt(k,j,i) ) &
-                                 * ddzu(k+1) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                   s2 = s2 - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )   &
-                                 * ( q(k+1,j,i) - q(k,j,i) )     &
-                                 * ddzu(k+1) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                   s1 = s1 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )              &
+                                    * ( vpt(k+1,j,i) - vpt(k,j,i) )            &
+                                    * ddzu(k+1) * rmask(j,i,sr) 
+                                    * rflags_invers(j,i,k+1)
+                   s2 = s2 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )              &
+                                    * ( q(k+1,j,i) - q(k,j,i) )                &
+                                    * ddzu(k+1) * rmask(j,i,sr)                &
+                                    * rflags_invers(j,i,k+1)
                 ENDDO
              ENDDO
@@ -1965,8 +1972,9 @@
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
-                      s1 = s1 - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )    &
-                                    * ( ( q(k+1,j,i) - ql(k+1,j,i) ) &
-                                      - ( q(k,j,i) - ql(k,j,i) ) )   &
-                                    * ddzu(k+1) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                      s1 = s1 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )           &
+                                       *  ( ( q(k+1,j,i) - ql(k+1,j,i) )       &
+                                          - ( q(k,j,i) - ql(k,j,i) ) )         &
+                                       * ddzu(k+1) * rmask(j,i,sr)             & 
+                                       * rflags_invers(j,i,k+1)
                    ENDDO
                 ENDDO
@@ -1987,7 +1995,8 @@
              DO  i = nxl, nxr
                 DO  j = nys, nyn
-                   s1 = s1 - 0.5 * ( kh(k,j,i) + kh(k+1,j,i) )   &
-                                 * ( q(k+1,j,i) - q(k,j,i) )     &
-                                 * ddzu(k+1) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                   s1 = s1 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )              &
+                                    * ( q(k+1,j,i) - q(k,j,i) )                &
+                                    * ddzu(k+1) * rmask(j,i,sr)                &
+                                    * rflags_invers(j,i,k+1)
                 ENDDO
              ENDDO
@@ -2010,6 +2019,6 @@
                 s2 = s2 + vsws(j,i) * rmask(j,i,sr)     ! w"v"
                 s3 = s3 + shf(j,i)  * rmask(j,i,sr)     ! w"pt"
-                s4 = s4 + 0.0 * rmask(j,i,sr)           ! u"pt"
-                s5 = s5 + 0.0 * rmask(j,i,sr)           ! v"pt"
+                s4 = s4 + 0.0_wp * rmask(j,i,sr)        ! u"pt"
+                s5 = s5 + 0.0_wp * rmask(j,i,sr)        ! v"pt"
              ENDDO
           ENDDO
@@ -2044,6 +2053,6 @@
                 DO  j =  nys, nyn
                    s1 = s1 + qsws(j,i) * rmask(j,i,sr)  ! w"q" (w"qv")
-                   s2 = s2 + ( ( 1.0 + 0.61 * q(nzb,j,i) ) * shf(j,i) &
-                               + 0.61 * pt(nzb,j,i) * qsws(j,i) )
+                   s2 = s2 + ( ( 1.0_wp + 0.61_wp * q(nzb,j,i) ) * shf(j,i)    &
+                               + 0.61_wp * pt(nzb,j,i) * qsws(j,i) )
                 ENDDO
              ENDDO
@@ -2059,6 +2068,7 @@
                 DO  i = nxl, nxr
                    DO  j =  nys, nyn
-                      s1 = s1 + ( ( 1.0 + 0.61 * q(nzb,j,i) - ql(nzb,j,i) ) * &
-                                  shf(j,i) + 0.61 * pt(nzb,j,i) * qsws(j,i) )
+                      s1 = s1 + ( ( 1.0_wp +                                   &
+                                    0.61_wp * q(nzb,j,i) - ql(nzb,j,i) ) *     &
+                                  shf(j,i) + 0.61_wp * pt(nzb,j,i) * qsws(j,i) )
                    ENDDO
                 ENDDO
@@ -2116,6 +2126,6 @@
                 s2 = s2 + vswst(j,i) * rmask(j,i,sr)    ! w"v"
                 s3 = s3 + tswst(j,i)  * rmask(j,i,sr)   ! w"pt"
-                s4 = s4 + 0.0 * rmask(j,i,sr)           ! u"pt"
-                s5 = s5 + 0.0 * rmask(j,i,sr)           ! v"pt"
+                s4 = s4 + 0.0_wp * rmask(j,i,sr)        ! u"pt"
+                s5 = s5 + 0.0_wp * rmask(j,i,sr)        ! v"pt"
              ENDDO
           ENDDO
@@ -2150,6 +2160,6 @@
                 DO  j =  nys, nyn
                    s1 = s1 + qswst(j,i) * rmask(j,i,sr) ! w"q" (w"qv")
-                   s2 = s2 + ( ( 1.0 + 0.61 * q(nzt,j,i) ) * tswst(j,i) + &
-                               0.61 * pt(nzt,j,i) * qswst(j,i) )
+                   s2 = s2 + ( ( 1.0_wp + 0.61_wp * q(nzt,j,i) ) * tswst(j,i) +&
+                                 0.61_wp * pt(nzt,j,i) * qswst(j,i) )
                 ENDDO
              ENDDO
@@ -2165,6 +2175,8 @@
                 DO  i = nxl, nxr
                    DO  j =  nys, nyn
-                      s1 = s1 + ( ( 1.0 + 0.61 * q(nzt,j,i) - ql(nzt,j,i) ) * &
-                                  tswst(j,i) + 0.61 * pt(nzt,j,i) * qswst(j,i) )
+                      s1 = s1 + ( ( 1.0_wp +                                   &
+                                    0.61_wp * q(nzt,j,i) - ql(nzt,j,i) ) *     &
+                                  tswst(j,i) +                                 &
+                                  0.61_wp * pt(nzt,j,i) * qswst(j,i) )
                    ENDDO
                 ENDDO
@@ -2220,10 +2232,10 @@
           DO  i = nxl, nxr
              DO  j = nys, nyn
-                ust = 0.5 * ( u(k,j,i)   - hom(k,1,1,sr) + &
-                              u(k+1,j,i) - hom(k+1,1,1,sr) )
-                vst = 0.5 * ( v(k,j,i)   - hom(k,1,2,sr) + &
-                              v(k+1,j,i) - hom(k+1,1,2,sr) )
-                pts = 0.5 * ( pt(k,j,i)   - hom(k,1,4,sr) + &
-                              pt(k+1,j,i) - hom(k+1,1,4,sr) )
+                ust = 0.5_wp * ( u(k,j,i)   - hom(k,1,1,sr) + &
+                                 u(k+1,j,i) - hom(k+1,1,1,sr) )
+                vst = 0.5_wp * ( v(k,j,i)   - hom(k,1,2,sr) + &
+                                 v(k+1,j,i) - hom(k+1,1,2,sr) )
+                pts = 0.5_wp * ( pt(k,j,i)   - hom(k,1,4,sr) + &
+                                 pt(k+1,j,i) - hom(k+1,1,4,sr) )
 !
 !--             Higher moments
@@ -2232,5 +2244,5 @@
 !
 !--             Energy flux w*e* (has to be adjusted?)
-                s3 = s3 + w(k,j,i) * 0.5 * ( ust**2 + vst**2 + w(k,j,i)**2 ) &
+                s3 = s3 + w(k,j,i) * 0.5_wp * ( ust**2 + vst**2 + w(k,j,i)**2 )&
                                    * rmask(j,i,sr) * rflags_invers(j,i,k+1)
              ENDDO
@@ -2254,7 +2266,8 @@
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
-                      s1 = s1 + 0.5 * ( sa(k,j,i)   - hom(k,1,23,sr) +   &
-                                        sa(k+1,j,i) - hom(k+1,1,23,sr) ) &
-                                    * w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                      s1 = s1 + 0.5_wp * ( sa(k,j,i)   - hom(k,1,23,sr) +      &
+                                           sa(k+1,j,i) - hom(k+1,1,23,sr) )    &
+                                       * w(k,j,i) * rmask(j,i,sr)              & 
+                                       * rflags_invers(j,i,k+1)
                    ENDDO
                 ENDDO
@@ -2293,7 +2306,7 @@
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
-                      s1 = s1 + 0.5 * ( vpt(k,j,i)   - hom(k,1,44,sr) +     &
-                                        vpt(k+1,j,i) - hom(k+1,1,44,sr) ) * &
-                                      w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                      s1 = s1 + 0.5_wp * ( vpt(k,j,i)   - hom(k,1,44,sr) +     &
+                                           vpt(k+1,j,i) - hom(k+1,1,44,sr) ) * &
+                                         w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
                    ENDDO
                 ENDDO
@@ -2309,7 +2322,7 @@
                    DO  i = nxl, nxr
                       DO  j = nys, nyn
-                         s1 = s1 + 0.5 * ( ( q(k,j,i)   - ql(k,j,i)   ) - hom(k,1,42,sr) +   &
-                                           ( q(k+1,j,i) - ql(k+1,j,i) ) - hom(k+1,1,42,sr) ) &
-                                       * w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                         s1 = s1 + 0.5_wp * ( ( q(k,j,i)   - ql(k,j,i)   ) - hom(k,1,42,sr) +   &
+                                              ( q(k+1,j,i) - ql(k+1,j,i) ) - hom(k+1,1,42,sr) ) &
+                                          * w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
                       ENDDO
                    ENDDO
@@ -2395,7 +2408,7 @@
                    DO  i = nxl, nxr
                       DO  j = nys, nyn
-                         s1 = s1 + 0.5 * ( vpt(k,j,i)   - hom(k,1,44,sr) +   &
-                                           vpt(k+1,j,i) - hom(k+1,1,44,sr) ) &
-                                       * w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                         s1 = s1 + 0.5_wp * ( vpt(k,j,i)   - hom(k,1,44,sr) +   &
+                                              vpt(k+1,j,i) - hom(k+1,1,44,sr) ) &
+                                          * w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
                       ENDDO
                    ENDDO
@@ -2408,6 +2421,6 @@
                 !$acc parallel loop present( hom, sums_l )
                 DO  k = nzb, nzt_diff
-                   sums_l(k,46,tn) = ( 1.0 + 0.61 * hom(k,1,41,sr) ) * sums_l(k,17,tn) + &
-                                             0.61 * hom(k,1,4,sr) * sums_l(k,49,tn)
+                   sums_l(k,46,tn) = ( 1.0_wp + 0.61_wp * hom(k,1,41,sr) ) * sums_l(k,17,tn) + &
+                                                0.61_wp * hom(k,1,4,sr) * sums_l(k,49,tn)
                 ENDDO
                 !$acc end parallel loop
@@ -2427,7 +2440,8 @@
              DO  i = nxl, nxr
                 DO  j = nys, nyn
-                   s1 = s1 + 0.5 * ( q(k,j,i)   - hom(k,1,41,sr) +   &
-                                     q(k+1,j,i) - hom(k+1,1,41,sr) ) &
-                                 * w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                   s1 = s1 + 0.5_wp * ( q(k,j,i)   - hom(k,1,41,sr) +          &
+                                        q(k+1,j,i) - hom(k+1,1,41,sr) )        &
+                                    * w(k,j,i) * rmask(j,i,sr)                 &
+                                    * rflags_invers(j,i,k+1)
                 ENDDO
              ENDDO
@@ -2450,16 +2464,18 @@
              DO  i = nxl, nxr
                 DO  j = nys, nyn
-                   ust = 0.5 * ( u(k,j,i)   - hom(k,1,1,sr) + &
-                               u(k+1,j,i) - hom(k+1,1,1,sr) )
-                   vst = 0.5 * ( v(k,j,i)   - hom(k,1,2,sr) + &
-                               v(k+1,j,i) - hom(k+1,1,2,sr) )
+                   ust = 0.5_wp * ( u(k,j,i)   - hom(k,1,1,sr) +               &
+                                    u(k+1,j,i) - hom(k+1,1,1,sr) )
+                   vst = 0.5_wp * ( v(k,j,i)   - hom(k,1,2,sr) +               &
+                                    v(k+1,j,i) - hom(k+1,1,2,sr) )
 !
 !--                Momentum flux w*u*
-                   s1 = s1 + 0.5 * ( w(k,j,i-1) + w(k,j,i) ) &
-                                 * ust * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                   s1 = s1 + 0.5_wp * ( w(k,j,i-1) + w(k,j,i) )                &
+                                    * ust * rmask(j,i,sr)                      &
+                                    * rflags_invers(j,i,k+1)
 !
 !--                Momentum flux w*v*
-                   s2 = s2 + 0.5 * ( w(k,j-1,i) + w(k,j,i) ) &
-                                 * vst * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                   s2 = s2 + 0.5_wp * ( w(k,j-1,i) + w(k,j,i) )                &
+                                    * vst * rmask(j,i,sr)                      & 
+                                    * rflags_invers(j,i,k+1)
                 ENDDO
              ENDDO
@@ -2481,7 +2497,8 @@
 !
 !--                Vertical heat flux
-                   s1 = s1 + 0.5 * ( pt(k,j,i)   - hom(k,1,4,sr) + &
-                                     pt(k+1,j,i) - hom(k+1,1,4,sr) ) &
-                                 * w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                   s1 = s1 + 0.5_wp * ( pt(k,j,i)   - hom(k,1,4,sr) +          &
+                                        pt(k+1,j,i) - hom(k+1,1,4,sr) )        &
+                                    * w(k,j,i) * rmask(j,i,sr)                 & 
+                                    * rflags_invers(j,i,k+1)
                 ENDDO
              ENDDO
@@ -2497,7 +2514,8 @@
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
-                      s1 = s1 + 0.5 * ( q(k,j,i)   - hom(k,1,41,sr) +   &
-                                        q(k+1,j,i) - hom(k+1,1,41,sr) ) &
-                                    * w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
+                      s1 = s1 + 0.5_wp * ( q(k,j,i)   - hom(k,1,41,sr) +       &
+                                           q(k+1,j,i) - hom(k+1,1,41,sr) )     &
+                                       * w(k,j,i) * rmask(j,i,sr)              &
+                                       * rflags_invers(j,i,k+1)
                    ENDDO
                 ENDDO
@@ -2525,8 +2543,8 @@
 !--    First calculate the products, then the divergence.
 !--    Calculation is time consuming. Do it only, if profiles shall be plotted.
-       IF ( hom(nzb+1,2,55,0) /= 0.0  .OR.  hom(nzb+1,2,68,0) /= 0.0 )  THEN
+       IF ( hom(nzb+1,2,55,0) /= 0.0_wp  .OR.  hom(nzb+1,2,68,0) /= 0.0_wp )  THEN
 
           STOP '+++ openACC porting for vertical flux div of resolved scale TKE in flow_statistics is still missing'
-          sums_ll = 0.0  ! local array
+          sums_ll = 0.0_wp  ! local array
 
           !$OMP DO
@@ -2535,14 +2553,14 @@
                 DO  k = nzb_s_inner(j,i)+1, nzt
 
-                   sums_ll(k,1) = sums_ll(k,1) + 0.5 * w(k,j,i) * (        &
-                  ( 0.25 * ( u(k,j,i)+u(k+1,j,i)+u(k,j,i+1)+u(k+1,j,i+1)   &
-                           - 0.5 * ( hom(k,1,1,sr) + hom(k+1,1,1,sr) )     &
-                           ) )**2                                          &
-                + ( 0.25 * ( v(k,j,i)+v(k+1,j,i)+v(k,j+1,i)+v(k+1,j+1,i)   &
-                           - 0.5 * ( hom(k,1,2,sr) + hom(k+1,1,2,sr) )     &
-                           ) )**2                                          &
-                   + w(k,j,i)**2                                  )
-
-                   sums_ll(k,2) = sums_ll(k,2) + 0.5 * w(k,j,i) &
+                   sums_ll(k,1) = sums_ll(k,1) + 0.5_wp * w(k,j,i) * (         &
+                  ( 0.25_wp * ( u(k,j,i)+u(k+1,j,i)+u(k,j,i+1)+u(k+1,j,i+1)    &
+                              - 0.5_wp * ( hom(k,1,1,sr) + hom(k+1,1,1,sr) )   &
+                              ) )**2                                           &
+                + ( 0.25_wp * ( v(k,j,i)+v(k+1,j,i)+v(k,j+1,i)+v(k+1,j+1,i)    &
+                              - 0.5_wp * ( hom(k,1,2,sr) + hom(k+1,1,2,sr) )   &
+                              ) )**2                                           &
+                + w(k,j,i)**2                                        )
+
+                   sums_ll(k,2) = sums_ll(k,2) + 0.5_wp * w(k,j,i)             &
                                                * ( p(k,j,i) + p(k+1,j,i) )
 
@@ -2550,8 +2568,8 @@
              ENDDO
           ENDDO
-          sums_ll(0,1)     = 0.0    ! because w is zero at the bottom
-          sums_ll(nzt+1,1) = 0.0
-          sums_ll(0,2)     = 0.0
-          sums_ll(nzt+1,2) = 0.0
+          sums_ll(0,1)     = 0.0_wp    ! because w is zero at the bottom
+          sums_ll(nzt+1,1) = 0.0_wp
+          sums_ll(0,2)     = 0.0_wp
+          sums_ll(nzt+1,2) = 0.0_wp
 
           DO  k = nzb+1, nzt
@@ -2562,5 +2580,5 @@
           sums_l(nzb,55,tn) = sums_l(nzb+1,55,tn)
           sums_l(nzb,56,tn) = sums_l(nzb+1,56,tn)
-          sums_l(nzb,68,tn) = 0.0    ! because w* = 0 at nzb
+          sums_l(nzb,68,tn) = 0.0_wp    ! because w* = 0 at nzb
 
        ENDIF
@@ -2568,5 +2586,5 @@
 !
 !--    Divergence of vertical flux of SGS TKE and the flux itself (69)
-       IF ( hom(nzb+1,2,57,0) /= 0.0  .OR.  hom(nzb+1,2,69,0) /= 0.0 )  THEN
+       IF ( hom(nzb+1,2,57,0) /= 0.0_wp  .OR.  hom(nzb+1,2,69,0) /= 0.0_wp )  THEN
 
           STOP '+++ openACC porting for vertical flux div of SGS TKE in flow_statistics is still missing'
@@ -2576,12 +2594,12 @@
                 DO  k = nzb_s_inner(j,i)+1, nzt
 
-                   sums_l(k,57,tn) = sums_l(k,57,tn) - 0.5 * (                 &
+                   sums_l(k,57,tn) = sums_l(k,57,tn) - 0.5_wp * (              &
                    (km(k,j,i)+km(k+1,j,i)) * (e(k+1,j,i)-e(k,j,i)) * ddzu(k+1) &
                  - (km(k-1,j,i)+km(k,j,i)) * (e(k,j,i)-e(k-1,j,i)) * ddzu(k)   &
-                                                             ) * ddzw(k)
-
-                   sums_l(k,69,tn) = sums_l(k,69,tn) - 0.5 * (                 &
+                                                                ) * ddzw(k)
+
+                   sums_l(k,69,tn) = sums_l(k,69,tn) - 0.5_wp * (              &
                    (km(k,j,i)+km(k+1,j,i)) * (e(k+1,j,i)-e(k,j,i)) * ddzu(k+1) &
-                                                              )
+                                                                )
 
                 ENDDO
@@ -2596,5 +2614,5 @@
 !--    Horizontal heat fluxes (subgrid, resolved, total).
 !--    Do it only, if profiles shall be plotted.
-       IF ( hom(nzb+1,2,58,0) /= 0.0 ) THEN
+       IF ( hom(nzb+1,2,58,0) /= 0.0_wp ) THEN
 
           STOP '+++ openACC porting for horizontal flux calculation in flow_statistics is still missing'
@@ -2605,9 +2623,9 @@
 !
 !--                Subgrid horizontal heat fluxes u"pt", v"pt"
-                   sums_l(k,58,tn) = sums_l(k,58,tn) - 0.5 *                   &
+                   sums_l(k,58,tn) = sums_l(k,58,tn) - 0.5_wp *                &
                                                    ( kh(k,j,i) + kh(k,j,i-1) ) &
                                                  * ( pt(k,j,i-1) - pt(k,j,i) ) &
                                                  * ddx * rmask(j,i,sr)
-                   sums_l(k,61,tn) = sums_l(k,61,tn) - 0.5 *                   &
+                   sums_l(k,61,tn) = sums_l(k,61,tn) - 0.5_wp *                &
                                                    ( kh(k,j,i) + kh(k,j-1,i) ) &
                                                  * ( pt(k,j-1,i) - pt(k,j,i) ) &
@@ -2616,13 +2634,13 @@
 !--                Resolved horizontal heat fluxes u*pt*, v*pt*
                    sums_l(k,59,tn) = sums_l(k,59,tn) +                         &
-                                                  ( u(k,j,i) - hom(k,1,1,sr) ) &
-                                       * 0.5 * ( pt(k,j,i-1) - hom(k,1,4,sr) + &
-                                                 pt(k,j,i)   - hom(k,1,4,sr) )
-                   pts = 0.5 * ( pt(k,j-1,i) - hom(k,1,4,sr) + &
-                                 pt(k,j,i)   - hom(k,1,4,sr) )
+                                     ( u(k,j,i) - hom(k,1,1,sr) ) * 0.5_wp *   &
+                                     ( pt(k,j,i-1) - hom(k,1,4,sr) +           &
+                                       pt(k,j,i)   - hom(k,1,4,sr) )
+                   pts = 0.5_wp * ( pt(k,j-1,i) - hom(k,1,4,sr) +              &
+                                    pt(k,j,i)   - hom(k,1,4,sr) )
                    sums_l(k,62,tn) = sums_l(k,62,tn) +                         &
-                                                  ( v(k,j,i) - hom(k,1,2,sr) ) &
-                                       * 0.5 * ( pt(k,j-1,i) - hom(k,1,4,sr) + &
-                                                 pt(k,j,i)   - hom(k,1,4,sr) )
+                                     ( v(k,j,i) - hom(k,1,2,sr) ) * 0.5_wp *   &
+                                     ( pt(k,j-1,i) - hom(k,1,4,sr) +           &
+                                       pt(k,j,i)   - hom(k,1,4,sr) )
                 ENDDO
              ENDDO
@@ -2630,10 +2648,10 @@
 !
 !--       Fluxes at the surface must be zero (e.g. due to the Prandtl-layer)
-          sums_l(nzb,58,tn) = 0.0
-          sums_l(nzb,59,tn) = 0.0
-          sums_l(nzb,60,tn) = 0.0
-          sums_l(nzb,61,tn) = 0.0
-          sums_l(nzb,62,tn) = 0.0
-          sums_l(nzb,63,tn) = 0.0
+          sums_l(nzb,58,tn) = 0.0_wp
+          sums_l(nzb,59,tn) = 0.0_wp
+          sums_l(nzb,60,tn) = 0.0_wp
+          sums_l(nzb,61,tn) = 0.0_wp
+          sums_l(nzb,62,tn) = 0.0_wp
+          sums_l(nzb,63,tn) = 0.0_wp
 
        ENDIF
@@ -2752,5 +2770,5 @@
        hom(:,1,37,sr) = sums(:,37)     ! w*e*
        hom(:,1,38,sr) = sums(:,38)     ! w*3
-       hom(:,1,39,sr) = sums(:,38) / ( abs( sums(:,32) ) + 1E-20 )**1.5   ! Sw
+       hom(:,1,39,sr) = sums(:,38) / ( abs( sums(:,32) ) + 1E-20_wp )**1.5_wp   ! Sw
        hom(:,1,40,sr) = sums(:,40)     ! p
        hom(:,1,45,sr) = sums(:,45)     ! w"vpt"
@@ -2781,5 +2799,5 @@
        hom(:,1,70,sr) = sums(:,70)     ! q*2
        hom(:,1,71,sr) = sums(:,71)     ! prho
-       hom(:,1,72,sr) = hyp * 1E-4     ! hyp in dbar
+       hom(:,1,72,sr) = hyp * 1E-4_wp     ! hyp in dbar
        hom(:,1,73,sr) = sums(:,73)     ! nr
        hom(:,1,74,sr) = sums(:,74)     ! qr
@@ -2809,18 +2827,18 @@
 !--    is less than 1.5 times the height where the heat flux becomes negative
 !--    (positive) for the first time.
-       z_i(1) = 0.0
+       z_i(1) = 0.0_wp
        first = .TRUE.
 
        IF ( ocean )  THEN
           DO  k = nzt, nzb+1, -1
-             IF ( first .AND. hom(k,1,18,sr) < 0.0 &
-                .AND. abs(hom(k,1,18,sr)) > 1.0E-8)  THEN
+             IF ( first .AND. hom(k,1,18,sr) < 0.0_wp                          &
+                .AND. abs(hom(k,1,18,sr)) > 1.0E-8_wp )  THEN
                 first = .FALSE.
                 height = zw(k)
              ENDIF
-             IF ( hom(k,1,18,sr) < 0.0  .AND. &
-                  abs(hom(k,1,18,sr)) > 1.0E-8 .AND. &
+             IF ( hom(k,1,18,sr) < 0.0_wp  .AND.                               &
+                  abs(hom(k,1,18,sr)) > 1.0E-8_wp .AND.                        &
                   hom(k-1,1,18,sr) > hom(k,1,18,sr) )  THEN
-                IF ( zw(k) < 1.5 * height )  THEN
+                IF ( zw(k) < 1.5_wp * height )  THEN
                    z_i(1) = zw(k)
                 ELSE
@@ -2832,13 +2850,13 @@
        ELSE
           DO  k = nzb, nzt-1
-             IF ( first .AND. hom(k,1,18,sr) < 0.0 &
-                .AND. abs(hom(k,1,18,sr)) > 1.0E-8 )  THEN
+             IF ( first .AND. hom(k,1,18,sr) < 0.0_wp                          &
+                .AND. abs(hom(k,1,18,sr)) > 1.0E-8_wp )  THEN
                 first = .FALSE.
                 height = zw(k)
              ENDIF
              IF ( hom(k,1,18,sr) < 0.0  .AND. &
-                  abs(hom(k,1,18,sr)) > 1.0E-8 .AND. &
+                  abs(hom(k,1,18,sr)) > 1.0E-8_wp .AND. &
                   hom(k+1,1,18,sr) > hom(k,1,18,sr) )  THEN
-                IF ( zw(k) < 1.5 * height )  THEN
+                IF ( zw(k) < 1.5_wp * height )  THEN
                    z_i(1) = zw(k)
                 ELSE
@@ -2858,5 +2876,5 @@
 !--    WARNING: The threshold value of 0.2K/100m must be adjusted for the
 !--             ocean case!
-       z_i(2) = 0.0
+       z_i(2) = 0.0_wp
        DO  k = nzb+1, nzt+1
           dptdz(k) = ( hom(k,1,4,sr) - hom(k-1,1,4,sr) ) * ddzu(k)
@@ -2891,14 +2909,14 @@
 !--    the characteristic convective boundary layer temperature.
 !--    The horizontal average at nzb+1 is input for the average temperature.
-       IF ( hom(nzb,1,18,sr) > 0.0 .AND. abs(hom(nzb,1,18,sr)) > 1.0E-8 &
-           .AND.  z_i(1) /= 0.0 )  THEN
-          hom(nzb+8,1,pr_palm,sr)  = ( g / hom(nzb+1,1,4,sr) * &
-                                       hom(nzb,1,18,sr) *      &
-                                       ABS( z_i(1) ) )**0.333333333
+       IF ( hom(nzb,1,18,sr) > 0.0_wp .AND. abs(hom(nzb,1,18,sr)) > 1.0E-8_wp  &
+           .AND.  z_i(1) /= 0.0_wp )  THEN
+          hom(nzb+8,1,pr_palm,sr)  = ( g / hom(nzb+1,1,4,sr) *                 &
+                                       hom(nzb,1,18,sr) *                      &
+                                       ABS( z_i(1) ) )**0.333333333_wp
 !--       so far this only works if Prandtl layer is used
           hom(nzb+11,1,pr_palm,sr) = hom(nzb,1,16,sr) / hom(nzb+8,1,pr_palm,sr)
        ELSE
-          hom(nzb+8,1,pr_palm,sr)  = 0.0
-          hom(nzb+11,1,pr_palm,sr) = 0.0
+          hom(nzb+8,1,pr_palm,sr)  = 0.0_wp
+          hom(nzb+11,1,pr_palm,sr) = 0.0_wp
        ENDIF
 
@@ -2927,9 +2945,9 @@
        ts_value(21,sr) = hom(nzb,1,48,sr)           ! w"q"    at k=0
 
-       IF ( ts_value(5,sr) /= 0.0 )  THEN
-          ts_value(22,sr) = ts_value(4,sr)**2 / &
+       IF ( ts_value(5,sr) /= 0.0_wp )  THEN
+          ts_value(22,sr) = ts_value(4,sr)**2_wp / &
                             ( kappa * g * ts_value(5,sr) / ts_value(18,sr) ) ! L
        ELSE
-          ts_value(22,sr) = 10000.0
+          ts_value(22,sr) = 10000.0_wp
        ENDIF
 
@@ -2946,5 +2964,5 @@
 !-- If required, sum up horizontal averages for subsequent time averaging
     IF ( do_sum )  THEN
-       IF ( average_count_pr == 0 )  hom_sum = 0.0
+       IF ( average_count_pr == 0 )  hom_sum = 0.0_wp
        hom_sum = hom_sum + hom(:,1,:,:)
        average_count_pr = average_count_pr + 1
Index: /palm/trunk/SOURCE/global_min_max.f90
===================================================================
--- /palm/trunk/SOURCE/global_min_max.f90	(revision 1352)
+++ /palm/trunk/SOURCE/global_min_max.f90	(revision 1353)
@@ -21,5 +21,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -191,5 +191,5 @@
 !
 !--    Determine the local absolut maximum
-       fmax_l(1)     = 0.0
+       fmax_l(1)     = 0.0_wp
        fmax_ijk_l(1) =  i1
        fmax_ijk_l(2) =  j1
@@ -212,5 +212,5 @@
 !--    A constant offset has to be subtracted in order to handle the special
 !--    case i=0 correctly
-       IF ( ar(fmax_ijk_l(1),fmax_ijk_l(2),fmax_ijk_l(3)) < 0.0 )  THEN
+       IF ( ar(fmax_ijk_l(1),fmax_ijk_l(2),fmax_ijk_l(3)) < 0.0_wp )  THEN
           fmax_ijk_l(1) = -fmax_ijk_l(1) - 10
        ENDIF
@@ -251,5 +251,5 @@
 !
 !--    Determine the local absolut maximum
-       fmax_l(1)     = 0.0
+       fmax_l(1)     = 0.0_wp
        fmax_ijk_l(1) =  i1
        fmax_ijk_l(2) =  j1
@@ -276,5 +276,5 @@
 !--    A constant offset has to be subtracted in order to handle the special
 !--    case i=0 correctly
-       IF ( ar(fmax_ijk_l(1),fmax_ijk_l(2),fmax_ijk_l(3)) < 0.0 )  THEN
+       IF ( ar(fmax_ijk_l(1),fmax_ijk_l(2),fmax_ijk_l(3)) < 0.0_wp )  THEN
           fmax_ijk_l(1) = -fmax_ijk_l(1) - 10
        ENDIF
Index: /palm/trunk/SOURCE/header.f90
===================================================================
--- /palm/trunk/SOURCE/header.f90	(revision 1352)
+++ /palm/trunk/SOURCE/header.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute 
 ! 
 ! Former revisions:
@@ -305,5 +305,5 @@
     ENDIF
 #if defined( __parallel )
-    IF ( coupling_start_time /= 0.0 )  THEN
+    IF ( coupling_start_time /= 0.0_wp )  THEN
        IF ( coupling_start_time > simulated_time_at_begin )  THEN
           WRITE ( io, 109 )
@@ -410,10 +410,11 @@
           char2 = 'at the end of the run'
        ENDIF
-       WRITE ( io, 119 )  TRIM( char1 ), TRIM( char2 ), &
-                          advected_distance_x/1000.0, advected_distance_y/1000.0
+       WRITE ( io, 119 )  TRIM( char1 ), TRIM( char2 ),                        &
+                          advected_distance_x/1000.0_wp,                       &
+                          advected_distance_y/1000.0_wp
     ENDIF
     WRITE ( io, 122 )  timestep_scheme
     IF ( use_upstream_for_tke )  WRITE ( io, 143 )
-    IF ( rayleigh_damping_factor /= 0.0 )  THEN
+    IF ( rayleigh_damping_factor /= 0.0_wp )  THEN
        IF ( .NOT. ocean )  THEN
           WRITE ( io, 123 )  'above', rayleigh_damping_height, &
@@ -480,6 +481,6 @@
     IF ( simulated_time_at_begin /= simulated_time )  THEN
        i = MAX ( log_point_s(10)%counts, 1 )
-       IF ( ( simulated_time - simulated_time_at_begin ) == 0.0 )  THEN
-          cpuseconds_per_simulated_second = 0.0
+       IF ( ( simulated_time - simulated_time_at_begin ) == 0.0_wp )  THEN
+          cpuseconds_per_simulated_second = 0.0_wp
        ELSE
           cpuseconds_per_simulated_second = log_point_s(10)%sum / &
@@ -504,5 +505,5 @@
 !-- and ocean are used or have been used. In this case, coupling_start_time
 !-- defines the time when the coupling is switched on.
-    IF ( coupling_start_time /= 0.0 )  THEN
+    IF ( coupling_start_time /= 0.0_wp )  THEN
        WRITE ( io, 207 )  coupling_start_time
     ENDIF
@@ -543,5 +544,5 @@
              building_wall_left = ( nx + 1 - blx ) / 2 * dx
           ENDIF
-          bxl = INT ( building_wall_left / dx + 0.5 )
+          bxl = INT ( building_wall_left / dx + 0.5_wp )
           bxr = bxl + blx
 
@@ -549,5 +550,5 @@
              building_wall_south = ( ny + 1 - bly ) / 2 * dy
           ENDIF
-          bys = INT ( building_wall_south / dy + 0.5 )
+          bys = INT ( building_wall_south / dy + 0.5_wp )
           byn = bys + bly
 
@@ -802,5 +803,5 @@
 !-- Listing of 1D-profiles
     WRITE ( io, 325 )  dt_dopr_listing
-    IF ( averaging_interval_pr /= 0.0 )  THEN
+    IF ( averaging_interval_pr /= 0.0_wp )  THEN
        WRITE ( io, 326 )  averaging_interval_pr, dt_averaging_input_pr
     ENDIF
@@ -809,5 +810,5 @@
 !-- DATA output
     WRITE ( io, 330 )
-    IF ( averaging_interval_pr /= 0.0 )  THEN
+    IF ( averaging_interval_pr /= 0.0_wp )  THEN
        WRITE ( io, 326 )  averaging_interval_pr, dt_averaging_input_pr
     ENDIF
@@ -835,5 +836,5 @@
        ENDIF
        WRITE ( io, 333 )  dt_dopr, averaging_interval_pr, dt_averaging_input_pr
-       IF ( skip_time_dopr /= 0.0 )  WRITE ( io, 339 )  skip_time_dopr
+       IF ( skip_time_dopr /= 0.0_wp )  WRITE ( io, 339 )  skip_time_dopr
     ENDIF
 
@@ -901,5 +902,5 @@
 
                 IF ( section(i,1) == -1 )  THEN
-                   WRITE (coor_chr,'(F10.1)')  -1.0
+                   WRITE (coor_chr,'(F10.1)')  -1.0_wp
                 ELSE
                    WRITE (coor_chr,'(F10.1)')  zu(section(i,1))
@@ -914,5 +915,5 @@
                                    TRIM( begin_chr ), 'k', TRIM( slices ), &
                                    TRIM( coordinates )
-                IF ( skip_time_do2d_xy /= 0.0 )  THEN
+                IF ( skip_time_do2d_xy /= 0.0_wp )  THEN
                    WRITE ( io, 339 )  skip_time_do2d_xy
                 ENDIF
@@ -922,5 +923,5 @@
                                    dt_averaging_input, 'k', TRIM( slices ), &
                                    TRIM( coordinates )
-                IF ( skip_time_data_output_av /= 0.0 )  THEN
+                IF ( skip_time_data_output_av /= 0.0_wp )  THEN
                    WRITE ( io, 339 )  skip_time_data_output_av
                 ENDIF
@@ -956,5 +957,5 @@
                                    TRIM( begin_chr ), 'j', TRIM( slices ), &
                                    TRIM( coordinates )
-                IF ( skip_time_do2d_xz /= 0.0 )  THEN
+                IF ( skip_time_do2d_xz /= 0.0_wp )  THEN
                    WRITE ( io, 339 )  skip_time_do2d_xz
                 ENDIF
@@ -964,5 +965,5 @@
                                    dt_averaging_input, 'j', TRIM( slices ), &
                                    TRIM( coordinates )
-                IF ( skip_time_data_output_av /= 0.0 )  THEN
+                IF ( skip_time_data_output_av /= 0.0_wp )  THEN
                    WRITE ( io, 339 )  skip_time_data_output_av
                 ENDIF
@@ -998,5 +999,5 @@
                                    TRIM( begin_chr ), 'i', TRIM( slices ), &
                                    TRIM( coordinates )
-                IF ( skip_time_do2d_yz /= 0.0 )  THEN
+                IF ( skip_time_do2d_yz /= 0.0_wp )  THEN
                    WRITE ( io, 339 )  skip_time_do2d_yz
                 ENDIF
@@ -1006,5 +1007,5 @@
                                    dt_averaging_input, 'i', TRIM( slices ), &
                                    TRIM( coordinates )
-                IF ( skip_time_data_output_av /= 0.0 )  THEN
+                IF ( skip_time_data_output_av /= 0.0_wp )  THEN
                    WRITE ( io, 339 )  skip_time_data_output_av
                 ENDIF
@@ -1065,9 +1066,9 @@
 
           IF ( av == 0 )  THEN
-             IF ( skip_time_do3d /= 0.0 )  THEN
+             IF ( skip_time_do3d /= 0.0_wp )  THEN
                 WRITE ( io, 339 )  skip_time_do3d
              ENDIF
           ELSE
-             IF ( skip_time_data_output_av /= 0.0 )  THEN
+             IF ( skip_time_data_output_av /= 0.0_wp )  THEN
                 WRITE ( io, 339 )  skip_time_data_output_av
              ENDIF
@@ -1115,9 +1116,9 @@
 
              IF ( av == 0 )  THEN
-                IF ( skip_time_domask(mid) /= 0.0 )  THEN
+                IF ( skip_time_domask(mid) /= 0.0_wp )  THEN
                    WRITE ( io, 339 )  skip_time_domask(mid)
                 ENDIF
              ELSE
-                IF ( skip_time_data_output_av /= 0.0 )  THEN
+                IF ( skip_time_data_output_av /= 0.0_wp )  THEN
                    WRITE ( io, 339 )  skip_time_data_output_av
                 ENDIF
@@ -1126,16 +1127,16 @@
 !--          output locations
              DO  dim = 1, 3
-                IF ( mask(mid,dim,1) >= 0.0 )  THEN
+                IF ( mask(mid,dim,1) >= 0.0_wp )  THEN
                    count = 0
-                   DO  WHILE ( mask(mid,dim,count+1) >= 0.0 )
+                   DO  WHILE ( mask(mid,dim,count+1) >= 0.0_wp )
                       count = count + 1
                    ENDDO
                    WRITE ( io, 349 )  dir(dim), dir(dim), mid, dir(dim), &
                                       mask(mid,dim,:count)
-                ELSEIF ( mask_loop(mid,dim,1) < 0.0 .AND.  &
-                         mask_loop(mid,dim,2) < 0.0 .AND.  &
-                         mask_loop(mid,dim,3) == 0.0 )  THEN
+                ELSEIF ( mask_loop(mid,dim,1) < 0.0_wp .AND.  &
+                         mask_loop(mid,dim,2) < 0.0_wp .AND.  &
+                         mask_loop(mid,dim,3) == 0.0_wp )  THEN
                    WRITE ( io, 350 )  dir(dim), dir(dim)
-                ELSEIF ( mask_loop(mid,dim,3) == 0.0 )  THEN
+                ELSEIF ( mask_loop(mid,dim,3) == 0.0_wp )  THEN
                    WRITE ( io, 351 )  dir(dim), dir(dim), mid, dir(dim), &
                                       mask_loop(mid,dim,1:2)
@@ -1221,5 +1222,5 @@
        WRITE ( io, 344 )  output_format
        WRITE ( io, 371 )  dt_dosp
-       IF ( skip_time_dosp /= 0.0 )  WRITE ( io, 339 )  skip_time_dosp
+       IF ( skip_time_dosp /= 0.0_wp )  WRITE ( io, 339 )  skip_time_dosp
        WRITE ( io, 372 )  ( data_output_sp(i), i = 1,10 ),     &
                           ( spectra_direction(i), i = 1,10 ),  &
@@ -1258,5 +1259,5 @@
        WRITE ( io, 416 ) surface_pressure, r_d, rho_surface, cp, l_v
        IF ( icloud_scheme == 0 )  THEN
-          WRITE ( io, 510 ) 1.0E-6 * nc_const
+          WRITE ( io, 510 ) 1.0E-6_wp * nc_const
           IF ( precipitation )  WRITE ( io, 511 ) c_sedimentation
        ENDIF
@@ -1538,6 +1539,6 @@
     ENDIF
     IF ( .NOT. constant_diffusion)  THEN
-       IF ( e_init > 0.0 )  WRITE ( io, 455 )  e_init
-       IF ( e_min > 0.0 )  WRITE ( io, 454 )  e_min
+       IF ( e_init > 0.0_wp )  WRITE ( io, 455 )  e_init
+       IF ( e_min > 0.0_wp )  WRITE ( io, 454 )  e_min
        IF ( wall_adjustment )  WRITE ( io, 453 )  wall_adjustment_factor
     ENDIF
@@ -1557,11 +1558,11 @@
        WRITE ( io, 474 )  TRIM( random_generator )
     ENDIF
-    IF ( pt_surface_initial_change /= 0.0 )  THEN
+    IF ( pt_surface_initial_change /= 0.0_wp )  THEN
        WRITE ( io, 475 )  pt_surface_initial_change
     ENDIF
-    IF ( humidity  .AND.  q_surface_initial_change /= 0.0 )  THEN
+    IF ( humidity  .AND.  q_surface_initial_change /= 0.0_wp )  THEN
        WRITE ( io, 476 )  q_surface_initial_change       
     ENDIF
-    IF ( passive_scalar  .AND.  q_surface_initial_change /= 0.0 )  THEN
+    IF ( passive_scalar  .AND.  q_surface_initial_change /= 0.0_wp )  THEN
        WRITE ( io, 477 )  q_surface_initial_change       
     ENDIF
@@ -1601,9 +1602,9 @@
        DO  i = 1, number_of_particle_groups
           IF ( i == 1  .AND.  density_ratio(i) == 9999999.9_wp )  THEN
-             WRITE ( io, 490 )  i, 0.0
+             WRITE ( io, 490 )  i, 0.0_wp
              WRITE ( io, 492 )
           ELSE
              WRITE ( io, 490 )  i, radius(i)
-             IF ( density_ratio(i) /= 0.0 )  THEN
+             IF ( density_ratio(i) /= 0.0_wp )  THEN
                 WRITE ( io, 491 )  density_ratio(i)
              ELSE
Index: /palm/trunk/SOURCE/impact_of_latent_heat.f90
===================================================================
--- /palm/trunk/SOURCE/impact_of_latent_heat.f90	(revision 1352)
+++ /palm/trunk/SOURCE/impact_of_latent_heat.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -90,5 +90,5 @@
                    dqdt_precip = prec_time_const * ( ql(k,j,i) - ql_crit )
                 ELSE
-                   dqdt_precip = 0.0
+                   dqdt_precip = 0.0_wp
                 ENDIF
                 tend(k,j,i) = tend(k,j,i) + dqdt_precip * l_d_cp * pt_d_t(k)
@@ -131,5 +131,5 @@
              dqdt_precip = prec_time_const * ( ql(k,j,i) - ql_crit )
           ELSE
-             dqdt_precip = 0.0
+             dqdt_precip = 0.0_wp
           ENDIF
           tend(k,j,i) = tend(k,j,i) + dqdt_precip * l_d_cp * pt_d_t(k)
Index: /palm/trunk/SOURCE/inflow_turbulence.f90
===================================================================
--- /palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1352)
+++ /palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -90,5 +90,5 @@
 !
 !-- Carry out spanwise averaging in the recycling plane
-    avpr_l = 0.0
+    avpr_l = 0.0_wp
     ngp_pr = ( nzt - nzb + 2 ) * 5 * nbgp
     ngp_ifd = ngp_pr * ( nyn - nys + 1 + 2 * nbgp )
@@ -192,5 +192,5 @@
     ELSEIF ( myidx /= id_recycling  .AND.  myidx == id_inflow )  THEN
 
-       inflow_dist = 0.0
+       inflow_dist = 0.0_wp
        CALL MPI_RECV( inflow_dist(nzb,nysg,1,1), ngp_ifd, MPI_REAL, &
                       id_recycling, 1, comm1dx, status, ierr )
Index: /palm/trunk/SOURCE/init_1d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_1d_model.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_1d_model.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute 
 ! 
 ! Former revisions:
@@ -113,23 +113,23 @@
        kh1d = km_constant / prandtl_number
     ELSE
-       e1d = 0.0; e1d_p = 0.0
-       kh1d = 0.0; km1d = 0.0
-       rif1d = 0.0
+       e1d = 0.0_wp; e1d_p = 0.0_wp
+       kh1d = 0.0_wp; km1d = 0.0_wp
+       rif1d = 0.0_wp
 !
 !--    Compute the mixing length
-       l_black(nzb) = 0.0
+       l_black(nzb) = 0.0_wp
 
        IF ( TRIM( mixing_length_1d ) == 'blackadar' )  THEN
 !
 !--       Blackadar mixing length
-          IF ( f /= 0.0 )  THEN
-             lambda = 2.7E-4 * SQRT( ug(nzt+1)**2 + vg(nzt+1)**2 ) /           &
-                               ABS( f ) + 1E-10
+          IF ( f /= 0.0_wp )  THEN
+             lambda = 2.7E-4_wp * SQRT( ug(nzt+1)**2 + vg(nzt+1)**2 ) /        &
+                               ABS( f ) + 1E-10_wp
           ELSE
-             lambda = 30.0
+             lambda = 30.0_wp
           ENDIF
 
           DO  k = nzb+1, nzt+1
-             l_black(k) = kappa * zu(k) / ( 1.0 + kappa * zu(k) / lambda )
+             l_black(k) = kappa * zu(k) / ( 1.0_wp + kappa * zu(k) / lambda )
           ENDDO
 
@@ -152,31 +152,31 @@
 !-- value in order to avoid too small time steps caused by the diffusion limit
 !-- in the initial phase of a run (at k=1, dz/2 occurs in the limiting formula!)
-    u1d(0:1)   = 0.1
-    u1d_p(0:1) = 0.1
-    v1d(0:1)   = 0.1
-    v1d_p(0:1) = 0.1
+    u1d(0:1)   = 0.1_wp
+    u1d_p(0:1) = 0.1_wp
+    v1d(0:1)   = 0.1_wp
+    v1d_p(0:1) = 0.1_wp
 
 !
 !-- For u*, theta* and the momentum fluxes plausible values are set
     IF ( prandtl_layer )  THEN
-       us1d = 0.1   ! without initial friction the flow would not change
+       us1d = 0.1_wp   ! without initial friction the flow would not change
     ELSE
-       e1d(nzb+1)  = 1.0
-       km1d(nzb+1) = 1.0
-       us1d = 0.0
+       e1d(nzb+1)  = 1.0_wp
+       km1d(nzb+1) = 1.0_wp
+       us1d = 0.0_wp
     ENDIF
-    ts1d = 0.0
-    usws1d = 0.0
-    vsws1d = 0.0
+    ts1d = 0.0_wp
+    usws1d = 0.0_wp
+    vsws1d = 0.0_wp
     z01d  = roughness_length
     z0h1d = z0h_factor * z01d 
-    IF ( humidity .OR. passive_scalar )  qs1d = 0.0
+    IF ( humidity .OR. passive_scalar )  qs1d = 0.0_wp
 
 !
 !-- Tendencies must be preset in order to avoid runtime errors within the
 !-- first Runge-Kutta step
-    te_em = 0.0
-    te_um = 0.0
-    te_vm = 0.0
+    te_em = 0.0_wp
+    te_um = 0.0_wp
+    te_vm = 0.0_wp
 
 !
@@ -270,6 +270,6 @@
           DO  k = nzb_diff, nzt
 
-             kmzm = 0.5 * ( km1d(k-1) + km1d(k) )
-             kmzp = 0.5 * ( km1d(k) + km1d(k+1) )
+             kmzm = 0.5_wp * ( km1d(k-1) + km1d(k) )
+             kmzp = 0.5_wp * ( km1d(k) + km1d(k+1) )
 !
 !--          u-component
@@ -289,14 +289,14 @@
 !
 !--             TKE
-                kmzm = 0.5 * ( km1d(k-1) + km1d(k) )
-                kmzp = 0.5 * ( km1d(k) + km1d(k+1) )
+                kmzm = 0.5_wp * ( km1d(k-1) + km1d(k) )
+                kmzp = 0.5_wp * ( km1d(k) + km1d(k+1) )
                 IF ( .NOT. humidity )  THEN
                    pt_0 = pt_init(k)
                    flux =  ( pt_init(k+1)-pt_init(k-1) ) * dd2zu(k)
                 ELSE
-                   pt_0 = pt_init(k) * ( 1.0 + 0.61 * q_init(k) )
-                   flux = ( ( pt_init(k+1) - pt_init(k-1) ) +                 &
-                            0.61 * pt_init(k) * ( q_init(k+1) - q_init(k-1) ) &
-                          ) * dd2zu(k)
+                   pt_0 = pt_init(k) * ( 1.0_wp + 0.61_wp * q_init(k) )
+                   flux = ( ( pt_init(k+1) - pt_init(k-1) ) +                  &
+                            0.61_wp * pt_init(k) *                             &
+                            ( q_init(k+1) - q_init(k-1) ) ) * dd2zu(k)
                 ENDIF
 
@@ -304,7 +304,7 @@
 !
 !--                According to Detering, c_e=0.064
-                   dissipation = 0.064 * e1d(k) * SQRT( e1d(k) ) / l1d(k)
+                   dissipation = 0.064_wp * e1d(k) * SQRT( e1d(k) ) / l1d(k)
                 ELSEIF ( dissipation_1d == 'as_in_3d_model' )  THEN
-                   dissipation = ( 0.19 + 0.74 * l1d(k) / l_grid(k) ) &
+                   dissipation = ( 0.19_wp + 0.74_wp * l1d(k) / l_grid(k) )    &
                                  * e1d(k) * SQRT( e1d(k) ) / l1d(k)
                 ENDIF
@@ -329,13 +329,13 @@
 
              k = nzb+1
-             kmzm = 0.5 * ( km1d(k-1) + km1d(k) )
-             kmzp = 0.5 * ( km1d(k) + km1d(k+1) )
+             kmzm = 0.5_wp * ( km1d(k-1) + km1d(k) )
+             kmzp = 0.5_wp * ( km1d(k) + km1d(k+1) )
              IF ( .NOT. humidity )  THEN
                 pt_0 = pt_init(k)
                 flux =  ( pt_init(k+1)-pt_init(k-1) ) * dd2zu(k)
              ELSE
-                pt_0 = pt_init(k) * ( 1.0 + 0.61 * q_init(k) )
-                flux = ( ( pt_init(k+1) - pt_init(k-1) ) +                 &
-                         0.61 * pt_init(k) * ( q_init(k+1) - q_init(k-1) ) &
+                pt_0 = pt_init(k) * ( 1.0_wp + 0.61_wp * q_init(k) )
+                flux = ( ( pt_init(k+1) - pt_init(k-1) ) +                     &
+                         0.61_wp * pt_init(k) * ( q_init(k+1) - q_init(k-1) )  &
                        ) * dd2zu(k)
              ENDIF
@@ -344,7 +344,7 @@
 !
 !--             According to Detering, c_e=0.064
-                dissipation = 0.064 * e1d(k) * SQRT( e1d(k) ) / l1d(k)
+                dissipation = 0.064_wp * e1d(k) * SQRT( e1d(k) ) / l1d(k)
              ELSEIF ( dissipation_1d == 'as_in_3d_model' )  THEN
-                dissipation = ( 0.19 + 0.74 * l1d(k) / l_grid(k) ) &
+                dissipation = ( 0.19_wp + 0.74_wp * l1d(k) / l_grid(k) )       &
                               * e1d(k) * SQRT( e1d(k) ) / l1d(k)
              ENDIF
@@ -354,10 +354,10 @@
              te_u(k) = f * ( v1d(k) - vg(k) ) + (                              &
                        kmzp * ( u1d(k+1) - u1d(k) ) * ddzu(k+1) + usws1d       &
-                                                ) * 2.0 * ddzw(k)
+                                                ) * 2.0_wp * ddzw(k)
 !
 !--          v-component
              te_v(k) = -f * ( u1d(k) - ug(k) ) + (                             &
                        kmzp * ( v1d(k+1) - v1d(k) ) * ddzu(k+1) + vsws1d       &
-                                                 ) * 2.0 * ddzw(k)
+                                                 ) * 2.0_wp * ddzw(k)
 !
 !--          TKE
@@ -394,5 +394,5 @@
 !--          integration due to numerical inaccuracies. In such cases the TKE
 !--          value is reduced to 10 percent of its old value.
-             WHERE ( e1d_p < 0.0 )  e1d_p = 0.1 * e1d
+             WHERE ( e1d_p < 0.0_wp )  e1d_p = 0.1_wp * e1d
           ENDIF
 
@@ -417,11 +417,11 @@
 
                 DO  k = nzb+1, nzt
-                   te_um(k) = -9.5625 * te_u(k) + 5.3125 * te_um(k)
-                   te_vm(k) = -9.5625 * te_v(k) + 5.3125 * te_vm(k)
+                   te_um(k) = -9.5625_wp * te_u(k) + 5.3125_wp * te_um(k)
+                   te_vm(k) = -9.5625_wp * te_v(k) + 5.3125_wp * te_vm(k)
                 ENDDO
 
                 IF ( .NOT. constant_diffusion )  THEN
                    DO k = nzb+1, nzt
-                      te_em(k) = -9.5625 * te_e(k) + 5.3125 * te_em(k)
+                      te_em(k) = -9.5625_wp * te_e(k) + 5.3125_wp * te_em(k)
                    ENDDO
                 ENDIF
@@ -440,6 +440,6 @@
          ! v1d_p(nzb) = -v1d_p(nzb+1)
 
-          u1d_p(nzb) = 0.0
-          v1d_p(nzb) = 0.0
+          u1d_p(nzb) = 0.0_wp
+          v1d_p(nzb) = 0.0_wp
 
 !
@@ -460,28 +460,31 @@
 !
 !--             Compute theta* using Rif numbers of the previous time step
-                IF ( rif1d(1) >= 0.0 )  THEN
+                IF ( rif1d(1) >= 0.0_wp )  THEN
 !
 !--                Stable stratification
-                   ts1d = kappa * ( pt_init(nzb+1) - pt_init(nzb) ) /       &
-                          ( LOG( zu(nzb+1) / z0h1d ) + 5.0 * rif1d(nzb+1) * &
-                                          ( zu(nzb+1) - z0h1d ) / zu(nzb+1) &
+                   ts1d = kappa * ( pt_init(nzb+1) - pt_init(nzb) ) /          &
+                          ( LOG( zu(nzb+1) / z0h1d ) + 5.0_wp * rif1d(nzb+1) * &
+                                          ( zu(nzb+1) - z0h1d ) / zu(nzb+1)    &
                           )
                 ELSE
 !
 !--                Unstable stratification
-                   a = SQRT( 1.0 - 16.0 * rif1d(nzb+1) )
-                   b = SQRT( 1.0 - 16.0 * rif1d(nzb+1) / zu(nzb+1) * z0h1d )
+                   a = SQRT( 1.0_wp - 16.0_wp * rif1d(nzb+1) )
+                   b = SQRT( 1.0_wp - 16.0_wp * rif1d(nzb+1) /                 &
+                       zu(nzb+1) * z0h1d )
 !
 !--                In the borderline case the formula for stable stratification 
 !--                must be applied, because otherwise a zero division would
 !--                occur in the argument of the logarithm.
-                   IF ( a == 0.0  .OR.  b == 0.0 )  THEN
+                   IF ( a == 0.0_wp  .OR.  b == 0.0_wp )  THEN
                       ts1d = kappa * ( pt_init(nzb+1) - pt_init(nzb) ) /       &
-                             ( LOG( zu(nzb+1) / z0h1d ) + 5.0 * rif1d(nzb+1) * &
-                                             ( zu(nzb+1) - z0h1d ) / zu(nzb+1) &
+                             ( LOG( zu(nzb+1) / z0h1d ) +                      &
+                               5.0_wp * rif1d(nzb+1) *                         &
+                               ( zu(nzb+1) - z0h1d ) / zu(nzb+1)               &
                              )
                    ELSE
-                      ts1d = kappa * ( pt_init(nzb+1) - pt_init(nzb) ) / &
-                             LOG( (a-1.0) / (a+1.0) * (b+1.0) / (b-1.0) )
+                      ts1d = kappa * ( pt_init(nzb+1) - pt_init(nzb) ) /       &
+                             LOG( (a-1.0_wp) / (a+1.0_wp) *                    &
+                                  (b+1.0_wp) / (b-1.0_wp) )
                    ENDIF
                 ENDIF
@@ -500,9 +503,9 @@
                    flux = ts1d
                 ELSE
-                   pt_0 = pt_init(nzb+1) * ( 1.0 + 0.61 * q_init(nzb+1) )
-                   flux = ts1d + 0.61 * pt_init(k) * qs1d
+                   pt_0 = pt_init(nzb+1) * ( 1.0_wp + 0.61_wp * q_init(nzb+1) )
+                   flux = ts1d + 0.61_wp * pt_init(k) * qs1d
                 ENDIF
                 rif1d(nzb+1) = zu(nzb+1) * kappa * g * flux / &
-                               ( pt_0 * ( us1d**2 + 1E-30 ) )
+                               ( pt_0 * ( us1d**2 + 1E-30_wp ) )
              ENDIF
 
@@ -512,21 +515,22 @@
                    flux = ( pt_init(k+1) - pt_init(k-1) ) * dd2zu(k)
                 ELSE
-                   pt_0 = pt_init(k) * ( 1.0 + 0.61 * q_init(k) )
+                   pt_0 = pt_init(k) * ( 1.0_wp + 0.61_wp * q_init(k) )
                    flux = ( ( pt_init(k+1) - pt_init(k-1) )                    &
-                            + 0.61 * pt_init(k) * ( q_init(k+1) - q_init(k-1) )&
+                            + 0.61_wp * pt_init(k)                             &
+                            * ( q_init(k+1) - q_init(k-1) )                    &
                           ) * dd2zu(k)
                 ENDIF
-                IF ( rif1d(k) >= 0.0 )  THEN
-                   rif1d(k) = g / pt_0 * flux /                              &
-                              (  ( ( u1d(k+1) - u1d(k-1) ) * dd2zu(k) )**2   &
-                               + ( ( v1d(k+1) - v1d(k-1) ) * dd2zu(k) )**2   &
-                               + 1E-30                                       &
+                IF ( rif1d(k) >= 0.0_wp )  THEN
+                   rif1d(k) = g / pt_0 * flux /                                &
+                              (  ( ( u1d(k+1) - u1d(k-1) ) * dd2zu(k) )**2     &
+                               + ( ( v1d(k+1) - v1d(k-1) ) * dd2zu(k) )**2     &
+                               + 1E-30_wp                                      &
                               )
                 ELSE
-                   rif1d(k) = g / pt_0 * flux /                              &
-                              (  ( ( u1d(k+1) - u1d(k-1) ) * dd2zu(k) )**2   &
-                               + ( ( v1d(k+1) - v1d(k-1) ) * dd2zu(k) )**2   &
-                               + 1E-30                                       &
-                              ) * ( 1.0 - 16.0 * rif1d(k) )**0.25
+                   rif1d(k) = g / pt_0 * flux /                                &
+                              (  ( ( u1d(k+1) - u1d(k-1) ) * dd2zu(k) )**2     &
+                               + ( ( v1d(k+1) - v1d(k-1) ) * dd2zu(k) )**2     &
+                               + 1E-30_wp                                      &
+                              ) * ( 1.0_wp - 16.0_wp * rif1d(k) )**0.25_wp
                 ENDIF
              ENDDO
@@ -543,9 +547,9 @@
                 uv_total = SQRT( u1d(nzb+1)**2 + v1d(nzb+1)**2 )
 
-                IF ( rif1d(nzb+1) >= 0.0 )  THEN
+                IF ( rif1d(nzb+1) >= 0.0_wp )  THEN
 !
 !--                Stable stratification
                    us1d = kappa * uv_total / (                                 &
-                             LOG( zu(nzb+1) / z01d ) + 5.0 * rif1d(nzb+1) *    &
+                             LOG( zu(nzb+1) / z01d ) + 5.0_wp * rif1d(nzb+1) * &
                                               ( zu(nzb+1) - z01d ) / zu(nzb+1) &
                                              )
@@ -553,20 +557,21 @@
 !
 !--                Unstable stratification
-                   a = 1.0 / SQRT( SQRT( 1.0 - 16.0 * rif1d(nzb+1) ) )
-                   b = 1.0 / SQRT( SQRT( 1.0 - 16.0 * rif1d(nzb+1) / zu(nzb+1) &
-                                                    * z01d ) )
+                   a = 1.0_wp / SQRT( SQRT( 1.0_wp - 16.0_wp * rif1d(nzb+1) ) )
+                   b = 1.0_wp / SQRT( SQRT( 1.0_wp - 16.0_wp * rif1d(nzb+1) /  &
+                                                     zu(nzb+1) * z01d ) )
 !
 !--                In the borderline case the formula for stable stratification 
 !--                must be applied, because otherwise a zero division would
 !--                occur in the argument of the logarithm.
-                   IF ( a == 1.0  .OR.  b == 1.0 )  THEN
-                      us1d = kappa * uv_total / (                            &
-                             LOG( zu(nzb+1) / z01d ) +                       &
-                             5.0 * rif1d(nzb+1) * ( zu(nzb+1) - z01d ) /     &
+                   IF ( a == 1.0_wp  .OR.  b == 1.0_wp )  THEN
+                      us1d = kappa * uv_total / (                              &
+                             LOG( zu(nzb+1) / z01d ) +                         &
+                             5.0_wp * rif1d(nzb+1) * ( zu(nzb+1) - z01d ) /    &
                                                   zu(nzb+1) )
                    ELSE
                       us1d = kappa * uv_total / (                              &
-                                 LOG( (1.0+b) / (1.0-b) * (1.0-a) / (1.0+a) ) +&
-                                 2.0 * ( ATAN( b ) - ATAN( a ) )               &
+                                 LOG( (1.0_wp+b) / (1.0_wp-b) * (1.0_wp-a) /   &
+                                      (1.0_wp+a) ) +                           &
+                                 2.0_wp * ( ATAN( b ) - ATAN( a ) )            &
                                                 )
                    ENDIF
@@ -584,7 +589,7 @@
 !--             compatibility with the 3D model.
                 IF ( ibc_e_b == 2 )  THEN
-                   e1d(nzb+1) = ( us1d / 0.1 )**2
-!                  e1d(nzb+1) = ( us1d / 0.4 )**2  !not used so far, see also
-                                                   !prandtl_fluxes
+                   e1d(nzb+1) = ( us1d / 0.1_wp )**2
+!                  e1d(nzb+1) = ( us1d / 0.4_wp )**2  !not used so far, see also
+                                                      !prandtl_fluxes
                 ENDIF
                 e1d(nzb) = e1d(nzb+1)
@@ -593,32 +598,35 @@
 !
 !--                Compute q* 
-                   IF ( rif1d(1) >= 0.0 )  THEN
+                   IF ( rif1d(1) >= 0.0_wp )  THEN
 !
 !--                Stable stratification
-                   qs1d = kappa * ( q_init(nzb+1) - q_init(nzb) ) /         &
-                          ( LOG( zu(nzb+1) / z0h1d ) + 5.0 * rif1d(nzb+1) * &
-                                          ( zu(nzb+1) - z0h1d ) / zu(nzb+1) &
+                   qs1d = kappa * ( q_init(nzb+1) - q_init(nzb) ) /            &
+                          ( LOG( zu(nzb+1) / z0h1d ) + 5.0_wp * rif1d(nzb+1) * &
+                                          ( zu(nzb+1) - z0h1d ) / zu(nzb+1)    &
                           )
                 ELSE
 !
 !--                Unstable stratification
-                   a = SQRT( 1.0 - 16.0 * rif1d(nzb+1) )
-                   b = SQRT( 1.0 - 16.0 * rif1d(nzb+1) / zu(nzb+1) * z0h1d )
+                   a = SQRT( 1.0_wp - 16.0_wp * rif1d(nzb+1) )
+                   b = SQRT( 1.0_wp - 16.0_wp * rif1d(nzb+1) /                 &
+                                      zu(nzb+1) * z0h1d )
 !
 !--                In the borderline case the formula for stable stratification 
 !--                must be applied, because otherwise a zero division would
 !--                occur in the argument of the logarithm.
-                   IF ( a == 1.0  .OR.  b == 1.0 )  THEN
+                   IF ( a == 1.0_wp  .OR.  b == 1.0_wp )  THEN
                       qs1d = kappa * ( q_init(nzb+1) - q_init(nzb) ) /         &
-                             ( LOG( zu(nzb+1) / z0h1d ) + 5.0 * rif1d(nzb+1) * &
-                                             ( zu(nzb+1) - z0h1d ) / zu(nzb+1) &
+                             ( LOG( zu(nzb+1) / z0h1d ) +                      &
+                               5.0_wp * rif1d(nzb+1) *                         &
+                               ( zu(nzb+1) - z0h1d ) / zu(nzb+1)               &
                              )
                    ELSE
-                      qs1d = kappa * ( q_init(nzb+1) - q_init(nzb) ) / &
-                             LOG( (a-1.0) / (a+1.0) * (b+1.0) / (b-1.0) )
+                      qs1d = kappa * ( q_init(nzb+1) - q_init(nzb) ) /         &
+                             LOG( (a-1.0_wp) / (a+1.0_wp) *                    &
+                                  (b+1.0_wp) / (b-1.0_wp) )
                    ENDIF
                 ENDIF                
                 ELSE
-                   qs1d = 0.0
+                   qs1d = 0.0_wp
                 ENDIF             
 
@@ -629,8 +637,9 @@
              IF ( mixing_length_1d == 'blackadar' )  THEN
                 DO  k = nzb+1, nzt
-                   IF ( rif1d(k) >= 0.0 )  THEN
-                      l1d(k) = l_black(k) / ( 1.0 + 5.0 * rif1d(k) )
+                   IF ( rif1d(k) >= 0.0_wp )  THEN
+                      l1d(k) = l_black(k) / ( 1.0_wp + 5.0_wp * rif1d(k) )
                    ELSE
-                      l1d(k) = l_black(k) * ( 1.0 - 16.0 * rif1d(k) )**0.25
+                      l1d(k) = l_black(k) *                                    &
+                               ( 1.0_wp - 16.0_wp * rif1d(k) )**0.25_wp
                    ENDIF
                    l1d(k) = l_black(k)
@@ -640,7 +649,7 @@
                 DO  k = nzb+1, nzt
                    dpt_dz = ( pt_init(k+1) - pt_init(k-1) ) * dd2zu(k)
-                   IF ( dpt_dz > 0.0 )  THEN
-                      l_stable = 0.76 * SQRT( e1d(k) ) / &
-                                     SQRT( g / pt_init(k) * dpt_dz ) + 1E-5
+                   IF ( dpt_dz > 0.0_wp )  THEN
+                      l_stable = 0.76_wp * SQRT( e1d(k) ) /                    &
+                                     SQRT( g / pt_init(k) * dpt_dz ) + 1E-5_wp
                    ELSE
                       l_stable = l_grid(k)
@@ -657,16 +666,16 @@
 !--          already been taken account of via the TKE (cf. also Diss.).
              IF ( prandtl_layer )  THEN
-                IF ( rif1d(nzb+1) >= 0.0 )  THEN
-                   km1d(nzb+1) = us1d * kappa * zu(nzb+1) / &
-                                 ( 1.0 + 5.0 * rif1d(nzb+1) )
-                ELSE
-                   km1d(nzb+1) = us1d * kappa * zu(nzb+1) * &
-                                 ( 1.0 - 16.0 * rif1d(nzb+1) )**0.25
+                IF ( rif1d(nzb+1) >= 0.0_wp )  THEN
+                   km1d(nzb+1) = us1d * kappa * zu(nzb+1) /                    &
+                                 ( 1.0_wp + 5.0_wp * rif1d(nzb+1) )
+                ELSE
+                   km1d(nzb+1) = us1d * kappa * zu(nzb+1) *                    &
+                                 ( 1.0_wp - 16.0_wp * rif1d(nzb+1) )**0.25_wp
                 ENDIF
              ENDIF
              DO  k = nzb_diff, nzt
 !                km1d(k) = 0.4 * SQRT( e1d(k) ) !changed: adjustment to 3D-model
-                km1d(k) = 0.1 * SQRT( e1d(k) )
-                IF ( rif1d(k) >= 0.0 )  THEN
+                km1d(k) = 0.1_wp * SQRT( e1d(k) )
+                IF ( rif1d(k) >= 0.0_wp )  THEN
                    km1d(k) = km1d(k) * l1d(k)
                 ELSE
@@ -678,5 +687,5 @@
 !--          Add damping layer
              DO  k = damp_level_ind_1d+1, nzt+1
-                km1d(k) = 1.1 * km1d(k-1)
+                km1d(k) = 1.1_wp * km1d(k-1)
                 km1d(k) = MIN( km1d(k), 10.0_wp )
              ENDDO
@@ -686,8 +695,8 @@
 !--          kh = phim / phih * km
              DO  k = nzb+1, nzt
-                IF ( rif1d(k) >= 0.0 )  THEN
+                IF ( rif1d(k) >= 0.0_wp )  THEN
                    kh1d(k) = km1d(k)
                 ELSE
-                   kh1d(k) = km1d(k) * ( 1.0 - 16.0 * rif1d(k) )**0.25
+                   kh1d(k) = km1d(k) * ( 1.0_wp - 16.0_wp * rif1d(k) )**0.25_wp
                 ENDIF
              ENDDO
@@ -778,20 +787,20 @@
 !--    Compute control quantities
 !--    grid level nzp is excluded due to mirror boundary condition
-       umax = 0.0; vmax = 0.0; energy = 0.0
+       umax = 0.0_wp; vmax = 0.0_wp; energy = 0.0_wp
        DO  k = nzb+1, nzt+1
           umax = MAX( ABS( umax ), ABS( u1d(k) ) )
           vmax = MAX( ABS( vmax ), ABS( v1d(k) ) )
-          energy = energy + 0.5 * ( u1d(k)**2 + v1d(k)**2 )
+          energy = energy + 0.5_wp * ( u1d(k)**2 + v1d(k)**2 )
        ENDDO
        energy = energy / REAL( nzt - nzb + 1, KIND=wp )
 
        uv_total = SQRT( u1d(nzb+1)**2 + v1d(nzb+1)**2 )
-       IF ( ABS( v1d(nzb+1) ) .LT. 1.0E-5 )  THEN
+       IF ( ABS( v1d(nzb+1) ) .LT. 1.0E-5_wp )  THEN
           alpha = ACOS( SIGN( 1.0_wp , u1d(nzb+1) ) )
        ELSE
           alpha = ACOS( u1d(nzb+1) / uv_total )
-          IF ( v1d(nzb+1) <= 0.0 )  alpha = 2.0 * pi - alpha
+          IF ( v1d(nzb+1) <= 0.0_wp )  alpha = 2.0_wp * pi - alpha
        ENDIF
-       alpha = alpha / ( 2.0 * pi ) * 360.0
+       alpha = alpha / ( 2.0_wp * pi ) * 360.0_wp
 
        WRITE ( 15, 101 )  current_timestep_number_1d, simulated_time_chr, &
@@ -853,16 +862,16 @@
 !-- Compute the currently feasible time step according to the diffusion
 !-- criterion. At nzb+1 the half grid length is used.
-    fac = 0.35
+    fac = 0.35_wp
     dt_diff = dt_max_1d
     DO  k = nzb+2, nzt
-       value   = fac * dzu(k) * dzu(k) / ( km1d(k) + 1E-20 )
+       value   = fac * dzu(k) * dzu(k) / ( km1d(k) + 1E-20_wp )
        dt_diff = MIN( value, dt_diff )
     ENDDO
-    value   = fac * zu(nzb+1) * zu(nzb+1) / ( km1d(nzb+1) + 1E-20 )
+    value   = fac * zu(nzb+1) * zu(nzb+1) / ( km1d(nzb+1) + 1E-20_wp )
     dt_1d = MIN( value, dt_diff )
 
 !
 !-- Set flag when the time step becomes too small
-    IF ( dt_1d < ( 0.00001 * dt_max_1d ) )  THEN
+    IF ( dt_1d < ( 0.00001_wp * dt_max_1d ) )  THEN
        stop_dt_1d = .TRUE.
 
@@ -876,9 +885,9 @@
 !-- A more or less simple new time step value is obtained taking only the
 !-- first two significant digits
-    div = 1000.0
+    div = 1000.0_wp
     DO  WHILE ( dt_1d < div )
-       div = div / 10.0
+       div = div / 10.0_wp
     ENDDO
-    dt_1d = NINT( dt_1d * 100.0 / div ) * div / 100.0
+    dt_1d = NINT( dt_1d * 100.0_wp / div ) * div / 100.0_wp
 
     old_dt_1d = dt_1d
Index: /palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_3d_model.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_3d_model.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! REAL constants provided with KIND-attribute 
 ! 
 ! Former revisions:
@@ -616,5 +616,5 @@
                 ENDDO
              ENDDO
-             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  &
+             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.              &
                   precipitation )  THEN
                 DO  i = nxlg, nxrg
@@ -673,5 +673,5 @@
           IF ( humidity  .OR.  passive_scalar )  THEN
              qs = 0.0_wp
-             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  &
+             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.              &
                   precipitation )  THEN
                 qrs = 0.0_wp
Index: /palm/trunk/SOURCE/init_advec.f90
===================================================================
--- /palm/trunk/SOURCE/init_advec.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_advec.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute 
 ! 
 ! Former revisions:
@@ -93,19 +93,19 @@
 
        delt  = 1.0_wp / REAL( intervals, KIND=wp )
-       sterm = delt * 0.5
+       sterm = delt * 0.5_wp
 
        DO  i = 1, intervals
 
-          IF ( sterm > 0.5 )  THEN
-             dn = -5.0
+          IF ( sterm > 0.5_wp )  THEN
+             dn = -5.0_wp
           ELSE
-             dn = 5.0
+             dn = 5.0_wp
           ENDIF
 
           DO  j = 1, 15
-             ex1 = dn * EXP( -dn ) - EXP( 0.5 * dn ) + EXP( -0.5 * dn )
+             ex1 = dn * EXP( -dn ) - EXP( 0.5_wp * dn ) + EXP( -0.5_wp * dn )
              ex2 = EXP( dn ) - EXP( -dn )
-             ex3 = EXP( -dn ) * ( 1.0 - dn ) - 0.5 * EXP(  0.5 * dn ) &
-                                             - 0.5 * EXP( -0.5 * dn )
+             ex3 = EXP( -dn ) * ( 1.0_wp - dn ) - 0.5_wp * EXP(  0.5_wp * dn ) &
+                                                - 0.5_wp * EXP( -0.5_wp * dn )
              ex4 = EXP( dn ) + EXP( -dn )
              ex5 = dn * sterm + ex1 / ex2
@@ -115,12 +115,12 @@
           ENDDO
 
-          IF ( sterm < 0.5 )  dn = MAX(  2.95E-2_wp, dn )
-          IF ( sterm > 0.5 )  dn = MIN( -2.95E-2_wp, dn )
+          IF ( sterm < 0.5_wp )  dn = MAX(  2.95E-2_wp, dn )
+          IF ( sterm > 0.5_wp )  dn = MIN( -2.95E-2_wp, dn )
           ex1 = EXP( -dn )
           ex2 = EXP( dn ) - ex1
           aex(i) = -ex1 / ex2
-          bex(i) = 1.0 / ex2
+          bex(i) = 1.0_wp / ex2
           dex(i) = dn
-          eex(i) = EXP( dex(i) * 0.5 )
+          eex(i) = EXP( dex(i) * 0.5_wp )
           sterm = sterm + delt
 
Index: /palm/trunk/SOURCE/init_cloud_physics.f90
===================================================================
--- /palm/trunk/SOURCE/init_cloud_physics.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_cloud_physics.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -93,5 +93,5 @@
     REAL(wp) ::  t_surface  !:
 
-    ALLOCATE( hyp(nzb:nzt+1), pt_d_t(nzb:nzt+1), t_d_pt(nzb:nzt+1),  &
+    ALLOCATE( hyp(nzb:nzt+1), pt_d_t(nzb:nzt+1), t_d_pt(nzb:nzt+1),            &
               hyrho(nzb:nzt+1) )
 
@@ -104,16 +104,16 @@
     schmidt_p_1d3 = schmidt**( 1.0_wp / 3.0_wp )
 
-    pirho_l  = pi * rho_l / 6.0
-    dpirho_l = 1.0 / pirho_l 
+    pirho_l  = pi * rho_l / 6.0_wp
+    dpirho_l = 1.0_wp / pirho_l 
 !
 !-- Calculate timestep according to precipitation
     IF ( icloud_scheme == 0  .AND.  precipitation )  THEN
-       dt_precipitation = c_sedimentation * MINVAL( dzu(nzb+2:nzt) ) /        &
+       dt_precipitation = c_sedimentation * MINVAL( dzu(nzb+2:nzt) ) /         &
                           w_precipitation
     ENDIF
 !
 !-- Calculate factor used in equation for droplet growth by condensation
-    bfactor = 3.0 * vanthoff * mass_of_solute * molecular_weight_of_water &
-              / ( 4.0 * pi * rho_l * molecular_weight_of_solute )
+    bfactor = 3.0_wp * vanthoff * mass_of_solute * molecular_weight_of_water   &
+              / ( 4.0_wp * pi * rho_l * molecular_weight_of_solute )
 !
 !-- Calculate:
@@ -121,17 +121,17 @@
 !-- t / pt : ratio of actual and potential temperature (t_d_pt)
 !-- p_0(z) : vertical profile of the hydrostatic pressure (hyp)
-    t_surface = pt_surface * ( surface_pressure / 1000.0 )**0.286_wp
+    t_surface = pt_surface * ( surface_pressure / 1000.0_wp )**0.286_wp
     DO  k = nzb, nzt+1
 !
 !--    Check temperature in case of too large domain height
-       IF ( ( t_surface - g/cp * zu(k) ) < 0.0 )  THEN
+       IF ( ( t_surface - g/cp * zu(k) ) < 0.0_wp )  THEN
           WRITE( message_string, * )  'absolute temperature < 0.0 at zu(', k, &
                                       ') = ', zu(k)
           CALL message( 'init_cloud_physics', 'PA0142', 1, 2, 0, 6, 0 )
        ENDIF
-       hyp(k)    = surface_pressure * 100.0 * &
+       hyp(k)    = surface_pressure * 100.0_wp * &
                    ( (t_surface - g/cp * zu(k)) / t_surface )**(1.0_wp/0.286_wp)
-       pt_d_t(k) = ( 100000.0 / hyp(k) )**0.286_wp
-       t_d_pt(k) = 1.0 / pt_d_t(k)
+       pt_d_t(k) = ( 100000.0_wp / hyp(k) )**0.286_wp
+       t_d_pt(k) = 1.0_wp / pt_d_t(k)
        hyrho(k)  = hyp(k) / ( r_d * t_d_pt(k) * pt_init(k) )       
     ENDDO
@@ -139,5 +139,5 @@
 !
 !-- Compute reference density
-    rho_surface = surface_pressure * 100.0 / ( r_d * t_surface )
+    rho_surface = surface_pressure * 100.0_wp / ( r_d * t_surface )
 
 
Index: /palm/trunk/SOURCE/init_dvrp.f90
===================================================================
--- /palm/trunk/SOURCE/init_dvrp.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_dvrp.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -131,8 +131,8 @@
 !
 !-- Set clipping to default (total domain), if not set by user
-    IF ( clip_dvrp_l == 9999999.9 )  clip_dvrp_l = 0.0
-    IF ( clip_dvrp_r == 9999999.9 )  clip_dvrp_r = ( nx + 1 ) * dx
-    IF ( clip_dvrp_s == 9999999.9 )  clip_dvrp_s = 0.0
-    IF ( clip_dvrp_n == 9999999.9 )  clip_dvrp_n = ( ny + 1 ) * dy
+    IF ( clip_dvrp_l == 9999999.9_wp )  clip_dvrp_l = 0.0_wp
+    IF ( clip_dvrp_r == 9999999.9_wp )  clip_dvrp_r = ( nx + 1 ) * dx
+    IF ( clip_dvrp_s == 9999999.9_wp )  clip_dvrp_s = 0.0_wp
+    IF ( clip_dvrp_n == 9999999.9_wp )  clip_dvrp_n = ( ny + 1 ) * dy
 
 !
@@ -256,10 +256,12 @@
 !
 !--       Compute center of domain and distance of camera from center
-          center(1) = ( clip_dvrp_l + clip_dvrp_r ) * 0.5 * superelevation_x
-          center(2) = ( clip_dvrp_s + clip_dvrp_n ) * 0.5 * superelevation_y
-          center(3) = ( zu(nz_do3d) - zu(nzb) ) * 0.5 * superelevation
-          distance  = 1.5 * MAX( (clip_dvrp_r-clip_dvrp_l) * superelevation_x, &
-                                 (clip_dvrp_n-clip_dvrp_s) * superelevation_y, &
-	                         ( zu(nz_do3d) - zu(nzb) ) * superelevation )
+          center(1) = ( clip_dvrp_l + clip_dvrp_r ) * 0.5_wp * superelevation_x
+          center(2) = ( clip_dvrp_s + clip_dvrp_n ) * 0.5_wp * superelevation_y
+          center(3) = ( zu(nz_do3d) - zu(nzb) ) * 0.5_wp * superelevation
+          distance  = 1.5_wp * MAX(                                            &
+                           (clip_dvrp_r-clip_dvrp_l) * superelevation_x,       &
+                           (clip_dvrp_n-clip_dvrp_s) * superelevation_y,       &
+	                        ( zu(nz_do3d) - zu(nzb) ) * superelevation          &
+	                               )
 
 !
@@ -302,11 +304,11 @@
 !
 !--       Define bounding box material and create a bounding box
-          tmp_r = 0.5;  tmp_g = 0.5;  tmp_b = 0.5;  tmp_t = 0.0
+          tmp_r = 0.5_wp;  tmp_g = 0.5_wp;  tmp_b = 0.5_wp;  tmp_t = 0.0_wp
           CALL DVRP_MATERIAL_RGB( m-1, 1, tmp_r, tmp_g, tmp_b, tmp_t )
 
-          tmp_1 = 0.01;
+          tmp_1 = 0.01_wp;
           tmp_2 = clip_dvrp_l * superelevation_x
           tmp_3 = clip_dvrp_s * superelevation_y
-          tmp_4 = 0.0
+          tmp_4 = 0.0_wp
           tmp_5 = (clip_dvrp_r+dx) * superelevation_x
           tmp_6 = (clip_dvrp_n+dy) * superelevation_y
@@ -386,5 +388,5 @@
              tmp_g = topography_color(2)
              tmp_b = topography_color(3)
-             tmp_t = 0.0
+             tmp_t = 0.0_wp
              CALL DVRP_MATERIAL_RGB( m-1, 1, tmp_r, tmp_g, tmp_b, tmp_t )
 
@@ -393,10 +395,10 @@
              ALLOCATE( local_pf(nxl_dvrp:nxr_dvrp+1,nys_dvrp:nyn_dvrp+1, &
                                 nzb:nz_do3d) )
-             local_pf = 0.0
+             local_pf = 0.0_wp
              IF ( dvrp_overlap )  THEN
                 DO  i = nxl_dvrp, nxr_dvrp+1
                    DO  j = nys_dvrp, nyn_dvrp+1
                       IF ( nzb_s_inner(j,i) > 0 )  THEN
-                         local_pf(i,j,nzb:nzb_s_inner(j,i)) = 1.0
+                         local_pf(i,j,nzb:nzb_s_inner(j,i)) = 1.0_wp
                       ENDIF
                    ENDDO
@@ -407,5 +409,5 @@
                              cyclic_dvrp, cyclic_dvrp, cyclic_dvrp )
 
-             tmp_th = 1.0
+             tmp_th = 1.0_wp
              CALL DVRP_THRESHOLD( m-1, tmp_th )
 
@@ -428,5 +430,5 @@
 !--             ATTENTION: A seperate procedure for setting cluster_alpha will
 !--                        be in the next version of libDVRP (Feb 09)
-                cluster_alpha = 38.0
+                cluster_alpha = 38.0_wp
                 CALL DVRP_THRESHOLD( -(m-1)-1, cluster_alpha )
 
@@ -512,5 +514,5 @@
           tmp_g = groundplate_color(2)
           tmp_b = groundplate_color(3)
-          tmp_t = 0.0
+          tmp_t = 0.0_wp
           CALL DVRP_MATERIAL_RGB( m-1, 1, tmp_r, tmp_g, tmp_b, tmp_t )
 
@@ -519,10 +521,10 @@
           ALLOCATE( local_pf(nxl_dvrp:nxr_dvrp+1,nys_dvrp:nyn_dvrp+1, &
                              nzb:nz_do3d) )
-          local_pf = 0.0
-          IF (dvrp_overlap )  local_pf(:,:,0) = 1.0
+          local_pf = 0.0_wp
+          IF (dvrp_overlap )  local_pf(:,:,0) = 1.0_wp
 
           CALL DVRP_DATA( m-1, local_pf, 1, nx_dvrp, ny_dvrp, nz_dvrp, &
                           cyclic_dvrp, cyclic_dvrp, cyclic_dvrp )
-          tmp_th = 1.0
+          tmp_th = 1.0_wp
           CALL DVRP_THRESHOLD( m-1, tmp_th )
 
@@ -543,5 +545,5 @@
 !--       ATTENTION: A seperate procedure for setting cluster_alpha will be in
 !--                  the next version of libDVRP (Feb 09)
-          cluster_alpha = 38.0
+          cluster_alpha = 38.0_wp
           CALL DVRP_THRESHOLD( -(m-1)-1, cluster_alpha )
 
@@ -581,9 +583,9 @@
 
                 IF ( do3d(0,vn)(1:1) == 'w' )  THEN
-                   steering_dvrp(pn)%min  = -4.0
-                   steering_dvrp(pn)%max  =  5.0
+                   steering_dvrp(pn)%min  = -4.0_wp
+                   steering_dvrp(pn)%max  =  5.0_wp
                 ELSE
-                   steering_dvrp(pn)%min  = 288.0
-                   steering_dvrp(pn)%max  = 292.0
+                   steering_dvrp(pn)%min  = 288.0_wp
+                   steering_dvrp(pn)%max  = 292.0_wp
                 ENDIF
 
@@ -690,6 +692,6 @@
        IF ( mode_dvrp(m) == 'pathlines' )  THEN
 
-          tmp_x1 = 0.0;  tmp_y1 = 0.0;  tmp_z1 = 0.0
-          tmp_x2 = 1.0;  tmp_y2 = 1.0;  tmp_z2 = 0.3
+          tmp_x1 = 0.0_wp;  tmp_y1 = 0.0_wp;  tmp_z1 = 0.0_wp
+          tmp_x2 = 1.0_wp;  tmp_y2 = 1.0_wp;  tmp_z2 = 0.3_wp
           CALL DVRP_CUBIC_SEEDING( m-1, tmp_x1, tmp_y1, tmp_z1, tmp_x2, tmp_y2,&
                                    tmp_z2, pathlines_linecount, 2, 0 )
@@ -703,5 +705,5 @@
 !--       Set pathline length
           CALL DVRP_PATHLINES_SETMAXHISTORY( m-1, pathlines_maxhistory )
-          CALL DVRP_PATHLINES_SETFADING( m-1, 1, 0.0 )
+          CALL DVRP_PATHLINES_SETFADING( m-1, 1, 0.0_wp )
 
           CALL DVRP_INIT_PATHLINES( m-1, 0 )
@@ -823,5 +825,5 @@
 !
 !-- If required, close dvrp-software and logging of dvrp-calls
-    IF ( dt_dvrp /= 9999999.9 )  THEN
+    IF ( dt_dvrp /= 9999999.9_wp )  THEN
        m = 1
        DO WHILE ( mode_dvrp(m) /= ' ' )
Index: /palm/trunk/SOURCE/init_grid.f90
===================================================================
--- /palm/trunk/SOURCE/init_grid.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_grid.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -105,5 +105,5 @@
                f2_mg, f3_mg, l_grid, l_wall, zu, zw
         
-    USE control_parameters,                                                             &
+    USE control_parameters,                                                    &
         ONLY:  bc_lr, bc_ns, building_height, building_length_x,               &
                building_length_y, building_wall_left, building_wall_south,     &
@@ -201,13 +201,13 @@
 !
 !-- Allocate grid arrays
-    ALLOCATE( ddzu(1:nzt+1), ddzw(1:nzt+1), dd2zu(1:nzt), dzu(1:nzt+1), &
+    ALLOCATE( ddzu(1:nzt+1), ddzw(1:nzt+1), dd2zu(1:nzt), dzu(1:nzt+1),        &
               dzw(1:nzt+1), l_grid(1:nzt), zu(nzb:nzt+1), zw(nzb:nzt+1) )
 
 !
 !-- Compute height of u-levels from constant grid length and dz stretch factors
-    IF ( dz == -1.0 )  THEN
+    IF ( dz == -1.0_wp )  THEN
        message_string = 'missing dz'
        CALL message( 'init_grid', 'PA0200', 1, 2, 0, 6, 0 ) 
-    ELSEIF ( dz <= 0.0 )  THEN
+    ELSEIF ( dz <= 0.0_wp )  THEN
        WRITE( message_string, * ) 'dz=',dz,' <= 0.0'
        CALL message( 'init_grid', 'PA0201', 1, 2, 0, 6, 0 )
@@ -223,10 +223,10 @@
 
        IF ( ibc_uv_b == 0 .OR. ibc_uv_b == 2 ) THEN
-          zu(0) = 0.0
-      !    zu(0) = - dz * 0.5
+          zu(0) = 0.0_wp
+      !    zu(0) = - dz * 0.5_wp
        ELSE
-          zu(0) = - dz * 0.5
+          zu(0) = - dz * 0.5_wp
        ENDIF
-       zu(1) =   dz * 0.5
+       zu(1) =   dz * 0.5_wp
 
        dz_stretch_level_index = nzt+1
@@ -246,9 +246,9 @@
 !--    ground the first u- and w-level (k=0) are defined at same height (z=0). 
 !--    The top w-level is extrapolated linearly.
-       zw(0) = 0.0
+       zw(0) = 0.0_wp
        DO  k = 1, nzt
-          zw(k) = ( zu(k) + zu(k+1) ) * 0.5
-       ENDDO
-       zw(nzt+1) = zw(nzt) + 2.0 * ( zu(nzt+1) - zw(nzt) )
+          zw(k) = ( zu(k) + zu(k+1) ) * 0.5_wp
+       ENDDO
+       zw(nzt+1) = zw(nzt) + 2.0_wp * ( zu(nzt+1) - zw(nzt) )
 
     ELSE
@@ -259,6 +259,6 @@
 !--    w-level are defined at same height, but staggered from the second level.
 !--    The second u-level (k=1) corresponds to the top of the Prandtl-layer.
-       zu(nzt+1) =   dz * 0.5
-       zu(nzt)   = - dz * 0.5
+       zu(nzt+1) =   dz * 0.5_wp
+       zu(nzt)   = - dz * 0.5_wp
 
        dz_stretch_level_index = 0
@@ -281,7 +281,7 @@
 !--    consistency, since w and all scalar variables are defined up tp nzt+1.
        zw(nzt+1) = dz
-       zw(nzt)   = 0.0
+       zw(nzt)   = 0.0_wp
        DO  k = 0, nzt
-          zw(k) = ( zu(k) + zu(k+1) ) * 0.5
+          zw(k) = ( zu(k) + zu(k+1) ) * 0.5_wp
        ENDDO
 
@@ -299,11 +299,11 @@
     DO  k = 1, nzt+1
        dzu(k)  = zu(k) - zu(k-1)
-       ddzu(k) = 1.0 / dzu(k)
+       ddzu(k) = 1.0_wp / dzu(k)
        dzw(k)  = zw(k) - zw(k-1)
-       ddzw(k) = 1.0 / dzw(k)
+       ddzw(k) = 1.0_wp / dzw(k)
     ENDDO
 
     DO  k = 1, nzt
-       dd2zu(k) = 1.0 / ( dzu(k) + dzu(k+1) )
+       dd2zu(k) = 1.0_wp / ( dzu(k) + dzu(k+1) )
     ENDDO
     
@@ -340,6 +340,6 @@
        nzt_l = nzt
        DO  l = maximum_grid_level-1, 1, -1
-           dzu_mg(nzb+1,l) = 2.0 * dzu_mg(nzb+1,l+1)
-           dzw_mg(nzb+1,l) = 2.0 * dzw_mg(nzb+1,l+1)
+           dzu_mg(nzb+1,l) = 2.0_wp * dzu_mg(nzb+1,l+1)
+           dzw_mg(nzb+1,l) = 2.0_wp * dzw_mg(nzb+1,l+1)
            nzt_l = nzt_l / 2
            DO  k = 2, nzt_l+1
@@ -353,15 +353,15 @@
        dy_l  = dy
        DO  l = maximum_grid_level, 1, -1
-          ddx2_mg(l) = 1.0 / dx_l**2
-          ddy2_mg(l) = 1.0 / dy_l**2
+          ddx2_mg(l) = 1.0_wp / dx_l**2
+          ddy2_mg(l) = 1.0_wp / dy_l**2
           DO  k = nzb+1, nzt_l
-             f2_mg(k,l) = 1.0 / ( dzu_mg(k+1,l) * dzw_mg(k,l) )
-             f3_mg(k,l) = 1.0 / ( dzu_mg(k,l)   * dzw_mg(k,l) )
-             f1_mg(k,l) = 2.0 * ( ddx2_mg(l) + ddy2_mg(l) ) + &
+             f2_mg(k,l) = 1.0_wp / ( dzu_mg(k+1,l) * dzw_mg(k,l) )
+             f3_mg(k,l) = 1.0_wp / ( dzu_mg(k,l)   * dzw_mg(k,l) )
+             f1_mg(k,l) = 2.0_wp * ( ddx2_mg(l) + ddy2_mg(l) ) + &
                           f2_mg(k,l) + f3_mg(k,l)
           ENDDO
           nzt_l = nzt_l / 2
-          dx_l  = dx_l * 2.0
-          dy_l  = dy_l * 2.0
+          dx_l  = dx_l * 2.0_wp
+          dy_l  = dy_l * 2.0_wp
        ENDDO
 
@@ -370,10 +370,10 @@
 !
 !-- Compute the reciprocal values of the horizontal grid lengths.
-    ddx = 1.0 / dx
-    ddy = 1.0 / dy
+    ddx = 1.0_wp / dx
+    ddy = 1.0_wp / dy
     dx2 = dx * dx
     dy2 = dy * dy
-    ddx2 = 1.0 / dx2
-    ddy2 = 1.0 / dy2
+    ddx2 = 1.0_wp / dx2
+    ddy2 = 1.0_wp / dy2
 
 !
@@ -433,6 +433,6 @@
     nzb_w_inner = nzb;  nzb_w_outer = nzb
 
-    rflags_s_inner = 1.0
-    rflags_invers  = 1.0
+    rflags_s_inner = 1.0_wp
+    rflags_invers  = 1.0_wp
 
 !
@@ -453,8 +453,8 @@
     nzb_diff_u = nzb_diff;  nzb_diff_v = nzb_diff
 
-    wall_e_x = 0.0;  wall_e_y = 0.0;  wall_u = 0.0;  wall_v = 0.0
-    wall_w_x = 0.0;  wall_w_y = 0.0
-    fwxp = 1.0;  fwxm = 1.0;  fwyp = 1.0;  fwym = 1.0
-    fxp  = 1.0;  fxm  = 1.0;  fyp  = 1.0;  fym  = 1.0
+    wall_e_x = 0.0_wp;  wall_e_y = 0.0_wp;  wall_u = 0.0_wp;  wall_v = 0.0_wp
+    wall_w_x = 0.0_wp;  wall_w_y = 0.0_wp
+    fwxp = 1.0_wp;  fwxm = 1.0_wp;  fwyp = 1.0_wp;  fwym = 1.0_wp
+    fxp  = 1.0_wp;  fxm  = 1.0_wp;  fyp  = 1.0_wp;  fym  = 1.0_wp
 
 !
@@ -471,10 +471,10 @@
     DO  k = 1, nzt
        vertical_influence(k) = MIN ( INT( l_grid(k) / &
-                     ( wall_adjustment_factor * dzw(k) ) + 0.5 ), nzt - k )
+                     ( wall_adjustment_factor * dzw(k) ) + 0.5_wp ), nzt - k )
     ENDDO
 
     DO  k = 1, MAXVAL( nzb_s_inner )
-       IF ( l_grid(k) > 1.5 * dx * wall_adjustment_factor .OR.  &
-            l_grid(k) > 1.5 * dy * wall_adjustment_factor )  THEN
+       IF ( l_grid(k) > 1.5_wp * dx * wall_adjustment_factor .OR.  &
+            l_grid(k) > 1.5_wp * dy * wall_adjustment_factor )  THEN
           WRITE( message_string, * ) 'grid anisotropy exceeds ', &
                                      'threshold given by only local', &
@@ -582,26 +582,26 @@
 !--       Street canyon size has to meet some requirements
           IF ( canyon_width_x /= 9999999.9_wp )  THEN
-             IF ( ( cxl < 1 ) .OR. ( cxr > nx-1 ) .OR. ( cwx < 3 ) .OR.  &
+             IF ( ( cxl < 1 ) .OR. ( cxr > nx-1 ) .OR. ( cwx < 3 ) .OR.        &
                ( ch < 3 ) )  THEN
-                WRITE( message_string, * ) 'inconsistent canyon parameters:', &
-                                           '&cxl=', cxl, 'cxr=', cxr,         &
-                                           'cwx=', cwx,                       &
+                WRITE( message_string, * ) 'inconsistent canyon parameters:',  &
+                                           '&cxl=', cxl, 'cxr=', cxr,          &
+                                           'cwx=', cwx,                        &
                                            'ch=', ch, 'nx=', nx, 'ny=', ny
                 CALL message( 'init_grid', 'PA0205', 1, 2, 0, 6, 0 ) 
              ENDIF
           ELSEIF ( canyon_width_y /= 9999999.9_wp )  THEN
-             IF ( ( cys < 1 ) .OR. ( cyn > ny-1 ) .OR. ( cwy < 3 ) .OR.  &
+             IF ( ( cys < 1 ) .OR. ( cyn > ny-1 ) .OR. ( cwy < 3 ) .OR.        &
                ( ch < 3 ) )  THEN
-                WRITE( message_string, * ) 'inconsistent canyon parameters:', &
-                                           '&cys=', cys, 'cyn=', cyn,         &
-                                           'cwy=', cwy,                       &
+                WRITE( message_string, * ) 'inconsistent canyon parameters:',  &
+                                           '&cys=', cys, 'cyn=', cyn,          &
+                                           'cwy=', cwy,                        &
                                            'ch=', ch, 'nx=', nx, 'ny=', ny
                 CALL message( 'init_grid', 'PA0206', 1, 2, 0, 6, 0 ) 
              ENDIF
           ENDIF
-          IF ( canyon_width_x /= 9999999.9_wp .AND. canyon_width_y /= 9999999.9_wp ) &
-               THEN
-             message_string = 'inconsistent canyon parameters:' //     &  
-                              '&street canyon can only be oriented' // &
+          IF ( canyon_width_x /= 9999999.9_wp .AND.                            &                 
+               canyon_width_y /= 9999999.9_wp )  THEN
+             message_string = 'inconsistent canyon parameters:' //             &   
+                              '&street canyon can only be oriented' //         &
                               '&either in x- or in y-direction'
              CALL message( 'init_grid', 'PA0207', 1, 2, 0, 6, 0 )
@@ -679,5 +679,5 @@
 !-- scheme have to be reduced up to nzt (required at the lateral boundaries).
     nzb_max = MAXVAL( nzb_local )
-    IF ( inflow_l .OR. outflow_l .OR. inflow_r .OR. outflow_r .OR.    &
+    IF ( inflow_l .OR. outflow_l .OR. inflow_r .OR. outflow_r .OR.             &
          inflow_n .OR. outflow_n .OR. inflow_s .OR. outflow_s )  THEN
          nzb_max = nzt
@@ -693,7 +693,7 @@
 !--    Consistency checks
        IF ( MINVAL( nzb_local ) < 0  .OR.  MAXVAL( nzb_local ) > nz + 1 )  THEN
-          WRITE( message_string, * ) 'nzb_local values are outside the',      &
-                                'model domain',                               &
-                                '&MINVAL( nzb_local ) = ', MINVAL(nzb_local), &
+          WRITE( message_string, * ) 'nzb_local values are outside the',       &
+                                'model domain',                                &
+                                '&MINVAL( nzb_local ) = ', MINVAL(nzb_local),  &
                                 '&MAXVAL( nzb_local ) = ', MAXVAL(nzb_local)
           CALL message( 'init_grid', 'PA0210', 1, 2, 0, 6, 0 )
@@ -701,7 +701,7 @@
 
        IF ( bc_lr == 'cyclic' )  THEN
-          IF ( ANY( nzb_local(:,-1) /= nzb_local(:,nx)   )  .OR. &
+          IF ( ANY( nzb_local(:,-1) /= nzb_local(:,nx)   )  .OR.               &
                ANY( nzb_local(:,0)  /= nzb_local(:,nx+1) ) )  THEN
-             message_string = 'nzb_local does not fulfill cyclic' // &
+             message_string = 'nzb_local does not fulfill cyclic' //           &
                               ' boundary condition in x-direction'
              CALL message( 'init_grid', 'PA0211', 1, 2, 0, 6, 0 )
@@ -709,7 +709,7 @@
        ENDIF
        IF ( bc_ns == 'cyclic' )  THEN
-          IF ( ANY( nzb_local(-1,:) /= nzb_local(ny,:)   )  .OR. &
+          IF ( ANY( nzb_local(-1,:) /= nzb_local(ny,:)   )  .OR.               &
                ANY( nzb_local(0,:)  /= nzb_local(ny+1,:) ) )  THEN
-             message_string = 'nzb_local does not fulfill cyclic' // &
+             message_string = 'nzb_local does not fulfill cyclic' //           &
                               ' boundary condition in y-direction'
              CALL message( 'init_grid', 'PA0212', 1, 2, 0, 6, 0 )
@@ -770,5 +770,5 @@
        DO  j = -1, ny + 1
           DO  i = 0, nx
-             nzb_tmp(j,i) = MAX( nzb_local(j,i-1), nzb_local(j,i), &
+             nzb_tmp(j,i) = MAX( nzb_local(j,i-1), nzb_local(j,i),             &
                                  nzb_local(j,i+1) )
           ENDDO
@@ -776,5 +776,5 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
-             nzb_s_outer(j,i) = MAX( nzb_tmp(j-1,i), nzb_tmp(j,i), &
+             nzb_s_outer(j,i) = MAX( nzb_tmp(j-1,i), nzb_tmp(j,i),             &
                                      nzb_tmp(j+1,i) )
           ENDDO
@@ -812,5 +812,5 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
-             nzb_u_outer(j,i) = MAX( nzb_tmp(j-1,i), nzb_tmp(j,i), &
+             nzb_u_outer(j,i) = MAX( nzb_tmp(j-1,i), nzb_tmp(j,i),             &
                                      nzb_tmp(j+1,i) )
           ENDDO
@@ -844,5 +844,5 @@
        DO  j = nys, nyn
           DO  i = nxl, nxr
-             nzb_v_outer(j,i) = MAX( nzb_tmp(j,i-1), nzb_tmp(j,i), &
+             nzb_v_outer(j,i) = MAX( nzb_tmp(j,i-1), nzb_tmp(j,i),             &
                                      nzb_tmp(j,i+1) )
           ENDDO
@@ -891,6 +891,6 @@
           DO  j = nysg, nyng
              DO  k = nzb, nzt+1
-                IF ( k <= nzb_s_inner(j,i) )  rflags_s_inner(k,j,i) = 0.0
-                IF ( k <= nzb_s_inner(j,i) )  rflags_invers(j,i,k)  = 0.0
+                IF ( k <= nzb_s_inner(j,i) )  rflags_s_inner(k,j,i) = 0.0_wp
+                IF ( k <= nzb_s_inner(j,i) )  rflags_invers(j,i,k)  = 0.0_wp
              ENDDO
           ENDDO
@@ -938,22 +938,22 @@
 !--       u-component
           IF ( nzb_u_outer(j,i) > nzb_u_outer(j+1,i) )  THEN
-             wall_u(j,i) = 1.0   ! north wall (location of adjacent fluid)
-             fym(j,i)    = 0.0
-             fyp(j,i)    = 1.0
+             wall_u(j,i) = 1.0_wp   ! north wall (location of adjacent fluid)
+             fym(j,i)    = 0.0_wp
+             fyp(j,i)    = 1.0_wp
           ELSEIF ( nzb_u_outer(j,i) > nzb_u_outer(j-1,i) )  THEN
-             wall_u(j,i) = 1.0   ! south wall (location of adjacent fluid)
-             fym(j,i)    = 1.0
-             fyp(j,i)    = 0.0
+             wall_u(j,i) = 1.0_wp   ! south wall (location of adjacent fluid)
+             fym(j,i)    = 1.0_wp
+             fyp(j,i)    = 0.0_wp
           ENDIF
 !
 !--       v-component
           IF ( nzb_v_outer(j,i) > nzb_v_outer(j,i+1) )  THEN
-             wall_v(j,i) = 1.0   ! rigth wall (location of adjacent fluid)
-             fxm(j,i)    = 0.0
-             fxp(j,i)    = 1.0
+             wall_v(j,i) = 1.0_wp   ! rigth wall (location of adjacent fluid)
+             fxm(j,i)    = 0.0_wp
+             fxp(j,i)    = 1.0_wp
           ELSEIF ( nzb_v_outer(j,i) > nzb_v_outer(j,i-1) )  THEN
-             wall_v(j,i) = 1.0   ! left wall (location of adjacent fluid)
-             fxm(j,i)    = 1.0
-             fxp(j,i)    = 0.0
+             wall_v(j,i) = 1.0_wp   ! left wall (location of adjacent fluid)
+             fxm(j,i)    = 1.0_wp
+             fxp(j,i)    = 0.0_wp
           ENDIF
 !
@@ -961,24 +961,24 @@
 !--       production of tke
           IF ( nzb_w_outer(j,i) > nzb_w_outer(j+1,i) )  THEN
-             wall_e_y(j,i) =  1.0   ! north wall (location of adjacent fluid)
-             wall_w_y(j,i) =  1.0
-             fwym(j,i)     =  0.0
-             fwyp(j,i)     =  1.0
+             wall_e_y(j,i) =  1.0_wp   ! north wall (location of adjacent fluid)
+             wall_w_y(j,i) =  1.0_wp
+             fwym(j,i)     =  0.0_wp
+             fwyp(j,i)     =  1.0_wp
           ELSEIF ( nzb_w_outer(j,i) > nzb_w_outer(j-1,i) )  THEN
-             wall_e_y(j,i) = -1.0   ! south wall (location of adjacent fluid)
-             wall_w_y(j,i) =  1.0
-             fwym(j,i)     =  1.0
-             fwyp(j,i)     =  0.0
+             wall_e_y(j,i) = -1.0_wp   ! south wall (location of adjacent fluid)
+             wall_w_y(j,i) =  1.0_wp
+             fwym(j,i)     =  1.0_wp
+             fwyp(j,i)     =  0.0_wp
           ENDIF
           IF ( nzb_w_outer(j,i) > nzb_w_outer(j,i+1) )  THEN
-             wall_e_x(j,i) =  1.0   ! right wall (location of adjacent fluid)
-             wall_w_x(j,i) =  1.0
-             fwxm(j,i)     =  0.0
-             fwxp(j,i)     =  1.0
+             wall_e_x(j,i) =  1.0_wp   ! right wall (location of adjacent fluid)
+             wall_w_x(j,i) =  1.0_wp
+             fwxm(j,i)     =  0.0_wp
+             fwxp(j,i)     =  1.0_wp
           ELSEIF ( nzb_w_outer(j,i) > nzb_w_outer(j,i-1) )  THEN
-             wall_e_x(j,i) = -1.0   ! left wall (location of adjacent fluid)
-             wall_w_x(j,i) =  1.0
-             fwxm(j,i)     =  1.0
-             fwxp(j,i)     =  0.0
+             wall_e_x(j,i) = -1.0_wp   ! left wall (location of adjacent fluid)
+             wall_w_x(j,i) =  1.0_wp
+             fwxm(j,i)     =  1.0_wp
+             fwxp(j,i)     =  0.0_wp
           ENDIF
 !
@@ -1399,11 +1399,11 @@
 !--             North wall (y distance)
                 DO  k = wall_n(j,i), nzb_si
-                   l_wall(k,j+1,i) = MIN( l_wall(k,j+1,i), 0.5 * dy )
+                   l_wall(k,j+1,i) = MIN( l_wall(k,j+1,i), 0.5_wp * dy )
                 ENDDO
 !
 !--             Above North wall (yz distance)
                 DO  k = nzb_si + 1, nzb_si + vi
-                   l_wall(k,j+1,i) = MIN( l_wall(k,j+1,i),     &
-                                          SQRT( 0.25 * dy**2 + &
+                   l_wall(k,j+1,i) = MIN( l_wall(k,j+1,i),                     &
+                                          SQRT( 0.25_wp * dy**2 +              &
                                           ( zu(k) - zw(nzb_si) )**2 ) )
                 ENDDO
@@ -1413,12 +1413,12 @@
                    DO  k = corner_nl(j,i), nzb_si
                       l_wall(k,j+1,i-1) = MIN( l_wall(k,j+1,i-1), &
-                                               0.5 * SQRT( dx**2 + dy**2 ) )
+                                               0.5_wp * SQRT( dx**2 + dy**2 ) )
                    ENDDO
 !
 !--                Above Northleft corner (xyz distance)
                    DO  k = nzb_si + 1, nzb_si + vi
-                      l_wall(k,j+1,i-1) = MIN( l_wall(k,j+1,i-1),             &
-                                               SQRT( 0.25 * (dx**2 + dy**2) + &
-                                               ( zu(k) - zw(nzb_si) )**2 ) )
+                      l_wall(k,j+1,i-1) = MIN( l_wall(k,j+1,i-1),              &
+                                            SQRT( 0.25_wp * (dx**2 + dy**2) +  &
+                                            ( zu(k) - zw(nzb_si) )**2 ) )
                    ENDDO
                 ENDIF
@@ -1427,13 +1427,13 @@
                 IF ( corner_nr(j,i) > 0 )  THEN
                    DO  k = corner_nr(j,i), nzb_si
-                       l_wall(k,j+1,i+1) = MIN( l_wall(k,j+1,i+1), &
-                                                0.5 * SQRT( dx**2 + dy**2 ) )
+                       l_wall(k,j+1,i+1) = MIN( l_wall(k,j+1,i+1),             &
+                                                0.5_wp * SQRT( dx**2 + dy**2 ) )
                    ENDDO
 !
 !--                Above northright corner (xyz distance)
                    DO  k = nzb_si + 1, nzb_si + vi
-                      l_wall(k,j+1,i+1) = MIN( l_wall(k,j+1,i+1), &
-                                               SQRT( 0.25 * (dx**2 + dy**2) + &
-                                               ( zu(k) - zw(nzb_si) )**2 ) )
+                      l_wall(k,j+1,i+1) = MIN( l_wall(k,j+1,i+1),              &
+                                            SQRT( 0.25_wp * (dx**2 + dy**2) +  &
+                                            ( zu(k) - zw(nzb_si) )**2 ) )
                    ENDDO
                 ENDIF
@@ -1444,12 +1444,11 @@
 !--             South wall (y distance)
                 DO  k = wall_s(j,i), nzb_si
-                   l_wall(k,j-1,i) = MIN( l_wall(k,j-1,i), 0.5 * dy )
+                   l_wall(k,j-1,i) = MIN( l_wall(k,j-1,i), 0.5_wp * dy )
                 ENDDO
 !
 !--             Above south wall (yz distance)
-                DO  k = nzb_si + 1, &
-                        nzb_si + vi
-                   l_wall(k,j-1,i) = MIN( l_wall(k,j-1,i),     &
-                                          SQRT( 0.25 * dy**2 + &
+                DO  k = nzb_si + 1, nzb_si + vi
+                   l_wall(k,j-1,i) = MIN( l_wall(k,j-1,i),                     &
+                                          SQRT( 0.25_wp * dy**2 +              &
                                           ( zu(k) - zw(nzb_si) )**2 ) )
                 ENDDO
@@ -1458,13 +1457,13 @@
                 IF ( corner_sl(j,i) > 0 )  THEN
                    DO  k = corner_sl(j,i), nzb_si
-                      l_wall(k,j-1,i-1) = MIN( l_wall(k,j-1,i-1), &
-                                               0.5 * SQRT( dx**2 + dy**2 ) )
+                      l_wall(k,j-1,i-1) = MIN( l_wall(k,j-1,i-1),              &
+                                               0.5_wp * SQRT( dx**2 + dy**2 ) )
                    ENDDO
 !
 !--                Above southleft corner (xyz distance)
                    DO  k = nzb_si + 1, nzb_si + vi
-                      l_wall(k,j-1,i-1) = MIN( l_wall(k,j-1,i-1),             &
-                                               SQRT( 0.25 * (dx**2 + dy**2) + &
-                                               ( zu(k) - zw(nzb_si) )**2 ) )
+                      l_wall(k,j-1,i-1) = MIN( l_wall(k,j-1,i-1),              &
+                                            SQRT( 0.25_wp * (dx**2 + dy**2) +  &
+                                            ( zu(k) - zw(nzb_si) )**2 ) )
                    ENDDO
                 ENDIF
@@ -1473,13 +1472,13 @@
                 IF ( corner_sr(j,i) > 0 )  THEN
                    DO  k = corner_sr(j,i), nzb_si
-                      l_wall(k,j-1,i+1) = MIN( l_wall(k,j-1,i+1), &
-                                               0.5 * SQRT( dx**2 + dy**2 ) )
+                      l_wall(k,j-1,i+1) = MIN( l_wall(k,j-1,i+1),              &
+                                               0.5_wp * SQRT( dx**2 + dy**2 ) )
                    ENDDO
 !
 !--                Above southright corner (xyz distance)
                    DO  k = nzb_si + 1, nzb_si + vi
-                      l_wall(k,j-1,i+1) = MIN( l_wall(k,j-1,i+1),             &
-                                               SQRT( 0.25 * (dx**2 + dy**2) + &
-                                               ( zu(k) - zw(nzb_si) )**2 ) )
+                      l_wall(k,j-1,i+1) = MIN( l_wall(k,j-1,i+1),              &
+                                            SQRT( 0.25_wp * (dx**2 + dy**2) +  &
+                                            ( zu(k) - zw(nzb_si) )**2 ) )
                    ENDDO
                 ENDIF
@@ -1491,28 +1490,28 @@
 !--             Left wall (x distance)
                 DO  k = wall_l(j,i), nzb_si
-                   l_wall(k,j,i-1) = MIN( l_wall(k,j,i-1), 0.5 * dx )
+                   l_wall(k,j,i-1) = MIN( l_wall(k,j,i-1), 0.5_wp * dx )
                 ENDDO
 !
 !--             Above left wall (xz distance)
                 DO  k = nzb_si + 1, nzb_si + vi
-                   l_wall(k,j,i-1) = MIN( l_wall(k,j,i-1),     &
-                                          SQRT( 0.25 * dx**2 + &
+                   l_wall(k,j,i-1) = MIN( l_wall(k,j,i-1),                     &
+                                       SQRT( 0.25_wp * dx**2 +                 &
+                                       ( zu(k) - zw(nzb_si) )**2 ) )
+                ENDDO
+             ENDIF
+
+             IF ( wall_r(j,i) > 0 )  THEN
+!
+!--             Right wall (x distance)
+                DO  k = wall_r(j,i), nzb_si
+                   l_wall(k,j,i+1) = MIN( l_wall(k,j,i+1), 0.5_wp * dx )
+                ENDDO
+!
+!--             Above right wall (xz distance)
+                DO  k = nzb_si + 1, nzb_si + vi
+                   l_wall(k,j,i+1) = MIN( l_wall(k,j,i+1),                     &
+                                          SQRT( 0.25_wp * dx**2 +              &
                                           ( zu(k) - zw(nzb_si) )**2 ) )
                 ENDDO
-             ENDIF
-
-             IF ( wall_r(j,i) > 0 )  THEN
-!
-!--             Right wall (x distance)
-                DO  k = wall_r(j,i), nzb_si
-                   l_wall(k,j,i+1) = MIN( l_wall(k,j,i+1), 0.5 * dx )
-                ENDDO
-!
-!--             Above right wall (xz distance)
-                DO  k = nzb_si + 1, nzb_si + vi
-                   l_wall(k,j,i+1) = MIN( l_wall(k,j,i+1),     &
-                                          SQRT( 0.25 * dx**2 + &
-                                          ( zu(k) - zw(nzb_si) )**2 ) )
-                ENDDO
 
              ENDIF
Index: /palm/trunk/SOURCE/init_masks.f90
===================================================================
--- /palm/trunk/SOURCE/init_masks.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_masks.f90	(revision 1353)
@@ -20,4 +20,5 @@
 ! Current revisions:
 ! -----------------
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -150,22 +151,22 @@
        mask      (mid,3,:) = mask_z(mid,:) 
        
-       IF ( mask_x_loop(mid,1) == -1.0  .AND.  mask_x_loop(mid,2) == -1.0  &
-            .AND.  mask_x_loop(mid,3) == -1.0 )  THEN
-          mask_loop(mid,1,1:2) = -1.0
-          mask_loop(mid,1,3) = 0.0
+       IF ( mask_x_loop(mid,1) == -1.0_wp  .AND.  mask_x_loop(mid,2) == -1.0_wp&
+            .AND.  mask_x_loop(mid,3) == -1.0_wp )  THEN
+          mask_loop(mid,1,1:2) = -1.0_wp
+          mask_loop(mid,1,3)   =  0.0_wp
        ELSE
           mask_loop(mid,1,:) = mask_x_loop(mid,:)
        ENDIF
-       IF ( mask_y_loop(mid,1) == -1.0  .AND.  mask_y_loop(mid,2) == -1.0  &
-            .AND.  mask_y_loop(mid,3) == -1.0 )  THEN
-          mask_loop(mid,2,1:2) = -1.0
-          mask_loop(mid,2,3) = 0.0
+       IF ( mask_y_loop(mid,1) == -1.0_wp  .AND.  mask_y_loop(mid,2) == -1.0_wp&
+            .AND.  mask_y_loop(mid,3) == -1.0_wp )  THEN
+          mask_loop(mid,2,1:2) = -1.0_wp
+          mask_loop(mid,2,3)   =  0.0_wp
        ELSE
           mask_loop(mid,2,:) = mask_y_loop(mid,:)
        ENDIF
-       IF ( mask_z_loop(mid,1) == -1.0  .AND.  mask_z_loop(mid,2) == -1.0  &
-            .AND.  mask_z_loop(mid,3) == -1.0 )  THEN
-          mask_loop(mid,3,1:2) = -1.0
-          mask_loop(mid,3,3) = 0.0
+       IF ( mask_z_loop(mid,1) == -1.0_wp  .AND.  mask_z_loop(mid,2) == -1.0_wp&
+            .AND.  mask_z_loop(mid,3) == -1.0_wp )  THEN
+          mask_loop(mid,3,1:2) = -1.0_wp
+          mask_loop(mid,3,3)   =  0.0_wp
        ELSE
           mask_loop(mid,3,:) = mask_z_loop(mid,:)
@@ -521,13 +522,16 @@
        REAL(wp)      ::  tmp2  !:
 
-       count = 0;  count_l = 0;  ddxyz = 1.0 / dxyz;  tmp1 = 0.0;  tmp2 = 0.0
-
-       IF ( mask(mid,dim,1) >= 0.0 )  THEN
+       count = 0;  count_l = 0  
+       ddxyz = 1.0_wp / dxyz  
+       tmp1  = 0.0_wp
+       tmp2  = 0.0_wp
+
+       IF ( mask(mid,dim,1) >= 0.0_wp )  THEN
 !
 !--       use predefined mask_* array
-          DO  WHILE ( mask(mid,dim,count+1) >= 0.0 )
+          DO  WHILE ( mask(mid,dim,count+1) >= 0.0_wp )
              count = count + 1
              IF ( dim == 1 .OR. dim == 2 )  THEN
-                m = NINT( mask(mid,dim,count) * mask_scale(dim) * ddxyz - 0.5 )
+                m = NINT( mask(mid,dim,count) * mask_scale(dim) * ddxyz - 0.5_wp )
              ELSEIF ( dim == 3 )  THEN
                 ind_array =  &
@@ -561,10 +565,10 @@
 !--       use predefined mask_loop_* array, or use the default (all grid points
 !--       along this direction)
-          IF ( mask_loop(mid,dim,1) < 0.0 )  THEN
+          IF ( mask_loop(mid,dim,1) < 0.0_wp )  THEN
              tmp1 = mask_loop(mid,dim,1)
              mask_loop(mid,dim,1) = zw(nzb)  !   lowest level  (default)
           ENDIF
           IF ( dim == 1 .OR. dim == 2 )  THEN
-             IF ( mask_loop(mid,dim,2) < 0.0 )  THEN
+             IF ( mask_loop(mid,dim,2) < 0.0_wp )  THEN
                 tmp2 = mask_loop(mid,dim,2)
                 mask_loop(mid,dim,2) = nxyz*dxyz / mask_scale(dim)   ! (default)
@@ -581,11 +585,11 @@
              ENDIF
              loop_begin  = NINT( mask_loop(mid,dim,1) * mask_scale(dim) &
-                  * ddxyz - 0.5 )
+                  * ddxyz - 0.5_wp )
              loop_end    = NINT( mask_loop(mid,dim,2) * mask_scale(dim) &
-                  * ddxyz - 0.5 )
+                  * ddxyz - 0.5_wp )
              loop_stride = NINT( mask_loop(mid,dim,3) * mask_scale(dim) &
                   * ddxyz )
           ELSEIF ( dim == 3 )  THEN
-             IF ( mask_loop(mid,dim,2) < 0.0 )  THEN
+             IF ( mask_loop(mid,dim,2) < 0.0_wp )  THEN
                 tmp2 = mask_loop(mid,dim,2)
                 mask_loop(mid,dim,2) = zu(nz) / mask_scale(dim)   ! (default)
@@ -627,6 +631,6 @@
 !
 !--       If necessary, reset mask_loop(mid,dim,1) and mask_loop(mid,dim,2).
-          IF ( tmp1 < 0.0 )  mask_loop(mid,dim,1) = tmp1
-          IF ( tmp2 < 0.0 )  mask_loop(mid,dim,2) = tmp2
+          IF ( tmp1 < 0.0_wp )  mask_loop(mid,dim,1) = tmp1
+          IF ( tmp2 < 0.0_wp )  mask_loop(mid,dim,2) = tmp2
 !
 !--       The default stride +/-1 (every grid point) applies if 
Index: /palm/trunk/SOURCE/init_ocean.f90
===================================================================
--- /palm/trunk/SOURCE/init_ocean.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_ocean.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -85,5 +85,5 @@
 !
 !-- Set water density near the ocean surface
-    rho_surface = 1027.62
+    rho_surface = 1027.62_wp
 
 !
@@ -93,5 +93,5 @@
     hyp(nzt+1) = surface_pressure * 100.0_wp
 
-    hyp(nzt)      = hyp(nzt+1) + rho_surface * g * 0.5 * dzu(nzt+1)
+    hyp(nzt)      = hyp(nzt+1) + rho_surface * g * 0.5_wp * dzu(nzt+1)
     rho_init(nzt) = rho_surface
 
@@ -106,10 +106,10 @@
     DO  n = 1, 5
 
-       rho_reference = rho_surface * 0.5 * dzu(nzt+1)
+       rho_reference = rho_surface * 0.5_wp * dzu(nzt+1)
 
        DO  k = nzt-1, 0, -1
 
-          sa_l = 0.5 * ( sa_init(k) + sa_init(k+1) )
-          pt_l = 0.5 * ( pt_init(k) + pt_init(k+1) )
+          sa_l = 0.5_wp * ( sa_init(k) + sa_init(k+1) )
+          pt_l = 0.5_wp * ( pt_init(k) + pt_init(k+1) )
 
           rho_init(k) = eqn_state_seawater_func( hyp(k), pt_l, sa_l )
@@ -122,5 +122,5 @@
 
        DO  k = nzt-1, 0, -1
-          hyp(k) = hyp(k+1) + g * 0.5 * ( rho_init(k) + rho_init(k+1 ) ) * &
+          hyp(k) = hyp(k+1) + g * 0.5_wp * ( rho_init(k) + rho_init(k+1 ) ) * &
                               dzu(k+1)
        ENDDO
@@ -130,9 +130,9 @@
 !
 !-- Calculate the reference potential density
-    prho_reference = 0.0
+    prho_reference = 0.0_wp
     DO  k = 0, nzt
 
-       sa_l = 0.5 * ( sa_init(k) + sa_init(k+1) )
-       pt_l = 0.5 * ( pt_init(k) + pt_init(k+1) )
+       sa_l = 0.5_wp * ( sa_init(k) + sa_init(k+1) )
+       pt_l = 0.5_wp * ( pt_init(k) + pt_init(k+1) )
 
        prho_reference = prho_reference + dzu(k+1) * &
Index: /palm/trunk/SOURCE/init_pegrid.f90
===================================================================
--- /palm/trunk/SOURCE/init_pegrid.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_pegrid.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -399,5 +399,5 @@
 !
 !-- Indices for direct transpositions z --> y (used for calculating spectra)
-    IF ( dt_dosp /= 9999999.9 )  THEN
+    IF ( dt_dosp /= 9999999.9_wp )  THEN
        IF ( MOD( nz, pdims(2) ) /= 0 )  THEN
           WRITE( message_string, * ) 'direct transposition z --> y (needed ', &
Index: /palm/trunk/SOURCE/init_pt_anomaly.f90
===================================================================
--- /palm/trunk/SOURCE/init_pt_anomaly.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_pt_anomaly.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -82,8 +82,8 @@
 !-- Defaults: radius rc, strength z,
 !--           position of centre: ic, jc, kc
-    rc =  10.0 * dx
+    rc =  10.0_wp * dx
     ic =  ( nx+1 ) / 2
     jc =  ic
-    kc = nzt / 2
+    kc =  nzt / 2
 
 !
@@ -97,7 +97,7 @@
              radius = SQRT( x**2 + y**2 + z**2 )
              IF ( radius <= rc )  THEN
-                betrag = 5.0 * EXP( -( radius * 0.001_wp / 2.0_wp )**2 )
+                betrag = 5.0_wp * EXP( -( radius * 0.001_wp / 2.0_wp )**2 )
              ELSE
-                betrag = 0.0
+                betrag = 0.0_wp
              ENDIF
 
Index: /palm/trunk/SOURCE/init_rankine.f90
===================================================================
--- /palm/trunk/SOURCE/init_rankine.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_rankine.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -89,5 +89,5 @@
 !-- Default: eddy radius rc, eddy strength z,
 !--          position of eddy centre: ic, jc, kc1, kc2
-    rc  =  4.0 * dx
+    rc  =  4.0_wp * dx
     ic  =  ( nx+1 ) / 2
     jc  =  ic
@@ -111,26 +111,26 @@
     DO  i = nxl, nxr
        DO  j = nys, nyn
-          x = ( i - ic - 0.5 ) * dx
-          y = ( j - jc ) * dy
+          x = ( i - ic - 0.5_wp ) * dx
+          y = ( j - jc          ) * dy
           radius = SQRT( x**2 + y**2 )
-          IF ( radius <= 2.0 * rc )  THEN
-             betrag = radius / ( 2.0 * rc ) * 0.08_wp
-          ELSEIF ( radius > 2.0 * rc  .AND.  radius < 8.0 * rc )  THEN
-             betrag = 0.08 * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp )
-          ELSE
-             betrag = 0.0
-          ENDIF
-
-          IF ( x == 0.0 )  THEN
-             IF ( y > 0.0 )  THEN
+          IF ( radius <= 2.0_wp * rc )  THEN
+             betrag = radius / ( 2.0_wp * rc ) * 0.08_wp
+          ELSEIF ( radius > 2.0_wp * rc  .AND.  radius < 8.0_wp * rc )  THEN
+             betrag = 0.08_wp * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp )
+          ELSE
+             betrag = 0.0_wp
+          ENDIF
+
+          IF ( x == 0.0_wp )  THEN
+             IF ( y > 0.0_wp )  THEN
                 alpha = pi / 2.0_wp
-             ELSEIF ( y < 0.0 )  THEN
-                alpha = 3.0 * pi / 2.0_wp
-             ENDIF
-          ELSE
-             IF ( x < 0.0 )  THEN
+             ELSEIF ( y < 0.0_wp )  THEN
+                alpha = 3.0_wp * pi / 2.0_wp
+             ENDIF
+          ELSE
+             IF ( x < 0.0_wp )  THEN
                 alpha = ATAN( y / x ) + pi
              ELSE
-                IF ( y < 0.0 )  THEN
+                IF ( y < 0.0_wp )  THEN
                    alpha = ATAN( y / x ) + 2.0_wp * pi
                 ELSE
@@ -152,26 +152,26 @@
     DO  i = nxl, nxr
        DO  j = nys, nyn
-          x = ( i - ic ) * dx
-          y = ( j - jc - 0.5) * dy
+          x = ( i - ic          ) * dx
+          y = ( j - jc - 0.5_wp ) * dy
           radius = SQRT( x**2 + y**2 )
-          IF ( radius <= 2.0 * rc )  THEN
+          IF ( radius <= 2.0_wp * rc )  THEN
              betrag = radius / ( 2.0_wp * rc ) * 0.08_wp
-          ELSEIF ( radius > 2.0 * rc  .AND.  radius < 8.0 * rc )  THEN
-             betrag = 0.08 * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp )
-          ELSE
-             betrag = 0.0
-          ENDIF
-
-          IF ( x == 0.0 )  THEN
-             IF ( y > 0.0 )  THEN
+          ELSEIF ( radius > 2.0_wp * rc  .AND.  radius < 8.0_wp * rc )  THEN
+             betrag = 0.08_wp * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp )
+          ELSE
+             betrag = 0.0_wp
+          ENDIF
+
+          IF ( x == 0.0_wp )  THEN
+             IF ( y > 0.0_wp )  THEN
                 alpha = pi / 2.0_wp
-             ELSEIF ( y < 0.0 )  THEN
-                alpha = 3.0 * pi / 2.0_wp
-             ENDIF
-          ELSE
-             IF ( x < 0.0 )  THEN
+             ELSEIF ( y < 0.0_wp )  THEN
+                alpha = 3.0_wp * pi / 2.0_wp
+             ENDIF
+          ELSE
+             IF ( x < 0.0_wp )  THEN
                 alpha = ATAN( y / x ) + pi
              ELSE
-                IF ( y < 0.0 )  THEN
+                IF ( y < 0.0_wp )  THEN
                    alpha = ATAN( y / x ) + 2.0_wp * pi
                 ELSE
Index: /palm/trunk/SOURCE/init_slope.f90
===================================================================
--- /palm/trunk/SOURCE/init_slope.f90	(revision 1352)
+++ /palm/trunk/SOURCE/init_slope.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -104,10 +104,10 @@
           ELSE
              radius = SQRT( ( i * dx )**2 )
-             height = 0.0
+             height = 0.0_wp
           ENDIF
-          IF ( radius /= 0.0 )  THEN
+          IF ( radius /= 0.0_wp )  THEN
              alpha = ASIN( height / radius )
           ELSE
-             alpha = 0.0
+             alpha = 0.0_wp
           ENDIF
 !
@@ -140,5 +140,5 @@
 !--    the rotated coordinate system)
        ALLOCATE( pt_init_local(nzb:nzt+1) )
-       pt_init_local = 0.0
+       pt_init_local = 0.0_wp
        DO  i = nxl, nxr
           DO  j =  nys, nyn
Index: /palm/trunk/SOURCE/local_stop.f90
===================================================================
--- /palm/trunk/SOURCE/local_stop.f90	(revision 1352)
+++ /palm/trunk/SOURCE/local_stop.f90	(revision 1353)
@@ -20,4 +20,5 @@
 ! Current revisions:
 ! -----------------
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -135,5 +136,5 @@
              ENDIF
              terminate_run = .TRUE.
-             time_restart = 9999999.9
+             time_restart = 9999999.9_wp
 
        END SELECT
Index: /palm/trunk/SOURCE/local_tremain.f90
===================================================================
--- /palm/trunk/SOURCE/local_tremain.f90	(revision 1352)
+++ /palm/trunk/SOURCE/local_tremain.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -93,5 +93,5 @@
 !
 !-- No stop due to running out of cpu-time on other machines
-    remaining_time = 9999999.9
+    remaining_time = 9999999.9_wp
 
 #endif
Index: /palm/trunk/SOURCE/ls_forcing.f90
===================================================================
--- /palm/trunk/SOURCE/ls_forcing.f90	(revision 1352)
+++ /palm/trunk/SOURCE/ls_forcing.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -105,7 +105,8 @@
                  vg_vert(nzb:nzt+1,0:nlsf), wsubs_vert(nzb:nzt+1,0:nlsf) )
 
-       p_surf = 0.0; pt_surf = 0.0; q_surf = 0.0; qsws_surf = 0.0
-       shf_surf = 0.0; time_vert = 0.0; time_surf = 0.0; ug_vert = 0.0
-       vg_vert = 0.0; wsubs_vert = 0.0
+       p_surf     = 0.0_wp;  pt_surf  = 0.0_wp;  q_surf    = 0.0_wp
+       qsws_surf  = 0.0_wp;  shf_surf = 0.0_wp;  time_vert = 0.0_wp
+       time_surf  = 0.0_wp;  ug_vert  = 0.0_wp;  vg_vert   = 0.0_wp
+       wsubs_vert = 0.0_wp
 
 
@@ -234,5 +235,5 @@
 !
 !--    Large scale vertical velocity has to be zero at the surface
-       wsubs_vert(nzb,:) = 0.0
+       wsubs_vert(nzb,:) = 0.0_wp
  
        IF ( time_vert(1) > end_time )  THEN
Index: /palm/trunk/SOURCE/microphysics.f90
===================================================================
--- /palm/trunk/SOURCE/microphysics.f90	(revision 1352)
+++ /palm/trunk/SOURCE/microphysics.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -368,15 +368,15 @@
 !--       t / pt : ratio of actual and potential temperature (t_d_pt)
 !--       p_0(z) : vertical profile of the hydrostatic pressure (hyp)
-          t_surface = pt_surface * ( surface_pressure / 1000.0 )**0.286_wp
+          t_surface = pt_surface * ( surface_pressure / 1000.0_wp )**0.286_wp
           DO  k = nzb, nzt+1
-             hyp(k)    = surface_pressure * 100.0 * &
+             hyp(k)    = surface_pressure * 100.0_wp * &
                          ( (t_surface - g/cp * zu(k)) / t_surface )**(1.0_wp/0.286_wp)
-             pt_d_t(k) = ( 100000.0 / hyp(k) )**0.286_wp
-             t_d_pt(k) = 1.0 / pt_d_t(k)
+             pt_d_t(k) = ( 100000.0_wp / hyp(k) )**0.286_wp
+             t_d_pt(k) = 1.0_wp / pt_d_t(k)
              hyrho(k)  = hyp(k) / ( r_d * t_d_pt(k) * pt_init(k) )       
           ENDDO
 !
 !--       Compute reference density
-          rho_surface = surface_pressure * 100.0 / ( r_d * t_surface )
+          rho_surface = surface_pressure * 100.0_wp / ( r_d * t_surface )
        ENDIF
 
@@ -445,6 +445,6 @@
 
           IF ( qr(k,j,i) <= eps_sb )  THEN
-             qr(k,j,i) = 0.0
-             nr(k,j,i) = 0.0
+             qr(k,j,i) = 0.0_wp
+             nr(k,j,i) = 0.0_wp
           ELSE
 !
@@ -506,5 +506,5 @@
        REAL(wp)     ::  xc                !:
 
-       k_au = k_cc / ( 20.0 * x0 )
+       k_au = k_cc / ( 20.0_wp * x0 )
 
        DO  k = nzb_s_inner(j,i)+1, nzt
@@ -513,14 +513,14 @@
 !
 !--          Intern time scale of coagulation (Seifert and Beheng, 2006):
-!--          (1.0 - qc(k,j,i) / ( qc(k,j,i) + qr_1d(k) ))
-             tau_cloud = 1.0 - qc_1d(k) / ( qr_1d(k) + qc_1d(k) )
+!--          (1.0_wp - qc(k,j,i) / ( qc(k,j,i) + qr_1d(k) ))
+             tau_cloud = 1.0_wp - qc_1d(k) / ( qr_1d(k) + qc_1d(k) )
 !
 !--          Universal function for autoconversion process 
 !--          (Seifert and Beheng, 2006):
-             phi_au    = 600.0 * tau_cloud**0.68_wp * ( 1.0 - tau_cloud**0.68_wp )**3
+             phi_au    = 600.0_wp * tau_cloud**0.68_wp * ( 1.0_wp - tau_cloud**0.68_wp )**3
 !
 !--          Shape parameter of gamma distribution (Geoffroy et al., 2010):
-!--          (Use constant nu_c = 1.0 instead?)
-             nu_c      = 1.0 !MAX( 0.0_wp, 1580.0 * hyrho(k) * qc(k,j,i) - 0.28_wp )
+!--          (Use constant nu_c = 1.0_wp instead?)
+             nu_c      = 1.0_wp !MAX( 0.0_wp, 1580.0_wp * hyrho(k) * qc(k,j,i) - 0.28_wp )
 !
 !--          Mean weight of cloud droplets:
@@ -532,9 +532,9 @@
 !
 !--             Weight averaged radius of cloud droplets:
-                rc = 0.5 * ( xc * dpirho_l )**( 1.0_wp / 3.0_wp )
-
-                alpha_cc = ( a_1 + a_2 * nu_c ) / ( 1.0 + a_3 * nu_c )
-                r_cc     = ( b_1 + b_2 * nu_c ) / ( 1.0 + b_3 * nu_c )
-                sigma_cc = ( c_1 + c_2 * nu_c ) / ( 1.0 + c_3 * nu_c )
+                rc = 0.5_wp * ( xc * dpirho_l )**( 1.0_wp / 3.0_wp )
+
+                alpha_cc = ( a_1 + a_2 * nu_c ) / ( 1.0_wp + a_3 * nu_c )
+                r_cc     = ( b_1 + b_2 * nu_c ) / ( 1.0_wp + b_3 * nu_c )
+                sigma_cc = ( c_1 + c_2 * nu_c ) / ( 1.0_wp + c_3 * nu_c )
 !
 !--             Mixing length (neglecting distance to ground and stratification)
@@ -546,19 +546,19 @@
 !
 !--             Compute Taylor-microscale Reynolds number:
-                re_lambda = 6.0 / 11.0 * ( l_mix / c_const )**( 2.0_wp / 3.0_wp ) *  &
-                            SQRT( 15.0 / kin_vis_air ) * epsilon**( 1.0_wp / 6.0_wp )
+                re_lambda = 6.0_wp / 11.0_wp * ( l_mix / c_const )**( 2.0_wp / 3.0_wp ) *  &
+                               SQRT( 15.0_wp / kin_vis_air ) * epsilon**( 1.0_wp / 6.0_wp )
 !
 !--             The factor of 1.0E4 is needed to convert the dissipation rate
 !--             from m2 s-3 to cm2 s-3.
-                k_au = k_au * ( 1.0_wp +                                       &
-                       epsilon * 1.0E4 * ( re_lambda * 1.0E-3 )**0.25_wp *     &
-                       ( alpha_cc * EXP( -1.0 * ( ( rc - r_cc ) /              &
+                k_au = k_au * ( 1.0_wp +                                             &
+                       epsilon * 1.0E4_wp * ( re_lambda * 1.0E-3_wp )**0.25_wp *     &
+                       ( alpha_cc * EXP( -1.0_wp * ( ( rc - r_cc ) /                 &
                        sigma_cc )**2 ) + beta_cc ) )
              ENDIF
 !
 !--          Autoconversion rate (Seifert and Beheng, 2006):
-             autocon = k_au * ( nu_c + 2.0 ) * ( nu_c + 4.0 ) /    &
-                       ( nu_c + 1.0 )**2.0_wp * qc_1d(k)**2.0_wp * xc**2.0_wp *   &
-                       ( 1.0 + phi_au / ( 1.0 - tau_cloud )**2.0_wp ) * &
+             autocon = k_au * ( nu_c + 2.0_wp ) * ( nu_c + 4.0_wp ) /                &
+                       ( nu_c + 1.0_wp )**2.0_wp * qc_1d(k)**2.0_wp * xc**2.0_wp *   &
+                       ( 1.0_wp + phi_au / ( 1.0_wp - tau_cloud )**2.0_wp ) *        &
                        rho_surface
              autocon = MIN( autocon, qc_1d(k) / dt_micro )
@@ -607,9 +607,9 @@
 !
 !--          Intern time scale of coagulation (Seifert and Beheng, 2006):
-             tau_cloud = 1.0 - qc_1d(k) / ( qc_1d(k) + qr_1d(k) ) 
+             tau_cloud = 1.0_wp - qc_1d(k) / ( qc_1d(k) + qr_1d(k) ) 
 !
 !--          Universal function for accretion process 
 !--          (Seifert and Beheng, 2001):
-             phi_ac = tau_cloud / ( tau_cloud + 5.0E-5 ) 
+             phi_ac = tau_cloud / ( tau_cloud + 5.0E-5_wp ) 
              phi_ac = ( phi_ac**2.0_wp )**2.0_wp
 !
@@ -618,6 +618,6 @@
 !--          convert the dissipation (diss) from m2 s-3 to cm2 s-3.
              IF ( turbulence )  THEN
-                k_cr = k_cr0 * ( 1.0 + 0.05 *                             &
-                                 MIN( 600.0_wp, diss(k,j,i) * 1.0E4 )**0.25_wp )
+                k_cr = k_cr0 * ( 1.0_wp + 0.05_wp *                             &
+                                 MIN( 600.0_wp, diss(k,j,i) * 1.0E4_wp )**0.25_wp )
              ELSE
                 k_cr = k_cr0                       
@@ -677,9 +677,9 @@
 !
 !--          Collisional breakup rate (Seifert, 2008):
-             IF ( dr >= 0.3E-3 )  THEN
-                phi_br  = k_br * ( dr - 1.1E-3 )
-                breakup = selfcoll * ( phi_br + 1.0 )
+             IF ( dr >= 0.3E-3_wp )  THEN
+                phi_br  = k_br * ( dr - 1.1E-3_wp )
+                breakup = selfcoll * ( phi_br + 1.0_wp )
              ELSE
-                breakup = 0.0
+                breakup = 0.0_wp
              ENDIF
 
@@ -749,18 +749,18 @@
 !
 !--          Saturation vapor pressure at t_l:
-             e_s = 610.78 * EXP( 17.269 * ( t_l - 273.16 ) / ( t_l - 35.86 ) )
+             e_s = 610.78_wp * EXP( 17.269_wp * ( t_l - 273.16_wp ) / ( t_l - 35.86_wp ) )
 !
 !--          Computation of saturation humidity:
-             q_s = 0.622 * e_s / ( hyp(k) - 0.378 * e_s )
-             alpha = 0.622 * l_d_r * l_d_cp / ( t_l * t_l )
-             q_s = q_s * ( 1.0 + alpha * q_1d(k) ) / ( 1.0 + alpha * q_s )
+             q_s = 0.622_wp * e_s / ( hyp(k) - 0.378_wp * e_s )
+             alpha = 0.622_wp * l_d_r * l_d_cp / ( t_l * t_l )
+             q_s = q_s * ( 1.0_wp + alpha * q_1d(k) ) / ( 1.0_wp + alpha * q_s )
 !
 !--          Supersaturation:
-             sat = MIN( 0.0_wp, ( q_1d(k) - qr_1d(k) - qc_1d(k) ) / q_s - 1.0 )
+             sat = MIN( 0.0_wp, ( q_1d(k) - qr_1d(k) - qc_1d(k) ) / q_s - 1.0_wp )
 !
 !--          Actual temperature:
              temp = t_l + l_d_cp * ( qc_1d(k) + qr_1d(k) )
     
-             g_evap = 1.0 / ( ( l_v / ( r_v * temp ) - 1.0 ) * l_v /   &
+             g_evap = 1.0_wp / ( ( l_v / ( r_v * temp ) - 1.0_wp ) * l_v /   &
                       ( thermal_conductivity_l * temp ) + r_v * temp / &
                       ( diff_coeff_l * e_s ) )
@@ -778,12 +778,12 @@
 !--             Shape parameter of gamma distribution (Milbrandt and Yau, 2005;
 !--             Stevens and Seifert, 2008):
-                mu_r = 10.0 * ( 1.0 + TANH( 1.2E3 * ( dr - 1.4E-3 ) ) )
+                mu_r = 10.0_wp * ( 1.0_wp + TANH( 1.2E3_wp * ( dr - 1.4E-3_wp ) ) )
 !
 !--             Slope parameter of gamma distribution (Seifert, 2008):
-                lambda_r = ( ( mu_r + 3.0 ) * ( mu_r + 2.0 ) *       &
-                             ( mu_r + 1.0 ) )**( 1.0_wp / 3.0_wp ) / dr
-
-                mu_r_2   = mu_r + 2.0
-                mu_r_5d2 = mu_r + 2.5 
+                lambda_r = ( ( mu_r + 3.0_wp ) * ( mu_r + 2.0_wp ) *       &
+                             ( mu_r + 1.0_wp ) )**( 1.0_wp / 3.0_wp ) / dr
+
+                mu_r_2   = mu_r + 2.0_wp
+                mu_r_5d2 = mu_r + 2.5_wp 
                 f_vent = a_vent * gamm( mu_r_2 ) *                            &
                          lambda_r**( -mu_r_2 ) +                              &
@@ -791,25 +791,25 @@
                          SQRT( a_term / kin_vis_air ) * gamm( mu_r_5d2 ) *    &
                          lambda_r**( -mu_r_5d2 ) *                            &
-                         ( 1.0 - 0.5 * ( b_term / a_term ) *                  &
+                         ( 1.0_wp - 0.5_wp * ( b_term / a_term ) *            &
                          ( lambda_r /                                         &
                          (       c_term + lambda_r ) )**mu_r_5d2 -            &
-                                 0.125 * ( b_term / a_term )**2.0_wp *        &
+                                 0.125_wp * ( b_term / a_term )**2.0_wp *     &
                          ( lambda_r /                                         &
-                         ( 2.0 * c_term + lambda_r ) )**mu_r_5d2 -            &
-                                 0.0625 * ( b_term / a_term )**3.0_wp *       &
+                         ( 2.0_wp * c_term + lambda_r ) )**mu_r_5d2 -         &
+                                 0.0625_wp * ( b_term / a_term )**3.0_wp *    &
                          ( lambda_r /                                         &
-                         ( 3.0 * c_term + lambda_r ) )**mu_r_5d2 -            &
-                                 0.0390625 * ( b_term / a_term )**4.0_wp *    &
+                         ( 3.0_wp * c_term + lambda_r ) )**mu_r_5d2 -         &
+                                 0.0390625_wp * ( b_term / a_term )**4.0_wp * &
                          ( lambda_r /                                         &
-                         ( 4.0 * c_term + lambda_r ) )**mu_r_5d2 )
-                nr_0   = nr_1d(k) * lambda_r**( mu_r + 1.0 ) /                &
-                         gamm( mu_r + 1.0 ) 
+                         ( 4.0_wp * c_term + lambda_r ) )**mu_r_5d2 )
+                nr_0   = nr_1d(k) * lambda_r**( mu_r + 1.0_wp ) /             &
+                         gamm( mu_r + 1.0_wp ) 
              ELSE
-                f_vent = 1.0
+                f_vent = 1.0_wp
                 nr_0   = nr_1d(k) * dr
              ENDIF
 !
 !--          Evaporation rate of rain water content (Seifert and Beheng, 2006):
-             evap = 2.0 * pi * nr_0 * g_evap * f_vent * sat /    &
+             evap = 2.0_wp * pi * nr_0 * g_evap * f_vent * sat /    &
                     hyrho(k)
 
@@ -859,8 +859,8 @@
 !
 !--    Sedimentation of cloud droplets (Heus et al., 2010):
-       sed_qc_const = k_st * ( 3.0 / ( 4.0 * pi * rho_l ))**( 2.0_wp / 3.0_wp ) *   &
-                     EXP( 5.0 * LOG( sigma_gc )**2 )
-
-       sed_qc(nzt+1) = 0.0
+       sed_qc_const = k_st * ( 3.0_wp / ( 4.0_wp * pi * rho_l ))**( 2.0_wp / 3.0_wp ) *   &
+                     EXP( 5.0_wp * LOG( sigma_gc )**2 )
+
+       sed_qc(nzt+1) = 0.0_wp
 
        DO  k = nzt, nzb_s_inner(j,i)+1, -1
@@ -869,5 +869,5 @@
                         ( qc_1d(k) * hyrho(k) )**( 5.0_wp / 3.0_wp )
           ELSE
-             sed_qc(k) = 0.0
+             sed_qc(k) = 0.0_wp
           ENDIF
 
@@ -943,5 +943,5 @@
 !--    Computation of sedimentation flux. Implementation according to Stevens
 !--    and Seifert (2008).
-       IF ( intermediate_timestep_count == 1 )  prr(:,j,i) = 0.0
+       IF ( intermediate_timestep_count == 1 )  prr(:,j,i) = 0.0_wp
 !
 !--    Compute velocities 
@@ -954,17 +954,17 @@
 !--          Shape parameter of gamma distribution (Milbrandt and Yau, 2005;
 !--          Stevens and Seifert, 2008):
-             mu_r = 10.0 * ( 1.0 + TANH( 1.2E3 * ( dr - 1.4E-3 ) ) )
+             mu_r = 10.0_wp * ( 1.0_wp + TANH( 1.2E3_wp * ( dr - 1.4E-3_wp ) ) )
 !
 !--          Slope parameter of gamma distribution (Seifert, 2008):
-             lambda_r = ( ( mu_r + 3.0 ) * ( mu_r + 2.0 ) *          &
-                        ( mu_r + 1.0 ) )**( 1.0_wp / 3.0_wp ) / dr
-
-             w_nr(k) = MAX( 0.1_wp, MIN( 20.0_wp, a_term - b_term * ( 1.0 +    &
-                       c_term / lambda_r )**( -1.0 * ( mu_r + 1.0 ) ) ) )
-             w_qr(k) = MAX( 0.1_wp, MIN( 20.0_wp, a_term - b_term * ( 1.0 +    &
-                       c_term / lambda_r )**( -1.0 * ( mu_r + 4.0 ) ) ) )
+             lambda_r = ( ( mu_r + 3.0_wp ) * ( mu_r + 2.0_wp ) *          &
+                        ( mu_r + 1.0_wp ) )**( 1.0_wp / 3.0_wp ) / dr
+
+             w_nr(k) = MAX( 0.1_wp, MIN( 20.0_wp, a_term - b_term * ( 1.0_wp +    &
+                       c_term / lambda_r )**( -1.0_wp * ( mu_r + 1.0_wp ) ) ) )
+             w_qr(k) = MAX( 0.1_wp, MIN( 20.0_wp, a_term - b_term * ( 1.0_wp +    &
+                       c_term / lambda_r )**( -1.0_wp * ( mu_r + 4.0_wp ) ) ) )
           ELSE
-             w_nr(k) = 0.0
-             w_qr(k) = 0.0
+             w_nr(k) = 0.0_wp
+             w_qr(k) = 0.0_wp
           ENDIF
        ENDDO
@@ -973,12 +973,12 @@
        w_nr(nzb_s_inner(j,i)) = w_nr(nzb_s_inner(j,i)+1)
        w_qr(nzb_s_inner(j,i)) = w_qr(nzb_s_inner(j,i)+1)
-       w_nr(nzt+1) = 0.0
-       w_qr(nzt+1) = 0.0
+       w_nr(nzt+1) = 0.0_wp
+       w_qr(nzt+1) = 0.0_wp
 !
 !--    Compute Courant number
        DO  k = nzb_s_inner(j,i)+1, nzt
-          c_nr(k) = 0.25 * ( w_nr(k-1) + 2.0 * w_nr(k) + w_nr(k+1) ) * &
+          c_nr(k) = 0.25_wp * ( w_nr(k-1) + 2.0_wp * w_nr(k) + w_nr(k+1) ) * &
                     dt_micro * ddzu(k)
-          c_qr(k) = 0.25 * ( w_qr(k-1) + 2.0 * w_qr(k) + w_qr(k+1) ) * &
+          c_qr(k) = 0.25_wp * ( w_qr(k-1) + 2.0_wp * w_qr(k) + w_qr(k+1) ) * &
                     dt_micro * ddzu(k)
        ENDDO     
@@ -988,16 +988,16 @@
 
           DO k = nzb_s_inner(j,i)+1, nzt
-             d_mean = 0.5 * ( qr_1d(k+1) + qr_1d(k-1) )
+             d_mean = 0.5_wp * ( qr_1d(k+1) + qr_1d(k-1) )
              d_min  = qr_1d(k) - MIN( qr_1d(k+1), qr_1d(k), qr_1d(k-1) )
              d_max  = MAX( qr_1d(k+1), qr_1d(k), qr_1d(k-1) ) - qr_1d(k)
 
-             qr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0 * d_min, 2.0 * d_max, &
+             qr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0_wp * d_min, 2.0_wp * d_max, &
                                                      ABS( d_mean ) )
 
-             d_mean = 0.5 * ( nr_1d(k+1) + nr_1d(k-1) )
+             d_mean = 0.5_wp * ( nr_1d(k+1) + nr_1d(k-1) )
              d_min  = nr_1d(k) - MIN( nr_1d(k+1), nr_1d(k), nr_1d(k-1) )
              d_max  = MAX( nr_1d(k+1), nr_1d(k), nr_1d(k-1) ) - nr_1d(k)
 
-             nr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0 * d_min, 2.0 * d_max, &
+             nr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0_wp * d_min, 2.0_wp * d_max, &
                                                      ABS( d_mean ) )
           ENDDO
@@ -1005,11 +1005,11 @@
        ELSE
 
-          nr_slope = 0.0
-          qr_slope = 0.0
+          nr_slope = 0.0_wp
+          qr_slope = 0.0_wp
 
        ENDIF
 
-       sed_nr(nzt+1) = 0.0
-       sed_qr(nzt+1) = 0.0
+       sed_nr(nzt+1) = 0.0_wp
+       sed_qr(nzt+1) = 0.0_wp
 !
 !--    Compute sedimentation flux
@@ -1018,12 +1018,12 @@
 !--       Sum up all rain drop number densities which contribute to the flux 
 !--       through k-1/2
-          flux  = 0.0
-          z_run = 0.0 ! height above z(k)
+          flux  = 0.0_wp
+          z_run = 0.0_wp ! height above z(k)
           k_run = k
           c_run = MIN( 1.0_wp, c_nr(k) )
-          DO WHILE ( c_run > 0.0  .AND.  k_run <= nzt )
+          DO WHILE ( c_run > 0.0_wp  .AND.  k_run <= nzt )
              flux  = flux + hyrho(k_run) *                                    &
-                     ( nr_1d(k_run) + nr_slope(k_run) * ( 1.0 - c_run ) *     &
-                     0.5 ) * c_run * dzu(k_run)
+                     ( nr_1d(k_run) + nr_slope(k_run) * ( 1.0_wp - c_run ) *     &
+                     0.5_wp ) * c_run * dzu(k_run)
              z_run = z_run + dzu(k_run)
              k_run = k_run + 1
@@ -1042,14 +1042,14 @@
 !--       Sum up all rain water content which contributes to the flux 
 !--       through k-1/2
-          flux  = 0.0
-          z_run = 0.0 ! height above z(k)
+          flux  = 0.0_wp
+          z_run = 0.0_wp ! height above z(k)
           k_run = k
           c_run = MIN( 1.0_wp, c_qr(k) )
 
-          DO WHILE ( c_run > 0.0  .AND.  k_run <= nzt-1 )
+          DO WHILE ( c_run > 0.0_wp  .AND.  k_run <= nzt-1 )
 
              flux  = flux + hyrho(k_run) *                                    &
-                     ( qr_1d(k_run) + qr_slope(k_run) * ( 1.0 - c_run ) *    &
-                     0.5 ) * c_run * dzu(k_run)
+                     ( qr_1d(k_run) + qr_slope(k_run) * ( 1.0_wp - c_run ) *    &
+                     0.5_wp ) * c_run * dzu(k_run)
              z_run = z_run + dzu(k_run)
              k_run = k_run + 1
@@ -1114,10 +1114,10 @@
        x_gamm = xx 
        y_gamm = x_gamm 
-       tmp = x_gamm + 5.5 
-       tmp = ( x_gamm + 0.5 ) * LOG( tmp ) - tmp 
+       tmp = x_gamm + 5.5_wp
+       tmp = ( x_gamm + 0.5_wp ) * LOG( tmp ) - tmp 
        ser = 1.000000000190015_wp
 
        DO  j = 1, 6 
-          y_gamm = y_gamm + 1.0 
+          y_gamm = y_gamm + 1.0_wp 
           ser    = ser + cof( j ) / y_gamm 
        ENDDO
Index: /palm/trunk/SOURCE/modules.f90
===================================================================
--- /palm/trunk/SOURCE/modules.f90	(revision 1352)
+++ /palm/trunk/SOURCE/modules.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -882,5 +882,5 @@
     USE kinds
 
-    REAL(wp) ::  ddx, ddx2, dx = 1.0, dx2, ddy, ddy2, dy = 1.0, dy2
+    REAL(wp) ::  ddx, ddx2, dx = 1.0_wp, dx2, ddy, ddy2, dy = 1.0_wp, dy2
 
     REAL(wp), DIMENSION(:), ALLOCATABLE ::  ddx2_mg, ddy2_mg
Index: /palm/trunk/SOURCE/netcdf.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf.f90	(revision 1352)
+++ /palm/trunk/SOURCE/netcdf.f90	(revision 1353)
@@ -23,5 +23,5 @@
 ! Current revisions:
 ! ------------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -603,5 +603,5 @@
           ALLOCATE( netcdf_data(mask_size(mid,1)) )
 
-          netcdf_data = ( mask_i_global(mid,:mask_size(mid,1)) + 0.5 ) * dx
+          netcdf_data = ( mask_i_global(mid,:mask_size(mid,1)) + 0.5_wp ) * dx
 
           nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_x_mask(mid,av), &
@@ -623,5 +623,5 @@
           ALLOCATE( netcdf_data(mask_size(mid,2)) )
 
-          netcdf_data = ( mask_j_global(mid,:mask_size(mid,2)) + 0.5 ) * dy
+          netcdf_data = ( mask_j_global(mid,:mask_size(mid,2)) + 0.5_wp ) * dy
 
           nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_y_mask(mid,av), &
@@ -1187,5 +1187,5 @@
 
              DO  i = 0, ny+1
-                netcdf_data(i) = ( i + 0.5 ) * dy
+                netcdf_data(i) = ( i + 0.5_wp ) * dy
              ENDDO
 
@@ -1785,5 +1785,5 @@
              DO  i = 1, ns
                 IF( section(i,1) == -1 )  THEN
-                   netcdf_data(i) = -1.0  ! section averaged along z
+                   netcdf_data(i) = -1.0_wp  ! section averaged along z
                 ELSE
                    netcdf_data(i) = zu( section(i,1) )
@@ -1799,5 +1799,5 @@
              DO  i = 1, ns
                 IF( section(i,1) == -1 )  THEN
-                   netcdf_data(i) = -1.0  ! section averaged along z
+                   netcdf_data(i) = -1.0_wp  ! section averaged along z
                 ELSE
                    netcdf_data(i) = zw( section(i,1) )
@@ -1831,5 +1831,5 @@
 
              DO  i = 0, nx+1
-                netcdf_data(i) = ( i + 0.5 ) * dx
+                netcdf_data(i) = ( i + 0.5_wp ) * dx
              ENDDO
 
@@ -1855,5 +1855,5 @@
 
              DO  i = 0, ny+1
-                netcdf_data(i) = ( i + 0.5 ) * dy
+                netcdf_data(i) = ( i + 0.5_wp ) * dy
              ENDDO
 
@@ -1986,5 +1986,5 @@
                 ENDIF
              ELSE
-                IF ( -1.0 /= netcdf_data(i) )  THEN
+                IF ( -1.0_wp /= netcdf_data(i) )  THEN
                    message_string = 'netCDF file for cross-sections ' //     &
                                TRIM( var ) // ' from previous run found,' // &
@@ -2437,7 +2437,7 @@
              DO  i = 1, ns
                 IF( section(i,2) == -1 )  THEN
-                   netcdf_data(i) = -1.0  ! section averaged along y
+                   netcdf_data(i) = -1.0_wp  ! section averaged along y
                 ELSE
-                   netcdf_data(i) = ( section(i,2) + 0.5 ) * dy
+                   netcdf_data(i) = ( section(i,2) + 0.5_wp ) * dy
                 ENDIF
              ENDDO
@@ -2451,5 +2451,5 @@
              DO  i = 1, ns
                 IF( section(i,2) == -1 )  THEN
-                   netcdf_data(i) = -1.0  ! section averaged along y
+                   netcdf_data(i) = -1.0_wp  ! section averaged along y
                 ELSE
                    netcdf_data(i) = section(i,2) * dy
@@ -2477,5 +2477,5 @@
 
              DO  i = 0, nx+1
-                netcdf_data(i) = ( i + 0.5 ) * dx
+                netcdf_data(i) = ( i + 0.5_wp ) * dx
              ENDDO
 
@@ -2610,5 +2610,5 @@
                 ENDIF
              ELSE
-                IF ( -1.0 /= netcdf_data(i) )  THEN
+                IF ( -1.0_wp /= netcdf_data(i) )  THEN
                    message_string = 'netCDF file for cross-sections ' //     &
                                TRIM( var ) // ' from previous run found,' // &
@@ -3076,7 +3076,7 @@
              DO  i = 1, ns
                 IF( section(i,3) == -1 )  THEN
-                   netcdf_data(i) = -1.0  ! section averaged along x
+                   netcdf_data(i) = -1.0_wp  ! section averaged along x
                 ELSE
-                   netcdf_data(i) = ( section(i,3) + 0.5 ) * dx
+                   netcdf_data(i) = ( section(i,3) + 0.5_wp ) * dx
                 ENDIF
              ENDDO
@@ -3090,5 +3090,5 @@
              DO  i = 1, ns
                 IF( section(i,3) == -1 )  THEN
-                   netcdf_data(i) = -1.0  ! section averaged along x
+                   netcdf_data(i) = -1.0_wp  ! section averaged along x
                 ELSE
                    netcdf_data(i) = section(i,3) * dx
@@ -3115,5 +3115,5 @@
 
              DO  j = 0, ny+1
-                netcdf_data(j) = ( j + 0.5 ) * dy
+                netcdf_data(j) = ( j + 0.5_wp ) * dy
              ENDDO
 
@@ -3248,5 +3248,5 @@
                 ENDIF
              ELSE
-                IF ( -1.0 /= netcdf_data(i) )  THEN
+                IF ( -1.0_wp /= netcdf_data(i) )  THEN
                    message_string = 'netCDF file for cross-sections ' //    &
                               TRIM( var ) // ' from previous run found,' // &
@@ -3395,5 +3395,5 @@
 !
 !--       Define some global attributes of the dataset
-          IF ( averaging_interval_pr /= 0.0 )  THEN
+          IF ( averaging_interval_pr /= 0.0_wp )  THEN
              WRITE (time_average_text,'('', '',F7.1,'' s average'')') &
                                                             averaging_interval_pr
@@ -3820,5 +3820,5 @@
 !--       performance loss due to data copying; an alternative strategy would be 
 !--       to ensure equal attribute size in a job chain. Maybe revise later.
-          IF ( averaging_interval_pr == 0.0 )  THEN
+          IF ( averaging_interval_pr == 0.0_wp )  THEN
              time_average_text = ' '
           ELSE
@@ -4050,5 +4050,5 @@
 !
 !--       Define some global attributes of the dataset
-          IF ( averaging_interval_sp /= 0.0 )  THEN
+          IF ( averaging_interval_sp /= 0.0_wp )  THEN
              WRITE (time_average_text,'('', '',F7.1,'' s average'')') &
                                                             averaging_interval_sp
@@ -4268,5 +4268,5 @@
           ALLOCATE( netcdf_data(nx/2) )
           DO  i = 1, nx/2
-             netcdf_data(i) = 2.0 * pi * i / ( dx * ( nx + 1 ) )
+             netcdf_data(i) = 2.0_wp * pi * i / ( dx * ( nx + 1 ) )
           ENDDO
 
@@ -4279,5 +4279,5 @@
           ALLOCATE( netcdf_data(ny/2) )
           DO  i = 1, ny/2
-             netcdf_data(i) = 2.0 * pi * i / ( dy * ( ny + 1 ) )
+             netcdf_data(i) = 2.0_wp * pi * i / ( dy * ( ny + 1 ) )
           ENDDO
 
@@ -4456,5 +4456,5 @@
           nc_stat = NF90_REDEF( id_set_sp )
           CALL handle_netcdf_error( 'netcdf', 441 )
-          IF ( averaging_interval_sp /= 0.0 )  THEN
+          IF ( averaging_interval_sp /= 0.0_wp )  THEN
              WRITE (time_average_text,'('', '',F7.1,'' s average'')') &
                                                            averaging_interval_sp
Index: /palm/trunk/SOURCE/nudging.f90
===================================================================
--- /palm/trunk/SOURCE/nudging.f90	(revision 1352)
+++ /palm/trunk/SOURCE/nudging.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-!
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -119,6 +119,6 @@
 
 
-       ptnudge = 0.0; qnudge = 0.0; tnudge = 0.0; unudge = 0.0
-       vnudge = 0.0; wnudge = 0.0; timenudge = 0.0
+       ptnudge = 0.0_wp; qnudge = 0.0_wp; tnudge = 0.0_wp; unudge = 0.0_wp
+       vnudge = 0.0_wp; wnudge = 0.0_wp; timenudge = 0.0_wp
 
        t = 0
@@ -193,10 +193,10 @@
              fac = ( highheight - zu(k) ) / ( highheight - lowheight )
 
-             tnudge(k,t)  = fac * lowtnudge + ( 1.0 - fac ) * hightnudge
-             unudge(k,t)  = fac * lowunudge + ( 1.0 - fac ) * highunudge
-             vnudge(k,t)  = fac * lowvnudge + ( 1.0 - fac ) * highvnudge
-             wnudge(k,t)  = fac * lowwnudge + ( 1.0 - fac ) * highwnudge
-             ptnudge(k,t) = fac * lowptnudge + ( 1.0 - fac ) * highptnudge
-             qnudge(k,t)  = fac * lowqnudge + ( 1.0 - fac ) * highqnudge
+             tnudge(k,t)  = fac * lowtnudge  + ( 1.0_wp - fac ) * hightnudge
+             unudge(k,t)  = fac * lowunudge  + ( 1.0_wp - fac ) * highunudge
+             vnudge(k,t)  = fac * lowvnudge  + ( 1.0_wp - fac ) * highvnudge
+             wnudge(k,t)  = fac * lowwnudge  + ( 1.0_wp - fac ) * highwnudge
+             ptnudge(k,t) = fac * lowptnudge + ( 1.0_wp - fac ) * highptnudge
+             qnudge(k,t)  = fac * lowqnudge  + ( 1.0_wp - fac ) * highqnudge
           ENDDO
 
@@ -208,9 +208,9 @@
 !--    Prevent nudging if nudging profiles exhibt too small values
 !--    not used so far
-       lptnudge  = ANY( ABS( ptnudge ) > 1e-8 )
-       lqnudge   = ANY( ABS( qnudge ) > 1e-8 )
-       lunudge   = ANY( ABS( unudge ) > 1e-8 )
-       lvnudge   = ANY( ABS( vnudge ) > 1e-8 )
-       lwnudge   = ANY( ABS( wnudge ) > 1e-8 )
+       lptnudge  = ANY( ABS( ptnudge ) > 1.0e-8_wp )
+       lqnudge   = ANY( ABS( qnudge )  > 1.0e-8_wp )
+       lunudge   = ANY( ABS( unudge )  > 1.0e-8_wp )
+       lvnudge   = ANY( ABS( vnudge )  > 1.0e-8_wp )
+       lwnudge   = ANY( ABS( wnudge )  > 1.0e-8_wp )
 
     END SUBROUTINE init_nudge
Index: /palm/trunk/SOURCE/parin.f90
===================================================================
--- /palm/trunk/SOURCE/parin.f90	(revision 1352)
+++ /palm/trunk/SOURCE/parin.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute 
 ! 
 ! Former revisions:
@@ -452,5 +452,5 @@
                        hom_sum(0:nz+1,pr_palm+max_pr_user,0:statistic_regions) )
 
-             hom = 0.0
+             hom = 0.0_wp
 
           ENDIF
Index: /palm/trunk/SOURCE/poismg.f90
===================================================================
--- /palm/trunk/SOURCE/poismg.f90	(revision 1352)
+++ /palm/trunk/SOURCE/poismg.f90	(revision 1353)
@@ -23,5 +23,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -166,5 +166,5 @@
     ENDIF
 
-    p3 = 0.0
+    p3 = 0.0_wp
  
 !
@@ -185,8 +185,8 @@
     IF ( mg_cycles == -1 )  THEN
        maximum_mgcycles = 0
-       residual_norm    = 1.0 
+       residual_norm    = 1.0_wp
     ELSE
        maximum_mgcycles = mg_cycles
-       residual_norm    = 0.0
+       residual_norm    = 0.0_wp
     ENDIF
 
@@ -334,5 +334,5 @@
 !
 !--          Residual within topography should be zero
-             r(k,j,i) = r(k,j,i) * ( 1.0 - IBITS( flags(k,j,i), 6, 1 ) )
+             r(k,j,i) = r(k,j,i) * ( 1.0_wp - IBITS( flags(k,j,i), 6, 1 ) )
           ENDDO
        ENDDO
@@ -361,5 +361,5 @@
        r(nzb,:,: ) = r(nzb+1,:,:)
     ELSE
-       r(nzb,:,: ) = 0.0
+       r(nzb,:,: ) = 0.0_wp
     ENDIF
 
@@ -367,5 +367,5 @@
        r(nzt_mg(l)+1,:,: ) = r(nzt_mg(l),:,:)
     ELSE
-       r(nzt_mg(l)+1,:,: ) = 0.0
+       r(nzt_mg(l)+1,:,: ) = 0.0_wp
     ENDIF
 
@@ -508,39 +508,39 @@
                                         ( r(k,j,i) - r(k-1,j+1,i+1) )
 
-             f_mg(kc,jc,ic) = 1.0 / 64.0_wp * (                         &
-                              8.0 * r(k,j,i)                            &
-                            + 4.0 * ( rkjim   + rkjip   +               &
-                                      rkjpi   + rkjmi   )               &
-                            + 2.0 * ( rkjmim  + rkjpim  +               &
-                                      rkjmip  + rkjpip  )               &
-                            + 4.0 * rkmji                               &
-                            + 2.0 * ( rkmjim  + rkmjim  +               &
-                                      rkmjpi  + rkmjmi  )               &
-                            +       ( rkmjmim + rkmjpim +               &
-                                      rkmjmip + rkmjpip )               &
-                            + 4.0 * r(k+1,j,i)                          &
-                            + 2.0 * ( r(k+1,j,i-1)   + r(k+1,j,i+1)   + &
-                                      r(k+1,j+1,i)   + r(k+1,j-1,i)   ) &
-                            +       ( r(k+1,j-1,i-1) + r(k+1,j+1,i-1) + &
-                                      r(k+1,j-1,i+1) + r(k+1,j+1,i+1) ) &
-                                              )
-
-!             f_mg(kc,jc,ic) = 1.0 / 64.0_wp * (                         &
-!                              8.0 * r(k,j,i)                            &
-!                            + 4.0 * ( r(k,j,i-1)     + r(k,j,i+1)     + &
-!                                      r(k,j+1,i)     + r(k,j-1,i)     ) &
-!                            + 2.0 * ( r(k,j-1,i-1)   + r(k,j+1,i-1)   + &
-!                                      r(k,j-1,i+1)   + r(k,j+1,i+1)   ) &
-!                            + 4.0 * r(k-1,j,i)                          &
-!                            + 2.0 * ( r(k-1,j,i-1)   + r(k-1,j,i+1)   + &
-!                                      r(k-1,j+1,i)   + r(k-1,j-1,i)   ) &
-!                            +       ( r(k-1,j-1,i-1) + r(k-1,j+1,i-1) + &
-!                                      r(k-1,j-1,i+1) + r(k-1,j+1,i+1) ) &
-!                            + 4.0 * r(k+1,j,i)                          &
-!                            + 2.0 * ( r(k+1,j,i-1)   + r(k+1,j,i+1)   + &
-!                                      r(k+1,j+1,i)   + r(k+1,j-1,i)   ) &
-!                            +       ( r(k+1,j-1,i-1) + r(k+1,j+1,i-1) + &
-!                                      r(k+1,j-1,i+1) + r(k+1,j+1,i+1) ) &
-!                                              )
+             f_mg(kc,jc,ic) = 1.0_wp / 64.0_wp * (                         &
+                              8.0_wp * r(k,j,i)                            &
+                            + 4.0_wp * ( rkjim   + rkjip   +               &
+                                         rkjpi   + rkjmi   )               &
+                            + 2.0_wp * ( rkjmim  + rkjpim  +               &
+                                         rkjmip  + rkjpip  )               &
+                            + 4.0_wp * rkmji                               &
+                            + 2.0_wp * ( rkmjim  + rkmjim  +               &
+                                         rkmjpi  + rkmjmi  )               &
+                            +          ( rkmjmim + rkmjpim +               &
+                                         rkmjmip + rkmjpip )               &
+                            + 4.0_wp * r(k+1,j,i)                          &
+                            + 2.0_wp * ( r(k+1,j,i-1)   + r(k+1,j,i+1)   + &
+                                         r(k+1,j+1,i)   + r(k+1,j-1,i)   ) &
+                            +          ( r(k+1,j-1,i-1) + r(k+1,j+1,i-1) + &
+                                         r(k+1,j-1,i+1) + r(k+1,j+1,i+1) ) &
+                                                 )
+
+!             f_mg(kc,jc,ic) = 1.0_wp / 64.0_wp * (                         &
+!                              8.0_wp * r(k,j,i)                            &
+!                            + 4.0_wp * ( r(k,j,i-1)     + r(k,j,i+1)     + &
+!                                         r(k,j+1,i)     + r(k,j-1,i)     ) &
+!                            + 2.0_wp * ( r(k,j-1,i-1)   + r(k,j+1,i-1)   + &
+!                                         r(k,j-1,i+1)   + r(k,j+1,i+1)   ) &
+!                            + 4.0_wp * r(k-1,j,i)                          &
+!                            + 2.0_wp * ( r(k-1,j,i-1)   + r(k-1,j,i+1)   + &
+!                                         r(k-1,j+1,i)   + r(k-1,j-1,i)   ) &
+!                            +          ( r(k-1,j-1,i-1) + r(k-1,j+1,i-1) + &
+!                                         r(k-1,j-1,i+1) + r(k-1,j+1,i+1) ) &
+!                            + 4.0_wp * r(k+1,j,i)                          &
+!                            + 2.0_wp * ( r(k+1,j,i-1)   + r(k+1,j,i+1)   + &
+!                                         r(k+1,j+1,i)   + r(k+1,j-1,i)   ) &
+!                            +          ( r(k+1,j-1,i-1) + r(k+1,j+1,i-1) + &
+!                                         r(k+1,j-1,i+1) + r(k+1,j+1,i+1) ) &
+!                                                )
           ENDDO
        ENDDO
@@ -569,5 +569,5 @@
        f_mg(nzb,:,: ) = f_mg(nzb+1,:,:)
     ELSE
-       f_mg(nzb,:,: ) = 0.0
+       f_mg(nzb,:,: ) = 0.0_wp
     ENDIF
 
@@ -575,5 +575,5 @@
        f_mg(nzt_mg(l)+1,:,: ) = f_mg(nzt_mg(l),:,:)
     ELSE
-       f_mg(nzt_mg(l)+1,:,: ) = 0.0
+       f_mg(nzt_mg(l)+1,:,: ) = 0.0_wp
     ENDIF
 
@@ -634,22 +634,22 @@
 ! 
 !--          Points between two coarse-grid points
-             temp(2*k-1,2*j,2*i+1) = 0.5 * ( p(k,j,i) + p(k,j,i+1) )
-             temp(2*k-1,2*j+1,2*i) = 0.5 * ( p(k,j,i) + p(k,j+1,i) )
-             temp(2*k,2*j,2*i)     = 0.5 * ( p(k,j,i) + p(k+1,j,i) )
+             temp(2*k-1,2*j,2*i+1) = 0.5_wp * ( p(k,j,i) + p(k,j,i+1) )
+             temp(2*k-1,2*j+1,2*i) = 0.5_wp * ( p(k,j,i) + p(k,j+1,i) )
+             temp(2*k,2*j,2*i)     = 0.5_wp * ( p(k,j,i) + p(k+1,j,i) )
 !
 !--          Points in the center of the planes stretched by four points
 !--          of the coarse grid cube
-             temp(2*k-1,2*j+1,2*i+1) = 0.25 * ( p(k,j,i)   + p(k,j,i+1) + &
-                                                p(k,j+1,i) + p(k,j+1,i+1) )
-             temp(2*k,2*j,2*i+1)     = 0.25 * ( p(k,j,i)   + p(k,j,i+1) + &
-                                                p(k+1,j,i) + p(k+1,j,i+1) )
-             temp(2*k,2*j+1,2*i)     = 0.25 * ( p(k,j,i)   + p(k,j+1,i) + &
-                                                p(k+1,j,i) + p(k+1,j+1,i) )
+             temp(2*k-1,2*j+1,2*i+1) = 0.25_wp * ( p(k,j,i)   + p(k,j,i+1) + &
+                                                   p(k,j+1,i) + p(k,j+1,i+1) )
+             temp(2*k,2*j,2*i+1)     = 0.25_wp * ( p(k,j,i)   + p(k,j,i+1) + &
+                                                   p(k+1,j,i) + p(k+1,j,i+1) )
+             temp(2*k,2*j+1,2*i)     = 0.25_wp * ( p(k,j,i)   + p(k,j+1,i) + &
+                                                   p(k+1,j,i) + p(k+1,j+1,i) )
 !
 !--          Points in the middle of coarse grid cube
-             temp(2*k,2*j+1,2*i+1) = 0.125 * ( p(k,j,i)     + p(k,j,i+1)   + &
-                                               p(k,j+1,i)   + p(k,j+1,i+1) + &
-                                               p(k+1,j,i)   + p(k+1,j,i+1) + &
-                                               p(k+1,j+1,i) + p(k+1,j+1,i+1) )
+             temp(2*k,2*j+1,2*i+1) = 0.125_wp * ( p(k,j,i)     + p(k,j,i+1)   + &
+                                                  p(k,j+1,i)   + p(k,j+1,i+1) + &
+                                                  p(k+1,j,i)   + p(k+1,j,i+1) + &
+                                                  p(k+1,j+1,i) + p(k+1,j+1,i+1) )
           ENDDO
        ENDDO
@@ -676,5 +676,5 @@
        temp(nzb,:,: ) = temp(nzb+1,:,:)
     ELSE
-       temp(nzb,:,: ) = 0.0
+       temp(nzb,:,: ) = 0.0_wp
     ENDIF
 
@@ -682,5 +682,5 @@
        temp(nzt_mg(l)+1,:,: ) = temp(nzt_mg(l),:,:)
     ELSE
-       temp(nzt_mg(l)+1,:,: ) = 0.0
+       temp(nzt_mg(l)+1,:,: ) = 0.0_wp
     ENDIF
 
@@ -791,5 +791,5 @@
                 DO  j = nys_mg(l) + 2 - color, nyn_mg(l), 2 
                    DO  k = nzb+1, nzt_mg(l), 2
-!                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+!                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
 !                                ddx2_mg(l) * ( p_mg(k,j,i+1) + p_mg(k,j,i-1) ) &
 !                              + ddy2_mg(l) * ( p_mg(k,j+1,i) + p_mg(k,j-1,i) ) &
@@ -798,5 +798,5 @@
 !                                                       )
 
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -821,5 +821,5 @@
                 DO  j = nys_mg(l) + (color-1), nyn_mg(l), 2
                    DO  k = nzb+1, nzt_mg(l), 2 
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -844,5 +844,5 @@
                 DO  j = nys_mg(l) + (color-1), nyn_mg(l), 2
                    DO  k = nzb+2, nzt_mg(l), 2
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -867,5 +867,5 @@
                 DO  j = nys_mg(l) + 2 - color, nyn_mg(l), 2
                    DO  k = nzb+2, nzt_mg(l), 2
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -899,5 +899,5 @@
                    DO  k = nzb+1, nzt_mg(l), 2
                       j = jj
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -916,5 +916,5 @@
                            - f_mg(k,j,i)               )
                       j = jj+2
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -938,5 +938,5 @@
                    DO  k = nzb+1, nzt_mg(l), 2 
                       j =jj
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -955,5 +955,5 @@
                            - f_mg(k,j,i)               )
                       j = jj+2
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -977,5 +977,5 @@
                    DO  k = nzb+2, nzt_mg(l), 2
                       j =jj
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -994,5 +994,5 @@
                            - f_mg(k,j,i)               )
                       j = jj+2
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -1016,5 +1016,5 @@
                    DO  k = nzb+2, nzt_mg(l), 2
                       j =jj
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -1033,5 +1033,5 @@
                            - f_mg(k,j,i)               )
                       j = jj+2
-                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
+                      p_mg(k,j,i) = 1.0_wp / f1_mg(k,l) * (                    &
                              ddx2_mg(l) *                                      &
                                ( p_mg(k,j,i+1) + IBITS( flags(k,j,i), 5, 1 ) * &
@@ -1084,5 +1084,5 @@
              p_mg(nzb,:,: ) = p_mg(nzb+1,:,:)
           ELSE
-             p_mg(nzb,:,: ) = 0.0
+             p_mg(nzb,:,: ) = 0.0_wp
           ENDIF
 
@@ -1090,5 +1090,5 @@
              p_mg(nzt_mg(l)+1,:,: ) = p_mg(nzt_mg(l),:,:)
           ELSE
-             p_mg(nzt_mg(l)+1,:,: ) = 0.0
+             p_mg(nzt_mg(l)+1,:,: ) = 0.0_wp
           ENDIF
 
@@ -1106,5 +1106,5 @@
 !
 !--          First, set pressure inside topography to zero
-             p_mg(k,j,i) = p_mg(k,j,i) * ( 1.0 - IBITS( flags(k,j,i), 6, 1 ) )
+             p_mg(k,j,i) = p_mg(k,j,i) * ( 1.0_wp - IBITS( flags(k,j,i), 6, 1 ) )
 !
 !--          Second, determine if the gridpoint inside topography is adjacent
@@ -1119,11 +1119,11 @@
                           wall_top
 
-             IF ( wall_total > 0.0 )  THEN
-                p_mg(k,j,i) = 1.0 / wall_total *                 &
-                                  ( wall_left  * p_mg(k,j,i-1) + &
-                                    wall_right * p_mg(k,j,i+1) + &
-                                    wall_south * p_mg(k,j-1,i) + &
-                                    wall_north * p_mg(k,j+1,i) + &
-                                    wall_top   * p_mg(k+1,j,i) )
+             IF ( wall_total > 0.0_wp )  THEN
+                p_mg(k,j,i) = 1.0_wp / wall_total *                 &
+                                     ( wall_left  * p_mg(k,j,i-1) + &
+                                       wall_right * p_mg(k,j,i+1) + &
+                                       wall_south * p_mg(k,j-1,i) + &
+                                       wall_north * p_mg(k,j+1,i) + &
+                                       wall_top   * p_mg(k+1,j,i) )
              ENDIF
           ENDDO
@@ -1182,5 +1182,5 @@
     CALL cpu_log( log_point_s(34), 'mg_gather', 'start' )
 
-    f2_l = 0.0
+    f2_l = 0.0_wp
 
 !
@@ -1456,5 +1456,5 @@
        ENDIF
 
-       p2 = 0.0
+       p2 = 0.0_wp
 
 !
Index: /palm/trunk/SOURCE/production_e.f90
===================================================================
--- /palm/trunk/SOURCE/production_e.f90	(revision 1352)
+++ /palm/trunk/SOURCE/production_e.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -647,7 +647,7 @@
                             temp  = theta * t_d_pt(k)
                             k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp *               &
-                                          ( q(k,j,i) - ql(k,j,i) ) *          &
-                                 ( 1.0_wp + 0.622_wp * l_d_r / temp ) ) /        &
-                                 ( 1.0_wp + 0.622_wp * l_d_r * l_d_cp *          &
+                                          ( q(k,j,i) - ql(k,j,i) ) *           &
+                                 ( 1.0_wp + 0.622_wp * l_d_r / temp ) ) /      &
+                                 ( 1.0_wp + 0.622_wp * l_d_r * l_d_cp *        &
                                  ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
                             k2 = theta * ( l_d_cp / temp * k1 - 1.0_wp )
@@ -680,8 +680,8 @@
                             theta = pt(k,j,i) + pt_d_t(k) * l_d_cp * ql(k,j,i)
                             temp  = theta * t_d_pt(k)
-                            k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp *                 &
-                                          ( q(k,j,i) - ql(k,j,i) ) *          &
-                                 ( 1.0_wp + 0.622_wp * l_d_r / temp ) ) /        &
-                                 ( 1.0_wp + 0.622_wp * l_d_r * l_d_cp *          &
+                            k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp *               &
+                                          ( q(k,j,i) - ql(k,j,i) ) *           &
+                                 ( 1.0_wp + 0.622_wp * l_d_r / temp ) ) /      &
+                                 ( 1.0_wp + 0.622_wp * l_d_r * l_d_cp *        &
                                  ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
                             k2 = theta * ( l_d_cp / temp * k1 - 1.0_wp )
@@ -1644,7 +1644,7 @@
              dwdz  =           ( w(k,j,i)   - w(k-1,j,i)   ) * ddzw(k)
 
-             def = 2.0 * ( dudx**2 + dvdy**2 + dwdz**2 ) +           &
+             def = 2.0_wp * ( dudx**2 + dvdy**2 + dwdz**2 ) +        &
                    dudy**2 + dvdx**2 + dwdx**2 + dwdy**2 + dudz**2 + &
-                   dvdz**2 + 2.0 * ( dvdx*dudy + dwdx*dudz + dwdy*dvdz )
+                   dvdz**2 + 2.0_wp * ( dvdx*dudy + dwdx*dudz + dwdy*dvdz )
 
              IF ( def < 0.0_wp )  def = 0.0_wp
Index: /palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- /palm/trunk/SOURCE/prognostic_equations.f90	(revision 1352)
+++ /palm/trunk/SOURCE/prognostic_equations.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -1038,5 +1038,5 @@
     CALL cpu_log( log_point(7), 'w-equation', 'start' )
 
-    tend = 0.0
+    tend = 0.0_wp
     IF ( timestep_scheme(1:5) == 'runge' )  THEN
        IF ( ws_scheme_mom )  THEN
@@ -1121,5 +1121,5 @@
 !
 !--          Bott-Chlond scheme always uses Euler time step. Thus:
-             sbt = 1.0
+             sbt = 1.0_wp
           ENDIF
           tend = 0.0_wp
@@ -1230,5 +1230,5 @@
 !
 !--          Bott-Chlond scheme always uses Euler time step. Thus:
-             sbt = 1.0
+             sbt = 1.0_wp
           ENDIF
           tend = 0.0_wp
@@ -1240,5 +1240,5 @@
 !--    sa-tendency terms with no communication
        IF ( scalar_advec /= 'bc-scheme' )  THEN
-          tend = 0.0
+          tend = 0.0_wp
           IF ( timestep_scheme(1:5) == 'runge' )  THEN
              IF ( ws_scheme_sca )  THEN
@@ -1755,5 +1755,5 @@
 !
 !--          Bott-Chlond scheme always uses Euler time step. Thus:
-             sbt = 1.0
+             sbt = 1.0_wp
           ENDIF
           tend = 0.0_wp
Index: /palm/trunk/SOURCE/run_control.f90
===================================================================
--- /palm/trunk/SOURCE/run_control.f90	(revision 1352)
+++ /palm/trunk/SOURCE/run_control.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -67,4 +67,6 @@
     USE indices,                                                               &
         ONLY:  nzb
+
+    USE kinds
 
     USE pegrid
@@ -118,6 +120,6 @@
                           hom(nzb+10,1,pr_palm,0), u_max_ijk(1:3),             &
                           v_max_ijk(1:3), w_max_ijk(1:3),                      &
-                          advected_distance_x/1000.0,                          &
-                          advected_distance_y/1000.0, mgcycles
+                          advected_distance_x/1000.0_wp,                       &
+                          advected_distance_y/1000.0_wp, mgcycles
 !
 !--    Write buffer contents to disc immediately
Index: /palm/trunk/SOURCE/set_slicer_attributes_dvrp.f90
===================================================================
--- /palm/trunk/SOURCE/set_slicer_attributes_dvrp.f90	(revision 1352)
+++ /palm/trunk/SOURCE/set_slicer_attributes_dvrp.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -69,5 +69,5 @@
     minv = slicer_range_limits_dvrp(1,n_slicer)
     maxv = slicer_range_limits_dvrp(2,n_slicer)
-    meav = ( minv + maxv ) * 0.5
+    meav = ( minv + maxv ) * 0.5_wp
 
 !
@@ -75,13 +75,13 @@
 !-- This table ranges from deep blue (min) to deep red (max)
     DO  j = 1, 50
-       interval_values_dvrp(1,j) = minv + (meav-minv) * (j-1.0) / 50.0
-       interval_values_dvrp(2,j) = minv + (meav-minv) * (  j  ) / 50.0
-       interval_h_dvrp(:,j) = 270.0 - ( j - 1.0 ) * 90.0 / 49.0
+       interval_values_dvrp(1,j) = minv + (meav-minv) * ( j - 1.0_wp ) / 50.0_wp
+       interval_values_dvrp(2,j) = minv + (meav-minv) * ( j )          / 50.0_wp
+       interval_h_dvrp(:,j) = 270.0_wp - ( j - 1.0_wp ) * 90.0_wp / 49.0_wp
     ENDDO
 
     DO  j = 51, 100
-       interval_values_dvrp(1,j) = meav + (maxv-meav) * (j-51.0) / 50.0
-       interval_values_dvrp(2,j) = meav + (maxv-meav) * (j-50.0) / 50.0
-       interval_h_dvrp(:,j) = 70.0 - ( j - 51.0 ) * 90.0 / 49.0
+       interval_values_dvrp(1,j) = meav + (maxv-meav) * ( j - 51.0_wp ) / 50.0_wp
+       interval_values_dvrp(2,j) = meav + (maxv-meav) * ( j - 50.0_wp ) / 50.0_wp
+       interval_h_dvrp(:,j) = 70.0_wp - ( j - 51.0_wp ) * 90.0_wp / 49.0_wp
     ENDDO
 
Index: /palm/trunk/SOURCE/sor.f90
===================================================================
--- /palm/trunk/SOURCE/sor.f90	(revision 1352)
+++ /palm/trunk/SOURCE/sor.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -88,5 +88,5 @@
          f2(k) = ddzu(k+1) * ddzw(k)
          f3(k) = ddzu(k)   * ddzw(k)
-         f1(k) = 2.0 * ( ddx2 + ddy2 ) + f2(k) + f3(k)
+         f1(k) = 2.0_wp * ( ddx2 + ddy2 ) + f2(k) + f3(k)
     ENDDO
 
@@ -195,5 +195,5 @@
           p(nzb,:,:) = p(nzb+1,:,:)
        ELSE                            !       Dirichlet
-          p(nzb,:,:) = 0.0
+          p(nzb,:,:) = 0.0_wp
        ENDIF
 
@@ -203,5 +203,5 @@
           p(nzt+1,:,:) = p(nzt,:,:)
        ELSE                      !  Dirichlet
-          p(nzt+1,:,:) = 0.0
+          p(nzt+1,:,:) = 0.0_wp
        ENDIF
 
Index: /palm/trunk/SOURCE/subsidence.f90
===================================================================
--- /palm/trunk/SOURCE/subsidence.f90	(revision 1352)
+++ /palm/trunk/SOURCE/subsidence.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -89,5 +89,5 @@
        IF ( .NOT. ALLOCATED( w_subs )) THEN
           ALLOCATE( w_subs(nzb:nzt+1) )
-          w_subs = 0.0
+          w_subs = 0.0_wp
        ENDIF 
 
@@ -102,6 +102,6 @@
 !--   using the given gradients
       i = 1
-      gradient = 0.0
-      ws_surface = 0.0
+      gradient = 0.0_wp
+      ws_surface = 0.0_wp
       
 
@@ -110,15 +110,15 @@
          IF ( i < 11 ) THEN
             IF ( subs_vertical_gradient_level(i) < zu(k)  .AND. &
-                 subs_vertical_gradient_level(i) >= 0.0 )  THEN
-               gradient = subs_vertical_gradient(i) / 100.0
+                 subs_vertical_gradient_level(i) >= 0.0_wp )  THEN
+               gradient = subs_vertical_gradient(i) / 100.0_wp
                subs_vertical_gradient_level_i(i) = k - 1
                i = i + 1
             ENDIF
          ENDIF
-         IF ( gradient /= 0.0 )  THEN
+         IF ( gradient /= 0.0_wp )  THEN
             IF ( k /= 1 )  THEN
                w_subs(k) = w_subs(k-1) + dzu(k) * gradient
             ELSE
-               w_subs(k) = ws_surface   + 0.5 * dzu(k) * gradient
+               w_subs(k) = ws_surface   + 0.5_wp * dzu(k) * gradient
             ENDIF
          ELSE
@@ -130,6 +130,6 @@
 !--   In case of no given gradients for the subsidence/ascent velocity,
 !--   choose zero gradient
-      IF ( subs_vertical_gradient_level(1) == -9999999.9 )  THEN
-         subs_vertical_gradient_level(1) = 0.0
+      IF ( subs_vertical_gradient_level(1) == -9999999.9_wp )  THEN
+         subs_vertical_gradient_level(1) = 0.0_wp
       ENDIF
 
@@ -171,5 +171,5 @@
           DO  j = nys, nyn
              DO  k = nzb_s_inner(j,i)+1, nzt 
-                IF ( w_subs(k) < 0.0 ) THEN    ! large-scale subsidence
+                IF ( w_subs(k) < 0.0_wp ) THEN    ! large-scale subsidence
                    tendency(k,j,i) = tendency(k,j,i) - w_subs(k) *  &
                                      ( var(k+1,j,i) - var(k,j,i) ) * ddzu(k+1)
@@ -187,5 +187,5 @@
 
        DO  k = nzb, nzt
-          IF ( w_subs(k) < 0.0 ) THEN      ! large-scale subsidence
+          IF ( w_subs(k) < 0.0_wp ) THEN      ! large-scale subsidence
              var_mod(k) = var_init(k) - dt_3d * w_subs(k) *  &
                                ( var_init(k+1) - var_init(k) ) * ddzu(k+1)
@@ -195,5 +195,5 @@
 !--   At the upper boundary, the initial profile is shifted with aid of 
 !--   the gradient tmp_grad. (This is ok if the gradients are linear.)
-      IF ( w_subs(nzt) < 0.0 ) THEN
+      IF ( w_subs(nzt) < 0.0_wp ) THEN
          tmp_grad = ( var_init(nzt+1) - var_init(nzt) ) * ddzu(nzt+1)
          var_mod(nzt+1) = var_init(nzt+1) -  &
@@ -203,5 +203,5 @@
 
       DO  k = nzt+1, nzb+1, -1
-         IF ( w_subs(k) >= 0.0 ) THEN  ! large-scale ascent
+         IF ( w_subs(k) >= 0.0_wp ) THEN  ! large-scale ascent
             var_mod(k) = var_init(k) - dt_3d * w_subs(k) *  &
                                ( var_init(k) - var_init(k-1) ) * ddzu(k) 
@@ -213,5 +213,5 @@
 
 
-      IF ( w_subs(nzb+1) >= 0.0 ) THEN
+      IF ( w_subs(nzb+1) >= 0.0_wp ) THEN
          var_mod(nzb) = var_init(nzb)
       ENDIF
@@ -253,5 +253,5 @@
 !--    Influence of w_subsidence on the current tendency term
        DO  k = nzb_s_inner(j,i)+1, nzt 
-          IF ( w_subs(k) < 0.0 ) THEN      ! large-scale subsidence
+          IF ( w_subs(k) < 0.0_wp ) THEN      ! large-scale subsidence
              tendency(k,j,i) = tendency(k,j,i) - w_subs(k) *  &
                                ( var(k+1,j,i) - var(k,j,i) ) * ddzu(k+1)
@@ -269,5 +269,5 @@
 
           DO  k = nzb, nzt
-             IF ( w_subs(k) < 0.0 ) THEN      ! large-scale subsidence
+             IF ( w_subs(k) < 0.0_wp ) THEN      ! large-scale subsidence
                 var_mod(k) = var_init(k) - dt_3d * w_subs(k) *  &
                                   ( var_init(k+1) - var_init(k) ) * ddzu(k+1)
@@ -277,5 +277,5 @@
 !--       At the upper boundary, the initial profile is shifted with aid of 
 !--       the gradient tmp_grad. (This is ok if the gradients are linear.)
-          IF ( w_subs(nzt) < 0.0 ) THEN
+          IF ( w_subs(nzt) < 0.0_wp ) THEN
              tmp_grad = ( var_init(nzt+1) - var_init(nzt) ) * ddzu(nzt+1)
              var_mod(nzt+1) = var_init(nzt+1) -  &
@@ -285,5 +285,5 @@
 
           DO  k = nzt+1, nzb+1, -1
-             IF ( w_subs(k) >= 0.0 ) THEN  ! large-scale ascent
+             IF ( w_subs(k) >= 0.0_wp ) THEN  ! large-scale ascent
                 var_mod(k) = var_init(k) - dt_3d * w_subs(k) *  &
                                    ( var_init(k) - var_init(k-1) ) * ddzu(k)
@@ -295,5 +295,5 @@
 
 
-          IF ( w_subs(nzb+1) >= 0.0 ) THEN
+          IF ( w_subs(nzb+1) >= 0.0_wp ) THEN
              var_mod(nzb) = var_init(nzb)
           ENDIF
Index: /palm/trunk/SOURCE/sum_up_3d_data.f90
===================================================================
--- /palm/trunk/SOURCE/sum_up_3d_data.f90	(revision 1352)
+++ /palm/trunk/SOURCE/sum_up_3d_data.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -121,5 +121,5 @@
                    ALLOCATE( e_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                e_av = 0.0
+                e_av = 0.0_wp
 
              CASE ( 'lpt' )
@@ -127,5 +127,5 @@
                    ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                lpt_av = 0.0
+                lpt_av = 0.0_wp
 
              CASE ( 'lwp*' )
@@ -133,5 +133,5 @@
                    ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                lwp_av = 0.0
+                lwp_av = 0.0_wp
 
              CASE ( 'nr' )
@@ -139,5 +139,5 @@
                    ALLOCATE( nr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                nr_av = 0.0
+                nr_av = 0.0_wp
 
              CASE ( 'p' )
@@ -145,5 +145,5 @@
                    ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                p_av = 0.0
+                p_av = 0.0_wp
 
              CASE ( 'pc' )
@@ -151,5 +151,5 @@
                    ALLOCATE( pc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                pc_av = 0.0
+                pc_av = 0.0_wp
 
              CASE ( 'pr' )
@@ -157,5 +157,5 @@
                    ALLOCATE( pr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                pr_av = 0.0
+                pr_av = 0.0_wp
 
              CASE ( 'prr' )
@@ -163,5 +163,5 @@
                    ALLOCATE( prr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                prr_av = 0.0
+                prr_av = 0.0_wp
 
              CASE ( 'prr*' )
@@ -169,5 +169,5 @@
                    ALLOCATE( precipitation_rate_av(nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                precipitation_rate_av = 0.0
+                precipitation_rate_av = 0.0_wp
 
              CASE ( 'pt' )
@@ -175,5 +175,5 @@
                    ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                pt_av = 0.0
+                pt_av = 0.0_wp
 
              CASE ( 'q' )
@@ -181,5 +181,5 @@
                    ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                q_av = 0.0
+                q_av = 0.0_wp
 
              CASE ( 'qc' )
@@ -187,5 +187,5 @@
                    ALLOCATE( qc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                qc_av = 0.0
+                qc_av = 0.0_wp
 
              CASE ( 'ql' )
@@ -193,5 +193,5 @@
                    ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                ql_av = 0.0
+                ql_av = 0.0_wp
 
              CASE ( 'ql_c' )
@@ -199,5 +199,5 @@
                    ALLOCATE( ql_c_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                ql_c_av = 0.0
+                ql_c_av = 0.0_wp
 
              CASE ( 'ql_v' )
@@ -205,5 +205,5 @@
                    ALLOCATE( ql_v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                ql_v_av = 0.0
+                ql_v_av = 0.0_wp
 
              CASE ( 'ql_vp' )
@@ -211,5 +211,5 @@
                    ALLOCATE( ql_vp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                ql_vp_av = 0.0
+                ql_vp_av = 0.0_wp
 
              CASE ( 'qr' )
@@ -217,5 +217,5 @@
                    ALLOCATE( qr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                qr_av = 0.0
+                qr_av = 0.0_wp
 
              CASE ( 'qsws*' )
@@ -223,5 +223,5 @@
                    ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                qsws_av = 0.0
+                qsws_av = 0.0_wp
 
              CASE ( 'qv' )
@@ -229,5 +229,5 @@
                    ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                qv_av = 0.0
+                qv_av = 0.0_wp
 
              CASE ( 'rho' )
@@ -235,5 +235,5 @@
                    ALLOCATE( rho_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                rho_av = 0.0
+                rho_av = 0.0_wp
 
              CASE ( 's' )
@@ -241,5 +241,5 @@
                    ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                s_av = 0.0
+                s_av = 0.0_wp
 
              CASE ( 'sa' )
@@ -247,5 +247,5 @@
                    ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                sa_av = 0.0
+                sa_av = 0.0_wp
 
              CASE ( 'shf*' )
@@ -253,5 +253,5 @@
                    ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                shf_av = 0.0
+                shf_av = 0.0_wp
 
              CASE ( 't*' )
@@ -259,5 +259,5 @@
                    ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                ts_av = 0.0
+                ts_av = 0.0_wp
 
              CASE ( 'u' )
@@ -265,5 +265,5 @@
                    ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                u_av = 0.0
+                u_av = 0.0_wp
 
              CASE ( 'u*' )
@@ -271,5 +271,5 @@
                    ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                us_av = 0.0
+                us_av = 0.0_wp
 
              CASE ( 'v' )
@@ -277,5 +277,5 @@
                    ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                v_av = 0.0
+                v_av = 0.0_wp
 
              CASE ( 'vpt' )
@@ -283,5 +283,5 @@
                    ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                vpt_av = 0.0
+                vpt_av = 0.0_wp
 
              CASE ( 'w' )
@@ -289,5 +289,5 @@
                    ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                w_av = 0.0
+                w_av = 0.0_wp
 
              CASE ( 'z0*' )
@@ -295,5 +295,5 @@
                    ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                z0_av = 0.0
+                z0_av = 0.0_wp
 
              CASE ( 'z0h*' )
@@ -301,5 +301,5 @@
                    ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) )
                 ENDIF
-                z0h_av = 0.0
+                z0h_av = 0.0_wp
 
              CASE DEFAULT
@@ -380,6 +380,6 @@
                    DO  k = nzb, nzt+1
                       psi = prt_start_index(k,j,i)
-                      s_r3 = 0.0
-                      s_r4 = 0.0
+                      s_r3 = 0.0_wp
+                      s_r4 = 0.0_wp
                       DO  n = psi, psi+prt_count(k,j,i)-1
                          s_r3 = s_r3 + particles(n)%radius**3 * &
@@ -388,8 +388,8 @@
                                        particles(n)%weight_factor
                       ENDDO
-                      IF ( s_r3 /= 0.0 )  THEN
+                      IF ( s_r3 /= 0.0_wp )  THEN
                          mean_r = s_r4 / s_r3
                       ELSE
-                         mean_r = 0.0
+                         mean_r = 0.0_wp
                       ENDIF
                       pr_av(k,j,i) = pr_av(k,j,i) + mean_r
Index: /palm/trunk/SOURCE/surface_coupler.f90
===================================================================
--- /palm/trunk/SOURCE/surface_coupler.f90	(revision 1352)
+++ /palm/trunk/SOURCE/surface_coupler.f90	(revision 1353)
@@ -20,4 +20,5 @@
 ! Current revisions:
 ! ------------------
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -206,6 +207,6 @@
 !
 !--       Send heat flux at bottom surface to the ocean
-          total_2d_a = 0.0
-          total_2d   = 0.0
+          total_2d_a = 0.0_wp
+          total_2d   = 0.0_wp
           total_2d(nys:nyn,nxl:nxr) = shf(nys:nyn,nxl:nxr)
 
@@ -216,6 +217,6 @@
 !--       Send humidity flux at bottom surface to the ocean
           IF ( humidity )  THEN
-             total_2d_a = 0.0
-             total_2d   = 0.0
+             total_2d_a = 0.0_wp
+             total_2d   = 0.0_wp
              total_2d(nys:nyn,nxl:nxr) = qsws(nys:nyn,nxl:nxr)
 
@@ -236,6 +237,6 @@
 !
 !--       Send momentum flux (u) at bottom surface to the ocean
-          total_2d_a = 0.0 
-          total_2d   = 0.0
+          total_2d_a = 0.0_wp 
+          total_2d   = 0.0_wp
           total_2d(nys:nyn,nxl:nxr) = usws(nys:nyn,nxl:nxr)
           CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, MPI_SUM, 0, &
@@ -244,6 +245,6 @@
 !
 !--       Send momentum flux (v) at bottom surface to the ocean
-          total_2d_a = 0.0
-          total_2d   = 0.0
+          total_2d_a = 0.0_wp
+          total_2d   = 0.0_wp
           total_2d(nys:nyn,nxl:nxr) = vsws(nys:nyn,nxl:nxr)
           CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, MPI_SUM, 0, &
@@ -338,6 +339,6 @@
 !
 !--       Send surface temperature to atmosphere
-          total_2d_o = 0.0
-          total_2d   = 0.0
+          total_2d_o = 0.0_wp
+          total_2d   = 0.0_wp
           total_2d(nys:nyn,nxl:nxr) = pt(nzt,nys:nyn,nxl:nxr)
 
@@ -367,6 +368,6 @@
 !
 !--       Send u to atmosphere
-          total_2d_o = 0.0  
-          total_2d   = 0.0
+          total_2d_o = 0.0_wp  
+          total_2d   = 0.0_wp
           total_2d(nys:nyn,nxl:nxr) = u(nzt,nys:nyn,nxl:nxr)
           CALL MPI_REDUCE( total_2d, total_2d_o, ngp_o, MPI_REAL, MPI_SUM, 0, &
@@ -375,6 +376,6 @@
 !
 !--       Send v to atmosphere
-          total_2d_o = 0.0
-          total_2d   = 0.0
+          total_2d_o = 0.0_wp
+          total_2d   = 0.0_wp
           total_2d(nys:nyn,nxl:nxr) = v(nzt,nys:nyn,nxl:nxr)
           CALL MPI_REDUCE( total_2d, total_2d_o, ngp_o, MPI_REAL, MPI_SUM, 0, &
@@ -396,6 +397,6 @@
 !--       following Steinhorn (1991), JPO 21, pp. 1681-1683:
 !--       S'w' = -S * evaporation / ( rho_water * ( 1 - S ) )
-          saswst = -1.0 * sa(nzt,:,:) * qswst_remote /  &
-                    ( rho(nzt,:,:) * ( 1.0 - sa(nzt,:,:) ) )
+          saswst = -1.0_wp * sa(nzt,:,:) * qswst_remote /  &
+                    ( rho(nzt,:,:) * ( 1.0_wp - sa(nzt,:,:) ) )
        ENDIF
 
@@ -474,5 +475,5 @@
        dny2 = 2 * ( dny / 2 )
 
-       total_2d_a = 0.0
+       total_2d_a = 0.0_wp
 !
 !--    Interpolation from ocean-grid-layer to atmosphere-grid-layer
Index: /palm/trunk/SOURCE/user_3d_data_averaging.f90
===================================================================
--- /palm/trunk/SOURCE/user_3d_data_averaging.f90	(revision 1352)
+++ /palm/trunk/SOURCE/user_3d_data_averaging.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -78,5 +78,5 @@
 !                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
 !             ENDIF
-!             u2_av = 0.0
+!             u2_av = 0.0_wp
 
           CASE DEFAULT
Index: /palm/trunk/SOURCE/user_actions.f90
===================================================================
--- /palm/trunk/SOURCE/user_actions.f90	(revision 1352)
+++ /palm/trunk/SOURCE/user_actions.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! REAL constants provided with KIND-attribute
 ! 
 ! Former revisions:
@@ -117,6 +117,6 @@
 !                   DO  k = nzb, nzt+1
 !                      ustvst(k,j,i) =  &
-!                         ( 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,0) ) * &
-!                         ( 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,0) )
+!                         ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,0) ) * &
+!                         ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,0) )
 !                   ENDDO
 !                ENDDO
Index: /palm/trunk/SOURCE/user_init.f90
===================================================================
--- /palm/trunk/SOURCE/user_init.f90	(revision 1352)
+++ /palm/trunk/SOURCE/user_init.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -61,5 +61,5 @@
 !-- Sample for user-defined output
 !    ALLOCATE( u2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-!    ALLOCATE( ustvst(nzb:nzt+1,nysg:nyng,nxlg:nxrg) );  ustvst = 0.0
+!    ALLOCATE( ustvst(nzb:nzt+1,nysg:nyng,nxlg:nxrg) );  ustvst = 0.0_wp
 
 !-- Sample for user-defined time series
Index: /palm/trunk/SOURCE/user_init_plant_canopy.f90
===================================================================
--- /palm/trunk/SOURCE/user_init_plant_canopy.f90	(revision 1352)
+++ /palm/trunk/SOURCE/user_init_plant_canopy.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -86,6 +86,6 @@
 !                ENDDO
 !             ELSE
-!                lad_s(:,:,i) = 0.0
-!                cdc(:,:,i)   = 0.0
+!                lad_s(:,:,i) = 0.0_wp
+!                cdc(:,:,i)   = 0.0_wp
 !             ENDIF
 !          ENDDO 
Index: /palm/trunk/SOURCE/user_statistics.f90
===================================================================
--- /palm/trunk/SOURCE/user_statistics.f90	(revision 1352)
+++ /palm/trunk/SOURCE/user_statistics.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute 
 !
 ! Former revisions:
@@ -98,6 +98,6 @@
 !!--             horizontal momentum flux u*v*
 !                sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) +               &
-!                      ( 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) *     &
-!                      ( 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) )       &
+!                      ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) *     &
+!                      ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) )       &
 !                                                 * rmask(j,i,sr)
 !!
@@ -117,5 +117,5 @@
 !--    creates two time series for the absolut values of the horizontal
 !--    velocities u and v.
-!       ts_value_l = 0.0
+!       ts_value_l = 0.0_wp
 !       ts_value_l(dots_num_palm+1) = ABS( u_max )
 !       ts_value_l(dots_num_palm+2) = ABS( v_max )
Index: /palm/trunk/SOURCE/wall_fluxes.f90
===================================================================
--- /palm/trunk/SOURCE/wall_fluxes.f90	(revision 1352)
+++ /palm/trunk/SOURCE/wall_fluxes.f90	(revision 1353)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! REAL constants provided with KIND-attribute
 !
 ! Former revisions:
@@ -148,6 +148,6 @@
 
 
-       zp         = 0.5 * ( (a+c1) * dy + (b+c2) * dx )
-       wall_flux  = 0.0
+       zp         = 0.5_wp * ( (a+c1) * dy + (b+c2) * dx )
+       wall_flux  = 0.0_wp
        wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 )
 
@@ -155,5 +155,5 @@
           DO  j = nys, nyn
 
-             IF ( wall(j,i) /= 0.0 )  THEN
+             IF ( wall(j,i) /= 0.0_wp )  THEN
 !
 !--             All subsequent variables are computed for the respective
@@ -165,15 +165,15 @@
                    rifs  = rif_wall(k,j,i,wall_index)
 
-                   u_i   = a * u(k,j,i) + c1 * 0.25 *                          &
+                   u_i   = a * u(k,j,i) + c1 * 0.25_wp *                       &
                            ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) )
 
-                   v_i   = b * v(k,j,i) + c2 * 0.25 *                          &
+                   v_i   = b * v(k,j,i) + c2 * 0.25_wp *                       &
                            ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) )
 
-                   ws    = ( c1 + c2 ) * w(k,j,i) + 0.25 * (                   &
+                   ws    = ( c1 + c2 ) * w(k,j,i) + 0.25_wp * (                &
                      a * ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + w(k,j,i) ) &
                    + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) &
-                                                           )
-                   pt_i  = 0.5 * ( pt(k,j,i) + a *  pt(k,j,i-1) +              &
+                                                              )
+                   pt_i  = 0.5_wp * ( pt(k,j,i) + a *  pt(k,j,i-1) +           &
                                    b * pt(k,j-1,i) + ( c1 + c2 ) * pt(k+1,j,i) )
 
@@ -187,10 +187,10 @@
 !
 !--                (3) Compute wall friction velocity us_wall
-                   IF ( rifs >= 0.0 )  THEN
+                   IF ( rifs >= 0.0_wp )  THEN
 
 !
 !--                   Stable stratification (and neutral)
                       us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) +    &
-                                            5.0 * rifs * ( zp - z0(j,i) ) / zp &
+                                         5.0_wp * rifs * ( zp - z0(j,i) ) / zp &
                                                     )
                    ELSE
@@ -198,12 +198,12 @@
 !
 !--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-                      h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
                       us_wall = kappa * vel_total / (                          &
                            LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                                ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                                2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
+                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
+                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
                                                     )
                    ENDIF
@@ -212,6 +212,6 @@
 !--                (4) Compute zp/L (corresponds to neutral Richardson flux
 !--                    number rifs)
-                   rifs = -1.0 * zp * kappa * g * wspts / ( pt_i *             &
-                                                        ( us_wall**3 + 1E-30 ) )
+                   rifs = -1.0_wp * zp * kappa * g * wspts /                   &
+                          ( pt_i * ( us_wall**3 + 1E-30 ) )
 
 !
@@ -227,5 +227,5 @@
 !
 !--                (5) Compute wall_flux (u'v', v'u', w'v', or w'u')
-                   IF ( rifs >= 0.0 )  THEN
+                   IF ( rifs >= 0.0_wp )  THEN
 
 !
@@ -234,5 +234,5 @@
                               ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / &
                               (  LOG( zp / z0(j,i) ) +                         &
-                                 5.0 * rifs * ( zp - z0(j,i) ) / zp            &
+                                 5.0_wp * rifs * ( zp - z0(j,i) ) / zp         &
                               )
                    ELSE
@@ -240,13 +240,13 @@
 !
 !--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-                      h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
                       wall_flux(k,j,i) = kappa *                               &
                            ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / (  &
                            LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                                ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                                2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
+                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
+                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
                                                                             )
                    ENDIF
@@ -333,6 +333,6 @@
 
 
-       zp         = 0.5 * ( (a+c1) * dy + (b+c2) * dx )
-       wall_flux  = 0.0
+       zp         = 0.5_wp * ( (a+c1) * dy + (b+c2) * dx )
+       wall_flux  = 0.0_wp
        wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 )
 
@@ -346,5 +346,5 @@
           DO  j = j_south, j_north
 
-             IF ( wall(j,i) /= 0.0 )  THEN
+             IF ( wall(j,i) /= 0.0_wp )  THEN
 !
 !--             All subsequent variables are computed for the respective
@@ -357,15 +357,15 @@
                    rifs  = rif_wall(k,j,i,wall_index)
 
-                   u_i   = a * u(k,j,i) + c1 * 0.25 *                          &
+                   u_i   = a * u(k,j,i) + c1 * 0.25_wp *                       &
                            ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) )
 
-                   v_i   = b * v(k,j,i) + c2 * 0.25 *                          &
+                   v_i   = b * v(k,j,i) + c2 * 0.25_wp *                       &
                            ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) )
 
-                   ws    = ( c1 + c2 ) * w(k,j,i) + 0.25 * (                   &
+                   ws    = ( c1 + c2 ) * w(k,j,i) + 0.25_wp * (                &
                      a * ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + w(k,j,i) ) &
                    + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) &
-                                                           )
-                   pt_i  = 0.5 * ( pt(k,j,i) + a *  pt(k,j,i-1) +              &
+                                                              )
+                   pt_i  = 0.5_wp * ( pt(k,j,i) + a *  pt(k,j,i-1) +           &
                                    b * pt(k,j-1,i) + ( c1 + c2 ) * pt(k+1,j,i) )
 
@@ -379,10 +379,10 @@
 !
 !--                (3) Compute wall friction velocity us_wall
-                   IF ( rifs >= 0.0 )  THEN
+                   IF ( rifs >= 0.0_wp )  THEN
 
 !
 !--                   Stable stratification (and neutral)
                       us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) +    &
-                                            5.0 * rifs * ( zp - z0(j,i) ) / zp &
+                                         5.0_wp * rifs * ( zp - z0(j,i) ) / zp &
                                                     )
                    ELSE
@@ -390,12 +390,12 @@
 !
 !--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-                      h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
                       us_wall = kappa * vel_total / (                          &
                            LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                                ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                                2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
+                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
+                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
                                                     )
                    ENDIF
@@ -404,6 +404,6 @@
 !--                (4) Compute zp/L (corresponds to neutral Richardson flux
 !--                    number rifs)
-                   rifs = -1.0 * zp * kappa * g * wspts / ( pt_i *             &
-                                                        ( us_wall**3 + 1E-30 ) )
+                   rifs = -1.0_wp * zp * kappa * g * wspts /                   &
+                          ( pt_i * ( us_wall**3 + 1E-30 ) )
 
 !
@@ -419,5 +419,5 @@
 !
 !--                (5) Compute wall_flux (u'v', v'u', w'v', or w'u')
-                   IF ( rifs >= 0.0 )  THEN
+                   IF ( rifs >= 0.0_wp )  THEN
 
 !
@@ -426,5 +426,5 @@
                               ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / &
                               (  LOG( zp / z0(j,i) ) +                         &
-                                 5.0 * rifs * ( zp - z0(j,i) ) / zp            &
+                                 5.0_wp * rifs * ( zp - z0(j,i) ) / zp         &
                               )
                    ELSE
@@ -432,13 +432,13 @@
 !
 !--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-                      h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
                       wall_flux(k,j,i) = kappa *                               &
                            ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / (  &
                            LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                                ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                                2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
+                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
+                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
                                                                             )
                    ENDIF
@@ -511,6 +511,6 @@
 
 
-       zp         = 0.5 * ( (a+c1) * dy + (b+c2) * dx )
-       wall_flux  = 0.0
+       zp         = 0.5_wp * ( (a+c1) * dy + (b+c2) * dx )
+       wall_flux  = 0.0_wp
        wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 )
 
@@ -524,15 +524,15 @@
           rifs  = rif_wall(k,j,i,wall_index)
 
-          u_i   = a * u(k,j,i) + c1 * 0.25 *                                   &
+          u_i   = a * u(k,j,i) + c1 * 0.25_wp *                                &
                   ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) )
 
-          v_i   = b * v(k,j,i) + c2 * 0.25 *                                   &
+          v_i   = b * v(k,j,i) + c2 * 0.25_wp *                                &
                   ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) )
 
-          ws    = ( c1 + c2 ) * w(k,j,i) + 0.25 * (                            &
+          ws    = ( c1 + c2 ) * w(k,j,i) + 0.25_wp * (                         &
                      a * ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + w(k,j,i) ) &
                    + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) &
-                                                  )
-          pt_i  = 0.5 * ( pt(k,j,i) + a *  pt(k,j,i-1) + b * pt(k,j-1,i)       &
+                                                     )
+          pt_i  = 0.5_wp * ( pt(k,j,i) + a *  pt(k,j,i-1) + b * pt(k,j-1,i)    &
                           + ( c1 + c2 ) * pt(k+1,j,i) )
 
@@ -546,10 +546,10 @@
 !
 !--       (3) Compute wall friction velocity us_wall
-          IF ( rifs >= 0.0 )  THEN
+          IF ( rifs >= 0.0_wp )  THEN
 
 !
 !--          Stable stratification (and neutral)
              us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) +             &
-                                            5.0 * rifs * ( zp - z0(j,i) ) / zp &
+                                         5.0_wp * rifs * ( zp - z0(j,i) ) / zp &
                                            )
           ELSE
@@ -557,12 +557,12 @@
 !
 !--          Unstable stratification
-             h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-             h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+             h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+             h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
              us_wall = kappa * vel_total / (                                   &
                   LOG( zp / z0(j,i) ) -                                        &
-                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (                   &
-                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +               &
-                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )                       &
+                  LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (             &
+                       ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +         &
+                       2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )                    &
                                            )
           ENDIF
@@ -571,5 +571,6 @@
 !--       (4) Compute zp/L (corresponds to neutral Richardson flux number 
 !--           rifs)
-          rifs = -1.0 * zp * kappa * g * wspts / ( pt_i * (us_wall**3 + 1E-30) )
+          rifs = -1.0_wp * zp * kappa * g * wspts /                            &
+                  ( pt_i * (us_wall**3 + 1E-30) )
 
 !
@@ -584,5 +585,5 @@
 !
 !--       (5) Compute wall_flux (u'v', v'u', w'v', or w'u')
-          IF ( rifs >= 0.0 )  THEN
+          IF ( rifs >= 0.0_wp )  THEN
 
 !
@@ -591,5 +592,5 @@
                             ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) /   &
                             (  LOG( zp / z0(j,i) ) +                           &
-                               5.0 * rifs * ( zp - z0(j,i) ) / zp              &
+                               5.0_wp * rifs * ( zp - z0(j,i) ) / zp           &
                             )
           ELSE
@@ -597,13 +598,13 @@
 !
 !--          Unstable stratification
-             h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-             h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+             h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+             h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
              wall_flux(k) = kappa *                                            &
                   ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / (           &
                   LOG( zp / z0(j,i) ) -                                        &
-                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (                   &
-                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +               &
-                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )                       &
+                  LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (             &
+                       ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +         &
+                       2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )                    &
                                                                    )
           ENDIF
@@ -680,6 +681,6 @@
 
 
-       zp         = 0.5 * ( (a+c1) * dy + (b+c2) * dx )
-       wall_flux  = 0.0
+       zp         = 0.5_wp * ( (a+c1) * dy + (b+c2) * dx )
+       wall_flux  = 0.0_wp
        wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 )
 
@@ -687,5 +688,5 @@
           DO  j = nys, nyn
 
-             IF ( wall(j,i) /= 0.0 )  THEN
+             IF ( wall(j,i) /= 0.0_wp )  THEN
 !
 !--             All subsequent variables are computed for scalar locations.
@@ -698,25 +699,27 @@
                       kk = k-1
                    ENDIF
-                   rifs  = 0.5 * ( rif_wall(k,j,i,wall_index) +                &
-                          a * rif_wall(k,j,i+1,1) +  b * rif_wall(k,j+1,i,2) + &
-                          c1 * rif_wall(kk,j,i,3) + c2 * rif_wall(kk,j,i,4)    &
-                                 )
-
-                   u_i   = 0.5 * ( u(k,j,i) + u(k,j,i+1) )
-                   v_i   = 0.5 * ( v(k,j,i) + v(k,j+1,i) )
-                   ws    = 0.5 * ( w(k,j,i) + w(k-1,j,i) )
+                   rifs  = 0.5_wp * (      rif_wall(k,j,i,wall_index) +        &
+                                      a  * rif_wall(k,j,i+1,1)        +        &
+                                      b  * rif_wall(k,j+1,i,2)        +        &
+                                      c1 * rif_wall(kk,j,i,3)         +        &
+                                      c2 * rif_wall(kk,j,i,4)                  &
+                                    )
+
+                   u_i   = 0.5_wp * ( u(k,j,i) + u(k,j,i+1) )
+                   v_i   = 0.5_wp * ( v(k,j,i) + v(k,j+1,i) )
+                   ws    = 0.5_wp * ( w(k,j,i) + w(k-1,j,i) )
 !
 !--                (2) Compute wall-parallel absolute velocity vel_total and
 !--                interpolate appropriate velocity component vel_zp.
                    vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 )
-                   vel_zp = 0.5 * ( a * u_i + b * v_i + (c1+c2) * ws )
+                   vel_zp    = 0.5_wp * ( a * u_i + b * v_i + (c1+c2) * ws )
 !
 !--                (3) Compute wall friction velocity us_wall
-                   IF ( rifs >= 0.0 )  THEN
+                   IF ( rifs >= 0.0_wp )  THEN
 
 !
 !--                   Stable stratification (and neutral)
                       us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) +    &
-                                            5.0 * rifs * ( zp - z0(j,i) ) / zp &
+                                         5.0_wp * rifs * ( zp - z0(j,i) ) / zp &
                                                     )
                    ELSE
@@ -724,12 +727,12 @@
 !
 !--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-                      h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
                       us_wall = kappa * vel_total / (                          &
                            LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                                ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                                2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
+                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
+                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
                                                     )
                    ENDIF
@@ -741,22 +744,22 @@
 !--                (5) Compute wall_flux (u'v', v'u', w'v', or w'u')
 
-                   IF ( rifs >= 0.0 )  THEN
+                   IF ( rifs >= 0.0_wp )  THEN
 
 !
 !--                   Stable stratification (and neutral)
-                      wall_flux(k,j,i) = kappa *  vel_zp /                     &
-                          ( LOG( zp/z0(j,i) ) + 5.0*rifs * ( zp-z0(j,i) ) / zp )
+                      wall_flux(k,j,i) = kappa * vel_zp / ( LOG( zp/z0(j,i) ) +&
+                                         5.0_wp * rifs * ( zp-z0(j,i) ) / zp )
                    ELSE
 
 !
 !--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-                      h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
                       wall_flux(k,j,i) = kappa * vel_zp / (                    &
                            LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                                ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                                2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
+                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
+                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
                                                           )
                    ENDIF
@@ -836,6 +839,6 @@
 
 
-       zp         = 0.5 * ( (a+c1) * dy + (b+c2) * dx )
-       wall_flux  = 0.0
+       zp         = 0.5_wp * ( (a+c1) * dy + (b+c2) * dx )
+       wall_flux  = 0.0_wp
        wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 )
 
@@ -851,5 +854,6 @@
 !--             All subsequent variables are computed for scalar locations
                 IF ( k >= nzb_diff_s_inner(j,i)-1  .AND.                       &
-                     k <= nzb_diff_s_outer(j,i)-2  .AND.  wall(j,i) /= 0.0 )  THEN
+                     k <= nzb_diff_s_outer(j,i)-2  .AND.                       &
+                     wall(j,i) /= 0.0_wp )         THEN
 !
 !--                (1) Compute rifs, u_i, v_i, and ws
@@ -859,25 +863,27 @@
                       kk = k-1
                    ENDIF
-                   rifs  = 0.5 * ( rif_wall(k,j,i,wall_index) +                &
-                          a * rif_wall(k,j,i+1,1) +  b * rif_wall(k,j+1,i,2) + &
-                          c1 * rif_wall(kk,j,i,3) + c2 * rif_wall(kk,j,i,4)    &
-                                 )
-
-                   u_i   = 0.5 * ( u(k,j,i) + u(k,j,i+1) )
-                   v_i   = 0.5 * ( v(k,j,i) + v(k,j+1,i) )
-                   ws    = 0.5 * ( w(k,j,i) + w(k-1,j,i) )
+                   rifs  = 0.5_wp * (      rif_wall(k,j,i,wall_index) +        &
+                                      a  * rif_wall(k,j,i+1,1)        +        &
+                                      b  * rif_wall(k,j+1,i,2)        +        &
+                                      c1 * rif_wall(kk,j,i,3)         +        &
+                                      c2 * rif_wall(kk,j,i,4)                  &
+                                    )
+
+                   u_i   = 0.5_wp * ( u(k,j,i) + u(k,j,i+1) )
+                   v_i   = 0.5_wp * ( v(k,j,i) + v(k,j+1,i) )
+                   ws    = 0.5_wp * ( w(k,j,i) + w(k-1,j,i) )
 !
 !--                (2) Compute wall-parallel absolute velocity vel_total and
 !--                interpolate appropriate velocity component vel_zp.
                    vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 )
-                   vel_zp = 0.5 * ( a * u_i + b * v_i + (c1+c2) * ws )
+                   vel_zp    = 0.5_wp * ( a * u_i + b * v_i + (c1+c2) * ws )
 !
 !--                (3) Compute wall friction velocity us_wall
-                   IF ( rifs >= 0.0 )  THEN
+                   IF ( rifs >= 0.0_wp )  THEN
 
 !
 !--                   Stable stratification (and neutral)
                       us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) +    &
-                                            5.0 * rifs * ( zp - z0(j,i) ) / zp &
+                                         5.0_wp * rifs * ( zp - z0(j,i) ) / zp &
                                                     )
                    ELSE
@@ -885,12 +891,12 @@
 !
 !--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-                      h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
                       us_wall = kappa * vel_total / (                          &
                            LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                                ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                                2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
+                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
+                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
                                                     )
                    ENDIF
@@ -902,22 +908,24 @@
 !--                (5) Compute wall_flux (u'v', v'u', w'v', or w'u')
 
-                   IF ( rifs >= 0.0 )  THEN
+                   IF ( rifs >= 0.0_wp )  THEN
 
 !
 !--                   Stable stratification (and neutral)
-                      wall_flux(k,j,i) = kappa *  vel_zp /                     &
-                          ( LOG( zp/z0(j,i) ) + 5.0*rifs * ( zp-z0(j,i) ) / zp )
+                      wall_flux(k,j,i) = kappa *  vel_zp / (                   &
+                                         LOG( zp/z0(j,i) ) +                   &
+                                         5.0_wp * rifs * ( zp-z0(j,i) ) / zp   &
+                                                           )
                    ELSE
 
 !
 !--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-                      h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
                       wall_flux(k,j,i) = kappa * vel_zp / (                    &
                            LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                                ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                                2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
+                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
+                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
                                                           )
                    ENDIF
@@ -981,6 +989,6 @@
 
 
-       zp         = 0.5 * ( (a+c1) * dy + (b+c2) * dx )
-       wall_flux  = 0.0
+       zp         = 0.5_wp * ( (a+c1) * dy + (b+c2) * dx )
+       wall_flux  = 0.0_wp
        wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 )
 
@@ -996,25 +1004,27 @@
              kk = k-1
           ENDIF
-          rifs  = 0.5 * ( rif_wall(k,j,i,wall_index) +                         &
-                          a * rif_wall(k,j,i+1,1) +  b * rif_wall(k,j+1,i,2) + &
-                          c1 * rif_wall(kk,j,i,3) + c2 * rif_wall(kk,j,i,4)    &
-                        )
-
-          u_i   = 0.5 * ( u(k,j,i) + u(k,j,i+1) )
-          v_i   = 0.5 * ( v(k,j,i) + v(k,j+1,i) )
-          ws    = 0.5 * ( w(k,j,i) + w(k-1,j,i) )
+          rifs  = 0.5_wp * (      rif_wall(k,j,i,wall_index) +                 &
+                             a  * rif_wall(k,j,i+1,1)        +                 &
+                             b  * rif_wall(k,j+1,i,2)        +                 &
+                             c1 * rif_wall(kk,j,i,3)         +                 &
+                             c2 * rif_wall(kk,j,i,4)                           &
+                           )
+
+          u_i   = 0.5_wp * ( u(k,j,i) + u(k,j,i+1) )
+          v_i   = 0.5_wp * ( v(k,j,i) + v(k,j+1,i) )
+          ws    = 0.5_wp * ( w(k,j,i) + w(k-1,j,i) )
 !
 !--       (2) Compute wall-parallel absolute velocity vel_total and
 !--       interpolate appropriate velocity component vel_zp.
           vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 )
-          vel_zp = 0.5 * ( a * u_i + b * v_i + (c1+c2) * ws )
+          vel_zp    = 0.5_wp * ( a * u_i + b * v_i + (c1+c2) * ws )
 !
 !--       (3) Compute wall friction velocity us_wall
-          IF ( rifs >= 0.0 )  THEN
+          IF ( rifs >= 0.0_wp )  THEN
 
 !
 !--          Stable stratification (and neutral)
              us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) +             &
-                                            5.0 * rifs * ( zp - z0(j,i) ) / zp &
+                                         5.0_wp * rifs * ( zp - z0(j,i) ) / zp &
                                            )
           ELSE
@@ -1022,12 +1032,12 @@
 !
 !--          Unstable stratification
-             h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-             h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+             h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+             h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
              us_wall = kappa * vel_total / (                                   &
                   LOG( zp / z0(j,i) ) -                                        &
-                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (                   &
-                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +               &
-                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )                       &
+                  LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (             &
+                       ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +         &
+                       2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )                    &
                                            )
           ENDIF
@@ -1041,28 +1051,28 @@
 !--       subroutine wall_fluxes because fluxes in subroutine 
 !--       wall_fluxes_e are defined at scalar locations).
-          vel_zp = 0.5 * (       a * ( u(k,j,i) + u(k,j,i+1) ) +               &
-                                 b * ( v(k,j,i) + v(k,j+1,i) ) +               &
-                           (c1+c2) * ( w(k,j,i) + w(k-1,j,i) )                 &
-                         )
-
-          IF ( rifs >= 0.0 )  THEN
+          vel_zp = 0.5_wp * (       a * ( u(k,j,i) + u(k,j,i+1) ) +            &
+                                    b * ( v(k,j,i) + v(k,j+1,i) ) +            &
+                              (c1+c2) * ( w(k,j,i) + w(k-1,j,i) )              &
+                            )
+
+          IF ( rifs >= 0.0_wp )  THEN
 
 !
 !--          Stable stratification (and neutral)
              wall_flux(k) = kappa *  vel_zp /                                  &
-                          ( LOG( zp/z0(j,i) ) + 5.0*rifs * ( zp-z0(j,i) ) / zp )
+                     ( LOG( zp/z0(j,i) ) + 5.0_wp * rifs * ( zp-z0(j,i) ) / zp )
           ELSE
 
 !
 !--          Unstable stratification
-             h1 = SQRT( SQRT( 1.0 - 16.0 * rifs ) )
-             h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
+             h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
+             h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
 
              wall_flux(k) = kappa * vel_zp / (                                 &
                   LOG( zp / z0(j,i) ) -                                        &
-                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (                   &
-                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +               &
-                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )                       &
-                                                 )
+                  LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (             &
+                       ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +         &
+                       2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )                    &
+                                             )
           ENDIF
           wall_flux(k) = - wall_flux(k) * us_wall
Index: /palm/trunk/SOURCE/write_3d_binary.f90
===================================================================
--- /palm/trunk/SOURCE/write_3d_binary.f90	(revision 1352)
+++ /palm/trunk/SOURCE/write_3d_binary.f90	(revision 1353)
@@ -80,10 +80,10 @@
         ONLY:  nxl, nxr, nys, nyn, nzb, nzt
         
-    USE particle_attributes,                                                               &
+    USE particle_attributes,                                                   &
         ONLY:  iran_part
         
     USE pegrid
     
-    USE random_function_mod,                                                               &
+    USE random_function_mod,                                                   &
         ONLY:  random_iv, random_iy
         
Index: /palm/trunk/SOURCE/write_var_list.f90
===================================================================
--- /palm/trunk/SOURCE/write_var_list.f90	(revision 1352)
+++ /palm/trunk/SOURCE/write_var_list.f90	(revision 1353)
@@ -20,4 +20,5 @@
 ! Current revisions:
 ! -----------------
+! 
 !
 ! Former revisions:
