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