1 | !> @file advec_v_pw.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | !------------------------------------------------------------------------------! |
---|
4 | ! This file is part of the PALM model system. |
---|
5 | ! |
---|
6 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
7 | ! terms of the GNU General Public License as published by the Free Software |
---|
8 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
9 | ! version. |
---|
10 | ! |
---|
11 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
12 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
13 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
14 | ! |
---|
15 | ! You should have received a copy of the GNU General Public License along with |
---|
16 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
17 | ! |
---|
18 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
19 | !------------------------------------------------------------------------------! |
---|
20 | ! |
---|
21 | ! Current revisions: |
---|
22 | ! ----------------- |
---|
23 | ! |
---|
24 | ! |
---|
25 | ! Former revisions: |
---|
26 | ! ----------------- |
---|
27 | ! $Id: advec_v_pw.f90 2718 2018-01-02 08:49:38Z knoop $ |
---|
28 | ! Corrected "Former revisions" section |
---|
29 | ! |
---|
30 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
31 | ! Change in file header (GPL part) |
---|
32 | ! |
---|
33 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
34 | ! |
---|
35 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
36 | ! topography representation via flags |
---|
37 | ! |
---|
38 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
39 | ! Forced header and separation lines into 80 columns |
---|
40 | ! |
---|
41 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
42 | ! Module renamed (removed _mod) |
---|
43 | ! |
---|
44 | ! |
---|
45 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
46 | ! Module renamed |
---|
47 | ! |
---|
48 | ! |
---|
49 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
50 | ! Code annotations made doxygen readable |
---|
51 | ! |
---|
52 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
53 | ! REAL constants provided with KIND-attribute |
---|
54 | ! |
---|
55 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
56 | ! ONLY-attribute added to USE-statements, |
---|
57 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
58 | ! kinds are defined in new module kinds, |
---|
59 | ! revision history before 2012 removed, |
---|
60 | ! comment fields (!:) to be used for variable explanations added to |
---|
61 | ! all variable declaration statements |
---|
62 | ! |
---|
63 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
64 | ! code put under GPL (PALM 3.9) |
---|
65 | ! |
---|
66 | ! Revision 1.1 1997/08/11 06:09:57 raasch |
---|
67 | ! Initial revision |
---|
68 | ! |
---|
69 | ! |
---|
70 | ! Description: |
---|
71 | ! ------------ |
---|
72 | !> Advection term for v velocity-component using Piacsek and Williams. |
---|
73 | !> Vertical advection at the first grid point above the surface is done with |
---|
74 | !> normal centred differences, because otherwise no information from the surface |
---|
75 | !> would be communicated upwards due to w=0 at K=nzb. |
---|
76 | !------------------------------------------------------------------------------! |
---|
77 | MODULE advec_v_pw_mod |
---|
78 | |
---|
79 | |
---|
80 | PRIVATE |
---|
81 | PUBLIC advec_v_pw |
---|
82 | |
---|
83 | INTERFACE advec_v_pw |
---|
84 | MODULE PROCEDURE advec_v_pw |
---|
85 | MODULE PROCEDURE advec_v_pw_ij |
---|
86 | END INTERFACE advec_v_pw |
---|
87 | |
---|
88 | CONTAINS |
---|
89 | |
---|
90 | |
---|
91 | !------------------------------------------------------------------------------! |
---|
92 | ! Description: |
---|
93 | ! ------------ |
---|
94 | !> Call for all grid points |
---|
95 | !------------------------------------------------------------------------------! |
---|
96 | SUBROUTINE advec_v_pw |
---|
97 | |
---|
98 | USE arrays_3d, & |
---|
99 | ONLY: ddzw, tend, u, v, w |
---|
100 | |
---|
101 | USE control_parameters, & |
---|
102 | ONLY: u_gtrans, v_gtrans |
---|
103 | |
---|
104 | USE grid_variables, & |
---|
105 | ONLY: ddx, ddy |
---|
106 | |
---|
107 | USE indices, & |
---|
108 | ONLY: nxl, nxr, nyn, nysv, nzb, nzt, wall_flags_0 |
---|
109 | |
---|
110 | USE kinds |
---|
111 | |
---|
112 | |
---|
113 | IMPLICIT NONE |
---|
114 | |
---|
115 | INTEGER(iwp) :: i !< |
---|
116 | INTEGER(iwp) :: j !< |
---|
117 | INTEGER(iwp) :: k !< |
---|
118 | |
---|
119 | REAL(wp) :: gu !< |
---|
120 | REAL(wp) :: gv !< |
---|
121 | |
---|
122 | |
---|
123 | gu = 2.0_wp * u_gtrans |
---|
124 | gv = 2.0_wp * v_gtrans |
---|
125 | DO i = nxl, nxr |
---|
126 | DO j = nysv, nyn |
---|
127 | DO k = nzb+1, nzt |
---|
128 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
129 | ( v(k,j,i+1) * ( u(k,j-1,i+1) + u(k,j,i+1) - gu ) & |
---|
130 | - v(k,j,i-1) * ( u(k,j-1,i) + u(k,j,i) - gu ) ) * ddx & |
---|
131 | + ( v(k,j+1,i) * ( v(k,j+1,i) + v(k,j,i) - gv ) & |
---|
132 | - v(k,j-1,i) * ( v(k,j,i) + v(k,j-1,i) - gv ) ) * ddy & |
---|
133 | + ( v(k+1,j,i) * ( w(k,j-1,i) + w(k,j,i) ) & |
---|
134 | - v(k-1,j,i) * ( w(k-1,j-1,i) + w(k-1,j,i) ) ) & |
---|
135 | * ddzw(k) & |
---|
136 | ) & |
---|
137 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
138 | BTEST( wall_flags_0(k,j,i), 2 ) ) |
---|
139 | ENDDO |
---|
140 | ENDDO |
---|
141 | ENDDO |
---|
142 | |
---|
143 | END SUBROUTINE advec_v_pw |
---|
144 | |
---|
145 | |
---|
146 | !------------------------------------------------------------------------------! |
---|
147 | ! Description: |
---|
148 | ! ------------ |
---|
149 | !> Call for grid point i,j |
---|
150 | !------------------------------------------------------------------------------! |
---|
151 | SUBROUTINE advec_v_pw_ij( i, j ) |
---|
152 | |
---|
153 | USE arrays_3d, & |
---|
154 | ONLY: ddzw, tend, u, v, w |
---|
155 | |
---|
156 | USE control_parameters, & |
---|
157 | ONLY: u_gtrans, v_gtrans |
---|
158 | |
---|
159 | USE grid_variables, & |
---|
160 | ONLY: ddx, ddy |
---|
161 | |
---|
162 | USE indices, & |
---|
163 | ONLY: nzb, nzt, wall_flags_0 |
---|
164 | |
---|
165 | USE kinds |
---|
166 | |
---|
167 | |
---|
168 | IMPLICIT NONE |
---|
169 | |
---|
170 | INTEGER(iwp) :: i !< |
---|
171 | INTEGER(iwp) :: j !< |
---|
172 | INTEGER(iwp) :: k !< |
---|
173 | |
---|
174 | REAL(wp) :: gu !< |
---|
175 | REAL(wp) :: gv !< |
---|
176 | |
---|
177 | |
---|
178 | gu = 2.0_wp * u_gtrans |
---|
179 | gv = 2.0_wp * v_gtrans |
---|
180 | DO k = nzb+1, nzt |
---|
181 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
182 | ( v(k,j,i+1) * ( u(k,j-1,i+1) + u(k,j,i+1) - gu ) & |
---|
183 | - v(k,j,i-1) * ( u(k,j-1,i) + u(k,j,i) - gu ) ) * ddx & |
---|
184 | + ( v(k,j+1,i) * ( v(k,j+1,i) + v(k,j,i) - gv ) & |
---|
185 | - v(k,j-1,i) * ( v(k,j,i) + v(k,j-1,i) - gv ) ) * ddy & |
---|
186 | + ( v(k+1,j,i) * ( w(k,j-1,i) + w(k,j,i) ) & |
---|
187 | - v(k-1,j,i) * ( w(k-1,j-1,i) + w(k-1,j,i) ) ) & |
---|
188 | * ddzw(k) & |
---|
189 | ) & |
---|
190 | * MERGE( 1.0_wp, 0.0_wp, & |
---|
191 | BTEST( wall_flags_0(k,j,i), 2 ) ) |
---|
192 | ENDDO |
---|
193 | |
---|
194 | END SUBROUTINE advec_v_pw_ij |
---|
195 | |
---|
196 | END MODULE advec_v_pw_mod |
---|
197 | |
---|