1 | !> @file advec_s_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_s_pw.f90 3665 2019-01-10 08:28:24Z raasch $ |
---|
27 | ! unused variables removed |
---|
28 | ! |
---|
29 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
30 | ! nopointer option removed |
---|
31 | ! |
---|
32 | ! 3547 2018-11-21 13:21:24Z suehring |
---|
33 | ! variables documented |
---|
34 | ! |
---|
35 | ! 3538 2018-11-20 10:55:41Z suehring |
---|
36 | ! Remove unnecessary double-masking of topography |
---|
37 | ! |
---|
38 | ! 3302 2018-10-03 02:39:40Z raasch |
---|
39 | ! Stokes drift velocity added |
---|
40 | ! |
---|
41 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
42 | ! Corrected "Former revisions" section |
---|
43 | ! |
---|
44 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
45 | ! Change in file header (GPL part) |
---|
46 | ! |
---|
47 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
48 | ! |
---|
49 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
50 | ! topography representation via flags |
---|
51 | ! |
---|
52 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
53 | ! Forced header and separation lines into 80 columns |
---|
54 | ! |
---|
55 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
56 | ! Module renamed (removed _mod) |
---|
57 | ! |
---|
58 | ! |
---|
59 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
60 | ! Module renamed |
---|
61 | ! |
---|
62 | ! |
---|
63 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
64 | ! Code annotations made doxygen readable |
---|
65 | ! |
---|
66 | ! 1374 2014-04-25 12:55:07Z raasch |
---|
67 | ! missing variables added to ONLY list |
---|
68 | ! |
---|
69 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
70 | ! REAL constants provided with KIND-attribute |
---|
71 | ! |
---|
72 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
73 | ! ONLY-attribute added to USE-statements, |
---|
74 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
75 | ! kinds are defined in new module kinds, |
---|
76 | ! revision history before 2012 removed, |
---|
77 | ! comment fields (!:) to be used for variable explanations added to |
---|
78 | ! all variable declaration statements |
---|
79 | ! |
---|
80 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
81 | ! code put under GPL (PALM 3.9) |
---|
82 | ! |
---|
83 | ! 1010 2012-09-20 07:59:54Z raasch |
---|
84 | ! cpp switch __nopointer added for pointer free version |
---|
85 | ! |
---|
86 | ! Revision 1.1 1997/08/29 08:54:20 raasch |
---|
87 | ! Initial revision |
---|
88 | ! |
---|
89 | ! |
---|
90 | ! Description: |
---|
91 | ! ------------ |
---|
92 | !> Advection term for scalar variables using the Piacsek and Williams scheme |
---|
93 | !> (form C3). Contrary to PW itself, for reasons of accuracy their scheme is |
---|
94 | !> slightly modified as follows: the values of those scalars that are used for |
---|
95 | !> the computation of the flux divergence are reduced by the value of the |
---|
96 | !> relevant scalar at the location where the difference is computed (sk(k,j,i)). |
---|
97 | !> NOTE: at the first grid point above the surface computation still takes place! |
---|
98 | !------------------------------------------------------------------------------! |
---|
99 | MODULE advec_s_pw_mod |
---|
100 | |
---|
101 | |
---|
102 | PRIVATE |
---|
103 | PUBLIC advec_s_pw |
---|
104 | |
---|
105 | INTERFACE advec_s_pw |
---|
106 | MODULE PROCEDURE advec_s_pw |
---|
107 | MODULE PROCEDURE advec_s_pw_ij |
---|
108 | END INTERFACE |
---|
109 | |
---|
110 | CONTAINS |
---|
111 | |
---|
112 | |
---|
113 | !------------------------------------------------------------------------------! |
---|
114 | ! Description: |
---|
115 | ! ------------ |
---|
116 | !> Call for all grid points |
---|
117 | !------------------------------------------------------------------------------! |
---|
118 | SUBROUTINE advec_s_pw( sk ) |
---|
119 | |
---|
120 | USE arrays_3d, & |
---|
121 | ONLY: dd2zu, tend, u, u_stokes_zu, v, v_stokes_zu, w |
---|
122 | |
---|
123 | USE control_parameters, & |
---|
124 | ONLY: u_gtrans, v_gtrans |
---|
125 | |
---|
126 | USE grid_variables, & |
---|
127 | ONLY: ddx, ddy |
---|
128 | |
---|
129 | USE indices, & |
---|
130 | ONLY: nxl, nxr, nyn, nys, nzb, nzt |
---|
131 | |
---|
132 | USE kinds |
---|
133 | |
---|
134 | |
---|
135 | IMPLICIT NONE |
---|
136 | |
---|
137 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
138 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
139 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
140 | |
---|
141 | REAL(wp) :: gu !< local additional advective velocity |
---|
142 | REAL(wp) :: gv !< local additional advective velocity |
---|
143 | |
---|
144 | REAL(wp), DIMENSION(:,:,:), POINTER :: sk |
---|
145 | |
---|
146 | |
---|
147 | DO i = nxl, nxr |
---|
148 | DO j = nys, nyn |
---|
149 | DO k = nzb+1, nzt |
---|
150 | |
---|
151 | ! |
---|
152 | !-- Galilean transformation + Stokes drift velocity (ocean only) |
---|
153 | gu = u_gtrans - u_stokes_zu(k) |
---|
154 | gv = v_gtrans - v_stokes_zu(k) |
---|
155 | |
---|
156 | tend(k,j,i) = tend(k,j,i) + & |
---|
157 | ( -0.5_wp * ( ( u(k,j,i+1) - gu ) * & |
---|
158 | ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
159 | - ( u(k,j,i) - gu ) * & |
---|
160 | ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
161 | ) * ddx & |
---|
162 | -0.5_wp * ( ( v(k,j+1,i) - gv ) * & |
---|
163 | ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
164 | - ( v(k,j,i) - gv ) * & |
---|
165 | ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
166 | ) * ddy & |
---|
167 | - ( w(k,j,i) * & |
---|
168 | ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
169 | - w(k-1,j,i) * & |
---|
170 | ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
171 | ) * dd2zu(k) & |
---|
172 | ) |
---|
173 | ENDDO |
---|
174 | ENDDO |
---|
175 | ENDDO |
---|
176 | |
---|
177 | END SUBROUTINE advec_s_pw |
---|
178 | |
---|
179 | |
---|
180 | !------------------------------------------------------------------------------! |
---|
181 | ! Description: |
---|
182 | ! ------------ |
---|
183 | !> Call for grid point i,j |
---|
184 | !------------------------------------------------------------------------------! |
---|
185 | SUBROUTINE advec_s_pw_ij( i, j, sk ) |
---|
186 | |
---|
187 | USE arrays_3d, & |
---|
188 | ONLY: dd2zu, tend, u, u_stokes_zu, v, v_stokes_zu, w |
---|
189 | |
---|
190 | USE control_parameters, & |
---|
191 | ONLY: u_gtrans, v_gtrans |
---|
192 | |
---|
193 | USE grid_variables, & |
---|
194 | ONLY: ddx, ddy |
---|
195 | |
---|
196 | USE indices, & |
---|
197 | ONLY: nzb, nzt |
---|
198 | |
---|
199 | USE kinds |
---|
200 | |
---|
201 | |
---|
202 | IMPLICIT NONE |
---|
203 | |
---|
204 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
205 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
206 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
207 | |
---|
208 | REAL(wp) :: gu !< local additional advective velocity |
---|
209 | REAL(wp) :: gv !< local additional advective velocity |
---|
210 | |
---|
211 | REAL(wp), DIMENSION(:,:,:), POINTER :: sk |
---|
212 | |
---|
213 | |
---|
214 | DO k = nzb+1, nzt |
---|
215 | |
---|
216 | ! |
---|
217 | !-- Galilean transformation + Stokes drift velocity (ocean only) |
---|
218 | gu = u_gtrans - u_stokes_zu(k) |
---|
219 | gv = v_gtrans - v_stokes_zu(k) |
---|
220 | |
---|
221 | tend(k,j,i) = tend(k,j,i) + & |
---|
222 | ( -0.5_wp * ( ( u(k,j,i+1) - gu ) * & |
---|
223 | ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
224 | - ( u(k,j,i) - gu ) * & |
---|
225 | ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
226 | ) * ddx & |
---|
227 | -0.5_wp * ( ( v(k,j+1,i) - gv ) * & |
---|
228 | ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
229 | - ( v(k,j,i) - gv ) * & |
---|
230 | ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
231 | ) * ddy & |
---|
232 | - ( w(k,j,i) * & |
---|
233 | ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
234 | - w(k-1,j,i) * & |
---|
235 | ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
236 | ) * dd2zu(k) & |
---|
237 | ) |
---|
238 | ENDDO |
---|
239 | |
---|
240 | END SUBROUTINE advec_s_pw_ij |
---|
241 | |
---|
242 | END MODULE advec_s_pw_mod |
---|