1 | !> @file advec_u_pw.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
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. |
---|
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 | ! |
---|
17 | ! Copyright 1997-2019 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: advec_u_pw.f90 3655 2019-01-07 16:51:22Z suehring $ |
---|
27 | ! variables documented |
---|
28 | ! |
---|
29 | ! 3538 2018-11-20 10:55:41Z suehring |
---|
30 | ! Remove unnecessary double-masking of topography |
---|
31 | ! |
---|
32 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
33 | ! Corrected "Former revisions" section |
---|
34 | ! |
---|
35 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
36 | ! Change in file header (GPL part) |
---|
37 | ! |
---|
38 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
39 | ! |
---|
40 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
41 | ! topography representation via flags |
---|
42 | ! |
---|
43 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
44 | ! Forced header and separation lines into 80 columns |
---|
45 | ! |
---|
46 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
47 | ! Module renamed (removed _mod) |
---|
48 | ! |
---|
49 | ! |
---|
50 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
51 | ! Module renamed |
---|
52 | ! |
---|
53 | ! |
---|
54 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
55 | ! Code annotations made doxygen readable |
---|
56 | ! |
---|
57 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
58 | ! REAL constants provided with KIND-attribute |
---|
59 | ! |
---|
60 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
61 | ! ONLY-attribute added to USE-statements, |
---|
62 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
63 | ! kinds are defined in new module kinds, |
---|
64 | ! revision history before 2012 removed, |
---|
65 | ! comment fields (!:) to be used for variable explanations added to |
---|
66 | ! all variable declaration statements |
---|
67 | ! |
---|
68 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
69 | ! code put under GPL (PALM 3.9) |
---|
70 | ! |
---|
71 | ! Revision 1.1 1997/08/11 06:09:21 raasch |
---|
72 | ! Initial revision |
---|
73 | ! |
---|
74 | ! |
---|
75 | ! Description: |
---|
76 | ! ------------ |
---|
77 | !> Advection term for u velocity-component using Piacsek and Williams. |
---|
78 | !> Vertical advection at the first grid point above the surface is done with |
---|
79 | !> normal centred differences, because otherwise no information from the surface |
---|
80 | !> would be communicated upwards due to w=0 at K=nzb. |
---|
81 | !------------------------------------------------------------------------------! |
---|
82 | MODULE advec_u_pw_mod |
---|
83 | |
---|
84 | |
---|
85 | PRIVATE |
---|
86 | PUBLIC advec_u_pw |
---|
87 | |
---|
88 | INTERFACE advec_u_pw |
---|
89 | MODULE PROCEDURE advec_u_pw |
---|
90 | MODULE PROCEDURE advec_u_pw_ij |
---|
91 | END INTERFACE advec_u_pw |
---|
92 | |
---|
93 | CONTAINS |
---|
94 | |
---|
95 | |
---|
96 | !------------------------------------------------------------------------------! |
---|
97 | ! Description: |
---|
98 | ! ------------ |
---|
99 | !> Call for all grid points |
---|
100 | !------------------------------------------------------------------------------! |
---|
101 | SUBROUTINE advec_u_pw |
---|
102 | |
---|
103 | USE arrays_3d, & |
---|
104 | ONLY: ddzw, tend, u, v, w |
---|
105 | |
---|
106 | USE control_parameters, & |
---|
107 | ONLY: u_gtrans, v_gtrans |
---|
108 | |
---|
109 | USE grid_variables, & |
---|
110 | ONLY: ddx, ddy |
---|
111 | |
---|
112 | USE indices, & |
---|
113 | ONLY: nxlu, nxr, nyn, nys, nzb, nzt |
---|
114 | |
---|
115 | USE kinds |
---|
116 | |
---|
117 | |
---|
118 | IMPLICIT NONE |
---|
119 | |
---|
120 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
121 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
122 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
123 | |
---|
124 | REAL(wp) :: gu !< Galilei-transformation velocity along x |
---|
125 | REAL(wp) :: gv !< Galilei-transformation velocity along y |
---|
126 | |
---|
127 | gu = 2.0_wp * u_gtrans |
---|
128 | gv = 2.0_wp * v_gtrans |
---|
129 | DO i = nxlu, nxr |
---|
130 | DO j = nys, nyn |
---|
131 | DO k = nzb+1, nzt |
---|
132 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
133 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
134 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
135 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
136 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
137 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
138 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) & |
---|
139 | * ddzw(k) & |
---|
140 | ) |
---|
141 | ENDDO |
---|
142 | ENDDO |
---|
143 | ENDDO |
---|
144 | |
---|
145 | END SUBROUTINE advec_u_pw |
---|
146 | |
---|
147 | |
---|
148 | !------------------------------------------------------------------------------! |
---|
149 | ! Description: |
---|
150 | ! ------------ |
---|
151 | !> Call for grid point i,j |
---|
152 | !------------------------------------------------------------------------------! |
---|
153 | SUBROUTINE advec_u_pw_ij( i, j ) |
---|
154 | |
---|
155 | USE arrays_3d, & |
---|
156 | ONLY: ddzw, tend, u, v, w |
---|
157 | |
---|
158 | USE control_parameters, & |
---|
159 | ONLY: u_gtrans, v_gtrans |
---|
160 | |
---|
161 | USE grid_variables, & |
---|
162 | ONLY: ddx, ddy |
---|
163 | |
---|
164 | USE indices, & |
---|
165 | ONLY: nzb, nzt |
---|
166 | |
---|
167 | USE kinds |
---|
168 | |
---|
169 | |
---|
170 | IMPLICIT NONE |
---|
171 | |
---|
172 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
173 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
174 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
175 | |
---|
176 | REAL(wp) :: gu !< Galilei-transformation velocity along x |
---|
177 | REAL(wp) :: gv !< Galilei-transformation velocity along y |
---|
178 | |
---|
179 | gu = 2.0_wp * u_gtrans |
---|
180 | gv = 2.0_wp * v_gtrans |
---|
181 | DO k = nzb+1, nzt |
---|
182 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
183 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
184 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
185 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
186 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
187 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
188 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) & |
---|
189 | * ddzw(k) & |
---|
190 | ) |
---|
191 | ENDDO |
---|
192 | |
---|
193 | END SUBROUTINE advec_u_pw_ij |
---|
194 | |
---|
195 | END MODULE advec_u_pw_mod |
---|