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