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