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

Last change on this file since 4183 was 4182, checked in by scharf, 5 years ago
  • corrected "Former revisions" section
  • minor formatting in "Former revisions" section
  • added "Author" section
  • Property svn:keywords set to Id
File size: 8.8 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!
[3655]17! Copyright 1997-2019 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 4182 2019-08-22 15:20:23Z oliver.maas $
[4182]27! Corrected "Former revisions" section
28!
29! 3655 2019-01-07 16:51:22Z knoop
[3634]30! OpenACC port for SPEC
[1321]31!
[4182]32! Revision 1.1  1997/08/29 08:57:38  raasch
33! Initial revision
34!
35!
[1]36! Description:
37! ------------
[1682]38!> Computation of all Coriolis terms in the equations of motion.
[3538]39!>
40!> @note In this routine the topography is masked, even though this
41!>       is again done in prognostic_equations. However, omitting the masking
42!>       here lead to slightly different results. Reason unknown.
[1]43!------------------------------------------------------------------------------!
[1682]44 MODULE coriolis_mod
45 
[1]46
47    PRIVATE
[2118]48    PUBLIC coriolis
[1]49
50    INTERFACE coriolis
51       MODULE PROCEDURE coriolis
52       MODULE PROCEDURE coriolis_ij
53    END INTERFACE coriolis
54
55 CONTAINS
56
57
58!------------------------------------------------------------------------------!
[1682]59! Description:
60! ------------
61!> Call for all grid points
[1]62!------------------------------------------------------------------------------!
63    SUBROUTINE coriolis( component )
64
[1320]65       USE arrays_3d,                                                          &
66           ONLY:  tend, u, ug, v, vg, w 
67           
68       USE control_parameters,                                                 &
[3241]69           ONLY:  f, fs, message_string
[1320]70           
71       USE indices,                                                            &
[2232]72           ONLY:  nxl, nxlu, nxr, nyn, nys, nysv, nzb, nzt, wall_flags_0
[1320]73                   
74       USE kinds
[1]75
76       IMPLICIT NONE
77
[1682]78       INTEGER(iwp) ::  component  !<
[2232]79       INTEGER(iwp) ::  i          !< running index x direction
80       INTEGER(iwp) ::  j          !< running index y direction
81       INTEGER(iwp) ::  k          !< running index z direction
[1]82
[3182]83       REAL(wp)     ::  flag           !< flag to mask topography
[2696]84
[1]85!
86!--    Compute Coriolis terms for the three velocity components
87       SELECT CASE ( component )
88
89!
90!--       u-component
91          CASE ( 1 )
[3634]92             !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag) &
93             !$ACC PRESENT(wall_flags_0) &
94             !$ACC PRESENT(v, w, vg) &
95             !$ACC PRESENT(tend)
[106]96             DO  i = nxlu, nxr
[1]97                DO  j = nys, nyn
[2232]98                   DO  k = nzb+1, nzt
99!
[2696]100!--                   Predetermine flag to mask topography
[2232]101                      flag = MERGE( 1.0_wp, 0.0_wp,                            &
102                                    BTEST( wall_flags_0(k,j,i), 1 ) )
103
[1353]104                      tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25_wp *          &
[1320]105                                   ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +    &
[3182]106                                     v(k,j+1,i) ) - vg(k) ) * flag             &
[1353]107                                                - fs *    ( 0.25_wp *          &
[1320]108                                   ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) +  &
[2232]109                                     w(k,j,i)   )                              &
[2696]110                                                          ) * flag
[1]111                   ENDDO
112                ENDDO
113             ENDDO
114
115!
116!--       v-component
117          CASE ( 2 )
[3634]118             !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag) &
119             !$ACC PRESENT(wall_flags_0) &
120             !$ACC PRESENT(u, ug) &
121             !$ACC PRESENT(tend)
[1]122             DO  i = nxl, nxr
[106]123                DO  j = nysv, nyn
[2232]124                   DO  k = nzb+1, nzt
[2696]125!
126!--                   Predetermine flag to mask topography
127                      flag = MERGE( 1.0_wp, 0.0_wp,                            &
128                                    BTEST( wall_flags_0(k,j,i), 2 ) )
129
[1353]130                      tend(k,j,i) = tend(k,j,i) - f *     ( 0.25_wp *          &
[1320]131                                   ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) +    &
[3182]132                                     u(k,j,i+1) ) - ug(k) ) * flag
[1]133                   ENDDO
134                ENDDO
135             ENDDO
136
137!
138!--       w-component
139          CASE ( 3 )
[3634]140             !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag) &
141             !$ACC PRESENT(wall_flags_0) &
142             !$ACC PRESENT(u) &
143             !$ACC PRESENT(tend)
[1]144             DO  i = nxl, nxr
145                DO  j = nys, nyn
[2232]146                   DO  k = nzb+1, nzt
[2696]147!
148!--                   Predetermine flag to mask topography
149                      flag = MERGE( 1.0_wp, 0.0_wp,                            &
150                                    BTEST( wall_flags_0(k,j,i), 3 ) )
151
[1353]152                      tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp *               &
[1320]153                                   ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +      &
[2696]154                                     u(k+1,j,i+1) ) * flag
[1]155                   ENDDO
156                ENDDO
157             ENDDO
158
159          CASE DEFAULT
160
[254]161             WRITE( message_string, * ) ' wrong component: ', component
162             CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 )
[1]163
164       END SELECT
165
166    END SUBROUTINE coriolis
167
168
169!------------------------------------------------------------------------------!
[1682]170! Description:
171! ------------
172!> Call for grid point i,j
[1]173!------------------------------------------------------------------------------!
174    SUBROUTINE coriolis_ij( i, j, component )
175
[1320]176       USE arrays_3d,                                                          &
177           ONLY:  tend, u, ug, v, vg, w 
178           
179       USE control_parameters,                                                 &
[3241]180           ONLY:  f, fs, message_string
[1320]181           
182       USE indices,                                                            &
[2232]183           ONLY:  nzb, nzt, wall_flags_0
[1320]184           
185       USE kinds
186       
[1]187       IMPLICIT NONE
188
[1682]189       INTEGER(iwp) ::  component  !<
[2232]190       INTEGER(iwp) ::  i          !< running index x direction
191       INTEGER(iwp) ::  j          !< running index y direction
192       INTEGER(iwp) ::  k          !< running index z direction
[1]193
[2232]194       REAL(wp)     ::  flag       !< flag to mask topography
195
[1]196!
197!--    Compute Coriolis terms for the three velocity components
198       SELECT CASE ( component )
199
200!
201!--       u-component
202          CASE ( 1 )
[2232]203             DO  k = nzb+1, nzt
204!
205!--             Predetermine flag to mask topography
206                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 1 ) )
207
208                tend(k,j,i) = tend(k,j,i) + f  *     ( 0.25_wp *               &
[1320]209                                ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +       &
[3182]210                                  v(k,j+1,i) ) - vg(k)                         &
[2696]211                                                     ) * flag                  &
212                                          - fs *     ( 0.25_wp *               &
[1320]213                                ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) +     &
[2696]214                                  w(k,j,i)   )       ) * flag
[1]215             ENDDO
216
217!
218!--       v-component
219          CASE ( 2 )
[2232]220             DO  k = nzb+1, nzt
[2696]221!
222!--             Predetermine flag to mask topography
223                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 2 ) )
224
[2232]225                tend(k,j,i) = tend(k,j,i) - f *        ( 0.25_wp *             &
[1320]226                                ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) +       &
[3182]227                                  u(k,j,i+1) ) - ug(k) ) * flag
[1]228             ENDDO
229
230!
231!--       w-component
232          CASE ( 3 )
[2232]233             DO  k = nzb+1, nzt
[2696]234!
235!--             Predetermine flag to mask topography
236                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 3 ) )
237
[1353]238                tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp *                     &
[1320]239                                ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +         &
[2696]240                                  u(k+1,j,i+1) ) * flag
[1]241             ENDDO
242
243          CASE DEFAULT
244
[254]245             WRITE( message_string, * ) ' wrong component: ', component
246             CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 )
[1]247
248       END SELECT
249
250    END SUBROUTINE coriolis_ij
251
252 END MODULE coriolis_mod
Note: See TracBrowser for help on using the repository browser.