[1] | 1 | MODULE advec_u_pw_mod |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1321] | 22 | ! |
---|
| 23 | ! |
---|
| 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: advec_u_pw.f90 1321 2014-03-20 09:40:40Z maronga $ |
---|
| 27 | ! |
---|
| 28 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 29 | ! ONLY-attribute added to USE-statements, |
---|
| 30 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 31 | ! kinds are defined in new module kinds, |
---|
| 32 | ! revision history before 2012 removed, |
---|
| 33 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 34 | ! all variable declaration statements |
---|
[1] | 35 | ! |
---|
[1037] | 36 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 37 | ! code put under GPL (PALM 3.9) |
---|
| 38 | ! |
---|
[1] | 39 | ! Revision 1.1 1997/08/11 06:09:21 raasch |
---|
| 40 | ! Initial revision |
---|
| 41 | ! |
---|
| 42 | ! |
---|
| 43 | ! Description: |
---|
| 44 | ! ------------ |
---|
| 45 | ! Advection term for u velocity-component using Piacsek and Williams. |
---|
| 46 | ! Vertical advection at the first grid point above the surface is done with |
---|
| 47 | ! normal centred differences, because otherwise no information from the surface |
---|
| 48 | ! would be communicated upwards due to w=0 at K=nzb. |
---|
| 49 | !------------------------------------------------------------------------------! |
---|
| 50 | |
---|
| 51 | PRIVATE |
---|
| 52 | PUBLIC advec_u_pw |
---|
| 53 | |
---|
| 54 | INTERFACE advec_u_pw |
---|
| 55 | MODULE PROCEDURE advec_u_pw |
---|
| 56 | MODULE PROCEDURE advec_u_pw_ij |
---|
| 57 | END INTERFACE advec_u_pw |
---|
| 58 | |
---|
| 59 | CONTAINS |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | !------------------------------------------------------------------------------! |
---|
| 63 | ! Call for all grid points |
---|
| 64 | !------------------------------------------------------------------------------! |
---|
| 65 | SUBROUTINE advec_u_pw |
---|
| 66 | |
---|
[1320] | 67 | USE arrays_3d, & |
---|
| 68 | ONLY: ddzw, tend, u, v, w |
---|
[1] | 69 | |
---|
[1320] | 70 | USE control_parameters, & |
---|
| 71 | ONLY: u_gtrans, v_gtrans |
---|
| 72 | |
---|
| 73 | USE grid_variables, & |
---|
| 74 | ONLY: ddx, ddy |
---|
| 75 | |
---|
| 76 | USE indices, & |
---|
| 77 | ONLY: nxlu, nxr, nyn, nys, nzb_u_inner, nzt |
---|
| 78 | |
---|
| 79 | USE kinds |
---|
| 80 | |
---|
| 81 | |
---|
[1] | 82 | IMPLICIT NONE |
---|
| 83 | |
---|
[1320] | 84 | INTEGER(iwp) :: i !: |
---|
| 85 | INTEGER(iwp) :: j !: |
---|
| 86 | INTEGER(iwp) :: k !: |
---|
| 87 | |
---|
| 88 | REAL(wp) :: gu !: |
---|
| 89 | REAL(wp) :: gv !: |
---|
[1] | 90 | |
---|
| 91 | gu = 2.0 * u_gtrans |
---|
| 92 | gv = 2.0 * v_gtrans |
---|
[106] | 93 | DO i = nxlu, nxr |
---|
[1] | 94 | DO j = nys, nyn |
---|
| 95 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
| 96 | tend(k,j,i) = tend(k,j,i) - 0.25 * ( & |
---|
| 97 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
| 98 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
| 99 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
| 100 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
| 101 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
| 102 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) & |
---|
| 103 | * ddzw(k) & |
---|
| 104 | ) |
---|
| 105 | ENDDO |
---|
| 106 | ENDDO |
---|
| 107 | ENDDO |
---|
| 108 | |
---|
| 109 | END SUBROUTINE advec_u_pw |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | !------------------------------------------------------------------------------! |
---|
| 113 | ! Call for grid point i,j |
---|
| 114 | !------------------------------------------------------------------------------! |
---|
| 115 | SUBROUTINE advec_u_pw_ij( i, j ) |
---|
| 116 | |
---|
[1320] | 117 | USE arrays_3d, & |
---|
| 118 | ONLY: ddzw, tend, u, v, w |
---|
[1] | 119 | |
---|
[1320] | 120 | USE control_parameters, & |
---|
| 121 | ONLY: u_gtrans, v_gtrans |
---|
| 122 | |
---|
| 123 | USE grid_variables, & |
---|
| 124 | ONLY: ddx, ddy |
---|
| 125 | |
---|
| 126 | USE indices, & |
---|
| 127 | ONLY: nzb_u_inner, nzt |
---|
| 128 | |
---|
| 129 | USE kinds |
---|
| 130 | |
---|
| 131 | |
---|
[1] | 132 | IMPLICIT NONE |
---|
| 133 | |
---|
[1320] | 134 | INTEGER(iwp) :: i !: |
---|
| 135 | INTEGER(iwp) :: j !: |
---|
| 136 | INTEGER(iwp) :: k !: |
---|
| 137 | |
---|
| 138 | REAL(wp) :: gu !: |
---|
| 139 | REAL(wp) :: gv !: |
---|
[1] | 140 | |
---|
| 141 | gu = 2.0 * u_gtrans |
---|
| 142 | gv = 2.0 * v_gtrans |
---|
| 143 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
| 144 | tend(k,j,i) = tend(k,j,i) - 0.25 * ( & |
---|
| 145 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
| 146 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
| 147 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
| 148 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
| 149 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
| 150 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) & |
---|
| 151 | * ddzw(k) & |
---|
| 152 | ) |
---|
| 153 | ENDDO |
---|
| 154 | |
---|
| 155 | END SUBROUTINE advec_u_pw_ij |
---|
| 156 | |
---|
| 157 | END MODULE advec_u_pw_mod |
---|