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

Last change on this file since 2716 was 2716, checked in by kanani, 6 years ago

Correction of "Former revisions" section

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