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