Index: palm/trunk/SOURCE/timestep.f90
===================================================================
--- palm/trunk/SOURCE/timestep.f90	(revision 1323)
+++ palm/trunk/SOURCE/timestep.f90	(revision 1342)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! REAL constants defined as wp-kind
 !
 ! Former revisions:
@@ -153,6 +153,6 @@
 !--       Horizontal averages already existent, just need to average them 
 !--       vertically.
-          u_gtrans = 0.0
-          v_gtrans = 0.0
+          u_gtrans = 0.0_wp
+          v_gtrans = 0.0_wp
           DO  k = nzb+1, nzt
              u_gtrans = u_gtrans + hom(k,1,1,0)
@@ -164,6 +164,6 @@
 !
 !--       Averaging over the entire model domain.
-          u_gtrans_l = 0.0
-          v_gtrans_l = 0.0
+          u_gtrans_l = 0.0_wp
+          v_gtrans_l = 0.0_wp
           !$acc parallel present( u, v )
           DO  i = nxl, nxr
@@ -196,10 +196,10 @@
 #if defined( __openacc )
     IF ( dt_fixed )  THEN  ! otherwise do it further below for better cache usage
-       u_max_l = -999999.9
-       u_min_l =  999999.9
-       v_max_l = -999999.9
-       v_min_l =  999999.9
-       w_max_l = -999999.9
-       w_min_l =  999999.9
+       u_max_l = -999999.9_wp
+       u_min_l =  999999.9_wp
+       v_max_l = -999999.9_wp
+       v_min_l =  999999.9_wp
+       w_max_l = -999999.9_wp
+       w_min_l =  999999.9_wp
        !$acc parallel present( u, v, w )
        DO  i = nxl, nxr
@@ -266,20 +266,20 @@
 !--    Calculate the maximum time step according to the CFL-criterion,
 !--    individually for each velocity component
-       dt_u_l  =  999999.9
-       dt_v_l  =  999999.9
-       dt_w_l  =  999999.9
-       u_max_l = -999999.9
-       u_min_l =  999999.9
-       v_max_l = -999999.9
-       v_min_l =  999999.9
-       w_max_l = -999999.9
-       w_min_l =  999999.9
+       dt_u_l  =  999999.9_wp
+       dt_v_l  =  999999.9_wp
+       dt_w_l  =  999999.9_wp
+       u_max_l = -999999.9_wp
+       u_min_l =  999999.9_wp
+       v_max_l = -999999.9_wp
+       v_min_l =  999999.9_wp
+       w_max_l = -999999.9_wp
+       w_min_l =  999999.9_wp
        !$acc parallel loop collapse(3) present( u, v, w )
        DO  i = nxl, nxr
           DO  j = nys, nyn
              DO  k = nzb+1, nzt
-                dt_u_l  = MIN( dt_u_l, ( dx     / ( ABS( u(k,j,i) - u_gtrans ) + 1.0E-10 ) ) )
-                dt_v_l  = MIN( dt_v_l, ( dy     / ( ABS( v(k,j,i) - v_gtrans ) + 1.0E-10 ) ) )
-                dt_w_l  = MIN( dt_w_l, ( dzu(k) / ( ABS( w(k,j,i) )            + 1.0E-10 ) ) )
+                dt_u_l  = MIN( dt_u_l, ( dx     / ( ABS( u(k,j,i) - u_gtrans ) + 1.0E-10_wp ) ) )
+                dt_v_l  = MIN( dt_v_l, ( dy     / ( ABS( v(k,j,i) - v_gtrans ) + 1.0E-10_wp ) ) )
+                dt_w_l  = MIN( dt_w_l, ( dzu(k) / ( ABS( w(k,j,i) )            + 1.0E-10_wp ) ) )
                 u_max_l = MAX( u_max_l, u(k,j,i) )
                 u_min_l = MIN( u_min_l, u(k,j,i) )
@@ -346,13 +346,13 @@
 !--    Calculate the maximum time step according to the CFL-criterion,
 !--    individually for each velocity component
-       dt_u_l = 999999.9
-       dt_v_l = 999999.9
-       dt_w_l = 999999.9
+       dt_u_l = 999999.9_wp
+       dt_v_l = 999999.9_wp
+       dt_w_l = 999999.9_wp
        DO  i = nxl, nxr
           DO  j = nys, nyn
              DO  k = nzb+1, nzt
-                dt_u_l = MIN( dt_u_l, ( dx     / ( ABS( u(k,j,i) - u_gtrans ) + 1.0E-10 ) ) )
-                dt_v_l = MIN( dt_v_l, ( dy     / ( ABS( v(k,j,i) - v_gtrans ) + 1.0E-10 ) ) )
-                dt_w_l = MIN( dt_w_l, ( dzu(k) / ( ABS( w(k,j,i) )            + 1.0E-10 ) ) )
+                dt_u_l = MIN( dt_u_l, ( dx     / ( ABS( u(k,j,i) - u_gtrans ) + 1.0E-10_wp ) ) )
+                dt_v_l = MIN( dt_v_l, ( dy     / ( ABS( v(k,j,i) - v_gtrans ) + 1.0E-10_wp ) ) )
+                dt_w_l = MIN( dt_w_l, ( dzu(k) / ( ABS( w(k,j,i) )            + 1.0E-10_wp ) ) )
              ENDDO
           ENDDO
@@ -382,8 +382,8 @@
 !--          in the Prandtl-layer friction term only dz/2 is used.
 !--          Experience from the old model seems to justify this.
-       dt_diff_l = 999999.0
+       dt_diff_l = 999999.0_wp
 
        DO  k = nzb+1, nzt
-           dxyz2_min(k) = MIN( dx2, dy2, dzw(k)*dzw(k) ) * 0.125
+           dxyz2_min(k) = MIN( dx2, dy2, dzw(k)*dzw(k) ) * 0.125_wp
        ENDDO
 
@@ -395,5 +395,5 @@
              DO  k = nzb+1, nzt
                 dt_diff_l = MIN( dt_diff_l, dxyz2_min(k) / &
-                                       ( MAX( kh(k,j,i), km(k,j,i) ) + 1E-20 ) )
+                                       ( MAX( kh(k,j,i), km(k,j,i) ) + 1E-20_wp ) )
              ENDDO
           ENDDO
@@ -414,5 +414,5 @@
        IF ( plant_canopy ) THEN
 
-          dt_plant_canopy_l = 0.0
+          dt_plant_canopy_l = 0.0_wp
           DO  i = nxl, nxr
              DO  j = nys, nyn
@@ -424,10 +424,10 @@
                                                  v(k,j+1,i)      +  &
                                                  v(k,j+1,i-1) )     &
-                                               / 4.0 )**2        +  &
+                                               / 4.0_wp )**2     +  &
                                              ( ( w(k-1,j,i-1)    +  &
                                                  w(k-1,j,i)      +  &
                                                  w(k,j,i-1)      +  &
                                                  w(k,j,i) )         &
-                                                 / 4.0 )**2 ) 
+                                                 / 4.0_wp )**2 ) 
                    IF ( dt_plant_canopy_u > dt_plant_canopy_l ) THEN
                       dt_plant_canopy_l = dt_plant_canopy_u  
@@ -438,5 +438,5 @@
                                                  u(k,j,i)        +  &
                                                  u(k,j,i+1) )       &
-                                               / 4.0 )**2        +  &
+                                               / 4.0_wp )**2     +  &
                                                  v(k,j,i)**2     +  &
                                              ( ( w(k-1,j-1,i)    +  &
@@ -444,5 +444,5 @@
                                                  w(k,j-1,i)      +  &
                                                  w(k,j,i) )         &
-                                                 / 4.0 )**2 ) 
+                                                 / 4.0_wp )**2 ) 
                    IF ( dt_plant_canopy_v > dt_plant_canopy_l ) THEN
                       dt_plant_canopy_l = dt_plant_canopy_v
@@ -453,10 +453,10 @@
                                                  u(k+1,j,i)      +  &
                                                  u(k+1,j,i+1) )     &
-                                               / 4.0 )**2        +  &
+                                               / 4.0_wp )**2     +  &
                                              ( ( v(k,j,i)        +  &
                                                  v(k,j+1,i)      +  &
                                                  v(k+1,j,i)      +  &
                                                  v(k+1,j+1,i) )     &
-                                               / 4.0 )**2        +  &
+                                               / 4.0_wp )**2        +  &
                                                  w(k,j,i)**2 )     
                    IF ( dt_plant_canopy_w > dt_plant_canopy_l ) THEN
@@ -467,8 +467,8 @@
           ENDDO 
 
-          IF ( dt_plant_canopy_l > 0.0 ) THEN
+          IF ( dt_plant_canopy_l > 0.0_wp ) THEN
 !
 !--          Invert dt_plant_canopy_l and apply a security timestep factor 0.1
-             dt_plant_canopy_l = 0.1 / dt_plant_canopy_l
+             dt_plant_canopy_l = 0.1_wp / dt_plant_canopy_l
           ELSE
 !
@@ -515,5 +515,5 @@
 !
 !--    Set flag if the time step becomes too small.
-       IF ( dt_3d < ( 0.00001 * dt_max ) )  THEN
+       IF ( dt_3d < ( 0.00001_wp * dt_max ) )  THEN
           stop_dt = .TRUE.
 
@@ -553,9 +553,9 @@
 !
 !--    Ensure a smooth value (two significant digits) of the timestep.
-       div = 1000.0
+       div = 1000.0_wp
        DO  WHILE ( dt_3d < div )
-          div = div / 10.0
+          div = div / 10.0_wp
        ENDDO
-       dt_3d = NINT( dt_3d * 100.0 / div ) * div / 100.0
+       dt_3d = NINT( dt_3d * 100.0_wp / div ) * div / 100.0_wp
 
 !
