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