1 | !> @file coriolis.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-2018 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: coriolis.f90 3538 2018-11-20 10:55:41Z sward $ |
---|
27 | ! Note concerning topography masking added |
---|
28 | ! |
---|
29 | ! 3241 2018-09-12 15:02:00Z raasch |
---|
30 | ! unused variables removed |
---|
31 | ! |
---|
32 | ! 3183 2018-07-27 14:25:55Z suehring |
---|
33 | ! Remove masking of geostrophic wind forcing in offline nesting case |
---|
34 | ! |
---|
35 | ! 3182 2018-07-27 13:36:03Z suehring |
---|
36 | ! Corrected "Former revisions" section |
---|
37 | ! |
---|
38 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
39 | ! Change in file header (GPL part) |
---|
40 | ! Forcing implemented, preliminary (MS) |
---|
41 | ! |
---|
42 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
43 | ! |
---|
44 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
45 | ! Adjustments to new topography concept |
---|
46 | ! |
---|
47 | ! 2118 2017-01-17 16:38:49Z raasch |
---|
48 | ! OpenACC version of subroutine removed |
---|
49 | ! |
---|
50 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
51 | ! Forced header and separation lines into 80 columns |
---|
52 | ! |
---|
53 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
54 | ! Module renamed (removed _mod) |
---|
55 | ! |
---|
56 | ! |
---|
57 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
58 | ! Module renamed |
---|
59 | ! |
---|
60 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
61 | ! Code annotations made doxygen readable |
---|
62 | ! |
---|
63 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
64 | ! REAL constants provided with KIND-attribute |
---|
65 | ! |
---|
66 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
67 | ! ONLY-attribute added to USE-statements, |
---|
68 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
69 | ! kinds are defined in new module kinds, |
---|
70 | ! revision history before 2012 removed, |
---|
71 | ! comment fields (!:) to be used for variable explanations added to |
---|
72 | ! all variable declaration statements |
---|
73 | ! |
---|
74 | ! 1257 2013-11-08 15:18:40Z raasch |
---|
75 | ! openacc loop and loop vector clauses removed |
---|
76 | ! |
---|
77 | ! 1128 2013-04-12 06:19:32Z raasch |
---|
78 | ! loop index bounds in accelerator version replaced by i_left, i_right, j_south, |
---|
79 | ! j_north |
---|
80 | ! |
---|
81 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
82 | ! code put under GPL (PALM 3.9) |
---|
83 | ! |
---|
84 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
85 | ! accelerator version (*_acc) added |
---|
86 | ! |
---|
87 | ! Revision 1.1 1997/08/29 08:57:38 raasch |
---|
88 | ! Initial revision |
---|
89 | ! |
---|
90 | ! |
---|
91 | ! Description: |
---|
92 | ! ------------ |
---|
93 | !> Computation of all Coriolis terms in the equations of motion. |
---|
94 | !> |
---|
95 | !> @note In this routine the topography is masked, even though this |
---|
96 | !> is again done in prognostic_equations. However, omitting the masking |
---|
97 | !> here lead to slightly different results. Reason unknown. |
---|
98 | !------------------------------------------------------------------------------! |
---|
99 | MODULE coriolis_mod |
---|
100 | |
---|
101 | |
---|
102 | PRIVATE |
---|
103 | PUBLIC coriolis |
---|
104 | |
---|
105 | INTERFACE coriolis |
---|
106 | MODULE PROCEDURE coriolis |
---|
107 | MODULE PROCEDURE coriolis_ij |
---|
108 | END INTERFACE coriolis |
---|
109 | |
---|
110 | CONTAINS |
---|
111 | |
---|
112 | |
---|
113 | !------------------------------------------------------------------------------! |
---|
114 | ! Description: |
---|
115 | ! ------------ |
---|
116 | !> Call for all grid points |
---|
117 | !------------------------------------------------------------------------------! |
---|
118 | SUBROUTINE coriolis( component ) |
---|
119 | |
---|
120 | USE arrays_3d, & |
---|
121 | ONLY: tend, u, ug, v, vg, w |
---|
122 | |
---|
123 | USE control_parameters, & |
---|
124 | ONLY: f, fs, message_string |
---|
125 | |
---|
126 | USE indices, & |
---|
127 | ONLY: nxl, nxlu, nxr, nyn, nys, nysv, nzb, nzt, wall_flags_0 |
---|
128 | |
---|
129 | USE kinds |
---|
130 | |
---|
131 | IMPLICIT NONE |
---|
132 | |
---|
133 | INTEGER(iwp) :: component !< |
---|
134 | INTEGER(iwp) :: i !< running index x direction |
---|
135 | INTEGER(iwp) :: j !< running index y direction |
---|
136 | INTEGER(iwp) :: k !< running index z direction |
---|
137 | |
---|
138 | REAL(wp) :: flag !< flag to mask topography |
---|
139 | |
---|
140 | ! |
---|
141 | !-- Compute Coriolis terms for the three velocity components |
---|
142 | SELECT CASE ( component ) |
---|
143 | |
---|
144 | ! |
---|
145 | !-- u-component |
---|
146 | CASE ( 1 ) |
---|
147 | DO i = nxlu, nxr |
---|
148 | DO j = nys, nyn |
---|
149 | DO k = nzb+1, nzt |
---|
150 | ! |
---|
151 | !-- Predetermine flag to mask topography |
---|
152 | flag = MERGE( 1.0_wp, 0.0_wp, & |
---|
153 | BTEST( wall_flags_0(k,j,i), 1 ) ) |
---|
154 | |
---|
155 | tend(k,j,i) = tend(k,j,i) + f * ( 0.25_wp * & |
---|
156 | ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + & |
---|
157 | v(k,j+1,i) ) - vg(k) ) * flag & |
---|
158 | - fs * ( 0.25_wp * & |
---|
159 | ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + & |
---|
160 | w(k,j,i) ) & |
---|
161 | ) * flag |
---|
162 | ENDDO |
---|
163 | ENDDO |
---|
164 | ENDDO |
---|
165 | |
---|
166 | ! |
---|
167 | !-- v-component |
---|
168 | CASE ( 2 ) |
---|
169 | DO i = nxl, nxr |
---|
170 | DO j = nysv, nyn |
---|
171 | DO k = nzb+1, nzt |
---|
172 | ! |
---|
173 | !-- Predetermine flag to mask topography |
---|
174 | flag = MERGE( 1.0_wp, 0.0_wp, & |
---|
175 | BTEST( wall_flags_0(k,j,i), 2 ) ) |
---|
176 | |
---|
177 | tend(k,j,i) = tend(k,j,i) - f * ( 0.25_wp * & |
---|
178 | ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + & |
---|
179 | u(k,j,i+1) ) - ug(k) ) * flag |
---|
180 | ENDDO |
---|
181 | ENDDO |
---|
182 | ENDDO |
---|
183 | |
---|
184 | ! |
---|
185 | !-- w-component |
---|
186 | CASE ( 3 ) |
---|
187 | DO i = nxl, nxr |
---|
188 | DO j = nys, nyn |
---|
189 | DO k = nzb+1, nzt |
---|
190 | ! |
---|
191 | !-- Predetermine flag to mask topography |
---|
192 | flag = MERGE( 1.0_wp, 0.0_wp, & |
---|
193 | BTEST( wall_flags_0(k,j,i), 3 ) ) |
---|
194 | |
---|
195 | tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp * & |
---|
196 | ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + & |
---|
197 | u(k+1,j,i+1) ) * flag |
---|
198 | ENDDO |
---|
199 | ENDDO |
---|
200 | ENDDO |
---|
201 | |
---|
202 | CASE DEFAULT |
---|
203 | |
---|
204 | WRITE( message_string, * ) ' wrong component: ', component |
---|
205 | CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 ) |
---|
206 | |
---|
207 | END SELECT |
---|
208 | |
---|
209 | END SUBROUTINE coriolis |
---|
210 | |
---|
211 | |
---|
212 | !------------------------------------------------------------------------------! |
---|
213 | ! Description: |
---|
214 | ! ------------ |
---|
215 | !> Call for grid point i,j |
---|
216 | !------------------------------------------------------------------------------! |
---|
217 | SUBROUTINE coriolis_ij( i, j, component ) |
---|
218 | |
---|
219 | USE arrays_3d, & |
---|
220 | ONLY: tend, u, ug, v, vg, w |
---|
221 | |
---|
222 | USE control_parameters, & |
---|
223 | ONLY: f, fs, message_string |
---|
224 | |
---|
225 | USE indices, & |
---|
226 | ONLY: nzb, nzt, wall_flags_0 |
---|
227 | |
---|
228 | USE kinds |
---|
229 | |
---|
230 | IMPLICIT NONE |
---|
231 | |
---|
232 | INTEGER(iwp) :: component !< |
---|
233 | INTEGER(iwp) :: i !< running index x direction |
---|
234 | INTEGER(iwp) :: j !< running index y direction |
---|
235 | INTEGER(iwp) :: k !< running index z direction |
---|
236 | |
---|
237 | REAL(wp) :: flag !< flag to mask topography |
---|
238 | |
---|
239 | ! |
---|
240 | !-- Compute Coriolis terms for the three velocity components |
---|
241 | SELECT CASE ( component ) |
---|
242 | |
---|
243 | ! |
---|
244 | !-- u-component |
---|
245 | CASE ( 1 ) |
---|
246 | DO k = nzb+1, nzt |
---|
247 | ! |
---|
248 | !-- Predetermine flag to mask topography |
---|
249 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 1 ) ) |
---|
250 | |
---|
251 | tend(k,j,i) = tend(k,j,i) + f * ( 0.25_wp * & |
---|
252 | ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + & |
---|
253 | v(k,j+1,i) ) - vg(k) & |
---|
254 | ) * flag & |
---|
255 | - fs * ( 0.25_wp * & |
---|
256 | ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + & |
---|
257 | w(k,j,i) ) ) * flag |
---|
258 | ENDDO |
---|
259 | |
---|
260 | ! |
---|
261 | !-- v-component |
---|
262 | CASE ( 2 ) |
---|
263 | DO k = nzb+1, nzt |
---|
264 | ! |
---|
265 | !-- Predetermine flag to mask topography |
---|
266 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 2 ) ) |
---|
267 | |
---|
268 | tend(k,j,i) = tend(k,j,i) - f * ( 0.25_wp * & |
---|
269 | ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + & |
---|
270 | u(k,j,i+1) ) - ug(k) ) * flag |
---|
271 | ENDDO |
---|
272 | |
---|
273 | ! |
---|
274 | !-- w-component |
---|
275 | CASE ( 3 ) |
---|
276 | DO k = nzb+1, nzt |
---|
277 | ! |
---|
278 | !-- Predetermine flag to mask topography |
---|
279 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 3 ) ) |
---|
280 | |
---|
281 | tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp * & |
---|
282 | ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + & |
---|
283 | u(k+1,j,i+1) ) * flag |
---|
284 | ENDDO |
---|
285 | |
---|
286 | CASE DEFAULT |
---|
287 | |
---|
288 | WRITE( message_string, * ) ' wrong component: ', component |
---|
289 | CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 ) |
---|
290 | |
---|
291 | END SELECT |
---|
292 | |
---|
293 | END SUBROUTINE coriolis_ij |
---|
294 | |
---|
295 | END MODULE coriolis_mod |
---|