Added reflective boundary conditions for cylinders. Not tested yet.

This commit is contained in:
Paul Romano 2011-09-11 15:20:07 -04:00
parent 7a35883e24
commit 43e34950bd

View file

@ -243,6 +243,45 @@ contains
v = v - 2*dot_prod*n2/norm
w = w - 2*dot_prod*n3/norm
! Set vector
p % uvw = (/ u, v, w /)
case (SURF_CYL_X)
! Find y-y0, z-z0 and dot product of direction and surface normal
y = p % xyz(2) - surf % coeffs(2)
z = p % xyz(3) - surf % coeffs(3)
R = surf % coeffs(4)
dot_prod = v*y + w*z
! Reflect direction according to normal
v = v - 2*dot_prod*y/(R*R)
w = w - 2*dot_prod*z/(R*R)
! Set vector
p % uvw = (/ u, v, w /)
case (SURF_CYL_Y)
! Find x-x0, z-z0 and dot product of direction and surface normal
x = p % xyz(1) - surf % coeffs(1)
z = p % xyz(3) - surf % coeffs(3)
R = surf % coeffs(4)
dot_prod = u*x + w*z
! Reflect direction according to normal
u = u - 2*dot_prod*x/(R*R)
w = w - 2*dot_prod*z/(R*R)
! Set vector
p % uvw = (/ u, v, w /)
case (SURF_CYL_Z)
! Find x-x0, y-y0 and dot product of direction and surface normal
x = p % xyz(1) - surf % coeffs(1)
y = p % xyz(2) - surf % coeffs(2)
R = surf % coeffs(4)
dot_prod = u*x + v*y
! Reflect direction according to normal
u = u - 2*dot_prod*x/(R*R)
v = v - 2*dot_prod*y/(R*R)
! Set vector
p % uvw = (/ u, v, w /)
case (SURF_SPHERE)
@ -279,6 +318,9 @@ contains
return
end if
! ==========================================================================
! SEARCH NEIGHBOR LISTS FOR NEXT CELL
if (p%surface > 0 .and. allocated(surf%neighbor_pos)) then
! If coming from negative side of surface, search all the neighboring
! cells on the positive side
@ -327,7 +369,9 @@ contains
end do
end if
! Couldn't find particle in neighboring cells, search through all cells
! ==========================================================================
! COULDN'T FIND PARTICLE IN NEIGHBORING CELLS, SEARCH ALL CELLS
do i = 1, size(cells)
c => cells(i)
if (cell_contains(c, p)) then