From 679781da0a42e5a4ab1b49b2ae8279b5b30cc00c Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 21 Jan 2016 15:43:49 -0600 Subject: [PATCH] Disallow duplicate scores in tallies --- src/ace.F90 | 2 +- src/endf.F90 | 47 +++++++++++++++++++++++++++++++++++++++++++ src/input_xml.F90 | 27 +++++++++++++++++++++++++ src/state_point.F90 | 49 +-------------------------------------------- src/summary.F90 | 49 +-------------------------------------------- 5 files changed, 77 insertions(+), 97 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index e97338b55..2947ff9de 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -3,7 +3,7 @@ module ace use ace_header, only: Nuclide, Reaction, SAlphaBeta, XsListing, & DistEnergy use constants - use endf, only: reaction_name, is_fission, is_disappearance + use endf, only: is_fission, is_disappearance use error, only: fatal_error, warning use fission, only: nu_total use global diff --git a/src/endf.F90 b/src/endf.F90 index ba324722c..64f26539a 100644 --- a/src/endf.F90 +++ b/src/endf.F90 @@ -17,6 +17,53 @@ contains character(20) :: string select case (MT) + ! Special reactions for tallies + case (SCORE_FLUX) + string = "flux" + case (SCORE_TOTAL) + string = "total" + case (SCORE_SCATTER) + string = "scatter" + case (SCORE_NU_SCATTER) + string = "nu-scatter" + case (SCORE_SCATTER_N) + string = "scatter-n" + case (SCORE_SCATTER_PN) + string = "scatter-pn" + case (SCORE_NU_SCATTER_N) + string = "nu-scatter-n" + case (SCORE_NU_SCATTER_PN) + string = "nu-scatter-pn" + case (SCORE_TRANSPORT) + string = "transport" + case (SCORE_N_1N) + string = "n1n" + case (SCORE_ABSORPTION) + string = "absorption" + case (SCORE_FISSION) + string = "fission" + case (SCORE_NU_FISSION) + string = "nu-fission" + case (SCORE_DELAYED_NU_FISSION) + string = "delayed-nu-fission" + case (SCORE_KAPPA_FISSION) + string = "kappa-fission" + case (SCORE_CURRENT) + string = "current" + case (SCORE_FLUX_YN) + string = "flux-yn" + case (SCORE_TOTAL_YN) + string = "total-yn" + case (SCORE_SCATTER_YN) + string = "scatter-yn" + case (SCORE_NU_SCATTER_YN) + string = "nu-scatter-yn" + case (SCORE_EVENTS) + string = "events" + case (SCORE_INVERSE_VELOCITY) + string = "inverse-velocity" + + ! Normal ENDF-based reactions case (TOTAL_XS) string = '(n,total)' case (ELASTIC) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 142745890..ec8a8a5a1 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -5,6 +5,7 @@ module input_xml use dict_header, only: DictIntInt, ElemKeyValueCI use distribution_multivariate use distribution_univariate + use endf, only: reaction_name use energy_grid, only: grid_method, n_log_bins use error, only: fatal_error, warning use geometry_header, only: Cell, Lattice, RectLattice, HexLattice @@ -3426,6 +3427,32 @@ contains ! Deallocate temporary string array of scores deallocate(sarray) + + ! Check that no duplicate scores exist + j = 1 + do while (j < n_scores) + ! Determine number of bins for scores with expansions + n_order = t % moment_order(j) + select case (t % score_bins(j)) + case (SCORE_SCATTER_PN, SCORE_NU_SCATTER_PN) + n_bins = n_order + 1 + case (SCORE_FLUX_YN, SCORE_TOTAL_YN, SCORE_SCATTER_YN, & + SCORE_NU_SCATTER_YN) + n_bins = (n_order + 1)**2 + case default + n_bins = 1 + end select + + do k = j + n_bins, n_scores + if (t % score_bins(j) == t % score_bins(k) .and. & + t % moment_order(j) == t % moment_order(k)) then + call fatal_error("Duplicate score of type '" // trim(& + reaction_name(t % score_bins(j))) // "' found in tally " & + // trim(to_str(t % id))) + end if + end do + j = j + n_bins + end do else call fatal_error("No specified on tally " & &// trim(to_str(t % id)) // ".") diff --git a/src/state_point.F90 b/src/state_point.F90 index e89cdf12a..70ee2d06a 100644 --- a/src/state_point.F90 +++ b/src/state_point.F90 @@ -310,54 +310,7 @@ contains call write_dataset(tally_group, "n_score_bins", tally%n_score_bins) allocate(str_array(size(tally%score_bins))) do j = 1, size(tally%score_bins) - select case(tally%score_bins(j)) - case (SCORE_FLUX) - str_array(j) = "flux" - case (SCORE_TOTAL) - str_array(j) = "total" - case (SCORE_SCATTER) - str_array(j) = "scatter" - case (SCORE_NU_SCATTER) - str_array(j) = "nu-scatter" - case (SCORE_SCATTER_N) - str_array(j) = "scatter-n" - case (SCORE_SCATTER_PN) - str_array(j) = "scatter-pn" - case (SCORE_NU_SCATTER_N) - str_array(j) = "nu-scatter-n" - case (SCORE_NU_SCATTER_PN) - str_array(j) = "nu-scatter-pn" - case (SCORE_TRANSPORT) - str_array(j) = "transport" - case (SCORE_N_1N) - str_array(j) = "n1n" - case (SCORE_ABSORPTION) - str_array(j) = "absorption" - case (SCORE_FISSION) - str_array(j) = "fission" - case (SCORE_NU_FISSION) - str_array(j) = "nu-fission" - case (SCORE_DELAYED_NU_FISSION) - str_array(j) = "delayed-nu-fission" - case (SCORE_KAPPA_FISSION) - str_array(j) = "kappa-fission" - case (SCORE_CURRENT) - str_array(j) = "current" - case (SCORE_FLUX_YN) - str_array(j) = "flux-yn" - case (SCORE_TOTAL_YN) - str_array(j) = "total-yn" - case (SCORE_SCATTER_YN) - str_array(j) = "scatter-yn" - case (SCORE_NU_SCATTER_YN) - str_array(j) = "nu-scatter-yn" - case (SCORE_EVENTS) - str_array(j) = "events" - case (SCORE_INVERSE_VELOCITY) - str_array(j) = "inverse-velocity" - case default - str_array(j) = reaction_name(tally%score_bins(j)) - end select + str_array(j) = reaction_name(tally%score_bins(j)) end do call write_dataset(tally_group, "score_bins", str_array) call write_dataset(tally_group, "n_user_score_bins", tally%n_user_score_bins) diff --git a/src/summary.F90 b/src/summary.F90 index 85d014692..c31068eb9 100644 --- a/src/summary.F90 +++ b/src/summary.F90 @@ -639,54 +639,7 @@ contains call write_dataset(tally_group, "n_score_bins", t%n_score_bins) allocate(str_array(size(t%score_bins))) do j = 1, size(t%score_bins) - select case(t%score_bins(j)) - case (SCORE_FLUX) - str_array(j) = "flux" - case (SCORE_TOTAL) - str_array(j) = "total" - case (SCORE_SCATTER) - str_array(j) = "scatter" - case (SCORE_NU_SCATTER) - str_array(j) = "nu-scatter" - case (SCORE_SCATTER_N) - str_array(j) = "scatter-n" - case (SCORE_SCATTER_PN) - str_array(j) = "scatter-pn" - case (SCORE_NU_SCATTER_N) - str_array(j) = "nu-scatter-n" - case (SCORE_NU_SCATTER_PN) - str_array(j) = "nu-scatter-pn" - case (SCORE_TRANSPORT) - str_array(j) = "transport" - case (SCORE_N_1N) - str_array(j) = "n1n" - case (SCORE_ABSORPTION) - str_array(j) = "absorption" - case (SCORE_FISSION) - str_array(j) = "fission" - case (SCORE_NU_FISSION) - str_array(j) = "nu-fission" - case (SCORE_DELAYED_NU_FISSION) - str_array(j) = "delayed-nu-fission" - case (SCORE_KAPPA_FISSION) - str_array(j) = "kappa-fission" - case (SCORE_CURRENT) - str_array(j) = "current" - case (SCORE_FLUX_YN) - str_array(j) = "flux-yn" - case (SCORE_TOTAL_YN) - str_array(j) = "total-yn" - case (SCORE_SCATTER_YN) - str_array(j) = "scatter-yn" - case (SCORE_NU_SCATTER_YN) - str_array(j) = "nu-scatter-yn" - case (SCORE_EVENTS) - str_array(j) = "events" - case (SCORE_INVERSE_VELOCITY) - str_array(j) = "inverse-velocity" - case default - str_array(j) = reaction_name(t%score_bins(j)) - end select + str_array(j) = reaction_name(t%score_bins(j)) end do call write_dataset(tally_group, "score_bins", str_array)