Remove tolerance when searching ray-wall intersections

This commit is contained in:
Lorenzo Figini 2023-10-05 16:37:56 +02:00
parent cf8a37fec9
commit 7d9f43e1af

View File

@ -33,11 +33,9 @@ subroutine inters_linewall(xv,kv,rw,zw,nw,sint,normw)
real(wp_), dimension(nw), intent(in) :: rw,zw
real(wp_), intent(out) :: sint
real(wp_), dimension(3), intent(out) :: normw
integer :: i,j,ni,iint,nneg
integer :: i,j,ni,iint,first
real(wp_), dimension(2) :: si,ti
real(wp_) :: drw,dzw,xint,yint,rint,l,kxy
real(wp_) :: tol
tol=sqrt(comp_eps)
sint=comp_huge
iint=0
normw=zero
@ -45,20 +43,14 @@ subroutine inters_linewall(xv,kv,rw,zw,nw,sint,normw)
!search intersections with i-th wall segment
call linecone_coord(xv,kv,rw(i:i+1),zw(i:i+1),si,ti,ni)
!discard solutions with s<=0
nneg=0
first=ni+1
do j=1,ni
if (si(j)<=tol) then
nneg=j
else
if (si(j)>zero) then
first=j
exit
end if
end do
! do while (ni>0 .and. si(1)<=tol)
! ni = ni-1
! si(1) = si(2) ???
! ti(1) = ti(2) ???
! end do
do j=nneg+1,ni
do j=first,ni
if ((si(j)<sint .or. iint==0) .and. ti(j)>=zero .and. ti(j)<=one) then
!check intersection is in r,z range and keep the closest
sint = si(j)