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