[1873] | 1 | !> @file advec_u_up.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 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1354] | 22 | ! |
---|
[2233] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: advec_u_up.f90 3655 2019-01-07 16:51:22Z raasch $ |
---|
[3547] | 27 | ! variables documented |
---|
| 28 | ! |
---|
| 29 | ! 3538 2018-11-20 10:55:41Z suehring |
---|
[3538] | 30 | ! Remove unnecessary double-masking of topography |
---|
| 31 | ! |
---|
| 32 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 33 | ! Corrected "Former revisions" section |
---|
| 34 | ! |
---|
| 35 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 36 | ! Change in file header (GPL part) |
---|
[1321] | 37 | ! |
---|
[2716] | 38 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
| 39 | ! |
---|
[2233] | 40 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
| 41 | ! topography representation via flags |
---|
| 42 | ! |
---|
[2001] | 43 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 44 | ! Forced header and separation lines into 80 columns |
---|
| 45 | ! |
---|
[1874] | 46 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
| 47 | ! Module renamed (removed _mod) |
---|
| 48 | ! |
---|
| 49 | ! |
---|
[1851] | 50 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
| 51 | ! Module renamed |
---|
| 52 | ! |
---|
| 53 | ! |
---|
[1683] | 54 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 55 | ! Code annotations made doxygen readable |
---|
| 56 | ! |
---|
[1354] | 57 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 58 | ! REAL constants provided with KIND-attribute |
---|
| 59 | ! |
---|
[1321] | 60 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 61 | ! ONLY-attribute added to USE-statements, |
---|
| 62 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 63 | ! kinds are defined in new module kinds, |
---|
| 64 | ! revision history before 2012 removed, |
---|
| 65 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 66 | ! all variable declaration statements |
---|
[1] | 67 | ! |
---|
[1037] | 68 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 69 | ! code put under GPL (PALM 3.9) |
---|
| 70 | ! |
---|
[1] | 71 | ! Revision 1.1 1997/08/29 08:55:25 raasch |
---|
| 72 | ! Initial revision |
---|
| 73 | ! |
---|
| 74 | ! |
---|
| 75 | ! Description: |
---|
| 76 | ! ------------ |
---|
[1682] | 77 | !> Advection term for the u velocity-component using upstream scheme. |
---|
| 78 | !> NOTE: vertical advection at k=1 still has wrong grid spacing for w>0! |
---|
| 79 | !> The same problem occurs for all topography boundaries! |
---|
[1] | 80 | !------------------------------------------------------------------------------! |
---|
[1682] | 81 | MODULE advec_u_up_mod |
---|
| 82 | |
---|
[1] | 83 | |
---|
| 84 | PRIVATE |
---|
| 85 | PUBLIC advec_u_up |
---|
| 86 | |
---|
| 87 | INTERFACE advec_u_up |
---|
| 88 | MODULE PROCEDURE advec_u_up |
---|
| 89 | MODULE PROCEDURE advec_u_up_ij |
---|
| 90 | END INTERFACE advec_u_up |
---|
| 91 | |
---|
| 92 | CONTAINS |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | !------------------------------------------------------------------------------! |
---|
[1682] | 96 | ! Description: |
---|
| 97 | ! ------------ |
---|
| 98 | !> Call for all grid points |
---|
[1] | 99 | !------------------------------------------------------------------------------! |
---|
| 100 | SUBROUTINE advec_u_up |
---|
| 101 | |
---|
[1320] | 102 | USE arrays_3d, & |
---|
| 103 | ONLY: ddzu, tend, u, v, w |
---|
[1] | 104 | |
---|
[1320] | 105 | USE control_parameters, & |
---|
| 106 | ONLY: u_gtrans, v_gtrans |
---|
| 107 | |
---|
| 108 | USE grid_variables, & |
---|
| 109 | ONLY: ddx, ddy |
---|
| 110 | |
---|
| 111 | USE indices, & |
---|
[3538] | 112 | ONLY: nxlu, nxr, nyn, nys, nzb, nzt |
---|
[1320] | 113 | |
---|
| 114 | USE kinds |
---|
| 115 | |
---|
| 116 | |
---|
[1] | 117 | IMPLICIT NONE |
---|
| 118 | |
---|
[3547] | 119 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
| 120 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
| 121 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
[1] | 122 | |
---|
[3547] | 123 | REAL(wp) :: ukomp !< advection velocity along x-direction |
---|
| 124 | REAL(wp) :: vkomp !< advection velocity along y-direction |
---|
| 125 | REAL(wp) :: wkomp !< advection velocity along z-direction |
---|
[1] | 126 | |
---|
[1320] | 127 | |
---|
[106] | 128 | DO i = nxlu, nxr |
---|
[1] | 129 | DO j = nys, nyn |
---|
[2232] | 130 | DO k = nzb+1, nzt |
---|
[1] | 131 | ! |
---|
| 132 | !-- x-direction |
---|
| 133 | ukomp = u(k,j,i) - u_gtrans |
---|
[1353] | 134 | IF ( ukomp > 0.0_wp ) THEN |
---|
[1320] | 135 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[3538] | 136 | ( u(k,j,i) - u(k,j,i-1) ) * ddx |
---|
[1] | 137 | ELSE |
---|
[1320] | 138 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[3538] | 139 | ( u(k,j,i+1) - u(k,j,i) ) * ddx |
---|
[1] | 140 | ENDIF |
---|
| 141 | ! |
---|
| 142 | !-- y-direction |
---|
[1353] | 143 | vkomp = 0.25_wp * ( v(k,j,i) + v(k,j+1,i) + & |
---|
[1] | 144 | v(k,j,i-1) + v(k,j+1,i-1) ) - v_gtrans |
---|
[1353] | 145 | IF ( vkomp > 0.0_wp ) THEN |
---|
[1320] | 146 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[3538] | 147 | ( u(k,j,i) - u(k,j-1,i) ) * ddy |
---|
[1] | 148 | ELSE |
---|
[1320] | 149 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[3538] | 150 | ( u(k,j+1,i) - u(k,j,i) ) * ddy |
---|
[1] | 151 | ENDIF |
---|
| 152 | ! |
---|
| 153 | !-- z-direction |
---|
[1353] | 154 | wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + & |
---|
[1] | 155 | w(k,j,i-1) + w(k-1,j,i-1) ) |
---|
[1353] | 156 | IF ( wkomp > 0.0_wp ) THEN |
---|
[1320] | 157 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
[3538] | 158 | ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k) |
---|
[1] | 159 | ELSE |
---|
[1320] | 160 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
[3538] | 161 | ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) |
---|
[1] | 162 | ENDIF |
---|
| 163 | |
---|
| 164 | ENDDO |
---|
| 165 | ENDDO |
---|
| 166 | ENDDO |
---|
| 167 | |
---|
| 168 | END SUBROUTINE advec_u_up |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | !------------------------------------------------------------------------------! |
---|
[1682] | 172 | ! Description: |
---|
| 173 | ! ------------ |
---|
| 174 | !> Call for grid point i,j |
---|
[1] | 175 | !------------------------------------------------------------------------------! |
---|
| 176 | SUBROUTINE advec_u_up_ij( i, j ) |
---|
| 177 | |
---|
[1320] | 178 | USE arrays_3d, & |
---|
| 179 | ONLY: ddzu, tend, u, v, w |
---|
[1] | 180 | |
---|
[1320] | 181 | USE control_parameters, & |
---|
| 182 | ONLY: u_gtrans, v_gtrans |
---|
| 183 | |
---|
| 184 | USE grid_variables, & |
---|
| 185 | ONLY: ddx, ddy |
---|
| 186 | |
---|
| 187 | USE indices, & |
---|
[3538] | 188 | ONLY: nzb, nzt |
---|
[1320] | 189 | |
---|
| 190 | USE kinds |
---|
| 191 | |
---|
| 192 | |
---|
[1] | 193 | IMPLICIT NONE |
---|
| 194 | |
---|
[3547] | 195 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
| 196 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
| 197 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
[1] | 198 | |
---|
[3547] | 199 | REAL(wp) :: ukomp !< advection velocity along x-direction |
---|
| 200 | REAL(wp) :: vkomp !< advection velocity along y-direction |
---|
| 201 | REAL(wp) :: wkomp !< advection velocity along z-direction |
---|
[1] | 202 | |
---|
| 203 | |
---|
[2232] | 204 | DO k = nzb+1, nzt |
---|
[1] | 205 | ! |
---|
| 206 | !-- x-direction |
---|
| 207 | ukomp = u(k,j,i) - u_gtrans |
---|
[1353] | 208 | IF ( ukomp > 0.0_wp ) THEN |
---|
[1320] | 209 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[3538] | 210 | ( u(k,j,i) - u(k,j,i-1) ) * ddx |
---|
[1] | 211 | ELSE |
---|
[1320] | 212 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[3538] | 213 | ( u(k,j,i+1) - u(k,j,i) ) * ddx |
---|
[1] | 214 | ENDIF |
---|
| 215 | ! |
---|
| 216 | !-- y-direction |
---|
[1353] | 217 | vkomp = 0.25_wp * ( v(k,j,i) + v(k,j+1,i) + v(k,j,i-1) + v(k,j+1,i-1) & |
---|
[1] | 218 | ) - v_gtrans |
---|
[1353] | 219 | IF ( vkomp > 0.0_wp ) THEN |
---|
[1320] | 220 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[3538] | 221 | ( u(k,j,i) - u(k,j-1,i) ) * ddy |
---|
[1] | 222 | ELSE |
---|
[1320] | 223 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[3538] | 224 | ( u(k,j+1,i) - u(k,j,i) ) * ddy |
---|
[1] | 225 | ENDIF |
---|
| 226 | ! |
---|
| 227 | !-- z-direction |
---|
[1353] | 228 | wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + w(k,j,i-1) + w(k-1,j,i-1) ) |
---|
| 229 | IF ( wkomp > 0.0_wp ) THEN |
---|
[1320] | 230 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
[3538] | 231 | ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k) |
---|
[1] | 232 | ELSE |
---|
[1320] | 233 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
[3538] | 234 | ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) |
---|
[1] | 235 | ENDIF |
---|
| 236 | |
---|
| 237 | ENDDO |
---|
| 238 | |
---|
| 239 | END SUBROUTINE advec_u_up_ij |
---|
| 240 | |
---|
| 241 | END MODULE advec_u_up_mod |
---|