source: palm/trunk/SOURCE/advec_u_pw.f90 @ 4598

Last change on this file since 4598 was 4488, checked in by raasch, 4 years ago

files re-formatted to follow the PALM coding standard

  • Property svn:keywords set to Id
File size: 5.9 KB
RevLine 
[1873]1!> @file advec_u_pw.f90
[4488]2!--------------------------------------------------------------------------------------------------!
[2696]3! This file is part of the PALM model system.
[1036]4!
[4488]5! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General
6! Public License as published by the Free Software Foundation, either version 3 of the License, or
7! (at your option) any later version.
[1036]8!
[4488]9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11! Public License for more details.
[1036]12!
[4488]13! You should have received a copy of the GNU General Public License along with PALM. If not, see
14! <http://www.gnu.org/licenses/>.
[1036]15!
[4360]16! Copyright 1997-2020 Leibniz Universitaet Hannover
[4488]17!--------------------------------------------------------------------------------------------------!
[1036]18!
[484]19! Current revisions:
[1]20! -----------------
[1354]21!
[2233]22!
[1321]23! Former revisions:
24! -----------------
25! $Id: advec_u_pw.f90 4488 2020-04-03 11:34:29Z suehring $
[4488]26! file re-formatted to follow the PALM coding standard
27!
28! 4360 2020-01-07 11:25:50Z suehring
[4182]29! Corrected "Former revisions" section
[4488]30!
[4182]31! 3655 2019-01-07 16:51:22Z knoop
[3547]32! variables documented
[1321]33!
[4182]34! Revision 1.1  1997/08/11 06:09:21  raasch
35! Initial revision
36!
37!
[1]38! Description:
39! ------------
[1682]40!> Advection term for u velocity-component using Piacsek and Williams.
[4488]41!> Vertical advection at the first grid point above the surface is done with normal centred
42!> differences, because otherwise no information from the surface would be communicated upwards due
43!> to w=0 at K=nzb.
44!--------------------------------------------------------------------------------------------------!
[1682]45 MODULE advec_u_pw_mod
[1]46
[4488]47
[1]48    PRIVATE
49    PUBLIC advec_u_pw
50
51    INTERFACE advec_u_pw
52       MODULE PROCEDURE advec_u_pw
53       MODULE PROCEDURE advec_u_pw_ij
54    END INTERFACE advec_u_pw
[4488]55
[1]56 CONTAINS
57
58
[4488]59!--------------------------------------------------------------------------------------------------!
[1682]60! Description:
61! ------------
62!> Call for all grid points
[4488]63!--------------------------------------------------------------------------------------------------!
64 SUBROUTINE advec_u_pw
[1]65
[4488]66    USE arrays_3d,                                                                                 &
67        ONLY:  ddzw, tend, u, v, w
[1]68
[4488]69    USE control_parameters,                                                                        &
70        ONLY:  u_gtrans, v_gtrans
[1320]71
[4488]72    USE grid_variables,                                                                            &
73        ONLY:  ddx, ddy
[1320]74
[4488]75    USE indices,                                                                                   &
76        ONLY:  nxlu, nxr, nyn, nys, nzb, nzt
[1320]77
[4488]78    USE kinds
[1320]79
80
[4488]81    IMPLICIT NONE
[1]82
[4488]83    INTEGER(iwp) ::  i !< grid index along x-direction
84    INTEGER(iwp) ::  j !< grid index along y-direction
85    INTEGER(iwp) ::  k !< grid index along z-direction
86
87    REAL(wp)     ::  gu !< Galilei-transformation velocity along x
88    REAL(wp)     ::  gv !< Galilei-transformation velocity along y
89
90    gu = 2.0_wp * u_gtrans
91    gv = 2.0_wp * v_gtrans
92    DO  i = nxlu, nxr
93       DO  j = nys, nyn
94          DO  k = nzb+1, nzt
95             tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                                               &
96                           ( u(k,j,i+1)   * ( u(k,j,i+1) + u(k,j,i) - gu )                         &
97                           - u(k,j,i-1)   * ( u(k,j,i)   + u(k,j,i-1) - gu ) ) * ddx               &
98                           + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv )                     &
99                           - u(k,j-1,i)   * ( v(k,j,i)   + v(k,j,i-1) - gv ) ) * ddy               &
100                           + ( u(k+1,j,i) * ( w(k,j,i)   + w(k,j,i-1) )                            &
101                           - u(k-1,j,i)   * ( w(k-1,j,i) + w(k-1,j,i-1) ) )    * ddzw(k)           &
102                                                   )
[1]103          ENDDO
104       ENDDO
[4488]105    ENDDO
[1]106
[4488]107 END SUBROUTINE advec_u_pw
[1]108
109
[4488]110!--------------------------------------------------------------------------------------------------!
[1682]111! Description:
112! ------------
113!> Call for grid point i,j
[4488]114!--------------------------------------------------------------------------------------------------!
115 SUBROUTINE advec_u_pw_ij( i, j )
[1]116
[4488]117    USE arrays_3d,                                                                                 &
118        ONLY:  ddzw, tend, u, v, w
[1]119
[4488]120    USE control_parameters,                                                                        &
121        ONLY:  u_gtrans, v_gtrans
[1320]122
[4488]123    USE grid_variables,                                                                            &
124        ONLY:  ddx, ddy
[1320]125
[4488]126    USE indices,                                                                                   &
127        ONLY:  nzb, nzt
[1320]128
[4488]129    USE kinds
[1320]130
131
[4488]132    IMPLICIT NONE
[1]133
[4488]134    INTEGER(iwp) ::  i !< grid index along x-direction
135    INTEGER(iwp) ::  j !< grid index along y-direction
136    INTEGER(iwp) ::  k !< grid index along z-direction
[1]137
[4488]138    REAL(wp)     ::  gu !< Galilei-transformation velocity along x
139    REAL(wp)     ::  gv !< Galilei-transformation velocity along y
[1]140
[4488]141    gu = 2.0_wp * u_gtrans
142    gv = 2.0_wp * v_gtrans
143    DO  k = nzb+1, nzt
144       tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                                                     &
145                     ( u(k,j,i+1)   * ( u(k,j,i+1) + u(k,j,i) - gu )                               &
146                     - u(k,j,i-1)   * ( u(k,j,i)   + u(k,j,i-1) - gu ) ) * ddx                     &
147                     + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv )                           &
148                     - u(k,j-1,i)   * ( v(k,j,i)   + v(k,j,i-1) - gv ) ) * ddy                     &
149                     + ( u(k+1,j,i) * ( w(k,j,i)   + w(k,j,i-1) )                                  &
150                     - u(k-1,j,i)   * ( w(k-1,j,i) + w(k-1,j,i-1) ) )    * ddzw(k)                 &
151                                             )
152    ENDDO
[1]153
[4488]154 END SUBROUTINE advec_u_pw_ij
155
[1]156 END MODULE advec_u_pw_mod
Note: See TracBrowser for help on using the repository browser.