Index: palm/trunk/SOURCE/boundary_conds.f90
===================================================================
--- palm/trunk/SOURCE/boundary_conds.f90	(revision 1933)
+++ palm/trunk/SOURCE/boundary_conds.f90	(revision 1960)
@@ -19,5 +19,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! Treat humidity and passive scalar separately
 ! 
 ! Former revisions:
@@ -135,16 +135,15 @@
     USE arrays_3d,                                                             &
         ONLY:  c_u, c_u_m, c_u_m_l, c_v, c_v_m, c_v_m_l, c_w, c_w_m, c_w_m_l,  &
-               dzu, e_p, nr_p, pt, pt_p, q, q_p, qr_p, sa, sa_p,               &
+               dzu, e_p, nr_p, pt, pt_p, q, q_p, qr_p, s, s_p, sa, sa_p,       &
                u, ug, u_init, u_m_l, u_m_n, u_m_r, u_m_s, u_p,                 &
                v, vg, v_init, v_m_l, v_m_n, v_m_r, v_m_s, v_p,                 &
-               w, w_p, w_m_l, w_m_n, w_m_r, w_m_s,&
-               pt_init
+               w, w_p, w_m_l, w_m_n, w_m_r, w_m_s, pt_init
 
     USE control_parameters,                                                    &
-        ONLY:  bc_pt_t_val, bc_q_t_val, constant_diffusion,                    &
+        ONLY:  bc_pt_t_val, bc_q_t_val, bc_s_t_val, constant_diffusion,        &
                cloud_physics, dt_3d, humidity,                                 &
-               ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, ibc_sa_t, ibc_uv_b,       &
-               ibc_uv_t, inflow_l, inflow_n, inflow_r, inflow_s,               &
-               intermediate_timestep_count, large_scale_forcing,               &
+               ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, ibc_s_b, ibc_s_t,         &
+               ibc_sa_t, ibc_uv_b, ibc_uv_t, inflow_l, inflow_n, inflow_r,     &
+               inflow_s, intermediate_timestep_count, large_scale_forcing,     &
                microphysics_seifert, nest_domain, nest_bound_l, nest_bound_s,  &
                nudging, ocean, outflow_l, outflow_n, outflow_r, outflow_s,     &
@@ -302,7 +301,7 @@
 
 !
-!-- Boundary conditions for total water content or scalar,
+!-- Boundary conditions for total water content,
 !-- bottom and top boundary (see also temperature)
-    IF ( humidity  .OR.  passive_scalar )  THEN
+    IF ( humidity )  THEN
 !
 !--    Surface conditions for constant_humidity_flux
@@ -344,4 +343,32 @@
        ENDIF
     ENDIF
+!
+!-- Boundary conditions for scalar,
+!-- bottom and top boundary (see also temperature)
+    IF ( passive_scalar )  THEN
+!
+!--    Surface conditions for constant_humidity_flux
+       IF ( ibc_s_b == 0 ) THEN
+          DO  i = nxlg, nxrg
+             DO  j = nysg, nyng
+                s_p(nzb_s_inner(j,i),j,i) = s(nzb_s_inner(j,i),j,i)
+             ENDDO
+          ENDDO
+       ELSE
+          DO  i = nxlg, nxrg
+             DO  j = nysg, nyng
+                s_p(nzb_s_inner(j,i),j,i) = s_p(nzb_s_inner(j,i)+1,j,i)
+             ENDDO
+          ENDDO
+       ENDIF
+!
+!--    Top boundary
+       IF ( ibc_s_t == 0 ) THEN
+          s_p(nzt+1,:,:) = s(nzt+1,:,:)
+       ELSEIF ( ibc_s_t == 1 ) THEN
+          s_p(nzt+1,:,:) = s_p(nzt,:,:)   + bc_s_t_val * dzu(nzt+1)
+       ENDIF
+
+    ENDIF    
 !
 !-- In case of inflow or nest boundary at the south boundary the boundary for v
@@ -381,5 +408,5 @@
        pt_p(:,nys-1,:)     = pt_p(:,nys,:)
        IF ( .NOT. constant_diffusion     )  e_p(:,nys-1,:) = e_p(:,nys,:)
-       IF ( humidity  .OR.  passive_scalar )  THEN
+       IF ( humidity )  THEN
           q_p(:,nys-1,:) = q_p(:,nys,:)
           IF ( cloud_physics  .AND.  microphysics_seifert )  THEN
@@ -388,8 +415,9 @@
           ENDIF
        ENDIF
+       IF ( passive_scalar )  s_p(:,nys-1,:) = s_p(:,nys,:)
     ELSEIF ( outflow_n )  THEN
        pt_p(:,nyn+1,:)     = pt_p(:,nyn,:)
        IF ( .NOT. constant_diffusion     )  e_p(:,nyn+1,:) = e_p(:,nyn,:)
-       IF ( humidity  .OR.  passive_scalar )  THEN
+       IF ( humidity )  THEN
           q_p(:,nyn+1,:) = q_p(:,nyn,:)
           IF ( cloud_physics  .AND.  microphysics_seifert )  THEN
@@ -398,8 +426,9 @@
           ENDIF
        ENDIF
+       IF ( passive_scalar )  s_p(:,nyn+1,:) = s_p(:,nyn,:)
     ELSEIF ( outflow_l )  THEN
        pt_p(:,:,nxl-1)     = pt_p(:,:,nxl)
        IF ( .NOT. constant_diffusion     )  e_p(:,:,nxl-1) = e_p(:,:,nxl)
-       IF ( humidity  .OR.  passive_scalar )  THEN
+       IF ( humidity )  THEN
           q_p(:,:,nxl-1) = q_p(:,:,nxl)
           IF ( cloud_physics  .AND.  microphysics_seifert )  THEN
@@ -408,8 +437,9 @@
           ENDIF
        ENDIF
+       IF ( passive_scalar )  s_p(:,:,nxl-1) = s_p(:,:,nxl)
     ELSEIF ( outflow_r )  THEN
        pt_p(:,:,nxr+1)     = pt_p(:,:,nxr)
        IF ( .NOT. constant_diffusion     )  e_p(:,:,nxr+1) = e_p(:,:,nxr)
-       IF ( humidity .OR. passive_scalar )  THEN
+       IF ( humidity )  THEN
           q_p(:,:,nxr+1) = q_p(:,:,nxr)
           IF ( cloud_physics  .AND.  microphysics_seifert )  THEN
@@ -418,4 +448,5 @@
           ENDIF
        ENDIF
+       IF ( passive_scalar )  s_p(:,:,nxr+1) = s_p(:,:,nxr)
     ENDIF
 
