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

Last change on this file since 1257 was 1257, checked in by raasch, 10 years ago

New:
---

openACC porting of timestep calculation
(modules, timestep, time_integration)

Changed:


openACC loop directives and vector clauses removed (because they do not give any performance improvement with PGI
compiler versions > 13.6)
(advec_ws, buoyancy, coriolis, diffusion_e, diffusion_s, diffusion_u, diffusion_v, diffusion_w, diffusivities, exchange_horiz, fft_xy, pres, production_e, transpose, tridia_solver, wall_fluxes)

openACC loop independent clauses added
(boundary_conds, prandtl_fluxes, pres)

openACC declare create statements moved after FORTRAN declaration statement
(diffusion_u, diffusion_v, diffusion_w, fft_xy, poisfft, production_e, tridia_solver)

openACC end parallel replaced by end parallel loop
(flow_statistics, pres)

openACC "kernels do" replaced by "kernels loop"
(prandtl_fluxes)

output format for theta* changed to avoid output of *
(run_control)

Errors:


bugfix for calculation of advective timestep (old version may cause wrong timesteps in case of
vertixcally stretched grids)
Attention: standard run-control output has changed!
(timestep)

  • Property svn:keywords set to Id
File size: 9.2 KB
Line 
1 MODULE coriolis_mod
2
3!--------------------------------------------------------------------------------!
4! This file is part of PALM.
5!
6! PALM is free software: you can redistribute it and/or modify it under the terms
7! of the GNU General Public License as published by the Free Software Foundation,
8! either version 3 of the License, or (at your option) any later 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-2012  Leibniz University Hannover
18!--------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22! openacc loop and loop vector clauses removed
23!
24! Former revisions:
25! -----------------
26! $Id: coriolis.f90 1257 2013-11-08 15:18:40Z raasch $
27!
28! 1128 2013-04-12 06:19:32Z raasch
29! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
30! j_north
31!
32! 1036 2012-10-22 13:43:42Z raasch
33! code put under GPL (PALM 3.9)
34!
35! 1015 2012-09-27 09:23:24Z raasch
36! accelerator version (*_acc) added
37!
38! 254 2009-03-05 15:33:42Z heinze
39! Output of messages replaced by message handling routine.
40!
41! 106 2007-08-16 14:30:26Z raasch
42! loops for u and v are starting from index nxlu, nysv, respectively (needed
43! for non-cyclic boundary conditions)
44!
45! 75 2007-03-22 09:54:05Z raasch
46! uxrp, vynp eliminated
47!
48! RCS Log replace by Id keyword, revision history cleaned up
49!
50! Revision 1.12  2006/02/23 10:08:57  raasch
51! nzb_2d replaced by nzb_u/v/w_inner
52!
53! Revision 1.1  1997/08/29 08:57:38  raasch
54! Initial revision
55!
56!
57! Description:
58! ------------
59! Computation of all Coriolis terms in the equations of motion.
60!------------------------------------------------------------------------------!
61
62    PRIVATE
63    PUBLIC coriolis, coriolis_acc
64
65    INTERFACE coriolis
66       MODULE PROCEDURE coriolis
67       MODULE PROCEDURE coriolis_ij
68    END INTERFACE coriolis
69
70    INTERFACE coriolis_acc
71       MODULE PROCEDURE coriolis_acc
72    END INTERFACE coriolis_acc
73
74 CONTAINS
75
76
77!------------------------------------------------------------------------------!
78! Call for all grid points
79!------------------------------------------------------------------------------!
80    SUBROUTINE coriolis( component )
81
82       USE arrays_3d
83       USE control_parameters
84       USE indices
85       USE pegrid
86
87       IMPLICIT NONE
88
89       INTEGER ::  component, i, j, k
90
91
92!
93!--    Compute Coriolis terms for the three velocity components
94       SELECT CASE ( component )
95
96!
97!--       u-component
98          CASE ( 1 )
99             DO  i = nxlu, nxr
100                DO  j = nys, nyn
101                   DO  k = nzb_u_inner(j,i)+1, nzt
102                      tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25 *            &
103                                   ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +   &
104                                     v(k,j+1,i) ) - vg(k) )                   &
105                                             - fs *    ( 0.25 *               &
106                                   ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + &
107                                     w(k,j,i)   ) &
108                                                          )
109                   ENDDO
110                ENDDO
111             ENDDO
112
113!
114!--       v-component
115          CASE ( 2 )
116             DO  i = nxl, nxr
117                DO  j = nysv, nyn
118                   DO  k = nzb_v_inner(j,i)+1, nzt
119                      tend(k,j,i) = tend(k,j,i) - f *     ( 0.25 *          &
120                                   ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + &
121                                     u(k,j,i+1) ) - ug(k) )
122                   ENDDO
123                ENDDO
124             ENDDO
125
126!
127!--       w-component
128          CASE ( 3 )
129             DO  i = nxl, nxr
130                DO  j = nys, nyn
131                   DO  k = nzb_w_inner(j,i)+1, nzt
132                      tend(k,j,i) = tend(k,j,i) + fs * 0.25 *             &
133                                   ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + &
134                                     u(k+1,j,i+1) )
135                   ENDDO
136                ENDDO
137             ENDDO
138
139          CASE DEFAULT
140
141             WRITE( message_string, * ) ' wrong component: ', component
142             CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 )
143
144       END SELECT
145
146    END SUBROUTINE coriolis
147
148
149!------------------------------------------------------------------------------!
150! Call for all grid points - accelerator version
151!------------------------------------------------------------------------------!
152    SUBROUTINE coriolis_acc( component )
153
154       USE arrays_3d
155       USE control_parameters
156       USE indices
157       USE pegrid
158
159       IMPLICIT NONE
160
161       INTEGER ::  component, i, j, k
162
163
164!
165!--    Compute Coriolis terms for the three velocity components
166       SELECT CASE ( component )
167
168!
169!--       u-component
170          CASE ( 1 )
171             !$acc  kernels present( nzb_u_inner, tend, v, vg, w )
172             DO  i = i_left, i_right
173                DO  j = j_south, j_north
174                   DO  k = 1, nzt
175                      IF  ( k > nzb_u_inner(j,i) )  THEN
176                         tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25 *          &
177                                      ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + &
178                                        v(k,j+1,i) ) - vg(k) )                 &
179                                                - fs *    ( 0.25 *             &
180                                      ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) &
181                                        + w(k,j,i)   )                         &
182                                                             )
183                      ENDIF
184                   ENDDO
185                ENDDO
186             ENDDO
187             !$acc end kernels
188
189!
190!--       v-component
191          CASE ( 2 )
192             !$acc  kernels present( nzb_v_inner, tend, u, ug )
193             DO  i = i_left, i_right
194                DO  j = j_south, j_north
195                   DO  k = 1, nzt
196                      IF  ( k > nzb_v_inner(j,i) )  THEN
197                         tend(k,j,i) = tend(k,j,i) - f *     ( 0.25 *          &
198                                      ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + &
199                                        u(k,j,i+1) ) - ug(k) )
200                      ENDIF
201                   ENDDO
202                ENDDO
203             ENDDO
204             !$acc end kernels
205
206!
207!--       w-component
208          CASE ( 3 )
209             !$acc  kernels present( nzb_w_inner, tend, u )
210             DO  i = i_left, i_right
211                DO  j = j_south, j_north
212                   DO  k = 1, nzt
213                      IF  ( k > nzb_w_inner(j,i) )  THEN
214                         tend(k,j,i) = tend(k,j,i) + fs * 0.25 *             &
215                                      ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + &
216                                        u(k+1,j,i+1) )
217                      ENDIF
218                   ENDDO
219                ENDDO
220             ENDDO
221             !$acc end kernels
222
223          CASE DEFAULT
224
225             WRITE( message_string, * ) ' wrong component: ', component
226             CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 )
227
228       END SELECT
229
230    END SUBROUTINE coriolis_acc
231
232
233!------------------------------------------------------------------------------!
234! Call for grid point i,j
235!------------------------------------------------------------------------------!
236    SUBROUTINE coriolis_ij( i, j, component )
237
238       USE arrays_3d
239       USE control_parameters
240       USE indices
241       USE pegrid
242
243       IMPLICIT NONE
244
245       INTEGER ::  component, i, j, k
246
247!
248!--    Compute Coriolis terms for the three velocity components
249       SELECT CASE ( component )
250
251!
252!--       u-component
253          CASE ( 1 )
254             DO  k = nzb_u_inner(j,i)+1, nzt
255                tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25 *               &
256                                ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +   &
257                                  v(k,j+1,i) ) - vg(k) )                   &
258                                          - fs *    ( 0.25 *               &
259                                ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + &
260                                  w(k,j,i)   ) &
261                                                    )
262             ENDDO
263
264!
265!--       v-component
266          CASE ( 2 )
267             DO  k = nzb_v_inner(j,i)+1, nzt
268                tend(k,j,i) = tend(k,j,i) - f *     ( 0.25 *             &
269                                ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + &
270                                  u(k,j,i+1) ) - ug(k) )
271             ENDDO
272
273!
274!--       w-component
275          CASE ( 3 )
276             DO  k = nzb_w_inner(j,i)+1, nzt
277                tend(k,j,i) = tend(k,j,i) + fs * 0.25 * &
278                                ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + &
279                                  u(k+1,j,i+1) )
280             ENDDO
281
282          CASE DEFAULT
283
284             WRITE( message_string, * ) ' wrong component: ', component
285             CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 )
286
287       END SELECT
288
289    END SUBROUTINE coriolis_ij
290
291 END MODULE coriolis_mod
Note: See TracBrowser for help on using the repository browser.