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