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