1 | !> @file advec_u_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_u_pw.f90 2101 2017-01-05 16:42:31Z schwenkel $ |
---|
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:09:21 raasch |
---|
57 | ! Initial revision |
---|
58 | ! |
---|
59 | ! |
---|
60 | ! Description: |
---|
61 | ! ------------ |
---|
62 | !> Advection term for u 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_u_pw_mod |
---|
68 | |
---|
69 | |
---|
70 | PRIVATE |
---|
71 | PUBLIC advec_u_pw |
---|
72 | |
---|
73 | INTERFACE advec_u_pw |
---|
74 | MODULE PROCEDURE advec_u_pw |
---|
75 | MODULE PROCEDURE advec_u_pw_ij |
---|
76 | END INTERFACE advec_u_pw |
---|
77 | |
---|
78 | CONTAINS |
---|
79 | |
---|
80 | |
---|
81 | !------------------------------------------------------------------------------! |
---|
82 | ! Description: |
---|
83 | ! ------------ |
---|
84 | !> Call for all grid points |
---|
85 | !------------------------------------------------------------------------------! |
---|
86 | SUBROUTINE advec_u_pw |
---|
87 | |
---|
88 | USE arrays_3d, & |
---|
89 | ONLY: ddzw, 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: nxlu, nxr, nyn, nys, nzb_u_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 | gu = 2.0_wp * u_gtrans |
---|
113 | gv = 2.0_wp * v_gtrans |
---|
114 | DO i = nxlu, nxr |
---|
115 | DO j = nys, nyn |
---|
116 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
117 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
118 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
119 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
120 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
121 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
122 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
123 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) & |
---|
124 | * ddzw(k) & |
---|
125 | ) |
---|
126 | ENDDO |
---|
127 | ENDDO |
---|
128 | ENDDO |
---|
129 | |
---|
130 | END SUBROUTINE advec_u_pw |
---|
131 | |
---|
132 | |
---|
133 | !------------------------------------------------------------------------------! |
---|
134 | ! Description: |
---|
135 | ! ------------ |
---|
136 | !> Call for grid point i,j |
---|
137 | !------------------------------------------------------------------------------! |
---|
138 | SUBROUTINE advec_u_pw_ij( i, j ) |
---|
139 | |
---|
140 | USE arrays_3d, & |
---|
141 | ONLY: ddzw, tend, u, v, w |
---|
142 | |
---|
143 | USE control_parameters, & |
---|
144 | ONLY: u_gtrans, v_gtrans |
---|
145 | |
---|
146 | USE grid_variables, & |
---|
147 | ONLY: ddx, ddy |
---|
148 | |
---|
149 | USE indices, & |
---|
150 | ONLY: nzb_u_inner, nzt |
---|
151 | |
---|
152 | USE kinds |
---|
153 | |
---|
154 | |
---|
155 | IMPLICIT NONE |
---|
156 | |
---|
157 | INTEGER(iwp) :: i !< |
---|
158 | INTEGER(iwp) :: j !< |
---|
159 | INTEGER(iwp) :: k !< |
---|
160 | |
---|
161 | REAL(wp) :: gu !< |
---|
162 | REAL(wp) :: gv !< |
---|
163 | |
---|
164 | gu = 2.0_wp * u_gtrans |
---|
165 | gv = 2.0_wp * v_gtrans |
---|
166 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
167 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
168 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
169 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
170 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
171 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
172 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
173 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) & |
---|
174 | * ddzw(k) & |
---|
175 | ) |
---|
176 | ENDDO |
---|
177 | |
---|
178 | END SUBROUTINE advec_u_pw_ij |
---|
179 | |
---|
180 | END MODULE advec_u_pw_mod |
---|