/[MITgcm]/MITgcm/pkg/flt/flt_bilinear.F
ViewVC logotype

Contents of /MITgcm/pkg/flt/flt_bilinear.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Thu Sep 13 17:43:55 2001 UTC (22 years, 8 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint51k_post, checkpoint47e_post, checkpoint52l_pre, ecco_c44_e19, hrcube4, hrcube5, checkpoint46l_post, checkpoint46g_pre, checkpoint47c_post, release1_p13_pre, checkpoint50c_post, checkpoint46f_post, checkpoint52d_pre, checkpoint48e_post, checkpoint50g_post, checkpoint46b_post, checkpoint52j_pre, checkpoint43a-release1mods, checkpoint51o_pre, checkpoint44g_post, checkpoint54d_post, checkpoint48c_post, checkpoint54e_post, ecco_c50_e32, ecco_c50_e33, ecco_c50_e30, ecco_c50_e31, release1_p13, checkpoint51l_post, checkpoint48i_post, checkpoint46l_pre, checkpoint50d_pre, checkpoint52k_post, chkpt44d_post, checkpoint54, checkpoint51, checkpoint53, checkpoint52, release1_p8, release1_p9, checkpoint50d_post, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, checkpoint52f_post, checkpoint50b_pre, checkpoint44e_pre, checkpoint51f_post, release1_b1, checkpoint48b_post, ecco_c51_e34d, ecco_c51_e34e, ecco_c51_e34f, ecco_c51_e34g, ecco_c51_e34a, ecco_c51_e34b, ecco_c51_e34c, checkpoint43, checkpoint51d_post, checkpoint48c_pre, checkpoint51t_post, checkpoint51n_post, release1_chkpt44d_post, chkpt44c_pre, checkpoint52i_pre, hrcube_2, hrcube_3, checkpoint51s_post, checkpoint48d_pre, checkpoint51j_post, checkpoint47i_post, checkpoint52e_pre, checkpoint52e_post, checkpoint51n_pre, checkpoint47d_post, icebear5, icebear4, icebear3, icebear2, checkpoint53d_post, checkpoint46d_pre, checkpoint48d_post, release1-branch_tutorials, checkpoint48f_post, checkpoint45d_post, checkpoint52b_pre, checkpoint54b_post, checkpoint46j_pre, ecco_c50_e28, checkpoint51l_pre, checkpoint52m_post, checkpoint47d_pre, checkpoint53b_post, checkpoint44h_pre, checkpoint48h_post, checkpoint51q_post, ecco_c50_e29, checkpoint51b_pre, checkpoint46a_post, checkpoint47g_post, checkpoint52b_post, chkpt44c_post, checkpoint46j_post, checkpoint51h_pre, checkpoint46k_post, checkpoint46b_pre, checkpoint52h_pre, checkpoint45a_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, hrcube_1, checkpoint51m_post, checkpoint52c_post, checkpoint44e_post, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, release1_p12, release1_p10, release1_p11, release1_p16, release1_p17, release1_p14, release1_p15, checkpoint47a_post, ecco_c50_e33a, checkpoint53c_post, branchpoint-genmake2, checkpoint54a_post, checkpoint46e_pre, checkpoint51r_post, checkpoint45b_post, checkpoint51i_post, release1-branch-end, release1_final_v1, checkpoint51b_post, release1_p12_pre, checkpoint46c_pre, checkpoint53a_post, checkpoint44f_post, checkpoint47b_post, checkpoint44b_post, ecco_c51_e34, checkpoint46h_pre, checkpoint52d_post, checkpoint53g_post, checkpoint46m_post, checkpoint46a_pre, checkpoint50c_pre, checkpoint45c_post, ecco_ice2, ecco_ice1, checkpoint44h_post, checkpoint46g_post, checkpoint51c_post, checkpoint52a_pre, checkpoint46i_post, checkpoint50h_post, checkpoint52i_post, checkpoint50e_pre, checkpoint50i_post, ecco_c44_e25, checkpoint54c_post, checkpoint51i_pre, checkpoint48a_post, checkpoint53f_post, checkpoint47j_post, checkpoint54a_pre, checkpoint53b_pre, branch-exfmods-tag, checkpoint52j_post, checkpoint47f_post, checkpoint50e_post, chkpt44a_pre, ecco_c44_e22, ecco_c44_e23, ecco_c44_e20, ecco_c44_e21, ecco_c44_e26, ecco_c44_e27, ecco_c44_e24, checkpoint46c_post, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5, branch-netcdf, checkpoint52l_post, checkpoint52n_post, checkpoint46e_post, release1_beta1, checkpoint51e_post, checkpoint44b_pre, checkpoint42, checkpoint40, checkpoint41, checkpoint46, checkpoint47, checkpoint44, checkpoint45, checkpoint48, checkpoint49, checkpoint46h_post, checkpoint51o_post, checkpoint50, checkpoint51f_pre, chkpt44a_post, checkpoint47h_post, checkpoint52a_post, checkpoint44f_pre, checkpoint51g_post, ecco_c52_e35, checkpoint46d_post, checkpoint50b_post, release1-branch_branchpoint, checkpoint52f_pre, checkpoint53d_pre, checkpoint51a_post, checkpoint51p_post, checkpoint48g_post, checkpoint51u_post
Branch point for: c24_e25_ice, branch-exfmods-curt, release1_coupled, release1_final, release1-branch, branch-genmake2, release1, branch-nonh, tg2-branch, ecco-branch, release1_50yr, netcdf-sm0, icebear, checkpoint51n_branch
Added package "flt".
 o pkg/flt
 o verification/flt_example
 o visualization of trajectories supplied
 o works but output not available to testscript

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

  ViewVC Help
Powered by ViewVC 1.1.22