1 | MODULE advec_v_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_v_up.f90 1321 2014-03-20 09:40:40Z suehring $ |
---|
27 | ! |
---|
28 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
29 | ! ONLY-attribute added to USE-statements, |
---|
30 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
31 | ! kinds are defined in new module kinds, |
---|
32 | ! revision history before 2012 removed, |
---|
33 | ! comment fields (!:) to be used for variable explanations added to |
---|
34 | ! all variable declaration statements |
---|
35 | ! |
---|
36 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
37 | ! code put under GPL (PALM 3.9) |
---|
38 | ! |
---|
39 | ! Revision 1.1 1997/08/29 08:56:05 raasch |
---|
40 | ! Initial revision |
---|
41 | ! |
---|
42 | ! |
---|
43 | ! Description: |
---|
44 | ! ------------ |
---|
45 | ! Advection term for the v velocity-component using upstream scheme. |
---|
46 | ! NOTE: vertical advection at k=1 still has wrong grid spacing for w>0! |
---|
47 | ! The same problem occurs for all topography boundaries! |
---|
48 | !------------------------------------------------------------------------------! |
---|
49 | |
---|
50 | PRIVATE |
---|
51 | PUBLIC advec_v_up |
---|
52 | |
---|
53 | INTERFACE advec_v_up |
---|
54 | MODULE PROCEDURE advec_v_up |
---|
55 | MODULE PROCEDURE advec_v_up_ij |
---|
56 | END INTERFACE advec_v_up |
---|
57 | |
---|
58 | CONTAINS |
---|
59 | |
---|
60 | |
---|
61 | !------------------------------------------------------------------------------! |
---|
62 | ! Call for all grid points |
---|
63 | !------------------------------------------------------------------------------! |
---|
64 | SUBROUTINE advec_v_up |
---|
65 | |
---|
66 | USE arrays_3d, & |
---|
67 | ONLY: ddzu, tend, u, v, w |
---|
68 | |
---|
69 | USE control_parameters, & |
---|
70 | ONLY: u_gtrans, v_gtrans |
---|
71 | |
---|
72 | USE grid_variables, & |
---|
73 | ONLY: ddx, ddy |
---|
74 | |
---|
75 | USE indices, & |
---|
76 | ONLY: nxl, nxr, nyn, nysv, nzb_v_inner, nzt |
---|
77 | |
---|
78 | USE kinds |
---|
79 | |
---|
80 | |
---|
81 | IMPLICIT NONE |
---|
82 | |
---|
83 | INTEGER(iwp) :: i !: |
---|
84 | INTEGER(iwp) :: j !: |
---|
85 | INTEGER(iwp) :: k !: |
---|
86 | |
---|
87 | REAL(wp) :: ukomp !: |
---|
88 | REAL(wp) :: vkomp !: |
---|
89 | REAL(wp) :: wkomp !: |
---|
90 | |
---|
91 | |
---|
92 | DO i = nxl, nxr |
---|
93 | DO j = nysv, nyn |
---|
94 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
95 | ! |
---|
96 | !-- x-direction |
---|
97 | ukomp = 0.25 * ( u(k,j,i) + u(k,j-1,i) + & |
---|
98 | u(k,j,i+1) + u(k,j-1,i+1) ) - u_gtrans |
---|
99 | IF ( ukomp > 0.0 ) THEN |
---|
100 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
101 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
102 | ELSE |
---|
103 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
104 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
105 | ENDIF |
---|
106 | ! |
---|
107 | !-- y-direction |
---|
108 | vkomp = v(k,j,i) - v_gtrans |
---|
109 | IF ( vkomp > 0.0 ) THEN |
---|
110 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
111 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
112 | ELSE |
---|
113 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
114 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
115 | ENDIF |
---|
116 | ! |
---|
117 | !-- z-direction |
---|
118 | wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + & |
---|
119 | w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
120 | IF ( wkomp > 0.0 ) THEN |
---|
121 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
122 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
123 | ELSE |
---|
124 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
125 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
126 | ENDIF |
---|
127 | |
---|
128 | ENDDO |
---|
129 | ENDDO |
---|
130 | ENDDO |
---|
131 | |
---|
132 | END SUBROUTINE advec_v_up |
---|
133 | |
---|
134 | |
---|
135 | !------------------------------------------------------------------------------! |
---|
136 | ! Call for grid point i,j |
---|
137 | !------------------------------------------------------------------------------! |
---|
138 | SUBROUTINE advec_v_up_ij( i, j ) |
---|
139 | |
---|
140 | USE arrays_3d, & |
---|
141 | ONLY: ddzu, tend, u, v, w |
---|
142 | |
---|
143 | USE control_parameters, & |
---|
144 | ONLY: u_gtrans, v_gtrans |
---|
145 | |
---|
146 | USE grid_variables, & |
---|
147 | ONLY: ddx, ddy |
---|
148 | |
---|
149 | USE indices, & |
---|
150 | ONLY: nzb_v_inner, nzt |
---|
151 | |
---|
152 | USE kinds |
---|
153 | |
---|
154 | |
---|
155 | IMPLICIT NONE |
---|
156 | |
---|
157 | INTEGER(iwp) :: i !: |
---|
158 | INTEGER(iwp) :: j !: |
---|
159 | INTEGER(iwp) :: k !: |
---|
160 | |
---|
161 | REAL(wp) :: ukomp !: |
---|
162 | REAL(wp) :: vkomp !: |
---|
163 | REAL(wp) :: wkomp !: |
---|
164 | |
---|
165 | |
---|
166 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
167 | ! |
---|
168 | !-- x-direction |
---|
169 | ukomp = 0.25 * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1) & |
---|
170 | ) - u_gtrans |
---|
171 | IF ( ukomp > 0.0 ) THEN |
---|
172 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
173 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
174 | ELSE |
---|
175 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
176 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
177 | ENDIF |
---|
178 | ! |
---|
179 | !-- y-direction |
---|
180 | vkomp = v(k,j,i) - v_gtrans |
---|
181 | IF ( vkomp > 0.0 ) THEN |
---|
182 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
183 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
184 | ELSE |
---|
185 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
186 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
187 | ENDIF |
---|
188 | ! |
---|
189 | !-- z-direction |
---|
190 | wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
191 | IF ( wkomp > 0.0 ) THEN |
---|
192 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
193 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
194 | ELSE |
---|
195 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
196 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
197 | ENDIF |
---|
198 | |
---|
199 | ENDDO |
---|
200 | |
---|
201 | END SUBROUTINE advec_v_up_ij |
---|
202 | |
---|
203 | END MODULE advec_v_up_mod |
---|