1 | !> @file advec_v_up.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
6 | ! terms of the GNU General Public License as published by the Free Software |
---|
7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
8 | ! 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-2016 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: advec_v_up.f90 2001 2016-08-20 18:41:22Z raasch $ |
---|
27 | ! |
---|
28 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
29 | ! Forced header and separation lines into 80 columns |
---|
30 | ! |
---|
31 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
32 | ! Module renamed (removed _mod) |
---|
33 | ! |
---|
34 | ! |
---|
35 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
36 | ! Module renamed |
---|
37 | ! |
---|
38 | ! |
---|
39 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
40 | ! Code annotations made doxygen readable |
---|
41 | ! |
---|
42 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
43 | ! REAL constants provided with KIND-attribute |
---|
44 | ! |
---|
45 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
46 | ! ONLY-attribute added to USE-statements, |
---|
47 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
48 | ! kinds are defined in new module kinds, |
---|
49 | ! revision history before 2012 removed, |
---|
50 | ! comment fields (!:) to be used for variable explanations added to |
---|
51 | ! all variable declaration statements |
---|
52 | ! |
---|
53 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
54 | ! code put under GPL (PALM 3.9) |
---|
55 | ! |
---|
56 | ! Revision 1.1 1997/08/29 08:56:05 raasch |
---|
57 | ! Initial revision |
---|
58 | ! |
---|
59 | ! |
---|
60 | ! Description: |
---|
61 | ! ------------ |
---|
62 | !> Advection term for the v velocity-component using upstream scheme. |
---|
63 | !> NOTE: vertical advection at k=1 still has wrong grid spacing for w>0! |
---|
64 | !> The same problem occurs for all topography boundaries! |
---|
65 | !------------------------------------------------------------------------------! |
---|
66 | MODULE advec_v_up_mod |
---|
67 | |
---|
68 | |
---|
69 | PRIVATE |
---|
70 | PUBLIC advec_v_up |
---|
71 | |
---|
72 | INTERFACE advec_v_up |
---|
73 | MODULE PROCEDURE advec_v_up |
---|
74 | MODULE PROCEDURE advec_v_up_ij |
---|
75 | END INTERFACE advec_v_up |
---|
76 | |
---|
77 | CONTAINS |
---|
78 | |
---|
79 | |
---|
80 | !------------------------------------------------------------------------------! |
---|
81 | ! Description: |
---|
82 | ! ------------ |
---|
83 | !> Call for all grid points |
---|
84 | !------------------------------------------------------------------------------! |
---|
85 | SUBROUTINE advec_v_up |
---|
86 | |
---|
87 | USE arrays_3d, & |
---|
88 | ONLY: ddzu, tend, u, v, w |
---|
89 | |
---|
90 | USE control_parameters, & |
---|
91 | ONLY: u_gtrans, v_gtrans |
---|
92 | |
---|
93 | USE grid_variables, & |
---|
94 | ONLY: ddx, ddy |
---|
95 | |
---|
96 | USE indices, & |
---|
97 | ONLY: nxl, nxr, nyn, nysv, nzb_v_inner, nzt |
---|
98 | |
---|
99 | USE kinds |
---|
100 | |
---|
101 | |
---|
102 | IMPLICIT NONE |
---|
103 | |
---|
104 | INTEGER(iwp) :: i !< |
---|
105 | INTEGER(iwp) :: j !< |
---|
106 | INTEGER(iwp) :: k !< |
---|
107 | |
---|
108 | REAL(wp) :: ukomp !< |
---|
109 | REAL(wp) :: vkomp !< |
---|
110 | REAL(wp) :: wkomp !< |
---|
111 | |
---|
112 | |
---|
113 | DO i = nxl, nxr |
---|
114 | DO j = nysv, nyn |
---|
115 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
116 | ! |
---|
117 | !-- x-direction |
---|
118 | ukomp = 0.25_wp * ( u(k,j,i) + u(k,j-1,i) + & |
---|
119 | u(k,j,i+1) + u(k,j-1,i+1) ) - u_gtrans |
---|
120 | IF ( ukomp > 0.0_wp ) THEN |
---|
121 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
122 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
123 | ELSE |
---|
124 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
125 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
126 | ENDIF |
---|
127 | ! |
---|
128 | !-- y-direction |
---|
129 | vkomp = v(k,j,i) - v_gtrans |
---|
130 | IF ( vkomp > 0.0_wp ) THEN |
---|
131 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
132 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
133 | ELSE |
---|
134 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
135 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
136 | ENDIF |
---|
137 | ! |
---|
138 | !-- z-direction |
---|
139 | wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + & |
---|
140 | w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
141 | IF ( wkomp > 0.0_wp ) THEN |
---|
142 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
143 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
144 | ELSE |
---|
145 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
146 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
147 | ENDIF |
---|
148 | |
---|
149 | ENDDO |
---|
150 | ENDDO |
---|
151 | ENDDO |
---|
152 | |
---|
153 | END SUBROUTINE advec_v_up |
---|
154 | |
---|
155 | |
---|
156 | !------------------------------------------------------------------------------! |
---|
157 | ! Description: |
---|
158 | ! ------------ |
---|
159 | !> Call for grid point i,j |
---|
160 | !------------------------------------------------------------------------------! |
---|
161 | SUBROUTINE advec_v_up_ij( i, j ) |
---|
162 | |
---|
163 | USE arrays_3d, & |
---|
164 | ONLY: ddzu, tend, u, v, w |
---|
165 | |
---|
166 | USE control_parameters, & |
---|
167 | ONLY: u_gtrans, v_gtrans |
---|
168 | |
---|
169 | USE grid_variables, & |
---|
170 | ONLY: ddx, ddy |
---|
171 | |
---|
172 | USE indices, & |
---|
173 | ONLY: nzb_v_inner, nzt |
---|
174 | |
---|
175 | USE kinds |
---|
176 | |
---|
177 | |
---|
178 | IMPLICIT NONE |
---|
179 | |
---|
180 | INTEGER(iwp) :: i !< |
---|
181 | INTEGER(iwp) :: j !< |
---|
182 | INTEGER(iwp) :: k !< |
---|
183 | |
---|
184 | REAL(wp) :: ukomp !< |
---|
185 | REAL(wp) :: vkomp !< |
---|
186 | REAL(wp) :: wkomp !< |
---|
187 | |
---|
188 | |
---|
189 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
190 | ! |
---|
191 | !-- x-direction |
---|
192 | ukomp = 0.25_wp * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1) & |
---|
193 | ) - u_gtrans |
---|
194 | IF ( ukomp > 0.0_wp ) THEN |
---|
195 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
196 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
197 | ELSE |
---|
198 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
199 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
200 | ENDIF |
---|
201 | ! |
---|
202 | !-- y-direction |
---|
203 | vkomp = v(k,j,i) - v_gtrans |
---|
204 | IF ( vkomp > 0.0_wp ) THEN |
---|
205 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
206 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
207 | ELSE |
---|
208 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
209 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
210 | ENDIF |
---|
211 | ! |
---|
212 | !-- z-direction |
---|
213 | wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
214 | IF ( wkomp > 0.0_wp ) THEN |
---|
215 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
216 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
217 | ELSE |
---|
218 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
219 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
220 | ENDIF |
---|
221 | |
---|
222 | ENDDO |
---|
223 | |
---|
224 | END SUBROUTINE advec_v_up_ij |
---|
225 | |
---|
226 | END MODULE advec_v_up_mod |
---|