230 el_list, n_pts, resx, resy, resz)
232 integer,
intent(in) :: n_pts
233 real(kind=
rp),
intent(inout) :: rst(3, n_pts)
234 real(kind=
rp),
intent(in) :: pt_x(n_pts)
235 real(kind=
rp),
intent(in) :: pt_y(n_pts)
236 real(kind=
rp),
intent(in) :: pt_z(n_pts)
237 real(kind=
rp),
intent(inout) :: resx(n_pts)
238 real(kind=
rp),
intent(inout) :: resy(n_pts)
239 real(kind=
rp),
intent(inout) :: resz(n_pts)
240 integer,
intent(in) :: el_list(n_pts)
241 real(kind=
rp) :: r_legendre(this%Xh%lx)
242 real(kind=
rp) :: s_legendre(this%Xh%lx)
243 real(kind=
rp) :: t_legendre(this%Xh%lx)
244 real(kind=
rp) :: dr_legendre(this%Xh%lx)
245 real(kind=
rp) :: ds_legendre(this%Xh%lx)
246 real(kind=
rp) :: dt_legendre(this%Xh%lx)
247 real(kind=
rp) :: jac(3,3)
248 real(kind=
xp) :: tmp(this%Xh%lx), tmp2(this%Xh%lx)
249 real(kind=
xp) :: rst_d(3), jacinv(3,3)
252 integer :: i, j, e, iter, lx, lx2
257 if (n_pts .lt. 1)
return
265 do while (.not. converged)
269 r_legendre(2) = rst(1,i)
271 s_legendre(2) = rst(2,i)
273 t_legendre(2) = rst(3,i)
281 r_legendre(j+1) = ((2.0_xp*(j-1.0_xp)+1.0_xp) * rst(1,i) &
282 * r_legendre(j) - (j-1.0_xp) &
283 * r_legendre(j-1)) / (
real(j,
xp))
284 s_legendre(j+1) = ((2.0_xp*(j-1.0_xp)+1.0_xp) * rst(2,i) &
285 * s_legendre(j) - (j-1.0_xp) &
286 * s_legendre(j-1))/(
real(j,
xp))
287 t_legendre(j+1) = ((2.0_xp*(j-1.0_xp)+1.0_xp) * rst(3,i) &
288 * t_legendre(j) - (j-1.0_xp) &
289 * t_legendre(j-1))/(
real(j,
xp))
290 dr_legendre(j+1) = ((j-1.0_xp)+1.0_xp) * r_legendre(j) &
291 + rst(1,i)*dr_legendre(j)
292 ds_legendre(j+1) = ((j-1.0_xp)+1.0_xp) * s_legendre(j) &
293 + rst(2,i)*ds_legendre(j)
294 dt_legendre(j+1) = ((j-1.0_xp)+1.0_xp) * t_legendre(j) &
295 + rst(3,i)*dt_legendre(j)
297 e = (el_list(i))*this%Xh%lxyz + 1
300 r_legendre, s_legendre, t_legendre)
302 r_legendre, s_legendre, t_legendre)
304 r_legendre, s_legendre, t_legendre)
308 dr_legendre, s_legendre(1), t_legendre)
310 dr_legendre, s_legendre(1), t_legendre)
312 dr_legendre, s_legendre, t_legendre)
314 r_legendre, ds_legendre, t_legendre)
316 r_legendre, ds_legendre, t_legendre)
318 r_legendre, ds_legendre, t_legendre)
320 r_legendre, s_legendre, dt_legendre)
322 r_legendre, s_legendre, dt_legendre)
324 r_legendre, s_legendre, dt_legendre)
325 resx(i) = pt_x(i) - resx(i)
326 resy(i) = pt_y(i) - resy(i)
327 resz(i) = pt_z(i) - resz(i)
329 jacinv =
matinv39(jac(1,1), jac(1,2), jac(1,3),&
330 jac(2,1), jac(2,2), jac(2,3),&
331 jac(3,1), jac(3,2), jac(3,3))
333 rst_d(1) = (resx(i)*jacinv(1,1) &
334 + jacinv(2,1)*resy(i) &
335 + jacinv(3,1)*resz(i))
336 rst_d(2) = (resx(i)*jacinv(1,2) &
337 + jacinv(2,2)*resy(i) &
338 + jacinv(3,2)*resz(i))
339 rst_d(3) = (resx(i)*jacinv(1,3) &
340 + jacinv(2,3)*resy(i) &
341 + jacinv(3,3)*resz(i))
344 if (norm2(
real(rst_d,
xp)) .le. this%tol)
then
347 if (norm2(
real(rst_d,
xp)) .gt. 4.0)
then
351 rst(1,i) = rst(1,i) + rst_d(1)
352 rst(2,i) = rst(2,i) + rst_d(2)
353 rst(3,i) = rst(3,i) + rst_d(3)
355 converged = conv_pts .eq. 1
356 if (iter .ge. this%max_iter) converged = .true.