[1873] | 1 | !> @file advec_s_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_s_pw.f90 2233 2017-05-30 18:08:54Z scharf $ |
---|
| 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 | ! |
---|
[1375] | 45 | ! 1374 2014-04-25 12:55:07Z raasch |
---|
| 46 | ! missing variables added to ONLY list |
---|
| 47 | ! |
---|
[1354] | 48 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 49 | ! REAL constants provided with KIND-attribute |
---|
| 50 | ! |
---|
[1321] | 51 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 52 | ! ONLY-attribute added to USE-statements, |
---|
| 53 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 54 | ! kinds are defined in new module kinds, |
---|
| 55 | ! revision history before 2012 removed, |
---|
| 56 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 57 | ! all variable declaration statements |
---|
[1] | 58 | ! |
---|
[1037] | 59 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 60 | ! code put under GPL (PALM 3.9) |
---|
| 61 | ! |
---|
[1011] | 62 | ! 1010 2012-09-20 07:59:54Z raasch |
---|
| 63 | ! cpp switch __nopointer added for pointer free version |
---|
| 64 | ! |
---|
[1] | 65 | ! Revision 1.1 1997/08/29 08:54:20 raasch |
---|
| 66 | ! Initial revision |
---|
| 67 | ! |
---|
| 68 | ! |
---|
| 69 | ! Description: |
---|
| 70 | ! ------------ |
---|
[1682] | 71 | !> Advection term for scalar variables using the Piacsek and Williams scheme |
---|
| 72 | !> (form C3). Contrary to PW itself, for reasons of accuracy their scheme is |
---|
| 73 | !> slightly modified as follows: the values of those scalars that are used for |
---|
| 74 | !> the computation of the flux divergence are reduced by the value of the |
---|
| 75 | !> relevant scalar at the location where the difference is computed (sk(k,j,i)). |
---|
| 76 | !> NOTE: at the first grid point above the surface computation still takes place! |
---|
[1] | 77 | !------------------------------------------------------------------------------! |
---|
[1682] | 78 | MODULE advec_s_pw_mod |
---|
| 79 | |
---|
[1] | 80 | |
---|
| 81 | PRIVATE |
---|
| 82 | PUBLIC advec_s_pw |
---|
| 83 | |
---|
| 84 | INTERFACE advec_s_pw |
---|
| 85 | MODULE PROCEDURE advec_s_pw |
---|
| 86 | MODULE PROCEDURE advec_s_pw_ij |
---|
| 87 | END INTERFACE |
---|
| 88 | |
---|
| 89 | CONTAINS |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | !------------------------------------------------------------------------------! |
---|
[1682] | 93 | ! Description: |
---|
| 94 | ! ------------ |
---|
| 95 | !> Call for all grid points |
---|
[1] | 96 | !------------------------------------------------------------------------------! |
---|
| 97 | SUBROUTINE advec_s_pw( sk ) |
---|
| 98 | |
---|
[1320] | 99 | USE arrays_3d, & |
---|
| 100 | ONLY: dd2zu, tend, u, v, w |
---|
[1] | 101 | |
---|
[1320] | 102 | USE control_parameters, & |
---|
| 103 | ONLY: u_gtrans, v_gtrans |
---|
| 104 | |
---|
| 105 | USE grid_variables, & |
---|
| 106 | ONLY: ddx, ddy |
---|
| 107 | |
---|
| 108 | USE indices, & |
---|
[2232] | 109 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, & |
---|
| 110 | nzt, wall_flags_0 |
---|
[1320] | 111 | |
---|
| 112 | USE kinds |
---|
| 113 | |
---|
| 114 | |
---|
[1] | 115 | IMPLICIT NONE |
---|
| 116 | |
---|
[1682] | 117 | INTEGER(iwp) :: i !< |
---|
| 118 | INTEGER(iwp) :: j !< |
---|
| 119 | INTEGER(iwp) :: k !< |
---|
[1] | 120 | |
---|
[1010] | 121 | #if defined( __nopointer ) |
---|
[1682] | 122 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk !< |
---|
[1010] | 123 | #else |
---|
[1320] | 124 | REAL(wp), DIMENSION(:,:,:), POINTER :: sk |
---|
[1010] | 125 | #endif |
---|
[1] | 126 | |
---|
| 127 | |
---|
| 128 | DO i = nxl, nxr |
---|
| 129 | DO j = nys, nyn |
---|
[2232] | 130 | DO k = nzb+1, nzt |
---|
| 131 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 132 | ( -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
[1353] | 133 | - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
| 134 | ) * ddx & |
---|
| 135 | -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
| 136 | - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
| 137 | ) * ddy & |
---|
| 138 | - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
| 139 | - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
[2232] | 140 | ) * dd2zu(k) & |
---|
| 141 | ) * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) ) |
---|
[1] | 142 | ENDDO |
---|
| 143 | ENDDO |
---|
| 144 | ENDDO |
---|
| 145 | |
---|
| 146 | END SUBROUTINE advec_s_pw |
---|
| 147 | |
---|
| 148 | |
---|
| 149 | !------------------------------------------------------------------------------! |
---|
[1682] | 150 | ! Description: |
---|
| 151 | ! ------------ |
---|
| 152 | !> Call for grid point i,j |
---|
[1] | 153 | !------------------------------------------------------------------------------! |
---|
| 154 | SUBROUTINE advec_s_pw_ij( i, j, sk ) |
---|
| 155 | |
---|
[1320] | 156 | USE arrays_3d, & |
---|
| 157 | ONLY: dd2zu, tend, u, v, w |
---|
[1] | 158 | |
---|
[1320] | 159 | USE control_parameters, & |
---|
| 160 | ONLY: u_gtrans, v_gtrans |
---|
| 161 | |
---|
| 162 | USE grid_variables, & |
---|
| 163 | ONLY: ddx, ddy |
---|
| 164 | |
---|
| 165 | USE indices, & |
---|
[2232] | 166 | ONLY: nxlg, nxrg, nyng, nysg, nzb, nzt, wall_flags_0 |
---|
[1320] | 167 | |
---|
| 168 | USE kinds |
---|
| 169 | |
---|
| 170 | |
---|
[1] | 171 | IMPLICIT NONE |
---|
| 172 | |
---|
[1682] | 173 | INTEGER(iwp) :: i !< |
---|
| 174 | INTEGER(iwp) :: j !< |
---|
| 175 | INTEGER(iwp) :: k !< |
---|
[1] | 176 | |
---|
[1010] | 177 | #if defined( __nopointer ) |
---|
[1682] | 178 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk !< |
---|
[1010] | 179 | #else |
---|
[1320] | 180 | REAL(wp), DIMENSION(:,:,:), POINTER :: sk |
---|
[1010] | 181 | #endif |
---|
[1] | 182 | |
---|
| 183 | |
---|
[2232] | 184 | DO k = nzb+1, nzt |
---|
| 185 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 186 | ( -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
[1353] | 187 | - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
| 188 | ) * ddx & |
---|
| 189 | -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
| 190 | - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
| 191 | ) * ddy & |
---|
| 192 | - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
| 193 | - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
[2232] | 194 | ) * dd2zu(k) & |
---|
| 195 | ) * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) ) |
---|
[1] | 196 | ENDDO |
---|
| 197 | |
---|
| 198 | END SUBROUTINE advec_s_pw_ij |
---|
| 199 | |
---|
| 200 | END MODULE advec_s_pw_mod |
---|