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