Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 865)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 866)
@@ -4,4 +4,7 @@
 ! Current revisions:
 ! -----------------
+! use only 60% of the geostrophic wind as translation speed in case of Galilean
+! transformation and use_ug_for_galilei_tr = .T. in order to mimimize the
+! timestep
 !
 ! Former revisions:
@@ -1328,6 +1331,6 @@
             ug_vertical_gradient_level(1) == 0.0 .AND. & 
             vg_vertical_gradient_level(1) == 0.0 )  THEN
-          u_gtrans = ug_surface
-          v_gtrans = vg_surface
+          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 )  THEN
Index: palm/trunk/SOURCE/global_min_max.f90
===================================================================
--- palm/trunk/SOURCE/global_min_max.f90	(revision 865)
+++ palm/trunk/SOURCE/global_min_max.f90	(revision 866)
@@ -1,8 +1,9 @@
- SUBROUTINE global_min_max( i1, i2, j1, j2, k1, k2, ar, mode, value, &
+ SUBROUTINE global_min_max( i1, i2, j1, j2, k1, k2, ar, mode, offset, value, &
                             value_ijk, value1, value1_ijk )
 
 !------------------------------------------------------------------------------!
 ! Current revisions:
-! -----------------
+! ------------------
+! new mode "absoff" accounts for an offset in the respective array
 !
 ! Former revisions:
@@ -43,5 +44,5 @@
                           fmin_ijk_l(3), value_ijk(3)
     INTEGER, OPTIONAL ::  value1_ijk(3)
-    REAL              ::  value, &
+    REAL              ::  offset, value, &
                           ar(i1:i2,j1:j2,k1:k2)
 #if defined( __ibm )
@@ -62,5 +63,5 @@
 !--    Determine the local minimum
        fmin_ijk_l = MINLOC( ar )
-       fmin_ijk_l(1) = i1 + fmin_ijk_l(1) - nbgp    ! MINLOC assumes lowerbound = 1
+       fmin_ijk_l(1) = i1 + fmin_ijk_l(1) - nbgp ! MINLOC assumes lowerbound = 1
        fmin_ijk_l(2) = j1 + fmin_ijk_l(2) - nbgp
        fmin_ijk_l(3) = k1 + fmin_ijk_l(3) - 1
@@ -103,5 +104,5 @@
 !--    Determine the local maximum
        fmax_ijk_l = MAXLOC( ar )
-       fmax_ijk_l(1) = i1 + fmax_ijk_l(1) - nbgp    ! MAXLOC assumes lowerbound = 1
+       fmax_ijk_l(1) = i1 + fmax_ijk_l(1) - nbgp ! MAXLOC assumes lowerbound = 1
        fmax_ijk_l(2) = j1 + fmax_ijk_l(2) - nbgp
        fmax_ijk_l(3) = k1 + fmax_ijk_l(3) - 1
@@ -198,4 +199,68 @@
 
 !
+!-- Determine absolute maximum of ( array - offset )
+    IF ( mode == 'absoff' )  THEN
+
+!
+!--    Determine the local absolut maximum
+       fmax_l(1)     = 0.0
+       fmax_ijk_l(1) =  i1
+       fmax_ijk_l(2) =  j1
+       fmax_ijk_l(3) =  k1
+       DO  k = k1, k2
+          DO  j = j1, j2
+!
+!--          Attention: the lowest gridpoint is excluded here, because there
+!--          ---------  is no advection at nzb=0 and mode 'absoff' is only
+!--                     used for calculating u,v extrema for CFL-criteria
+             DO  i = i1+1, i2
+                IF ( ABS( ar(i,j,k) - offset ) > fmax_l(1) )  THEN
+                   fmax_l(1) = ABS( ar(i,j,k) - offset )
+                   fmax_ijk_l(1) = i
+                   fmax_ijk_l(2) = j
+                   fmax_ijk_l(3) = k
+                ENDIF
+             ENDDO
+          ENDDO
+       ENDDO
+
+!
+!--    Set a flag in case that the determined value is negative.
+!--    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
+          fmax_ijk_l(1) = -fmax_ijk_l(1) - 10
+       ENDIF
+
+#if defined( __parallel )
+       fmax_l(2)  = myid
+       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
+       CALL MPI_ALLREDUCE( fmax_l, fmax, 1, MPI_2REAL, MPI_MAXLOC, comm2d, &
+                           ierr )
+
+!
+!--    Determine the global absolut maximum. Result stored on PE0.
+       id_fmax = fmax(2)
+       IF ( id_fmax /= 0 )  THEN
+          IF ( myid == 0 )  THEN
+             CALL MPI_RECV( fmax_ijk, 3, MPI_INTEGER, id_fmax, 0, comm2d, &
+                            status, ierr )
+          ELSEIF ( myid == id_fmax )  THEN
+             CALL MPI_SEND( fmax_ijk_l, 3, MPI_INTEGER, 0, 0, comm2d, ierr )
+          ENDIF
+       ELSE
+          fmax_ijk = fmax_ijk_l
+       ENDIF
+!
+!--    Send the indices of the just determined absolut maximum to other PEs
+       CALL MPI_BCAST( fmax_ijk, 3, MPI_INTEGER, 0, comm2d, ierr )
+#else
+       fmax(1)  = fmax_l(1)
+       fmax_ijk = fmax_ijk_l
+#endif
+
+    ENDIF
+
+!
 !-- Determine output parameters
     SELECT CASE( mode )
@@ -218,5 +283,5 @@
           value1_ijk = fmax_ijk
 
-       CASE( 'abs' )
+       CASE( 'abs', 'absoff' )
 
           value     = fmax(1)
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 865)
+++ palm/trunk/SOURCE/modules.f90	(revision 866)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! interface for global_min_max changed
 !
 ! Former revisions:
@@ -978,11 +979,11 @@
     INTERFACE
 
-       SUBROUTINE global_min_max ( i1, i2, j1, j2, k1, k2, feld, mode, wert, &
-                                   wert_ijk, wert1, wert1_ijk )
+       SUBROUTINE global_min_max ( i1, i2, j1, j2, k1, k2, feld, mode, offset, &
+                                   wert, wert_ijk, wert1, wert1_ijk )
           CHARACTER (LEN=*), INTENT(IN) ::  mode
           INTEGER, INTENT(IN)           ::  i1, i2, j1, j2, k1, k2
           INTEGER                       ::  wert_ijk(3)
           INTEGER, OPTIONAL             ::  wert1_ijk(3)
-          REAL                          ::  wert
+          REAL                          ::  offset, wert
           REAL, OPTIONAL                ::  wert1
           REAL, INTENT(IN)              ::  feld(i1:i2,j1:j2,k1:k2)
Index: palm/trunk/SOURCE/timestep.f90
===================================================================
--- palm/trunk/SOURCE/timestep.f90	(revision 865)
+++ palm/trunk/SOURCE/timestep.f90	(revision 866)
@@ -3,6 +3,7 @@
 !------------------------------------------------------------------------------!
 ! Current revisions:
-! -----------------
-! 
+! ------------------
+! bugfix for timestep calculation in case of Galilei transformation,
+! special treatment in case of mirror velocity boundary condition removed
 !
 ! Former revisions:
@@ -56,5 +57,5 @@
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k
+    INTEGER ::  i, j, k, u_max_cfl_ijk(3), v_max_cfl_ijk(3)
 
     REAL ::  div, dt_diff, dt_diff_l, dt_plant_canopy,                 &
@@ -62,5 +63,5 @@
              dt_plant_canopy_u, dt_plant_canopy_v, dt_plant_canopy_w,  & 
              dt_u, dt_v, dt_w, lad_max, percent_change,                &
-             u_gtrans_l, vabs_max, value, v_gtrans_l
+             u_gtrans_l, u_max_cfl, vabs_max, value, v_gtrans_l, v_max_cfl
 
     REAL, DIMENSION(2)         ::  uv_gtrans, uv_gtrans_l
@@ -70,31 +71,4 @@
 
     CALL cpu_log( log_point(12), 'calculate_timestep', 'start' )
-
-!
-!-- Determine the maxima of the velocity components.
-    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, u, 'abs', &
-                         u_max, u_max_ijk )
-    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, v, 'abs', &
-                         v_max, v_max_ijk )
-    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, w, 'abs', &
-                         w_max, w_max_ijk )
-
-!
-!-- In case maxima of the horizontal velocity components have been found at the
-!-- bottom boundary (k=nzb), the corresponding maximum at level k=1 is chosen
-!-- if the Dirichlet-boundary condition ('mirror') has been set. This is 
-!-- necessary, because otherwise in case of Galilei-transform a far too large
-!-- velocity (having the respective opposite sign) would be used for the time
-!-- step determination (almost double the mean flow velocity).
-    IF ( ibc_uv_b == 0 )  THEN
-       IF ( u_max_ijk(1) == nzb )  THEN
-          u_max        = -u_max
-          u_max_ijk(1) = nzb + 1
-       ENDIF
-       IF ( v_max_ijk(1) == nzb )  THEN
-          v_max        = -v_max
-          v_max_ijk(1) = nzb + 1
-       ENDIF
-    ENDIF
 
 !
@@ -142,4 +116,29 @@
     ENDIF
 
+!
+!-- Determine the maxima of the velocity components.
+    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, u, 'abs', 0.0, &
+                         u_max, u_max_ijk )
+    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, v, 'abs', 0.0, &
+                         v_max, v_max_ijk )
+    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, w, 'abs', 0.0, &
+                         w_max, w_max_ijk )
+
+!
+!-- In case of Galilei transformation, the horizontal velocity maxima have
+!-- to be calculated from the transformed horizontal velocities
+    IF ( galilei_transformation )  THEN
+       CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, u, 'absoff', &
+                            u_gtrans, u_max_cfl, u_max_cfl_ijk )
+       CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, v, 'absoff', &
+                            v_gtrans, v_max_cfl, v_max_cfl_ijk )
+    ELSE
+       u_max_cfl = u_max
+       v_max_cfl = v_max
+       u_max_cfl_ijk = u_max_ijk
+       v_max_cfl_ijk = v_max_ijk
+    ENDIF
+
+
     IF ( .NOT. dt_fixed )  THEN
 !
@@ -147,7 +146,7 @@
 !
 !--    For each component, compute the maximum time step according to the 
-!--    FCL-criterion.
-       dt_u = dx / ( ABS( u_max - u_gtrans ) + 1.0E-10 )
-       dt_v = dy / ( ABS( v_max - v_gtrans ) + 1.0E-10 )
+!--    CFL-criterion.
+       dt_u = dx / ( ABS( u_max_cfl ) + 1.0E-10 )
+       dt_v = dy / ( ABS( v_max_cfl ) + 1.0E-10 )
        dt_w = dzu(MAX( 1, w_max_ijk(1) )) / ( ABS( w_max ) + 1.0E-10 )
 
@@ -267,5 +266,5 @@
 #if defined( __parallel )
           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( dt_plant_canopy_l, dt_plant_canopy, 1, MPI_REAL,  &
+          CALL MPI_ALLREDUCE( dt_plant_canopy_l, dt_plant_canopy, 1, MPI_REAL, &
                               MPI_MIN, comm2d, ierr )
 #else
@@ -318,9 +317,9 @@
                '&dt_diff         = ', dt_diff, ' s',                          &
                '&dt_plant_canopy = ', dt_plant_canopy, ' s',                  &
-               '&u_max   = ', u_max, ' m/s   k=', u_max_ijk(1),               &
+               '&u_max_cfl   = ', u_max_cfl, ' m/s   k=', u_max_cfl_ijk(1),   &
                '  j=', u_max_ijk(2), '  i=', u_max_ijk(3),                    &
-               '&v_max   = ', v_max, ' m/s   k=', v_max_ijk(1),               &
+               '&v_max_cfl   = ', v_max_cfl, ' m/s   k=', v_max_cfl_ijk(1),   &
                '  j=', v_max_ijk(2), '  i=', v_max_ijk(3),                    &
-               '&w_max   = ', w_max, ' m/s   k=', w_max_ijk(1),               &
+               '&w_max       = ', w_max, ' m/s   k=', w_max_ijk(1),           &
                '  j=', w_max_ijk(2), '  i=', w_max_ijk(3)
           CALL message( 'timestep', 'PA0312', 0, 1, 0, 6, 0 )
