[1873] | 1 | !> @file advec_s_pw.f90 |
---|
[1036] | 2 | !--------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 7 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 8 | ! |
---|
| 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 12 | ! |
---|
| 13 | ! You should have received a copy of the GNU General Public License along with |
---|
| 14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 15 | ! |
---|
[1818] | 16 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
[1036] | 17 | !--------------------------------------------------------------------------------! |
---|
| 18 | ! |
---|
[484] | 19 | ! Current revisions: |
---|
[1] | 20 | ! ----------------- |
---|
[1354] | 21 | ! |
---|
[1683] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: advec_s_pw.f90 1874 2016-04-18 14:51:10Z hoffmann $ |
---|
| 26 | ! |
---|
[1874] | 27 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
| 28 | ! Module renamed (removed _mod) |
---|
| 29 | ! |
---|
| 30 | ! |
---|
[1851] | 31 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
| 32 | ! Module renamed |
---|
| 33 | ! |
---|
| 34 | ! |
---|
[1683] | 35 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 36 | ! Code annotations made doxygen readable |
---|
| 37 | ! |
---|
[1375] | 38 | ! 1374 2014-04-25 12:55:07Z raasch |
---|
| 39 | ! missing variables added to ONLY list |
---|
| 40 | ! |
---|
[1354] | 41 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 42 | ! REAL constants provided with KIND-attribute |
---|
| 43 | ! |
---|
[1321] | 44 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 45 | ! ONLY-attribute added to USE-statements, |
---|
| 46 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 47 | ! kinds are defined in new module kinds, |
---|
| 48 | ! revision history before 2012 removed, |
---|
| 49 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 50 | ! all variable declaration statements |
---|
[1] | 51 | ! |
---|
[1037] | 52 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 53 | ! code put under GPL (PALM 3.9) |
---|
| 54 | ! |
---|
[1011] | 55 | ! 1010 2012-09-20 07:59:54Z raasch |
---|
| 56 | ! cpp switch __nopointer added for pointer free version |
---|
| 57 | ! |
---|
[1] | 58 | ! Revision 1.1 1997/08/29 08:54:20 raasch |
---|
| 59 | ! Initial revision |
---|
| 60 | ! |
---|
| 61 | ! |
---|
| 62 | ! Description: |
---|
| 63 | ! ------------ |
---|
[1682] | 64 | !> Advection term for scalar variables using the Piacsek and Williams scheme |
---|
| 65 | !> (form C3). Contrary to PW itself, for reasons of accuracy their scheme is |
---|
| 66 | !> slightly modified as follows: the values of those scalars that are used for |
---|
| 67 | !> the computation of the flux divergence are reduced by the value of the |
---|
| 68 | !> relevant scalar at the location where the difference is computed (sk(k,j,i)). |
---|
| 69 | !> NOTE: at the first grid point above the surface computation still takes place! |
---|
[1] | 70 | !------------------------------------------------------------------------------! |
---|
[1682] | 71 | MODULE advec_s_pw_mod |
---|
| 72 | |
---|
[1] | 73 | |
---|
| 74 | PRIVATE |
---|
| 75 | PUBLIC advec_s_pw |
---|
| 76 | |
---|
| 77 | INTERFACE advec_s_pw |
---|
| 78 | MODULE PROCEDURE advec_s_pw |
---|
| 79 | MODULE PROCEDURE advec_s_pw_ij |
---|
| 80 | END INTERFACE |
---|
| 81 | |
---|
| 82 | CONTAINS |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | !------------------------------------------------------------------------------! |
---|
[1682] | 86 | ! Description: |
---|
| 87 | ! ------------ |
---|
| 88 | !> Call for all grid points |
---|
[1] | 89 | !------------------------------------------------------------------------------! |
---|
| 90 | SUBROUTINE advec_s_pw( sk ) |
---|
| 91 | |
---|
[1320] | 92 | USE arrays_3d, & |
---|
| 93 | ONLY: dd2zu, tend, u, v, w |
---|
[1] | 94 | |
---|
[1320] | 95 | USE control_parameters, & |
---|
| 96 | ONLY: u_gtrans, v_gtrans |
---|
| 97 | |
---|
| 98 | USE grid_variables, & |
---|
| 99 | ONLY: ddx, ddy |
---|
| 100 | |
---|
| 101 | USE indices, & |
---|
[1374] | 102 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzb_s_inner,& |
---|
| 103 | nzt |
---|
[1320] | 104 | |
---|
| 105 | USE kinds |
---|
| 106 | |
---|
| 107 | |
---|
[1] | 108 | IMPLICIT NONE |
---|
| 109 | |
---|
[1682] | 110 | INTEGER(iwp) :: i !< |
---|
| 111 | INTEGER(iwp) :: j !< |
---|
| 112 | INTEGER(iwp) :: k !< |
---|
[1] | 113 | |
---|
[1010] | 114 | #if defined( __nopointer ) |
---|
[1682] | 115 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk !< |
---|
[1010] | 116 | #else |
---|
[1320] | 117 | REAL(wp), DIMENSION(:,:,:), POINTER :: sk |
---|
[1010] | 118 | #endif |
---|
[1] | 119 | |
---|
| 120 | |
---|
| 121 | DO i = nxl, nxr |
---|
| 122 | DO j = nys, nyn |
---|
[19] | 123 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
[1] | 124 | tend(k,j,i) = tend(k,j,i) & |
---|
[1353] | 125 | -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
| 126 | - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
| 127 | ) * ddx & |
---|
| 128 | -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
| 129 | - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
| 130 | ) * ddy & |
---|
| 131 | - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
| 132 | - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
| 133 | ) * dd2zu(k) |
---|
[1] | 134 | ENDDO |
---|
| 135 | ENDDO |
---|
| 136 | ENDDO |
---|
| 137 | |
---|
| 138 | END SUBROUTINE advec_s_pw |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | !------------------------------------------------------------------------------! |
---|
[1682] | 142 | ! Description: |
---|
| 143 | ! ------------ |
---|
| 144 | !> Call for grid point i,j |
---|
[1] | 145 | !------------------------------------------------------------------------------! |
---|
| 146 | SUBROUTINE advec_s_pw_ij( i, j, sk ) |
---|
| 147 | |
---|
[1320] | 148 | USE arrays_3d, & |
---|
| 149 | ONLY: dd2zu, tend, u, v, w |
---|
[1] | 150 | |
---|
[1320] | 151 | USE control_parameters, & |
---|
| 152 | ONLY: u_gtrans, v_gtrans |
---|
| 153 | |
---|
| 154 | USE grid_variables, & |
---|
| 155 | ONLY: ddx, ddy |
---|
| 156 | |
---|
| 157 | USE indices, & |
---|
[1374] | 158 | ONLY: nxlg, nxrg, nyng, nysg, nzb, nzb_s_inner, nzt |
---|
[1320] | 159 | |
---|
| 160 | USE kinds |
---|
| 161 | |
---|
| 162 | |
---|
[1] | 163 | IMPLICIT NONE |
---|
| 164 | |
---|
[1682] | 165 | INTEGER(iwp) :: i !< |
---|
| 166 | INTEGER(iwp) :: j !< |
---|
| 167 | INTEGER(iwp) :: k !< |
---|
[1] | 168 | |
---|
[1010] | 169 | #if defined( __nopointer ) |
---|
[1682] | 170 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk !< |
---|
[1010] | 171 | #else |
---|
[1320] | 172 | REAL(wp), DIMENSION(:,:,:), POINTER :: sk |
---|
[1010] | 173 | #endif |
---|
[1] | 174 | |
---|
| 175 | |
---|
[19] | 176 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
[1] | 177 | tend(k,j,i) = tend(k,j,i) & |
---|
[1353] | 178 | -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
| 179 | - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
| 180 | ) * ddx & |
---|
| 181 | -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
| 182 | - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
| 183 | ) * ddy & |
---|
| 184 | - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
| 185 | - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
| 186 | ) * dd2zu(k) |
---|
[1] | 187 | ENDDO |
---|
| 188 | |
---|
| 189 | END SUBROUTINE advec_s_pw_ij |
---|
| 190 | |
---|
| 191 | END MODULE advec_s_pw_mod |
---|