[1873] | 1 | !> @file advec_w_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_w_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:33 raasch |
---|
| 53 | ! Initial revision |
---|
| 54 | ! |
---|
| 55 | ! |
---|
| 56 | ! Description: |
---|
| 57 | ! ------------ |
---|
[1682] | 58 | !> Advection term for the w 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_w_up_mod |
---|
| 63 | |
---|
[1] | 64 | |
---|
| 65 | PRIVATE |
---|
| 66 | PUBLIC advec_w_up |
---|
| 67 | |
---|
| 68 | INTERFACE advec_w_up |
---|
| 69 | MODULE PROCEDURE advec_w_up |
---|
| 70 | MODULE PROCEDURE advec_w_up_ij |
---|
| 71 | END INTERFACE advec_w_up |
---|
| 72 | |
---|
| 73 | CONTAINS |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | !------------------------------------------------------------------------------! |
---|
[1682] | 77 | ! Description: |
---|
| 78 | ! ------------ |
---|
| 79 | !> Call for all grid points |
---|
[1] | 80 | !------------------------------------------------------------------------------! |
---|
| 81 | SUBROUTINE advec_w_up |
---|
| 82 | |
---|
[1320] | 83 | USE arrays_3d, & |
---|
| 84 | ONLY: ddzw, 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, nys, nzb_w_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 !< |
---|
[1] | 106 | |
---|
[1320] | 107 | |
---|
[1] | 108 | DO i = nxl, nxr |
---|
| 109 | DO j = nys, nyn |
---|
| 110 | DO k = nzb_w_inner(j,i)+1, nzt-1 |
---|
| 111 | ! |
---|
| 112 | !-- x-direction |
---|
[1353] | 113 | ukomp = 0.25_wp * ( u(k,j,i) + u(k,j,i+1) + & |
---|
[1] | 114 | u(k+1,j,i) + u(k+1,j,i+1) ) - u_gtrans |
---|
[1353] | 115 | IF ( ukomp > 0.0_wp ) THEN |
---|
[1320] | 116 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[1] | 117 | ( w(k,j,i) - w(k,j,i-1) ) * ddx |
---|
| 118 | ELSE |
---|
[1320] | 119 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[1] | 120 | ( w(k,j,i+1) - w(k,j,i) ) * ddx |
---|
| 121 | ENDIF |
---|
| 122 | ! |
---|
| 123 | !-- y-direction |
---|
[1353] | 124 | vkomp = 0.25_wp * ( v(k,j,i) + v(k,j+1,i) + & |
---|
[1] | 125 | v(k+1,j,i) + v(k+1,j+1,i) ) - v_gtrans |
---|
[1353] | 126 | IF ( vkomp > 0.0_wp ) THEN |
---|
[1320] | 127 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[1] | 128 | ( w(k,j,i) - w(k,j-1,i) ) * ddy |
---|
| 129 | ELSE |
---|
[1320] | 130 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[1] | 131 | ( w(k,j+1,i) - w(k,j,i) ) * ddy |
---|
| 132 | ENDIF |
---|
| 133 | ! |
---|
| 134 | !-- z-direction |
---|
[1353] | 135 | IF ( w(k,j,i) > 0.0_wp ) THEN |
---|
[1320] | 136 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
[1] | 137 | ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k) |
---|
| 138 | ELSE |
---|
[1320] | 139 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
[1] | 140 | ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) |
---|
| 141 | ENDIF |
---|
| 142 | |
---|
| 143 | ENDDO |
---|
| 144 | ENDDO |
---|
| 145 | ENDDO |
---|
| 146 | |
---|
| 147 | END SUBROUTINE advec_w_up |
---|
| 148 | |
---|
| 149 | |
---|
| 150 | !------------------------------------------------------------------------------! |
---|
[1682] | 151 | ! Description: |
---|
| 152 | ! ------------ |
---|
| 153 | !> Call for grid point i,j |
---|
[1] | 154 | !------------------------------------------------------------------------------! |
---|
| 155 | SUBROUTINE advec_w_up_ij( i, j ) |
---|
| 156 | |
---|
[1320] | 157 | USE arrays_3d, & |
---|
| 158 | ONLY: ddzw, tend, u, v, w |
---|
[1] | 159 | |
---|
[1320] | 160 | USE control_parameters, & |
---|
| 161 | ONLY: u_gtrans, v_gtrans |
---|
| 162 | |
---|
| 163 | USE grid_variables, & |
---|
| 164 | ONLY: ddx, ddy |
---|
| 165 | |
---|
| 166 | USE indices, & |
---|
| 167 | ONLY: nzb_w_inner, nzt |
---|
| 168 | |
---|
| 169 | USE kinds |
---|
| 170 | |
---|
| 171 | |
---|
[1] | 172 | IMPLICIT NONE |
---|
| 173 | |
---|
[1682] | 174 | INTEGER(iwp) :: i !< |
---|
| 175 | INTEGER(iwp) :: j !< |
---|
| 176 | INTEGER(iwp) :: k !< |
---|
[1] | 177 | |
---|
[1682] | 178 | REAL(wp) :: ukomp !< |
---|
| 179 | REAL(wp) :: vkomp !< |
---|
[1] | 180 | |
---|
[1320] | 181 | |
---|
[1] | 182 | DO k = nzb_w_inner(j,i)+1, nzt-1 |
---|
| 183 | ! |
---|
| 184 | !-- x-direction |
---|
[1353] | 185 | 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] | 186 | ) - u_gtrans |
---|
[1353] | 187 | IF ( ukomp > 0.0_wp ) THEN |
---|
[1320] | 188 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[1] | 189 | ( w(k,j,i) - w(k,j,i-1) ) * ddx |
---|
| 190 | ELSE |
---|
[1320] | 191 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
[1] | 192 | ( w(k,j,i+1) - w(k,j,i) ) * ddx |
---|
| 193 | ENDIF |
---|
| 194 | ! |
---|
| 195 | !-- y-direction |
---|
[1353] | 196 | 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] | 197 | ) - v_gtrans |
---|
[1353] | 198 | IF ( vkomp > 0.0_wp ) THEN |
---|
[1320] | 199 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[1] | 200 | ( w(k,j,i) - w(k,j-1,i) ) * ddy |
---|
| 201 | ELSE |
---|
[1320] | 202 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
[1] | 203 | ( w(k,j+1,i) - w(k,j,i) ) * ddy |
---|
| 204 | ENDIF |
---|
| 205 | ! |
---|
| 206 | !-- z-direction |
---|
[1353] | 207 | IF ( w(k,j,i) > 0.0_wp ) THEN |
---|
[1320] | 208 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
[1] | 209 | ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k) |
---|
| 210 | ELSE |
---|
[1320] | 211 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
[1] | 212 | ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) |
---|
| 213 | ENDIF |
---|
| 214 | |
---|
| 215 | ENDDO |
---|
| 216 | |
---|
| 217 | END SUBROUTINE advec_w_up_ij |
---|
| 218 | |
---|
| 219 | END MODULE advec_w_up_mod |
---|