Index: palm/trunk/SOURCE/init_grid.f90
===================================================================
--- palm/trunk/SOURCE/init_grid.f90	(revision 2897)
+++ palm/trunk/SOURCE/init_grid.f90	(revision 2918)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Moved init_mixing_length to turbulence_closure_mod.f90
+! 
+! 2897 2018-03-15 11:47:16Z suehring
 ! Relax restrictions for topography input, terrain and building heights can be
 ! input separately and are not mandatory any more. 
@@ -284,5 +287,4 @@
 ! -----------------------------------------------------------------------------!
 !> Creating grid depending constants
-!> @todo: Move initialization mixing length
 !> @todo: Rearrange topo flag list
 !> @todo: reference 3D buildings on top of orography is not tested and may need
@@ -517,8 +519,4 @@
 
 !
-!-- Calculated grid-dependent as well as near-wall mixing length 
-    CALL init_mixing_length
-
-!
 !-- Determine the maximum level of topography. It is used for
 !-- steering the degradation of order of the applied advection scheme, 
@@ -1342,154 +1340,4 @@
  END SUBROUTINE filter_topography
 
-! Description:
-! -----------------------------------------------------------------------------!
-!> Pre-computation of grid-dependent and near-wall mixing length.
-!> @todo: move subroutine to turbulence module developed by M1 (Tobi).
-!------------------------------------------------------------------------------!
- SUBROUTINE init_mixing_length
-
-    USE arrays_3d,                                                             &
-        ONLY:  dzw, l_grid, l_wall, zu, zw
-
-    USE control_parameters,                                                    &
-        ONLY:  message_string, wall_adjustment_factor
-
-    USE grid_variables,                                                        &
-        ONLY:  dx, dy
-
-    USE indices,                                                               &
-        ONLY:  nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt,     &
-               wall_flags_0
-    
-    USE kinds
-
-    IMPLICIT NONE
-
-    INTEGER(iwp) ::  i             !< index variable along x
-    INTEGER(iwp) ::  j             !< index variable along y
-    INTEGER(iwp) ::  k             !< index variable along z
-
-    ALLOCATE( l_grid(1:nzt) )
-    ALLOCATE( l_wall(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-!
-!-- Compute the grid-dependent mixing length.
-    DO  k = 1, nzt
-       l_grid(k)  = ( dx * dy * dzw(k) )**0.33333333333333_wp
-    ENDDO
-!
-!-- Initialize near-wall mixing length l_wall only in the vertical direction
-!-- for the moment, multiplication with wall_adjustment_factor further below
-    l_wall(nzb,:,:)   = l_grid(1)
-    DO  k = nzb+1, nzt
-       l_wall(k,:,:)  = l_grid(k)
-    ENDDO
-    l_wall(nzt+1,:,:) = l_grid(nzt)
-
-    DO  k = 1, nzt
-       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', &
-                                     ' &horizontal reduction of near_wall ', &
-                                     'mixing length l_wall', &
-                                     ' &starting from height level k = ', k, '.'
-          CALL message( 'init_grid', 'PA0202', 0, 1, 0, 6, 0 )
-          EXIT
-       ENDIF
-    ENDDO
-!
-!-- In case of topography: limit near-wall mixing length l_wall further:
-!-- Go through all points of the subdomain one by one and look for the closest
-!-- surface.
-!-- Is this correct in the ocean case?
-    DO  i = nxl, nxr
-       DO  j = nys, nyn
-          DO  k = nzb+1, nzt
-!
-!--          Check if current gridpoint belongs to the atmosphere
-             IF ( BTEST( wall_flags_0(k,j,i), 0 ) )  THEN
-!
-!--             Check for neighbouring grid-points.
-!--             Vertical distance, down
-                IF ( .NOT. BTEST( wall_flags_0(k-1,j,i), 0 ) )                 &
-                   l_wall(k,j,i) = MIN( l_grid(k), zu(k) - zw(k-1) )
-!
-!--             Vertical distance, up
-                IF ( .NOT. BTEST( wall_flags_0(k+1,j,i), 0 ) )                 &
-                   l_wall(k,j,i) = MIN( l_grid(k), zw(k) - zu(k) )
-!
-!--             y-distance
-                IF ( .NOT. BTEST( wall_flags_0(k,j-1,i), 0 )  .OR.             &
-                     .NOT. BTEST( wall_flags_0(k,j+1,i), 0 ) )                 &
-                   l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k), 0.5_wp * dy )
-!
-!--             x-distance
-                IF ( .NOT. BTEST( wall_flags_0(k,j,i-1), 0 )  .OR.             &
-                     .NOT. BTEST( wall_flags_0(k,j,i+1), 0 ) )                 &
-                   l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k), 0.5_wp * dx )
-!
-!--              yz-distance (vertical edges, down)
-                 IF ( .NOT. BTEST( wall_flags_0(k-1,j-1,i), 0 )  .OR.          &
-                      .NOT. BTEST( wall_flags_0(k-1,j+1,i), 0 )  )             &
-                   l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),              &
-                                        SQRT( 0.25_wp * dy**2 +                &
-                                       ( zu(k) - zw(k-1) )**2 ) )
-!
-!--              yz-distance (vertical edges, up)
-                 IF ( .NOT. BTEST( wall_flags_0(k+1,j-1,i), 0 )  .OR.          &
-                      .NOT. BTEST( wall_flags_0(k+1,j+1,i), 0 )  )             &
-                   l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),              &
-                                        SQRT( 0.25_wp * dy**2 +                &
-                                       ( zw(k) - zu(k) )**2 ) )
-!   
-!--              xz-distance (vertical edges, down)
-                 IF ( .NOT. BTEST( wall_flags_0(k-1,j,i-1), 0 )  .OR.          &
-                      .NOT. BTEST( wall_flags_0(k-1,j,i+1), 0 )  )             &
-                   l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),              &
-                                        SQRT( 0.25_wp * dx**2 +                &
-                                       ( zu(k) - zw(k-1) )**2 ) )
-!
-!--              xz-distance (vertical edges, up)
-                 IF ( .NOT. BTEST( wall_flags_0(k+1,j,i-1), 0 )  .OR.          &
-                      .NOT. BTEST( wall_flags_0(k+1,j,i+1), 0 )  )             &
-                  l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),              &
-                                        SQRT( 0.25_wp * dx**2 +                &
-                                       ( zw(k) - zu(k) )**2 ) )
-!
-!--             xy-distance (horizontal edges)
-                IF ( .NOT. BTEST( wall_flags_0(k,j-1,i-1), 0 )  .OR.           &
-                     .NOT. BTEST( wall_flags_0(k,j+1,i-1), 0 )  .OR.           &
-                     .NOT. BTEST( wall_flags_0(k,j-1,i+1), 0 )  .OR.           &
-                     .NOT. BTEST( wall_flags_0(k,j+1,i+1), 0 ) )               &
-                   l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),              &
-                                        SQRT( 0.25_wp * ( dx**2 + dy**2 ) ) )
-!
-!--             xyz distance (vertical and horizontal edges, down)
-                IF ( .NOT. BTEST( wall_flags_0(k-1,j-1,i-1), 0 )  .OR.         &
-                     .NOT. BTEST( wall_flags_0(k-1,j+1,i-1), 0 )  .OR.         &
-                     .NOT. BTEST( wall_flags_0(k-1,j-1,i+1), 0 )  .OR.         &
-                     .NOT. BTEST( wall_flags_0(k-1,j+1,i+1), 0 ) )             &
-                   l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),              &
-                                        SQRT( 0.25_wp * ( dx**2 + dy**2 )      &
-                                              +  ( zu(k) - zw(k-1) )**2  ) )
-!
-!--             xyz distance (vertical and horizontal edges, up)
-                IF ( .NOT. BTEST( wall_flags_0(k+1,j-1,i-1), 0 )  .OR.         &
-                     .NOT. BTEST( wall_flags_0(k+1,j+1,i-1), 0 )  .OR.         &
-                     .NOT. BTEST( wall_flags_0(k+1,j-1,i+1), 0 )  .OR.         &
-                     .NOT. BTEST( wall_flags_0(k+1,j+1,i+1), 0 ) )             &
-                   l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),              &
-                                        SQRT( 0.25_wp * ( dx**2 + dy**2 )      &
-                                              +  ( zw(k) - zu(k) )**2  ) )
-                  
-             ENDIF
-          ENDDO
-       ENDDO
-    ENDDO
-!
-!-- Set lateral boundary conditions for l_wall
-    CALL exchange_horiz( l_wall, nbgp )     
-
- END SUBROUTINE init_mixing_length
 
 ! Description:
