1 | !> @file advec_v_up.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
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-2019 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: advec_v_up.f90 4180 2019-08-21 14:37:54Z raasch $ |
---|
27 | ! variables documented |
---|
28 | ! |
---|
29 | ! |
---|
30 | ! Description: |
---|
31 | ! ------------ |
---|
32 | !> Advection term for the v velocity-component using upstream scheme. |
---|
33 | !> NOTE: vertical advection at k=1 still has wrong grid spacing for w>0! |
---|
34 | !> The same problem occurs for all topography boundaries! |
---|
35 | !------------------------------------------------------------------------------! |
---|
36 | MODULE advec_v_up_mod |
---|
37 | |
---|
38 | |
---|
39 | PRIVATE |
---|
40 | PUBLIC advec_v_up |
---|
41 | |
---|
42 | INTERFACE advec_v_up |
---|
43 | MODULE PROCEDURE advec_v_up |
---|
44 | MODULE PROCEDURE advec_v_up_ij |
---|
45 | END INTERFACE advec_v_up |
---|
46 | |
---|
47 | CONTAINS |
---|
48 | |
---|
49 | |
---|
50 | !------------------------------------------------------------------------------! |
---|
51 | ! Description: |
---|
52 | ! ------------ |
---|
53 | !> Call for all grid points |
---|
54 | !------------------------------------------------------------------------------! |
---|
55 | SUBROUTINE advec_v_up |
---|
56 | |
---|
57 | USE arrays_3d, & |
---|
58 | ONLY: ddzu, tend, u, v, w |
---|
59 | |
---|
60 | USE control_parameters, & |
---|
61 | ONLY: u_gtrans, v_gtrans |
---|
62 | |
---|
63 | USE grid_variables, & |
---|
64 | ONLY: ddx, ddy |
---|
65 | |
---|
66 | USE indices, & |
---|
67 | ONLY: nxl, nxr, nyn, nysv, nzb, nzt |
---|
68 | |
---|
69 | USE kinds |
---|
70 | |
---|
71 | |
---|
72 | IMPLICIT NONE |
---|
73 | |
---|
74 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
75 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
76 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
77 | |
---|
78 | REAL(wp) :: ukomp !< advection velocity along x-direction |
---|
79 | REAL(wp) :: vkomp !< advection velocity along y-direction |
---|
80 | REAL(wp) :: wkomp !< advection velocity along z-direction |
---|
81 | |
---|
82 | |
---|
83 | DO i = nxl, nxr |
---|
84 | DO j = nysv, nyn |
---|
85 | DO k = nzb+1, nzt |
---|
86 | ! |
---|
87 | !-- x-direction |
---|
88 | ukomp = 0.25_wp * ( u(k,j,i) + u(k,j-1,i) + & |
---|
89 | u(k,j,i+1) + u(k,j-1,i+1) ) - u_gtrans |
---|
90 | IF ( ukomp > 0.0_wp ) THEN |
---|
91 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
92 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
93 | ELSE |
---|
94 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
95 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
96 | ENDIF |
---|
97 | ! |
---|
98 | !-- y-direction |
---|
99 | vkomp = v(k,j,i) - v_gtrans |
---|
100 | IF ( vkomp > 0.0_wp ) THEN |
---|
101 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
102 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
103 | ELSE |
---|
104 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
105 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
106 | ENDIF |
---|
107 | ! |
---|
108 | !-- z-direction |
---|
109 | wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + & |
---|
110 | w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
111 | IF ( wkomp > 0.0_wp ) THEN |
---|
112 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
113 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
114 | ELSE |
---|
115 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
116 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
117 | ENDIF |
---|
118 | |
---|
119 | ENDDO |
---|
120 | ENDDO |
---|
121 | ENDDO |
---|
122 | |
---|
123 | END SUBROUTINE advec_v_up |
---|
124 | |
---|
125 | |
---|
126 | !------------------------------------------------------------------------------! |
---|
127 | ! Description: |
---|
128 | ! ------------ |
---|
129 | !> Call for grid point i,j |
---|
130 | !------------------------------------------------------------------------------! |
---|
131 | SUBROUTINE advec_v_up_ij( i, j ) |
---|
132 | |
---|
133 | USE arrays_3d, & |
---|
134 | ONLY: ddzu, tend, u, v, w |
---|
135 | |
---|
136 | USE control_parameters, & |
---|
137 | ONLY: u_gtrans, v_gtrans |
---|
138 | |
---|
139 | USE grid_variables, & |
---|
140 | ONLY: ddx, ddy |
---|
141 | |
---|
142 | USE indices, & |
---|
143 | ONLY: nzb, nzt |
---|
144 | |
---|
145 | USE kinds |
---|
146 | |
---|
147 | |
---|
148 | IMPLICIT NONE |
---|
149 | |
---|
150 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
151 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
152 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
153 | |
---|
154 | REAL(wp) :: ukomp !< advection velocity along x-direction |
---|
155 | REAL(wp) :: vkomp !< advection velocity along y-direction |
---|
156 | REAL(wp) :: wkomp !< advection velocity along z-direction |
---|
157 | |
---|
158 | |
---|
159 | DO k = nzb+1, nzt |
---|
160 | ! |
---|
161 | !-- x-direction |
---|
162 | ukomp = 0.25_wp * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1) & |
---|
163 | ) - u_gtrans |
---|
164 | IF ( ukomp > 0.0_wp ) THEN |
---|
165 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
166 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
167 | ELSE |
---|
168 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
169 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
170 | ENDIF |
---|
171 | ! |
---|
172 | !-- y-direction |
---|
173 | vkomp = v(k,j,i) - v_gtrans |
---|
174 | IF ( vkomp > 0.0_wp ) THEN |
---|
175 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
176 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
177 | ELSE |
---|
178 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
179 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
180 | ENDIF |
---|
181 | ! |
---|
182 | !-- z-direction |
---|
183 | wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
184 | IF ( wkomp > 0.0_wp ) THEN |
---|
185 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
186 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
187 | ELSE |
---|
188 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
189 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
190 | ENDIF |
---|
191 | |
---|
192 | ENDDO |
---|
193 | |
---|
194 | END SUBROUTINE advec_v_up_ij |
---|
195 | |
---|
196 | END MODULE advec_v_up_mod |
---|