Address #1050 changes

This commit is contained in:
Shikhar Kumar 2018-08-17 12:43:19 -04:00
parent 1ec0a806a0
commit d7c2e8ddff
3 changed files with 22 additions and 25 deletions

View file

@ -228,12 +228,8 @@ class Tally(_FortranObjectWithID):
@property
def estimator(self):
estimator = c_int32()
try:
_dll.openmc_tally_get_estimator(self._index, estimator)
except AllocationError:
return ""
else:
return _ESTIMATORS[estimator.value]
_dll.openmc_tally_get_estimator(self._index, estimator)
return _ESTIMATORS[estimator.value]
@estimator.setter
def estimator(self, estimator):
@ -352,6 +348,7 @@ class Tally(_FortranObjectWithID):
return std_dev
def reset(self):
"""Reset results and num_realizations of tally"""
_dll.openmc_tally_reset(self._index)
def ci_width(self, alpha=0.05):

View file

@ -2176,11 +2176,14 @@ contains
end if
! Check to make sure 'id' hasn't been used
if (tally_dict % has(tally_id)) then
if (tally_dict % has(t % id)) then
call fatal_error("Two or more tallies use the same unique ID: " &
// to_str(tally_id))
end if
! Set tally id
err = openmc_tally_set_id(i_start + i - 1, tally_id)
! Copy tally name
if (check_for_node(node_tal, "name")) &
call get_node_value(node_tal, "name", t % name)
@ -2217,7 +2220,7 @@ contains
else
call fatal_error("Could not find filter " &
// trim(to_str(temp_filter(j))) // " specified on tally " &
// trim(to_str(tally_id)))
// trim(to_str(t % id)))
end if
! Store the index of the filter
@ -2271,7 +2274,7 @@ contains
if (.not. nuclide_dict % has(word)) then
call fatal_error("Could not find the nuclide " &
// trim(word) // " specified in tally " &
// trim(to_str(tally_id)) // " in any material.")
// trim(to_str(t % id)) // " in any material.")
end if
! Set bin to index in nuclides array
@ -2581,7 +2584,7 @@ contains
if (t % score_bins(j) == t % score_bins(k)) then
call fatal_error("Duplicate score of type '" // trim(&
reaction_name(t % score_bins(j))) // "' found in tally " &
// trim(to_str(tally_id)))
// trim(to_str(t % id)))
end if
end do
end do
@ -2628,7 +2631,7 @@ contains
end if
else
call fatal_error("No <scores> specified on tally " &
// trim(to_str(tally_id)) // ".")
// trim(to_str(t % id)) // ".")
end if
! Check for a tally derivative.
@ -2651,7 +2654,7 @@ contains
if (j == size(tally_derivs)) then
call fatal_error("Could not find derivative " &
// trim(to_str(t % deriv)) // " specified on tally " &
// trim(to_str(tally_id)))
// trim(to_str(t % id)))
end if
end do
@ -2659,7 +2662,7 @@ contains
.or. tally_derivs(t % deriv) % variable == DIFF_TEMPERATURE) then
if (any(t % nuclide_bins == -1)) then
if (t % find_filter(FILTER_ENERGYOUT) > 0) then
call fatal_error("Error on tally " // trim(to_str(tally_id)) &
call fatal_error("Error on tally " // trim(to_str(t % id)) &
// ": Cannot use a 'nuclide_density' or 'temperature' &
&derivative on a tally with an outgoing energy filter and &
&'total' nuclide rate. Instead, tally each nuclide in the &
@ -2736,7 +2739,7 @@ contains
temp_str = to_lower(temp_str)
else
call fatal_error("Must specify trigger type for tally " // &
trim(to_str(tally_id)) // " in tally XML file.")
trim(to_str(t % id)) // " in tally XML file.")
end if
! Get the convergence threshold for the trigger
@ -2744,7 +2747,7 @@ contains
call get_node_value(node_trigger, "threshold", threshold)
else
call fatal_error("Must specify trigger threshold for tally " // &
trim(to_str(tally_id)) // " in tally XML file.")
trim(to_str(t % id)) // " in tally XML file.")
end if
! Get list scores for this trigger
@ -2788,7 +2791,7 @@ contains
t % triggers(trig_ind) % type = RELATIVE_ERROR
case default
call fatal_error("Unknown trigger type " // &
trim(temp_str) // " in tally " // trim(to_str(tally_id)))
trim(temp_str) // " in tally " // trim(to_str(t % id)))
end select
! Store the trigger convergence threshold
@ -2809,7 +2812,7 @@ contains
! Check if an invalid score was set for the trigger
if (t % triggers(trig_ind) % score_index == 0) then
call fatal_error("The trigger score " // trim(score_name) // &
" is not set for tally " // trim(to_str(tally_id)))
" is not set for tally " // trim(to_str(t % id)))
end if
! Store the trigger convergence threshold
@ -2825,7 +2828,7 @@ contains
t % triggers(trig_ind) % type = RELATIVE_ERROR
case default
call fatal_error("Unknown trigger type " // trim(temp_str) // &
" in tally " // trim(to_str(tally_id)))
" in tally " // trim(to_str(t % id)))
end select
! Increment the overall trigger index
@ -2857,7 +2860,7 @@ contains
! tally needs post-collision information
if (t % estimator == ESTIMATOR_ANALOG) then
call fatal_error("Cannot use track-length estimator for tally " &
// to_str(tally_id))
// to_str(t % id))
end if
! Set estimator to track-length estimator
@ -2868,7 +2871,7 @@ contains
! tally needs post-collision information
if (t % estimator == ESTIMATOR_ANALOG) then
call fatal_error("Cannot use collision estimator for tally " &
// to_str(tally_id))
// to_str(t % id))
end if
! Set estimator to collision estimator
@ -2880,9 +2883,6 @@ contains
end select
end if
! Set tally id
err = openmc_tally_set_id(i_start + i - 1, tally_id)
end associate
end do READ_TALLIES

View file

@ -716,7 +716,7 @@ contains
case ('collision')
tallies(index) % obj % estimator = ESTIMATOR_COLLISION
case default
err = E_UNASSIGNED
err = E_INVALID_ARGUMENT
call set_errmsg("Unknown tally estimator: " // trim(estimator_))
end select
else
@ -1035,7 +1035,7 @@ contains
case ('surface')
tallies(index) % obj % type = TALLY_SURFACE
case default
err = E_UNASSIGNED
err = E_INVALID_ARGUMENT
call set_errmsg("Unknown tally type: " // trim(type_))
end select
else