Index: palm/trunk/SOURCE/advec_v_up.f90
===================================================================
--- palm/trunk/SOURCE/advec_v_up.f90	(revision 4901)
+++ palm/trunk/SOURCE/advec_v_up.f90	(revision 1)
@@ -1,34 +1,47 @@
-!> @file advec_v_up.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_v_up_mod
+
+!------------------------------------------------------------------------------!
+! Actual revisions:
 ! -----------------
 ! 
-! 
+!
 ! Former revisions:
 ! -----------------
-! $Id$
-! file re-formatted to follow the PALM coding standard
+! $Log: advec_v_up.f90,v $
+! Revision 1.12  2006/02/23 09:46:37  raasch
+! nzb_2d replaced by nzb_v_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.11  2005/03/26 14:55:59  raasch
+! Extension of horizontal loop upper bounds for non-cyclic boundary conditions
+!
+! Revision 1.10  2004/01/30 10:12:45  raasch
+! Scalar lower k index nzb replaced by 2d-array nzb_2d
+!
+! Revision 1.9  2003/03/12 16:19:00  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.8  2002/06/11 12:26:48  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.7  2001/03/29 17:36:22  raasch
+! Translation of remaining German identifiers (variables, subroutines, etc.)
+!
+! Revision 1.6  2001/01/22 05:16:19  raasch
+! Module test_variables removed
+!
+! Revision 1.5  2000/01/20 10:20:31  letzel
+! All comments translated into English
+!
+! Revision 1.4  1998/07/06 12:05:37  raasch
+! + USE test_variables
+!
+! Revision 1.3  1998/04/21 15:53:36  raasch
+! Galilei-Transformation eingebaut
+!
+! Revision 1.2  1997/09/09 08:28:21  raasch
+! Kehrwerte der Gitterweiten implementiert
 !
 ! Revision 1.1  1997/08/29 08:56:05  raasch
@@ -38,10 +51,8 @@
 ! Description:
 ! ------------
-!> Advection term for the v velocity-component using upstream scheme.
-!> NOTE: vertical advection at k=1 still has wrong grid spacing for w>0!
-!>       The same problem occurs for all topography boundaries!
-!--------------------------------------------------------------------------------------------------!
- MODULE advec_v_up_mod
- 
+! Advection term for the v velocity-component using upstream scheme.
+! NOTE: vertical advection at k=1 still has wrong grid spacing for w>0!
+!       The same problem occurs for all topography boundaries!
+!------------------------------------------------------------------------------!
 
     PRIVATE
@@ -56,134 +67,116 @@
 
 
-!--------------------------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for all grid points
-!--------------------------------------------------------------------------------------------------!
- SUBROUTINE advec_v_up
+!------------------------------------------------------------------------------!
+! Call for all grid points
+!------------------------------------------------------------------------------!
+    SUBROUTINE advec_v_up
 
-    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
-
-    USE indices,                                                                                   &
-        ONLY:  nxl, nxr, nyn, nysv, nzb, nzt
-
-    USE kinds
+       INTEGER ::  i, j, k
+       REAL    ::  ukomp, vkomp, wkomp
 
 
-    IMPLICIT NONE
+       DO  i = nxl, nxr
+          DO  j = nys, nyn+vynp
+             DO  k = nzb_v_inner(j,i)+1, nzt
+!
+!--             x-direction
+                ukomp = 0.25 * ( u(k,j,i)   + u(k,j-1,i) + &
+                                 u(k,j,i+1) + u(k,j-1,i+1) ) - u_gtrans
+                IF ( ukomp > 0.0 )  THEN
+                   tend(k,j,i) = tend(k,j,i) - ukomp * &
+                                         ( v(k,j,i) - v(k,j,i-1) ) * ddx
+                ELSE
+                   tend(k,j,i) = tend(k,j,i) - ukomp * &
+                                         ( v(k,j,i+1) - v(k,j,i) ) * ddx
+                ENDIF
+!
+!--             y-direction
+                vkomp = v(k,j,i) - v_gtrans
+                IF ( vkomp > 0.0 )  THEN
+                   tend(k,j,i) = tend(k,j,i) - vkomp * &
+                                         ( v(k,j,i) - v(k,j-1,i) ) * ddy
+                ELSE
+                   tend(k,j,i) = tend(k,j,i) - vkomp * &
+                                         ( v(k,j+1,i) - v(k,j,i) ) * ddy
+                ENDIF
+!
+!--             z-direction
+                wkomp = 0.25 * ( w(k,j,i)  + w(k-1,j,i) + &
+                                 w(k,j-1,i) + w(k-1,j-1,i) )
+                IF ( wkomp > 0.0 )  THEN
+                   tend(k,j,i) = tend(k,j,i) - wkomp * &
+                                         ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)
+                ELSE
+                   tend(k,j,i) = tend(k,j,i) - wkomp * &
+                                         ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)
+                ENDIF
 
-    INTEGER(iwp) ::  i !< grid index along x-direction
-    INTEGER(iwp) ::  j !< grid index along y-direction
-    INTEGER(iwp) ::  k !< grid index along z-direction
+             ENDDO
+          ENDDO
+       ENDDO
 
-    REAL(wp) ::  ukomp !< advection velocity along x-direction 
-    REAL(wp) ::  vkomp !< advection velocity along y-direction 
-    REAL(wp) ::  wkomp !< advection velocity along z-direction       
+    END SUBROUTINE advec_v_up
 
 
-    DO  i = nxl, nxr
-       DO  j = nysv, nyn
-          DO  k = nzb+1, nzt
-!
-!--          x-direction
-             ukomp = 0.25_wp * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1) ) - u_gtrans
-             IF ( ukomp > 0.0_wp )  THEN
-                tend(k,j,i) = tend(k,j,i) - ukomp * ( v(k,j,i) - v(k,j,i-1) ) * ddx
-             ELSE
-                tend(k,j,i) = tend(k,j,i) - ukomp * ( v(k,j,i+1) - v(k,j,i) ) * ddx
-             ENDIF
-!
-!--          y-direction
-             vkomp = v(k,j,i) - v_gtrans
-             IF ( vkomp > 0.0_wp )  THEN
-                tend(k,j,i) = tend(k,j,i) - vkomp * ( v(k,j,i) - v(k,j-1,i) ) * ddy
-             ELSE
-                tend(k,j,i) = tend(k,j,i) - vkomp * ( v(k,j+1,i) - v(k,j,i) ) * ddy
-             ENDIF
-!
-!--          z-direction
-             wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) )
-             IF ( wkomp > 0.0_wp )  THEN
-                tend(k,j,i) = tend(k,j,i) - wkomp * ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)
-             ELSE
-                tend(k,j,i) = tend(k,j,i) - wkomp * ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)
-             ENDIF
+!------------------------------------------------------------------------------!
+! Call for grid point i,j
+!------------------------------------------------------------------------------!
+    SUBROUTINE advec_v_up_ij( i, j )
 
-          ENDDO
-       ENDDO
-    ENDDO
+       USE arrays_3d
+       USE control_parameters
+       USE grid_variables
+       USE indices
 
- END SUBROUTINE advec_v_up
+       IMPLICIT NONE
+
+       INTEGER ::  i, j, k
+
+       REAL ::  ukomp, vkomp, wkomp
 
 
-!--------------------------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for grid point i,j
-!--------------------------------------------------------------------------------------------------!
- SUBROUTINE advec_v_up_ij( i, j )
+       DO  k = nzb_v_inner(j,i)+1, nzt
+!
+!--       x-direction
+          ukomp = 0.25 * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1) &
+                         ) - u_gtrans
+          IF ( ukomp > 0.0 )  THEN
+             tend(k,j,i) = tend(k,j,i) - ukomp * &
+                                         ( v(k,j,i) - v(k,j,i-1) ) * ddx
+          ELSE
+             tend(k,j,i) = tend(k,j,i) - ukomp * &
+                                         ( v(k,j,i+1) - v(k,j,i) ) * ddx
+          ENDIF
+!
+!--       y-direction
+          vkomp = v(k,j,i) - v_gtrans
+          IF ( vkomp > 0.0 )  THEN
+             tend(k,j,i) = tend(k,j,i) - vkomp * &
+                                         ( v(k,j,i) - v(k,j-1,i) ) * ddy
+          ELSE
+             tend(k,j,i) = tend(k,j,i) - vkomp * &
+                                         ( v(k,j+1,i) - v(k,j,i) ) * ddy
+          ENDIF
+!
+!--       z-direction
+          wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) )
+          IF ( wkomp > 0.0 )  THEN
+             tend(k,j,i) = tend(k,j,i) - wkomp * &
+                                         ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)
+          ELSE
+             tend(k,j,i) = tend(k,j,i) - wkomp * &
+                                         ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)
+          ENDIF
 
-    USE arrays_3d,                                                                                 &
-        ONLY:  ddzu, tend, u, v, w
+       ENDDO
 
-    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) ::  ukomp !< advection velocity along x-direction 
-    REAL(wp) ::  vkomp !< advection velocity along y-direction 
-    REAL(wp) ::  wkomp !< advection velocity along z-direction 
-
-
-    DO  k = nzb+1, nzt
-!
-!--    x-direction
-       ukomp = 0.25_wp * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1) ) - u_gtrans
-       IF ( ukomp > 0.0_wp )  THEN
-          tend(k,j,i) = tend(k,j,i) - ukomp * ( v(k,j,i) - v(k,j,i-1) ) * ddx
-       ELSE
-          tend(k,j,i) = tend(k,j,i) - ukomp * ( v(k,j,i+1) - v(k,j,i) ) * ddx
-       ENDIF
-!
-!--    y-direction
-       vkomp = v(k,j,i) - v_gtrans
-       IF ( vkomp > 0.0_wp )  THEN
-          tend(k,j,i) = tend(k,j,i) - vkomp * ( v(k,j,i) - v(k,j-1,i) ) * ddy
-       ELSE
-          tend(k,j,i) = tend(k,j,i) - vkomp * ( v(k,j+1,i) - v(k,j,i) ) * ddy
-       ENDIF
-!
-!--    z-direction
-       wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) )
-       IF ( wkomp > 0.0_wp )  THEN
-          tend(k,j,i) = tend(k,j,i) - wkomp * ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)
-       ELSE
-          tend(k,j,i) = tend(k,j,i) - wkomp * ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)
-       ENDIF
-
-    ENDDO
-
- END SUBROUTINE advec_v_up_ij
+    END SUBROUTINE advec_v_up_ij
 
  END MODULE advec_v_up_mod
