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