Index: /palm/trunk/SOURCE/advec_ws.f90
===================================================================
--- /palm/trunk/SOURCE/advec_ws.f90	(revision 1561)
+++ /palm/trunk/SOURCE/advec_ws.f90	(revision 1562)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! ------------------
-! 
+! Bugfix: REAL constants provided with KIND-attribute in call of 
+! intrinsic function like MAX and MIN 
 ! 
 ! Former revisions:
@@ -757,9 +758,9 @@
 !--          Calculate ratio of upwind gradients. Note, Min/Max is just to 
 !--          avoid if statements.
-             rl     = ( MAX( 0.0, u(k,j,i) - u_gtrans ) *                     & 
+             rl     = ( MAX( 0.0_wp, u(k,j,i) - u_gtrans ) *                  & 
                            ABS( ( sk(k,j,i-1) - sk(k,j,i-2)            ) /    &
                                 ( sk(k,j,i)   - sk(k,j,i-1) + 1E-20_wp )      &
                               ) +                                             & 
-                        MIN( 0.0, u(k,j,i) - u_gtrans ) *                     &
+                        MIN( 0.0_wp, u(k,j,i) - u_gtrans ) *                  &
                            ABS( ( sk(k,j,i)   - sk(k,j,i+1)            ) /    &
                                 ( sk(k,j,i-1) - sk(k,j,i)   + 1E-20_wp )      &
@@ -767,9 +768,9 @@
                       ) / ABS( u(k,j,i) - u_gtrans + 1E-20_wp )
 
-             rr     = ( MAX( 0.0, u(k,j,i+1) - u_gtrans ) *                   & 
+             rr     = ( MAX( 0.0_wp, u(k,j,i+1) - u_gtrans ) *                & 
                            ABS( ( sk(k,j,i)   - sk(k,j,i-1)            ) /    &
                                 ( sk(k,j,i+1) - sk(k,j,i)   + 1E-20_wp )      &
                               ) +                                             & 
-                        MIN( 0.0, u(k,j,i+1) - u_gtrans ) *                   &
+                        MIN( 0.0_wp, u(k,j,i+1) - u_gtrans ) *                &
                            ABS( ( sk(k,j,i+1) - sk(k,j,i+2)            ) /    &
                                 ( sk(k,j,i)   - sk(k,j,i+1) + 1E-20_wp )      &
@@ -777,9 +778,9 @@
                       ) / ABS( u(k,j,i+1) - u_gtrans + 1E-20_wp )
 
-             rs     = ( MAX( 0.0, v(k,j,i) - v_gtrans ) *                     & 
+             rs     = ( MAX( 0.0_wp, v(k,j,i) - v_gtrans ) *                  & 
                            ABS( ( sk(k,j-1,i) - sk(k,j-2,i)            ) /    &
                                 ( sk(k,j,i)   - sk(k,j-1,i) + 1E-20_wp )      &
                               ) +                                             & 
-                        MIN( 0.0, v(k,j,i) - v_gtrans ) *                     &
+                        MIN( 0.0_wp, v(k,j,i) - v_gtrans ) *                  &
                            ABS( ( sk(k,j,i)   - sk(k,j+1,i)            ) /    &
                                 ( sk(k,j-1,i) - sk(k,j,i)   + 1E-20_wp )      &
@@ -787,9 +788,9 @@
                       ) / ABS( v(k,j,i) - v_gtrans + 1E-20_wp )
 
-             rn     = ( MAX( 0.0, v(k,j+1,i) - v_gtrans ) *                   & 
+             rn     = ( MAX( 0.0_wp, v(k,j+1,i) - v_gtrans ) *                & 
                            ABS( ( sk(k,j,i)   - sk(k,j-1,i)            ) /    &
                                 ( sk(k,j+1,i) - sk(k,j,i)   + 1E-20_wp )      &
                               ) +                                             & 
-                       MIN( 0.0, v(k,j+1,i) - v_gtrans ) *                    &
+                       MIN( 0.0_wp, v(k,j+1,i) - v_gtrans ) *                 &
                            ABS( ( sk(k,j+1,i) - sk(k,j+2,i)            ) /    &
                                 ( sk(k,j,i)   - sk(k,j+1,i) + 1E-20_wp )      &
@@ -803,9 +804,9 @@
              k_mmm  = k - 3 * ibit8
 
-             rd     = ( MAX( 0.0, w(k-1,j,i) ) *                              & 
+             rd     = ( MAX( 0.0_wp, w(k-1,j,i) ) *                           & 
                            ABS( ( sk(k_mm,j,i) - sk(k_mmm,j,i)           ) /  &
                                 ( sk(k-1,j,i)  - sk(k_mm,j,i) + 1E-20_wp )    &
                               ) +                                             & 
-                        MIN( 0.0, w(k-1,j,i) ) *                              &
+                        MIN( 0.0_wp, w(k-1,j,i) ) *                           &
                            ABS( ( sk(k-1,j,i) - sk(k,j,i)            ) /      &
                                 ( sk(k_mm,j,i) - sk(k-1,j,i)   + 1E-20_wp )   &
@@ -813,9 +814,9 @@
                       ) * ibit8 / ABS( w(k-1,j,i) + 1E-20_wp ) 
  
-             rt     = ( MAX( 0.0, w(k,j,i) ) *                                & 
+             rt     = ( MAX( 0.0_wp, w(k,j,i) ) *                             & 
                            ABS( ( sk(k,j,i)   - sk(k-1,j,i)            ) /    &
                                 ( sk(k+1,j,i) - sk(k,j,i)   + 1E-20_wp )      &
                               ) +                                             & 
-                        MIN( 0.0, w(k,j,i) ) *                                &
+                        MIN( 0.0_wp, w(k,j,i) ) *                             &
                            ABS( ( sk(k+1,j,i) - sk(k_pp,j,i)           ) /    &
                                 ( sk(k,j,i)   - sk(k+1,j,i) + 1E-20_wp )      &
@@ -986,9 +987,9 @@
 !--          Calculate ratio of upwind gradients. Note, Min/Max is just to 
 !--          avoid if statements. 
-             rl     = ( MAX( 0.0, u(k,j,i) - u_gtrans ) *                     & 
+             rl     = ( MAX( 0.0_wp, u(k,j,i) - u_gtrans ) *                  & 
                            ABS( ( sk(k,j,i-1) - sk(k,j,i-2)            ) /    &
                                 ( sk(k,j,i)   - sk(k,j,i-1) + 1E-20_wp )      &
                               ) +                                             & 
-                        MIN( 0.0, u(k,j,i) - u_gtrans ) *                     &
+                        MIN( 0.0_wp, u(k,j,i) - u_gtrans ) *                  &
                            ABS( ( sk(k,j,i)   - sk(k,j,i+1)            ) /    &
                                 ( sk(k,j,i-1) - sk(k,j,i)   + 1E-20_wp )      &
@@ -996,9 +997,9 @@
                       ) / ABS( u(k,j,i) - u_gtrans + 1E-20_wp )
 
-             rr     = ( MAX( 0.0, u(k,j,i+1) - u_gtrans ) *                   & 
+             rr     = ( MAX( 0.0_wp, u(k,j,i+1) - u_gtrans ) *                & 
                            ABS( ( sk(k,j,i)   - sk(k,j,i-1)            ) /    &
                                 ( sk(k,j,i+1) - sk(k,j,i)   + 1E-20_wp )      &
                               ) +                                             & 
-                        MIN( 0.0, u(k,j,i+1) - u_gtrans ) *                   &
+                        MIN( 0.0_wp, u(k,j,i+1) - u_gtrans ) *                &
                            ABS( ( sk(k,j,i+1) - sk(k,j,i+2)            ) /    &
                                 ( sk(k,j,i)   - sk(k,j,i+1) + 1E-20_wp )      &
@@ -1006,9 +1007,9 @@
                       ) / ABS( u(k,j,i+1) - u_gtrans + 1E-20_wp )
 
-             rs     = ( MAX( 0.0, v(k,j,i) - v_gtrans ) *                     & 
+             rs     = ( MAX( 0.0_wp, v(k,j,i) - v_gtrans ) *                  & 
                            ABS( ( sk(k,j-1,i) - sk(k,j-2,i)            ) /    &
                                 ( sk(k,j,i)   - sk(k,j-1,i) + 1E-20_wp )      &
                               ) +                                             & 
-                        MIN( 0.0, v(k,j,i) - v_gtrans ) *                     &
+                        MIN( 0.0_wp, v(k,j,i) - v_gtrans ) *                  &
                            ABS( ( sk(k,j,i)   - sk(k,j+1,i)            ) /    &
                                 ( sk(k,j-1,i) - sk(k,j,i)   + 1E-20_wp )      &
@@ -1016,9 +1017,9 @@
                       ) / ABS( v(k,j,i) - v_gtrans + 1E-20_wp )
 
-             rn     = ( MAX( 0.0, v(k,j+1,i) - v_gtrans ) *                   & 
+             rn     = ( MAX( 0.0_wp, v(k,j+1,i) - v_gtrans ) *                & 
                            ABS( ( sk(k,j,i)   - sk(k,j-1,i)            ) /    &
                                 ( sk(k,j+1,i) - sk(k,j,i)   + 1E-20_wp )      &
                               ) +                                             & 
-                       MIN( 0.0, v(k,j+1,i) - v_gtrans ) *                    &
+                       MIN( 0.0_wp, v(k,j+1,i) - v_gtrans ) *                 &
                            ABS( ( sk(k,j+1,i) - sk(k,j+2,i)            ) /    &
                                 ( sk(k,j,i)   - sk(k,j+1,i) + 1E-20_wp )      &
@@ -1032,9 +1033,9 @@
              k_mmm  = k - 3 * ibit8
 
-             rd     = ( MAX( 0.0, w(k-1,j,i) ) *                              & 
+             rd     = ( MAX( 0.0_wp, w(k-1,j,i) ) *                           & 
                            ABS( ( sk(k_mm,j,i) - sk(k_mmm,j,i)           ) /  &
                                 ( sk(k-1,j,i)  - sk(k_mm,j,i) + 1E-20_wp )    &
                               ) +                                             & 
-                        MIN( 0.0, w(k-1,j,i) ) *                              &
+                        MIN( 0.0_wp, w(k-1,j,i) ) *                           &
                            ABS( ( sk(k-1,j,i) - sk(k,j,i)            ) /      &
                                 ( sk(k_mm,j,i) - sk(k-1,j,i)   + 1E-20_wp )   &
@@ -1042,9 +1043,9 @@
                       ) * ibit8 / ABS( w(k-1,j,i) + 1E-20_wp ) 
  
-             rt     = ( MAX( 0.0, w(k,j,i) ) *                                & 
+             rt     = ( MAX( 0.0_wp, w(k,j,i) ) *                             & 
                            ABS( ( sk(k,j,i)   - sk(k-1,j,i)            ) /    &
                                 ( sk(k+1,j,i) - sk(k,j,i)   + 1E-20_wp )      &
                               ) +                                             & 
-                        MIN( 0.0, w(k,j,i) ) *                                &
+                        MIN( 0.0_wp, w(k,j,i) ) *                             &
                            ABS( ( sk(k+1,j,i) - sk(k_pp,j,i)           ) /    &
                                 ( sk(k,j,i)   - sk(k+1,j,i) + 1E-20_wp )      &
@@ -2893,9 +2894,9 @@
 !--                Calculate ratio of upwind gradients. Note, Min/Max is just
 !--                to avoid if statements.
-                   rl     = ( MAX( 0.0, u(k,j,i) - u_gtrans ) *               & 
+                   rl     = ( MAX( 0.0_wp, u(k,j,i) - u_gtrans ) *            & 
                                ABS( ( sk(k,j,i-1) - sk(k,j,i-2)            ) /&
                                     ( sk(k,j,i)   - sk(k,j,i-1) + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, u(k,j,i) - u_gtrans ) *               &
+                              MIN( 0.0_wp, u(k,j,i) - u_gtrans ) *            &
                                ABS( ( sk(k,j,i)   - sk(k,j,i+1)            ) /&
                                     ( sk(k,j,i-1) - sk(k,j,i)   + 1E-20_wp )  &
@@ -2903,9 +2904,9 @@
                             ) / ABS( u(k,j,i) - u_gtrans + 1E-20_wp )
 
-                   rr     = ( MAX( 0.0, u(k,j,i+1) - u_gtrans ) *             & 
+                   rr     = ( MAX( 0.0_wp, u(k,j,i+1) - u_gtrans ) *          & 
                                ABS( ( sk(k,j,i)   - sk(k,j,i-1)            ) /&
                                     ( sk(k,j,i+1) - sk(k,j,i)   + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, u(k,j,i+1) - u_gtrans ) *             &
+                              MIN( 0.0_wp, u(k,j,i+1) - u_gtrans ) *          &
                                ABS( ( sk(k,j,i+1) - sk(k,j,i+2)            ) /&
                                     ( sk(k,j,i)   - sk(k,j,i+1) + 1E-20_wp )  &
@@ -2913,9 +2914,9 @@
                             ) / ABS( u(k,j,i+1) - u_gtrans + 1E-20_wp )
 
-                   rs     = ( MAX( 0.0, v(k,j,i) - v_gtrans ) *               & 
+                   rs     = ( MAX( 0.0_wp, v(k,j,i) - v_gtrans ) *            & 
                                ABS( ( sk(k,j-1,i) - sk(k,j-2,i)            ) /&
                                     ( sk(k,j,i)   - sk(k,j-1,i) + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, v(k,j,i) - v_gtrans ) *               &
+                              MIN( 0.0_wp, v(k,j,i) - v_gtrans ) *            &
                                ABS( ( sk(k,j,i)   - sk(k,j+1,i)            ) /&
                                     ( sk(k,j-1,i) - sk(k,j,i)   + 1E-20_wp )  &
@@ -2923,9 +2924,9 @@
                             ) / ABS( v(k,j,i) - v_gtrans + 1E-20_wp )
 
-                   rn     = ( MAX( 0.0, v(k,j+1,i) - v_gtrans ) *             & 
+                   rn     = ( MAX( 0.0_wp, v(k,j+1,i) - v_gtrans ) *          & 
                                ABS( ( sk(k,j,i)   - sk(k,j-1,i)            ) /&
                                     ( sk(k,j+1,i) - sk(k,j,i)   + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, v(k,j+1,i) - v_gtrans ) *             &
+                              MIN( 0.0_wp, v(k,j+1,i) - v_gtrans ) *          &
                                ABS( ( sk(k,j+1,i) - sk(k,j+2,i)            ) /&
                                     ( sk(k,j,i)   - sk(k,j+1,i) + 1E-20_wp )  &
@@ -2939,9 +2940,9 @@
                    k_mmm  = k - 3 * ibit8
 
-                   rd     = ( MAX( 0.0, w(k-1,j,i) ) *                        & 
+                   rd     = ( MAX( 0.0_wp, w(k-1,j,i) ) *                     & 
                             ABS( ( sk(k_mm,j,i) - sk(k_mmm,j,i)           ) / &
                                  ( sk(k-1,j,i)  - sk(k_mm,j,i) + 1E-20_wp )   &
                                ) +                                            & 
-                              MIN( 0.0, w(k-1,j,i) ) *                        &
+                              MIN( 0.0_wp, w(k-1,j,i) ) *                     &
                             ABS( ( sk(k-1,j,i) - sk(k,j,i)            ) /     &
                                  ( sk(k_mm,j,i) - sk(k-1,j,i)   + 1E-20_wp )  &
@@ -2949,9 +2950,9 @@
                             ) * ibit8 / ABS( w(k-1,j,i) + 1E-20_wp ) 
  
-                   rt     = ( MAX( 0.0, w(k,j,i) ) *                          & 
+                   rt     = ( MAX( 0.0_wp, w(k,j,i) ) *                       & 
                             ABS( ( sk(k,j,i)   - sk(k-1,j,i)            ) /   &
                                  ( sk(k+1,j,i) - sk(k,j,i)   + 1E-20_wp )     &
                                ) +                                            & 
-                              MIN( 0.0, w(k,j,i) ) *                          &
+                              MIN( 0.0_wp, w(k,j,i) ) *                       &
                             ABS( ( sk(k+1,j,i) - sk(k_pp,j,i)           ) /   &
                                  ( sk(k,j,i)   - sk(k+1,j,i) + 1E-20_wp )     &
@@ -3118,9 +3119,9 @@
 !--                Calculate ratio of upwind gradients. Note, Min/Max is just
 !--                to avoid if statements.
-                   rl     = ( MAX( 0.0, u(k,j,i) - u_gtrans ) *               & 
+                   rl     = ( MAX( 0.0_wp, u(k,j,i) - u_gtrans ) *            & 
                                ABS( ( sk(k,j,i-1) - sk(k,j,i-2)            ) /&
                                     ( sk(k,j,i)   - sk(k,j,i-1) + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, u(k,j,i) - u_gtrans ) *               &
+                              MIN( 0.0_wp, u(k,j,i) - u_gtrans ) *            &
                                ABS( ( sk(k,j,i)   - sk(k,j,i+1)            ) /&
                                     ( sk(k,j,i-1) - sk(k,j,i)   + 1E-20_wp )  &
@@ -3128,9 +3129,9 @@
                             ) / ABS( u(k,j,i) - u_gtrans + 1E-20_wp )
 
-                   rr     = ( MAX( 0.0, u(k,j,i+1) - u_gtrans ) *             & 
+                   rr     = ( MAX( 0.0_wp, u(k,j,i+1) - u_gtrans ) *          & 
                                ABS( ( sk(k,j,i)   - sk(k,j,i-1)            ) /&
                                     ( sk(k,j,i+1) - sk(k,j,i)   + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, u(k,j,i+1) - u_gtrans ) *             &
+                              MIN( 0.0_wp, u(k,j,i+1) - u_gtrans ) *          &
                                ABS( ( sk(k,j,i+1) - sk(k,j,i+2)            ) /&
                                     ( sk(k,j,i)   - sk(k,j,i+1) + 1E-20_wp )  &
@@ -3138,9 +3139,9 @@
                             ) / ABS( u(k,j,i+1) - u_gtrans + 1E-20_wp )
 
-                   rs     = ( MAX( 0.0, v(k,j,i) - v_gtrans ) *               & 
+                   rs     = ( MAX( 0.0_wp, v(k,j,i) - v_gtrans ) *            & 
                                ABS( ( sk(k,j-1,i) - sk(k,j-2,i)            ) /&
                                     ( sk(k,j,i)   - sk(k,j-1,i) + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, v(k,j,i) - v_gtrans ) *               &
+                              MIN( 0.0_wp, v(k,j,i) - v_gtrans ) *            &
                                ABS( ( sk(k,j,i)   - sk(k,j+1,i)            ) /&
                                     ( sk(k,j-1,i) - sk(k,j,i)   + 1E-20_wp )  &
@@ -3148,9 +3149,9 @@
                             ) / ABS( v(k,j,i) - v_gtrans + 1E-20_wp )
 
-                   rn     = ( MAX( 0.0, v(k,j+1,i) - v_gtrans ) *             & 
+                   rn     = ( MAX( 0.0_wp, v(k,j+1,i) - v_gtrans ) *          & 
                                ABS( ( sk(k,j,i)   - sk(k,j-1,i)            ) /&
                                     ( sk(k,j+1,i) - sk(k,j,i)   + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, v(k,j+1,i) - v_gtrans ) *             &
+                              MIN( 0.0_wp, v(k,j+1,i) - v_gtrans ) *          &
                                ABS( ( sk(k,j+1,i) - sk(k,j+2,i)            ) /&
                                     ( sk(k,j,i)   - sk(k,j+1,i) + 1E-20_wp )  &
@@ -3164,9 +3165,9 @@
                    k_mmm  = k - 3 * ibit8
 
-                   rd     = ( MAX( 0.0, w(k-1,j,i) ) *                        & 
+                   rd     = ( MAX( 0.0_wp, w(k-1,j,i) ) *                     & 
                             ABS( ( sk(k_mm,j,i) - sk(k_mmm,j,i)           ) / &
                                  ( sk(k-1,j,i)  - sk(k_mm,j,i) + 1E-20_wp )   &
                                ) +                                            & 
-                              MIN( 0.0, w(k-1,j,i) ) *                        &
+                              MIN( 0.0_wp, w(k-1,j,i) ) *                     &
                             ABS( ( sk(k-1,j,i) - sk(k,j,i)            ) /     &
                                  ( sk(k_mm,j,i) - sk(k-1,j,i)   + 1E-20_wp )  &
@@ -3174,9 +3175,9 @@
                             ) * ibit8 / ABS( w(k-1,j,i) + 1E-20_wp ) 
  
-                   rt     = ( MAX( 0.0, w(k,j,i) ) *                          & 
+                   rt     = ( MAX( 0.0_wp, w(k,j,i) ) *                       & 
                             ABS( ( sk(k,j,i)   - sk(k-1,j,i)            ) /   &
                                  ( sk(k+1,j,i) - sk(k,j,i)   + 1E-20_wp )     &
                                ) +                                            & 
-                              MIN( 0.0, w(k,j,i) ) *                          &
+                              MIN( 0.0_wp, w(k,j,i) ) *                       &
                             ABS( ( sk(k+1,j,i) - sk(k_pp,j,i)           ) /   &
                                  ( sk(k,j,i)   - sk(k+1,j,i) + 1E-20_wp )     &
@@ -3631,9 +3632,9 @@
 !--                Calculate ratio of upwind gradients. Note, Min/Max is just
 !--                to avoid if statements.
-                   rl     = ( MAX( 0.0, u(k,j,i) - u_gtrans ) *               & 
+                   rl     = ( MAX( 0.0_wp, u(k,j,i) - u_gtrans ) *            & 
                                ABS( ( sk(k,j,i-1) - sk(k,j,i-2)            ) /&
                                     ( sk(k,j,i)   - sk(k,j,i-1) + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, u(k,j,i) - u_gtrans ) *               &
+                              MIN( 0.0_wp, u(k,j,i) - u_gtrans ) *            &
                                ABS( ( sk(k,j,i)   - sk(k,j,i+1)            ) /&
                                     ( sk(k,j,i-1) - sk(k,j,i)   + 1E-20_wp )  &
@@ -3641,9 +3642,9 @@
                             ) / ABS( u(k,j,i) - u_gtrans + 1E-20_wp )
 
-                   rr     = ( MAX( 0.0, u(k,j,i+1) - u_gtrans ) *             & 
+                   rr     = ( MAX( 0.0_wp, u(k,j,i+1) - u_gtrans ) *          & 
                                ABS( ( sk(k,j,i)   - sk(k,j,i-1)            ) /&
                                     ( sk(k,j,i+1) - sk(k,j,i)   + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, u(k,j,i+1) - u_gtrans ) *             &
+                              MIN( 0.0_wp, u(k,j,i+1) - u_gtrans ) *          &
                                ABS( ( sk(k,j,i+1) - sk(k,j,i+2)            ) /&
                                     ( sk(k,j,i)   - sk(k,j,i+1) + 1E-20_wp )  &
@@ -3651,9 +3652,9 @@
                             ) / ABS( u(k,j,i+1) - u_gtrans + 1E-20_wp )
 
-                   rs     = ( MAX( 0.0, v(k,j,i) - v_gtrans ) *               & 
+                   rs     = ( MAX( 0.0_wp, v(k,j,i) - v_gtrans ) *            & 
                                ABS( ( sk(k,j-1,i) - sk(k,j-2,i)            ) /&
                                     ( sk(k,j,i)   - sk(k,j-1,i) + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, v(k,j,i) - v_gtrans ) *               &
+                              MIN( 0.0_wp, v(k,j,i) - v_gtrans ) *            &
                                ABS( ( sk(k,j,i)   - sk(k,j+1,i)            ) /&
                                     ( sk(k,j-1,i) - sk(k,j,i)   + 1E-20_wp )  &
@@ -3661,9 +3662,9 @@
                             ) / ABS( v(k,j,i) - v_gtrans + 1E-20_wp )
 
-                   rn     = ( MAX( 0.0, v(k,j+1,i) - v_gtrans ) *             & 
+                   rn     = ( MAX( 0.0_wp, v(k,j+1,i) - v_gtrans ) *          & 
                                ABS( ( sk(k,j,i)   - sk(k,j-1,i)            ) /&
                                     ( sk(k,j+1,i) - sk(k,j,i)   + 1E-20_wp )  &
                                   ) +                                         & 
-                              MIN( 0.0, v(k,j+1,i) - v_gtrans ) *             &
+                              MIN( 0.0_wp, v(k,j+1,i) - v_gtrans ) *          &
                                ABS( ( sk(k,j+1,i) - sk(k,j+2,i)            ) /&
                                     ( sk(k,j,i)   - sk(k,j+1,i) + 1E-20_wp )  &
@@ -3677,9 +3678,9 @@
                    k_mmm  = k - 3 * ibit8
 
-                   rd     = ( MAX( 0.0, w(k-1,j,i) ) *                        & 
+                   rd     = ( MAX( 0.0_wp, w(k-1,j,i) ) *                     & 
                             ABS( ( sk(k_mm,j,i) - sk(k_mmm,j,i)           ) / &
                                  ( sk(k-1,j,i)  - sk(k_mm,j,i) + 1E-20_wp )   &
                                ) +                                            & 
-                              MIN( 0.0, w(k-1,j,i) ) *                        &
+                              MIN( 0.0_wp, w(k-1,j,i) ) *                     &
                             ABS( ( sk(k-1,j,i) - sk(k,j,i)            ) /     &
                                  ( sk(k_mm,j,i) - sk(k-1,j,i)   + 1E-20_wp )  &
@@ -3687,9 +3688,9 @@
                             ) * ibit8 / ABS( w(k-1,j,i) + 1E-20_wp ) 
  
-                   rt     = ( MAX( 0.0, w(k,j,i) ) *                          & 
+                   rt     = ( MAX( 0.0_wp, w(k,j,i) ) *                       & 
                             ABS( ( sk(k,j,i)   - sk(k-1,j,i)            ) /   &
                                  ( sk(k+1,j,i) - sk(k,j,i)   + 1E-20_wp )     &
                                ) +                                            & 
-                              MIN( 0.0, w(k,j,i) ) *                          &
+                              MIN( 0.0_wp, w(k,j,i) ) *                       &
                             ABS( ( sk(k+1,j,i) - sk(k_pp,j,i)           ) /   &
                                  ( sk(k,j,i)   - sk(k+1,j,i) + 1E-20_wp )     &
