[1682] | 1 | !> @file advec_w_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_w_pw.f90 1818 2016-04-06 15:53:27Z maronga $ |
---|
| 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:10:29 raasch |
---|
| 45 | ! Initial revision |
---|
| 46 | ! |
---|
| 47 | ! |
---|
| 48 | ! Description: |
---|
| 49 | ! ------------ |
---|
[1682] | 50 | !> Advection term for w 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_w_pw_mod |
---|
| 56 | |
---|
[1] | 57 | |
---|
| 58 | PRIVATE |
---|
| 59 | PUBLIC advec_w_pw |
---|
| 60 | |
---|
| 61 | INTERFACE advec_w_pw |
---|
| 62 | MODULE PROCEDURE advec_w_pw |
---|
| 63 | MODULE PROCEDURE advec_w_pw_ij |
---|
| 64 | END INTERFACE advec_w_pw |
---|
| 65 | |
---|
| 66 | CONTAINS |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | !------------------------------------------------------------------------------! |
---|
[1682] | 70 | ! Description: |
---|
| 71 | ! ------------ |
---|
| 72 | !> Call for all grid points |
---|
[1] | 73 | !------------------------------------------------------------------------------! |
---|
| 74 | SUBROUTINE advec_w_pw |
---|
| 75 | |
---|
[1320] | 76 | USE arrays_3d, & |
---|
| 77 | ONLY: ddzu, 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: nxl, nxr, nyn, nys, nzb_w_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 | |
---|
| 100 | |
---|
[1353] | 101 | gu = 2.0_wp * u_gtrans |
---|
| 102 | gv = 2.0_wp * v_gtrans |
---|
[1] | 103 | DO i = nxl, nxr |
---|
| 104 | DO j = nys, nyn |
---|
| 105 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
[1353] | 106 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
[1] | 107 | ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu ) & |
---|
| 108 | - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx & |
---|
| 109 | + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv ) & |
---|
| 110 | - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy & |
---|
| 111 | + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) ) & |
---|
| 112 | - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) ) & |
---|
| 113 | * ddzu(k+1) & |
---|
[1353] | 114 | ) |
---|
[1] | 115 | ENDDO |
---|
| 116 | ENDDO |
---|
| 117 | ENDDO |
---|
| 118 | |
---|
| 119 | END SUBROUTINE advec_w_pw |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | !------------------------------------------------------------------------------! |
---|
[1682] | 123 | ! Description: |
---|
| 124 | ! ------------ |
---|
| 125 | !> Call for grid point i,j |
---|
[1] | 126 | !------------------------------------------------------------------------------! |
---|
| 127 | SUBROUTINE advec_w_pw_ij( i, j ) |
---|
| 128 | |
---|
[1320] | 129 | USE arrays_3d, & |
---|
| 130 | ONLY: ddzu, tend, u, v, w |
---|
[1] | 131 | |
---|
[1320] | 132 | USE control_parameters, & |
---|
| 133 | ONLY: u_gtrans, v_gtrans |
---|
| 134 | |
---|
| 135 | USE grid_variables, & |
---|
| 136 | ONLY: ddx, ddy |
---|
| 137 | |
---|
| 138 | USE indices, & |
---|
| 139 | ONLY: nzb_w_inner, nzt |
---|
| 140 | |
---|
| 141 | USE kinds |
---|
| 142 | |
---|
| 143 | |
---|
[1] | 144 | IMPLICIT NONE |
---|
| 145 | |
---|
[1682] | 146 | INTEGER(iwp) :: i !< |
---|
| 147 | INTEGER(iwp) :: j !< |
---|
| 148 | INTEGER(iwp) :: k !< |
---|
[1320] | 149 | |
---|
[1682] | 150 | REAL(wp) :: gu !< |
---|
| 151 | REAL(wp) :: gv !< |
---|
[1] | 152 | |
---|
[1353] | 153 | gu = 2.0_wp * u_gtrans |
---|
| 154 | gv = 2.0_wp * v_gtrans |
---|
[1] | 155 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
[1353] | 156 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
[1] | 157 | ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu ) & |
---|
| 158 | - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx & |
---|
| 159 | + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv ) & |
---|
| 160 | - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy & |
---|
| 161 | + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) ) & |
---|
| 162 | - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) ) & |
---|
| 163 | * ddzu(k+1) & |
---|
| 164 | ) |
---|
| 165 | ENDDO |
---|
| 166 | END SUBROUTINE advec_w_pw_ij |
---|
| 167 | |
---|
| 168 | END MODULE advec_w_pw_mod |
---|