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