Index: palm/trunk/SOURCE/advec_w_pw.f90
===================================================================
--- palm/trunk/SOURCE/advec_w_pw.f90	(revision 4901)
+++ palm/trunk/SOURCE/advec_w_pw.f90	(revision 1)
@@ -1,34 +1,39 @@
-!> @file advec_w_pw.f90
-!--------------------------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General
-! Public License as published by the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
-! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-! Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with PALM. If not, see
-! <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2021 Leibniz Universitaet Hannover
-!--------------------------------------------------------------------------------------------------!
-!
-! Current revisions:
+ MODULE advec_w_pw_mod
+
+!------------------------------------------------------------------------------!
+! Actual revisions:
 ! -----------------
 ! 
-! 
+!
 ! Former revisions:
 ! -----------------
-! $Id$
-! file re-formatted to follow the PALM coding standard
+! $Log: advec_w_pw.f90,v $
+! Revision 1.15  2006/02/23 09:47:01  raasch
+! nzb_2d replaced by nzb_w_inner
 !
-! 4360 2020-01-07 11:25:50Z suehring
-! Corrected "Former revisions" section
-! 
-! 3655 2019-01-07 16:51:22Z knoop
-! variables documented
+! Revision 1.14  2004/01/30 10:13:07  raasch
+! Scalar lower k index nzb replaced by 2d-array nzb_2d
+!
+! Revision 1.13  2003/03/12 16:19:29  raasch
+! Full code replaced in the call for all gridpoints instead of calling the
+! _ij version (required by NEC, because otherwise no vectorization)
+!
+! Revision 1.12  2002/06/11 12:27:33  raasch
+! Former subroutine changed to a module which allows to be called for all grid
+! points of a single vertical column with index i,j or for all grid points by
+! using function overloading.
+!
+! Revision 1.11  2001/03/29 17:37:10  raasch
+! Translation of remaining German identifiers (variables, subroutines, etc.)
+!
+! Revision 1.10  2001/01/22 05:19:42  raasch
+! Module test_variables removed
+!
+! Revision 1.9  2000/01/20 10:18:31  letzel
+! All comments translated into English
+!
+! Revision 1.8  1998/08/05 06:51:10  raasch
+! Alle Gitterpunkte werden gleich behandelt (keine zentralen Differenzenquotien-
+! ten mehr bei Vertikaladvektion bei k=1)
 !
 ! Revision 1.1  1997/08/11 06:10:29  raasch
@@ -38,11 +43,9 @@
 ! Description:
 ! ------------
-!> Advection term for w velocity-component using Piacsek and Williams.
-!> Vertical advection at the first grid point above the surface is done with normal centred
-!> differences, because otherwise no information from the surface would be communicated upwards due
-!> to w=0 at k=nzb.
-!--------------------------------------------------------------------------------------------------!
- MODULE advec_w_pw_mod
- 
+! Advection term for w velocity-component using Piacsek and Williams.
+! Vertical advection at the first grid point above the surface is done with
+! normal centred differences, because otherwise no information from the surface
+! would be communicated upwards due to w=0 at k=nzb.
+!------------------------------------------------------------------------------!
 
     PRIVATE
@@ -57,100 +60,72 @@
 
 
-!--------------------------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for all grid points
-!--------------------------------------------------------------------------------------------------!
- SUBROUTINE advec_w_pw
+!------------------------------------------------------------------------------!
+! Call for all grid points
+!------------------------------------------------------------------------------!
+    SUBROUTINE advec_w_pw
 
-    USE arrays_3d,                                                                                 &
-        ONLY:  ddzu, tend, u, v, w
+       USE arrays_3d
+       USE control_parameters
+       USE grid_variables
+       USE indices
 
-    USE control_parameters,                                                                        &
-        ONLY:  u_gtrans, v_gtrans
+       IMPLICIT NONE
 
-    USE grid_variables,                                                                            &
-        ONLY:  ddx, ddy
+       INTEGER ::  i, j, k
+       REAL    ::  gu, gv
 
-    USE indices,                                                                                   &
-        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
+ 
+       gu = 2.0 * u_gtrans
+       gv = 2.0 * v_gtrans
+       DO  i = nxl, nxr
+          DO  j = nys, nyn
+             DO  k = nzb_w_inner(j,i)+1, nzt
+                tend(k,j,i) = tend(k,j,i) - 0.25 * (                           &
+                         ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu )     &
+                         - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx &
+                       + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv )     &
+                         - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy &
+                       + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) )              &
+                         - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) )            &
+                                                                  * ddzu(k+1)  &
+                                                   )
+             ENDDO
+          ENDDO
+       ENDDO
 
-    USE kinds
+    END SUBROUTINE advec_w_pw
 
 
-    IMPLICIT NONE
+!------------------------------------------------------------------------------!
+! Call for grid point i,j
+!------------------------------------------------------------------------------!
+    SUBROUTINE advec_w_pw_ij( i, j )
 
-    INTEGER(iwp) ::  i !< grid index along x-direction
-    INTEGER(iwp) ::  j !< grid index along y-direction
-    INTEGER(iwp) ::  k !< grid index along z-direction
-    
-    REAL(wp)     ::  gu !< Galilei-transformation velocity along x
-    REAL(wp)     ::  gv !< Galilei-transformation velocity along y
+       USE arrays_3d
+       USE control_parameters
+       USE grid_variables
+       USE indices
+
+       IMPLICIT NONE
+
+       INTEGER ::  i, j, k
+       REAL    ::  gu, gv
 
 
-    gu = 2.0_wp * u_gtrans
-    gv = 2.0_wp * v_gtrans
-    DO  i = nxl, nxr
-       DO  j = nys, nyn
-          DO  k = nzb+1, nzt
-             tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                                               &
-                           ( w(k,j,i+1)   * ( u(k+1,j,i+1) + u(k,j,i+1) - gu )                     &
-                           - w(k,j,i-1)   * ( u(k+1,j,i)   + u(k,j,i) - gu ) ) * ddx               &
-                           + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv )                     &
-                           - w(k,j-1,i)   * ( v(k+1,j,i)   + v(k,j,i) - gv ) ) * ddy               &
-                           + ( w(k+1,j,i) * ( w(k+1,j,i)   + w(k,j,i) )                            &
-                           - w(k-1,j,i)   * ( w(k,j,i)     + w(k-1,j,i) ) )    * ddzu(k+1)         &
-                                                   )
-          ENDDO
+       gu = 2.0 * u_gtrans
+       gv = 2.0 * v_gtrans
+       DO  k = nzb_w_inner(j,i)+1, nzt
+          tend(k,j,i) = tend(k,j,i) - 0.25 * (                              &
+                         ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu )     &
+                         - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx &
+                       + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv )     &
+                         - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy &
+                       + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) )              &
+                         - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) )            &
+                                                                  * ddzu(k+1)  &
+                                                )
        ENDDO
-    ENDDO
 
- END SUBROUTINE advec_w_pw
-
-
-!--------------------------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for grid point i,j
-!--------------------------------------------------------------------------------------------------!
- SUBROUTINE advec_w_pw_ij( i, j )
-
-    USE arrays_3d,                                                                                 &
-        ONLY:  ddzu, tend, u, v, w
-
-    USE control_parameters,                                                                        &
-        ONLY:  u_gtrans, v_gtrans
-
-    USE grid_variables,                                                                            &
-        ONLY:  ddx, ddy
-
-    USE indices,                                                                                   &
-        ONLY:  nzb, nzt
-
-    USE kinds
-
-
-    IMPLICIT NONE
-
-    INTEGER(iwp) ::  i !< grid index along x-direction
-    INTEGER(iwp) ::  j !< grid index along y-direction
-    INTEGER(iwp) ::  k !< grid index along z-direction
-    
-    REAL(wp)     ::  gu !< Galilei-transformation velocity along x
-    REAL(wp)     ::  gv !< Galilei-transformation velocity along y
-
-    gu = 2.0_wp * u_gtrans
-    gv = 2.0_wp * v_gtrans
-    DO  k = nzb+1, nzt
-       tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                                                     &
-                      ( w(k,j,i+1)   * ( u(k+1,j,i+1) + u(k,j,i+1) - gu )                          &
-                      - w(k,j,i-1)   * ( u(k+1,j,i)   + u(k,j,i) - gu ) ) * ddx                    &
-                      + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv )                          &
-                      - w(k,j-1,i)   * ( v(k+1,j,i)   + v(k,j,i) - gv ) ) * ddy                    &
-                      + ( w(k+1,j,i) * ( w(k+1,j,i)   + w(k,j,i) )                                 &
-                      - w(k-1,j,i)   * ( w(k,j,i)     + w(k-1,j,i) ) )    * ddzu(k+1)              &
-                                             )
-    ENDDO
- END SUBROUTINE advec_w_pw_ij
+    END SUBROUTINE advec_w_pw_ij
 
  END MODULE advec_w_pw_mod
