1 | !> @file advec_w_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_w_up.f90 4182 2019-08-22 15:20:23Z suehring $ |
---|
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:33 raasch |
---|
33 | ! Initial revision |
---|
34 | ! |
---|
35 | ! |
---|
36 | ! Description: |
---|
37 | ! ------------ |
---|
38 | !> Advection term for the w 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_w_up_mod |
---|
43 | |
---|
44 | |
---|
45 | PRIVATE |
---|
46 | PUBLIC advec_w_up |
---|
47 | |
---|
48 | INTERFACE advec_w_up |
---|
49 | MODULE PROCEDURE advec_w_up |
---|
50 | MODULE PROCEDURE advec_w_up_ij |
---|
51 | END INTERFACE advec_w_up |
---|
52 | |
---|
53 | CONTAINS |
---|
54 | |
---|
55 | |
---|
56 | !------------------------------------------------------------------------------! |
---|
57 | ! Description: |
---|
58 | ! ------------ |
---|
59 | !> Call for all grid points |
---|
60 | !------------------------------------------------------------------------------! |
---|
61 | SUBROUTINE advec_w_up |
---|
62 | |
---|
63 | USE arrays_3d, & |
---|
64 | ONLY: ddzw, 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, nys, 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 | |
---|
87 | |
---|
88 | DO i = nxl, nxr |
---|
89 | DO j = nys, nyn |
---|
90 | DO k = nzb+1, nzt-1 |
---|
91 | ! |
---|
92 | !-- x-direction |
---|
93 | ukomp = 0.25_wp * ( u(k,j,i) + u(k,j,i+1) + & |
---|
94 | u(k+1,j,i) + u(k+1,j,i+1) ) - u_gtrans |
---|
95 | IF ( ukomp > 0.0_wp ) THEN |
---|
96 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
97 | ( w(k,j,i) - w(k,j,i-1) ) * ddx |
---|
98 | ELSE |
---|
99 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
100 | ( w(k,j,i+1) - w(k,j,i) ) * ddx |
---|
101 | ENDIF |
---|
102 | ! |
---|
103 | !-- y-direction |
---|
104 | vkomp = 0.25_wp * ( v(k,j,i) + v(k,j+1,i) + & |
---|
105 | v(k+1,j,i) + v(k+1,j+1,i) ) - v_gtrans |
---|
106 | IF ( vkomp > 0.0_wp ) THEN |
---|
107 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
108 | ( w(k,j,i) - w(k,j-1,i) ) * ddy |
---|
109 | ELSE |
---|
110 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
111 | ( w(k,j+1,i) - w(k,j,i) ) * ddy |
---|
112 | ENDIF |
---|
113 | ! |
---|
114 | !-- z-direction |
---|
115 | IF ( w(k,j,i) > 0.0_wp ) THEN |
---|
116 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
117 | ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k) |
---|
118 | ELSE |
---|
119 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
120 | ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) |
---|
121 | ENDIF |
---|
122 | |
---|
123 | ENDDO |
---|
124 | ENDDO |
---|
125 | ENDDO |
---|
126 | |
---|
127 | END SUBROUTINE advec_w_up |
---|
128 | |
---|
129 | |
---|
130 | !------------------------------------------------------------------------------! |
---|
131 | ! Description: |
---|
132 | ! ------------ |
---|
133 | !> Call for grid point i,j |
---|
134 | !------------------------------------------------------------------------------! |
---|
135 | SUBROUTINE advec_w_up_ij( i, j ) |
---|
136 | |
---|
137 | USE arrays_3d, & |
---|
138 | ONLY: ddzw, tend, u, v, w |
---|
139 | |
---|
140 | USE control_parameters, & |
---|
141 | ONLY: u_gtrans, v_gtrans |
---|
142 | |
---|
143 | USE grid_variables, & |
---|
144 | ONLY: ddx, ddy |
---|
145 | |
---|
146 | USE indices, & |
---|
147 | ONLY: nzb, nzt |
---|
148 | |
---|
149 | USE kinds |
---|
150 | |
---|
151 | |
---|
152 | IMPLICIT NONE |
---|
153 | |
---|
154 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
155 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
156 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
157 | |
---|
158 | REAL(wp) :: ukomp !< advection velocity along x-direction |
---|
159 | REAL(wp) :: vkomp !< advection velocity along y-direction |
---|
160 | |
---|
161 | |
---|
162 | DO k = nzb+1, nzt-1 |
---|
163 | ! |
---|
164 | !-- x-direction |
---|
165 | ukomp = 0.25_wp * ( u(k,j,i) + u(k,j,i+1) + u(k+1,j,i) + u(k+1,j,i+1) & |
---|
166 | ) - u_gtrans |
---|
167 | IF ( ukomp > 0.0_wp ) THEN |
---|
168 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
169 | ( w(k,j,i) - w(k,j,i-1) ) * ddx |
---|
170 | ELSE |
---|
171 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
172 | ( w(k,j,i+1) - w(k,j,i) ) * ddx |
---|
173 | ENDIF |
---|
174 | ! |
---|
175 | !-- y-direction |
---|
176 | vkomp = 0.25_wp * ( v(k,j,i) + v(k,j+1,i) + v(k+1,j,i) + v(k+1,j+1,i) & |
---|
177 | ) - v_gtrans |
---|
178 | IF ( vkomp > 0.0_wp ) THEN |
---|
179 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
180 | ( w(k,j,i) - w(k,j-1,i) ) * ddy |
---|
181 | ELSE |
---|
182 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
183 | ( w(k,j+1,i) - w(k,j,i) ) * ddy |
---|
184 | ENDIF |
---|
185 | ! |
---|
186 | !-- z-direction |
---|
187 | IF ( w(k,j,i) > 0.0_wp ) THEN |
---|
188 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
189 | ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k) |
---|
190 | ELSE |
---|
191 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
192 | ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) |
---|
193 | ENDIF |
---|
194 | |
---|
195 | ENDDO |
---|
196 | |
---|
197 | END SUBROUTINE advec_w_up_ij |
---|
198 | |
---|
199 | END MODULE advec_w_up_mod |
---|