1 | !> @file coriolis.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
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-2017 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: coriolis.f90 2119 2017-01-17 16:51:50Z raasch $ |
---|
27 | ! |
---|
28 | ! 2118 2017-01-17 16:38:49Z raasch |
---|
29 | ! OpenACC version of subroutine removed |
---|
30 | ! |
---|
31 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
32 | ! Forced header and separation lines into 80 columns |
---|
33 | ! |
---|
34 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
35 | ! Module renamed (removed _mod) |
---|
36 | ! |
---|
37 | ! |
---|
38 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
39 | ! Module renamed |
---|
40 | ! |
---|
41 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
42 | ! Code annotations made doxygen readable |
---|
43 | ! |
---|
44 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
45 | ! REAL constants provided with KIND-attribute |
---|
46 | ! |
---|
47 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
48 | ! ONLY-attribute added to USE-statements, |
---|
49 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
50 | ! kinds are defined in new module kinds, |
---|
51 | ! revision history before 2012 removed, |
---|
52 | ! comment fields (!:) to be used for variable explanations added to |
---|
53 | ! all variable declaration statements |
---|
54 | ! |
---|
55 | ! 1257 2013-11-08 15:18:40Z raasch |
---|
56 | ! openacc loop and loop vector clauses removed |
---|
57 | ! |
---|
58 | ! 1128 2013-04-12 06:19:32Z raasch |
---|
59 | ! loop index bounds in accelerator version replaced by i_left, i_right, j_south, |
---|
60 | ! j_north |
---|
61 | ! |
---|
62 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
63 | ! code put under GPL (PALM 3.9) |
---|
64 | ! |
---|
65 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
66 | ! accelerator version (*_acc) added |
---|
67 | ! |
---|
68 | ! Revision 1.1 1997/08/29 08:57:38 raasch |
---|
69 | ! Initial revision |
---|
70 | ! |
---|
71 | ! |
---|
72 | ! Description: |
---|
73 | ! ------------ |
---|
74 | !> Computation of all Coriolis terms in the equations of motion. |
---|
75 | !------------------------------------------------------------------------------! |
---|
76 | MODULE coriolis_mod |
---|
77 | |
---|
78 | |
---|
79 | PRIVATE |
---|
80 | PUBLIC coriolis |
---|
81 | |
---|
82 | INTERFACE coriolis |
---|
83 | MODULE PROCEDURE coriolis |
---|
84 | MODULE PROCEDURE coriolis_ij |
---|
85 | END INTERFACE coriolis |
---|
86 | |
---|
87 | CONTAINS |
---|
88 | |
---|
89 | |
---|
90 | !------------------------------------------------------------------------------! |
---|
91 | ! Description: |
---|
92 | ! ------------ |
---|
93 | !> Call for all grid points |
---|
94 | !------------------------------------------------------------------------------! |
---|
95 | SUBROUTINE coriolis( component ) |
---|
96 | |
---|
97 | USE arrays_3d, & |
---|
98 | ONLY: tend, u, ug, v, vg, w |
---|
99 | |
---|
100 | USE control_parameters, & |
---|
101 | ONLY: f, fs, message_string |
---|
102 | |
---|
103 | USE indices, & |
---|
104 | ONLY: nxl, nxlu, nxr, nyn, nys, nysv, nzb_u_inner, nzb_v_inner, & |
---|
105 | nzb_w_inner, nzt |
---|
106 | |
---|
107 | USE kinds |
---|
108 | |
---|
109 | IMPLICIT NONE |
---|
110 | |
---|
111 | INTEGER(iwp) :: component !< |
---|
112 | INTEGER(iwp) :: i !< |
---|
113 | INTEGER(iwp) :: j !< |
---|
114 | INTEGER(iwp) :: k !< |
---|
115 | |
---|
116 | |
---|
117 | ! |
---|
118 | !-- Compute Coriolis terms for the three velocity components |
---|
119 | SELECT CASE ( component ) |
---|
120 | |
---|
121 | ! |
---|
122 | !-- u-component |
---|
123 | CASE ( 1 ) |
---|
124 | DO i = nxlu, nxr |
---|
125 | DO j = nys, nyn |
---|
126 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
127 | tend(k,j,i) = tend(k,j,i) + f * ( 0.25_wp * & |
---|
128 | ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + & |
---|
129 | v(k,j+1,i) ) - vg(k) ) & |
---|
130 | - fs * ( 0.25_wp * & |
---|
131 | ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + & |
---|
132 | w(k,j,i) ) & |
---|
133 | ) |
---|
134 | ENDDO |
---|
135 | ENDDO |
---|
136 | ENDDO |
---|
137 | |
---|
138 | ! |
---|
139 | !-- v-component |
---|
140 | CASE ( 2 ) |
---|
141 | DO i = nxl, nxr |
---|
142 | DO j = nysv, nyn |
---|
143 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
144 | tend(k,j,i) = tend(k,j,i) - f * ( 0.25_wp * & |
---|
145 | ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + & |
---|
146 | u(k,j,i+1) ) - ug(k) ) |
---|
147 | ENDDO |
---|
148 | ENDDO |
---|
149 | ENDDO |
---|
150 | |
---|
151 | ! |
---|
152 | !-- w-component |
---|
153 | CASE ( 3 ) |
---|
154 | DO i = nxl, nxr |
---|
155 | DO j = nys, nyn |
---|
156 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
157 | tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp * & |
---|
158 | ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + & |
---|
159 | u(k+1,j,i+1) ) |
---|
160 | ENDDO |
---|
161 | ENDDO |
---|
162 | ENDDO |
---|
163 | |
---|
164 | CASE DEFAULT |
---|
165 | |
---|
166 | WRITE( message_string, * ) ' wrong component: ', component |
---|
167 | CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 ) |
---|
168 | |
---|
169 | END SELECT |
---|
170 | |
---|
171 | END SUBROUTINE coriolis |
---|
172 | |
---|
173 | |
---|
174 | !------------------------------------------------------------------------------! |
---|
175 | ! Description: |
---|
176 | ! ------------ |
---|
177 | !> Call for grid point i,j |
---|
178 | !------------------------------------------------------------------------------! |
---|
179 | SUBROUTINE coriolis_ij( i, j, component ) |
---|
180 | |
---|
181 | USE arrays_3d, & |
---|
182 | ONLY: tend, u, ug, v, vg, w |
---|
183 | |
---|
184 | USE control_parameters, & |
---|
185 | ONLY: f, fs, message_string |
---|
186 | |
---|
187 | USE indices, & |
---|
188 | ONLY: nzb_u_inner, nzb_v_inner, nzb_w_inner, nzt |
---|
189 | |
---|
190 | USE kinds |
---|
191 | |
---|
192 | IMPLICIT NONE |
---|
193 | |
---|
194 | INTEGER(iwp) :: component !< |
---|
195 | INTEGER(iwp) :: i !< |
---|
196 | INTEGER(iwp) :: j !< |
---|
197 | INTEGER(iwp) :: k !< |
---|
198 | |
---|
199 | ! |
---|
200 | !-- Compute Coriolis terms for the three velocity components |
---|
201 | SELECT CASE ( component ) |
---|
202 | |
---|
203 | ! |
---|
204 | !-- u-component |
---|
205 | CASE ( 1 ) |
---|
206 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
207 | tend(k,j,i) = tend(k,j,i) + f * ( 0.25_wp * & |
---|
208 | ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + & |
---|
209 | v(k,j+1,i) ) - vg(k) ) & |
---|
210 | - fs * ( 0.25_wp * & |
---|
211 | ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + & |
---|
212 | w(k,j,i) ) ) |
---|
213 | ENDDO |
---|
214 | |
---|
215 | ! |
---|
216 | !-- v-component |
---|
217 | CASE ( 2 ) |
---|
218 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
219 | tend(k,j,i) = tend(k,j,i) - f * ( 0.25_wp * & |
---|
220 | ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + & |
---|
221 | u(k,j,i+1) ) - ug(k) ) |
---|
222 | ENDDO |
---|
223 | |
---|
224 | ! |
---|
225 | !-- w-component |
---|
226 | CASE ( 3 ) |
---|
227 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
228 | tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp * & |
---|
229 | ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + & |
---|
230 | u(k+1,j,i+1) ) |
---|
231 | ENDDO |
---|
232 | |
---|
233 | CASE DEFAULT |
---|
234 | |
---|
235 | WRITE( message_string, * ) ' wrong component: ', component |
---|
236 | CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 ) |
---|
237 | |
---|
238 | END SELECT |
---|
239 | |
---|
240 | END SUBROUTINE coriolis_ij |
---|
241 | |
---|
242 | END MODULE coriolis_mod |
---|