Index: palm/trunk/SOURCE/bulk_cloud_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 3886)
+++ palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 3887)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Added bcm_exchange_horiz which is called after non_transport_physics
+! 
+! 3885 2019-04-11 11:29:34Z kanani
 ! Changes related to global restructuring of location messages and introduction 
 ! of additional debug messages
@@ -260,5 +263,5 @@
 
     USE indices,                                                               &
-        ONLY:  nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt,           &
+        ONLY:  nbgp, nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt,     &
                wall_flags_0
 
@@ -369,4 +372,5 @@
            bcm_actions, &
            bcm_non_transport_physics, &
+           bcm_exchange_horiz, &
            bcm_prognostic_equations, &
            bcm_3d_data_averaging, &
@@ -432,4 +436,8 @@
        MODULE PROCEDURE bcm_non_transport_physics_ij
     END INTERFACE bcm_non_transport_physics
+
+    INTERFACE bcm_exchange_horiz
+       MODULE PROCEDURE bcm_exchange_horiz
+    END INTERFACE bcm_exchange_horiz    
 
     INTERFACE bcm_prognostic_equations
@@ -1312,4 +1320,33 @@
 
     END SUBROUTINE bcm_non_transport_physics_ij
+    
+    
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Control of microphysics for all grid points
+!------------------------------------------------------------------------------!
+    SUBROUTINE bcm_exchange_horiz
+
+
+       IF ( .NOT. microphysics_sat_adjust  .AND.                                &
+            ( intermediate_timestep_count == 1  .OR.                            &
+              call_microphysics_at_all_substeps ) )                             &
+       THEN
+          IF ( microphysics_morrison )  THEN
+             CALL exchange_horiz( nc, nbgp )
+             CALL exchange_horiz( qc, nbgp )          
+          ENDIF
+          IF ( microphysics_seifert ) THEN
+             CALL exchange_horiz( qr, nbgp )
+             CALL exchange_horiz( nr, nbgp )
+          ENDIF
+          CALL exchange_horiz( q, nbgp )
+          CALL exchange_horiz( pt, nbgp )          
+       ENDIF
+
+
+    END SUBROUTINE bcm_exchange_horiz
+    
 
 
@@ -2898,6 +2935,6 @@
        CALL cpu_log( log_point_s(50), 'adjust_cloud', 'start' )
 
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
              DO  k = nzb+1, nzt
 !
@@ -3020,6 +3057,6 @@
        CALL cpu_log( log_point_s(65), 'activation', 'start' )
 
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
              DO  k = nzb+1, nzt
 !
@@ -3221,6 +3258,6 @@
        CALL cpu_log( log_point_s(66), 'condensation', 'start' )
 
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
              DO  k = nzb+1, nzt
 !
@@ -3381,6 +3418,6 @@
        CALL cpu_log( log_point_s(47), 'autoconversion', 'start' )
 
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
              DO  k = nzb+1, nzt
 !
@@ -3615,6 +3652,6 @@
        REAL(wp)    ::  flag        !< flag to mask topography grid points
 
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
 !
 !--          Determine vertical index of topography top
@@ -3716,6 +3753,6 @@
        CALL cpu_log( log_point_s(56), 'accretion', 'start' )
 
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
              DO  k = nzb+1, nzt
 !
@@ -3877,6 +3914,6 @@
        CALL cpu_log( log_point_s(57), 'selfcollection', 'start' )
 
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
              DO  k = nzb+1, nzt
 !
@@ -3994,6 +4031,6 @@
        CALL cpu_log( log_point_s(58), 'evaporation', 'start' )
 
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
              DO  k = nzb+1, nzt
 !
@@ -4230,6 +4267,6 @@
        sed_nc(nzt+1) = 0.0_wp
 
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
              DO  k = nzt, nzb+1, -1
 !
@@ -4430,6 +4467,6 @@
 !
 !--    Compute velocities
-       DO  i = nxlg, nxrg
-          DO  j = nysg, nyng
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
              DO  k = nzb+1, nzt
 !
Index: palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 3886)
+++ palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 3887)
@@ -522,4 +522,8 @@
        MODULE PROCEDURE chem_non_transport_physics_ij
     END INTERFACE chem_non_transport_physics
+    
+    INTERFACE chem_exchange_horiz
+       MODULE PROCEDURE chem_exchange_horiz
+    END INTERFACE chem_exchange_horiz    
 
     INTERFACE chem_prognostic_equations
@@ -622,5 +626,5 @@
          chem_actions, chem_prognostic_equations, chem_rrd_local,             &
          chem_statistics, chem_swap_timelevel, chem_wrd_local, chem_depo,     &
-         chem_non_transport_physics
+         chem_non_transport_physics, chem_exchange_horiz
 
  CONTAINS
@@ -915,5 +919,5 @@
     DO  lsp = 1, nspec
 
-       CALL exchange_horiz( chem_species(lsp)%conc_p, nbgp )
+       CALL exchange_horiz( chem_species(lsp)%conc, nbgp )
        lsp_usr = 1
        DO WHILE ( TRIM( cs_name( lsp_usr ) ) /= 'novalue' )
@@ -2460,4 +2464,35 @@
 
  END SUBROUTINE chem_non_transport_physics_ij
+ 
+ SUBROUTINE chem_exchange_horiz
+
+
+    INTEGER(iwp) ::  i  !< grid index in x-direction
+    INTEGER(iwp) ::  j  !< grid index in y-direction
+
+    i = i + j
+! !
+! !-- Loop over chemical species       
+!     CALL cpu_log( log_point_s(84), 'chem.exch-horiz', 'start' )
+!     DO  lsp = 1, nspec
+!        CALL exchange_horiz( chem_species(lsp)%conc, nbgp )    
+!        lsp_usr = 1  
+!        DO WHILE ( TRIM( cs_name( lsp_usr ) ) /= 'novalue' )
+!           IF ( TRIM(chem_species(lsp)%name) == TRIM(cs_name(lsp_usr)) )  THEN
+!           
+!              CALL chem_boundary_conds( chem_species(lsp)%conc_p,               &
+!                                        chem_species(lsp)%conc_pr_init ) 
+!              
+!           ENDIF
+!           lsp_usr = lsp_usr +1
+!        ENDDO
+! 
+! 
+!     ENDDO
+!     CALL cpu_log( log_point_s(84), 'chem.exch-horiz', 'stop' )
+
+
+ END SUBROUTINE chem_exchange_horiz
+
 
  
Index: palm/trunk/SOURCE/module_interface.f90
===================================================================
--- palm/trunk/SOURCE/module_interface.f90	(revision 3886)
+++ palm/trunk/SOURCE/module_interface.f90	(revision 3887)
@@ -152,4 +152,5 @@
                bcm_actions,                                                    &
                bcm_non_transport_physics,                                      &
+               bcm_exchange_horiz,                                             &               
                bcm_prognostic_equations,                                       &
                bcm_swap_timelevel,                                             &
@@ -179,5 +180,5 @@
               chem_statistics,                                                 &
               chem_rrd_local,                                                  &
-               chem_wrd_local
+              chem_wrd_local
 
     USE flight_mod,                                                            &
@@ -392,4 +393,5 @@
        module_interface_actions,                                               &
        module_interface_non_transport_physics,                                 &
+       module_interface_exchange_horiz,                                        &
        module_interface_prognostic_equations,                                  &
        module_interface_swap_timelevel,                                        &
@@ -458,5 +460,9 @@
        MODULE PROCEDURE module_interface_non_transport_physics_ij
     END INTERFACE module_interface_non_transport_physics
-
+    
+    INTERFACE module_interface_exchange_horiz
+       MODULE PROCEDURE module_interface_exchange_horiz
+    END INTERFACE module_interface_exchange_horiz
+    
     INTERFACE module_interface_prognostic_equations
        MODULE PROCEDURE module_interface_prognostic_equations
@@ -972,4 +978,17 @@
 
  END SUBROUTINE module_interface_non_transport_physics_ij
+ 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Exchange horiz for module-specific quantities 
+!------------------------------------------------------------------------------!
+ SUBROUTINE module_interface_exchange_horiz()
+
+
+    IF ( bulk_cloud_model    )  CALL bcm_exchange_horiz()
+
+
+ END SUBROUTINE module_interface_exchange_horiz
 
 
Index: palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- palm/trunk/SOURCE/prognostic_equations.f90	(revision 3886)
+++ palm/trunk/SOURCE/prognostic_equations.f90	(revision 3887)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Implicit Bugfix for chemistry model, loop for non_transport_physics over 
+! ghost points is avoided. Instead introducing module_interface_exchange_horiz.
+! 
+! 3885 2019-04-11 11:29:34Z kanani
 ! Changes related to global restructuring of location messages and introduction 
 ! of additional debug messages
@@ -441,4 +445,5 @@
         ONLY:  module_interface_actions, &
                module_interface_non_transport_physics, &
+               module_interface_exchange_horiz, &
                module_interface_prognostic_equations
 
@@ -533,6 +538,6 @@
     !$OMP PARALLEL PRIVATE (i,j)
     !$OMP DO
-    DO  i = nxlg, nxrg
-       DO  j = nysg, nyng
+    DO  i = nxl, nxr
+       DO  j = nys, nyn
 !
 !--       Calculate non transport physics for all other modules
@@ -540,4 +545,8 @@
        ENDDO
     ENDDO
+!
+!-- Module Inferface for exchange horiz after non_transport_physics but before
+!-- advection. Therefore, non_transport_physics must not run for ghost points. 
+    CALL module_interface_exchange_horiz()
     !$OMP END PARALLEL
 
@@ -1210,5 +1219,9 @@
 !-- Calculate non transport physics for all other modules
     CALL module_interface_non_transport_physics
-
+!
+!-- Module Inferface for exchange horiz after non_transport_physics but before
+!-- advection. Therefore, non_transport_physics must not run for ghost points.     
+    CALL module_interface_exchange_horiz()
+    
 !
 !-- u-velocity component
