[1] | 1 | MODULE advec_w_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_w_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:10:29 raasch |
---|
| 40 | ! Initial revision |
---|
| 41 | ! |
---|
| 42 | ! |
---|
| 43 | ! Description: |
---|
| 44 | ! ------------ |
---|
| 45 | ! Advection term for w 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_w_pw |
---|
| 53 | |
---|
| 54 | INTERFACE advec_w_pw |
---|
| 55 | MODULE PROCEDURE advec_w_pw |
---|
| 56 | MODULE PROCEDURE advec_w_pw_ij |
---|
| 57 | END INTERFACE advec_w_pw |
---|
| 58 | |
---|
| 59 | CONTAINS |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | !------------------------------------------------------------------------------! |
---|
| 63 | ! Call for all grid points |
---|
| 64 | !------------------------------------------------------------------------------! |
---|
| 65 | SUBROUTINE advec_w_pw |
---|
| 66 | |
---|
[1320] | 67 | USE arrays_3d, & |
---|
| 68 | ONLY: ddzu, 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: nxl, nxr, nyn, nys, nzb_w_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 | |
---|
| 92 | gu = 2.0 * u_gtrans |
---|
| 93 | gv = 2.0 * v_gtrans |
---|
| 94 | DO i = nxl, nxr |
---|
| 95 | DO j = nys, nyn |
---|
| 96 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
| 97 | tend(k,j,i) = tend(k,j,i) - 0.25 * ( & |
---|
| 98 | ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu ) & |
---|
| 99 | - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx & |
---|
| 100 | + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv ) & |
---|
| 101 | - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy & |
---|
| 102 | + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) ) & |
---|
| 103 | - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) ) & |
---|
| 104 | * ddzu(k+1) & |
---|
| 105 | ) |
---|
| 106 | ENDDO |
---|
| 107 | ENDDO |
---|
| 108 | ENDDO |
---|
| 109 | |
---|
| 110 | END SUBROUTINE advec_w_pw |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | !------------------------------------------------------------------------------! |
---|
| 114 | ! Call for grid point i,j |
---|
| 115 | !------------------------------------------------------------------------------! |
---|
| 116 | SUBROUTINE advec_w_pw_ij( i, j ) |
---|
| 117 | |
---|
[1320] | 118 | USE arrays_3d, & |
---|
| 119 | ONLY: ddzu, tend, u, v, w |
---|
[1] | 120 | |
---|
[1320] | 121 | USE control_parameters, & |
---|
| 122 | ONLY: u_gtrans, v_gtrans |
---|
| 123 | |
---|
| 124 | USE grid_variables, & |
---|
| 125 | ONLY: ddx, ddy |
---|
| 126 | |
---|
| 127 | USE indices, & |
---|
| 128 | ONLY: nzb_w_inner, nzt |
---|
| 129 | |
---|
| 130 | USE kinds |
---|
| 131 | |
---|
| 132 | |
---|
[1] | 133 | IMPLICIT NONE |
---|
| 134 | |
---|
[1320] | 135 | INTEGER(iwp) :: i !: |
---|
| 136 | INTEGER(iwp) :: j !: |
---|
| 137 | INTEGER(iwp) :: k !: |
---|
| 138 | |
---|
| 139 | REAL(wp) :: gu !: |
---|
| 140 | REAL(wp) :: gv !: |
---|
[1] | 141 | |
---|
| 142 | gu = 2.0 * u_gtrans |
---|
| 143 | gv = 2.0 * v_gtrans |
---|
| 144 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
[1320] | 145 | tend(k,j,i) = tend(k,j,i) - 0.25 * ( & |
---|
[1] | 146 | ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu ) & |
---|
| 147 | - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx & |
---|
| 148 | + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv ) & |
---|
| 149 | - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy & |
---|
| 150 | + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) ) & |
---|
| 151 | - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) ) & |
---|
| 152 | * ddzu(k+1) & |
---|
| 153 | ) |
---|
| 154 | ENDDO |
---|
| 155 | END SUBROUTINE advec_w_pw_ij |
---|
| 156 | |
---|
| 157 | END MODULE advec_w_pw_mod |
---|