[1873] | 1 | !> @file advec_v_up.f90 |
---|
[1036] | 2 | !--------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 7 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 8 | ! |
---|
| 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 12 | ! |
---|
| 13 | ! You should have received a copy of the GNU General Public License along with |
---|
| 14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 15 | ! |
---|
[1818] | 16 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
[1036] | 17 | !--------------------------------------------------------------------------------! |
---|
| 18 | ! |
---|
[484] | 19 | ! Current revisions: |
---|
[1] | 20 | ! ----------------- |
---|
[1354] | 21 | ! |
---|
[1683] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: advec_v_up.f90 1874 2016-04-18 14:51:10Z suehring $ |
---|
| 26 | ! |
---|
[1874] | 27 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
| 28 | ! Module renamed (removed _mod) |
---|
| 29 | ! |
---|
| 30 | ! |
---|
[1851] | 31 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
| 32 | ! Module renamed |
---|
| 33 | ! |
---|
| 34 | ! |
---|
[1683] | 35 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 36 | ! Code annotations made doxygen readable |
---|
| 37 | ! |
---|
[1354] | 38 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 39 | ! REAL constants provided with KIND-attribute |
---|
| 40 | ! |
---|
[1321] | 41 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 42 | ! ONLY-attribute added to USE-statements, |
---|
| 43 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 44 | ! kinds are defined in new module kinds, |
---|
| 45 | ! revision history before 2012 removed, |
---|
| 46 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 47 | ! all variable declaration statements |
---|
[1] | 48 | ! |
---|
[1037] | 49 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 50 | ! code put under GPL (PALM 3.9) |
---|
| 51 | ! |
---|
[1] | 52 | ! Revision 1.1 1997/08/29 08:56:05 raasch |
---|
| 53 | ! Initial revision |
---|
| 54 | ! |
---|
| 55 | ! |
---|
| 56 | ! Description: |
---|
| 57 | ! ------------ |
---|
[1682] | 58 | !> Advection term for the v velocity-component using upstream scheme. |
---|
| 59 | !> NOTE: vertical advection at k=1 still has wrong grid spacing for w>0! |
---|
| 60 | !> The same problem occurs for all topography boundaries! |
---|
[1] | 61 | !------------------------------------------------------------------------------! |
---|
[1682] | 62 | MODULE advec_v_up_mod |
---|
| 63 | |
---|
[1] | 64 | |
---|
| 65 | PRIVATE |
---|
| 66 | PUBLIC advec_v_up |
---|
| 67 | |
---|
| 68 | INTERFACE advec_v_up |
---|
| 69 | MODULE PROCEDURE advec_v_up |
---|
| 70 | MODULE PROCEDURE advec_v_up_ij |
---|
| 71 | END INTERFACE advec_v_up |
---|
| 72 | |
---|
| 73 | CONTAINS |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | !------------------------------------------------------------------------------! |
---|
[1682] | 77 | ! Description: |
---|
| 78 | ! ------------ |
---|
| 79 | !> Call for all grid points |
---|
[1] | 80 | !------------------------------------------------------------------------------! |
---|
| 81 | SUBROUTINE advec_v_up |
---|
| 82 | |
---|
[1320] | 83 | USE arrays_3d, & |
---|
| 84 | ONLY: ddzu, tend, u, v, w |
---|
[1] | 85 | |
---|
[1320] | 86 | USE control_parameters, & |
---|
| 87 | ONLY: u_gtrans, v_gtrans |
---|
| 88 | |
---|
| 89 | USE grid_variables, & |
---|
| 90 | ONLY: ddx, ddy |
---|
| 91 | |
---|
| 92 | USE indices, & |
---|
| 93 | ONLY: nxl, nxr, nyn, nysv, nzb_v_inner, nzt |
---|
| 94 | |
---|
| 95 | USE kinds |
---|
| 96 | |
---|
| 97 | |
---|
[1] | 98 | IMPLICIT NONE |
---|
| 99 | |
---|
[1682] | 100 | INTEGER(iwp) :: i !< |
---|
| 101 | INTEGER(iwp) :: j !< |
---|
| 102 | INTEGER(iwp) :: k !< |
---|
[1] | 103 | |
---|
[1682] | 104 | REAL(wp) :: ukomp !< |
---|
| 105 | REAL(wp) :: vkomp !< |
---|
| 106 | REAL(wp) :: wkomp !< |
---|
[1] | 107 | |
---|
[1320] | 108 | |
---|
[1] | 109 | DO i = nxl, nxr |
---|
[106] | 110 | DO j = nysv, nyn |
---|
[1] | 111 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
| 112 | ! |
---|
| 113 | !-- x-direction |
---|
[1353] | 114 | ukomp = 0.25_wp * ( u(k,j,i) + u(k,j-1,i) + & |
---|
[1] | 115 | u(k,j,i+1) + u(k,j-1,i+1) ) - u_gtrans |
---|
[1353] | 116 | IF ( ukomp > 0.0_wp ) THEN |
---|
[1320] | 117 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[1] | 118 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
| 119 | ELSE |
---|
[1320] | 120 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[1] | 121 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
| 122 | ENDIF |
---|
| 123 | ! |
---|
| 124 | !-- y-direction |
---|
| 125 | vkomp = v(k,j,i) - v_gtrans |
---|
[1353] | 126 | IF ( vkomp > 0.0_wp ) THEN |
---|
[1320] | 127 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[1] | 128 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
| 129 | ELSE |
---|
[1320] | 130 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[1] | 131 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
| 132 | ENDIF |
---|
| 133 | ! |
---|
| 134 | !-- z-direction |
---|
[1353] | 135 | wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + & |
---|
[1] | 136 | w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
[1353] | 137 | IF ( wkomp > 0.0_wp ) THEN |
---|
[1320] | 138 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
[1] | 139 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
| 140 | ELSE |
---|
[1320] | 141 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
[1] | 142 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
| 143 | ENDIF |
---|
| 144 | |
---|
| 145 | ENDDO |
---|
| 146 | ENDDO |
---|
| 147 | ENDDO |
---|
| 148 | |
---|
| 149 | END SUBROUTINE advec_v_up |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | !------------------------------------------------------------------------------! |
---|
[1682] | 153 | ! Description: |
---|
| 154 | ! ------------ |
---|
| 155 | !> Call for grid point i,j |
---|
[1] | 156 | !------------------------------------------------------------------------------! |
---|
| 157 | SUBROUTINE advec_v_up_ij( i, j ) |
---|
| 158 | |
---|
[1320] | 159 | USE arrays_3d, & |
---|
| 160 | ONLY: ddzu, tend, u, v, w |
---|
[1] | 161 | |
---|
[1320] | 162 | USE control_parameters, & |
---|
| 163 | ONLY: u_gtrans, v_gtrans |
---|
| 164 | |
---|
| 165 | USE grid_variables, & |
---|
| 166 | ONLY: ddx, ddy |
---|
| 167 | |
---|
| 168 | USE indices, & |
---|
| 169 | ONLY: nzb_v_inner, nzt |
---|
| 170 | |
---|
| 171 | USE kinds |
---|
| 172 | |
---|
| 173 | |
---|
[1] | 174 | IMPLICIT NONE |
---|
| 175 | |
---|
[1682] | 176 | INTEGER(iwp) :: i !< |
---|
| 177 | INTEGER(iwp) :: j !< |
---|
| 178 | INTEGER(iwp) :: k !< |
---|
[1] | 179 | |
---|
[1682] | 180 | REAL(wp) :: ukomp !< |
---|
| 181 | REAL(wp) :: vkomp !< |
---|
| 182 | REAL(wp) :: wkomp !< |
---|
[1] | 183 | |
---|
| 184 | |
---|
| 185 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
| 186 | ! |
---|
| 187 | !-- x-direction |
---|
[1353] | 188 | ukomp = 0.25_wp * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1) & |
---|
[1] | 189 | ) - u_gtrans |
---|
[1353] | 190 | IF ( ukomp > 0.0_wp ) THEN |
---|
[1320] | 191 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[1] | 192 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
| 193 | ELSE |
---|
[1320] | 194 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[1] | 195 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
| 196 | ENDIF |
---|
| 197 | ! |
---|
| 198 | !-- y-direction |
---|
| 199 | vkomp = v(k,j,i) - v_gtrans |
---|
[1353] | 200 | IF ( vkomp > 0.0_wp ) THEN |
---|
[1320] | 201 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[1] | 202 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
| 203 | ELSE |
---|
[1320] | 204 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[1] | 205 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
| 206 | ENDIF |
---|
| 207 | ! |
---|
| 208 | !-- z-direction |
---|
[1353] | 209 | wkomp = 0.25_wp * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
| 210 | IF ( wkomp > 0.0_wp ) THEN |
---|
[1320] | 211 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
[1] | 212 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
| 213 | ELSE |
---|
[1320] | 214 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
[1] | 215 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
| 216 | ENDIF |
---|
| 217 | |
---|
| 218 | ENDDO |
---|
| 219 | |
---|
| 220 | END SUBROUTINE advec_v_up_ij |
---|
| 221 | |
---|
| 222 | END MODULE advec_v_up_mod |
---|