Index: /palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_3d_model.f90	(revision 3287)
+++ /palm/trunk/SOURCE/init_3d_model.f90	(revision 3288)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! Introduce module parameter for number of inflow profiles
 ! 
 ! Former revisions:
@@ -798,5 +798,4 @@
     ALLOCATE( drho_air(nzb:nzt+1) )
     ALLOCATE( drho_air_zw(nzb:nzt+1) )
-
 !
 !-- Density profile calculation for anelastic approximation
@@ -1235,5 +1234,4 @@
              ENDDO
           ENDIF
-
 !
 !--       Set velocity components at non-atmospheric / oceanic grid points to 
@@ -1638,5 +1636,5 @@
 !--       profiles from the prerun. Alternatively, prescribed profiles
 !--       for u,v-components can be used.
-          ALLOCATE( mean_inflow_profiles(nzb:nzt+1,7) )
+          ALLOCATE( mean_inflow_profiles(nzb:nzt+1,1:num_mean_inflow_profiles) )
 
           IF ( use_prescribed_profile_data )  THEN
Index: /palm/trunk/SOURCE/modules.f90
===================================================================
--- /palm/trunk/SOURCE/modules.f90	(revision 3287)
+++ /palm/trunk/SOURCE/modules.f90	(revision 3288)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! +num_mean_inflow_profiles
 ! 
 ! Former revisions:
@@ -1203,4 +1203,5 @@
     INTEGER(iwp) ::  n_sor                             !< number of iterations to be used in SOR-scheme
     INTEGER(iwp) ::  normalizing_region = 0            !< namelist parameter
+    INTEGER(iwp) ::  num_mean_inflow_profiles = 7      !< number of mean inflow profiles in case of turbulent inflow
     INTEGER(iwp) ::  num_leg=0                         !< number of different legs in virtual flight measurements
     INTEGER(iwp) ::  num_var_fl                        !< number of sampling/output variables in virtual flight measurements
Index: /palm/trunk/SOURCE/read_restart_data_mod.f90
===================================================================
--- /palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 3287)
+++ /palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 3288)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! Introduce module parameter for number of inflow profiles
 ! 
 ! Former revisions:
@@ -460,5 +460,5 @@
              CASE ( 'mean_inflow_profiles' )
                 IF ( .NOT. ALLOCATED( mean_inflow_profiles ) )  THEN
-                   ALLOCATE( mean_inflow_profiles(0:nz+1,7) )
+                   ALLOCATE( mean_inflow_profiles(0:nz+1,1:num_mean_inflow_profiles) )
                 ENDIF
                 READ ( 13 )  mean_inflow_profiles
Index: /palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90
===================================================================
--- /palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 3287)
+++ /palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 3288)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! Introduce module parameter for number of inflow profiles
 ! 
 ! Former revisions:
@@ -152,5 +152,6 @@
 
     USE control_parameters,                                                    &
-        ONLY:  initializing_actions, message_string, syn_turb_gen
+        ONLY:  initializing_actions, num_mean_inflow_profiles, message_string, &
+               syn_turb_gen
 
     USE cpulog,                                                                &
@@ -439,5 +440,5 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  ddzw, u_init, v_init, zu
+        ONLY:  dzw, ddzw, u_init, v_init, zu, zw
 
     USE control_parameters,                                                    &
@@ -445,5 +446,5 @@
 
     USE grid_variables,                                                        &
-        ONLY:  ddx, ddy
+        ONLY:  ddx, ddy, dx, dy
 
     USE indices,                                                               &
@@ -510,5 +511,5 @@
 
     IF ( .NOT. ALLOCATED( mean_inflow_profiles ) )                             &
-       ALLOCATE( mean_inflow_profiles(nzb:nzt+1,5) )
+       ALLOCATE( mean_inflow_profiles(nzb:nzt+1,1:num_mean_inflow_profiles) )
 
     ALLOCATE ( a11(nzb:nzt+1), a21(nzb:nzt+1), a22(nzb:nzt+1),                 &
@@ -528,5 +529,4 @@
     IF ( MOD( nz , pdims(1) ) /= 0  .AND.  myidx == id_stg_right )             &
        nzt_x_stg = nzt_x_stg + myidx * ( nnz - INT( nnz ) )
-!        nzt_x_stg = myidx * nnz + MOD( nz , pdims(1) )
 
     IF ( nesting_offline   .OR.  ( child_domain  .AND.  rans_mode_parent       &
@@ -538,5 +538,4 @@
        IF ( MOD( nz , pdims(2) ) /= 0  .AND.  myidy == id_stg_north )          &
           nzt_y_stg = nzt_y_stg + myidy * ( nnz - INT( nnz ) )
-!           nzt_y_stg = myidy * nnz + MOD( nz , pdims(2) )
     ENDIF
 
@@ -670,6 +669,11 @@
     ELSE
 !
-!--    Set-up defaul length scales. Assume exponentially decreasing length
-!--    scales and isotropic turbulence.
+!--    Set-up default turbulent length scales. From the numerical point of
+!--    view the imposed perturbations should not be immediately dissipated
+!--    by the numerics. The numerical dissipation, however, acts on scales
+!--    up to 8 x the grid spacing. For this reason, set the turbulence 
+!--    length scale to 8 time the grid spacing. Further, above the boundary
+!--    layer height, set turbulence lenght scales to zero (equivalent to not
+!--    imposing any perturbations) in order to save computational costs. 
 !--    Typical length (time) scales of 100 m (s) should be a good compromise
 !--    between all stratrifications. Near-surface variances are fixed to
@@ -684,5 +688,7 @@
                                   zu(k) > 0.3 * zu(nzt)                        &
                                 )
-          length_scale_z = length_scale_surface * EXP( dum_exp )
+          length_scale_z = 8.0_wp * MIN( dx, dy, dzw(k) )
+          
+!           IF ( zu(k) > zi_richardson )  
 
           nux(k) = MAX( INT( length_scale_z * ddx     ), 1 )
@@ -709,4 +715,5 @@
 
        ENDDO
+       
        nux(nzb) = nux(nzb+1)
        nuy(nzb) = nuy(nzb+1)
