1 | MODULE advec_v_up_mod |
---|
2 | |
---|
3 | !------------------------------------------------------------------------------! |
---|
4 | ! Actual revisions: |
---|
5 | ! ----------------- |
---|
6 | ! |
---|
7 | ! |
---|
8 | ! Former revisions: |
---|
9 | ! ----------------- |
---|
10 | ! $Log: advec_v_up.f90,v $ |
---|
11 | ! Revision 1.12 2006/02/23 09:46:37 raasch |
---|
12 | ! nzb_2d replaced by nzb_v_inner |
---|
13 | ! |
---|
14 | ! Revision 1.11 2005/03/26 14:55:59 raasch |
---|
15 | ! Extension of horizontal loop upper bounds for non-cyclic boundary conditions |
---|
16 | ! |
---|
17 | ! Revision 1.10 2004/01/30 10:12:45 raasch |
---|
18 | ! Scalar lower k index nzb replaced by 2d-array nzb_2d |
---|
19 | ! |
---|
20 | ! Revision 1.9 2003/03/12 16:19:00 raasch |
---|
21 | ! Full code replaced in the call for all gridpoints instead of calling the |
---|
22 | ! _ij version (required by NEC, because otherwise no vectorization) |
---|
23 | ! |
---|
24 | ! Revision 1.8 2002/06/11 12:26:48 raasch |
---|
25 | ! Former subroutine changed to a module which allows to be called for all grid |
---|
26 | ! points of a single vertical column with index i,j or for all grid points by |
---|
27 | ! using function overloading. |
---|
28 | ! |
---|
29 | ! Revision 1.7 2001/03/29 17:36:22 raasch |
---|
30 | ! Translation of remaining German identifiers (variables, subroutines, etc.) |
---|
31 | ! |
---|
32 | ! Revision 1.6 2001/01/22 05:16:19 raasch |
---|
33 | ! Module test_variables removed |
---|
34 | ! |
---|
35 | ! Revision 1.5 2000/01/20 10:20:31 letzel |
---|
36 | ! All comments translated into English |
---|
37 | ! |
---|
38 | ! Revision 1.4 1998/07/06 12:05:37 raasch |
---|
39 | ! + USE test_variables |
---|
40 | ! |
---|
41 | ! Revision 1.3 1998/04/21 15:53:36 raasch |
---|
42 | ! Galilei-Transformation eingebaut |
---|
43 | ! |
---|
44 | ! Revision 1.2 1997/09/09 08:28:21 raasch |
---|
45 | ! Kehrwerte der Gitterweiten implementiert |
---|
46 | ! |
---|
47 | ! Revision 1.1 1997/08/29 08:56:05 raasch |
---|
48 | ! Initial revision |
---|
49 | ! |
---|
50 | ! |
---|
51 | ! Description: |
---|
52 | ! ------------ |
---|
53 | ! Advection term for the v velocity-component using upstream scheme. |
---|
54 | ! NOTE: vertical advection at k=1 still has wrong grid spacing for w>0! |
---|
55 | ! The same problem occurs for all topography boundaries! |
---|
56 | !------------------------------------------------------------------------------! |
---|
57 | |
---|
58 | PRIVATE |
---|
59 | PUBLIC advec_v_up |
---|
60 | |
---|
61 | INTERFACE advec_v_up |
---|
62 | MODULE PROCEDURE advec_v_up |
---|
63 | MODULE PROCEDURE advec_v_up_ij |
---|
64 | END INTERFACE advec_v_up |
---|
65 | |
---|
66 | CONTAINS |
---|
67 | |
---|
68 | |
---|
69 | !------------------------------------------------------------------------------! |
---|
70 | ! Call for all grid points |
---|
71 | !------------------------------------------------------------------------------! |
---|
72 | SUBROUTINE advec_v_up |
---|
73 | |
---|
74 | USE arrays_3d |
---|
75 | USE control_parameters |
---|
76 | USE grid_variables |
---|
77 | USE indices |
---|
78 | |
---|
79 | IMPLICIT NONE |
---|
80 | |
---|
81 | INTEGER :: i, j, k |
---|
82 | REAL :: ukomp, vkomp, wkomp |
---|
83 | |
---|
84 | |
---|
85 | DO i = nxl, nxr |
---|
86 | DO j = nys, nyn+vynp |
---|
87 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
88 | ! |
---|
89 | !-- x-direction |
---|
90 | ukomp = 0.25 * ( u(k,j,i) + u(k,j-1,i) + & |
---|
91 | u(k,j,i+1) + u(k,j-1,i+1) ) - u_gtrans |
---|
92 | IF ( ukomp > 0.0 ) THEN |
---|
93 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
94 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
95 | ELSE |
---|
96 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
97 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
98 | ENDIF |
---|
99 | ! |
---|
100 | !-- y-direction |
---|
101 | vkomp = v(k,j,i) - v_gtrans |
---|
102 | IF ( vkomp > 0.0 ) THEN |
---|
103 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
104 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
105 | ELSE |
---|
106 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
107 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
108 | ENDIF |
---|
109 | ! |
---|
110 | !-- z-direction |
---|
111 | wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + & |
---|
112 | w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
113 | IF ( wkomp > 0.0 ) THEN |
---|
114 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
115 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
116 | ELSE |
---|
117 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
118 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
119 | ENDIF |
---|
120 | |
---|
121 | ENDDO |
---|
122 | ENDDO |
---|
123 | ENDDO |
---|
124 | |
---|
125 | END SUBROUTINE advec_v_up |
---|
126 | |
---|
127 | |
---|
128 | !------------------------------------------------------------------------------! |
---|
129 | ! Call for grid point i,j |
---|
130 | !------------------------------------------------------------------------------! |
---|
131 | SUBROUTINE advec_v_up_ij( i, j ) |
---|
132 | |
---|
133 | USE arrays_3d |
---|
134 | USE control_parameters |
---|
135 | USE grid_variables |
---|
136 | USE indices |
---|
137 | |
---|
138 | IMPLICIT NONE |
---|
139 | |
---|
140 | INTEGER :: i, j, k |
---|
141 | |
---|
142 | REAL :: ukomp, vkomp, wkomp |
---|
143 | |
---|
144 | |
---|
145 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
146 | ! |
---|
147 | !-- x-direction |
---|
148 | ukomp = 0.25 * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1) & |
---|
149 | ) - u_gtrans |
---|
150 | IF ( ukomp > 0.0 ) THEN |
---|
151 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
152 | ( v(k,j,i) - v(k,j,i-1) ) * ddx |
---|
153 | ELSE |
---|
154 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
155 | ( v(k,j,i+1) - v(k,j,i) ) * ddx |
---|
156 | ENDIF |
---|
157 | ! |
---|
158 | !-- y-direction |
---|
159 | vkomp = v(k,j,i) - v_gtrans |
---|
160 | IF ( vkomp > 0.0 ) THEN |
---|
161 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
162 | ( v(k,j,i) - v(k,j-1,i) ) * ddy |
---|
163 | ELSE |
---|
164 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
165 | ( v(k,j+1,i) - v(k,j,i) ) * ddy |
---|
166 | ENDIF |
---|
167 | ! |
---|
168 | !-- z-direction |
---|
169 | wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) ) |
---|
170 | IF ( wkomp > 0.0 ) THEN |
---|
171 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
172 | ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k) |
---|
173 | ELSE |
---|
174 | tend(k,j,i) = tend(k,j,i) - wkomp * & |
---|
175 | ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) |
---|
176 | ENDIF |
---|
177 | |
---|
178 | ENDDO |
---|
179 | |
---|
180 | END SUBROUTINE advec_v_up_ij |
---|
181 | |
---|
182 | END MODULE advec_v_up_mod |
---|