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

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