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