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