Index: /palm/trunk/SOURCE/inflow_turbulence.f90
===================================================================
--- /palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1614)
+++ /palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1615)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! Enable turbulent inflow for passive_scalar and humidity
 ! 
 ! Former revisions:
@@ -61,8 +61,8 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  e, inflow_damping_factor, mean_inflow_profiles, pt, u, v, w
+        ONLY:  e, inflow_damping_factor, mean_inflow_profiles, pt, q, u, v, w
         
     USE control_parameters,                                                    &
-        ONLY:  recycling_plane, recycling_yshift
+        ONLY:  humidity, passive_scalar, recycling_plane, recycling_yshift
         
     USE cpulog,                                                                &
@@ -91,7 +91,7 @@
     INTEGER(iwp) ::  prev     !:
 
-    REAL(wp), DIMENSION(nzb:nzt+1,5,nbgp)           ::                         &
+    REAL(wp), DIMENSION(nzb:nzt+1,6,nbgp)           ::                         &
        avpr, avpr_l  !:
-    REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,5,nbgp) ::                         &
+    REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,6,nbgp) ::                         &
        inflow_dist, local_inflow_dist  !:
 
@@ -101,5 +101,5 @@
 !-- Carry out spanwise averaging in the recycling plane
     avpr_l = 0.0_wp
-    ngp_pr = ( nzt - nzb + 2 ) * 5 * nbgp
+    ngp_pr = ( nzt - nzb + 2 ) * 6 * nbgp
     ngp_ifd = ngp_pr * ( nyn - nys + 1 + 2 * nbgp )
 
@@ -120,4 +120,6 @@
                 avpr_l(k,4,l) = avpr_l(k,4,l) + pt(k,j,i)
                 avpr_l(k,5,l) = avpr_l(k,5,l) + e(k,j,i)
+                IF ( humidity  .OR.  passive_scalar )                          &
+                   avpr_l(k,6,l) = avpr_l(k,6,l) + q(k,j,i)
 
              ENDDO
@@ -130,5 +132,5 @@
 !-- Now, averaging over all PEs
     IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-    CALL MPI_ALLREDUCE( avpr_l(nzb,1,1), avpr(nzb,1,1), ngp_pr, MPI_REAL, &
+    CALL MPI_ALLREDUCE( avpr_l(nzb,1,1), avpr(nzb,1,1), ngp_pr, MPI_REAL,      &
                         MPI_SUM, comm2d, ierr )
 
@@ -143,4 +145,6 @@
              avpr_l(k,4,l) = avpr_l(k,4,l) + pt(k,j,i)
              avpr_l(k,5,l) = avpr_l(k,5,l) + e(k,j,i)
+             IF ( humidity  .OR.  passive_scalar )                             &
+                avpr_l(k,6,l) = avpr_l(k,6,l) + q(k,j,i)
 
           ENDDO
@@ -168,5 +172,6 @@
                 inflow_dist(k,j,4,l) = pt(k,j,i)  - avpr(k,4,l)
                 inflow_dist(k,j,5,l) = e(k,j,i)   - avpr(k,5,l)
-              
+                IF ( humidity  .OR.  passive_scalar )                          &
+                   inflow_dist(k,j,6,l) = q(k,j,i) - avpr(k,6,l)
             ENDDO
           ENDDO
@@ -185,4 +190,6 @@
              inflow_dist(k,j,4,l) = pt(k,j,i)  - avpr(k,4,l)
              inflow_dist(k,j,5,l) = e(k,j,i)   - avpr(k,5,l)
+             IF ( humidity  .OR.  passive_scalar )                             &
+                inflow_dist(k,j,6,l) = q(k,j,i) - avpr(k,6,l)
               
           ENDDO
@@ -263,4 +270,9 @@
                 e(k,j,-nbgp:-1)  = MAX( e(k,j,-nbgp:-1), 0.0_wp )
 
+                IF ( humidity  .OR.  passive_scalar )                          &
+                   q(k,j,-nbgp:-1)  = mean_inflow_profiles(k,6) +              &
+                                      local_inflow_dist(k,j,6,1:nbgp) *        &
+                                      inflow_damping_factor(k)
+
              ENDDO
           ENDDO
@@ -271,15 +283,19 @@
              DO  k = nzb, nzt + 1
  
-                 u(k,j,-nbgp+1:0) = mean_inflow_profiles(k,1) +                   &
-                              inflow_dist(k,j,1,1:nbgp) * inflow_damping_factor(k)
-                 v(k,j,-nbgp:-1)  = mean_inflow_profiles(k,2) +                   &
-                              inflow_dist(k,j,2,1:nbgp) * inflow_damping_factor(k)
-                 w(k,j,-nbgp:-1)  =                                               &
+                u(k,j,-nbgp+1:0) = mean_inflow_profiles(k,1) +                 &
+                           inflow_dist(k,j,1,1:nbgp) * inflow_damping_factor(k)
+                v(k,j,-nbgp:-1)  = mean_inflow_profiles(k,2) +                 &
+                           inflow_dist(k,j,2,1:nbgp) * inflow_damping_factor(k)
+                w(k,j,-nbgp:-1)  =                                             &
                            inflow_dist(k,j,3,1:nbgp) * inflow_damping_factor(k)
-                 pt(k,j,-nbgp:-1) = mean_inflow_profiles(k,4) +                   &
+                pt(k,j,-nbgp:-1) = mean_inflow_profiles(k,4) +                 &
                            inflow_dist(k,j,4,1:nbgp) * inflow_damping_factor(k)
-                 e(k,j,-nbgp:-1)  = mean_inflow_profiles(k,5) +                   &
+                e(k,j,-nbgp:-1)  = mean_inflow_profiles(k,5) +                 &
                            inflow_dist(k,j,5,1:nbgp) * inflow_damping_factor(k)
-                 e(k,j,-nbgp:-1)  = MAX( e(k,j,-nbgp:-1), 0.0_wp )
+                e(k,j,-nbgp:-1)  = MAX( e(k,j,-nbgp:-1), 0.0_wp )
+
+                IF ( humidity  .OR.  passive_scalar )                          &
+                   q(k,j,-nbgp:-1)  = mean_inflow_profiles(k,6) +              &
+                           inflow_dist(k,j,6,1:nbgp) * inflow_damping_factor(k)
 
              ENDDO
Index: /palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_3d_model.f90	(revision 1614)
+++ /palm/trunk/SOURCE/init_3d_model.f90	(revision 1615)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! Enable turbulent inflow for passive_scalar and humidity
 ! 
 ! Former revisions:
@@ -1248,5 +1248,5 @@
 !--       profiles from the prerun. Alternatively, prescribed profiles
 !--       for u,v-components can be used.
-          ALLOCATE( mean_inflow_profiles(nzb:nzt+1,5) )
+          ALLOCATE( mean_inflow_profiles(nzb:nzt+1,6) )
 
           IF ( use_prescribed_profile_data )  THEN
@@ -1259,4 +1259,5 @@
           mean_inflow_profiles(:,4) = hom_sum(:,4,0)       ! pt
           mean_inflow_profiles(:,5) = hom_sum(:,8,0)       ! e
+          mean_inflow_profiles(:,6) = hom_sum(:,41,0)      ! q
 
 !
@@ -1285,4 +1286,6 @@
                    pt(k,j,nxlg:-1) = mean_inflow_profiles(k,4)
                    e(k,j,nxlg:-1)  = mean_inflow_profiles(k,5)
+                   IF ( humidity  .OR.  passive_scalar )                       &
+                      q(k,j,nxlg:-1)  = mean_inflow_profiles(k,6)
                 ENDDO
              ENDDO
Index: /palm/trunk/SOURCE/read_var_list.f90
===================================================================
--- /palm/trunk/SOURCE/read_var_list.f90	(revision 1614)
+++ /palm/trunk/SOURCE/read_var_list.f90	(revision 1615)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! Enable turbulent inflow for passive_scalar and humidity
 ! 
 ! Former revisions:
@@ -442,5 +442,5 @@
           CASE ( 'mean_inflow_profiles' )
              IF ( .NOT. ALLOCATED( mean_inflow_profiles ) )  THEN
-                ALLOCATE( mean_inflow_profiles(0:nz+1,5) )
+                ALLOCATE( mean_inflow_profiles(0:nz+1,6) )
              ENDIF
              READ ( 13 )  mean_inflow_profiles
