mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
Write depletable attribute to XML and summary files
This commit is contained in:
parent
3298c24790
commit
606253e11c
5 changed files with 29 additions and 10 deletions
|
|
@ -255,7 +255,7 @@ class Material(object):
|
|||
|
||||
@depletable.setter
|
||||
def depletable(self, depletable):
|
||||
cv.check_type('Depletable flag for Material ID="{}"'.format(self._id),
|
||||
cv.check_type('Depletable flag for Material ID="{}"'.format(self.id),
|
||||
depletable, bool)
|
||||
self._depletable = depletable
|
||||
|
||||
|
|
@ -771,6 +771,9 @@ class Material(object):
|
|||
if len(self._name) > 0:
|
||||
element.set("name", str(self._name))
|
||||
|
||||
if self._depletable:
|
||||
element.set("depletable", "true")
|
||||
|
||||
# Create temperature XML subelement
|
||||
if self.temperature is not None:
|
||||
subelement = ET.SubElement(element, "temperature")
|
||||
|
|
|
|||
|
|
@ -97,23 +97,25 @@ class Summary(object):
|
|||
# Values - Material objects
|
||||
self.materials = {}
|
||||
|
||||
for key in self._f['materials'].keys():
|
||||
for key, group in self._f['materials'].items():
|
||||
if key == 'n_materials':
|
||||
continue
|
||||
|
||||
material_id = int(key.lstrip('material '))
|
||||
index = self._f['materials'][key]['index'].value
|
||||
name = self._f['materials'][key]['name'].value.decode()
|
||||
density = self._f['materials'][key]['atom_density'].value
|
||||
nuc_densities = self._f['materials'][key]['nuclide_densities'][...]
|
||||
nuclides = self._f['materials'][key]['nuclides'].value
|
||||
|
||||
index = group['index'].value
|
||||
name = group['name'].value.decode()
|
||||
density = group['atom_density'].value
|
||||
nuc_densities = group['nuclide_densities'][...]
|
||||
nuclides = group['nuclides'].value
|
||||
|
||||
# Create the Material
|
||||
material = openmc.Material(material_id=material_id, name=name)
|
||||
material.depletable = bool(group.attrs['depletable'])
|
||||
|
||||
# Read the names of the S(a,b) tables for this Material and add them
|
||||
if 'sab_names' in self._f['materials'][key]:
|
||||
sab_tables = self._f['materials'][key]['sab_names'].value
|
||||
if 'sab_names' in group:
|
||||
sab_tables = group['sab_names'].value
|
||||
for sab_table in sab_tables:
|
||||
name = sab_table.decode()
|
||||
material.add_s_alpha_beta(name)
|
||||
|
|
|
|||
|
|
@ -2251,6 +2251,13 @@ contains
|
|||
call fatal_error("Must specify id of material in materials XML file")
|
||||
end if
|
||||
|
||||
! Check if material is depletable
|
||||
if (check_for_node(node_mat, "depletable")) then
|
||||
call get_node_value(node_mat, "depletable", temp_str)
|
||||
if (to_lower(temp_str) == "true" .or. temp_str == "1") &
|
||||
mat % depletable = .true.
|
||||
end if
|
||||
|
||||
! Check to make sure 'id' hasn't been used
|
||||
if (material_dict % has_key(mat % id)) then
|
||||
call fatal_error("Two or more materials use the same unique ID: " &
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@ module material_header
|
|||
character(20), allocatable :: names(:) ! isotope names
|
||||
character(20), allocatable :: sab_names(:) ! name of S(a,b) table
|
||||
|
||||
! Does this material contain fissionable nuclides?
|
||||
! Does this material contain fissionable nuclides? Is it depletable?
|
||||
logical :: fissionable = .false.
|
||||
logical :: depletable = .false.
|
||||
|
||||
! enforce isotropic scattering in lab
|
||||
logical, allocatable :: p0(:)
|
||||
|
|
|
|||
|
|
@ -536,6 +536,12 @@ contains
|
|||
material_group = create_group(materials_group, "material " // &
|
||||
trim(to_str(m%id)))
|
||||
|
||||
if (m % depletable) then
|
||||
call write_attribute(material_group, "depletable", 1)
|
||||
else
|
||||
call write_attribute(material_group, "depletable", 0)
|
||||
end if
|
||||
|
||||
! Write internal OpenMC index for this material
|
||||
call write_dataset(material_group, "index", i)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue