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