Index: /palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4486)
+++ /palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4487)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! bugfix for subroutine calls that contain the decycle_chem switches as arguments
+! 
+! 4481 2020-03-31 18:55:54Z maronga
 ! use statement for exchange horiz added,
 ! bugfix for call of exchange horiz 2d
@@ -2037,8 +2040,8 @@
 !--    appear under shear-free stable conditions. 
        CALL ws_init_flags_scalar(                                              &
-                  bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  decycle_chem_lr, &
-                  bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  decycle_chem_ns, &
-                  bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  decycle_chem_lr, &
-                  bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  decycle_chem_ns, &
+                  bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  ( decycle_chem_lr .AND. nxl == 0  ), &
+                  bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  ( decycle_chem_ns .AND. nyn == ny ), &
+                  bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  ( decycle_chem_lr .AND. nxr == nx ), &
+                  bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  ( decycle_chem_ns .AND. nys == 0  ), &
                   cs_advc_flags_s, .TRUE. )
     ENDIF
@@ -2829,8 +2832,8 @@
           IF ( ws_scheme_sca )  THEN
              CALL advec_s_ws( cs_advc_flags_s, chem_species(ilsp)%conc, 'kc',                      &
-                              bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  decycle_chem_lr,         &
-                              bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  decycle_chem_ns,         &
-                              bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  decycle_chem_lr,         &
-                              bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  decycle_chem_ns )
+                  bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  ( decycle_chem_lr .AND. nxl == 0  ), &
+                  bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  ( decycle_chem_ns .AND. nyn == ny ), &
+                  bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  ( decycle_chem_lr .AND. nxr == nx ), &
+                  bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  ( decycle_chem_ns .AND. nys == 0  ) )
           ELSE
              CALL advec_s_pw( chem_species(ilsp)%conc )
@@ -2939,9 +2942,5 @@
        IF ( timestep_scheme(1:5) == 'runge' )  THEN
           IF ( ws_scheme_sca )  THEN
-             CALL advec_s_ws( cs_advc_flags_s,                                                     &
-                              i,                                                                   &
-                              j,                                                                   &
-                              chem_species(ilsp)%conc,                                             &
-                              'kc',                                                                &
+             CALL advec_s_ws( cs_advc_flags_s, i, j, chem_species(ilsp)%conc, 'kc',                &
                               chem_species(ilsp)%flux_s_cs,                                        &
                               chem_species(ilsp)%diss_s_cs,                                        &
@@ -2950,9 +2949,9 @@
                               i_omp_start,                                                         &
                               tn,                                                                  &
-                              bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  decycle_chem_lr,         &
-                              bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  decycle_chem_ns,         &
-                              bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  decycle_chem_lr,         &
-                              bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  decycle_chem_ns,         &
-                              monotonic_limiter_z )
+                  bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  ( decycle_chem_lr .AND. nxl == 0  ), &
+                  bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  ( decycle_chem_ns .AND. nyn == ny ), &
+                  bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  ( decycle_chem_lr .AND. nxr == nx ), &
+                  bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  ( decycle_chem_ns .AND. nys == 0  ), &
+                  monotonic_limiter_z )
           ELSE
              CALL advec_s_pw( i, j, chem_species(ilsp)%conc )
Index: /palm/trunk/SOURCE/salsa_mod.f90
===================================================================
--- /palm/trunk/SOURCE/salsa_mod.f90	(revision 4486)
+++ /palm/trunk/SOURCE/salsa_mod.f90	(revision 4487)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! bugfix for subroutine calls that contain the decycle_salsa switches as arguments
+! 
+! 4481 2020-03-31 18:55:54Z maronga
 ! Bug fix to the previous commit: the logical switch monotonic_limiter_z missing
 ! from advec_s_ws in salsa_tendency_ij
@@ -1748,9 +1751,10 @@
 !--    oscillations, which are responsible for high concentration maxima that may appear e.g. under
 !--    shear-free stable conditions.
-       CALL ws_init_flags_scalar( bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  decycle_salsa_lr,    &
-                                  bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  decycle_salsa_ns,    &
-                                  bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  decycle_salsa_lr,    &
-                                  bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  decycle_salsa_ns,    &
-                                  salsa_advc_flags_s, .TRUE. )
+       CALL ws_init_flags_scalar(                                                                  &
+                 bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  ( decycle_salsa_lr .AND. nxl == 0  ), &
+                 bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  ( decycle_salsa_ns .AND. nyn == ny ), &
+                 bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  ( decycle_salsa_lr .AND. nxr == nx ), &
+                 bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  ( decycle_salsa_ns .AND. nys == 0  ), &
+                 salsa_advc_flags_s, .TRUE. )
     ENDIF
 
@@ -8105,10 +8109,10 @@
        IF ( ws_scheme_sca )  THEN
           CALL advec_s_ws( salsa_advc_flags_s, i, j, rs, id,                                       &
-                           flux_s, diss_s, flux_l, diss_l, i_omp_start, tn,                        &
-                           bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  decycle_salsa_lr,           &
-                           bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  decycle_salsa_ns,           &
-                           bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  decycle_salsa_lr,           &
-                           bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  decycle_salsa_ns,           &
-                           monotonic_limiter_z )
+                 flux_s, diss_s, flux_l, diss_l, i_omp_start, tn,                                  &
+                 bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  ( decycle_salsa_lr .AND. nxl == 0  ), &
+                 bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  ( decycle_salsa_ns .AND. nyn == ny ), &
+                 bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  ( decycle_salsa_lr .AND. nxr == nx ), &
+                 bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  ( decycle_salsa_ns .AND. nys == 0  ), &
+                 monotonic_limiter_z )
        ELSE
           CALL advec_s_pw( i, j, rs )
@@ -8242,8 +8246,8 @@
        IF ( ws_scheme_sca )  THEN
           CALL advec_s_ws( salsa_advc_flags_s, rs, id,                                             &
-                           bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  decycle_salsa_lr,           &
-                           bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  decycle_salsa_ns,           &
-                           bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  decycle_salsa_lr,           &
-                           bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  decycle_salsa_ns )
+                 bc_dirichlet_l  .OR.  bc_radiation_l  .OR.  ( decycle_salsa_lr .AND. nxl == 0  ), &
+                 bc_dirichlet_n  .OR.  bc_radiation_n  .OR.  ( decycle_salsa_ns .AND. nyn == ny ), &
+                 bc_dirichlet_r  .OR.  bc_radiation_r  .OR.  ( decycle_salsa_lr .AND. nxr == nx ), &
+                 bc_dirichlet_s  .OR.  bc_radiation_s  .OR.  ( decycle_salsa_ns .AND. nys == 0  ) )
        ELSE
           CALL advec_s_pw( rs )
