source: palm/trunk/SOURCE/coriolis.f90 @ 1952

Last change on this file since 1952 was 1874, checked in by maronga, 8 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 11.1 KB
Line 
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 terms
6! of the GNU General Public License as published by the Free Software Foundation,
7! either version 3 of the License, or (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with
14! PALM. If not, see <http://www.gnu.org/licenses/>.
15!
16! Copyright 1997-2016 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------!
18!
19! Current revisions:
20! -----------------
21!
22!
23! Former revisions:
24! -----------------
25! $Id: coriolis.f90 1874 2016-04-18 14:51:10Z suehring $
26!
27! 1873 2016-04-18 14:50:06Z maronga
28! Module renamed (removed _mod)
29!
30!
31! 1850 2016-04-08 13:29:27Z maronga
32! Module renamed
33!
34!
35! 1682 2015-10-07 23:56:08Z knoop
36! Code annotations made doxygen readable
37!
38! 1353 2014-04-08 15:21:23Z heinze
39! REAL constants provided with KIND-attribute
40!
41! 1320 2014-03-20 08:40:49Z raasch
42! ONLY-attribute added to USE-statements,
43! kind-parameters added to all INTEGER and REAL declaration statements,
44! kinds are defined in new module kinds,
45! revision history before 2012 removed,
46! comment fields (!:) to be used for variable explanations added to
47! all variable declaration statements
48!
49! 1257 2013-11-08 15:18:40Z raasch
50! openacc loop and loop vector clauses removed
51!
52! 1128 2013-04-12 06:19:32Z raasch
53! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
54! j_north
55!
56! 1036 2012-10-22 13:43:42Z raasch
57! code put under GPL (PALM 3.9)
58!
59! 1015 2012-09-27 09:23:24Z raasch
60! accelerator version (*_acc) added
61!
62! Revision 1.1  1997/08/29 08:57:38  raasch
63! Initial revision
64!
65!
66! Description:
67! ------------
68!> Computation of all Coriolis terms in the equations of motion.
69!------------------------------------------------------------------------------!
70 MODULE coriolis_mod
71 
72
73    PRIVATE
74    PUBLIC coriolis, coriolis_acc
75
76    INTERFACE coriolis
77       MODULE PROCEDURE coriolis
78       MODULE PROCEDURE coriolis_ij
79    END INTERFACE coriolis
80
81    INTERFACE coriolis_acc
82       MODULE PROCEDURE coriolis_acc
83    END INTERFACE coriolis_acc
84
85 CONTAINS
86
87
88!------------------------------------------------------------------------------!
89! Description:
90! ------------
91!> Call for all grid points
92!------------------------------------------------------------------------------!
93    SUBROUTINE coriolis( component )
94
95       USE arrays_3d,                                                          &
96           ONLY:  tend, u, ug, v, vg, w 
97           
98       USE control_parameters,                                                 &
99           ONLY:  f, fs, message_string
100           
101       USE indices,                                                            &
102           ONLY:  nxl, nxlu, nxr, nyn, nys, nysv, nzb_u_inner, nzb_v_inner,    &
103                  nzb_w_inner, nzt
104                   
105       USE kinds
106
107       IMPLICIT NONE
108
109       INTEGER(iwp) ::  component  !<
110       INTEGER(iwp) ::  i          !<
111       INTEGER(iwp) ::  j          !<
112       INTEGER(iwp) ::  k          !<
113
114
115!
116!--    Compute Coriolis terms for the three velocity components
117       SELECT CASE ( component )
118
119!
120!--       u-component
121          CASE ( 1 )
122             DO  i = nxlu, nxr
123                DO  j = nys, nyn
124                   DO  k = nzb_u_inner(j,i)+1, nzt
125                      tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25_wp *          &
126                                   ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +    &
127                                     v(k,j+1,i) ) - vg(k) )                    &
128                                                - fs *    ( 0.25_wp *          &
129                                   ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) +  &
130                                     w(k,j,i)   ) &
131                                                          )
132                   ENDDO
133                ENDDO
134             ENDDO
135
136!
137!--       v-component
138          CASE ( 2 )
139             DO  i = nxl, nxr
140                DO  j = nysv, nyn
141                   DO  k = nzb_v_inner(j,i)+1, nzt
142                      tend(k,j,i) = tend(k,j,i) - f *     ( 0.25_wp *          &
143                                   ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) +    &
144                                     u(k,j,i+1) ) - ug(k) )
145                   ENDDO
146                ENDDO
147             ENDDO
148
149!
150!--       w-component
151          CASE ( 3 )
152             DO  i = nxl, nxr
153                DO  j = nys, nyn
154                   DO  k = nzb_w_inner(j,i)+1, nzt
155                      tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp *               &
156                                   ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +      &
157                                     u(k+1,j,i+1) )
158                   ENDDO
159                ENDDO
160             ENDDO
161
162          CASE DEFAULT
163
164             WRITE( message_string, * ) ' wrong component: ', component
165             CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 )
166
167       END SELECT
168
169    END SUBROUTINE coriolis
170
171
172!------------------------------------------------------------------------------!
173! Description:
174! ------------
175!> Call for all grid points - accelerator version
176!------------------------------------------------------------------------------!
177    SUBROUTINE coriolis_acc( component )
178
179       USE arrays_3d,                                                          &
180           ONLY:  tend, u, ug, v, vg, w 
181           
182       USE control_parameters,                                                 &
183           ONLY:  f, fs, message_string
184           
185       USE indices,                                                            &
186           ONLY:  i_left, i_right, j_north, j_south, nzb_u_inner,              &
187                  nzb_v_inner, nzb_w_inner, nzt
188                   
189       USE kinds
190
191       IMPLICIT NONE
192
193       INTEGER(iwp) ::  component  !<
194       INTEGER(iwp) ::  i          !<
195       INTEGER(iwp) ::  j          !<
196       INTEGER(iwp) ::  k          !<
197
198
199!
200!--    Compute Coriolis terms for the three velocity components
201       SELECT CASE ( component )
202
203!
204!--       u-component
205          CASE ( 1 )
206             !$acc  kernels present( nzb_u_inner, tend, v, vg, w )
207             DO  i = i_left, i_right
208                DO  j = j_south, j_north
209                   DO  k = 1, nzt
210                      IF  ( k > nzb_u_inner(j,i) )  THEN
211                         tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25_wp *       &
212                                      ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + &
213                                        v(k,j+1,i) ) - vg(k) )                 &
214                                                   - fs *    ( 0.25_wp *       &
215                                      ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) &
216                                        + w(k,j,i)   )                         &
217                                                             )
218                      ENDIF
219                   ENDDO
220                ENDDO
221             ENDDO
222             !$acc end kernels
223
224!
225!--       v-component
226          CASE ( 2 )
227             !$acc  kernels present( nzb_v_inner, tend, u, ug )
228             DO  i = i_left, i_right
229                DO  j = j_south, j_north
230                   DO  k = 1, nzt
231                      IF  ( k > nzb_v_inner(j,i) )  THEN
232                         tend(k,j,i) = tend(k,j,i) - f *     ( 0.25_wp *       &
233                                      ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + &
234                                        u(k,j,i+1) ) - ug(k) )
235                      ENDIF
236                   ENDDO
237                ENDDO
238             ENDDO
239             !$acc end kernels
240
241!
242!--       w-component
243          CASE ( 3 )
244             !$acc  kernels present( nzb_w_inner, tend, u )
245             DO  i = i_left, i_right
246                DO  j = j_south, j_north
247                   DO  k = 1, nzt
248                      IF  ( k > nzb_w_inner(j,i) )  THEN
249                         tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp *            &
250                                      ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +   &
251                                        u(k+1,j,i+1) )
252                      ENDIF
253                   ENDDO
254                ENDDO
255             ENDDO
256             !$acc end kernels
257
258          CASE DEFAULT
259
260             WRITE( message_string, * ) ' wrong component: ', component
261             CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 )
262
263       END SELECT
264
265    END SUBROUTINE coriolis_acc
266
267
268!------------------------------------------------------------------------------!
269! Description:
270! ------------
271!> Call for grid point i,j
272!------------------------------------------------------------------------------!
273    SUBROUTINE coriolis_ij( i, j, component )
274
275       USE arrays_3d,                                                          &
276           ONLY:  tend, u, ug, v, vg, w 
277           
278       USE control_parameters,                                                 &
279           ONLY:  f, fs, message_string
280           
281       USE indices,                                                            &
282           ONLY:  nzb_u_inner, nzb_v_inner, nzb_w_inner, nzt
283           
284       USE kinds
285       
286       IMPLICIT NONE
287
288       INTEGER(iwp) ::  component  !<
289       INTEGER(iwp) ::  i          !<
290       INTEGER(iwp) ::  j          !<
291       INTEGER(iwp) ::  k          !<
292
293!
294!--    Compute Coriolis terms for the three velocity components
295       SELECT CASE ( component )
296
297!
298!--       u-component
299          CASE ( 1 )
300             DO  k = nzb_u_inner(j,i)+1, nzt
301                tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25_wp *                &
302                                ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +       &
303                                  v(k,j+1,i) ) - vg(k) )                       &
304                                          - fs *    ( 0.25_wp *                &
305                                ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) +     &
306                                  w(k,j,i)   ) )
307             ENDDO
308
309!
310!--       v-component
311          CASE ( 2 )
312             DO  k = nzb_v_inner(j,i)+1, nzt
313                tend(k,j,i) = tend(k,j,i) - f *     ( 0.25_wp *                &
314                                ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) +       &
315                                  u(k,j,i+1) ) - ug(k) )
316             ENDDO
317
318!
319!--       w-component
320          CASE ( 3 )
321             DO  k = nzb_w_inner(j,i)+1, nzt
322                tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp *                     &
323                                ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +         &
324                                  u(k+1,j,i+1) )
325             ENDDO
326
327          CASE DEFAULT
328
329             WRITE( message_string, * ) ' wrong component: ', component
330             CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 )
331
332       END SELECT
333
334    END SUBROUTINE coriolis_ij
335
336 END MODULE coriolis_mod
Note: See TracBrowser for help on using the repository browser.