Changed mesh_bins filter on TallyObject to scalar integer named mesh.

This commit is contained in:
Paul Romano 2011-09-29 14:49:26 -04:00
parent 1e5fb2e428
commit fa4d0f2adb
6 changed files with 49 additions and 61 deletions

View file

@ -417,16 +417,14 @@ contains
! ADJUST MESH INDICES FOR EACH TALLY
if (t % n_bins(T_MESH) > 0) then
do j = 1, size(t % mesh_bins)
uid = t % mesh_bins(j) % scalar
if (dict_has_key(mesh_dict, uid)) then
t % mesh_bins(j) % scalar = dict_get_key(mesh_dict, uid)
else
msg = "Could not find mesh " // trim(int_to_str(uid)) // &
& " specified on tally " // trim(int_to_str(t % uid))
call fatal_error(msg)
end if
end do
uid = t % mesh
if (dict_has_key(mesh_dict, uid)) then
t % mesh = dict_get_key(mesh_dict, uid)
else
msg = "Could not find mesh " // trim(int_to_str(uid)) // &
& " specified on tally " // trim(int_to_str(t % uid))
call fatal_error(msg)
end if
end if
end do

View file

@ -679,25 +679,20 @@ contains
end if
! Read mesh filter bins
if (len_trim(tally_(i) % filters % mesh) > 0) then
call split_string(tally_(i) % filters % mesh, words, n_words)
allocate(t % mesh_bins(n_words))
do j = 1, n_words
t % mesh_bins(j) % scalar = str_to_int(words(j))
t % mesh = tally_(i) % filters % mesh
if (t % mesh > 0) then
! Determine index in mesh array for this bin
uid = t % mesh
if (dict_has_key(mesh_dict, uid)) then
index = dict_get_key(mesh_dict, uid)
m => meshes(index)
else
msg = "Could not find mesh " // trim(int_to_str(uid)) // &
" specified on tally " // trim(int_to_str(t % uid))
call fatal_error(msg)
end if
! Determine index in mesh array for this bin
uid = t % mesh_bins(j) % scalar
if (dict_has_key(mesh_dict, uid)) then
index = dict_get_key(mesh_dict, uid)
m => meshes(index)
else
msg = "Could not find mesh " // trim(int_to_str(uid)) // &
" specified on tally " // trim(int_to_str(t % uid))
call fatal_error(msg)
end if
t % n_bins(T_MESH) = t % n_bins(T_MESH) + product(m % dimension)
end do
t % n_bins(T_MESH) = t % n_bins(T_MESH) + product(m % dimension)
end if
! Read birth region filter bins

View file

@ -560,11 +560,9 @@ contains
if (t % n_bins(T_MESH) > 0) then
string = ""
do i = 1, size(t % mesh_bins)
uid = t % mesh_bins(i) % scalar
mesh => meshes(uid)
string = trim(string) // ' ' // trim(int_to_str(mesh % uid))
end do
uid = t % mesh
mesh => meshes(uid)
string = trim(string) // ' ' // trim(int_to_str(mesh % uid))
write(ou, *) ' Mesh Bins:' // trim(string)
end if

View file

@ -105,7 +105,7 @@ contains
! allocate tally map array -- note that we don't need a tally map for the
! energy_in and energy_out filters
allocate(tally_maps(TALLY_TYPES - 2))
allocate(tally_maps(TALLY_TYPES - 3))
! allocate list of items for each different filter type
allocate(tally_maps(T_UNIVERSE) % items(n_universes))
@ -113,10 +113,9 @@ contains
allocate(tally_maps(T_CELL) % items(n_cells))
allocate(tally_maps(T_CELLBORN) % items(n_cells))
allocate(tally_maps(T_SURFACE) % items(n_surfaces))
allocate(tally_maps(T_MESH) % items(100)) ! TODO: Change this
! Allocate and initialize tally map positioning for finding bins
allocate(position(TALLY_TYPES - 2))
allocate(position(TALLY_TYPES - 3))
position = 0
do i = 1, n_tallies
@ -139,8 +138,6 @@ contains
filter_bins = filter_bins * n
end if
! TODO: Determine size of mesh to increase number of scoring bins
! Add map elements for surface bins
n = t % n_bins(T_SURFACE)
t % stride(T_SURFACE) = filter_bins
@ -275,22 +272,6 @@ contains
! =======================================================================
! DETERMINE SCORING BIN COMBINATION
! determine next cell bin
if (t % n_bins(T_CELL) > 0) then
bins(T_CELL) = get_next_bin(T_CELL, p % cell, i)
if (bins(T_CELL) == NO_BIN_FOUND) cycle
else
bins(T_CELL) = 1
end if
! determine next surface bin
if (t % n_bins(T_SURFACE) > 0) then
bins(T_SURFACE) = get_next_bin(T_SURFACE, p % surface, i)
if (bins(T_SURFACE) == NO_BIN_FOUND) cycle
else
bins(T_SURFACE) = 1
end if
! determine next universe bin
if (t % n_bins(T_UNIVERSE) > 0) then
bins(T_UNIVERSE) = get_next_bin(T_UNIVERSE, p % universe, i)
@ -307,6 +288,14 @@ contains
bins(T_MATERIAL) = 1
end if
! determine next cell bin
if (t % n_bins(T_CELL) > 0) then
bins(T_CELL) = get_next_bin(T_CELL, p % cell, i)
if (bins(T_CELL) == NO_BIN_FOUND) cycle
else
bins(T_CELL) = 1
end if
! determine next cellborn bin
if (t % n_bins(T_CELLBORN) > 0) then
bins(T_CELLBORN) = get_next_bin(T_CELLBORN, p % cell_born, i)
@ -315,6 +304,14 @@ contains
bins(T_CELLBORN) = 1
end if
! determine next surface bin
if (t % n_bins(T_SURFACE) > 0) then
bins(T_SURFACE) = get_next_bin(T_SURFACE, p % surface, i)
if (bins(T_SURFACE) == NO_BIN_FOUND) cycle
else
bins(T_SURFACE) = 1
end if
! determine incoming energy bin
n = t % n_bins(T_ENERGYIN)
if (n > 0) then
@ -665,8 +662,8 @@ contains
index = t % surface_bins(bin) % scalar
uid = int_to_str(surfaces(index) % uid)
case (T_MESH)
index = t % mesh_bins(bin) % scalar
! uid = int_to_str(meshs(index) % uid)
index = t % mesh
uid = int_to_str(meshes(index) % uid)
case (T_ENERGYIN)
E0 = t % energy_in(bin)
E1 = t % energy_in(bin + 1)

View file

@ -69,7 +69,7 @@ module tally_header
type(TallyFilter), pointer :: cell_bins(:) => null()
type(TallyFilter), pointer :: cellborn_bins(:) => null()
type(TallyFilter), pointer :: surface_bins(:) => null()
type(TallyFilter), pointer :: mesh_bins(:) => null()
integer :: mesh = 0
real(8), allocatable :: energy_in(:)
real(8), allocatable :: energy_out(:)

View file

@ -19,7 +19,7 @@ type filter_xml
character(len=250) :: surface
character(len=250) :: universe
character(len=250) :: material
character(len=250) :: mesh
integer :: mesh
character(len=250) :: cellborn
character(len=250) :: energy
character(len=250) :: energyout
@ -354,7 +354,7 @@ subroutine read_xml_type_filter_xml( info, starttag, endtag, attribs, noattribs,
info, tag, endtag, attribs, noattribs, data, nodata, &
dvar%material, has_material )
case('mesh')
call read_xml_word( &
call read_xml_integer( &
info, tag, endtag, attribs, noattribs, data, nodata, &
dvar%mesh, has_mesh )
case('cellborn')
@ -395,7 +395,7 @@ subroutine init_xml_type_filter_xml(dvar)
dvar%surface = ''
dvar%universe = ''
dvar%material = ''
dvar%mesh = ''
dvar%mesh = 0
dvar%cellborn = ''
dvar%energy = ''
dvar%energyout = ''
@ -426,7 +426,7 @@ subroutine write_xml_type_filter_xml( &
call write_to_xml_word( info, 'surface', indent+3, dvar%surface)
call write_to_xml_word( info, 'universe', indent+3, dvar%universe)
call write_to_xml_word( info, 'material', indent+3, dvar%material)
call write_to_xml_word( info, 'mesh', indent+3, dvar%mesh)
call write_to_xml_integer( info, 'mesh', indent+3, dvar%mesh)
call write_to_xml_word( info, 'cellborn', indent+3, dvar%cellborn)
call write_to_xml_word( info, 'energy', indent+3, dvar%energy)
call write_to_xml_word( info, 'energyout', indent+3, dvar%energyout)