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