From 7d9f43e1af4b8bb99ad69183e1fd088f3a679ef7 Mon Sep 17 00:00:00 2001 From: Lorenzo Figini Date: Thu, 5 Oct 2023 16:37:56 +0200 Subject: [PATCH] Remove tolerance when searching ray-wall intersections --- src/reflections.f90 | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/reflections.f90 b/src/reflections.f90 index 7cc157b..7b40f39 100644 --- a/src/reflections.f90 +++ b/src/reflections.f90 @@ -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)=zero .and. ti(j)<=one) then !check intersection is in r,z range and keep the closest sint = si(j)