1 | MODULE advec_v_up_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-2012 Leibniz University Hannover |
---|
18 | !--------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: advec_v_up.f90 1037 2012-10-22 14:10:22Z witha $ |
---|
27 | ! |
---|
28 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
29 | ! code put under GPL (PALM 3.9) |
---|
30 | ! |
---|
31 | ! 106 2007-08-16 14:30:26Z raasch |
---|
32 | ! j loop is starting from nysv (needed for non-cyclic boundary conditions) |
---|
33 | ! |
---|
34 | ! 75 2007-03-22 09:54:05Z raasch |
---|
35 | ! vynp eliminated |
---|
36 | ! |
---|
37 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
38 | ! |
---|
39 | ! Revision 1.12 2006/02/23 09:46:37 raasch |
---|
40 | ! nzb_2d replaced by nzb_v_inner |
---|
41 | ! |
---|
42 | ! Revision 1.1 1997/08/29 08:56:05 raasch |
---|
43 | ! Initial revision |
---|
44 | ! |
---|
45 | ! |
---|
46 | ! Description: |
---|
47 | ! ------------ |
---|
48 | ! Advection term for the v velocity-component using upstream scheme. |
---|
49 | ! NOTE: vertical advection at k=1 still has wrong grid spacing for w>0! |
---|
50 | ! The same problem occurs for all topography boundaries! |
---|
51 | !------------------------------------------------------------------------------! |
---|
52 | |
---|
53 | PRIVATE |
---|
54 | PUBLIC advec_v_up |
---|
55 | |
---|
56 | INTERFACE advec_v_up |
---|
57 | MODULE PROCEDURE advec_v_up |
---|
58 | MODULE PROCEDURE advec_v_up_ij |
---|
59 | END INTERFACE advec_v_up |
---|
60 | |
---|
61 | CONTAINS |
---|
62 | |
---|
63 | |
---|
64 | !------------------------------------------------------------------------------! |
---|
65 | ! Call for all grid points |
---|
66 | !------------------------------------------------------------------------------! |
---|
67 | SUBROUTINE advec_v_up |
---|
68 | |
---|
69 | USE arrays_3d |
---|
70 | USE control_parameters |
---|
71 | USE grid_variables |
---|
72 | USE indices |
---|
73 | |
---|
74 | IMPLICIT NONE |
---|
75 | |
---|
76 | INTEGER :: i, j, k |
---|
77 | REAL :: ukomp, vkomp, wkomp |
---|
78 | |
---|
79 | |
---|
80 | DO i = nxl, nxr |
---|
81 | DO j = nysv, nyn |
---|
82 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
83 | ! |
---|
84 | !-- x-direction |
---|
85 | ukomp = 0.25 * ( u(k,j,i) + u(k,j-1,i) + & |
---|
86 | u(k,j,i+1) + u(k,j-1,i+1) ) - u_gtrans |
---|
87 | IF ( ukomp > 0.0 ) THEN |
---|
88 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
89 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
90 | ELSE |
---|
91 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
92 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
93 | ENDIF |
---|
94 | ! |
---|
95 | !-- y-direction |
---|
96 | vkomp = v(k,j,i) - v_gtrans |
---|
97 | IF ( vkomp > 0.0 ) THEN |
---|
98 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
99 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
100 | ELSE |
---|
101 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
102 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
103 | ENDIF |
---|
104 | ! |
---|
105 | !-- z-direction |
---|
106 | wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + & |
---|
107 | w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
108 | IF ( wkomp > 0.0 ) THEN |
---|
109 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
110 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
111 | ELSE |
---|
112 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
113 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
114 | ENDIF |
---|
115 | |
---|
116 | ENDDO |
---|
117 | ENDDO |
---|
118 | ENDDO |
---|
119 | |
---|
120 | END SUBROUTINE advec_v_up |
---|
121 | |
---|
122 | |
---|
123 | !------------------------------------------------------------------------------! |
---|
124 | ! Call for grid point i,j |
---|
125 | !------------------------------------------------------------------------------! |
---|
126 | SUBROUTINE advec_v_up_ij( i, j ) |
---|
127 | |
---|
128 | USE arrays_3d |
---|
129 | USE control_parameters |
---|
130 | USE grid_variables |
---|
131 | USE indices |
---|
132 | |
---|
133 | IMPLICIT NONE |
---|
134 | |
---|
135 | INTEGER :: i, j, k |
---|
136 | |
---|
137 | REAL :: ukomp, vkomp, wkomp |
---|
138 | |
---|
139 | |
---|
140 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
141 | ! |
---|
142 | !-- x-direction |
---|
143 | ukomp = 0.25 * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1) & |
---|
144 | ) - u_gtrans |
---|
145 | IF ( ukomp > 0.0 ) THEN |
---|
146 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
147 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
148 | ELSE |
---|
149 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
150 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
151 | ENDIF |
---|
152 | ! |
---|
153 | !-- y-direction |
---|
154 | vkomp = v(k,j,i) - v_gtrans |
---|
155 | IF ( vkomp > 0.0 ) THEN |
---|
156 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
157 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
158 | ELSE |
---|
159 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
160 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
161 | ENDIF |
---|
162 | ! |
---|
163 | !-- z-direction |
---|
164 | wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
165 | IF ( wkomp > 0.0 ) THEN |
---|
166 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
167 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
168 | ELSE |
---|
169 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
170 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
171 | ENDIF |
---|
172 | |
---|
173 | ENDDO |
---|
174 | |
---|
175 | END SUBROUTINE advec_v_up_ij |
---|
176 | |
---|
177 | END MODULE advec_v_up_mod |
---|