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