source: palm/tags/release-6.0/SOURCE/coriolis.f90 @ 3884

Last change on this file since 3884 was 3241, checked in by raasch, 6 years ago

various changes to avoid compiler warnings (mainly removal of unused variables)

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