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