1 |
adcroft |
1.1 |
C $Header: $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "FLT_CPPOPTIONS.h" |
5 |
|
|
|
6 |
|
|
subroutine flt_bilinear( |
7 |
|
|
I xp, |
8 |
|
|
I yp, |
9 |
|
|
O uu, |
10 |
|
|
I kp, |
11 |
|
|
I u, |
12 |
|
|
I nu, |
13 |
|
|
I bi, |
14 |
|
|
I bj |
15 |
|
|
& ) |
16 |
|
|
|
17 |
|
|
c ================================================================== |
18 |
|
|
c SUBROUTINE flt_bilinear |
19 |
|
|
c ================================================================== |
20 |
|
|
c |
21 |
|
|
c o Bilinear scheme to find u of particle at given xp,yp location |
22 |
|
|
c |
23 |
|
|
c ================================================================== |
24 |
|
|
c SUBROUTINE flt_bilinear |
25 |
|
|
c ================================================================== |
26 |
|
|
|
27 |
|
|
c == global variables == |
28 |
|
|
|
29 |
|
|
#include "SIZE.h" |
30 |
|
|
|
31 |
|
|
c == routine arguments == |
32 |
|
|
|
33 |
|
|
_RL xp, yp |
34 |
|
|
_RL uu |
35 |
|
|
integer nu, kp, bi, bj |
36 |
|
|
_RL u (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
37 |
|
|
|
38 |
|
|
c == local variables == |
39 |
|
|
|
40 |
|
|
INTEGER nnx, nny, nfx, nfy, nfxp, nfyp |
41 |
|
|
_RL dx, dy, ddx, ddy |
42 |
|
|
integer ip |
43 |
|
|
_RL xx, yy, phi, scalex, scaley |
44 |
|
|
_RL u11, u12, u22, u21 |
45 |
|
|
|
46 |
|
|
c == end of interface == |
47 |
|
|
|
48 |
|
|
nnx = int(xp) |
49 |
|
|
nny = int(yp) |
50 |
|
|
dx = xp - float(nnx) |
51 |
|
|
dy = yp - float(nny) |
52 |
|
|
c |
53 |
|
|
c to chose the u box in which the particle is found |
54 |
|
|
c nu=1 for T, S |
55 |
|
|
c nu=2 for u |
56 |
|
|
c nu=3 for v |
57 |
|
|
c nu=4 for w |
58 |
|
|
c |
59 |
|
|
if (nu.eq.1.or.nu.eq.4) then |
60 |
|
|
nfx = nnx |
61 |
|
|
nfy = nny |
62 |
|
|
ddx = dx |
63 |
|
|
ddy = dy |
64 |
|
|
endif |
65 |
|
|
c |
66 |
|
|
if (nu.eq.2) then |
67 |
|
|
if (dx.le.0.5) then |
68 |
|
|
nfx = nnx |
69 |
|
|
ddx = dx + 0.5 |
70 |
|
|
else |
71 |
|
|
nfx = nnx + 1 |
72 |
|
|
ddx = dx - 0.5 |
73 |
|
|
endif |
74 |
|
|
nfy = nny |
75 |
|
|
ddy = dy |
76 |
|
|
endif |
77 |
|
|
c |
78 |
|
|
if (nu.eq.3) then |
79 |
|
|
if (dy.le.0.5) then |
80 |
|
|
nfy = nny |
81 |
|
|
ddy = dy + 0.5 |
82 |
|
|
else |
83 |
|
|
nfy = nny + 1 |
84 |
|
|
ddy = dy - 0.5 |
85 |
|
|
endif |
86 |
|
|
nfx = nnx |
87 |
|
|
ddx = dx |
88 |
|
|
endif |
89 |
|
|
c |
90 |
|
|
c |
91 |
|
|
cab change start |
92 |
|
|
c was correct only for global? |
93 |
|
|
c if(nfx.gt.nx) nfx=nfx-nx |
94 |
|
|
if(nfx.gt.nx) nfx=nx |
95 |
|
|
cab change end |
96 |
|
|
if(nfy.gt.ny) nfy=ny |
97 |
|
|
nfxp = nfx + 1 |
98 |
|
|
nfyp = nfy + 1 |
99 |
|
|
cab change start |
100 |
|
|
c if (nfx.eq.nx) nfxp = 1 |
101 |
|
|
if (nfx.eq.nx) nfxp = nfx |
102 |
|
|
cab change end |
103 |
|
|
if (nfy.eq.ny) nfyp = nfy |
104 |
|
|
|
105 |
|
|
if (nu.lt.4) then |
106 |
|
|
u11 = u(nfx,nfy,kp,bi,bj) |
107 |
|
|
u21 = u(nfxp,nfy,kp,bi,bj) |
108 |
|
|
u22 = u(nfxp,nfyp,kp,bi,bj) |
109 |
|
|
u12 = u(nfx,nfyp,kp,bi,bj) |
110 |
|
|
endif |
111 |
|
|
if (nu.eq.4) then |
112 |
|
|
u11 = u(nfx,nfy,kp,bi,bj)+u(nfx,nfy,kp-1,bi,bj) |
113 |
|
|
u21 = u(nfxp,nfy,kp,bi,bj)+u(nfxp,nfy,kp-1,bi,bj) |
114 |
|
|
u22 = u(nfxp,nfyp,kp,bi,bj)+u(nfxp,nfyp,kp-1,bi,bj) |
115 |
|
|
u12 = u(nfx,nfyp,kp,bi,bj)+u(nfx,nfyp,kp-1,bi,bj) |
116 |
|
|
endif |
117 |
|
|
c |
118 |
|
|
c |
119 |
|
|
c bilinear interpolation (from numerical recipes) |
120 |
|
|
uu = (1-ddx)*(1-ddy)*u11 + ddx*(1-ddy)*u21 + ddx*ddy*u22 |
121 |
|
|
. + (1-ddx)*ddy*u12 |
122 |
|
|
c |
123 |
|
|
c |
124 |
|
|
return |
125 |
|
|
end |
126 |
|
|
|
127 |
|
|
|
128 |
|
|
subroutine flt_bilinear2d( |
129 |
|
|
I xp, |
130 |
|
|
I yp, |
131 |
|
|
O uu, |
132 |
|
|
I u, |
133 |
|
|
I nu, |
134 |
|
|
I bi, |
135 |
|
|
I bj |
136 |
|
|
& ) |
137 |
|
|
|
138 |
|
|
c ================================================================== |
139 |
|
|
c SUBROUTINE flt_bilinear2d |
140 |
|
|
c ================================================================== |
141 |
|
|
c |
142 |
|
|
c o Bilinear scheme to find u of particle at given xp,yp location |
143 |
|
|
c o For 2D fields |
144 |
|
|
c |
145 |
|
|
c started: Arne Biastoch abiastoch@ucsd.edu 13-Jan-2000 |
146 |
|
|
c (adopted from subroutine bilinear) |
147 |
|
|
c |
148 |
|
|
c ================================================================== |
149 |
|
|
c SUBROUTINE flt_bilinear2d |
150 |
|
|
c ================================================================== |
151 |
|
|
|
152 |
|
|
c == global variables == |
153 |
|
|
|
154 |
|
|
#include "SIZE.h" |
155 |
|
|
|
156 |
|
|
c == routine arguments == |
157 |
|
|
|
158 |
|
|
_RL xp, yp |
159 |
|
|
_RL uu |
160 |
|
|
integer nu, bi, bj |
161 |
|
|
_RL u (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
162 |
|
|
|
163 |
|
|
c == local variables == |
164 |
|
|
|
165 |
|
|
INTEGER nnx, nny, nfx, nfy, nfxp, nfyp |
166 |
|
|
_RL dx, dy, ddx, ddy |
167 |
|
|
integer ip |
168 |
|
|
_RL xx, yy, phi, scalex, scaley |
169 |
|
|
_RL u11, u12, u22, u21 |
170 |
|
|
|
171 |
|
|
c == end of interface == |
172 |
|
|
|
173 |
|
|
nnx = int(xp) |
174 |
|
|
nny = int(yp) |
175 |
|
|
dx = xp - float(nnx) |
176 |
|
|
dy = yp - float(nny) |
177 |
|
|
c |
178 |
|
|
c to chose the u box in which the particle is found |
179 |
|
|
c nu=1 for T, S |
180 |
|
|
c nu=2 for u |
181 |
|
|
c nu=3 for v |
182 |
|
|
c nu=4 for w |
183 |
|
|
c |
184 |
|
|
if (nu.eq.1.or.nu.eq.4) then |
185 |
|
|
nfx = nnx |
186 |
|
|
nfy = nny |
187 |
|
|
ddx = dx |
188 |
|
|
ddy = dy |
189 |
|
|
endif |
190 |
|
|
c |
191 |
|
|
if (nu.eq.2) then |
192 |
|
|
if (dx.le.0.5) then |
193 |
|
|
nfx = nnx |
194 |
|
|
ddx = dx + 0.5 |
195 |
|
|
else |
196 |
|
|
nfx = nnx + 1 |
197 |
|
|
ddx = dx - 0.5 |
198 |
|
|
endif |
199 |
|
|
nfy = nny |
200 |
|
|
ddy = dy |
201 |
|
|
endif |
202 |
|
|
c |
203 |
|
|
if (nu.eq.3) then |
204 |
|
|
if (dy.le.0.5) then |
205 |
|
|
nfy = nny |
206 |
|
|
ddy = dy + 0.5 |
207 |
|
|
else |
208 |
|
|
nfy = nny + 1 |
209 |
|
|
ddy = dy - 0.5 |
210 |
|
|
endif |
211 |
|
|
nfx = nnx |
212 |
|
|
ddx = dx |
213 |
|
|
endif |
214 |
|
|
c |
215 |
|
|
cab change start |
216 |
|
|
c was correct only for global? |
217 |
|
|
c if(nfx.gt.nx) nfx=nfx-nx |
218 |
|
|
if(nfx.gt.nx) nfx=nx |
219 |
|
|
cab change end |
220 |
|
|
if(nfy.gt.ny) nfy=ny |
221 |
|
|
nfxp = nfx + 1 |
222 |
|
|
nfyp = nfy + 1 |
223 |
|
|
cab change start |
224 |
|
|
c if (nfx.eq.nx) nfxp = 1 |
225 |
|
|
if (nfx.eq.nx) nfxp = nfx |
226 |
|
|
cab change end |
227 |
|
|
if (nfy.eq.ny) nfyp = nfy |
228 |
|
|
|
229 |
|
|
if (nu.lt.4) then |
230 |
|
|
u11 = u(nfx,nfy,bi,bj) |
231 |
|
|
u21 = u(nfxp,nfy,bi,bj) |
232 |
|
|
u22 = u(nfxp,nfyp,bi,bj) |
233 |
|
|
u12 = u(nfx,nfyp,bi,bj) |
234 |
|
|
endif |
235 |
|
|
if (nu.eq.4) then |
236 |
|
|
u11 = u(nfx,nfy,bi,bj)+u(nfx,nfy,bi,bj) |
237 |
|
|
u21 = u(nfxp,nfy,bi,bj)+u(nfxp,nfy,bi,bj) |
238 |
|
|
u22 = u(nfxp,nfyp,bi,bj)+u(nfxp,nfyp,bi,bj) |
239 |
|
|
u12 = u(nfx,nfyp,bi,bj)+u(nfx,nfyp,bi,bj) |
240 |
|
|
endif |
241 |
|
|
c |
242 |
|
|
c |
243 |
|
|
c bilinear interpolation (from numerical recipes) |
244 |
|
|
uu = (1-ddx)*(1-ddy)*u11 + ddx*(1-ddy)*u21 + ddx*ddy*u22 |
245 |
|
|
. + (1-ddx)*ddy*u12 |
246 |
|
|
c |
247 |
|
|
c |
248 |
|
|
return |
249 |
|
|
end |
250 |
|
|
|