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