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

Last change on this file since 1036 was 1036, checked in by raasch, 9 years ago

code has been put under the GNU General Public License (v3)

  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1 MODULE advec_u_pw_mod
2
3!--------------------------------------------------------------------------------!
4! This file is part of PALM.
5!
6! PALM is free software: you can redistribute it and/or modify it under the terms
7! of the GNU General Public License as published by the Free Software Foundation,
8! either version 3 of the License, or (at your option) any later version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 1997-2012  Leibniz University Hannover
18!--------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: advec_u_pw.f90 1036 2012-10-22 13:43:42Z raasch $
27!
28! 106 2007-08-16 14:30:26Z raasch
29! i loop is starting from nxlu (needed for non-cyclic boundary conditions)
30!
31! 75 2007-03-22 09:54:05Z raasch
32! uxrp eliminated
33!
34! RCS Log replace by Id keyword, revision history cleaned up
35!
36! Revision 1.15  2006/02/23 09:44:21  raasch
37! nzb_2d replaced by nzb_u_inner
38!
39! Revision 1.1  1997/08/11 06:09:21  raasch
40! Initial revision
41!
42!
43! Description:
44! ------------
45! Advection term for u velocity-component using Piacsek and Williams.
46! Vertical advection at the first grid point above the surface is done with
47! normal centred differences, because otherwise no information from the surface
48! would be communicated upwards due to w=0 at K=nzb.
49!------------------------------------------------------------------------------!
50
51    PRIVATE
52    PUBLIC advec_u_pw
53
54    INTERFACE advec_u_pw
55       MODULE PROCEDURE advec_u_pw
56       MODULE PROCEDURE advec_u_pw_ij
57    END INTERFACE advec_u_pw
58 
59 CONTAINS
60
61
62!------------------------------------------------------------------------------!
63! Call for all grid points
64!------------------------------------------------------------------------------!
65    SUBROUTINE advec_u_pw
66
67       USE arrays_3d
68       USE control_parameters
69       USE grid_variables
70       USE indices
71
72       IMPLICIT NONE
73
74       INTEGER ::  i, j, k
75       REAL    ::  gu, gv
76 
77       gu = 2.0 * u_gtrans
78       gv = 2.0 * v_gtrans
79       DO  i = nxlu, nxr
80          DO  j = nys, nyn
81             DO  k = nzb_u_inner(j,i)+1, nzt
82                tend(k,j,i) = tend(k,j,i) - 0.25 * (                           &
83                         ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu )         &
84                         - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx &
85                       + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv )     &
86                         - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy &
87                       + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) )              &
88                         - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) )        &
89                                                                  * ddzw(k)    &
90                                                   )
91             ENDDO
92          ENDDO
93       ENDDO
94
95    END SUBROUTINE advec_u_pw
96
97
98!------------------------------------------------------------------------------!
99! Call for grid point i,j
100!------------------------------------------------------------------------------!
101    SUBROUTINE advec_u_pw_ij( i, j )
102
103       USE arrays_3d
104       USE control_parameters
105       USE grid_variables
106       USE indices
107
108       IMPLICIT NONE
109
110       INTEGER ::  i, j, k
111       REAL    ::  gu, gv
112
113       gu = 2.0 * u_gtrans
114       gv = 2.0 * v_gtrans
115       DO  k = nzb_u_inner(j,i)+1, nzt
116          tend(k,j,i) = tend(k,j,i) - 0.25 * (                                 &
117                         ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu )         &
118                         - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx &
119                       + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv )     &
120                         - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy &
121                       + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) )              &
122                         - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) )        &
123                                                                  * ddzw(k)    &
124                                             )
125       ENDDO
126
127    END SUBROUTINE advec_u_pw_ij
128
129 END MODULE advec_u_pw_mod
Note: See TracBrowser for help on using the repository browser.