From fa09b97077d0131c026fb20b7bf94cec3e17babd Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 2 Jul 2012 16:29:40 -0400 Subject: [PATCH] Added ability to read tag in tally specification. --- src/input_xml.F90 | 55 +++++++++++++++++++++++++++++++++++++++++++- src/tally_header.F90 | 5 +++- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 2707bf358c..08a6c9f19d 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -1034,6 +1034,9 @@ contains ! Copy material id t % id = tally_(i) % id + ! ======================================================================= + ! READ DATA FOR FILTERS + ! Check to make sure that both cells and surfaces were not specified if (len_trim(tally_(i) % filters % cell) > 0 .and. & len_trim(tally_(i) % filters % surface) > 0) then @@ -1159,7 +1162,57 @@ contains allocate(t % filters(n_filters)) t % filters = filters(1:n_filters) - ! Read macro reactions + ! ======================================================================= + ! READ DATA FOR NUCLIDES + + if (len_trim(tally_(i) % nuclides) > 0) then + call split_string(tally_(i) % nuclides, words, n_words) + + if (words(1) == 'all') then + ! Handle special case all + allocate(t % nuclide_bins(n_nuclides_total + 1)) + + ! Set bins to 1, 2, 3, ..., n_nuclides_total, -1 + t % nuclide_bins(1:n_nuclides_total) % scalar = & + (/ (j, j=1, n_nuclides_total) /) + t % nuclide_bins(n_nuclides_total + 1) % scalar = -1 + + ! Set flag so we can treat this case specially + t % all_nuclides = .true. + else + ! Any other case, e.g. U-235 Pu-239 + allocate(t % nuclide_bins(n_words)) + do j = 1, n_words + ! Check if xs specifier was given + if (ends_with(words(j), 'c')) then + word = words(j) + else + word = trim(words(j)) // "." // default_xs + end if + + ! Check to make sure nuclide specified is in problem + if (.not. dict_has_key(nuclide_dict, word)) then + message = "Could not find nuclide " // trim(word) // & + " from tally " // trim(to_str(t % id)) // & + " in cross_sections.xml file." + call fatal_error() + end if + + ! Set bin to index in nuclides array + t % nuclide_bins(j) % scalar = dict_get_key(nuclide_dict, word) + end do + end if + + else + ! No were specified -- create only one bin will be added + ! for the total material. + allocate(t % nuclide_bins(1)) + t % nuclide_bins(1) % scalar = -1 + end if + + ! ======================================================================= + ! READ DATA FOR SCORES + if (len_trim(tally_(i) % scores) > 0) then call split_string(tally_(i) % scores, words, n_words) allocate(t % score_bins(n_words)) diff --git a/src/tally_header.F90 b/src/tally_header.F90 index fdf487aac4..bb386b31d5 100644 --- a/src/tally_header.F90 +++ b/src/tally_header.F90 @@ -94,8 +94,11 @@ module tally_header integer, allocatable :: n_filter_bins(:) integer, allocatable :: stride(:) - ! Macroscopic properties to score + ! Individual nuclides to tally + type(TallyFilter), pointer :: nuclide_bins(:) => null() + logical :: all_nuclides = .false. + ! Values to score, e.g. flux, absorption, etc. type(TallyFilter), pointer :: score_bins(:) => null() integer :: n_score_bins = 0