1 | !> @file advec_v_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_v_pw.f90 1818 2016-04-06 15:53:27Z raasch $ |
---|
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:57 raasch |
---|
45 | ! Initial revision |
---|
46 | ! |
---|
47 | ! |
---|
48 | ! Description: |
---|
49 | ! ------------ |
---|
50 | !> Advection term for v 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_v_pw_mod |
---|
56 | |
---|
57 | |
---|
58 | PRIVATE |
---|
59 | PUBLIC advec_v_pw |
---|
60 | |
---|
61 | INTERFACE advec_v_pw |
---|
62 | MODULE PROCEDURE advec_v_pw |
---|
63 | MODULE PROCEDURE advec_v_pw_ij |
---|
64 | END INTERFACE advec_v_pw |
---|
65 | |
---|
66 | CONTAINS |
---|
67 | |
---|
68 | |
---|
69 | !------------------------------------------------------------------------------! |
---|
70 | ! Description: |
---|
71 | ! ------------ |
---|
72 | !> Call for all grid points |
---|
73 | !------------------------------------------------------------------------------! |
---|
74 | SUBROUTINE advec_v_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: nxl, nxr, nyn, nysv, nzb_v_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 | |
---|
101 | gu = 2.0_wp * u_gtrans |
---|
102 | gv = 2.0_wp * v_gtrans |
---|
103 | DO i = nxl, nxr |
---|
104 | DO j = nysv, nyn |
---|
105 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
106 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
107 | ( v(k,j,i+1) * ( u(k,j-1,i+1) + u(k,j,i+1) - gu ) & |
---|
108 | - v(k,j,i-1) * ( u(k,j-1,i) + u(k,j,i) - gu ) ) * ddx & |
---|
109 | + ( v(k,j+1,i) * ( v(k,j+1,i) + v(k,j,i) - gv ) & |
---|
110 | - v(k,j-1,i) * ( v(k,j,i) + v(k,j-1,i) - gv ) ) * ddy & |
---|
111 | + ( v(k+1,j,i) * ( w(k,j-1,i) + w(k,j,i) ) & |
---|
112 | - v(k-1,j,i) * ( w(k-1,j-1,i) + w(k-1,j,i) ) ) & |
---|
113 | * ddzw(k) & |
---|
114 | ) |
---|
115 | ENDDO |
---|
116 | ENDDO |
---|
117 | ENDDO |
---|
118 | |
---|
119 | END SUBROUTINE advec_v_pw |
---|
120 | |
---|
121 | |
---|
122 | !------------------------------------------------------------------------------! |
---|
123 | ! Description: |
---|
124 | ! ------------ |
---|
125 | !> Call for grid point i,j |
---|
126 | !------------------------------------------------------------------------------! |
---|
127 | SUBROUTINE advec_v_pw_ij( i, j ) |
---|
128 | |
---|
129 | USE arrays_3d, & |
---|
130 | ONLY: ddzw, tend, u, v, w |
---|
131 | |
---|
132 | USE control_parameters, & |
---|
133 | ONLY: u_gtrans, v_gtrans |
---|
134 | |
---|
135 | USE grid_variables, & |
---|
136 | ONLY: ddx, ddy |
---|
137 | |
---|
138 | USE indices, & |
---|
139 | ONLY: nzb_v_inner, nzt |
---|
140 | |
---|
141 | USE kinds |
---|
142 | |
---|
143 | |
---|
144 | IMPLICIT NONE |
---|
145 | |
---|
146 | INTEGER(iwp) :: i !< |
---|
147 | INTEGER(iwp) :: j !< |
---|
148 | INTEGER(iwp) :: k !< |
---|
149 | |
---|
150 | REAL(wp) :: gu !< |
---|
151 | REAL(wp) :: gv !< |
---|
152 | |
---|
153 | |
---|
154 | gu = 2.0_wp * u_gtrans |
---|
155 | gv = 2.0_wp * v_gtrans |
---|
156 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
157 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
158 | ( v(k,j,i+1) * ( u(k,j-1,i+1) + u(k,j,i+1) - gu ) & |
---|
159 | - v(k,j,i-1) * ( u(k,j-1,i) + u(k,j,i) - gu ) ) * ddx & |
---|
160 | + ( v(k,j+1,i) * ( v(k,j+1,i) + v(k,j,i) - gv ) & |
---|
161 | - v(k,j-1,i) * ( v(k,j,i) + v(k,j-1,i) - gv ) ) * ddy & |
---|
162 | + ( v(k+1,j,i) * ( w(k,j-1,i) + w(k,j,i) ) & |
---|
163 | - v(k-1,j,i) * ( w(k-1,j-1,i) + w(k-1,j,i) ) ) & |
---|
164 | * ddzw(k) & |
---|
165 | ) |
---|
166 | ENDDO |
---|
167 | |
---|
168 | END SUBROUTINE advec_v_pw_ij |
---|
169 | |
---|
170 | END MODULE advec_v_pw_mod |
---|
171 | |
---|