Index: palm/trunk/SOURCE/advec_s_bc.f90
===================================================================
--- palm/trunk/SOURCE/advec_s_bc.f90	(revision 1345)
+++ palm/trunk/SOURCE/advec_s_bc.f90	(revision 1346)
@@ -303,6 +303,6 @@
        DO  i = nxl, nxr
           DO  k = nzb+1, nzt
-             cip  =  MAX( 0.0, ( u(k,j,i+1) - u_gtrans ) * dt_3d * ddx )
-             cim  = -MIN( 0.0, ( u(k,j,i+1) - u_gtrans ) * dt_3d * ddx )
+             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
@@ -313,11 +313,11 @@
                     - a1(k,i+1) * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k,i+1) * f24 * ( 1.0 - cimf*cimf*cimf )
-             ip   = MAX( ip, 0.0 )
-             im   = MAX( im, 0.0 )
-             ippb(k,i) = ip * MIN( 1.0, sk_p(k,j,i)   / (ip+im+1E-15) )
-             impb(k,i) = im * MIN( 1.0, sk_p(k,j,i+1) / (ip+im+1E-15) )
-
-             cip  =  MAX( 0.0, ( u(k,j,i) - u_gtrans ) * dt_3d * ddx )
-             cim  = -MIN( 0.0, ( u(k,j,i) - u_gtrans ) * dt_3d * ddx )
+             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) )
+
+             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
@@ -328,8 +328,8 @@
                     - a1(k,i)   * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k,i)   * f24 * ( 1.0 - cimf*cimf*cimf )
-             ip   = MAX( ip, 0.0 )
-             im   = MAX( im, 0.0 )
-             ipmb(k,i) = ip * MIN( 1.0, sk_p(k,j,i-1) / (ip+im+1E-15) )
-             immb(k,i) = im * MIN( 1.0, sk_p(k,j,i)   / (ip+im+1E-15) )
+             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) )
           ENDDO
        ENDDO
@@ -358,9 +358,9 @@
           DO  k = nzb+1, nzt
              m2 = 2.0 * ABS( a1(k,i) - a12(k,i) ) /                            &
-                  MAX( ABS( a1(k,i) + a12(k,i) ), 1E-35 )
+                  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) ) /                            &
-                  MAX( ABS( a2(k,i) + a22(k,i) ), 1E-35 )
+                  MAX( ABS( a2(k,i) + a22(k,i) ), 1E-35_wp )
              IF ( ABS( a2(k,i) + a22(k,i) ) < fmax(1) )  m3 = 0.0
 
@@ -389,10 +389,10 @@
                 IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
                 sterm = ( sk_p(k,j,i) - sk_p(k,j,i-1) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cip =  MAX( 0.0, ( u(k,j,i+1) - u_gtrans ) * dt_3d * ddx )
+                cip =  MAX( 0.0_wp, ( u(k,j,i+1) - u_gtrans ) * dt_3d * ddx )
 
                 ippe(k,i) = sk_p(k,j,i-1) * cip + snenn * (                    &
@@ -407,10 +407,10 @@
                 IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
                 sterm = ( sk_p(k,j,i) - sk_p(k,j,i+1) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cim = -MIN( 0.0, ( u(k,j,i) - u_gtrans ) * dt_3d * ddx )
+                cim = -MIN( 0.0_wp, ( u(k,j,i) - u_gtrans ) * dt_3d * ddx )
 
                 imme(k,i) = sk_p(k,j,i+1) * cim + snenn * (                    &
@@ -428,10 +428,10 @@
                 IF ( ABS( snenn ) .LT. 1E-9 )  snenn = 1E-9
                 sterm = ( sk_p(k,j,i+1) - sk_p(k,j,i+2) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cim = -MIN( 0.0, ( 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 )
 
                 impe(k,i) = sk_p(k,j,i+2) * cim + snenn * (                    &
@@ -440,6 +440,6 @@
                                                                 )              &
                                                           )
-                IF ( sterm == 0.0001 )  impe(k,i) = sk_p(k,j,i+1) * cim
-                IF ( sterm == 0.9999 )  impe(k,i) = sk_p(k,j,i+1) * cim
+                IF ( sterm == 0.0001_wp )  impe(k,i) = sk_p(k,j,i+1) * cim
+                IF ( sterm == 0.9999_wp )  impe(k,i) = sk_p(k,j,i+1) * cim
              ENDIF
 
@@ -449,18 +449,18 @@
                 IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
                 sterm = ( sk_p(k,j,i-1) - sk_p(k,j,i-2) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cip = MAX( 0.0, ( u(k,j,i) - u_gtrans ) * dt_3d * ddx )
+                cip = MAX( 0.0_wp, ( u(k,j,i) - u_gtrans ) * dt_3d * ddx )
 
                 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 - 2.0 * cip ) ) &
+                            eex(ix) - EXP( dex(ix)*0.5 * ( 1.0_wp - 2.0 * cip ) ) &
                                                                 )              &
                                                           )
-                IF ( sterm == 0.0001 )  ipme(k,i) = sk_p(k,j,i-1) * cip
-                IF ( sterm == 0.9999 )  ipme(k,i) = sk_p(k,j,i-1) * cip
+                IF ( sterm == 0.0001_wp )  ipme(k,i) = sk_p(k,j,i-1) * cip
+                IF ( sterm == 0.9999_wp )  ipme(k,i) = sk_p(k,j,i-1) * cip
              ENDIF
 
@@ -473,18 +473,18 @@
        DO  i = nxl, nxr
           DO  k = nzb+1, nzt
-             fplus  = ( 1.0 - sw(k,i)   ) * ippb(k,i) + sw(k,i)   * ippe(k,i)  &
-                    - ( 1.0 - sw(k,i+1) ) * impb(k,i) - sw(k,i+1) * impe(k,i)
-             fminus = ( 1.0 - sw(k,i-1) ) * ipmb(k,i) + sw(k,i-1) * ipme(k,i)  &
-                    - ( 1.0 - sw(k,i)   ) * immb(k,i) - sw(k,i)   * imme(k,i)
+             fplus  = ( 1.0_wp - sw(k,i)   ) * ippb(k,i) + sw(k,i)   * ippe(k,i)  &
+                    - ( 1.0_wp - sw(k,i+1) ) * impb(k,i) - sw(k,i+1) * impe(k,i)
+             fminus = ( 1.0_wp - sw(k,i-1) ) * ipmb(k,i) + sw(k,i-1) * ipme(k,i)  &
+                    - ( 1.0_wp - sw(k,i)   ) * immb(k,i) - sw(k,i)   * imme(k,i)
              tendcy = fplus - fminus
 !
 !--           Removed in order to optimize speed
-!             ffmax   = MAX( ABS( fplus ), ABS( fminus ), 1E-35 )
-!             IF ( ( ABS( tendcy ) / ffmax ) < 1E-7 )  tendcy = 0.0
+!             ffmax   = MAX( ABS( fplus ), ABS( fminus ), 1E-35_wp )
+!             IF ( ( ABS( tendcy ) / ffmax ) < 1E-7_wp )  tendcy = 0.0
 !
 !--          Density correction because of possible remaining divergences
              d_new = d(k,j,i) - ( u(k,j,i+1) - u(k,j,i) ) * dt_3d * ddx
-             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
@@ -595,6 +595,6 @@
        DO  j = nys, nyn
           DO  k = nzb+1, nzt
-             cip  =  MAX( 0.0, ( v(k,j+1,i) - v_gtrans ) * dt_3d * ddy )
-             cim  = -MIN( 0.0, ( v(k,j+1,i) - v_gtrans ) * dt_3d * ddy )
+             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
@@ -605,11 +605,11 @@
                     - a1(k,j+1) * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k,j+1) * f24 * ( 1.0 - cimf*cimf*cimf )
-             ip   = MAX( ip, 0.0 )
-             im   = MAX( im, 0.0 )
-             ippb(k,j) = ip * MIN( 1.0, sk_p(k,j,i)   / (ip+im+1E-15) )
-             impb(k,j) = im * MIN( 1.0, sk_p(k,j+1,i) / (ip+im+1E-15) )
-
-             cip  =  MAX( 0.0, ( v(k,j,i) - v_gtrans ) * dt_3d * ddy )
-             cim  = -MIN( 0.0, ( v(k,j,i) - v_gtrans ) * dt_3d * ddy )
+             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) )
+
+             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
@@ -620,8 +620,8 @@
                     - a1(k,j)   * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k,j)   * f24 * ( 1.0 - cimf*cimf*cimf )
-             ip   = MAX( ip, 0.0 )
-             im   = MAX( im, 0.0 )
-             ipmb(k,j) = ip * MIN( 1.0, sk_p(k,j-1,i) / (ip+im+1E-15) )
-             immb(k,j) = im * MIN( 1.0, sk_p(k,j,i)   / (ip+im+1E-15) )
+             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) )
           ENDDO
        ENDDO
@@ -650,9 +650,9 @@
           DO  k = nzb+1, nzt
              m2 = 2.0 * ABS( a1(k,j) - a12(k,j) ) /                            &
-                  MAX( ABS( a1(k,j) + a12(k,j) ), 1E-35 )
+                  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) ) /                            &
-                  MAX( ABS( a2(k,j) + a22(k,j) ), 1E-35 )
+                  MAX( ABS( a2(k,j) + a22(k,j) ), 1E-35_wp )
              IF ( ABS( a2(k,j) + a22(k,j) ) < fmax(1) )  m3 = 0.0
 
@@ -681,10 +681,10 @@
                 IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
                 sterm = ( sk_p(k,j,i) - sk_p(k,j-1,i) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cip =  MAX( 0.0, ( v(k,j+1,i) - v_gtrans ) * dt_3d * ddy )
+                cip =  MAX( 0.0_wp, ( v(k,j+1,i) - v_gtrans ) * dt_3d * ddy )
 
                 ippe(k,j) = sk_p(k,j-1,i) * cip + snenn * (                    &
@@ -693,16 +693,16 @@
                                                                 )              &
                                                           )
-                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,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
                 sterm = ( sk_p(k,j,i) - sk_p(k,j+1,i) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cim = -MIN( 0.0, ( v(k,j,i) - v_gtrans ) * dt_3d * ddy )
+                cim = -MIN( 0.0_wp, ( v(k,j,i) - v_gtrans ) * dt_3d * ddy )
 
                 imme(k,j) = sk_p(k,j+1,i) * cim + snenn * (                    &
@@ -711,6 +711,6 @@
                                                                 )              &
                                                           )
-                IF ( sterm == 0.0001 )  imme(k,j) = sk_p(k,j,i) * cim
-                IF ( sterm == 0.9999 )  imme(k,j) = sk_p(k,j,i) * cim
+                IF ( sterm == 0.0001_wp )  imme(k,j) = sk_p(k,j,i) * cim
+                IF ( sterm == 0.9999_wp )  imme(k,j) = sk_p(k,j,i) * cim
              ENDIF
 
@@ -720,10 +720,10 @@
                 IF ( ABS( snenn ) .LT. 1E-9 )  snenn = 1E-9
                 sterm = ( sk_p(k,j+1,i) - sk_p(k,j+2,i) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cim = -MIN( 0.0, ( 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 )
 
                 impe(k,j) = sk_p(k,j+2,i) * cim + snenn * (                    &
@@ -732,6 +732,6 @@
                                                                 )              &
                                                           )
-                IF ( sterm == 0.0001 )  impe(k,j) = sk_p(k,j+1,i) * cim
-                IF ( sterm == 0.9999 )  impe(k,j) = sk_p(k,j+1,i) * cim
+                IF ( sterm == 0.0001_wp )  impe(k,j) = sk_p(k,j+1,i) * cim
+                IF ( sterm == 0.9999_wp )  impe(k,j) = sk_p(k,j+1,i) * cim
              ENDIF
 
@@ -739,12 +739,12 @@
              IF ( sw(k,j-1) == 1.0 )  THEN
                 snenn = sk_p(k,j,i) - sk_p(k,j-2,i)
-                IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
+                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9
                 sterm = ( sk_p(k,j-1,i) - sk_p(k,j-2,i) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cip = MAX( 0.0, ( v(k,j,i) - v_gtrans ) * dt_3d * ddy )
+                cip = MAX( 0.0_wp, ( v(k,j,i) - v_gtrans ) * dt_3d * ddy )
 
                 ipme(k,j) = sk_p(k,j-2,i) * cip + snenn * (                    &
@@ -753,6 +753,6 @@
                                                                 )              &
                                                           )
-                IF ( sterm == 0.0001 )  ipme(k,j) = sk_p(k,j-1,i) * cip
-                IF ( sterm == 0.9999 )  ipme(k,j) = sk_p(k,j-1,i) * cip
+                IF ( sterm == 0.0001_wp )  ipme(k,j) = sk_p(k,j-1,i) * cip
+                IF ( sterm == 0.9999_wp )  ipme(k,j) = sk_p(k,j-1,i) * cip
              ENDIF
 
@@ -772,6 +772,6 @@
 !
 !--           Removed in order to optimise speed
-!             ffmax   = MAX( ABS( fplus ), ABS( fminus ), 1E-35 )
-!             IF ( ( ABS( tendcy ) / ffmax ) < 1E-7 )  tendcy = 0.0
+!             ffmax   = MAX( ABS( fplus ), ABS( fminus ), 1E-35_wp )
+!             IF ( ( ABS( tendcy ) / ffmax ) < 1E-7_wp )  tendcy = 0.0
 !
 !--          Density correction because of possible remaining divergences
@@ -996,6 +996,6 @@
        DO  j = nys, nyn
           DO  k = nzb+1, nzt
-             cip  =  MAX( 0.0, w(k,j,i) * dt_3d * ddzw(k) )
-             cim  = -MIN( 0.0, w(k,j,i) * dt_3d * ddzw(k) )
+             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
@@ -1006,11 +1006,11 @@
                     - a1(k+1,j) * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k+1,j) * f24 * ( 1.0 - cimf*cimf*cimf )
-             ip   = MAX( ip, 0.0 )
-             im   = MAX( im, 0.0 )
-             ippb(k,j) = ip * MIN( 1.0, sk_p(k,j,i)   / (ip+im+1E-15) )
-             impb(k,j) = im * MIN( 1.0, sk_p(k+1,j,i) / (ip+im+1E-15) )
-
-             cip  =  MAX( 0.0, w(k-1,j,i) * dt_3d * ddzw(k) )
-             cim  = -MIN( 0.0, w(k-1,j,i) * dt_3d * ddzw(k) )
+             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) )
+
+             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
@@ -1021,8 +1021,8 @@
                     - a1(k,j)   * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k,j)   * f24 * ( 1.0 - cimf*cimf*cimf )
-             ip   = MAX( ip, 0.0 )
-             im   = MAX( im, 0.0 )
-             ipmb(k,j) = ip * MIN( 1.0, sk_p(k-1,j,i) / (ip+im+1E-15) )
-             immb(k,j) = im * MIN( 1.0, sk_p(k,j,i)   / (ip+im+1E-15) )
+             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) )
           ENDDO
        ENDDO
@@ -1051,9 +1051,9 @@
           DO  k = nzb, nzt+1
              m2 = 2.0 * ABS( a1(k,j) - a12(k,j) ) /                            &
-                  MAX( ABS( a1(k,j) + a12(k,j) ), 1E-35 )
+                  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) ) /                            &
-                  MAX( ABS( a2(k,j) + a22(k,j) ), 1E-35 )
+                  MAX( ABS( a2(k,j) + a22(k,j) ), 1E-35_wp )
              IF ( ABS( a2(k,j) + a22(k,j) ) < fmax(1) )  m3 = 0.0
 
@@ -1080,12 +1080,12 @@
              IF ( sw(k,j) == 1.0 )  THEN
                 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
                 sterm = ( sk_p(k,j,i) - sk_p(k-1,j,i) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cip =  MAX( 0.0, w(k,j,i) * dt_3d * ddzw(k) )
+                cip =  MAX( 0.0_wp, w(k,j,i) * dt_3d * ddzw(k) )
 
                 ippe(k,j) = sk_p(k-1,j,i) * cip + snenn * (                    &
@@ -1100,10 +1100,10 @@
                 IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
                 sterm = ( sk_p(k,j,i) - sk_p(k+1,j,i) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cim = -MIN( 0.0, w(k-1,j,i) * dt_3d * ddzw(k) )
+                cim = -MIN( 0.0_wp, w(k-1,j,i) * dt_3d * ddzw(k) )
 
                 imme(k,j) = sk_p(k+1,j,i) * cim + snenn * (                    &
@@ -1112,6 +1112,6 @@
                                                                 )              &
                                                           )
-                IF ( sterm == 0.0001 )  imme(k,j) = sk_p(k,j,i) * cim
-                IF ( sterm == 0.9999 )  imme(k,j) = sk_p(k,j,i) * cim
+                IF ( sterm == 0.0001_wp )  imme(k,j) = sk_p(k,j,i) * cim
+                IF ( sterm == 0.9999_wp )  imme(k,j) = sk_p(k,j,i) * cim
              ENDIF
 
@@ -1121,10 +1121,10 @@
                 IF ( ABS( snenn ) .LT. 1E-9 )  snenn = 1E-9
                 sterm = ( sk_p(k+1,j,i) - sk_p(k+2,j,i) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cim = -MIN( 0.0, w(k,j,i) * dt_3d * ddzw(k) )
+                cim = -MIN( 0.0_wp, w(k,j,i) * dt_3d * ddzw(k) )
 
                 impe(k,j) = sk_p(k+2,j,i) * cim + snenn * (                    &
@@ -1133,6 +1133,6 @@
                                                                 )              &
                                                           )
-                IF ( sterm == 0.0001 )  impe(k,j) = sk_p(k+1,j,i) * cim
-                IF ( sterm == 0.9999 )  impe(k,j) = sk_p(k+1,j,i) * cim
+                IF ( sterm == 0.0001_wp )  impe(k,j) = sk_p(k+1,j,i) * cim
+                IF ( sterm == 0.9999_wp )  impe(k,j) = sk_p(k+1,j,i) * cim
              ENDIF
 
@@ -1140,12 +1140,12 @@
              IF ( sw(k-1,j) == 1.0 )  THEN
                 snenn = sk_p(k,j,i) - sk_p(k-2,j,i)
-                IF ( ABS( snenn ) < 1E-9 )  snenn = 1E-9
+                IF ( ABS( snenn ) < 1E-9_wp )  snenn = 1E-9
                 sterm = ( sk_p(k-1,j,i) - sk_p(k-2,j,i) ) / snenn
-                sterm = MIN( sterm, 0.9999 )
-                sterm = MAX( sterm, 0.0001 )
+                sterm = MIN( sterm, 0.9999_wp )
+                sterm = MAX( sterm, 0.0001_wp )
 
                 ix = INT( sterm * 1000 ) + 1
 
-                cip = MAX( 0.0, w(k-1,j,i) * dt_3d * ddzw(k) )
+                cip = MAX( 0.0_wp, w(k-1,j,i) * dt_3d * ddzw(k) )
 
                 ipme(k,j) = sk_p(k-2,j,i) * cip + snenn * (                    &
@@ -1154,6 +1154,6 @@
                                                                 )              &
                                                           )
-                IF ( sterm == 0.0001 )  ipme(k,j) = sk_p(k-1,j,i) * cip
-                IF ( sterm == 0.9999 )  ipme(k,j) = sk_p(k-1,j,i) * cip
+                IF ( sterm == 0.0001_wp )  ipme(k,j) = sk_p(k-1,j,i) * cip
+                IF ( sterm == 0.9999_wp )  ipme(k,j) = sk_p(k-1,j,i) * cip
              ENDIF
 
@@ -1173,6 +1173,6 @@
 !
 !--           Removed in order to optimise speed
-!             ffmax   = MAX( ABS( fplus ), ABS( fminus ), 1E-35 )
-!             IF ( ( ABS( tendcy ) / ffmax ) < 1E-7 )  tendcy = 0.0
+!             ffmax   = MAX( ABS( fplus ), ABS( fminus ), 1E-35_wp )
+!             IF ( ( ABS( tendcy ) / ffmax ) < 1E-7_wp )  tendcy = 0.0
 !
 !--          Density correction because of possible remaining divergences
Index: palm/trunk/SOURCE/data_output_dvrp.f90
===================================================================
--- palm/trunk/SOURCE/data_output_dvrp.f90	(revision 1345)
+++ palm/trunk/SOURCE/data_output_dvrp.f90	(revision 1346)
@@ -71,5 +71,5 @@
                  slicer_range_limits_dvrp(1,islice_dvrp) )
 
-       scale = MODULO( 180.0 + 180.0 * scale, 360.0 )
+       scale = MODULO( 180.0 + 180.0 * scale, 360.0_wp )
 
        color = (/ scale, 0.5_wp, 1.0_wp, 0.0_wp /)
Index: palm/trunk/SOURCE/inflow_turbulence.f90
===================================================================
--- palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1345)
+++ palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1346)
@@ -214,5 +214,5 @@
               e(k,j,-nbgp:-1)  = mean_inflow_profiles(k,5) + &
                            inflow_dist(k,j,5,1:nbgp) * inflow_damping_factor(k)
-              e(k,j,-nbgp:-1)  = MAX( e(k,j,-nbgp:-1), 0.0 )
+              e(k,j,-nbgp:-1)  = MAX( e(k,j,-nbgp:-1), 0.0_wp )
 
           ENDDO
Index: palm/trunk/SOURCE/init_1d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_1d_model.f90	(revision 1345)
+++ palm/trunk/SOURCE/init_1d_model.f90	(revision 1346)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! Bugfix: REAL constants provided with KIND-attribute especially in call of 
+! intrinsic function like MAX, MIN, SIGN
 !
 ! Former revisions:
@@ -675,5 +676,5 @@
              DO  k = damp_level_ind_1d+1, nzt+1
                 km1d(k) = 1.1 * km1d(k-1)
-                km1d(k) = MIN( km1d(k), 10.0 )
+                km1d(k) = MIN( km1d(k), 10.0_wp )
              ENDDO
 
@@ -784,5 +785,5 @@
        uv_total = SQRT( u1d(nzb+1)**2 + v1d(nzb+1)**2 )
        IF ( ABS( v1d(nzb+1) ) .LT. 1.0E-5 )  THEN
-          alpha = ACOS( SIGN( 1.0 , u1d(nzb+1) ) )
+          alpha = ACOS( SIGN( 1.0_wp , u1d(nzb+1) ) )
        ELSE
           alpha = ACOS( u1d(nzb+1) / uv_total )
Index: palm/trunk/SOURCE/init_advec.f90
===================================================================
--- palm/trunk/SOURCE/init_advec.f90	(revision 1345)
+++ palm/trunk/SOURCE/init_advec.f90	(revision 1346)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! Bugfix: REAL constants provided with KIND-attribute especially in call of 
+! intrinsic function like MAX, MIN, SIGN
 !
 ! Former revisions:
@@ -111,6 +112,6 @@
           ENDDO
 
-          IF ( sterm < 0.5 )  dn = MAX(  2.95E-2, dn )
-          IF ( sterm > 0.5 )  dn = MIN( -2.95E-2, dn )
+          IF ( sterm < 0.5 )  dn = MAX(  2.95E-2_wp, dn )
+          IF ( sterm > 0.5 )  dn = MIN( -2.95E-2_wp, dn )
           ex1 = EXP( -dn )
           ex2 = EXP( dn ) - ex1
Index: palm/trunk/SOURCE/lpm_collision_kernels.f90
===================================================================
--- palm/trunk/SOURCE/lpm_collision_kernels.f90	(revision 1345)
+++ palm/trunk/SOURCE/lpm_collision_kernels.f90	(revision 1346)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! Bugfix: REAL constants provided with KIND-attribute especially in call of 
+! intrinsic function like MAX, MIN, SIGN
 !
 ! Former revisions:
@@ -840,5 +841,5 @@
                 qq = ( rq - rat(iq-1) ) / ( rat(iq) - rat(iq-1) )
                 ek = ( 1.0 - qq ) * ecoll(15,iq-1) + qq * ecoll(15,iq)
-                ec(j,i) = MIN( ek, 1.0 )
+                ec(j,i) = MIN( ek, 1.0_wp )
              ENDIF
 
Index: palm/trunk/SOURCE/lpm_droplet_condensation.f90
===================================================================
--- palm/trunk/SOURCE/lpm_droplet_condensation.f90	(revision 1345)
+++ palm/trunk/SOURCE/lpm_droplet_condensation.f90	(revision 1346)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! ------------------
-!
+! Bugfix: REAL constants provided with KIND-attribute especially in call of 
+! intrinsic function like MAX, MIN, SIGN
 !
 ! Former revisions:
@@ -447,5 +448,5 @@
 !--          Radius should not fall below 1E-8 because Rosenbrock method may
 !--          lead to errors otherwise
-             new_r = MAX( new_r, 1.0E-8 )
+             new_r = MAX( new_r, 1.0E-8_wp )
 !
 !--          Check if calculated droplet radius change is reasonable since in
Index: palm/trunk/SOURCE/microphysics.f90
===================================================================
--- palm/trunk/SOURCE/microphysics.f90	(revision 1345)
+++ palm/trunk/SOURCE/microphysics.f90	(revision 1346)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! ------------------
-! 
+! Bugfix: REAL constants provided with KIND-attribute especially in call of 
+! intrinsic function like MAX, MIN, SIGN
 ! 
 ! Former revisions:
@@ -988,5 +989,5 @@
              d_max  = MAX( qr_1d(k+1), qr_1d(k), qr_1d(k-1) ) - qr_1d(k)
 
-             qr_slope(k) = SIGN(1.0, d_mean) * MIN ( 2.0 * d_min, 2.0 * d_max, &
+             qr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0 * d_min, 2.0 * d_max, &
                                                      ABS( d_mean ) )
 
@@ -995,5 +996,5 @@
              d_max  = MAX( nr_1d(k+1), nr_1d(k), nr_1d(k-1) ) - nr_1d(k)
 
-             nr_slope(k) = SIGN(1.0, d_mean) * MIN ( 2.0 * d_min, 2.0 * d_max, &
+             nr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0 * d_min, 2.0 * d_max, &
                                                      ABS( d_mean ) )
           ENDDO
@@ -1017,5 +1018,5 @@
           z_run = 0.0 ! height above z(k)
           k_run = k
-          c_run = MIN( 1.0, c_nr(k) )
+          c_run = MIN( 1.0_wp, c_nr(k) )
           DO WHILE ( c_run > 0.0  .AND.  k_run <= nzt )
              flux  = flux + hyrho(k_run) *                                    &
@@ -1024,5 +1025,5 @@
              z_run = z_run + dzu(k_run)
              k_run = k_run + 1
-             c_run = MIN( 1.0, c_nr(k_run) - z_run * ddzu(k_run) )
+             c_run = MIN( 1.0_wp, c_nr(k_run) - z_run * ddzu(k_run) )
           ENDDO
 !
@@ -1041,5 +1042,5 @@
           z_run = 0.0 ! height above z(k)
           k_run = k
-          c_run = MIN( 1.0, c_qr(k) )
+          c_run = MIN( 1.0_wp, c_qr(k) )
 
           DO WHILE ( c_run > 0.0  .AND.  k_run <= nzt-1 )
@@ -1050,5 +1051,5 @@
              z_run = z_run + dzu(k_run)
              k_run = k_run + 1
-             c_run = MIN( 1.0, c_qr(k_run) - z_run * ddzu(k_run) )
+             c_run = MIN( 1.0_wp, c_qr(k_run) - z_run * ddzu(k_run) )
 
           ENDDO
