Added lattice outer universe capability

This commit is contained in:
Sterling Harper 2015-02-08 22:33:55 -05:00
parent fa77543013
commit 3fa5047ef5
5 changed files with 56 additions and 39 deletions

View file

@ -127,6 +127,9 @@ module constants
SURF_CONE_Y = 10, & ! Cone parallel to y-axis
SURF_CONE_Z = 11 ! Cone parallel to z-axis
! Flag to say that the outside of a lattice is not defined
integer, parameter :: NO_OUTER_UNIV = -22
! Maximum number of lost particles
integer, parameter :: MAX_LOST_PARTICLES = 10

View file

@ -280,17 +280,17 @@ contains
p % coord % xyz = xyz
else
! We're outside the lattice, so treat this as a normal cell with
! the material specified for the outside
!
! ! We're outside the lattice, so treat this as a normal cell with
! ! the material specified for the outside
!
outside_lattice = .true.
p % last_material = p % material
p % material = c % material
! We'll still make a new coordinate for the particle, as
! distance_to_boundary will still need to track through lattice
! widths even though there's nothing in them but this material
! p % last_material = p % material
! p % material = c % material
!
! ! We'll still make a new coordinate for the particle, as
! ! distance_to_boundary will still need to track through lattice
! ! widths even though there's nothing in them but this material
end if
@ -322,13 +322,13 @@ contains
if (.not. outside_lattice) then
p % coord % next % universe = lat % universes(i_x,i_y,i_z)
else
! Set universe as the same for subsequent calls to find_cell
p % coord % next % universe = p % coord % universe
! Set coord cell for calls to distance_to_boundary
p % coord % next % cell = index_cell
if (lat % outer == NO_OUTER_UNIV) then
call fatal_error("A particle is outside latttice " &
&// trim(to_str(lat % id)) // " but the lattice has no &
&defined outer universe.")
else
p % coord % next % universe = lat % outer
end if
end if
! Move particle to next level
@ -336,10 +336,9 @@ contains
end if
if (.not. outside_lattice) then
call find_cell(p, found)
if (.not. found) exit
end if
! Find in the next lowest coordinate level.
call find_cell(p, found)
if (.not. found) exit
end if

View file

@ -30,7 +30,7 @@ module geometry_header
real(8), allocatable :: lower_left(:) ! lower-left corner of lattice
real(8), allocatable :: width(:) ! width of each lattice cell
integer, allocatable :: universes(:,:,:) ! specified universes
integer :: outside ! material to fill area outside
integer :: outer ! universe to tile outside the lat
end type Lattice
!===============================================================================

View file

@ -607,17 +607,17 @@ contains
c % fill = universe_dict % get_key(id)
elseif (lattice_dict % has_key(id)) then
lid = lattice_dict % get_key(id)
mid = lattices(lid) % outside
! mid = lattices(lid) % outside
c % type = CELL_LATTICE
c % fill = lid
if (mid == MATERIAL_VOID) then
c % material = mid
else if (material_dict % has_key(mid)) then
c % material = material_dict % get_key(mid)
else
call fatal_error("Could not find material " // trim(to_str(mid)) &
&// " specified on lattice " // trim(to_str(lid)))
end if
! if (mid == MATERIAL_VOID) then
! c % material = mid
! else if (material_dict % has_key(mid)) then
! c % material = material_dict % get_key(mid)
! else
! call fatal_error("Could not find material " // trim(to_str(mid)) &
! &// " specified on lattice " // trim(to_str(lid)))
! end if
else
call fatal_error("Specified fill " // trim(to_str(id)) // " on cell "&
@ -654,6 +654,15 @@ contains
end do
end do
if (lat % outer /= NO_OUTER_UNIV) then
if (universe_dict % has_key(id)) then
lat % outer = universe_dict % get_key(id)
else
call fatal_error("Invalid universe number " // trim(to_str(id)) &
&// " specified on lattice " // trim(to_str(lat % id)))
end if
end if
end do
TALLY_LOOP: do i = 1, n_tallies

View file

@ -1341,14 +1341,20 @@ contains
deallocate(temp_int_array)
! Read material for area outside lattice
lat % outside = MATERIAL_VOID
if (check_for_node(node_lat, "outside")) then
call get_node_value(node_lat, "outside", mid)
if (mid == 0 .or. mid == MATERIAL_VOID) then
lat % outside = MATERIAL_VOID
else
lat % outside = mid
end if
! lat % outside = MATERIAL_VOID
! if (check_for_node(node_lat, "outside")) then
! call get_node_value(node_lat, "outside", mid)
! if (mid == 0 .or. mid == MATERIAL_VOID) then
! lat % outside = MATERIAL_VOID
! else
! lat % outside = mid
! end if
! end if
! Read outer universe for area outside lattice.
lat % outer = NO_OUTER_UNIV
if (check_for_node(node_lat, "outer")) then
call get_node_value(node_lat, "outer", lat % outer)
end if
! Add lattice to dictionary