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