4
5
6
7
8
9
10
11
12
13
14
15
16
19# ifdef FLOATS
21# endif
24 USE roms_interpolate_mod
25
26# ifdef DISTRIBUTE
28# endif
29
30 implicit none
31
32
33
34 integer, intent(in) :: ng, model
35
36
37
38 integer :: IstrR, Iend, JstrR, Jend
39 integer :: LBi, UBi, LBj, UBj
40 integer :: i, j, k, l, mc
41
42 real(r8), parameter :: spv = 0.0_r8
43
44# ifdef FLOATS
45 real(r8) :: Xstr, Xend, Ystr, Yend, zfloat
46 logical, dimension(Nfloats(ng)) :: my_thread
47 real(r8), dimension(Nfloats(ng)) :: Iflt, Jflt
48# ifdef SOLVE3D
49 real(r8), dimension(Nfloats(ng)) :: Kflt
50# endif
51# endif
52
53# ifdef STATIONS
54 real(r8), dimension(Nstation(ng)) :: Slon, Slat
55 real(r8), dimension(Nstation(ng)) :: Ista, Jsta
56# endif
57
58
59
60
61
62# ifdef DISTRIBUTE
67# else
68 istrr=0
70 jstrr=0
72# endif
73
74 lbi=lbound(
grid(ng)%h,dim=1)
75 ubi=ubound(
grid(ng)%h,dim=1)
76 lbj=lbound(
grid(ng)%h,dim=2)
77 ubj=ubound(
grid(ng)%h,dim=2)
78
79# ifdef FLOATS
80
85
86
87
88
89
90
94 IF (
drifter(ng)%Findex(0).gt.0)
THEN
95 CALL hindices (ng, lbi, ubi, lbj, ubj, &
96 & istrr, iend+1, jstrr, jend+1, &
100 & 1, mc, 1, 1, &
101 & 1, mc, 1, 1, &
104 & iflt, jflt, spv, .false.)
105# ifdef DISTRIBUTE
108# endif
109 DO i=1,mc
113 END DO
114 END IF
115 END IF
116 END IF
117
118# ifdef SOLVE3D
119
120
121
122# ifdef DISTRIBUTE
129 my_thread(l)=.true.
130 ELSE
131 my_thread(l)=.false.
132 END IF
133 END DO
134 END IF
135# else
137 my_thread(l)=.true.
138 END DO
139# endif
140# endif
141
142
143
144
145
146
147
150# ifdef SOLVE3D
152 IF (my_thread(l).and. &
156 & real(
lm(ng),r8)+0.5_r8).and. &
158 & real(
mm(ng),r8)+0.5_r8)))
THEN
161 kflt(l)=zfloat
162 IF (zfloat.le.0.0_r8) THEN
165 IF (zfloat.lt.
grid(ng)%z_w(i,j,0))
THEN
166 zfloat=
grid(ng)%z_w(i,j,0)+5.0_r8
168 END IF
171 IF ((
grid(ng)%z_w(i,j,k)-zfloat)* &
172 & (zfloat-
grid(ng)%z_w(i,j,k-1)).ge.0.0_r8)
THEN
173 kflt(l)=real(k-1,r8)+ &
174 & (zfloat-
grid(ng)%z_w(i,j,k-1))/ &
176 END IF
177 END DO
178 END IF
179 ELSE
180 kflt(l)=spv
181 END IF
182# else
184# endif
185 END IF
186 END DO
187# ifdef SOLVE3D
189# ifdef DISTRIBUTE
192# endif
195 END DO
196 END IF
197# endif
198# endif
199# ifdef STATIONS
200
201
202
203
204
205
207 mc=0
209 IF (
scalars(ng)%Sflag(l).gt.0)
THEN
210 mc=mc+1
213 END IF
214 END DO
215 IF (mc.gt.0) THEN
216 CALL hindices (ng, lbi, ubi, lbj, ubj, &
217 & istrr, iend+1, jstrr, jend+1, &
221 & 1, mc, 1, 1, &
222 & 1, mc, 1, 1, &
223 & slon, slat, &
224 & ista, jsta, &
225 & spv, .false.)
226# ifdef DISTRIBUTE
229# endif
230 mc=0
232 IF (
scalars(ng)%Sflag(l).gt.0)
THEN
233 mc=mc+1
236 END IF
237 END DO
238 END IF
239 END IF
240# endif
241 RETURN
subroutine hindices(ng, lbi, ubi, lbj, ubj, is, ie, js, je, angler, xgrd, ygrd, lbm, ubm, lbn, ubn, ms, me, ns, ne, xpos, ypos, ipos, jpos, ijspv, rectangular)
type(t_drifter), dimension(:), allocatable drifter
type(t_grid), dimension(:), allocatable grid
integer, dimension(:), allocatable nfloats
integer, dimension(:), allocatable n
type(t_bounds), dimension(:), allocatable bounds
integer, dimension(:), allocatable nstation
integer, dimension(:), allocatable lm
integer, dimension(:), allocatable mm
logical, dimension(:), allocatable lfloats
type(t_scalars), dimension(:), allocatable scalars