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