1 | MODULE advec_w_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_w_pw.f90 1354 2014-04-08 15:22:57Z boeske $ |
---|
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:10:29 raasch |
---|
43 | ! Initial revision |
---|
44 | ! |
---|
45 | ! |
---|
46 | ! Description: |
---|
47 | ! ------------ |
---|
48 | ! Advection term for w 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_w_pw |
---|
56 | |
---|
57 | INTERFACE advec_w_pw |
---|
58 | MODULE PROCEDURE advec_w_pw |
---|
59 | MODULE PROCEDURE advec_w_pw_ij |
---|
60 | END INTERFACE advec_w_pw |
---|
61 | |
---|
62 | CONTAINS |
---|
63 | |
---|
64 | |
---|
65 | !------------------------------------------------------------------------------! |
---|
66 | ! Call for all grid points |
---|
67 | !------------------------------------------------------------------------------! |
---|
68 | SUBROUTINE advec_w_pw |
---|
69 | |
---|
70 | USE arrays_3d, & |
---|
71 | ONLY: ddzu, 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: nxl, nxr, nyn, nys, nzb_w_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 | |
---|
95 | gu = 2.0_wp * u_gtrans |
---|
96 | gv = 2.0_wp * v_gtrans |
---|
97 | DO i = nxl, nxr |
---|
98 | DO j = nys, nyn |
---|
99 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
100 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
101 | ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu ) & |
---|
102 | - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx & |
---|
103 | + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv ) & |
---|
104 | - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy & |
---|
105 | + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) ) & |
---|
106 | - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) ) & |
---|
107 | * ddzu(k+1) & |
---|
108 | ) |
---|
109 | ENDDO |
---|
110 | ENDDO |
---|
111 | ENDDO |
---|
112 | |
---|
113 | END SUBROUTINE advec_w_pw |
---|
114 | |
---|
115 | |
---|
116 | !------------------------------------------------------------------------------! |
---|
117 | ! Call for grid point i,j |
---|
118 | !------------------------------------------------------------------------------! |
---|
119 | SUBROUTINE advec_w_pw_ij( i, j ) |
---|
120 | |
---|
121 | USE arrays_3d, & |
---|
122 | ONLY: ddzu, tend, u, v, w |
---|
123 | |
---|
124 | USE control_parameters, & |
---|
125 | ONLY: u_gtrans, v_gtrans |
---|
126 | |
---|
127 | USE grid_variables, & |
---|
128 | ONLY: ddx, ddy |
---|
129 | |
---|
130 | USE indices, & |
---|
131 | ONLY: nzb_w_inner, nzt |
---|
132 | |
---|
133 | USE kinds |
---|
134 | |
---|
135 | |
---|
136 | IMPLICIT NONE |
---|
137 | |
---|
138 | INTEGER(iwp) :: i !: |
---|
139 | INTEGER(iwp) :: j !: |
---|
140 | INTEGER(iwp) :: k !: |
---|
141 | |
---|
142 | REAL(wp) :: gu !: |
---|
143 | REAL(wp) :: gv !: |
---|
144 | |
---|
145 | gu = 2.0_wp * u_gtrans |
---|
146 | gv = 2.0_wp * v_gtrans |
---|
147 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
148 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
149 | ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu ) & |
---|
150 | - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx & |
---|
151 | + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv ) & |
---|
152 | - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy & |
---|
153 | + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) ) & |
---|
154 | - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) ) & |
---|
155 | * ddzu(k+1) & |
---|
156 | ) |
---|
157 | ENDDO |
---|
158 | END SUBROUTINE advec_w_pw_ij |
---|
159 | |
---|
160 | END MODULE advec_w_pw_mod |
---|