1 | !> @file advec_s_pw.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
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-2016 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: advec_s_pw.f90 2001 2016-08-20 18:41:22Z suehring $ |
---|
27 | ! |
---|
28 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
29 | ! Forced header and separation lines into 80 columns |
---|
30 | ! |
---|
31 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
32 | ! Module renamed (removed _mod) |
---|
33 | ! |
---|
34 | ! |
---|
35 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
36 | ! Module renamed |
---|
37 | ! |
---|
38 | ! |
---|
39 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
40 | ! Code annotations made doxygen readable |
---|
41 | ! |
---|
42 | ! 1374 2014-04-25 12:55:07Z raasch |
---|
43 | ! missing variables added to ONLY list |
---|
44 | ! |
---|
45 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
46 | ! REAL constants provided with KIND-attribute |
---|
47 | ! |
---|
48 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
49 | ! ONLY-attribute added to USE-statements, |
---|
50 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
51 | ! kinds are defined in new module kinds, |
---|
52 | ! revision history before 2012 removed, |
---|
53 | ! comment fields (!:) to be used for variable explanations added to |
---|
54 | ! all variable declaration statements |
---|
55 | ! |
---|
56 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
57 | ! code put under GPL (PALM 3.9) |
---|
58 | ! |
---|
59 | ! 1010 2012-09-20 07:59:54Z raasch |
---|
60 | ! cpp switch __nopointer added for pointer free version |
---|
61 | ! |
---|
62 | ! Revision 1.1 1997/08/29 08:54:20 raasch |
---|
63 | ! Initial revision |
---|
64 | ! |
---|
65 | ! |
---|
66 | ! Description: |
---|
67 | ! ------------ |
---|
68 | !> Advection term for scalar variables using the Piacsek and Williams scheme |
---|
69 | !> (form C3). Contrary to PW itself, for reasons of accuracy their scheme is |
---|
70 | !> slightly modified as follows: the values of those scalars that are used for |
---|
71 | !> the computation of the flux divergence are reduced by the value of the |
---|
72 | !> relevant scalar at the location where the difference is computed (sk(k,j,i)). |
---|
73 | !> NOTE: at the first grid point above the surface computation still takes place! |
---|
74 | !------------------------------------------------------------------------------! |
---|
75 | MODULE advec_s_pw_mod |
---|
76 | |
---|
77 | |
---|
78 | PRIVATE |
---|
79 | PUBLIC advec_s_pw |
---|
80 | |
---|
81 | INTERFACE advec_s_pw |
---|
82 | MODULE PROCEDURE advec_s_pw |
---|
83 | MODULE PROCEDURE advec_s_pw_ij |
---|
84 | END INTERFACE |
---|
85 | |
---|
86 | CONTAINS |
---|
87 | |
---|
88 | |
---|
89 | !------------------------------------------------------------------------------! |
---|
90 | ! Description: |
---|
91 | ! ------------ |
---|
92 | !> Call for all grid points |
---|
93 | !------------------------------------------------------------------------------! |
---|
94 | SUBROUTINE advec_s_pw( sk ) |
---|
95 | |
---|
96 | USE arrays_3d, & |
---|
97 | ONLY: dd2zu, tend, u, v, w |
---|
98 | |
---|
99 | USE control_parameters, & |
---|
100 | ONLY: u_gtrans, v_gtrans |
---|
101 | |
---|
102 | USE grid_variables, & |
---|
103 | ONLY: ddx, ddy |
---|
104 | |
---|
105 | USE indices, & |
---|
106 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzb_s_inner,& |
---|
107 | nzt |
---|
108 | |
---|
109 | USE kinds |
---|
110 | |
---|
111 | |
---|
112 | IMPLICIT NONE |
---|
113 | |
---|
114 | INTEGER(iwp) :: i !< |
---|
115 | INTEGER(iwp) :: j !< |
---|
116 | INTEGER(iwp) :: k !< |
---|
117 | |
---|
118 | #if defined( __nopointer ) |
---|
119 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk !< |
---|
120 | #else |
---|
121 | REAL(wp), DIMENSION(:,:,:), POINTER :: sk |
---|
122 | #endif |
---|
123 | |
---|
124 | |
---|
125 | DO i = nxl, nxr |
---|
126 | DO j = nys, nyn |
---|
127 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
128 | tend(k,j,i) = tend(k,j,i) & |
---|
129 | -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
130 | - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
131 | ) * ddx & |
---|
132 | -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
133 | - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
134 | ) * ddy & |
---|
135 | - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
136 | - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
137 | ) * dd2zu(k) |
---|
138 | ENDDO |
---|
139 | ENDDO |
---|
140 | ENDDO |
---|
141 | |
---|
142 | END SUBROUTINE advec_s_pw |
---|
143 | |
---|
144 | |
---|
145 | !------------------------------------------------------------------------------! |
---|
146 | ! Description: |
---|
147 | ! ------------ |
---|
148 | !> Call for grid point i,j |
---|
149 | !------------------------------------------------------------------------------! |
---|
150 | SUBROUTINE advec_s_pw_ij( i, j, sk ) |
---|
151 | |
---|
152 | USE arrays_3d, & |
---|
153 | ONLY: dd2zu, tend, u, v, w |
---|
154 | |
---|
155 | USE control_parameters, & |
---|
156 | ONLY: u_gtrans, v_gtrans |
---|
157 | |
---|
158 | USE grid_variables, & |
---|
159 | ONLY: ddx, ddy |
---|
160 | |
---|
161 | USE indices, & |
---|
162 | ONLY: nxlg, nxrg, nyng, nysg, nzb, nzb_s_inner, nzt |
---|
163 | |
---|
164 | USE kinds |
---|
165 | |
---|
166 | |
---|
167 | IMPLICIT NONE |
---|
168 | |
---|
169 | INTEGER(iwp) :: i !< |
---|
170 | INTEGER(iwp) :: j !< |
---|
171 | INTEGER(iwp) :: k !< |
---|
172 | |
---|
173 | #if defined( __nopointer ) |
---|
174 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk !< |
---|
175 | #else |
---|
176 | REAL(wp), DIMENSION(:,:,:), POINTER :: sk |
---|
177 | #endif |
---|
178 | |
---|
179 | |
---|
180 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
181 | tend(k,j,i) = tend(k,j,i) & |
---|
182 | -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
183 | - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
184 | ) * ddx & |
---|
185 | -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
186 | - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
187 | ) * ddy & |
---|
188 | - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
189 | - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
190 | ) * dd2zu(k) |
---|
191 | ENDDO |
---|
192 | |
---|
193 | END SUBROUTINE advec_s_pw_ij |
---|
194 | |
---|
195 | END MODULE advec_s_pw_mod |
---|