Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 710)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 743)
@@ -4,5 +4,6 @@
 ! Current revisions:
 ! -----------------
-! 
+! Calculation of turbulent fluxes with WS-scheme only for the whole model
+! domain, not for user-defined subregions. 
 !
 ! Former revisions:
@@ -168,5 +169,5 @@
 !--    Copy the turbulent quantities, evaluated in the advection routines to 
 !--    the local array sums_l() for further computations
-       IF ( ws_scheme_mom )  THEN
+       IF ( ws_scheme_mom .AND. sr == 0 )  THEN
 
 !       
@@ -174,6 +175,6 @@
 !--       the corresponding fluxes has to satisfiy the same bc.
           IF ( ocean )  THEN
-             sums_us2_ws_l(nzt+1,sr) = sums_us2_ws_l(nzt,sr)
-             sums_vs2_ws_l(nzt+1,sr) = sums_vs2_ws_l(nzt,sr)    
+             sums_us2_ws_l(nzt+1) = sums_us2_ws_l(nzt)
+             sums_vs2_ws_l(nzt+1) = sums_vs2_ws_l(nzt)    
           ENDIF
 
@@ -181,17 +182,17 @@
 !          
 !--          Swap the turbulent quantities evaluated in advec_ws.
-             sums_l(:,13,i) = sums_wsus_ws_l(:,sr)       ! w*u* 
-             sums_l(:,15,i) = sums_wsvs_ws_l(:,sr)       ! w*v* 
-             sums_l(:,30,i) = sums_us2_ws_l(:,sr)        ! u*2 
-             sums_l(:,31,i) = sums_vs2_ws_l(:,sr)        ! v*2 
-             sums_l(:,32,i) = sums_ws2_ws_l(:,sr)        ! w*2 
+             sums_l(:,13,i) = sums_wsus_ws_l(:)       ! w*u* 
+             sums_l(:,15,i) = sums_wsvs_ws_l(:)       ! w*v* 
+             sums_l(:,30,i) = sums_us2_ws_l(:)        ! u*2 
+             sums_l(:,31,i) = sums_vs2_ws_l(:)        ! v*2 
+             sums_l(:,32,i) = sums_ws2_ws_l(:)        ! w*2 
              sums_l(:,34,i) = sums_l(:,34,i) + 0.5 *                        & 
-                              ( sums_us2_ws_l(:,sr) + sums_vs2_ws_l(:,sr) + &
-                                sums_ws2_ws_l(:,sr) )    ! e*
+                              ( sums_us2_ws_l(:) + sums_vs2_ws_l(:) +       &
+                                sums_ws2_ws_l(:) )    ! e*
              DO  k = nzb, nzt
                 sums_l(nzb+5,pr_palm,i) = sums_l(nzb+5,pr_palm,i) + 0.5 * (  &
-                                                      sums_us2_ws_l(k,sr) +  &
-                                                      sums_vs2_ws_l(k,sr) +  &
-                                                      sums_ws2_ws_l(k,sr) )
+                                                      sums_us2_ws_l(k) +     &
+                                                      sums_vs2_ws_l(k) +     &
+                                                      sums_ws2_ws_l(k) )
              ENDDO
           ENDDO
@@ -199,11 +200,11 @@
        ENDIF
 
-       IF ( ws_scheme_sca )  THEN
+       IF ( ws_scheme_sca .AND. sr == 0 )  THEN
 
           DO  i = 0, threads_per_task-1
-             sums_l(:,17,i) = sums_wspts_ws_l(:,sr)      ! w*pt* from advec_s_ws
-             IF ( ocean ) sums_l(:,66,i) = sums_wssas_ws_l(:,sr) ! w*sa*
+             sums_l(:,17,i) = sums_wspts_ws_l(:)      ! w*pt* from advec_s_ws
+             IF ( ocean ) sums_l(:,66,i) = sums_wssas_ws_l(:) ! w*sa*
              IF ( humidity .OR. passive_scalar ) sums_l(:,49,i) =              &
-                                                   sums_wsqs_ws_l(:,sr) !w*q*
+                                                   sums_wsqs_ws_l(:) !w*q*
           ENDDO
 
@@ -483,5 +484,5 @@
 !--    Computation of statistics when ws-scheme is not used. Else these 
 !--    quantities are evaluated in the advection routines.
-       IF ( .NOT. ws_scheme_mom )  THEN
+       IF ( .NOT. ws_scheme_mom .OR. sr /= 0 )  THEN
           !$OMP DO
           DO  i = nxl, nxr
@@ -692,5 +693,5 @@
 !--             but so far there is no other suitable place to calculate)
                 IF ( ocean )  THEN
-                   IF( .NOT. ws_scheme_sca )  THEN
+                   IF( .NOT. ws_scheme_sca .OR. sr /= 0 )  THEN
                       pts = 0.5 * ( sa(k,j,i)   - hom(k,1,23,sr) + &
                                  sa(k+1,j,i) - hom(k+1,1,23,sr) )
@@ -726,5 +727,6 @@
 !
 !--             Passive scalar flux
-                IF ( passive_scalar .AND. ( .NOT. ws_scheme_sca ))  THEN
+                IF ( passive_scalar .AND. ( .NOT. ws_scheme_sca   &
+                     .OR. sr /= 0 ) )  THEN
                    pts = 0.5 * ( q(k,j,i)   - hom(k,1,41,sr) + &
                                  q(k+1,j,i) - hom(k+1,1,41,sr) )
@@ -746,5 +748,5 @@
 !--    inside the WS advection routines are treated seperatly
 !--    Momentum fluxes first:
-       IF ( .NOT. ws_scheme_mom )  THEN
+       IF ( .NOT. ws_scheme_mom .OR. sr /= 0  )  THEN
          !$OMP DO
          DO  i = nxl, nxr
@@ -770,5 +772,5 @@
 
        ENDIF
-       IF ( .NOT. ws_scheme_sca )  THEN
+       IF ( .NOT. ws_scheme_sca .OR. sr /= 0 )  THEN
          !$OMP DO
          DO  i = nxl, nxr
