[1873] | 1 | !> @file advec_u_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_u_pw.f90 1874 2016-04-18 14:51:10Z suehring $ |
---|
| 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 | ! |
---|
[1354] | 38 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 39 | ! REAL constants provided with KIND-attribute |
---|
| 40 | ! |
---|
[1321] | 41 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 42 | ! ONLY-attribute added to USE-statements, |
---|
| 43 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 44 | ! kinds are defined in new module kinds, |
---|
| 45 | ! revision history before 2012 removed, |
---|
| 46 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 47 | ! all variable declaration statements |
---|
[1] | 48 | ! |
---|
[1037] | 49 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 50 | ! code put under GPL (PALM 3.9) |
---|
| 51 | ! |
---|
[1] | 52 | ! Revision 1.1 1997/08/11 06:09:21 raasch |
---|
| 53 | ! Initial revision |
---|
| 54 | ! |
---|
| 55 | ! |
---|
| 56 | ! Description: |
---|
| 57 | ! ------------ |
---|
[1682] | 58 | !> Advection term for u velocity-component using Piacsek and Williams. |
---|
| 59 | !> Vertical advection at the first grid point above the surface is done with |
---|
| 60 | !> normal centred differences, because otherwise no information from the surface |
---|
| 61 | !> would be communicated upwards due to w=0 at K=nzb. |
---|
[1] | 62 | !------------------------------------------------------------------------------! |
---|
[1682] | 63 | MODULE advec_u_pw_mod |
---|
| 64 | |
---|
[1] | 65 | |
---|
| 66 | PRIVATE |
---|
| 67 | PUBLIC advec_u_pw |
---|
| 68 | |
---|
| 69 | INTERFACE advec_u_pw |
---|
| 70 | MODULE PROCEDURE advec_u_pw |
---|
| 71 | MODULE PROCEDURE advec_u_pw_ij |
---|
| 72 | END INTERFACE advec_u_pw |
---|
| 73 | |
---|
| 74 | CONTAINS |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | !------------------------------------------------------------------------------! |
---|
[1682] | 78 | ! Description: |
---|
| 79 | ! ------------ |
---|
| 80 | !> Call for all grid points |
---|
[1] | 81 | !------------------------------------------------------------------------------! |
---|
| 82 | SUBROUTINE advec_u_pw |
---|
| 83 | |
---|
[1320] | 84 | USE arrays_3d, & |
---|
| 85 | ONLY: ddzw, 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, & |
---|
| 94 | ONLY: nxlu, nxr, nyn, nys, nzb_u_inner, nzt |
---|
| 95 | |
---|
| 96 | USE kinds |
---|
| 97 | |
---|
| 98 | |
---|
[1] | 99 | IMPLICIT NONE |
---|
| 100 | |
---|
[1682] | 101 | INTEGER(iwp) :: i !< |
---|
| 102 | INTEGER(iwp) :: j !< |
---|
| 103 | INTEGER(iwp) :: k !< |
---|
[1320] | 104 | |
---|
[1682] | 105 | REAL(wp) :: gu !< |
---|
| 106 | REAL(wp) :: gv !< |
---|
[1] | 107 | |
---|
[1353] | 108 | gu = 2.0_wp * u_gtrans |
---|
| 109 | gv = 2.0_wp * v_gtrans |
---|
[106] | 110 | DO i = nxlu, nxr |
---|
[1] | 111 | DO j = nys, nyn |
---|
| 112 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1353] | 113 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
[1] | 114 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
| 115 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
| 116 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
| 117 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
| 118 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
| 119 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) & |
---|
| 120 | * ddzw(k) & |
---|
[1353] | 121 | ) |
---|
[1] | 122 | ENDDO |
---|
| 123 | ENDDO |
---|
| 124 | ENDDO |
---|
| 125 | |
---|
| 126 | END SUBROUTINE advec_u_pw |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | !------------------------------------------------------------------------------! |
---|
[1682] | 130 | ! Description: |
---|
| 131 | ! ------------ |
---|
| 132 | !> Call for grid point i,j |
---|
[1] | 133 | !------------------------------------------------------------------------------! |
---|
| 134 | SUBROUTINE advec_u_pw_ij( i, j ) |
---|
| 135 | |
---|
[1320] | 136 | USE arrays_3d, & |
---|
| 137 | ONLY: ddzw, tend, u, v, w |
---|
[1] | 138 | |
---|
[1320] | 139 | USE control_parameters, & |
---|
| 140 | ONLY: u_gtrans, v_gtrans |
---|
| 141 | |
---|
| 142 | USE grid_variables, & |
---|
| 143 | ONLY: ddx, ddy |
---|
| 144 | |
---|
| 145 | USE indices, & |
---|
| 146 | ONLY: nzb_u_inner, nzt |
---|
| 147 | |
---|
| 148 | USE kinds |
---|
| 149 | |
---|
| 150 | |
---|
[1] | 151 | IMPLICIT NONE |
---|
| 152 | |
---|
[1682] | 153 | INTEGER(iwp) :: i !< |
---|
| 154 | INTEGER(iwp) :: j !< |
---|
| 155 | INTEGER(iwp) :: k !< |
---|
[1320] | 156 | |
---|
[1682] | 157 | REAL(wp) :: gu !< |
---|
| 158 | REAL(wp) :: gv !< |
---|
[1] | 159 | |
---|
[1353] | 160 | gu = 2.0_wp * u_gtrans |
---|
| 161 | gv = 2.0_wp * v_gtrans |
---|
[1] | 162 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1353] | 163 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
[1] | 164 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
| 165 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
| 166 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
| 167 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
| 168 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
| 169 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) & |
---|
| 170 | * ddzw(k) & |
---|
[1353] | 171 | ) |
---|
[1] | 172 | ENDDO |
---|
| 173 | |
---|
| 174 | END SUBROUTINE advec_u_pw_ij |
---|
| 175 | |
---|
| 176 | END MODULE advec_u_pw_mod |
---|