Index: palm/trunk/SOURCE/advec_ws.f90
===================================================================
--- palm/trunk/SOURCE/advec_ws.f90	(revision 4509)
+++ palm/trunk/SOURCE/advec_ws.f90	(revision 4581)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! Enable output of resolved-scale vertical fluxes of chemical species.
+! 
+! 4509 2020-04-26 15:57:55Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -229,16 +232,28 @@
 
     USE statistics,                                                                                &
-        ONLY:  hom, weight_substep,                                                                &
-               sums_salsa_ws_l, sums_us2_ws_l, sums_vs2_ws_l, sums_ws2_ws_l,                       &
-               sums_wsncs_ws_l, sums_wsnrs_ws_l,                                                   &
-               sums_wspts_ws_l, sums_wsqs_ws_l, sums_wsss_ws_l,                                    &
-               sums_wsqcs_ws_l, sums_wsqrs_ws_l,                                                   &
-               sums_wsqis_ws_l, sums_wsnis_ws_l,                                                   &
-               sums_wssas_ws_l, sums_wsus_ws_l, sums_wsvs_ws_l
+        ONLY:  hom,                                                                                &
+               sums_salsa_ws_l,                                                                    &
+               sums_us2_ws_l,                                                                      &
+               sums_vs2_ws_l,                                                                      &
+               sums_ws2_ws_l,                                                                      &
+               sums_wschs_ws_l,                                                                    &
+               sums_wsncs_ws_l,                                                                    &
+               sums_wsnrs_ws_l,                                                                    &
+               sums_wspts_ws_l,                                                                    &
+               sums_wsqs_ws_l,                                                                     &
+               sums_wsss_ws_l,                                                                     &
+               sums_wsqcs_ws_l,                                                                    &
+               sums_wsqrs_ws_l,                                                                    &
+               sums_wsqis_ws_l,                                                                    &
+               sums_wsnis_ws_l,                                                                    &
+               sums_wssas_ws_l,                                                                    &
+               sums_wsus_ws_l,                                                                     &
+               sums_wsvs_ws_l,                                                                     &
+               weight_substep
 
 
 
     IMPLICIT NONE
-    
+
     REAL(wp) ::  adv_mom_1            !< 1/4 - constant used in 5th-order advection scheme for momentum advection (1st-order part)
     REAL(wp) ::  adv_mom_3            !< 1/24 - constant used in 5th-order advection scheme for momentum advection (3rd-order part)
@@ -1875,5 +1890,5 @@
           ENDDO
 
-      CASE ( 'aerosol_mass', 'aerosol_number', 'salsa_gas' )
+       CASE ( 'aerosol_mass', 'aerosol_number', 'salsa_gas' )
 
           DO  k = nzb, nzt
@@ -1886,6 +1901,13 @@
           ENDDO
 
-!       CASE ( 'kc' )
-        !kk Has to be implemented for kpp chemistry
+       CASE ( 'kc' )
+          DO  k = nzb, nzt
+             sums_wschs_ws_l(k,tn)  = sums_wschs_ws_l(k,tn) +                                      &
+                                      ( flux_t(k) / ( w(k,j,i) + SIGN( 1.0E-20_wp, w(k,j,i) ) )    &
+                                                  * ( w(k,j,i) - hom(k,1,3,0)                 )    &
+                                      + diss_t(k) / ( ABS(w(k,j,i)) + 1.0E-20_wp              )    &
+                                                  *   ABS( w(k,j,i) - hom(k,1,3,0)            )    &
+                                      ) * weight_substep(intermediate_timestep_count)
+          ENDDO
 
     END SELECT
