231 el_list, n_pts, resx, resy, resz)
233 integer,
intent(in) :: n_pts
234 real(kind=
rp),
intent(inout) :: rst(3, n_pts)
235 real(kind=
rp),
intent(in) :: pt_x(n_pts)
236 real(kind=
rp),
intent(in) :: pt_y(n_pts)
237 real(kind=
rp),
intent(in) :: pt_z(n_pts)
238 real(kind=
rp),
intent(inout) :: resx(n_pts)
239 real(kind=
rp),
intent(inout) :: resy(n_pts)
240 real(kind=
rp),
intent(inout) :: resz(n_pts)
241 integer,
intent(in) :: el_list(n_pts)
242 real(kind=
rp) :: r_legendre(this%Xh%lx)
243 real(kind=
rp) :: s_legendre(this%Xh%lx)
244 real(kind=
rp) :: t_legendre(this%Xh%lx)
245 real(kind=
rp) :: dr_legendre(this%Xh%lx)
246 real(kind=
rp) :: ds_legendre(this%Xh%lx)
247 real(kind=
rp) :: dt_legendre(this%Xh%lx)
248 real(kind=
rp) :: jac(3,3)
249 real(kind=
xp) :: tmp(this%Xh%lx), tmp2(this%Xh%lx)
250 real(kind=
xp) :: rst_d(3), jacinv(3,3)
253 integer :: i, j, e, iter, lx, lx2
258 if (n_pts .lt. 1)
return
266 do while (.not. converged)
270 r_legendre(2) = rst(1,i)
272 s_legendre(2) = rst(2,i)
274 t_legendre(2) = rst(3,i)
282 r_legendre(j+1) = ((2.0_xp*(j-1.0_xp)+1.0_xp) * rst(1,i) &
283 * r_legendre(j) - (j-1.0_xp) &
284 * r_legendre(j-1)) / (
real(j,
xp))
285 s_legendre(j+1) = ((2.0_xp*(j-1.0_xp)+1.0_xp) * rst(2,i) &
286 * s_legendre(j) - (j-1.0_xp) &
287 * s_legendre(j-1))/(
real(j,
xp))
288 t_legendre(j+1) = ((2.0_xp*(j-1.0_xp)+1.0_xp) * rst(3,i) &
289 * t_legendre(j) - (j-1.0_xp) &
290 * t_legendre(j-1))/(
real(j,
xp))
291 dr_legendre(j+1) = ((j-1.0_xp)+1.0_xp) * r_legendre(j) &
292 + rst(1,i)*dr_legendre(j)
293 ds_legendre(j+1) = ((j-1.0_xp)+1.0_xp) * s_legendre(j) &
294 + rst(2,i)*ds_legendre(j)
295 dt_legendre(j+1) = ((j-1.0_xp)+1.0_xp) * t_legendre(j) &
296 + rst(3,i)*dt_legendre(j)
298 e = (el_list(i))*this%Xh%lxyz + 1
301 r_legendre, s_legendre, t_legendre)
303 r_legendre, s_legendre, t_legendre)
305 r_legendre, s_legendre, t_legendre)
309 dr_legendre, s_legendre(1), t_legendre)
311 dr_legendre, s_legendre(1), t_legendre)
313 dr_legendre, s_legendre, t_legendre)
315 r_legendre, ds_legendre, t_legendre)
317 r_legendre, ds_legendre, t_legendre)
319 r_legendre, ds_legendre, t_legendre)
321 r_legendre, s_legendre, dt_legendre)
323 r_legendre, s_legendre, dt_legendre)
325 r_legendre, s_legendre, dt_legendre)
326 resx(i) = pt_x(i) - resx(i)
327 resy(i) = pt_y(i) - resy(i)
328 resz(i) = pt_z(i) - resz(i)
330 jacinv =
matinv39(jac(1,1), jac(1,2), jac(1,3),&
331 jac(2,1), jac(2,2), jac(2,3),&
332 jac(3,1), jac(3,2), jac(3,3))
334 rst_d(1) = (resx(i)*jacinv(1,1) &
335 + jacinv(2,1)*resy(i) &
336 + jacinv(3,1)*resz(i))
337 rst_d(2) = (resx(i)*jacinv(1,2) &
338 + jacinv(2,2)*resy(i) &
339 + jacinv(3,2)*resz(i))
340 rst_d(3) = (resx(i)*jacinv(1,3) &
341 + jacinv(2,3)*resy(i) &
342 + jacinv(3,3)*resz(i))
345 if (norm2(
real(rst_d,
xp)) .le. this%tol)
then
348 if (norm2(
real(rst_d,
xp)) .gt. 4.0)
then
352 rst(1,i) = rst(1,i) + rst_d(1)
353 rst(2,i) = rst(2,i) + rst_d(2)
354 rst(3,i) = rst(3,i) + rst_d(3)
356 converged = conv_pts .eq. 1
357 if (iter .ge. this%max_iter) converged = .true.