229 el_list, n_pts, resx, resy, resz)
231 integer,
intent(in) :: n_pts
232 real(kind=
rp),
intent(inout) :: rst(3, n_pts)
233 real(kind=
rp),
intent(in) :: pt_x(n_pts)
234 real(kind=
rp),
intent(in) :: pt_y(n_pts)
235 real(kind=
rp),
intent(in) :: pt_z(n_pts)
236 real(kind=
rp),
intent(inout) :: resx(n_pts)
237 real(kind=
rp),
intent(inout) :: resy(n_pts)
238 real(kind=
rp),
intent(inout) :: resz(n_pts)
239 integer,
intent(in) :: el_list(n_pts)
240 real(kind=
rp) :: r_legendre(1, this%Xh%lx)
241 real(kind=
rp) :: s_legendre(this%Xh%lx, 1)
242 real(kind=
rp) :: t_legendre(this%Xh%lx, 1)
243 real(kind=
rp) :: dr_legendre(1, this%Xh%lx)
244 real(kind=
rp) :: ds_legendre(this%Xh%lx, 1)
245 real(kind=
rp) :: dt_legendre(this%Xh%lx, 1)
246 real(kind=
rp) :: jac(3,3)
247 real(kind=
xp) :: rst_d(3), jacinv(3,3)
248 real(kind=
rp),
dimension(this%Xh%lx * this%Xh%lx * this%Xh%lx) :: x_hat
249 real(kind=
rp),
dimension(this%Xh%lx * this%Xh%lx * this%Xh%lx) :: y_hat
250 real(kind=
rp),
dimension(this%Xh%lx * this%Xh%lx * this%Xh%lx) :: z_hat
253 integer :: i, j, e, iter, lx, ih
258 if (n_pts .lt. 1)
return
266 do while (.not. converged)
269 r_legendre(1, 1) = 1.0
270 r_legendre(1, 2) = rst(1,i)
271 s_legendre(1, 1) = 1.0
272 s_legendre(2, 1) = rst(2,i)
273 t_legendre(1, 1) = 1.0
274 t_legendre(2, 1) = rst(3,i)
275 dr_legendre(1, 1) = 0.0
276 dr_legendre(1, 2) = 1.0
277 ds_legendre(1, 1) = 0.0
278 ds_legendre(2, 1) = 1.0
279 dt_legendre(1, 1) = 0.0
280 dt_legendre(2, 1) = 1.0
282 r_legendre(1, j+1) = ((2.0_xp*(j-1.0_xp)+1.0_xp) * rst(1,i) &
283 * r_legendre(1, j) - (j-1.0_xp) &
284 * r_legendre(1, j-1)) / (
real(j,
xp))
285 s_legendre(j+1, 1) = ((2.0_xp*(j-1.0_xp)+1.0_xp) * rst(2,i) &
286 * s_legendre(j, 1) - (j-1.0_xp) &
287 * s_legendre(j-1, 1))/(
real(j,
xp))
288 t_legendre(j+1, 1) = ((2.0_xp*(j-1.0_xp)+1.0_xp) * rst(3,i) &
289 * t_legendre(j, 1) - (j-1.0_xp) &
290 * t_legendre(j-1, 1))/(
real(j,
xp))
291 dr_legendre(1, j+1) = ((j-1.0_xp)+1.0_xp) * r_legendre(1, j) &
292 + rst(1,i)*dr_legendre(1, j)
293 ds_legendre(j+1, 1) = ((j-1.0_xp)+1.0_xp) * s_legendre(j, 1) &
294 + rst(2,i)*ds_legendre(j, 1)
295 dt_legendre(j+1, 1) = ((j-1.0_xp)+1.0_xp) * t_legendre(j, 1) &
296 + rst(3,i)*dt_legendre(j, 1)
298 e = (el_list(i))*this%Xh%lxyz + 1
301 do ih = 0, lx*lx*lx - 1
302 x_hat(ih + 1) = this%x_hat%x(e + ih)
303 y_hat(ih + 1) = this%y_hat%x(e + ih)
304 z_hat(ih + 1) = this%z_hat%x(e + ih)
309 r_legendre, s_legendre, t_legendre)
311 r_legendre, s_legendre, t_legendre)
313 r_legendre, s_legendre, t_legendre)
317 dr_legendre, s_legendre, t_legendre)
319 dr_legendre, s_legendre, t_legendre)
321 dr_legendre, s_legendre, t_legendre)
323 r_legendre, ds_legendre, t_legendre)
325 r_legendre, ds_legendre, t_legendre)
327 r_legendre, ds_legendre, t_legendre)
329 r_legendre, s_legendre, dt_legendre)
331 r_legendre, s_legendre, dt_legendre)
333 r_legendre, s_legendre, dt_legendre)
334 resx(i) = pt_x(i) - resx(i)
335 resy(i) = pt_y(i) - resy(i)
336 resz(i) = pt_z(i) - resz(i)
338 jacinv =
matinv39(jac(1,1), jac(1,2), jac(1,3),&
339 jac(2,1), jac(2,2), jac(2,3),&
340 jac(3,1), jac(3,2), jac(3,3))
342 rst_d(1) = (resx(i)*jacinv(1,1) &
343 + jacinv(2,1)*resy(i) &
344 + jacinv(3,1)*resz(i))
345 rst_d(2) = (resx(i)*jacinv(1,2) &
346 + jacinv(2,2)*resy(i) &
347 + jacinv(3,2)*resz(i))
348 rst_d(3) = (resx(i)*jacinv(1,3) &
349 + jacinv(2,3)*resy(i) &
350 + jacinv(3,3)*resz(i))
353 if (norm2(
real(rst_d,
xp)) .le. this%tol)
then
356 if (norm2(
real(rst_d,
xp)) .gt. 4.0)
then
360 rst(1,i) = rst(1,i) + rst_d(1)
361 rst(2,i) = rst(2,i) + rst_d(2)
362 rst(3,i) = rst(3,i) + rst_d(3)
364 converged = conv_pts .eq. 1
365 if (iter .ge. this%max_iter) converged = .true.