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