[1873] | 1 | !> @file advec_v_pw.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | !------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of the PALM model system. |
---|
[1036] | 5 | ! |
---|
[2000] | 6 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
| 7 | ! terms of the GNU General Public License as published by the Free Software |
---|
| 8 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
| 9 | ! version. |
---|
[1036] | 10 | ! |
---|
| 11 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 12 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 13 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 14 | ! |
---|
| 15 | ! You should have received a copy of the GNU General Public License along with |
---|
| 16 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 17 | ! |
---|
[2718] | 18 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
[2000] | 19 | !------------------------------------------------------------------------------! |
---|
[1036] | 20 | ! |
---|
[484] | 21 | ! Current revisions: |
---|
[1] | 22 | ! ----------------- |
---|
[1354] | 23 | ! |
---|
[2233] | 24 | ! |
---|
[1321] | 25 | ! Former revisions: |
---|
| 26 | ! ----------------- |
---|
| 27 | ! $Id: advec_v_pw.f90 2718 2018-01-02 08:49:38Z sward $ |
---|
[2716] | 28 | ! Corrected "Former revisions" section |
---|
| 29 | ! |
---|
| 30 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 31 | ! Change in file header (GPL part) |
---|
[1321] | 32 | ! |
---|
[2716] | 33 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
| 34 | ! |
---|
[2233] | 35 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
| 36 | ! topography representation via flags |
---|
| 37 | ! |
---|
[2001] | 38 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 39 | ! Forced header and separation lines into 80 columns |
---|
| 40 | ! |
---|
[1874] | 41 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
| 42 | ! Module renamed (removed _mod) |
---|
| 43 | ! |
---|
| 44 | ! |
---|
[1851] | 45 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
| 46 | ! Module renamed |
---|
| 47 | ! |
---|
| 48 | ! |
---|
[1683] | 49 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 50 | ! Code annotations made doxygen readable |
---|
| 51 | ! |
---|
[1354] | 52 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 53 | ! REAL constants provided with KIND-attribute |
---|
| 54 | ! |
---|
[1321] | 55 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 56 | ! ONLY-attribute added to USE-statements, |
---|
| 57 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 58 | ! kinds are defined in new module kinds, |
---|
| 59 | ! revision history before 2012 removed, |
---|
| 60 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 61 | ! all variable declaration statements |
---|
[1] | 62 | ! |
---|
[1037] | 63 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 64 | ! code put under GPL (PALM 3.9) |
---|
| 65 | ! |
---|
[1] | 66 | ! Revision 1.1 1997/08/11 06:09:57 raasch |
---|
| 67 | ! Initial revision |
---|
| 68 | ! |
---|
| 69 | ! |
---|
| 70 | ! Description: |
---|
| 71 | ! ------------ |
---|
[1682] | 72 | !> Advection term for v velocity-component using Piacsek and Williams. |
---|
| 73 | !> Vertical advection at the first grid point above the surface is done with |
---|
| 74 | !> normal centred differences, because otherwise no information from the surface |
---|
| 75 | !> would be communicated upwards due to w=0 at K=nzb. |
---|
[1] | 76 | !------------------------------------------------------------------------------! |
---|
[1682] | 77 | MODULE advec_v_pw_mod |
---|
| 78 | |
---|
[1] | 79 | |
---|
| 80 | PRIVATE |
---|
| 81 | PUBLIC advec_v_pw |
---|
| 82 | |
---|
| 83 | INTERFACE advec_v_pw |
---|
| 84 | MODULE PROCEDURE advec_v_pw |
---|
| 85 | MODULE PROCEDURE advec_v_pw_ij |
---|
| 86 | END INTERFACE advec_v_pw |
---|
| 87 | |
---|
| 88 | CONTAINS |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | !------------------------------------------------------------------------------! |
---|
[1682] | 92 | ! Description: |
---|
| 93 | ! ------------ |
---|
| 94 | !> Call for all grid points |
---|
[1] | 95 | !------------------------------------------------------------------------------! |
---|
| 96 | SUBROUTINE advec_v_pw |
---|
| 97 | |
---|
[1320] | 98 | USE arrays_3d, & |
---|
| 99 | ONLY: ddzw, tend, u, v, w |
---|
[1] | 100 | |
---|
[1320] | 101 | USE control_parameters, & |
---|
| 102 | ONLY: u_gtrans, v_gtrans |
---|
| 103 | |
---|
| 104 | USE grid_variables, & |
---|
| 105 | ONLY: ddx, ddy |
---|
| 106 | |
---|
| 107 | USE indices, & |
---|
[2232] | 108 | ONLY: nxl, nxr, nyn, nysv, nzb, nzt, wall_flags_0 |
---|
[1320] | 109 | |
---|
| 110 | USE kinds |
---|
| 111 | |
---|
| 112 | |
---|
[1] | 113 | IMPLICIT NONE |
---|
| 114 | |
---|
[1682] | 115 | INTEGER(iwp) :: i !< |
---|
| 116 | INTEGER(iwp) :: j !< |
---|
| 117 | INTEGER(iwp) :: k !< |
---|
[1320] | 118 | |
---|
[1682] | 119 | REAL(wp) :: gu !< |
---|
| 120 | REAL(wp) :: gv !< |
---|
[1] | 121 | |
---|
| 122 | |
---|
[1353] | 123 | gu = 2.0_wp * u_gtrans |
---|
| 124 | gv = 2.0_wp * v_gtrans |
---|
[1] | 125 | DO i = nxl, nxr |
---|
[106] | 126 | DO j = nysv, nyn |
---|
[2232] | 127 | DO k = nzb+1, nzt |
---|
[1353] | 128 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
[1] | 129 | ( v(k,j,i+1) * ( u(k,j-1,i+1) + u(k,j,i+1) - gu ) & |
---|
| 130 | - v(k,j,i-1) * ( u(k,j-1,i) + u(k,j,i) - gu ) ) * ddx & |
---|
| 131 | + ( v(k,j+1,i) * ( v(k,j+1,i) + v(k,j,i) - gv ) & |
---|
| 132 | - v(k,j-1,i) * ( v(k,j,i) + v(k,j-1,i) - gv ) ) * ddy & |
---|
| 133 | + ( v(k+1,j,i) * ( w(k,j-1,i) + w(k,j,i) ) & |
---|
| 134 | - v(k-1,j,i) * ( w(k-1,j-1,i) + w(k-1,j,i) ) ) & |
---|
| 135 | * ddzw(k) & |
---|
[2232] | 136 | ) & |
---|
| 137 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 138 | BTEST( wall_flags_0(k,j,i), 2 ) ) |
---|
[1] | 139 | ENDDO |
---|
| 140 | ENDDO |
---|
| 141 | ENDDO |
---|
| 142 | |
---|
| 143 | END SUBROUTINE advec_v_pw |
---|
| 144 | |
---|
| 145 | |
---|
| 146 | !------------------------------------------------------------------------------! |
---|
[1682] | 147 | ! Description: |
---|
| 148 | ! ------------ |
---|
| 149 | !> Call for grid point i,j |
---|
[1] | 150 | !------------------------------------------------------------------------------! |
---|
| 151 | SUBROUTINE advec_v_pw_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, & |
---|
[2232] | 163 | ONLY: nzb, nzt, wall_flags_0 |
---|
[1320] | 164 | |
---|
| 165 | USE kinds |
---|
| 166 | |
---|
| 167 | |
---|
[1] | 168 | IMPLICIT NONE |
---|
| 169 | |
---|
[1682] | 170 | INTEGER(iwp) :: i !< |
---|
| 171 | INTEGER(iwp) :: j !< |
---|
| 172 | INTEGER(iwp) :: k !< |
---|
[1320] | 173 | |
---|
[1682] | 174 | REAL(wp) :: gu !< |
---|
| 175 | REAL(wp) :: gv !< |
---|
[1] | 176 | |
---|
| 177 | |
---|
[1353] | 178 | gu = 2.0_wp * u_gtrans |
---|
| 179 | gv = 2.0_wp * v_gtrans |
---|
[2232] | 180 | DO k = nzb+1, nzt |
---|
[1353] | 181 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
[1] | 182 | ( v(k,j,i+1) * ( u(k,j-1,i+1) + u(k,j,i+1) - gu ) & |
---|
| 183 | - v(k,j,i-1) * ( u(k,j-1,i) + u(k,j,i) - gu ) ) * ddx & |
---|
| 184 | + ( v(k,j+1,i) * ( v(k,j+1,i) + v(k,j,i) - gv ) & |
---|
| 185 | - v(k,j-1,i) * ( v(k,j,i) + v(k,j-1,i) - gv ) ) * ddy & |
---|
| 186 | + ( v(k+1,j,i) * ( w(k,j-1,i) + w(k,j,i) ) & |
---|
| 187 | - v(k-1,j,i) * ( w(k-1,j-1,i) + w(k-1,j,i) ) ) & |
---|
| 188 | * ddzw(k) & |
---|
[2232] | 189 | ) & |
---|
| 190 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 191 | BTEST( wall_flags_0(k,j,i), 2 ) ) |
---|
[1] | 192 | ENDDO |
---|
| 193 | |
---|
| 194 | END SUBROUTINE advec_v_pw_ij |
---|
| 195 | |
---|
| 196 | END MODULE advec_v_pw_mod |
---|
| 197 | |
---|