Ability to specify a void material. Closes #66 on github.

This commit is contained in:
Paul Romano 2012-05-31 18:41:03 +07:00
parent 18fe0a4975
commit 6fc608a889
7 changed files with 41 additions and 8 deletions

View file

@ -72,8 +72,10 @@ module constants
integer, parameter :: &
CELL_NORMAL = 1, & ! Cell with a specified material
CELL_FILL = 2, & ! Cell filled by a separate universe
CELL_LATTICE = 3, & ! Cell filled with a lattice
CELL_VOID = -1
CELL_LATTICE = 3 ! Cell filled with a lattice
! Void material
integer, parameter :: MATERIAL_VOID = -1
! Lattice types
integer, parameter :: &

View file

@ -34,6 +34,9 @@ contains
material_xs % fission = ZERO
material_xs % nu_fission = ZERO
! Exit subroutine if material is void
if (p % material == MATERIAL_VOID) return
mat => materials(p % material)
! Find energy index on unionized grid

View file

@ -166,9 +166,13 @@ contains
select case (c % type)
case (CELL_NORMAL)
call h5ltmake_dataset_string_f(temp_group, "fill_type", "normal", &
hdf5_err)
call hdf5_make_integer(temp_group, "material", &
materials(c % material) % id)
hdf5_err)
if (c % material == MATERIAL_VOID) then
call hdf5_make_integer(temp_group, "material", -1)
else
call hdf5_make_integer(temp_group, "material", &
materials(c % material) % id)
end if
case (CELL_FILL)
call h5ltmake_dataset_string_f(temp_group, "fill_type", "universe", &
hdf5_err)

View file

@ -445,7 +445,9 @@ contains
! ADJUST MATERIAL/FILL POINTERS FOR EACH CELL
id = c % material
if (id /= 0) then
if (id == MATERIAL_VOID) then
c % type = CELL_NORMAL
elseif (id /= 0) then
if (dict_has_key(material_dict, id)) then
c % type = CELL_NORMAL
c % material = dict_get_key(material_dict, id)

View file

@ -368,9 +368,29 @@ contains
! Copy data into cells
c % id = cell_(i) % id
c % universe = cell_(i) % universe
c % material = cell_(i) % material
c % fill = cell_(i) % fill
! Read material
word = cell_(i) % material
call lower_case(word)
select case(word)
case ('void')
c % material = MATERIAL_VOID
case ('')
! This case is called if no material was specified
c % material = 0
case default
c % material = str_to_int(word)
! Check for error
if (c % material == ERROR_INT) then
message = "Invalid material specified on cell " // to_str(c % id)
call fatal_error()
end if
end select
! Check to make sure that either material or fill was specified
if (c % material == 0 .and. c % fill == 0) then
message = "Neither material nor fill was specified for cell " // &

View file

@ -344,6 +344,8 @@ contains
! Write information on material
if (c % material == 0) then
write(unit_,*) ' Material = NONE'
elseif (c % material == MATERIAL_VOID) then
write(unit_,*) ' Material = Void'
else
m => materials(c % material)
write(unit_,*) ' Material = ' // to_str(m % id)

View file

@ -8,7 +8,7 @@
<typedef name="cell_xml">
<component name="id" type="integer" />
<component name="universe" type="integer" default="0" />
<component name="material" type="integer" default="0" />
<component name="material" type="word" length="12" default="''" />
<component name="fill" type="integer" default="0" />
<component name="surfaces" type="integer-array" />
</typedef>