1 | MODULE advec_u_up_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-2014 Leibniz Universitaet Hannover |
---|
18 | !--------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: advec_u_up.f90 1310 2014-03-14 08:01:56Z suehring $ |
---|
27 | ! |
---|
28 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
29 | ! code put under GPL (PALM 3.9) |
---|
30 | ! |
---|
31 | ! 106 2007-08-16 14:30:26Z raasch |
---|
32 | ! i loop is starting from nxlu (needed for non-cyclic boundary conditions) |
---|
33 | ! |
---|
34 | ! 75 2007-03-22 09:54:05Z raasch |
---|
35 | ! uxrp eliminated |
---|
36 | ! |
---|
37 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
38 | ! |
---|
39 | ! Revision 1.12 2006/02/23 09:45:04 raasch |
---|
40 | ! nzb_2d replaced by nzb_u_inner |
---|
41 | ! |
---|
42 | ! Revision 1.1 1997/08/29 08:55:25 raasch |
---|
43 | ! Initial revision |
---|
44 | ! |
---|
45 | ! |
---|
46 | ! Description: |
---|
47 | ! ------------ |
---|
48 | ! Advection term for the u velocity-component using upstream scheme. |
---|
49 | ! NOTE: vertical advection at k=1 still has wrong grid spacing for w>0! |
---|
50 | ! The same problem occurs for all topography boundaries! |
---|
51 | !------------------------------------------------------------------------------! |
---|
52 | |
---|
53 | PRIVATE |
---|
54 | PUBLIC advec_u_up |
---|
55 | |
---|
56 | INTERFACE advec_u_up |
---|
57 | MODULE PROCEDURE advec_u_up |
---|
58 | MODULE PROCEDURE advec_u_up_ij |
---|
59 | END INTERFACE advec_u_up |
---|
60 | |
---|
61 | CONTAINS |
---|
62 | |
---|
63 | |
---|
64 | !------------------------------------------------------------------------------! |
---|
65 | ! Call for all grid points |
---|
66 | !------------------------------------------------------------------------------! |
---|
67 | SUBROUTINE advec_u_up |
---|
68 | |
---|
69 | USE arrays_3d |
---|
70 | USE control_parameters |
---|
71 | USE grid_variables |
---|
72 | USE indices |
---|
73 | |
---|
74 | IMPLICIT NONE |
---|
75 | |
---|
76 | INTEGER :: i, j, k |
---|
77 | |
---|
78 | REAL :: ukomp, vkomp, wkomp |
---|
79 | |
---|
80 | |
---|
81 | DO i = nxlu, nxr |
---|
82 | DO j = nys, nyn |
---|
83 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
84 | ! |
---|
85 | !-- x-direction |
---|
86 | ukomp = u(k,j,i) - u_gtrans |
---|
87 | IF ( ukomp > 0.0 ) THEN |
---|
88 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
89 | ( u(k,j,i) - u(k,j,i-1) ) * ddx |
---|
90 | ELSE |
---|
91 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
92 | ( u(k,j,i+1) - u(k,j,i) ) * ddx |
---|
93 | ENDIF |
---|
94 | ! |
---|
95 | !-- y-direction |
---|
96 | vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + & |
---|
97 | v(k,j,i-1) + v(k,j+1,i-1) ) - v_gtrans |
---|
98 | IF ( vkomp > 0.0 ) THEN |
---|
99 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
100 | ( u(k,j,i) - u(k,j-1,i) ) * ddy |
---|
101 | ELSE |
---|
102 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
103 | ( u(k,j+1,i) - u(k,j,i) ) * ddy |
---|
104 | ENDIF |
---|
105 | ! |
---|
106 | !-- z-direction |
---|
107 | wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + & |
---|
108 | w(k,j,i-1) + w(k-1,j,i-1) ) |
---|
109 | IF ( wkomp > 0.0 ) THEN |
---|
110 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
111 | ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k) |
---|
112 | ELSE |
---|
113 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
114 | ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) |
---|
115 | ENDIF |
---|
116 | |
---|
117 | ENDDO |
---|
118 | ENDDO |
---|
119 | ENDDO |
---|
120 | |
---|
121 | END SUBROUTINE advec_u_up |
---|
122 | |
---|
123 | |
---|
124 | !------------------------------------------------------------------------------! |
---|
125 | ! Call for grid point i,j |
---|
126 | !------------------------------------------------------------------------------! |
---|
127 | SUBROUTINE advec_u_up_ij( i, j ) |
---|
128 | |
---|
129 | USE arrays_3d |
---|
130 | USE control_parameters |
---|
131 | USE grid_variables |
---|
132 | USE indices |
---|
133 | |
---|
134 | IMPLICIT NONE |
---|
135 | |
---|
136 | INTEGER :: i, j, k |
---|
137 | |
---|
138 | REAL :: ukomp, vkomp, wkomp |
---|
139 | |
---|
140 | |
---|
141 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
142 | ! |
---|
143 | !-- x-direction |
---|
144 | ukomp = u(k,j,i) - u_gtrans |
---|
145 | IF ( ukomp > 0.0 ) THEN |
---|
146 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
147 | ( u(k,j,i) - u(k,j,i-1) ) * ddx |
---|
148 | ELSE |
---|
149 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
150 | ( u(k,j,i+1) - u(k,j,i) ) * ddx |
---|
151 | ENDIF |
---|
152 | ! |
---|
153 | !-- y-direction |
---|
154 | vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + v(k,j,i-1) + v(k,j+1,i-1) & |
---|
155 | ) - v_gtrans |
---|
156 | IF ( vkomp > 0.0 ) THEN |
---|
157 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
158 | ( u(k,j,i) - u(k,j-1,i) ) * ddy |
---|
159 | ELSE |
---|
160 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
161 | ( u(k,j+1,i) - u(k,j,i) ) * ddy |
---|
162 | ENDIF |
---|
163 | ! |
---|
164 | !-- z-direction |
---|
165 | wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + w(k,j,i-1) + w(k-1,j,i-1) ) |
---|
166 | IF ( wkomp > 0.0 ) THEN |
---|
167 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
168 | ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k) |
---|
169 | ELSE |
---|
170 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
171 | ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) |
---|
172 | ENDIF |
---|
173 | |
---|
174 | ENDDO |
---|
175 | |
---|
176 | END SUBROUTINE advec_u_up_ij |
---|
177 | |
---|
178 | END MODULE advec_u_up_mod |
---|