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