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