Index: palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 141)
+++ palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 142)
@@ -12,3 +12,8 @@
 ------
 
+Bugfix: remove IF statement in plant_canopy_model_ij
+Bugfix: divide sums(k,8) (e) and sums(k,34) (e*) by ngp_2dh_s_inner(k,sr) 
+(like other scalars)
 
+flow_statistics, plant_canopy_model
+
Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 141)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 142)
@@ -4,5 +4,6 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Bugfix: divide sums(k,8) (e) and sums(k,34) (e*) by ngp_2dh_s_inner(k,sr) 
+! (like other scalars)
 !
 ! Former revisions:
@@ -785,10 +786,10 @@
        DO  k = nzb, nzt+1
           sums(k,3)               = sums(k,3)           / ngp_2dh(sr)
-          sums(k,9:11)            = sums(k,9:11)        / ngp_2dh_s_inner(k,sr)
+          sums(k,8:11)            = sums(k,8:11)        / ngp_2dh_s_inner(k,sr)
           sums(k,12:22)           = sums(k,12:22)       / ngp_2dh(sr)
           sums(k,23:29)           = sums(k,23:29)       / ngp_2dh_s_inner(k,sr)
           sums(k,30:32)           = sums(k,30:32)       / ngp_2dh(sr)
-          sums(k,33)              = sums(k,33)          / ngp_2dh_s_inner(k,sr)
-          sums(k,34:39)           = sums(k,34:39)       / ngp_2dh(sr)
+          sums(k,33:34)           = sums(k,33:34)       / ngp_2dh_s_inner(k,sr)
+          sums(k,35:39)           = sums(k,35:39)       / ngp_2dh(sr)
           sums(k,40)              = sums(k,40)          / ngp_2dh_s_inner(k,sr)
           sums(k,45:53)           = sums(k,45:53)       / ngp_2dh(sr)
Index: palm/trunk/SOURCE/plant_canopy_model.f90
===================================================================
--- palm/trunk/SOURCE/plant_canopy_model.f90	(revision 141)
+++ palm/trunk/SOURCE/plant_canopy_model.f90	(revision 142)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Bugfix: remove IF statement in plant_canopy_model_ij
 !
 ! Former revisions:
@@ -166,99 +166,94 @@
        INTEGER ::  component, i, j, k
 
-       IF ( drag_coefficient /= 0.0 ) THEN
-
-!
-!--       Compute drag for the three velocity components 
-          SELECT CASE ( component )
-
-!
-!--          u-component
-             CASE ( 1 )
-                DO  k = nzb_u_inner(j,i)+1, pch_index
-                   tend(k,j,i) = tend(k,j,i) -                  &
-                                 cdc(k,j,i) * lad_u(k,j,i) *    &   
-                                 SQRT(     u(k,j,i)**2 +        &
-                                       ( ( v(k,j,i-1)  +        &
-                                           v(k,j,i)    +        &
-                                           v(k,j+1,i)  +        &
-                                           v(k,j+1,i+1) )       &
-                                         / 4.0 )**2    +        &
-                                       ( ( w(k-1,j,i-1) +       &
-                                           w(k-1,j,i)   +       &
-                                           w(k,j,i-1)   +       &
-                                           w(k,j,i) )           &
-                                         / 4.0 )**2 ) *         &
-                                 u(k,j,i)
-                ENDDO
-
-!
-!--          v-component
-             CASE ( 2 )
-                DO  k = nzb_v_inner(j,i)+1, pch_index
-                   tend(k,j,i) = tend(k,j,i) -                  &
-                                 cdc(k,j,i) * lad_v(k,j,i) *    &
-                                 SQRT( ( ( u(k,j-1,i)   +       &
-                                           u(k,j-1,i+1) +       &
-                                           u(k,j,i)     +       &
-                                           u(k,j,i+1) )         &
-                                         / 4.0 )**2     +       &
-                                           v(k,j,i)**2  +       &
-                                       ( ( w(k-1,j-1,i) +       &
-                                           w(k-1,j,i)   +       &
-                                           w(k,j-1,i)   +       &
-                                           w(k,j,i) )           &
-                                         / 4.0 )**2 ) *         &
-                                 v(k,j,i)
-                ENDDO
-
-!
-!--          w-component
-             CASE ( 3 )
-                DO  k = nzb_w_inner(j,i)+1, pch_index
-                   tend(k,j,i) = tend(k,j,i) -                  &
-                                 cdc(k,j,i) * lad_w(k,j,i) *    & 
-                                 SQRT( ( ( u(k,j,i)    +        &  
-                                           u(k,j,i+1)  +        &
-                                           u(k+1,j,i)  +        &
-                                           u(k+1,j,i+1) )       &
-                                         / 4.0 )**2    +        &
-                                       ( ( v(k,j,i)    +        &
-                                           v(k,j+1,i)  +        &
-                                           v(k+1,j,i)  +        &
-                                           v(k+1,j+1,i) )       &
-                                         / 4.0 )**2    +        &
-                                           w(k,j,i)**2 ) *      &
-                                 w(k,j,i)
+!
+!--    Compute drag for the three velocity components 
+       SELECT CASE ( component )
+
+!
+!--       u-component
+       CASE ( 1 )
+          DO  k = nzb_u_inner(j,i)+1, pch_index
+             tend(k,j,i) = tend(k,j,i) -                  &
+                              cdc(k,j,i) * lad_u(k,j,i) *    &   
+                              SQRT(     u(k,j,i)**2 +        &
+                                    ( ( v(k,j,i-1)  +        &
+                                        v(k,j,i)    +        &
+                                        v(k,j+1,i)  +        &
+                                        v(k,j+1,i+1) )       &
+                                      / 4.0 )**2    +        &
+                                    ( ( w(k-1,j,i-1) +       &
+                                        w(k-1,j,i)   +       &
+                                        w(k,j,i-1)   +       &
+                                        w(k,j,i) )           &
+                                      / 4.0 )**2 ) *         &
+                              u(k,j,i)
+          ENDDO
+
+!
+!--       v-component
+       CASE ( 2 )
+          DO  k = nzb_v_inner(j,i)+1, pch_index
+             tend(k,j,i) = tend(k,j,i) -                  &
+                              cdc(k,j,i) * lad_v(k,j,i) *    &
+                              SQRT( ( ( u(k,j-1,i)   +       &
+                                        u(k,j-1,i+1) +       &
+                                        u(k,j,i)     +       &
+                                        u(k,j,i+1) )         &
+                                      / 4.0 )**2     +       &
+                                        v(k,j,i)**2  +       &
+                                    ( ( w(k-1,j-1,i) +       &
+                                        w(k-1,j,i)   +       &
+                                        w(k,j-1,i)   +       &
+                                        w(k,j,i) )           &
+                                      / 4.0 )**2 ) *         &
+                              v(k,j,i)
+          ENDDO
+
+!
+!--       w-component
+       CASE ( 3 )
+          DO  k = nzb_w_inner(j,i)+1, pch_index
+             tend(k,j,i) = tend(k,j,i) -                  &
+                              cdc(k,j,i) * lad_w(k,j,i) *    & 
+                              SQRT( ( ( u(k,j,i)    +        &  
+                                        u(k,j,i+1)  +        &
+                                        u(k+1,j,i)  +        &
+                                        u(k+1,j,i+1) )       &
+                                      / 4.0 )**2    +        &
+                                    ( ( v(k,j,i)    +        &
+                                        v(k,j+1,i)  +        &
+                                        v(k+1,j,i)  +        &
+                                        v(k+1,j+1,i) )       &
+                                      / 4.0 )**2    +        &
+                                        w(k,j,i)**2 ) *      &
+                              w(k,j,i)
    
-                ENDDO
-
-!
-!--          sgs-tke
-             CASE ( 4 )
-                DO  k = nzb_s_inner(j,i)+1, pch_index   
-                   tend(k,j,i) = tend(k,j,i) -                     &
-                                 2.0 * cdc(k,j,i) * lad_s(k,j,i) * &
-                                 SQRT( ( ( u(k,j,i)           +    &
-                                           u(k,j,i+1) )            &
-                                         / 2.0 )**2           +    &  
-                                       ( ( v(k,j,i)           +    &
-                                           v(k,j+1,i) )            &
-                                         / 2.0 )**2           +    &
-                                       ( ( w(k,j,i)           +    &
-                                           w(k+1,j,i) )            &
-                                         / 2.0 )**2 )         *    &
-                                 e(k,j,i)
-
-                ENDDO
-
-             CASE DEFAULT
-
-                IF ( myid == 0 )  PRINT*,'+++ pcm:  wrong component: ', &
-                                         component
-                CALL local_stop
-
-          END SELECT
-
-       ENDIF
+          ENDDO
+
+!
+!--       sgs-tke
+       CASE ( 4 )
+          DO  k = nzb_s_inner(j,i)+1, pch_index   
+             tend(k,j,i) = tend(k,j,i) -                     &
+                              2.0 * cdc(k,j,i) * lad_s(k,j,i) * &
+                              SQRT( ( ( u(k,j,i)           +    &
+                                        u(k,j,i+1) )            &
+                                      / 2.0 )**2           +    &  
+                                    ( ( v(k,j,i)           +    &
+                                        v(k,j+1,i) )            &
+                                      / 2.0 )**2           +    &
+                                    ( ( w(k,j,i)           +    &
+                                        w(k+1,j,i) )            &
+                                      / 2.0 )**2 )         *    &
+                              e(k,j,i)
+          ENDDO
+
+       CASE DEFAULT
+
+          IF ( myid == 0 )  PRINT*,'+++ pcm:  wrong component: ', &
+                                      component
+          CALL local_stop
+
+       END SELECT
 
     END SUBROUTINE plant_canopy_model_ij
