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