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