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