[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 | ! |
---|
[2001] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: advec_s_pw.f90 2101 2017-01-05 16:42:31Z suehring $ |
---|
| 27 | ! |
---|
[2001] | 28 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 29 | ! Forced header and separation lines into 80 columns |
---|
| 30 | ! |
---|
[1874] | 31 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
| 32 | ! Module renamed (removed _mod) |
---|
| 33 | ! |
---|
| 34 | ! |
---|
[1851] | 35 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
| 36 | ! Module renamed |
---|
| 37 | ! |
---|
| 38 | ! |
---|
[1683] | 39 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 40 | ! Code annotations made doxygen readable |
---|
| 41 | ! |
---|
[1375] | 42 | ! 1374 2014-04-25 12:55:07Z raasch |
---|
| 43 | ! missing variables added to ONLY list |
---|
| 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 | ! |
---|
[1011] | 59 | ! 1010 2012-09-20 07:59:54Z raasch |
---|
| 60 | ! cpp switch __nopointer added for pointer free version |
---|
| 61 | ! |
---|
[1] | 62 | ! Revision 1.1 1997/08/29 08:54:20 raasch |
---|
| 63 | ! Initial revision |
---|
| 64 | ! |
---|
| 65 | ! |
---|
| 66 | ! Description: |
---|
| 67 | ! ------------ |
---|
[1682] | 68 | !> Advection term for scalar variables using the Piacsek and Williams scheme |
---|
| 69 | !> (form C3). Contrary to PW itself, for reasons of accuracy their scheme is |
---|
| 70 | !> slightly modified as follows: the values of those scalars that are used for |
---|
| 71 | !> the computation of the flux divergence are reduced by the value of the |
---|
| 72 | !> relevant scalar at the location where the difference is computed (sk(k,j,i)). |
---|
| 73 | !> NOTE: at the first grid point above the surface computation still takes place! |
---|
[1] | 74 | !------------------------------------------------------------------------------! |
---|
[1682] | 75 | MODULE advec_s_pw_mod |
---|
| 76 | |
---|
[1] | 77 | |
---|
| 78 | PRIVATE |
---|
| 79 | PUBLIC advec_s_pw |
---|
| 80 | |
---|
| 81 | INTERFACE advec_s_pw |
---|
| 82 | MODULE PROCEDURE advec_s_pw |
---|
| 83 | MODULE PROCEDURE advec_s_pw_ij |
---|
| 84 | END INTERFACE |
---|
| 85 | |
---|
| 86 | CONTAINS |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | !------------------------------------------------------------------------------! |
---|
[1682] | 90 | ! Description: |
---|
| 91 | ! ------------ |
---|
| 92 | !> Call for all grid points |
---|
[1] | 93 | !------------------------------------------------------------------------------! |
---|
| 94 | SUBROUTINE advec_s_pw( sk ) |
---|
| 95 | |
---|
[1320] | 96 | USE arrays_3d, & |
---|
| 97 | ONLY: dd2zu, tend, u, v, w |
---|
[1] | 98 | |
---|
[1320] | 99 | USE control_parameters, & |
---|
| 100 | ONLY: u_gtrans, v_gtrans |
---|
| 101 | |
---|
| 102 | USE grid_variables, & |
---|
| 103 | ONLY: ddx, ddy |
---|
| 104 | |
---|
| 105 | USE indices, & |
---|
[1374] | 106 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzb_s_inner,& |
---|
| 107 | nzt |
---|
[1320] | 108 | |
---|
| 109 | USE kinds |
---|
| 110 | |
---|
| 111 | |
---|
[1] | 112 | IMPLICIT NONE |
---|
| 113 | |
---|
[1682] | 114 | INTEGER(iwp) :: i !< |
---|
| 115 | INTEGER(iwp) :: j !< |
---|
| 116 | INTEGER(iwp) :: k !< |
---|
[1] | 117 | |
---|
[1010] | 118 | #if defined( __nopointer ) |
---|
[1682] | 119 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk !< |
---|
[1010] | 120 | #else |
---|
[1320] | 121 | REAL(wp), DIMENSION(:,:,:), POINTER :: sk |
---|
[1010] | 122 | #endif |
---|
[1] | 123 | |
---|
| 124 | |
---|
| 125 | DO i = nxl, nxr |
---|
| 126 | DO j = nys, nyn |
---|
[19] | 127 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
[1] | 128 | tend(k,j,i) = tend(k,j,i) & |
---|
[1353] | 129 | -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
| 130 | - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
| 131 | ) * ddx & |
---|
| 132 | -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
| 133 | - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
| 134 | ) * ddy & |
---|
| 135 | - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
| 136 | - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
| 137 | ) * dd2zu(k) |
---|
[1] | 138 | ENDDO |
---|
| 139 | ENDDO |
---|
| 140 | ENDDO |
---|
| 141 | |
---|
| 142 | END SUBROUTINE advec_s_pw |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | !------------------------------------------------------------------------------! |
---|
[1682] | 146 | ! Description: |
---|
| 147 | ! ------------ |
---|
| 148 | !> Call for grid point i,j |
---|
[1] | 149 | !------------------------------------------------------------------------------! |
---|
| 150 | SUBROUTINE advec_s_pw_ij( i, j, sk ) |
---|
| 151 | |
---|
[1320] | 152 | USE arrays_3d, & |
---|
| 153 | ONLY: dd2zu, tend, u, v, w |
---|
[1] | 154 | |
---|
[1320] | 155 | USE control_parameters, & |
---|
| 156 | ONLY: u_gtrans, v_gtrans |
---|
| 157 | |
---|
| 158 | USE grid_variables, & |
---|
| 159 | ONLY: ddx, ddy |
---|
| 160 | |
---|
| 161 | USE indices, & |
---|
[1374] | 162 | ONLY: nxlg, nxrg, nyng, nysg, nzb, nzb_s_inner, nzt |
---|
[1320] | 163 | |
---|
| 164 | USE kinds |
---|
| 165 | |
---|
| 166 | |
---|
[1] | 167 | IMPLICIT NONE |
---|
| 168 | |
---|
[1682] | 169 | INTEGER(iwp) :: i !< |
---|
| 170 | INTEGER(iwp) :: j !< |
---|
| 171 | INTEGER(iwp) :: k !< |
---|
[1] | 172 | |
---|
[1010] | 173 | #if defined( __nopointer ) |
---|
[1682] | 174 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk !< |
---|
[1010] | 175 | #else |
---|
[1320] | 176 | REAL(wp), DIMENSION(:,:,:), POINTER :: sk |
---|
[1010] | 177 | #endif |
---|
[1] | 178 | |
---|
| 179 | |
---|
[19] | 180 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
[1] | 181 | tend(k,j,i) = tend(k,j,i) & |
---|
[1353] | 182 | -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
| 183 | - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
| 184 | ) * ddx & |
---|
| 185 | -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
| 186 | - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
| 187 | ) * ddy & |
---|
| 188 | - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
| 189 | - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
| 190 | ) * dd2zu(k) |
---|
[1] | 191 | ENDDO |
---|
| 192 | |
---|
| 193 | END SUBROUTINE advec_s_pw_ij |
---|
| 194 | |
---|
| 195 | END MODULE advec_s_pw_mod |
---|