Fix writing of energy cutoff, few other issues

This commit is contained in:
Paul Romano 2017-07-20 08:11:14 -05:00
parent 698cb09682
commit 58992b02c3
5 changed files with 10 additions and 3 deletions

View file

@ -964,7 +964,7 @@ class Settings(object):
def _create_cutoff_subelement(self, root):
if self._cutoff is not None:
element = ET.SubElement(root, "cutoff")
for key, value in self.items():
for key, value in self._cutoff.items():
subelement = ET.SubElement(element, key)
subelement.text = str(value)

View file

@ -624,6 +624,10 @@ contains
end if
if (check_for_node(node_cutoff, "energy_neutron")) then
call get_node_value(node_cutoff, "energy_neutron", energy_cutoff(1))
elseif (check_for_node(node_cutoff, "energy")) then
call warning("The use of an <energy> cutoff is deprecated and should &
&be replaced by <energy_neutron>.")
call get_node_value(node_cutoff, "energy", energy_cutoff(1))
end if
if (check_for_node(node_cutoff, "energy_photon")) then
call get_node_value(node_cutoff, "energy_photon", energy_cutoff(2))

View file

@ -250,6 +250,9 @@ contains
! Bank source neutrons by copying particle data
bank_array(i) % xyz = p % coord(1) % xyz
! Set particle as neutron
bank_array(i) % particle = NEUTRON
! Set weight of fission bank site
bank_array(i) % wgt = ONE/weight

View file

@ -27,7 +27,7 @@
<energy parameters="988000.0 2.249e-06" type="watt" />
</source>
<cutoff>
<energy>4.0</energy>
<energy_neutron>4.0</energy_neutron>
</cutoff>
</settings>
<?xml version='1.0' encoding='utf-8'?>

View file

@ -41,7 +41,7 @@ class EnergyCutoffTestHarness(PyAPITestHarness):
settings_file.run_mode = 'fixed source'
settings_file.batches = 10
settings_file.particles = 100
settings_file.cutoff = {'energy': energy_cutoff}
settings_file.cutoff = {'energy_neutron': energy_cutoff}
bounds = [-1, -1, -1, 1, 1, 1]
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:])
watt_dist = openmc.stats.Watt()