Index: palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 150)
+++ palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 151)
@@ -26,5 +26,7 @@
 User-defined spectra.
 
-advec_particles, calc_spectra, check_open, check_parameters, data_output_spectra, init_particles, init_pegrid, init_3d_model, modules, netcdf, particle_boundary_conds, read_var_list, read_3d_binary, user_interface, write_var_list, write_3d_binary
+advec_particles, calc_spectra, check_open, check_parameters, data_output_spectra, init_particles, init_pegrid, init_3d_model, modules, netcdf, particle_boundary_conds, read_var_list, read_3d_binary, time_integration, user_interface, write_var_list, write_3d_binary
+
+New: inflow_turbulence
 
 
@@ -64,7 +66,7 @@
 Bugfix: extra '*' removed in user_statistics sample code (user_interface)
 Bugfix: a stop command was missing in some cases of the parallel branch (local_stop)
+Bugfix in volume flow control for non-cyclic boundary conditions (pres)
 
 
+flow_statistics, local_stop, plant_canopy_model, pres, read_3d_binary, user_interface, write_3d_binary
 
-flow_statistics, local_stop, plant_canopy_model, read_3d_binary, user_interface, write_3d_binary
-
Index: palm/trunk/SOURCE/Makefile
===================================================================
--- palm/trunk/SOURCE/Makefile	(revision 150)
+++ palm/trunk/SOURCE/Makefile	(revision 151)
@@ -4,5 +4,5 @@
 # Actual revisions:
 # -----------------
-# +plant_canopy_model
+# +plant_canopy_model, inflow_turbulence
 #
 # +surface_coupler
@@ -55,9 +55,10 @@
 	disturb_heatflux.f90 eqn_state_seawater.f90 exchange_horiz.f90 exchange_horiz_2d.f90 \
 	fft_xy.f90 flow_statistics.f90 global_min_max.f90 header.f90 \
-	impact_of_latent_heat.f90 init_1d_model.f90 init_3d_model.f90 \
-	init_advec.f90 init_cloud_physics.f90 init_dvrp.f90 init_grid.f90 \
-	init_ocean.f90 init_particles.f90 init_pegrid.f90 init_pt_anomaly.f90 \
-	init_rankine.f90 init_slope.f90 interaction_droplets_ptq.f90 \
-	local_flush.f90 local_getenv.f90 local_stop.f90 local_system.f90 local_tremain.f90 \
+	impact_of_latent_heat.f90 inflow_turbulence.f90 init_1d_model.f90 \
+	init_3d_model.f90 init_advec.f90 init_cloud_physics.f90 init_dvrp.f90 \
+	init_grid.f90 init_ocean.f90 init_particles.f90 init_pegrid.f90 \
+	init_pt_anomaly.f90 init_rankine.f90 init_slope.f90 \
+	interaction_droplets_ptq.f90 local_flush.f90 local_getenv.f90 \
+	local_stop.f90 local_system.f90 local_tremain.f90 \
 	local_tremain_ini.f90 modules.f90 netcdf.f90 package_parin.f90 \
 	palm.f90 parin.f90 particle_boundary_conds.f90 \
@@ -87,5 +88,5 @@
 	disturb_heatflux.o eqn_state_seawater.o exchange_horiz.o exchange_horiz_2d.o fft_xy.o \
 	flow_statistics.o global_min_max.o header.o impact_of_latent_heat.o \
-	init_1d_model.o init_3d_model.o init_advec.o init_cloud_physics.o \
+	inflow_turbulence.o init_1d_model.o init_3d_model.o init_advec.o init_cloud_physics.o \
 	init_dvrp.o init_grid.o init_ocean.o init_particles.o init_pegrid.o \
 	init_pt_anomaly.o init_rankine.o init_slope.o \
@@ -182,4 +183,5 @@
 header.o: modules.o
 impact_of_latent_heat.o: modules.o
+inflow_turbulence.o: modules.o
 init_1d_model.o: modules.o
 init_3d_model.o: modules.o random_function.o
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 150)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 151)
@@ -4,5 +4,6 @@
 ! Actual revisions:
 ! -----------------
-! Case of reading data for recycling included in initializing_actions 
+! Case of reading data for recycling included in initializing_actions,
+! check of turbulent_inflow and calculation of recycling_plane
 !
 ! Former revisions:
@@ -2981,4 +2982,38 @@
 
 !
+!-- A turbulent inflow requires Dirichlet conditions at the respective inflow
+!-- boundary (so far, a turbulent inflow is realized from the left side only)
+    IF ( turbulent_inflow  .AND.  bc_lr /= 'dirichlet/radiation' )  THEN
+       IF ( myid == 0 )  THEN
+          PRINT*, '+++ check_parameters:'
+          PRINT*, '    turbulent_inflow = .T. requires a Dirichlet condition', &
+                  ' at the inflow boundary'
+       ENDIF
+       CALL local_stop
+    ENDIF
+
+!
+!-- In case of turbulent inflow calculate the index of the recycling plane
+    IF ( turbulent_inflow )  THEN
+       IF ( recycling_width == 9999999.9 )  THEN
+!
+!--       Set the default value for the width of the recycling domain
+          recycling_width = 0.1 * nx * dx
+       ELSE
+          IF ( recycling_width < dx  .OR.  recycling_width > nx * dx )  THEN
+             IF ( myid == 0 )  THEN
+                PRINT*, '+++ check_parameters:'
+                PRINT*, '    illegal value for recycling_width: ', &
+                        recycling_width
+             ENDIF
+             CALL local_stop
+          ENDIF
+       ENDIF
+!
+!--    Calculate the index
+       recycling_plane = recycling_width / dx
+    ENDIF
+
+!
 !-- Check random generator
     IF ( random_generator /= 'system-specific'  .AND. &
Index: palm/trunk/SOURCE/header.f90
===================================================================
--- palm/trunk/SOURCE/header.f90	(revision 150)
+++ palm/trunk/SOURCE/header.f90	(revision 151)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Output of turbulence recycling informations
 !
 ! Former revisions:
@@ -514,5 +514,5 @@
        WRITE ( io, 304 )
        IF ( coupling_mode == 'uncoupled' )  THEN
-          WRITE ( io, 319 )  top_momentumflux_u, top_momentumflux_v
+          WRITE ( io, 320 )  top_momentumflux_u, top_momentumflux_v
           IF ( constant_top_heatflux )  THEN
              WRITE ( io, 306 )  top_heatflux
@@ -548,11 +548,15 @@
     IF ( bc_lr /= 'cyclic'  .OR.  bc_ns /= 'cyclic' )  THEN
        WRITE ( io, 318 )  outflow_damping_width, km_damp_max
+       IF ( turbulent_inflow )  THEN
+          WRITE ( io, 319 )  recycling_width, recycling_plane, &
+                             inflow_damping_height, inflow_damping_width
+       ENDIF
     ENDIF
 
 !
 !-- Listing of 1D-profiles
-    WRITE ( io, 320 )  dt_dopr_listing
+    WRITE ( io, 325 )  dt_dopr_listing
     IF ( averaging_interval_pr /= 0.0 )  THEN
-       WRITE ( io, 321 )  averaging_interval_pr, dt_averaging_input_pr
+       WRITE ( io, 326 )  averaging_interval_pr, dt_averaging_input_pr
     ENDIF
 
@@ -561,5 +565,5 @@
     WRITE ( io, 330 )
     IF ( averaging_interval_pr /= 0.0 )  THEN
-       WRITE ( io, 321 )  averaging_interval_pr, dt_averaging_input_pr
+       WRITE ( io, 326 )  averaging_interval_pr, dt_averaging_input_pr
     ENDIF
 
@@ -1414,11 +1418,14 @@
 318 FORMAT (/'       outflow damping layer width: ',I3,' gridpoints with km_', &
                     'max =',F5.1,' m**2/s')
-319 FORMAT ('       Predefined constant momentumflux:  u: ',F9.6,' m**2/s**2'/ &
+319 FORMAT ('       turbulence recycling at inflow switched on'/ &
+            '       width of recycling domain: ',F7.1,' m   grid index: ',I4/ &
+            '       inflow damping height: ',F6.1,' m   width: ',F6.1,' m')
+320 FORMAT ('       Predefined constant momentumflux:  u: ',F9.6,' m**2/s**2'/ &
             '                                          v: ',F9.6,' m**2/s**2')
-320 FORMAT (//' List output:'/ &
+325 FORMAT (//' List output:'/ &
              ' -----------'//  &
             '    1D-Profiles:'/    &
             '       Output every             ',F8.2,' s')
-321 FORMAT ('       Time averaged over       ',F8.2,' s'/ &
+326 FORMAT ('       Time averaged over       ',F8.2,' s'/ &
             '       Averaging input every    ',F8.2,' s')
 330 FORMAT (//' Data output:'/ &
Index: palm/trunk/SOURCE/inflow_turbulence.f90
===================================================================
--- palm/trunk/SOURCE/inflow_turbulence.f90	(revision 151)
+++ palm/trunk/SOURCE/inflow_turbulence.f90	(revision 151)
@@ -0,0 +1,199 @@
+ SUBROUTINE inflow_turbulence
+
+!------------------------------------------------------------------------------!
+! Actual revisions:
+! -----------------
+! 
+!
+! Former revisions:
+! -----------------
+! $Id$
+!
+!
+! Description:
+! ------------
+! Imposing turbulence at the respective inflow using the turbulence
+! recycling method of Kataoka and Mizuno (2002).
+!------------------------------------------------------------------------------!
+
+    USE arrays_3d
+    USE control_parameters
+    USE cpulog
+    USE grid_variables
+    USE indices
+    USE interfaces
+    USE pegrid
+
+
+    IMPLICIT NONE
+
+    INTEGER ::  i, imax, j, k, ngp_ifd, ngp_pr
+
+    REAL, DIMENSION(1:2) ::  volume_flow_l, volume_flow_offset
+    REAL, DIMENSION(nzb:nzt+1,5) ::  avpr, avpr_l
+    REAL, DIMENSION(nzb:nzt+1,nys-1:nyn+1,5) ::  inflow_dist
+
+    CALL cpu_log( log_point(40), 'inflow_turbulence', 'start' )
+
+!
+!-- Carry out horizontal averaging in the recycling plane
+    avpr_l = 0.0
+    ngp_pr = ( nzt - nzb + 2 ) * 5
+    ngp_ifd = ngp_pr * ( nyn - nys + 3 )
+
+!
+!-- First, local averaging within the recycling domain
+    IF ( recycling_plane >= nxl )  THEN
+
+       imax = MIN( nxr, recycling_plane )
+
+       DO  i = nxl, imax
+          DO  j = nys, nyn
+             DO  k = nzb, nzt+1
+
+                avpr_l(k,1) = avpr_l(k,1) + u(k,j,i)
+                avpr_l(k,2) = avpr_l(k,2) + v(k,j,i)
+                avpr_l(k,3) = avpr_l(k,3) + w(k,j,i)
+                avpr_l(k,4) = avpr_l(k,4) + pt(k,j,i)
+                avpr_l(k,5) = avpr_l(k,5) + e(k,j,i)
+
+             ENDDO
+          ENDDO
+       ENDDO
+
+    ENDIF
+
+!    WRITE (9,*) '*** averaged profiles avpr_l'
+!    DO  k = nzb, nzt+1
+!       WRITE (9,'(F5.1,1X,F5.1,1X,F5.1,1X,F6.1,1X,F7.2)') avpr_l(k,1),avpr_l(k,2),avpr_l(k,3),avpr_l(k,4),avpr_l(k,5)
+!    ENDDO
+!    WRITE (9,*) ' '
+
+#if defined( __parallel )
+!
+!-- Now, averaging over all PEs
+    CALL MPI_ALLREDUCE( avpr_l(nzb,1), avpr(nzb,1), ngp_pr, MPI_REAL, MPI_SUM, &
+                        comm2d, ierr )
+#else
+    avpr = avpr_l
+#endif
+
+    avpr = avpr / ( ( ny + 1 ) * ( recycling_plane + 1 ) )
+
+!    WRITE (9,*) '*** averaged profiles'
+!    DO  k = nzb, nzt+1
+!       WRITE (9,'(F5.1,1X,F5.1,1X,F5.1,1X,F6.1,1X,F7.2)') avpr(k,1),avpr(k,2),avpr(k,3),avpr(k,4),avpr(k,5)
+!    ENDDO
+!    WRITE (9,*) ' '
+
+!
+!-- Calculate the disturbances at the recycling plane
+    i = recycling_plane
+
+    IF ( i >= nxl  .AND.  i <= nxr )  THEN
+
+       DO  j = nys-1, nyn+1
+          DO  k = nzb, nzt+1
+
+              inflow_dist(k,j,1) = u(k,j,i+1) - avpr(k,1)
+              inflow_dist(k,j,2) = v(k,j,i)   - avpr(k,2)
+              inflow_dist(k,j,3) = w(k,j,i)   - avpr(k,3)
+              inflow_dist(k,j,4) = pt(k,j,i)  - avpr(k,4)
+              inflow_dist(k,j,5) = e(k,j,i)   - avpr(k,5)
+
+          ENDDO
+       ENDDO
+
+    ENDIF
+
+!
+!-- For parallel runs, send the disturbances to the respective inflow PE
+#if defined( __parallel )
+    IF ( i >= nxl  .AND.  i <= nxr  .AND.  myid /= id_inflow )  THEN
+
+!       print*, '*** sending id = ', myid, '   send to:', id_inflow
+       CALL MPI_SEND( inflow_dist(nzb,nys-1,1), ngp_ifd, MPI_REAL, &
+                      id_inflow, 1, comm1dx, ierr )
+
+    ELSEIF ( ( i < nxl  .OR.  i > nxr )  .AND.  myid == id_inflow )  THEN
+
+!       print*, '*** receiving id = ', myid
+       CALL MPI_RECV( inflow_dist(nzb,nys-1,1), ngp_ifd, MPI_REAL, &
+                      MPI_ANY_SOURCE, 1, comm1dx, status, ierr )
+
+    ENDIF
+#endif
+
+!
+!-- Add the disturbance at the inflow
+    IF ( nxl == 0 )  THEN
+
+       DO  j = nys-1, nyn+1
+          DO  k = nzb, nzt+1
+
+!              WRITE (9,*) 'j=',j,' k=',k
+!              WRITE (9,*) 'mean_u = ', mean_inflow_profiles(k,1), ' dist_u = ',&
+!                          inflow_dist(k,j,1)
+!              WRITE (9,*) 'mean_v = ', mean_inflow_profiles(k,2), ' dist_v = ',&
+!                          inflow_dist(k,j,2)
+!              WRITE (9,*) 'mean_w = 0.0', ' dist_w = ',&
+!                          inflow_dist(k,j,3)
+!              WRITE (9,*) 'mean_pt = ', mean_inflow_profiles(k,4), ' dist_pt = ',&
+!                          inflow_dist(k,j,4)
+!              WRITE (9,*) 'mean_e = ', mean_inflow_profiles(k,5), ' dist_e = ',&
+!                          inflow_dist(k,j,5)
+              u(k,j,0)   = mean_inflow_profiles(k,1) + &
+                           inflow_dist(k,j,1) * inflow_damping_factor(k)
+              v(k,j,-1)  = mean_inflow_profiles(k,2) + &
+                           inflow_dist(k,j,2) * inflow_damping_factor(k)
+              w(k,j,-1)  = inflow_dist(k,j,3) * inflow_damping_factor(k)
+              pt(k,j,-1) = mean_inflow_profiles(k,4) + &
+                           inflow_dist(k,j,4) * inflow_damping_factor(k)
+              e(k,j,-1)  = mean_inflow_profiles(k,5) + &
+                           inflow_dist(k,j,5) * inflow_damping_factor(k)
+              e(k,j,-1)  = MAX( e(k,j,-1), 0.0 )
+
+          ENDDO
+       ENDDO
+
+    ENDIF
+
+!
+!-- Conserve the volume flow at the inflow in order to avoid generation of
+!-- waves in the stable layer
+!    IF ( conserve_volume_flow  .AND.  inflow_l )  THEN
+
+!       volume_flow(1)   = 0.0
+!       volume_flow_l(1) = 0.0
+
+!       i = 0
+
+!       DO  j = nys, nyn
+!
+!--       Sum up the volume flow through the south/north boundary
+!          DO  k = nzb_2d(j,i) + 1, nzt
+!             volume_flow_l(1) = volume_flow_l(1) + u(k,j,i) * dzu(k)
+!          ENDDO
+!       ENDDO
+
+#if defined( __parallel )   
+!       CALL MPI_ALLREDUCE( volume_flow_l(1), volume_flow(1), 1, MPI_REAL, &
+!                           MPI_SUM, comm1dy, ierr )   
+#else
+!       volume_flow = volume_flow_l  
+#endif
+!       volume_flow_offset(1) = ( volume_flow_initial(1) - volume_flow(1) )    &
+!                               / volume_flow_area(1)
+
+!       DO  j = nys-1, nyn+1
+!          DO  k = nzb_v_inner(j,i) + 1, nzt
+!             u(k,j,i) = u(k,j,i) + volume_flow_offset(1)
+!          ENDDO
+!       ENDDO
+
+!    ENDIF
+
+    CALL cpu_log( log_point(40), 'inflow_turbulence', 'stop' )
+
+
+ END SUBROUTINE inflow_turbulence
Index: palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_3d_model.f90	(revision 150)
+++ palm/trunk/SOURCE/init_3d_model.f90	(revision 151)
@@ -602,5 +602,5 @@
 
 !
-!--    apply channel flow boundary condition
+!--    Apply channel flow boundary condition
        IF ( TRIM( bc_uv_t ) == 'dirichlet_0' )  THEN
 
@@ -608,5 +608,5 @@
           v(nzt+1,:,:) = 0.0
 
-!--       for the Dirichlet condition to be correctly applied at the top, set
+!--       For the Dirichlet condition to be correctly applied at the top, set
 !--       ug and vg to zero there
           ug(nzt+1)    = 0.0
@@ -755,4 +755,222 @@
 
 !
+!--    For the moment, perturbation pressure and vertical velocity are zero
+       p = 0.0; w = 0.0
+
+!
+!--    Initialize array sums (must be defined in first call of pres)
+       sums = 0.0
+
+!
+!--    Treating cloud physics, liquid water content and precipitation amount
+!--    are zero at beginning of the simulation
+       IF ( cloud_physics )  THEN
+          ql = 0.0
+          IF ( precipitation )  precipitation_amount = 0.0
+       ENDIF
+
+!
+!--    Impose vortex with vertical axis on the initial velocity profile
+       IF ( INDEX( initializing_actions, 'initialize_vortex' ) /= 0 )  THEN
+          CALL init_rankine
+       ENDIF
+
+!
+!--    Impose temperature anomaly (advection test only)
+       IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 )  THEN
+          CALL init_pt_anomaly
+       ENDIF
+
+!
+!--    If required, change the surface temperature at the start of the 3D run
+       IF ( pt_surface_initial_change /= 0.0 )  THEN
+          pt(nzb,:,:) = pt(nzb,:,:) + pt_surface_initial_change
+       ENDIF
+
+!
+!--    If required, change the surface humidity/scalar at the start of the 3D
+!--    run
+       IF ( ( humidity .OR. passive_scalar ) .AND. &
+            q_surface_initial_change /= 0.0 )  THEN
+          q(nzb,:,:) = q(nzb,:,:) + q_surface_initial_change
+       ENDIF
+
+!
+!--    Initialize the random number generator (from numerical recipes)
+       CALL random_function_ini
+
+!
+!--    Impose random perturbation on the horizontal velocity field and then
+!--    remove the divergences from the velocity field
+       IF ( create_disturbances )  THEN
+          CALL disturb_field( nzb_u_inner, tend, u )
+          CALL disturb_field( nzb_v_inner, tend, v )
+          n_sor = nsor_ini
+          CALL pres
+          n_sor = nsor
+       ENDIF
+
+!
+!--    Once again set the perturbation pressure explicitly to zero in order to
+!--    assure that it does not generate any divergences in the first time step.
+!--    At t=0 the velocity field is free of divergence (as constructed above).
+!--    Divergences being created during a time step are not yet known and thus
+!--    cannot be corrected during the time step yet.
+       p = 0.0
+
+!
+!--    Initialize old and new time levels.
+       IF ( timestep_scheme(1:5) /= 'runge' )  THEN
+          e_m = e; pt_m = pt; u_m = u; v_m = v; w_m = w; kh_m = kh; km_m = km
+       ELSE
+          te_m = 0.0; tpt_m = 0.0; tu_m = 0.0; tv_m = 0.0; tw_m = 0.0
+       ENDIF
+       e_p = e; pt_p = pt; u_p = u; v_p = v; w_p = w
+
+       IF ( humidity  .OR.  passive_scalar )  THEN
+          IF ( ASSOCIATED( q_m ) )  q_m = q
+          IF ( timestep_scheme(1:5) == 'runge' )  tq_m = 0.0
+          q_p = q
+          IF ( humidity  .AND.  ASSOCIATED( vpt_m ) )  vpt_m = vpt
+       ENDIF
+
+       IF ( ocean )  THEN
+          tsa_m = 0.0
+          sa_p  = sa
+       ENDIF
+
+
+    ELSEIF ( TRIM( initializing_actions ) == 'read_restart_data'  .OR.    &
+             TRIM( initializing_actions ) == 'read_data_for_recycling' )  &
+    THEN
+!
+!--    When reading data for initializing the recycling method, first read
+!--    some of the global variables from restart file
+       IF ( TRIM( initializing_actions ) == 'read_data_for_recycling' )  THEN
+
+          WRITE (9,*) 'before read_parts_of_var_list'
+          CALL local_flush( 9 )
+          CALL read_parts_of_var_list
+          WRITE (9,*) 'after read_parts_of_var_list'
+          CALL local_flush( 9 )
+          CALL close_file( 13 )
+!
+!--       Store temporally and horizontally averaged vertical profiles to be
+!--       used as mean inflow profiles
+          ALLOCATE( mean_inflow_profiles(nzb:nzt+1,5) )
+
+          mean_inflow_profiles(:,1) = hom_sum(:,1,0)    ! u
+          mean_inflow_profiles(:,2) = hom_sum(:,2,0)    ! v
+          mean_inflow_profiles(:,4) = hom_sum(:,4,0)    ! pt
+          mean_inflow_profiles(:,5) = hom_sum(:,8,0)    ! e
+
+!
+!--       Use these mean profiles for the inflow (provided that Dirichlet
+!--       conditions are used)
+          IF ( inflow_l )  THEN
+             DO  j = nys-1, nyn+1
+                DO  k = nzb, nzt+1
+                   u(k,j,-1)  = mean_inflow_profiles(k,1)
+                   v(k,j,-1)  = mean_inflow_profiles(k,2)
+                   w(k,j,-1)  = 0.0
+                   pt(k,j,-1) = mean_inflow_profiles(k,4)
+                   e(k,j,-1)  = mean_inflow_profiles(k,5)
+                ENDDO
+             ENDDO
+          ENDIF
+
+!
+!--       Calculate the damping factors to be used at the inflow. For a
+!--       turbulent inflow the turbulent fluctuations have to be limited
+!--       vertically because otherwise the turbulent inflow layer will grow
+!--       in time.
+          IF ( inflow_damping_height == 9999999.9 )  THEN
+!
+!--          Default: use the inversion height calculated by the prerun
+             inflow_damping_height = hom_sum(nzb+6,pr_palm,0)
+
+          ENDIF
+
+          IF ( inflow_damping_width == 9999999.9 )  THEN
+!
+!--          Default for the transition range: one tenth of the undamped layer
+             inflow_damping_width = 0.1 * inflow_damping_height
+
+          ENDIF
+
+          ALLOCATE( inflow_damping_factor(nzb:nzt+1) )
+
+          DO  k = nzb, nzt+1
+
+             IF ( zu(k) <= inflow_damping_height )  THEN
+                inflow_damping_factor(k) = 1.0
+             ELSEIF ( zu(k) <= inflow_damping_height + inflow_damping_width ) &
+             THEN
+                inflow_damping_factor(k) = 1.0 -                               &
+                                           ( zu(k) - inflow_damping_height ) / &
+                                           inflow_damping_width
+             ELSE
+                inflow_damping_factor(k) = 0.0
+             ENDIF
+
+          ENDDO
+
+       ENDIF
+
+
+!
+!--    Read binary data from restart file
+          WRITE (9,*) 'before read_3d_binary'
+          CALL local_flush( 9 )
+       CALL read_3d_binary
+          WRITE (9,*) 'after read_3d_binary'
+          CALL local_flush( 9 )
+
+!
+!--    Calculate initial temperature field and other constants used in case
+!--    of a sloping surface
+       IF ( sloping_surface )  CALL init_slope
+
+!
+!--    Initialize new time levels (only done in order to set boundary values
+!--    including ghost points)
+       e_p = e; pt_p = pt; u_p = u; v_p = v; w_p = w
+       IF ( humidity  .OR.  passive_scalar )  q_p = q
+       IF ( ocean )  sa_p = sa
+
+    ELSE
+!
+!--    Actually this part of the programm should not be reached
+       IF ( myid == 0 )  PRINT*,'+++ init_3d_model: unknown initializing ', &
+                                                    'problem'
+       CALL local_stop
+    ENDIF
+
+
+    IF (  TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
+!
+!--    Initialize old timelevels needed for radiation boundary conditions
+       IF ( outflow_l )  THEN
+          u_m_l(:,:,:) = u(:,:,1:2)
+          v_m_l(:,:,:) = v(:,:,0:1)
+          w_m_l(:,:,:) = w(:,:,0:1)
+       ENDIF
+       IF ( outflow_r )  THEN
+          u_m_r(:,:,:) = u(:,:,nx-1:nx)
+          v_m_r(:,:,:) = v(:,:,nx-1:nx)
+          w_m_r(:,:,:) = w(:,:,nx-1:nx)
+       ENDIF
+       IF ( outflow_s )  THEN
+          u_m_s(:,:,:) = u(:,0:1,:)
+          v_m_s(:,:,:) = v(:,1:2,:)
+          w_m_s(:,:,:) = w(:,0:1,:)
+       ENDIF
+       IF ( outflow_n )  THEN
+          u_m_n(:,:,:) = u(:,ny-1:ny,:)
+          v_m_n(:,:,:) = v(:,ny-1:ny,:)
+          w_m_n(:,:,:) = w(:,ny-1:ny,:)
+       ENDIF
+
+!
 !--    Calculate the initial volume flow at the right and north boundary
        IF ( conserve_volume_flow )  THEN
@@ -800,154 +1018,4 @@
        ENDIF
 
-!
-!--    For the moment, perturbation pressure and vertical velocity are zero
-       p = 0.0; w = 0.0
-
-!
-!--    Initialize array sums (must be defined in first call of pres)
-       sums = 0.0
-
-!
-!--    Treating cloud physics, liquid water content and precipitation amount
-!--    are zero at beginning of the simulation
-       IF ( cloud_physics )  THEN
-          ql = 0.0
-          IF ( precipitation )  precipitation_amount = 0.0
-       ENDIF
-
-!
-!--    Impose vortex with vertical axis on the initial velocity profile
-       IF ( INDEX( initializing_actions, 'initialize_vortex' ) /= 0 )  THEN
-          CALL init_rankine
-       ENDIF
-
-!
-!--    Impose temperature anomaly (advection test only)
-       IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 )  THEN
-          CALL init_pt_anomaly
-       ENDIF
-
-!
-!--    If required, change the surface temperature at the start of the 3D run
-       IF ( pt_surface_initial_change /= 0.0 )  THEN
-          pt(nzb,:,:) = pt(nzb,:,:) + pt_surface_initial_change
-       ENDIF
-
-!
-!--    If required, change the surface humidity/scalar at the start of the 3D
-!--    run
-       IF ( ( humidity .OR. passive_scalar ) .AND. &
-            q_surface_initial_change /= 0.0 )  THEN
-          q(nzb,:,:) = q(nzb,:,:) + q_surface_initial_change
-       ENDIF
-
-!
-!--    Initialize the random number generator (from numerical recipes)
-       CALL random_function_ini
-
-!
-!--    Impose random perturbation on the horizontal velocity field and then
-!--    remove the divergences from the velocity field
-       IF ( create_disturbances )  THEN
-          CALL disturb_field( nzb_u_inner, tend, u )
-          CALL disturb_field( nzb_v_inner, tend, v )
-          n_sor = nsor_ini
-          CALL pres
-          n_sor = nsor
-       ENDIF
-
-!
-!--    Once again set the perturbation pressure explicitly to zero in order to
-!--    assure that it does not generate any divergences in the first time step.
-!--    At t=0 the velocity field is free of divergence (as constructed above).
-!--    Divergences being created during a time step are not yet known and thus
-!--    cannot be corrected during the time step yet.
-       p = 0.0
-
-!
-!--    Initialize old and new time levels.
-       IF ( timestep_scheme(1:5) /= 'runge' )  THEN
-          e_m = e; pt_m = pt; u_m = u; v_m = v; w_m = w; kh_m = kh; km_m = km
-       ELSE
-          te_m = 0.0; tpt_m = 0.0; tu_m = 0.0; tv_m = 0.0; tw_m = 0.0
-       ENDIF
-       e_p = e; pt_p = pt; u_p = u; v_p = v; w_p = w
-
-       IF ( humidity  .OR.  passive_scalar )  THEN
-          IF ( ASSOCIATED( q_m ) )  q_m = q
-          IF ( timestep_scheme(1:5) == 'runge' )  tq_m = 0.0
-          q_p = q
-          IF ( humidity  .AND.  ASSOCIATED( vpt_m ) )  vpt_m = vpt
-       ENDIF
-
-       IF ( ocean )  THEN
-          tsa_m = 0.0
-          sa_p  = sa
-       ENDIF
-
-!
-!--    Initialize old timelevels needed for radiation boundary conditions
-       IF ( outflow_l )  THEN
-          u_m_l(:,:,:) = u(:,:,1:2)
-          v_m_l(:,:,:) = v(:,:,0:1)
-          w_m_l(:,:,:) = w(:,:,0:1)
-       ENDIF
-       IF ( outflow_r )  THEN
-          u_m_r(:,:,:) = u(:,:,nx-1:nx)
-          v_m_r(:,:,:) = v(:,:,nx-1:nx)
-          w_m_r(:,:,:) = w(:,:,nx-1:nx)
-       ENDIF
-       IF ( outflow_s )  THEN
-          u_m_s(:,:,:) = u(:,0:1,:)
-          v_m_s(:,:,:) = v(:,1:2,:)
-          w_m_s(:,:,:) = w(:,0:1,:)
-       ENDIF
-       IF ( outflow_n )  THEN
-          u_m_n(:,:,:) = u(:,ny-1:ny,:)
-          v_m_n(:,:,:) = v(:,ny-1:ny,:)
-          w_m_n(:,:,:) = w(:,ny-1:ny,:)
-       ENDIF
-
-    ELSEIF ( TRIM( initializing_actions ) == 'read_restart_data'  .OR.    &
-             TRIM( initializing_actions ) == 'read_data_for_recycling' )  &
-    THEN
-!
-!--    When reading data for initializing the recycling method, first read
-!--    some of the global variables from restart file
-       IF ( TRIM( initializing_actions ) == 'read_data_for_recycling' )  THEN
-          WRITE (9,*) 'before read_parts_of_var_list'
-          CALL local_flush( 9 )
-          CALL read_parts_of_var_list
-          WRITE (9,*) 'after read_parts_of_var_list'
-          CALL local_flush( 9 )
-          CALL close_file( 13 )
-       ENDIF
-
-!
-!--    Read binary data from restart file
-          WRITE (9,*) 'before read_3d_binary'
-          CALL local_flush( 9 )
-       CALL read_3d_binary
-          WRITE (9,*) 'after read_3d_binary'
-          CALL local_flush( 9 )
-
-!
-!--    Calculate initial temperature field and other constants used in case
-!--    of a sloping surface
-       IF ( sloping_surface )  CALL init_slope
-
-!
-!--    Initialize new time levels (only done in order to set boundary values
-!--    including ghost points)
-       e_p = e; pt_p = pt; u_p = u; v_p = v; w_p = w
-       IF ( humidity  .OR.  passive_scalar )  q_p = q
-       IF ( ocean )  sa_p = sa
-
-    ELSE
-!
-!--    Actually this part of the programm should not be reached
-       IF ( myid == 0 )  PRINT*,'+++ init_3d_model: unknown initializing ', &
-                                                    'problem'
-       CALL local_stop
     ENDIF
 
Index: palm/trunk/SOURCE/init_pegrid.f90
===================================================================
--- palm/trunk/SOURCE/init_pegrid.f90	(revision 150)
+++ palm/trunk/SOURCE/init_pegrid.f90	(revision 151)
@@ -4,5 +4,6 @@
 ! Actual revisions:
 ! -----------------
-! Collect on PE0 horizontal index bounds from all other PEs
+! Collect on PE0 horizontal index bounds from all other PEs,
+! broadcast the id of the inflow PE (using the respective communicator)
 ! TEST OUTPUT (TO BE REMOVED) logging mpi2 ierr values
 !
@@ -57,9 +58,9 @@
     IMPLICIT NONE
 
-    INTEGER ::  gathered_size, i, ind(5), j, k, maximum_grid_level_l,     &
-                mg_switch_to_pe0_level_l, mg_levels_x, mg_levels_y,       &
-                mg_levels_z, nnx_y, nnx_z, nny_x, nny_z, nnz_x, nnz_y,    &
-                numproc_sqr, nx_total, nxl_l, nxr_l, nyn_l, nys_l, nzb_l, &
-                nzt_l, omp_get_num_threads, subdomain_size
+    INTEGER ::  gathered_size, i, id_inflow_l, ind(5), j, k,                 &
+                maximum_grid_level_l, mg_switch_to_pe0_level_l, mg_levels_x, &
+                mg_levels_y, mg_levels_z, nnx_y, nnx_z, nny_x, nny_z, nnz_x, &
+                nnz_y, numproc_sqr, nx_total, nxl_l, nxr_l, nyn_l, nys_l,    &
+                nzb_l, nzt_l, omp_get_num_threads, subdomain_size
 
     INTEGER, DIMENSION(:), ALLOCATABLE ::  ind_all, nxlf, nxrf, nynf, nysf
@@ -918,4 +919,14 @@
     ENDIF
 
+!
+!-- Broadcast the id of the inflow PE
+    IF ( inflow_l )  THEN
+       id_inflow_l = myid
+    ELSE
+       id_inflow_l = 0
+    ENDIF
+    CALL MPI_ALLREDUCE( id_inflow_l, id_inflow, 1, MPI_INTEGER, MPI_SUM, &
+                        comm1dx, ierr )
+
 #else
     IF ( bc_lr == 'dirichlet/radiation' )  THEN
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 150)
+++ palm/trunk/SOURCE/modules.f90	(revision 151)
@@ -5,6 +5,7 @@
 ! Actual revisions:
 ! -----------------
-! +hor_index_bounds, hor_index_bounds_previous_run, numprocs_previous_run,
-! nx_on_file, ny_on_file, offset_ocean_*
+! +hor_index_bounds, hor_index_bounds_previous_run, id_inflow,
+! inflow_damping_*, mean_inflow_profiles, numprocs_previous_run, nx_on_file,
+! ny_on_file, offset_ocean_*, recycling_plane, recycling_width, turbulent_inflow
 ! -myid_char_14
 !
@@ -115,11 +116,11 @@
 
     REAL, DIMENSION(:), ALLOCATABLE ::                                         &
-          ddzu, dd2zu, dzu, ddzw, dzw, hyp, km_damp_x, km_damp_y, lad, l_grid, &
-          pt_init, q_init, rdf, sa_init, ug, u_init, u_nzb_p1_for_vfc, vg,     &
-          v_init, v_nzb_p1_for_vfc, zu, zw
+          ddzu, dd2zu, dzu, ddzw, dzw, hyp, inflow_damping_factor, km_damp_x,  &
+          km_damp_y, lad, l_grid, pt_init, q_init, rdf, sa_init, ug, u_init,   &
+          u_nzb_p1_for_vfc, vg, v_init, v_nzb_p1_for_vfc, zu, zw
 
     REAL, DIMENSION(:,:), ALLOCATABLE ::                                       &
-          c_u, c_v, c_w, dzu_mg, dzw_mg, f1_mg, f2_mg, f3_mg, pt_slope_ref,    &
-          qs, qswst_remote, ts, us, z0
+          c_u, c_v, c_w, dzu_mg, dzw_mg, f1_mg, f2_mg, f3_mg,                  &
+          mean_inflow_profiles, pt_slope_ref, qs, qswst_remote, ts, us, z0
 
     REAL, DIMENSION(:,:), ALLOCATABLE, TARGET ::                               &
@@ -309,7 +310,7 @@
                 nsor_ini = 100, n_sor, normalizing_region = 0, &
                 nz_do1d, nz_do3d = -9999, outflow_damping_width = -1, &
-                prt_time_count = 0, runnr = 0, skip_do_avs = 0, &
-                terminate_coupled = 0, terminate_coupled_remote = 0, &
-                timestep_count = 0
+                prt_time_count = 0, recycling_plane, runnr = 0, &
+                skip_do_avs = 0, terminate_coupled = 0, &
+                terminate_coupled_remote = 0, timestep_count = 0
 
     INTEGER ::  dist_nxl(0:1), dist_nxr(0:1), dist_nyn(0:1), dist_nys(0:1), &
@@ -357,8 +358,9 @@
                 random_heatflux = .FALSE., run_control_header = .FALSE., &
                 sloping_surface = .FALSE., stop_dt = .FALSE., &
-                terminate_run = .FALSE., use_prior_plot1d_parameters = .FALSE.,&
-                use_reference = .FALSE., use_surface_fluxes = .FALSE., &
-                use_top_fluxes = .FALSE., use_ug_for_galilei_tr = .TRUE., &
-                use_upstream_for_tke = .FALSE., wall_adjustment = .TRUE.
+                terminate_run = .FALSE., turbulent_inflow = .FALSE., &
+                use_prior_plot1d_parameters = .FALSE., use_reference = .FALSE.,&
+                use_surface_fluxes = .FALSE., use_top_fluxes = .FALSE., &
+                use_ug_for_galilei_tr = .TRUE., use_upstream_for_tke = .FALSE.,&
+                wall_adjustment = .TRUE.
 
     LOGICAL ::  data_output_xy(0:1) = .FALSE., data_output_xz(0:1) = .FALSE., &
@@ -392,5 +394,6 @@
              dz_stretch_level = 100000.0, e_init = 0.0, e_min = 0.0, &
              end_time = 0.0, &
-             f = 0.0, fs = 0.0, g = 9.81, kappa = 0.4, km_constant = -1.0, &
+             f = 0.0, fs = 0.0, g = 9.81, inflow_damping_height = 9999999.9, &
+             inflow_damping_width = 9999999.9, kappa = 0.4, km_constant = -1.0,&
              km_damp_max = -1.0, lad_surface = 0.0, long_filter_factor = 0.0, &
              maximum_cpu_time_allowed = 0.0, molecular_viscosity = 1.461E-5, &
@@ -405,6 +408,7 @@
              q_surface = 0.0, q_surface_initial_change = 0.0, &
              rayleigh_damping_factor = -1.0, rayleigh_damping_height = -1.0, &
-             residual_limit = 1.0E-4, restart_time = 9999999.9, rho_reference, &
-             rho_surface, rif_max = 1.0, &
+             recycling_width = 9999999.9, residual_limit = 1.0E-4, &
+             restart_time = 9999999.9, rho_reference, rho_surface, &
+             rif_max = 1.0, &
              rif_min = -5.0, roughness_length = 0.1, sa_surface = 35.0, &
              simulated_time = 0.0, simulated_time_at_begin, sin_alpha_surface, &
@@ -961,6 +965,6 @@
 #endif
     CHARACTER(LEN=5)       ::  myid_char = ''
-    INTEGER                ::  myid=0, npex = -1, npey = -1, numprocs = 1, &
-                               numprocs_previous_run = -1,                 &
+    INTEGER                ::  id_inflow, myid=0, npex = -1, npey = -1,  &
+                               numprocs = 1, numprocs_previous_run = -1, &
                                tasks_per_node = -9999, threads_per_task = 1
 
Index: palm/trunk/SOURCE/parin.f90
===================================================================
--- palm/trunk/SOURCE/parin.f90	(revision 150)
+++ palm/trunk/SOURCE/parin.f90	(revision 151)
@@ -4,4 +4,6 @@
 ! Actual revisions:
 ! -----------------
+! +inflow_damping_height, inflow_damping_width, recycling_width,
+! turbulent_inflow in inipar
 ! Allocation of hom_sum moved from init_3d_model to here,
 ! npex, npey moved from inipar to d3par, setting of myid_char_14 removed,
@@ -85,4 +87,5 @@
              dz_stretch_level, e_init, e_min, end_time_1d, fft_method, &
              galilei_transformation, grid_matching, humidity, &
+             inflow_damping_height, inflow_damping_width, &
              inflow_disturbance_begin, inflow_disturbance_end, &
              initializing_actions, km_constant, km_damp_max, lad_surface, &
@@ -97,6 +100,6 @@
              pt_vertical_gradient_level, q_surface, q_surface_initial_change, &
              q_vertical_gradient, q_vertical_gradient_level, radiation, &
-             random_generator, random_heatflux, rif_max, rif_min, &
-             roughness_length, sa_surface, sa_vertical_gradient, &
+             random_generator, random_heatflux, recycling_width, rif_max, &
+             rif_min, roughness_length, sa_surface, sa_vertical_gradient, &
              sa_vertical_gradient_level, scalar_advec, statistic_regions, &
              surface_heatflux, surface_pressure, surface_scalarflux, &
@@ -104,5 +107,5 @@
              s_vertical_gradient, s_vertical_gradient_level, top_heatflux, &
              top_momentumflux_u, top_momentumflux_v, top_salinityflux, &
-             timestep_scheme, topography, ug_surface, &
+             timestep_scheme, topography, turbulent_inflow, ug_surface, &
              ug_vertical_gradient, ug_vertical_gradient_level, ups_limit_e, &
              ups_limit_pt, ups_limit_u, ups_limit_v, ups_limit_w, &
Index: palm/trunk/SOURCE/pres.f90
===================================================================
--- palm/trunk/SOURCE/pres.f90	(revision 150)
+++ palm/trunk/SOURCE/pres.f90	(revision 151)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Bugfix in volume flow control for non-cyclic boundary conditions
 !
 ! Former revisions:
@@ -110,11 +110,9 @@
                                / volume_flow_area(1)
 
-       DO  j = nys, nyn
+       DO  j = nys-1, nyn+1
           DO  k = nzb_v_inner(j,i) + 1, nzt
              u(k,j,i) = u(k,j,i) + volume_flow_offset(1)
           ENDDO
        ENDDO
-
-       CALL exchange_horiz( u )
 
     ENDIF
@@ -150,11 +148,9 @@
                                / volume_flow_area(2)
 
-       DO  i = nxl, nxr
+       DO  i = nxl-1, nxr+1
           DO  k = nzb_v_inner(j,i) + 1, nzt
              v(k,j,i) = v(k,j,i) + volume_flow_offset(2)
           ENDDO
        ENDDO
-
-       CALL exchange_horiz( v )
 
     ENDIF
Index: palm/trunk/SOURCE/read_var_list.f90
===================================================================
--- palm/trunk/SOURCE/read_var_list.f90	(revision 150)
+++ palm/trunk/SOURCE/read_var_list.f90	(revision 151)
@@ -4,5 +4,7 @@
 ! Actual revisions:
 ! -----------------
-! +numprocs_previous_run, hor_index_bounds_previous_run,
+! +numprocs_previous_run, hor_index_bounds_previous_run, inflow_damping_factor,
+! inflow_damping_height, inflow_damping_width, mean_inflow_profiles,
+! recycling_width, turbulent_inflow,
 ! -cross_ts_*, npex, npey,
 ! hom_sum, volume_flow_area, volume_flow_initial moved from
@@ -279,4 +281,15 @@
           CASE ( 'hom_sum' )
              READ ( 13 )  hom_sum
+          CASE ( 'humidity' )
+             READ ( 13 )  humidity
+          CASE ( 'inflow_damping_factor' )
+             IF ( .NOT. ALLOCATED( inflow_damping_factor ) )  THEN
+                ALLOCATE( inflow_damping_factor(0:nz+1) )
+             ENDIF
+             READ ( 13 )  inflow_damping_factor
+          CASE ( 'inflow_damping_height' )
+             READ ( 13 )  inflow_damping_height
+          CASE ( 'inflow_damping_width' )
+             READ ( 13 )  inflow_damping_width
           CASE ( 'inflow_disturbance_begin' )
              READ ( 13 )  inflow_disturbance_begin
@@ -303,8 +316,11 @@
           CASE ( 'loop_optimization' )
              READ ( 13 )  loop_optimization
+          CASE ( 'mean_inflow_profiles' )
+             IF ( .NOT. ALLOCATED( mean_inflow_profiles ) )  THEN
+                ALLOCATE( mean_inflow_profiles(0:nz+1,5) )
+             ENDIF
+             READ ( 13 )  mean_inflow_profiles
           CASE ( 'mixing_length_1d' )
              READ ( 13 )  mixing_length_1d
-          CASE ( 'humidity' )
-             READ ( 13 )  humidity
           CASE ( 'momentum_advec' )
              READ ( 13 )  momentum_advec
@@ -381,4 +397,6 @@
           CASE ( 'random_heatflux' )
              READ ( 13 )  random_heatflux
+          CASE ( 'recycling_width' )
+             READ ( 13 )  recycling_width
           CASE ( 'rif_max' )
              READ ( 13 )  rif_max
@@ -467,4 +485,6 @@
           CASE ( 'tsc' )
              READ ( 13 )  tsc
+          CASE ( 'turbulent_inflow' )
+             READ ( 13 )  turbulent_inflow
           CASE ( 'u_init' )
              READ ( 13 )  u_init
@@ -552,7 +572,8 @@
 ! Skipping the global control variables from restart-file (binary format)
 ! except some informations needed when reading restart data from a previous
-! run which used a smaller total domain.
+! run which used a smaller total domain or/and a different domain decomposition.
 !------------------------------------------------------------------------------!
 
+    USE arrays_3d
     USE control_parameters
     USE indices
@@ -568,4 +589,5 @@
                 statistic_regions_on_file
 
+    REAL, DIMENSION(:,:,:),   ALLOCATABLE ::  hom_sum_on_file
     REAL, DIMENSION(:,:,:,:), ALLOCATABLE ::  hom_on_file
 
@@ -672,4 +694,13 @@
        SELECT CASE ( TRIM( variable_chr ) )
 
+          CASE ( 'average_count_pr' )
+             READ ( 13 )  average_count_pr
+             IF ( average_count_pr /= 0  .AND.  myid == 0 )  THEN
+                PRINT*, '+++ read_parts_of_var_list:'
+                PRINT*, '    WARNING: inflow profiles not temporally averaged.'
+                PRINT*, '    Averaging will be done now using ', &
+                        average_count_pr, ' samples.'
+             ENDIF
+
           CASE ( 'hom' )
              ALLOCATE( hom_on_file(0:nz+1,2,pr_palm+max_pr_user_on_file, &
@@ -678,4 +709,12 @@
              hom = hom_on_file(:,:,1:pr_palm+max_pr_user,0:statistic_regions)
              DEALLOCATE( hom_on_file )
+
+          CASE ( 'hom_sum' )
+             ALLOCATE( hom_sum_on_file(0:nz+1,pr_palm+max_pr_user_on_file, &
+                       0:statistic_regions_on_file) )
+             READ ( 13 )  hom_sum_on_file
+             hom_sum = hom_sum_on_file(:,1:pr_palm+max_pr_user, &
+                                       0:statistic_regions)
+             DEALLOCATE( hom_sum_on_file )
 
           CASE ( 'nx' )
@@ -710,4 +749,10 @@
     ENDDO
 
+!
+!-- Calculate the temporal average of vertical profiles, if neccessary
+    IF ( average_count_pr /= 0 )  THEN
+       hom_sum = hom_sum / REAL( average_count_pr )
+    ENDIF
+
 
  END SUBROUTINE read_parts_of_var_list
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 150)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 151)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! inflow turbulence is imposed by calling new routine inflow_turbulence
 !
 ! Former revisions:
@@ -214,4 +214,8 @@
 
 !
+!--       Impose a turbulent inflow using the recycling method
+          IF ( turbulent_inflow )  CALL  inflow_turbulence
+
+!
 !--       Impose a random perturbation on the horizontal velocity field
           IF ( create_disturbances  .AND.                                      &
Index: palm/trunk/SOURCE/write_var_list.f90
===================================================================
--- palm/trunk/SOURCE/write_var_list.f90	(revision 150)
+++ palm/trunk/SOURCE/write_var_list.f90	(revision 151)
@@ -4,5 +4,7 @@
 ! Actual revisions:
 ! -----------------
-! +numprocs, hor_index_bounds, -cross_ts_*, npex, npey
+! +numprocs, hor_index_bounds, inflow_damping_height, inflow_damping_width,
+! mean_inflow_profiles, recycling_width, turbulent_inflow,
+! -cross_ts_*, npex, npey
 ! hom_sum, volume_flow_area, volume_flow_initial moved from write_3d_binary
 ! to here
@@ -199,4 +201,14 @@
     WRITE ( 14 )  'hom_sum                       '
     WRITE ( 14 )  hom_sum
+    WRITE ( 14 )  'humidity                      '
+    WRITE ( 14 )  humidity
+    IF ( ALLOCATED( inflow_damping_factor ) )  THEN
+       WRITE ( 14 )  'inflow_damping_factor         '
+       WRITE ( 14 )  inflow_damping_factor
+    ENDIF
+    WRITE ( 14 )  'inflow_damping_height         '
+    WRITE ( 14 )  inflow_damping_height
+    WRITE ( 14 )  'inflow_damping_width          '
+    WRITE ( 14 )  inflow_damping_width
     WRITE ( 14 )  'inflow_disturbance_begin      '
     WRITE ( 14 )  inflow_disturbance_begin
@@ -223,8 +235,10 @@
     WRITE ( 14 )  'loop_optimization             '
     WRITE ( 14 )  loop_optimization
+    IF ( ALLOCATED( mean_inflow_profiles ) )  THEN
+       WRITE ( 14 )  'mean_inflow_profiles          '
+       WRITE ( 14 )  mean_inflow_profiles
+    ENDIF
     WRITE ( 14 )  'mixing_length_1d              '
     WRITE ( 14 )  mixing_length_1d
-    WRITE ( 14 )  'humidity                      '
-    WRITE ( 14 )  humidity
     WRITE ( 14 )  'momentum_advec                '
     WRITE ( 14 )  momentum_advec
@@ -299,4 +313,6 @@
     WRITE ( 14 )  'random_heatflux               '
     WRITE ( 14 )  random_heatflux
+    WRITE ( 14 )  'recycling_width               '
+    WRITE ( 14 )  recycling_width
     WRITE ( 14 )  'rif_max                       '
     WRITE ( 14 )  rif_max
@@ -385,4 +401,6 @@
     WRITE ( 14 )  'tsc                           '
     WRITE ( 14 )  tsc
+    WRITE ( 14 )  'turbulent_inflow              '
+    WRITE ( 14 )  turbulent_inflow
     WRITE ( 14 )  'u_init                        '
     WRITE ( 14 )  u_init
