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

Last change on this file since 3182 was 3182, checked in by suehring, 6 years ago

New Inifor features: grid stretching, improved command-interface, support start dates in different formats in both YYYYMMDD and YYYYMMDDHH, Ability to manually control input file prefixes (--radiation-prefix, --soil-preifx, --flow-prefix, --soilmoisture-prefix) for compatiblity with DWD forcast naming scheme; GNU-style short and long option; Prepared output of large-scale forcing profiles (no computation yet); Added preprocessor flag netcdf4 to switch output format between netCDF 3 and 4; Updated netCDF variable names and attributes to comply with PIDS v1.9; Inifor bugfixes: Improved compatibility with older Intel Intel compilers by avoiding implicit array allocation; Added origin_lon/_lat values and correct reference time in dynamic driver global attributes; corresponding PALM changes: adjustments to revised Inifor; variables names in dynamic driver adjusted; enable geostrophic forcing also in offline nested mode; variable names in LES-LES and COSMO offline nesting changed; lateral boundary flags for nesting, in- and outflow conditions renamed

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