1 | !> @file advec_w_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-2017 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: advec_w_pw.f90 2101 2017-01-05 16:42:31Z hoffmann $ |
---|
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 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
43 | ! REAL constants provided with KIND-attribute |
---|
44 | ! |
---|
45 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
46 | ! ONLY-attribute added to USE-statements, |
---|
47 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
48 | ! kinds are defined in new module kinds, |
---|
49 | ! revision history before 2012 removed, |
---|
50 | ! comment fields (!:) to be used for variable explanations added to |
---|
51 | ! all variable declaration statements |
---|
52 | ! |
---|
53 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
54 | ! code put under GPL (PALM 3.9) |
---|
55 | ! |
---|
56 | ! Revision 1.1 1997/08/11 06:10:29 raasch |
---|
57 | ! Initial revision |
---|
58 | ! |
---|
59 | ! |
---|
60 | ! Description: |
---|
61 | ! ------------ |
---|
62 | !> Advection term for w velocity-component using Piacsek and Williams. |
---|
63 | !> Vertical advection at the first grid point above the surface is done with |
---|
64 | !> normal centred differences, because otherwise no information from the surface |
---|
65 | !> would be communicated upwards due to w=0 at k=nzb. |
---|
66 | !------------------------------------------------------------------------------! |
---|
67 | MODULE advec_w_pw_mod |
---|
68 | |
---|
69 | |
---|
70 | PRIVATE |
---|
71 | PUBLIC advec_w_pw |
---|
72 | |
---|
73 | INTERFACE advec_w_pw |
---|
74 | MODULE PROCEDURE advec_w_pw |
---|
75 | MODULE PROCEDURE advec_w_pw_ij |
---|
76 | END INTERFACE advec_w_pw |
---|
77 | |
---|
78 | CONTAINS |
---|
79 | |
---|
80 | |
---|
81 | !------------------------------------------------------------------------------! |
---|
82 | ! Description: |
---|
83 | ! ------------ |
---|
84 | !> Call for all grid points |
---|
85 | !------------------------------------------------------------------------------! |
---|
86 | SUBROUTINE advec_w_pw |
---|
87 | |
---|
88 | USE arrays_3d, & |
---|
89 | ONLY: ddzu, 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, nxr, nyn, nys, nzb_w_inner, nzt |
---|
99 | |
---|
100 | USE kinds |
---|
101 | |
---|
102 | |
---|
103 | IMPLICIT NONE |
---|
104 | |
---|
105 | INTEGER(iwp) :: i !< |
---|
106 | INTEGER(iwp) :: j !< |
---|
107 | INTEGER(iwp) :: k !< |
---|
108 | |
---|
109 | REAL(wp) :: gu !< |
---|
110 | REAL(wp) :: gv !< |
---|
111 | |
---|
112 | |
---|
113 | gu = 2.0_wp * u_gtrans |
---|
114 | gv = 2.0_wp * v_gtrans |
---|
115 | DO i = nxl, nxr |
---|
116 | DO j = nys, nyn |
---|
117 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
118 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
119 | ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu ) & |
---|
120 | - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx & |
---|
121 | + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv ) & |
---|
122 | - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy & |
---|
123 | + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) ) & |
---|
124 | - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) ) & |
---|
125 | * ddzu(k+1) & |
---|
126 | ) |
---|
127 | ENDDO |
---|
128 | ENDDO |
---|
129 | ENDDO |
---|
130 | |
---|
131 | END SUBROUTINE advec_w_pw |
---|
132 | |
---|
133 | |
---|
134 | !------------------------------------------------------------------------------! |
---|
135 | ! Description: |
---|
136 | ! ------------ |
---|
137 | !> Call for grid point i,j |
---|
138 | !------------------------------------------------------------------------------! |
---|
139 | SUBROUTINE advec_w_pw_ij( i, j ) |
---|
140 | |
---|
141 | USE arrays_3d, & |
---|
142 | ONLY: ddzu, tend, u, v, w |
---|
143 | |
---|
144 | USE control_parameters, & |
---|
145 | ONLY: u_gtrans, v_gtrans |
---|
146 | |
---|
147 | USE grid_variables, & |
---|
148 | ONLY: ddx, ddy |
---|
149 | |
---|
150 | USE indices, & |
---|
151 | ONLY: nzb_w_inner, nzt |
---|
152 | |
---|
153 | USE kinds |
---|
154 | |
---|
155 | |
---|
156 | IMPLICIT NONE |
---|
157 | |
---|
158 | INTEGER(iwp) :: i !< |
---|
159 | INTEGER(iwp) :: j !< |
---|
160 | INTEGER(iwp) :: k !< |
---|
161 | |
---|
162 | REAL(wp) :: gu !< |
---|
163 | REAL(wp) :: gv !< |
---|
164 | |
---|
165 | gu = 2.0_wp * u_gtrans |
---|
166 | gv = 2.0_wp * v_gtrans |
---|
167 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
168 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
169 | ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu ) & |
---|
170 | - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx & |
---|
171 | + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv ) & |
---|
172 | - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy & |
---|
173 | + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) ) & |
---|
174 | - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) ) & |
---|
175 | * ddzu(k+1) & |
---|
176 | ) |
---|
177 | ENDDO |
---|
178 | END SUBROUTINE advec_w_pw_ij |
---|
179 | |
---|
180 | END MODULE advec_w_pw_mod |
---|