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