Index: palm/trunk/SOURCE/bulk_cloud_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4182)
+++ palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4268)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Introducing bcm_boundary_conditions
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -114,5 +117,5 @@
                bc_radiation_n,                                                 &
                bc_radiation_r,                                                 &
-               bc_radiation_s,                                                 &                                                                
+               bc_radiation_s,                                                 &
                debug_output,                                                   &
                dt_3d, dt_do2d_xy, intermediate_timestep_count,                 &
@@ -247,4 +250,5 @@
            bcm_exchange_horiz, &
            bcm_prognostic_equations, &
+           bcm_boundary_conditions, &
            bcm_3d_data_averaging, &
            bcm_data_output_2d, &
@@ -313,5 +317,5 @@
     INTERFACE bcm_exchange_horiz
        MODULE PROCEDURE bcm_exchange_horiz
-    END INTERFACE bcm_exchange_horiz    
+    END INTERFACE bcm_exchange_horiz
 
     INTERFACE bcm_prognostic_equations
@@ -319,4 +323,8 @@
        MODULE PROCEDURE bcm_prognostic_equations_ij
     END INTERFACE bcm_prognostic_equations
+
+    INTERFACE bcm_boundary_conditions
+       MODULE PROCEDURE bcm_boundary_conditions
+    END INTERFACE bcm_boundary_conditions
 
     INTERFACE bcm_swap_timelevel
@@ -2014,4 +2022,107 @@
 
 !------------------------------------------------------------------------------!
+! Description: Boundary conditions of the bulk cloud module variables
+!------------------------------------------------------------------------------!
+    SUBROUTINE bcm_boundary_conditions
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i !<
+       INTEGER(iwp) ::  j !<
+       INTEGER(iwp) ::  k !<
+       INTEGER(iwp) ::  m !<
+       INTEGER(iwp) ::  l !<
+
+       IF ( microphysics_morrison )  THEN
+!
+!--       Surface conditions cloud water (Dirichlet)
+!--       Run loop over all non-natural and natural walls. Note, in wall-datatype
+!--       the k coordinate belongs to the atmospheric grid point, therefore, set
+!--       qr_p and nr_p at upward (k-1) and downward-facing (k+1) walls
+          DO  l = 0, 1
+          !$OMP PARALLEL DO PRIVATE( i, j, k )
+             DO  m = 1, bc_h(l)%ns
+                i = bc_h(l)%i(m)
+                j = bc_h(l)%j(m)
+                k = bc_h(l)%k(m)
+                qc_p(k+bc_h(l)%koff,j,i) = 0.0_wp
+                nc_p(k+bc_h(l)%koff,j,i) = 0.0_wp
+             ENDDO
+          ENDDO
+!
+!--       Top boundary condition for cloud water (Dirichlet)
+          qc_p(nzt+1,:,:) = 0.0_wp
+          nc_p(nzt+1,:,:) = 0.0_wp
+
+       ENDIF
+
+       IF ( microphysics_seifert )  THEN
+!
+!--       Surface conditions rain water (Dirichlet)
+!--       Run loop over all non-natural and natural walls. Note, in wall-datatype
+!--       the k coordinate belongs to the atmospheric grid point, therefore, set
+!--       qr_p and nr_p at upward (k-1) and downward-facing (k+1) walls
+          DO  l = 0, 1
+          !$OMP PARALLEL DO PRIVATE( i, j, k )
+             DO  m = 1, bc_h(l)%ns
+                i = bc_h(l)%i(m)
+                j = bc_h(l)%j(m)
+                k = bc_h(l)%k(m)
+                qr_p(k+bc_h(l)%koff,j,i) = 0.0_wp
+                nr_p(k+bc_h(l)%koff,j,i) = 0.0_wp
+             ENDDO
+          ENDDO
+!
+!--       Top boundary condition for rain water (Dirichlet)
+          qr_p(nzt+1,:,:) = 0.0_wp
+          nr_p(nzt+1,:,:) = 0.0_wp
+
+       ENDIF
+
+!
+!--    Lateral boundary conditions for scalar quantities at the outflow.
+!--    Lateral oundary conditions for TKE and dissipation are set
+!--    in tcm_boundary_conds.
+       IF ( bc_radiation_s )  THEN
+          IF ( microphysics_morrison )  THEN
+             qc_p(:,nys-1,:) = qc_p(:,nys,:)
+             nc_p(:,nys-1,:) = nc_p(:,nys,:)
+          ENDIF
+          IF ( microphysics_seifert )  THEN
+             qr_p(:,nys-1,:) = qr_p(:,nys,:)
+             nr_p(:,nys-1,:) = nr_p(:,nys,:)
+          ENDIF
+       ELSEIF ( bc_radiation_n )  THEN
+          IF ( microphysics_morrison )  THEN
+             qc_p(:,nyn+1,:) = qc_p(:,nyn,:)
+             nc_p(:,nyn+1,:) = nc_p(:,nyn,:)
+          ENDIF
+          IF ( microphysics_seifert )  THEN
+             qr_p(:,nyn+1,:) = qr_p(:,nyn,:)
+             nr_p(:,nyn+1,:) = nr_p(:,nyn,:)
+          ENDIF
+       ELSEIF ( bc_radiation_l )  THEN
+          IF ( microphysics_morrison )  THEN
+             qc_p(:,:,nxl-1) = qc_p(:,:,nxl)
+             nc_p(:,:,nxl-1) = nc_p(:,:,nxl)
+          ENDIF
+          IF ( microphysics_seifert )  THEN
+             qr_p(:,:,nxl-1) = qr_p(:,:,nxl)
+             nr_p(:,:,nxl-1) = nr_p(:,:,nxl)
+          ENDIF
+       ELSEIF ( bc_radiation_r )  THEN
+          IF ( microphysics_morrison )  THEN
+             qc_p(:,:,nxr+1) = qc_p(:,:,nxr)
+             nc_p(:,:,nxr+1) = nc_p(:,:,nxr)
+          ENDIF
+          IF ( microphysics_seifert )  THEN
+             qr_p(:,:,nxr+1) = qr_p(:,:,nxr)
+             nr_p(:,:,nxr+1) = nr_p(:,:,nxr)
+          ENDIF
+       ENDIF
+
+    END SUBROUTINE bcm_boundary_conditions
+
+!------------------------------------------------------------------------------!
 !
 ! Description:
