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