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