routine that updates positions of photon and calls Fresnel routines if photon leaves current voxel
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cart_grid), | intent(in) | :: | grid | |||
type(vector), | intent(inout) | :: | pos | |||
integer, | intent(inout) | :: | celli | |||
integer, | intent(inout) | :: | cellj | |||
integer, | intent(inout) | :: | cellk | |||
real(kind=wp), | intent(in) | :: | dcell | |||
logical, | intent(in) | :: | wall_flag | |||
type(vector), | intent(in) | :: | dir | |||
logical, | intent(in) | :: | ldir(:) | |||
real(kind=wp), | intent(in) | :: | delta |
subroutine update_pos(grid, pos, celli, cellj, cellk, dcell, wall_flag, dir, ldir, delta) !! routine that updates positions of photon and calls Fresnel routines if photon leaves current voxel use vector_class use gridMod use utils, only : str type(cart_grid), intent(IN) :: grid type(vector), intent(IN) :: dir logical, intent(IN) :: wall_flag, ldir(:) real(kind=wp), intent(IN) :: dcell, delta type(vector), intent(INOUT) :: pos integer, intent(INOUT) :: celli, cellj, cellk if(wall_flag)then if(ldir(1))then if(dir%x > 0._wp)then pos%x = grid%xface(celli+1) + delta elseif(dir%x < 0._wp)then pos%x = grid%xface(celli) - delta else print*,'Error in x ldir in update_pos', ldir, dir end if pos%y = pos%y + dir%y*dcell pos%z = pos%z + dir%z*dcell elseif(ldir(2))then if(dir%y > 0._wp)then pos%y = grid%yface(cellj+1) + delta elseif(dir%y < 0._wp)then pos%y = grid%yface(cellj) - delta else print*,'Error in y ldir in update_pos', ldir, dir end if pos%x = pos%x + dir%x*dcell pos%z = pos%z + dir%z*dcell elseif(ldir(3))then if(dir%z > 0._wp)then pos%z = grid%zface(cellk+1) + delta elseif(dir%z < 0._wp)then pos%z = grid%zface(cellk) - delta else print*,'Error in z ldir in update_pos', ldir, dir end if pos%x = pos%x + dir%x*dcell pos%y = pos%y + dir%y*dcell else print*,'Error in update_pos... '//str(ldir) error stop 1 end if else pos%x = pos%x + dir%x*dcell pos%y = pos%y + dir%y*dcell pos%z = pos%z + dir%z*dcell end if if(wall_flag)then call update_voxels(grid, pos, celli, cellj, cellk) end if end subroutine update_pos