From 26bb80aff66528c8931d7adeced7bc2ee4f5864c Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Wed, 1 Apr 2015 15:42:30 -0400 Subject: [PATCH 01/38] implemented delayed group tallies for computing delayed fractions --- src/ace.F90 | 52 +++++- src/ace_header.F90 | 38 ++-- src/bank_header.F90 | 9 +- src/constants.F90 | 72 ++++---- src/cross_section.F90 | 17 +- src/global.F90 | 7 +- src/hdf5_summary.F90 | 4 + src/initialize.F90 | 23 +-- src/input_xml.F90 | 153 +++++++++++++++- src/output.F90 | 73 +++++--- src/particle_header.F90 | 11 +- src/physics.F90 | 70 +++++--- src/tally.F90 | 389 +++++++++++++++++++++++++++++++++++++++- src/tracking.F90 | 5 + 14 files changed, 803 insertions(+), 120 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index 3c75fe4a9..b566c40b6 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -5,7 +5,7 @@ module ace use constants use endf, only: reaction_name, is_fission, is_disappearance use error, only: fatal_error, warning - use fission, only: nu_total + use fission, only: nu_total, nu_delayed use global use list_header, only: ListInt use material_header, only: Material @@ -378,6 +378,10 @@ contains call generate_nu_fission(nuc) end if + if (nuc % fissionable .and. .not. data_0K) then + call generate_delay_nu_fission(nuc) + end if + case (ACE_THERMAL) sab => sab_tables(i_table) sab % name = name @@ -461,6 +465,7 @@ contains allocate(nuc % fission(NE)) allocate(nuc % nu_fission(NE)) allocate(nuc % absorption(NE)) + allocate(nuc % delay_nu_fission(NE)) ! initialize cross sections nuc % total = ZERO @@ -468,6 +473,7 @@ contains nuc % fission = ZERO nuc % nu_fission = ZERO nuc % absorption = ZERO + nuc % delay_nu_fission = ZERO ! Read data from XSS -- only the energy grid, elastic scattering and heating ! cross section values are actually read from here. The total and absorption @@ -635,6 +641,23 @@ contains ! Allocate space for secondary energy distribution NPCR = NXS(8) + + ! Check to make sure nuclide does not have more than the maximum number + ! of delayed groups + if (NPCR > MAX_DELAYED_GROUPS) then + call fatal_error("Encountered nuclide with " // trim(to_str(NPCR)) & + &// " delayed groups while the maximum number of delayed groups" & + &// " set in constants.F90 is " // trim(to_str(MAX_DELAYED_GROUPS))) + end if + + if (n_delayed_groups == 0) then + n_delayed_groups = NPCR + else if (n_delayed_groups /= NPCR) then + call fatal_error("Encountered nuclides with different numbers of " & + &// " delayed groups. Nuclides with " // trim(to_str(n_delayed_groups)) & + &// " and " // trim(to_str(NPCR)) // " delayed groups encountered.") + end if + nuc % n_precursor = NPCR allocate(nuc % nu_d_edist(NPCR)) @@ -1386,6 +1409,33 @@ contains end subroutine generate_nu_fission +!=============================================================================== +! GENERATE_DELAYED_NU_FISSION precalculates the microscopic nu-fission cross section for +! a given nuclide. This is done so that the nu_total function does not need to +! be called during cross section lookups. +!=============================================================================== + + subroutine generate_delay_nu_fission(nuc) + + type(Nuclide), pointer :: nuc + + integer :: i ! index on nuclide energy grid + real(8) :: E ! energy + real(8) :: nu_delay ! # of neutrons per fission + + do i = 1, nuc % n_grid + ! determine energy + E = nuc % energy(i) + + ! determine total nu at given energy + nu_delay = nu_delayed(nuc, E) + + ! determine delay-nu-fission microscopic cross section + nuc % delay_nu_fission(i) = nu_delay * nuc % fission(i) + end do + + end subroutine generate_delay_nu_fission + !=============================================================================== ! READ_THERMAL_DATA reads elastic and inelastic cross sections and corresponding ! secondary energy/angle distributions derived from experimental S(a,b) diff --git a/src/ace_header.F90 b/src/ace_header.F90 index 1f34a2311..9462ff2dc 100644 --- a/src/ace_header.F90 +++ b/src/ace_header.F90 @@ -113,6 +113,7 @@ module ace_header real(8), allocatable :: nu_fission(:) ! neutron production real(8), allocatable :: absorption(:) ! absorption (MT > 100) real(8), allocatable :: heating(:) ! heating + real(8), allocatable :: delay_nu_fission(:) ! delayed neutron production ! Resonance scattering info logical :: resonant = .false. ! resonant scatterer? @@ -256,16 +257,17 @@ module ace_header !=============================================================================== type NuclideMicroXS - integer :: index_grid ! index on nuclide energy grid - integer :: index_temp ! temperature index for nuclide - real(8) :: last_E = 0.0 ! last evaluated energy - real(8) :: interp_factor ! interpolation factor on nuc. energy grid - real(8) :: total ! microscropic total xs - real(8) :: elastic ! microscopic elastic scattering xs - real(8) :: absorption ! microscopic absorption xs - real(8) :: fission ! microscopic fission xs - real(8) :: nu_fission ! microscopic production xs - real(8) :: kappa_fission ! microscopic energy-released from fission + integer :: index_grid ! index on nuclide energy grid + integer :: index_temp ! temperature index for nuclide + real(8) :: last_E = 0.0 ! last evaluated energy + real(8) :: interp_factor ! interpolation factor on nuc. energy grid + real(8) :: total ! microscropic total xs + real(8) :: elastic ! microscopic elastic scattering xs + real(8) :: absorption ! microscopic absorption xs + real(8) :: fission ! microscopic fission xs + real(8) :: nu_fission ! microscopic production xs + real(8) :: kappa_fission ! microscopic energy-released from fission + real(8) :: delay_nu_fission ! microscopic delayed production xs ! Information for S(a,b) use integer :: index_sab ! index in sab_tables (zero means no table) @@ -283,12 +285,13 @@ module ace_header !=============================================================================== type MaterialMacroXS - real(8) :: total ! macroscopic total xs - real(8) :: elastic ! macroscopic elastic scattering xs - real(8) :: absorption ! macroscopic absorption xs - real(8) :: fission ! macroscopic fission xs - real(8) :: nu_fission ! macroscopic production xs - real(8) :: kappa_fission ! macroscopic energy-released from fission + real(8) :: total ! macroscopic total xs + real(8) :: elastic ! macroscopic elastic scattering xs + real(8) :: absorption ! macroscopic absorption xs + real(8) :: fission ! macroscopic fission xs + real(8) :: nu_fission ! macroscopic production xs + real(8) :: kappa_fission ! macroscopic energy-released from fission + real(8) :: delay_nu_fission ! macroscopic delayed production xs end type MaterialMacroXS contains @@ -377,7 +380,8 @@ module ace_header if (allocated(this % energy)) & deallocate(this % energy, this % total, this % elastic, & - & this % fission, this % nu_fission, this % absorption) + & this % fission, this % nu_fission, this % absorption, & + this % delay_nu_fission) if (allocated(this % energy_0K)) & deallocate(this % energy_0K) diff --git a/src/bank_header.F90 b/src/bank_header.F90 index 1a91f86f7..ac8f6cd5c 100644 --- a/src/bank_header.F90 +++ b/src/bank_header.F90 @@ -14,10 +14,11 @@ module bank_header ! sites are sent from one processor to another. sequence - real(8) :: wgt ! weight of bank site - real(8) :: xyz(3) ! location of bank particle - real(8) :: uvw(3) ! diretional cosines - real(8) :: E ! energy + real(8) :: wgt ! weight of bank site + real(8) :: xyz(3) ! location of bank particle + real(8) :: uvw(3) ! diretional cosines + real(8) :: E ! energy + integer :: delayed_group ! delayed group end type Bank end module bank_header diff --git a/src/constants.F90 b/src/constants.F90 index bac301e36..5f3087707 100644 --- a/src/constants.F90 +++ b/src/constants.F90 @@ -253,28 +253,29 @@ module constants EVENT_ABSORB = 2 ! Tally score type - integer, parameter :: N_SCORE_TYPES = 20 + integer, parameter :: N_SCORE_TYPES = 21 integer, parameter :: & - SCORE_FLUX = -1, & ! flux - SCORE_TOTAL = -2, & ! total reaction rate - SCORE_SCATTER = -3, & ! scattering rate - SCORE_NU_SCATTER = -4, & ! scattering production rate - SCORE_SCATTER_N = -5, & ! arbitrary scattering moment - SCORE_SCATTER_PN = -6, & ! system for scoring 0th through nth moment - SCORE_NU_SCATTER_N = -7, & ! arbitrary nu-scattering moment - SCORE_NU_SCATTER_PN = -8, & ! system for scoring 0th through nth nu-scatter moment - SCORE_TRANSPORT = -9, & ! transport reaction rate - SCORE_N_1N = -10, & ! (n,1n) rate - SCORE_ABSORPTION = -11, & ! absorption rate - SCORE_FISSION = -12, & ! fission rate - SCORE_NU_FISSION = -13, & ! neutron production rate - SCORE_KAPPA_FISSION = -14, & ! fission energy production rate - SCORE_CURRENT = -15, & ! partial current - SCORE_FLUX_YN = -16, & ! angular moment of flux - SCORE_TOTAL_YN = -17, & ! angular moment of total reaction rate - SCORE_SCATTER_YN = -18, & ! angular flux-weighted scattering moment (0:N) - SCORE_NU_SCATTER_YN = -19, & ! angular flux-weighted nu-scattering moment (0:N) - SCORE_EVENTS = -20 ! number of events + SCORE_FLUX = -1, & ! flux + SCORE_TOTAL = -2, & ! total reaction rate + SCORE_SCATTER = -3, & ! scattering rate + SCORE_NU_SCATTER = -4, & ! scattering production rate + SCORE_SCATTER_N = -5, & ! arbitrary scattering moment + SCORE_SCATTER_PN = -6, & ! system for scoring 0th through nth moment + SCORE_NU_SCATTER_N = -7, & ! arbitrary nu-scattering moment + SCORE_NU_SCATTER_PN = -8, & ! system for scoring 0th through nth nu-scatter moment + SCORE_TRANSPORT = -9, & ! transport reaction rate + SCORE_N_1N = -10, & ! (n,1n) rate + SCORE_ABSORPTION = -11, & ! absorption rate + SCORE_FISSION = -12, & ! fission rate + SCORE_NU_FISSION = -13, & ! neutron production rate + SCORE_KAPPA_FISSION = -14, & ! fission energy production rate + SCORE_CURRENT = -15, & ! partial current + SCORE_FLUX_YN = -16, & ! angular moment of flux + SCORE_TOTAL_YN = -17, & ! angular moment of total reaction rate + SCORE_SCATTER_YN = -18, & ! angular flux-weighted scattering moment (0:N) + SCORE_NU_SCATTER_YN = -19, & ! angular flux-weighted nu-scattering moment (0:N) + SCORE_EVENTS = -20, & ! number of events + SCORE_DELAY_NU_FISSION = -21 ! delayed neutron production rate ! Maximum scattering order supported integer, parameter :: MAX_ANG_ORDER = 10 @@ -297,16 +298,17 @@ module constants integer, parameter :: NO_BIN_FOUND = -1 ! Tally filter and map types - integer, parameter :: N_FILTER_TYPES = 8 + integer, parameter :: N_FILTER_TYPES = 9 integer, parameter :: & - FILTER_UNIVERSE = 1, & - FILTER_MATERIAL = 2, & - FILTER_CELL = 3, & - FILTER_CELLBORN = 4, & - FILTER_SURFACE = 5, & - FILTER_MESH = 6, & - FILTER_ENERGYIN = 7, & - FILTER_ENERGYOUT = 8 + FILTER_UNIVERSE = 1, & + FILTER_MATERIAL = 2, & + FILTER_CELL = 3, & + FILTER_CELLBORN = 4, & + FILTER_SURFACE = 5, & + FILTER_MESH = 6, & + FILTER_ENERGYIN = 7, & + FILTER_ENERGYOUT = 8, & + FILTER_DELAYGROUP = 9 ! Tally surface current directions integer, parameter :: & @@ -398,4 +400,14 @@ module constants ! constant for writing out no residual real(8), parameter :: CMFD_NORES = 99999.0_8 + !============================================================================= + ! DELAYED NEUTRON PRECURSOR CONSTANTS + + ! Since cross section libraries come with different numbers of delayed groups + ! (e.g. ENDF/B-VII.1 has 6 and JEFF 3.1.1 has 8 delayed groups) and we don't + ! yet know what cross section library is being used when the tallies.xml file + ! is read in, we want to have an upper bound on the size of the array we + ! use to store the bins for delayed group tallies. + integer, parameter :: MAX_DELAYED_GROUPS = 8 + end module constants diff --git a/src/cross_section.F90 b/src/cross_section.F90 index 1672405e8..07504db23 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -4,7 +4,7 @@ module cross_section use constants use energy_grid, only: grid_method, log_spacing use error, only: fatal_error - use fission, only: nu_total + use fission, only: nu_total, nu_delayed use global use list_header, only: ListElemInt use material_header, only: Material @@ -42,6 +42,7 @@ contains material_xs % fission = ZERO material_xs % nu_fission = ZERO material_xs % kappa_fission = ZERO + material_xs % delay_nu_fission = ZERO ! Exit subroutine if material is void if (p % material == MATERIAL_VOID) return @@ -122,6 +123,10 @@ contains ! Add contributions to material macroscopic energy release from fission material_xs % kappa_fission = material_xs % kappa_fission + & atom_density * micro_xs(i_nuclide) % kappa_fission + + ! Add contributions to material macroscopic delay-nu-fission cross section + material_xs % delay_nu_fission = material_xs % delay_nu_fission + & + atom_density * micro_xs(i_nuclide) % delay_nu_fission end do end subroutine calculate_xs @@ -203,6 +208,7 @@ contains micro_xs(i_nuclide) % fission = ZERO micro_xs(i_nuclide) % nu_fission = ZERO micro_xs(i_nuclide) % kappa_fission = ZERO + micro_xs(i_nuclide) % delay_nu_fission = ZERO ! Calculate microscopic nuclide total cross section micro_xs(i_nuclide) % total = (ONE - f) * nuc % total(i_grid) & @@ -231,6 +237,11 @@ contains micro_xs(i_nuclide) % kappa_fission = & nuc % reactions(nuc % index_fission(1)) % Q_value * & micro_xs(i_nuclide) % fission + + ! Calculate microscopic nuclide delayed nu-fission cross section + micro_xs(i_nuclide) % delay_nu_fission = (ONE - f) * nuc % delay_nu_fission( & + i_grid) + f * nuc % delay_nu_fission(i_grid+1) + end if ! If there is S(a,b) data for this nuclide, we need to do a few @@ -498,10 +509,12 @@ contains micro_xs(i_nuclide) % fission = fission micro_xs(i_nuclide) % total = elastic + inelastic + capture + fission - ! Determine nu-fission cross section + ! Determine nu-fission and delay nu-fission cross section if (nuc % fissionable) then micro_xs(i_nuclide) % nu_fission = nu_total(nuc, E) * & micro_xs(i_nuclide) % fission + micro_xs(i_nuclide) % delay_nu_fission = nu_delayed(nuc, E) * & + micro_xs(i_nuclide) % fission end if end subroutine calculate_urr_xs diff --git a/src/global.F90 b/src/global.F90 index 004c43746..007a772da 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -68,9 +68,10 @@ module global type(NuclideMicroXS), allocatable :: micro_xs(:) ! Cache for each nuclide type(MaterialMacroXS) :: material_xs ! Cache for current material - integer :: n_nuclides_total ! Number of nuclide cross section tables - integer :: n_sab_tables ! Number of S(a,b) thermal scattering tables - integer :: n_listings ! Number of listings in cross_sections.xml + integer :: n_nuclides_total ! Number of nuclide cross section tables + integer :: n_sab_tables ! Number of S(a,b) thermal scattering tables + integer :: n_listings ! Number of listings in cross_sections.xml + integer :: n_delayed_groups = 0 ! Number of delayed groups in cross section library ! Dictionaries to look up cross sections and listings type(DictCharInt) :: nuclide_dict diff --git a/src/hdf5_summary.F90 b/src/hdf5_summary.F90 index e10ddc982..6bd835b6a 100644 --- a/src/hdf5_summary.F90 +++ b/src/hdf5_summary.F90 @@ -546,6 +546,10 @@ contains call su % write_data("energyout", "type_name", & group="tallies/tally " // trim(to_str(t % id)) & // "/filter " // trim(to_str(j))) + case(FILTER_DELAYGROUP) + call su % write_data("delaygroup", "type_name", & + group="tallies/tally " // trim(to_str(t % id)) & + // "/filter " // trim(to_str(j))) end select end do FILTER_LOOP diff --git a/src/initialize.F90 b/src/initialize.F90 index e39331675..3550b3c28 100644 --- a/src/initialize.F90 +++ b/src/initialize.F90 @@ -173,9 +173,9 @@ contains subroutine initialize_mpi() - integer :: bank_blocks(4) ! Count for each datatype - integer :: bank_types(4) ! Datatypes - integer(MPI_ADDRESS_KIND) :: bank_disp(4) ! Displacements + integer :: bank_blocks(5) ! Count for each datatype + integer :: bank_types(5) ! Datatypes + integer(MPI_ADDRESS_KIND) :: bank_disp(5) ! Displacements integer :: temp_type ! temporary derived type integer :: result_blocks(1) ! Count for each datatype integer :: result_types(1) ! Datatypes @@ -207,18 +207,19 @@ contains ! CREATE MPI_BANK TYPE ! Determine displacements for MPI_BANK type - call MPI_GET_ADDRESS(b % wgt, bank_disp(1), mpi_err) - call MPI_GET_ADDRESS(b % xyz, bank_disp(2), mpi_err) - call MPI_GET_ADDRESS(b % uvw, bank_disp(3), mpi_err) - call MPI_GET_ADDRESS(b % E, bank_disp(4), mpi_err) + call MPI_GET_ADDRESS(b % wgt, bank_disp(1), mpi_err) + call MPI_GET_ADDRESS(b % xyz, bank_disp(2), mpi_err) + call MPI_GET_ADDRESS(b % uvw, bank_disp(3), mpi_err) + call MPI_GET_ADDRESS(b % E, bank_disp(4), mpi_err) + call MPI_GET_ADDRESS(b % delayed_group, bank_disp(5), mpi_err) ! Adjust displacements bank_disp = bank_disp - bank_disp(1) ! Define MPI_BANK for fission sites - bank_blocks = (/ 1, 3, 3, 1 /) - bank_types = (/ MPI_REAL8, MPI_REAL8, MPI_REAL8, MPI_REAL8 /) - call MPI_TYPE_CREATE_STRUCT(4, bank_blocks, bank_disp, & + bank_blocks = (/ 1, 3, 3, 1, 1 /) + bank_types = (/ MPI_REAL8, MPI_REAL8, MPI_REAL8, MPI_REAL8, MPI_REAL8 /) + call MPI_TYPE_CREATE_STRUCT(5, bank_blocks, bank_disp, & bank_types, MPI_BANK, mpi_err) call MPI_TYPE_COMMIT(MPI_BANK, mpi_err) @@ -291,6 +292,8 @@ contains c_loc(tmpb(1)%uvw)), coordinates_t, hdf5_err) call h5tinsert_f(hdf5_bank_t, "E", h5offsetof(c_loc(tmpb(1)), & c_loc(tmpb(1)%E)), H5T_NATIVE_DOUBLE, hdf5_err) + call h5tinsert_f(hdf5_bank_t, "delayed_group", h5offsetof(c_loc(tmpb(1)), & + c_loc(tmpb(1)%delayed_group)), H5T_NATIVE_DOUBLE, hdf5_err) ! Determine type for integer(8) hdf5_integer8_t = h5kind_to_type(8, H5_INTEGER_KIND) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 4c1f3c244..f9cef299a 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -1952,6 +1952,7 @@ contains subroutine read_tallies_xml() + integer :: d ! delayed group index integer :: i ! loop over user-specified tallies integer :: j ! loop over words integer :: k ! another loop index @@ -2357,6 +2358,20 @@ contains ! Set to analog estimator t % estimator = ESTIMATOR_ANALOG + case ('delaygroup') + ! Set type of filter + t % filters(j) % type = FILTER_DELAYGROUP + + ! Set number of bins + t % filters(j) % n_bins = MAX_DELAYED_GROUPS + + ! Allocate and store bins + allocate(t % filters(j) % int_bins(MAX_DELAYED_GROUPS)) + + do d = 1, MAX_DELAYED_GROUPS + t % filters(j) % int_bins(d) = d + end do + case default ! Specified tally filter is invalid, raise error call fatal_error("Unknown filter type '" & @@ -2593,6 +2608,12 @@ contains call fatal_error("Cannot tally flux with an outgoing energy & &filter.") end if + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally flux with a & + &delaygroup energy filter.") + end if + case ('flux-yn') ! Prohibit user from tallying flux for an individual nuclide if (.not. (t % n_nuclide_bins == 1 .and. & @@ -2605,6 +2626,11 @@ contains &filter.") end if + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally flux with a & + &delaygroup energy filter.") + end if + t % score_bins(j : j + n_bins - 1) = SCORE_FLUX_YN t % moment_order(j : j + n_bins - 1) = n_order j = j + n_bins - 1 @@ -2616,25 +2642,53 @@ contains &outgoing energy filter.") end if + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally total reaction rate with a & + &delaygroup energy filter.") + end if + case ('total-yn') if (t % find_filter(FILTER_ENERGYOUT) > 0) then call fatal_error("Cannot tally total reaction rate with an & &outgoing energy filter.") end if + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally total reaction rate with a & + &delaygroup energy filter.") + end if + t % score_bins(j : j + n_bins - 1) = SCORE_TOTAL_YN t % moment_order(j : j + n_bins - 1) = n_order j = j + n_bins - 1 case ('scatter') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally scatter with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = SCORE_SCATTER case ('nu-scatter') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally nu scatter with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = SCORE_NU_SCATTER ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG case ('scatter-n') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally scatter n with a & + &delaygroup energy filter.") + end if + if (n_order == 0) then t % score_bins(j) = SCORE_SCATTER else @@ -2645,6 +2699,12 @@ contains t % moment_order(j) = n_order case ('nu-scatter-n') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally nu scatter n with a & + &delaygroup energy filter.") + end if + ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG if (n_order == 0) then @@ -2655,6 +2715,12 @@ contains t % moment_order(j) = n_order case ('scatter-pn') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally scatter pn with a & + &delaygroup energy filter.") + end if + t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_SCATTER_PN @@ -2662,6 +2728,12 @@ contains j = j + n_bins - 1 case ('nu-scatter-pn') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally nu scatter pn with a & + &delaygroup energy filter.") + end if + t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_NU_SCATTER_PN @@ -2669,6 +2741,12 @@ contains j = j + n_bins - 1 case ('scatter-yn') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally scatter yn with a & + &delaygroup energy filter.") + end if + t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_SCATTER_YN @@ -2676,6 +2754,12 @@ contains j = j + n_bins - 1 case ('nu-scatter-yn') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally nu scatter yn with a & + &delaygroup energy filter.") + end if + t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_NU_SCATTER_YN @@ -2683,48 +2767,115 @@ contains j = j + n_bins - 1 case('transport') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally transport reaction rate with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = SCORE_TRANSPORT ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG case ('diffusion') - call fatal_error("Diffusion score no longer supported for tallies, & + call fatal_error("Diffusion score no longer supported for tallies, & &please remove") case ('n1n') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally n1n with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = SCORE_N_1N ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG case ('n2n') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally n2n with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = N_2N case ('n3n') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally n3n with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = N_3N case ('n4n') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally n4n with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = N_4N case ('absorption') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally absorption rate with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = SCORE_ABSORPTION if (t % find_filter(FILTER_ENERGYOUT) > 0) then call fatal_error("Cannot tally absorption rate with an outgoing & &energy filter.") end if case ('fission') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally fission rate with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = SCORE_FISSION if (t % find_filter(FILTER_ENERGYOUT) > 0) then call fatal_error("Cannot tally fission rate with an outgoing & &energy filter.") end if case ('nu-fission') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally nu fission rate with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = SCORE_NU_FISSION if (t % find_filter(FILTER_ENERGYOUT) > 0) then ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG end if + case ('delay-nu-fission') + + t % score_bins(j) = SCORE_DELAY_NU_FISSION + if (t % find_filter(FILTER_ENERGYOUT) > 0) then + ! Set tally estimator to analog + t % estimator = ESTIMATOR_ANALOG + end if case ('kappa-fission') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally kappa fission with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = SCORE_KAPPA_FISSION case ('current') + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + call fatal_error("Cannot tally current with a & + &delaygroup energy filter.") + end if + t % score_bins(j) = SCORE_CURRENT t % type = TALLY_SURFACE_CURRENT diff --git a/src/output.F90 b/src/output.F90 index 5599d8c56..40b69eed7 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -317,6 +317,7 @@ contains ! Display weight, energy, grid index, and interpolation factor write(ou,*) ' Weight = ' // to_str(p % wgt) write(ou,*) ' Energy = ' // to_str(p % E) + write(ou,*) ' Delayed Group = ' // to_str(p % delayed_group) write(ou,*) end subroutine print_particle @@ -837,6 +838,17 @@ contains write(unit_,*) ' Outgoing Energy Bins:' // trim(string) end if + ! Write any delayed group bins if present + j = t % find_filter(FILTER_DELAYGROUP) + if (j > 0) then + string = "" + do i = 1, t % filters(j) % n_bins + string = trim(string) // ' ' // trim(to_str(& + t % filters(j) % int_bins(i))) + end do + write(unit_,*) ' Delay Group Bins:' // trim(string) + end if + ! Write nuclides bins write(unit_,fmt='(1X,A)',advance='no') ' Nuclide Bins:' do i = 1, t % n_nuclide_bins @@ -934,6 +946,8 @@ contains string = trim(string) // ' kappa-fission' case (SCORE_CURRENT) string = trim(string) // ' current' + case (SCORE_DELAY_NU_FISSION) + string = trim(string) // ' delay-nu-fission' case default string = trim(string) // ' ' // reaction_name(t % score_bins(j)) end select @@ -1706,35 +1720,37 @@ contains if (n_tallies == 0) return ! Initialize names for tally filter types - filter_name(FILTER_UNIVERSE) = "Universe" - filter_name(FILTER_MATERIAL) = "Material" - filter_name(FILTER_CELL) = "Cell" - filter_name(FILTER_CELLBORN) = "Birth Cell" - filter_name(FILTER_SURFACE) = "Surface" - filter_name(FILTER_MESH) = "Mesh" - filter_name(FILTER_ENERGYIN) = "Incoming Energy" - filter_name(FILTER_ENERGYOUT) = "Outgoing Energy" + filter_name(FILTER_UNIVERSE) = "Universe" + filter_name(FILTER_MATERIAL) = "Material" + filter_name(FILTER_CELL) = "Cell" + filter_name(FILTER_CELLBORN) = "Birth Cell" + filter_name(FILTER_SURFACE) = "Surface" + filter_name(FILTER_MESH) = "Mesh" + filter_name(FILTER_ENERGYIN) = "Incoming Energy" + filter_name(FILTER_ENERGYOUT) = "Outgoing Energy" + filter_name(FILTER_DELAYGROUP) = "Delay Group" ! Initialize names for scores - score_names(abs(SCORE_FLUX)) = "Flux" - score_names(abs(SCORE_TOTAL)) = "Total Reaction Rate" - score_names(abs(SCORE_SCATTER)) = "Scattering Rate" - score_names(abs(SCORE_NU_SCATTER)) = "Scattering Production Rate" - score_names(abs(SCORE_TRANSPORT)) = "Transport Rate" - score_names(abs(SCORE_N_1N)) = "(n,1n) Rate" - score_names(abs(SCORE_ABSORPTION)) = "Absorption Rate" - score_names(abs(SCORE_FISSION)) = "Fission Rate" - score_names(abs(SCORE_NU_FISSION)) = "Nu-Fission Rate" - score_names(abs(SCORE_KAPPA_FISSION)) = "Kappa-Fission Rate" - score_names(abs(SCORE_EVENTS)) = "Events" - score_names(abs(SCORE_FLUX_YN)) = "Flux Moment" - score_names(abs(SCORE_TOTAL_YN)) = "Total Reaction Rate Moment" - score_names(abs(SCORE_SCATTER_N)) = "Scattering Rate Moment" - score_names(abs(SCORE_SCATTER_PN)) = "Scattering Rate Moment" - score_names(abs(SCORE_SCATTER_YN)) = "Scattering Rate Moment" - score_names(abs(SCORE_NU_SCATTER_N)) = "Scattering Prod. Rate Moment" - score_names(abs(SCORE_NU_SCATTER_PN)) = "Scattering Prod. Rate Moment" - score_names(abs(SCORE_NU_SCATTER_YN)) = "Scattering Prod. Rate Moment" + score_names(abs(SCORE_FLUX)) = "Flux" + score_names(abs(SCORE_TOTAL)) = "Total Reaction Rate" + score_names(abs(SCORE_SCATTER)) = "Scattering Rate" + score_names(abs(SCORE_NU_SCATTER)) = "Scattering Production Rate" + score_names(abs(SCORE_TRANSPORT)) = "Transport Rate" + score_names(abs(SCORE_N_1N)) = "(n,1n) Rate" + score_names(abs(SCORE_ABSORPTION)) = "Absorption Rate" + score_names(abs(SCORE_FISSION)) = "Fission Rate" + score_names(abs(SCORE_NU_FISSION)) = "Nu-Fission Rate" + score_names(abs(SCORE_KAPPA_FISSION)) = "Kappa-Fission Rate" + score_names(abs(SCORE_EVENTS)) = "Events" + score_names(abs(SCORE_FLUX_YN)) = "Flux Moment" + score_names(abs(SCORE_TOTAL_YN)) = "Total Reaction Rate Moment" + score_names(abs(SCORE_SCATTER_N)) = "Scattering Rate Moment" + score_names(abs(SCORE_SCATTER_PN)) = "Scattering Rate Moment" + score_names(abs(SCORE_SCATTER_YN)) = "Scattering Rate Moment" + score_names(abs(SCORE_NU_SCATTER_N)) = "Scattering Prod. Rate Moment" + score_names(abs(SCORE_NU_SCATTER_PN)) = "Scattering Prod. Rate Moment" + score_names(abs(SCORE_NU_SCATTER_YN)) = "Scattering Prod. Rate Moment" + score_names(abs(SCORE_DELAY_NU_FISSION)) = "Delay-Nu-fission Rate" ! Create filename for tally output filename = trim(path_output) // "tallies.out" @@ -2143,6 +2159,9 @@ contains E0 = t % filters(i_filter) % real_bins(bin) E1 = t % filters(i_filter) % real_bins(bin + 1) label = "[" // trim(to_str(E0)) // ", " // trim(to_str(E1)) // ")" + case (FILTER_DELAYGROUP) + i = t % filters(i_filter) % int_bins(bin) + label = to_str(i) end select end function get_label diff --git a/src/particle_header.F90 b/src/particle_header.F90 index 3e9dca7d5..7b922837e 100644 --- a/src/particle_header.F90 +++ b/src/particle_header.F90 @@ -1,6 +1,6 @@ module particle_header - use constants, only: NEUTRON, ONE, NONE, ZERO + use constants, only: NEUTRON, ONE, NONE, ZERO, MAX_DELAYED_GROUPS use geometry_header, only: BASE_UNIVERSE implicit none @@ -63,10 +63,13 @@ module particle_header integer :: event ! scatter, absorption integer :: event_nuclide ! index in nuclides array integer :: event_MT ! reaction MT + integer :: delayed_group ! delayed group ! Post-collision physical data integer :: n_bank ! number of fission sites banked real(8) :: wgt_bank ! weight of fission sites banked + integer :: n_delay_bank(MAX_DELAYED_GROUPS) ! number of delayed fission + ! sites banked ! Indices for various arrays integer :: surface ! index for surface particle is on @@ -115,6 +118,7 @@ contains subroutine initialize_particle(this) class(Particle) :: this + integer :: d ! Clear coordinate lists call this % clear() @@ -135,6 +139,11 @@ contains this % wgt_bank = ZERO this % n_collision = 0 this % fission = .false. + this % delayed_group = 0 + + do d = 1, MAX_DELAYED_GROUPS + this % n_delay_bank(d) = 0 + end do ! Set up base level coordinates allocate(this % coord0) diff --git a/src/physics.F90 b/src/physics.F90 index 69bbcff34..2b728336e 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -1059,14 +1059,16 @@ contains integer, intent(in) :: i_nuclide integer, intent(in) :: i_reaction - integer :: i ! loop index - integer :: nu ! actual number of neutrons produced - integer :: ijk(3) ! indices in ufs mesh - real(8) :: nu_t ! total nu - real(8) :: mu ! fission neutron angular cosine - real(8) :: phi ! fission neutron azimuthal angle - real(8) :: weight ! weight adjustment for ufs method - logical :: in_mesh ! source site in ufs mesh? + integer :: d ! delayed group index + integer :: nu_delay(n_delayed_groups) ! number of delayed neutrons born + integer :: i ! loop index + integer :: nu ! actual number of neutrons produced + integer :: ijk(3) ! indices in ufs mesh + real(8) :: nu_t ! total nu + real(8) :: mu ! fission neutron angular cosine + real(8) :: phi ! fission neutron azimuthal angle + real(8) :: weight ! weight adjustment for ufs method + logical :: in_mesh ! source site in ufs mesh? type(Nuclide), pointer, save :: nuc => null() type(Reaction), pointer, save :: rxn => null() !$omp threadprivate(nuc, rxn) @@ -1117,6 +1119,13 @@ contains ! Bank source neutrons if (nu == 0 .or. n_bank == size(fission_bank)) return + + ! Initialize counter of delayed neutrons encountered for each delayed group + ! to zero. + do d = 1, n_delayed_groups + nu_delay(d) = 0 + end do + p % fission = .true. ! Fission neutrons will be banked do i = int(n_bank,4) + 1, int(min(n_bank + nu, int(size(fission_bank),8)),4) ! Bank source neutrons by copying particle data @@ -1139,15 +1148,26 @@ contains ! Sample secondary energy distribution for fission reaction and set energy ! in fission bank - fission_bank(i) % E = sample_fission_energy(nuc, rxn, p % E) + fission_bank(i) % E = sample_fission_energy(nuc, rxn, p) + + ! Set the delayed group of the neutron + fission_bank(i) % delayed_group = p % delayed_group + + ! Increment the number of neutrons born delayed + if (p % delayed_group > 0) then + nu_delay(p % delayed_group) = nu_delay(p % delayed_group) + 1 + end if end do ! increment number of bank sites n_bank = min(n_bank + nu, int(size(fission_bank),8)) - ! Store total weight banked for analog fission tallies + ! Store total and delayed weight banked for analog fission tallies p % n_bank = nu p % wgt_bank = nu/weight + do d = 1, n_delayed_groups + p % n_delay_bank(d) = nu_delay(d) + end do end subroutine create_fission_sites @@ -1155,12 +1175,12 @@ contains ! SAMPLE_FISSION_ENERGY !=============================================================================== - function sample_fission_energy(nuc, rxn, E) result(E_out) + function sample_fission_energy(nuc, rxn, p) result(E_out) - type(Nuclide), pointer :: nuc - type(Reaction), pointer :: rxn - real(8), intent(in) :: E ! incoming energy of neutron - real(8) :: E_out ! outgoing energy of fission neutron + type(Nuclide), pointer :: nuc + type(Reaction), pointer :: rxn + type(Particle), intent(inout) :: p ! Particle caussing fission + real(8) :: E_out ! outgoing energy of fission neutron integer :: j ! index on nu energy grid / precursor group integer :: lc ! index before start of energies/nu values @@ -1179,10 +1199,10 @@ contains !$omp threadprivate(edist) ! Determine total nu - nu_t = nu_total(nuc, E) + nu_t = nu_total(nuc, p % E) ! Determine delayed nu - nu_d = nu_delayed(nuc, E) + nu_d = nu_delayed(nuc, p % E) ! Determine delayed neutron fraction beta = nu_d / nu_t @@ -1202,7 +1222,7 @@ contains ! determine delayed neutron precursor yield for group j yield = interpolate_tab1(nuc % nu_d_precursor_data( & - lc+1:lc+2+2*NR+2*NE), E) + lc+1:lc+2+2*NR+2*NE), p % E) ! Check if this group is sampled prob = prob + yield @@ -1217,6 +1237,9 @@ contains ! n_precursor -- check for this condition j = min(j, nuc % n_precursor) + ! set the delayed group for the particle born from fission + p % delayed_group = j + ! select energy distribution for group j law = nuc % nu_d_edist(j) % law edist => nuc % nu_d_edist(j) @@ -1225,9 +1248,9 @@ contains n_sample = 0 do if (law == 44 .or. law == 61) then - call sample_energy(edist, E, E_out, mu) + call sample_energy(edist, p % E, E_out, mu) else - call sample_energy(edist, E, E_out) + call sample_energy(edist, p % E, E_out) end if ! resample if energy is >= 20 MeV @@ -1246,14 +1269,17 @@ contains ! ==================================================================== ! PROMPT NEUTRON SAMPLED + ! set the delayed group for the particle born from fission to 0 + p % delayed_group = 0 + ! sample from prompt neutron energy distribution law = rxn % edist % law n_sample = 0 do if (law == 44 .or. law == 61) then - call sample_energy(rxn%edist, E, E_out, prob) + call sample_energy(rxn%edist, p % E, E_out, prob) else - call sample_energy(rxn%edist, E, E_out) + call sample_energy(rxn%edist, p % E, E_out) end if ! resample if energy is >= 20 MeV diff --git a/src/tally.F90 b/src/tally.F90 index c96f1ecd6..335bcf82c 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -14,6 +14,9 @@ module tally use search, only: binary_search use string, only: to_str use tally_header, only: TallyResult, TallyMapItem, TallyMapElement + use fission, only: nu_total, nu_delayed + use output, only: write_message + use interpolation, only: interpolate_tab1 #ifdef MPI use mpi @@ -42,12 +45,18 @@ contains integer :: k ! loop index for nuclide bins integer :: n ! loop index for legendre order integer :: num_nm ! Number of N,M orders in harmonic - integer :: l ! scoring bin loop index, allowing for changing - ! position during the loop + integer :: l ! scoring bin loop index, allowing for + ! changing position during the loop integer :: filter_index ! single index for single bin integer :: score_bin ! scoring bin, e.g. SCORE_FLUX integer :: i_nuclide ! index in nuclides array integer :: score_index ! scoring bin index + integer :: lc ! pointer for interpolating in precursor + ! yield table + integer :: NR ! number of interpolation regions + integer :: NE ! number of interpolation energies + integer :: d ! delayed neutron index + real(8) :: yield ! delayed neutron yield real(8) :: score ! analog tally score real(8) :: last_wgt ! pre-collision particle weight real(8) :: wgt ! post-collision particle weight @@ -526,6 +535,107 @@ contains micro_xs(p % event_nuclide) % kappa_fission / & micro_xs(p % event_nuclide) % absorption end if + case (SCORE_DELAY_NU_FISSION) + + if (survival_biasing) then + ! No fission events occur if survival biasing is on -- need to + ! calculate fraction of absorptions that would have resulted in + ! delayed-nu-fission + + if (t % find_filter(FILTER_ENERGYOUT) > 0) then + ! Normally, we only need to make contributions to one scoring + ! bin. However, in the case of fission, since multiple fission + ! neutrons were emitted with different energies, multiple + ! outgoing energy bins may have been scored to. The following + ! logic treats this special case and results to multiple bins + + call score_fission_delayed_eout(p, t, score_index) + + else + + ! Normally, we only need to make contributions to one scoring + ! bin. However, in the case of fission, since multiple delayed + ! neutron groups will produce a fractional amount of neutrons on + ! each collision, multiple delayed group bins need to be scored to. + + if (micro_xs(p % event_nuclide) % fission > ZERO) then + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + + lc = 1 + do d = 1, n_delayed_groups + + ! determine number of interpolation regions and energies + NR = int(nuclides(p % event_nuclide) % nu_d_precursor_data(lc + 1)) + NE = int(nuclides(p % event_nuclide) % nu_d_precursor_data(lc + 2 + 2*NR)) + + ! determine delayed neutron precursor yield for group d + yield = interpolate_tab1(nuclides(p % event_nuclide) % nu_d_precursor_data( & + lc+1:lc+2+2*NR+2*NE), p % E) + + ! advance pointer + lc = lc + 2 + 2*NR + 2*NE + 1 + + score = p % absorb_wgt * yield * micro_xs(p % event_nuclide) % & + delay_nu_fission / micro_xs(p % event_nuclide) % absorption + + t % results(score_index, d) % value = & + t % results(score_index, d) % value + score + end do + else + score = p % absorb_wgt * micro_xs(p % event_nuclide) % & + delay_nu_fission / micro_xs(p % event_nuclide) % absorption + + t % results(score_index, 1) % value = & + t % results(score_index, 1) % value + score + end if + end if + end if + + cycle SCORE_LOOP + + else + + ! Skip any non-fission events or fission events that don't produce + ! delayed neutrons + if (.not. p % fission) cycle SCORE_LOOP + + if (t % find_filter(FILTER_ENERGYOUT) > 0) then + ! Normally, we only need to make contributions to one scoring + ! bin. However, in the case of fission, since multiple fission + ! neutrons were emitted with different energies, multiple + ! outgoing energy bins may have been scored to. The following + ! logic treats this special case and results to multiple bins + + call score_fission_delayed_eout(p, t, score_index) + cycle SCORE_LOOP + + else + ! If there is no outgoing energy filter, than we only need to + ! score to one bin. For the score to be 'analog', we need to + ! score the number of delayed particles that were banked in the + ! fission bank. Since this was weighted by 1/keff, we multiply + ! by keff to get the proper score. + + score = ZERO + + ! Loop over the neutrons produce from fission and check which + ! ones are delayed. If a delayed neutron is encountered, add + ! its contribution to the fission bank to the score. + do d = 1, n_delayed_groups + score = keff * p % wgt_bank / p % n_bank * p % n_delay_bank(d) + + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + t % results(score_index, d) % value = & + t % results(score_index, d) % value + score + else + t % results(score_index, 1) % value = & + t % results(score_index, 1) % value + score + end if + end do + cycle SCORE_LOOP + end if + end if case (SCORE_EVENTS) ! Simply count number of scoring events score = ONE @@ -624,6 +734,77 @@ contains end subroutine score_fission_eout + !=============================================================================== + ! SCORE_FISSION_DELAYED_EOUT handles a special case where we need to store + ! delayed neutron production rate with an outgoing energy filter (think of a + ! fission matrix). In this case, we may need to score to multiple bins if there + ! were multiple neutrons produced with different energies. + !=============================================================================== + + subroutine score_fission_delayed_eout(p, t, i_score) + + type(Particle), intent(in) :: p + type(TallyObject), pointer :: t + integer, intent(in) :: i_score ! index for score + + integer :: j ! delayed group + integer :: i ! index of outgoing energy filter + integer :: n ! number of energies on filter + integer :: k ! loop index for bank sites + integer :: bin_energyout ! original outgoing energy bin + integer :: i_filter ! index for matching filter bin combination + real(8) :: score ! actual score + real(8) :: E_out ! energy of fission bank site + + ! save original outgoing energy bin and score index + i = t % find_filter(FILTER_ENERGYOUT) + bin_energyout = matching_bins(i) + + ! Get number of energies on filter + n = size(t % filters(i) % real_bins) + + ! Since the creation of fission sites is weighted such that it is + ! expected to create n_particles sites, we need to multiply the + ! score by keff to get the true nu-fission rate. Otherwise, the sum + ! of all nu-fission rates would be ~1.0. + + ! loop over number of particles banked + do k = 1, p % n_bank + + ! get the delayed group + j = fission_bank(n_bank - p % n_bank + k) % delayed_group + + ! check if the particle was born delayed + if (j /= 0) then + + ! determine score based on bank site weight and keff + score = keff * fission_bank(n_bank - p % n_bank + k) % wgt + + ! determine outgoing energy from fission bank + E_out = fission_bank(n_bank - p % n_bank + k) % E + + ! check if outgoing energy is within specified range on filter + if (E_out < t % filters(i) % real_bins(1) .or. & + E_out > t % filters(i) % real_bins(n)) cycle + + ! change outgoing energy bin + matching_bins(i) = binary_search(t % filters(i) % real_bins, n, E_out) + + ! determine scoring index + i_filter = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1 + + ! Add score to tally + !$omp atomic + t % results(i_score, i_filter) % value = & + t % results(i_score, i_filter) % value + score + end if + end do + + ! reset outgoing energy bin and score index + matching_bins(i) = bin_energyout + + end subroutine score_fission_delayed_eout + !=============================================================================== ! SCORE_TRACKLENGTH_TALLY calculates fluxes and reaction rates based on the ! track-length estimate of the flux. This is triggered at every event (surface @@ -651,6 +832,13 @@ contains integer :: i_energy ! index in nuclide energy grid integer :: score_bin ! scoring type, e.g. SCORE_FLUX integer :: score_index ! scoring bin index + integer :: lc ! pointer for interpolating in precursor + ! yield table + integer :: NR ! number of interpolation regions + integer :: NE ! number of interpolation energies + integer :: d ! delayed neutron index + integer :: d_nuclide ! delayed neutron index for specific nuclide + real(8) :: yield ! delayed neutron yield real(8) :: f ! interpolation factor real(8) :: flux ! tracklength estimate of flux real(8) :: score ! actual score (e.g., flux*xs) @@ -830,6 +1018,47 @@ contains ! For number of events, just score unity score = ONE + case (SCORE_DELAY_NU_FISSION) + + if (micro_xs(i_nuclide) % fission > ZERO) then + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + + lc = 1 + do d = 1, n_delayed_groups + + ! determine number of interpolation regions and energies + NR = int(nuclides(i_nuclide) % nu_d_precursor_data(lc + 1)) + NE = int(nuclides(i_nuclide) % nu_d_precursor_data(lc + 2 + 2*NR)) + + ! determine delayed neutron precursor yield for group d + yield = interpolate_tab1(nuclides(i_nuclide) % nu_d_precursor_data( & + lc+1:lc+2+2*NR+2*NE), p % E) + + ! advance pointer + lc = lc + 2 + 2*NR + 2*NE + 1 + + ! Delay-nu-fission cross section is pre-calculated + score = micro_xs(i_nuclide) % delay_nu_fission * yield * & + atom_density * flux + + !$omp critical + t % results(score_index, d) % value = & + t % results(score_index, d) % value + score + !$omp critical end + end do + else + score = micro_xs(i_nuclide) % delay_nu_fission * & + atom_density * flux + + !$omp critical + t % results(score_index, 1) % value = & + t % results(score_index, 1) % value + score + !$omp critical end + end if + end if + + cycle SCORE_LOOP + case default ! Any other cross section has to be calculated on-the-fly. For ! cross sections that are used often (e.g. n2n, ngamma, etc. for @@ -957,6 +1186,51 @@ contains ! For number of events, just score unity score = ONE + case (SCORE_DELAY_NU_FISSION) + + if (p % material /= MATERIAL_VOID) then + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + do d_nuclide = 1, materials(p % material) % n_nuclides + if (micro_xs(d_nuclide) % fission > ZERO) then + + lc = 1 + do d = 1, n_delayed_groups + + ! determine number of interpolation regions and energies + NR = int(nuclides(d_nuclide) % nu_d_precursor_data(lc + 1)) + NE = int(nuclides(d_nuclide) % nu_d_precursor_data(lc + 2 + 2*NR)) + + ! determine delayed neutron precursor yield for group d + yield = interpolate_tab1(nuclides(d_nuclide) % nu_d_precursor_data( & + lc+1:lc+2+2*NR+2*NE), p % E) + + ! advance pointer + lc = lc + 2 + 2*NR + 2*NE + 1 + + ! Delay-nu-fission cross section is pre-calculated + score = micro_xs(d_nuclide) % delay_nu_fission * yield * & + materials(p % material) % atom_density(d_nuclide) * flux + + !$omp critical + t % results(score_index, d) % value = & + t % results(score_index, d) % value + score + !$omp critical end + end do + end if + end do + else + ! Delay-nu-fission cross section is pre-calculated + score = material_xs % delay_nu_fission * flux + + !$omp critical + t % results(score_index, 1) % value = & + t % results(score_index, 1) % value + score + !$omp critical end + end if + end if + + cycle SCORE_LOOP + case default ! Any other cross section has to be calculated on-the-fly. This ! is somewhat costly since it requires a loop over each nuclide @@ -1056,6 +1330,13 @@ contains integer :: score_bin ! type of score, e.g. SCORE_FLUX integer :: score_index ! scoring bin index integer :: i_energy ! index in nuclide energy grid + integer :: lc ! pointer for interpolating in precursor + ! yield table + integer :: NR ! number of interpolation regions + integer :: NE ! number of interpolation energies + integer :: d ! delayed neutron index + integer :: d_nuclide ! delayed neutron index for specific nuclide + real(8) :: yield ! delayed neutron yield real(8) :: f ! interpolation factor real(8) :: score ! actual scoring tally value real(8) :: atom_density ! atom density of single nuclide in atom/b-cm @@ -1168,6 +1449,47 @@ contains case (SCORE_EVENTS) score = ONE + case (SCORE_DELAY_NU_FISSION) + + if (micro_xs(i_nuclide) % fission > ZERO) then + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + + lc = 1 + do d = 1, n_delayed_groups + + ! determine number of interpolation regions and energies + NR = int(nuclides(i_nuclide) % nu_d_precursor_data(lc + 1)) + NE = int(nuclides(i_nuclide) % nu_d_precursor_data(lc + 2 + 2*NR)) + + ! determine delayed neutron precursor yield for group d + yield = interpolate_tab1(nuclides(i_nuclide) % nu_d_precursor_data( & + lc+1:lc+2+2*NR+2*NE), p % E) + + ! advance pointer + lc = lc + 2 + 2*NR + 2*NE + 1 + + ! Delay-nu-fission cross section is pre-calculated + score = micro_xs(i_nuclide) % delay_nu_fission * yield * & + atom_density * flux + + !$omp critical + t % results(score_index, d) % value = & + t % results(score_index, d) % value + score + !$omp critical end + end do + else + score = micro_xs(i_nuclide) % delay_nu_fission * & + atom_density * flux + + !$omp critical + t % results(score_index, 1) % value = & + t % results(score_index, 1) % value + score + !$omp critical end + end if + end if + + cycle SCORE_LOOP + case default ! Any other cross section has to be calculated on-the-fly. For cross ! sections that are used often (e.g. n2n, ngamma, etc. for depletion), @@ -1307,6 +1629,51 @@ contains case (SCORE_EVENTS) score = ONE + case (SCORE_DELAY_NU_FISSION) + + if (p % material /= MATERIAL_VOID) then + if (t % find_filter(FILTER_DELAYGROUP) > 0) then + do d_nuclide = 1, materials(p % material) % n_nuclides + if (micro_xs(d_nuclide) % fission > ZERO) then + + lc = 1 + do d = 1, n_delayed_groups + + ! determine number of interpolation regions and energies + NR = int(nuclides(d_nuclide) % nu_d_precursor_data(lc + 1)) + NE = int(nuclides(d_nuclide) % nu_d_precursor_data(lc + 2 + 2*NR)) + + ! determine delayed neutron precursor yield for group d + yield = interpolate_tab1(nuclides(d_nuclide) % nu_d_precursor_data( & + lc+1:lc+2+2*NR+2*NE), p % E) + + ! advance pointer + lc = lc + 2 + 2*NR + 2*NE + 1 + + ! Delay-nu-fission cross section is pre-calculated + score = micro_xs(d_nuclide) % delay_nu_fission * yield * & + materials(p % material) % atom_density(d_nuclide) * flux + + !$omp critical + t % results(score_index, d) % value = & + t % results(score_index, d) % value + score + !$omp critical end + end do + end if + end do + else + ! Delay-nu-fission cross section is pre-calculated + score = material_xs % delay_nu_fission * flux + + !$omp critical + t % results(score_index, 1) % value = & + t % results(score_index, 1) % value + score + !$omp critical end + end if + end if + + cycle MATERIAL_SCORE_LOOP + case default ! Any other cross section has to be calculated on-the-fly. This is ! somewhat costly since it requires a loop over each nuclide in a @@ -1698,6 +2065,9 @@ contains score = micro_xs(i_nuclide) % kappa_fission * atom_density * flux case (SCORE_EVENTS) score = ONE + case (SCORE_DELAY_NU_FISSION) + score = micro_xs(i_nuclide) % delay_nu_fission * & + atom_density * flux case default call fatal_error("Invalid score type on tally " & &// to_str(t % id) // ".") @@ -1773,6 +2143,8 @@ contains score = material_xs % kappa_fission * flux case (SCORE_EVENTS) score = ONE + case (SCORE_DELAY_NU_FISSION) + score = material_xs % delay_nu_fission * flux case default call fatal_error("Invalid score type on tally " & &// to_str(t % id) // ".") @@ -1899,6 +2271,19 @@ contains n + 1, p % E) end if + case (FILTER_DELAYGROUP) + + if (survival_biasing .and. t % find_filter(FILTER_ENERGYOUT) <= 0) then + matching_bins(i) = 1 + elseif (active_tracklength_tallies % size() > 0) then + matching_bins(i) = 1 + else + if (p % delayed_group == 0) then + matching_bins = NO_BIN_FOUND + else + matching_bins(i) = p % delayed_group + end if + end if end select ! If the current filter didn't match, exit this subroutine diff --git a/src/tracking.F90 b/src/tracking.F90 index c939f7991..772ce3dd3 100644 --- a/src/tracking.F90 +++ b/src/tracking.F90 @@ -28,6 +28,7 @@ contains type(Particle), intent(inout) :: p + integer :: d ! delayed group index integer :: surface_crossed ! surface which particle is on integer :: lattice_translation(3) ! in-lattice translation vector integer :: last_cell ! most recent cell particle was in @@ -165,6 +166,10 @@ contains p % n_bank = 0 p % wgt_bank = ZERO + do d = 1, n_delayed_groups + p % n_delay_bank = 0 + end do + ! Reset fission logical p % fission = .false. From c734994c267278fab2493469442be33ce08982b9 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Wed, 1 Apr 2015 15:49:56 -0400 Subject: [PATCH 02/38] fixed comment in ace.F90 for generating delayed nu fission --- src/ace.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index b566c40b6..3deceace5 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -1410,9 +1410,9 @@ contains end subroutine generate_nu_fission !=============================================================================== -! GENERATE_DELAYED_NU_FISSION precalculates the microscopic nu-fission cross section for -! a given nuclide. This is done so that the nu_total function does not need to -! be called during cross section lookups. +! GENERATE_DELAYED_NU_FISSION precalculates the microscopic delay-nu-fission +! cross section for a given nuclide. This is done so that the nu_delayed +! function does not need to be called during cross section lookups. !=============================================================================== subroutine generate_delay_nu_fission(nuc) From 460b0a75a74cdcdb714a7f7b457cfcfe611b1fd8 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Wed, 1 Apr 2015 20:44:49 -0400 Subject: [PATCH 03/38] fixed omp error in tally.F90 --- src/tally.F90 | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/tally.F90 b/src/tally.F90 index 335bcf82c..a8e94027e 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -562,6 +562,7 @@ contains if (t % find_filter(FILTER_DELAYGROUP) > 0) then +!$omp critical lc = 1 do d = 1, n_delayed_groups @@ -582,6 +583,7 @@ contains t % results(score_index, d) % value = & t % results(score_index, d) % value + score end do +!$omp end critical else score = p % absorb_wgt * micro_xs(p % event_nuclide) % & delay_nu_fission / micro_xs(p % event_nuclide) % absorption @@ -622,6 +624,7 @@ contains ! Loop over the neutrons produce from fission and check which ! ones are delayed. If a delayed neutron is encountered, add ! its contribution to the fission bank to the score. +!$omp critical do d = 1, n_delayed_groups score = keff * p % wgt_bank / p % n_bank * p % n_delay_bank(d) @@ -633,6 +636,7 @@ contains t % results(score_index, 1) % value + score end if end do +!$omp end critical cycle SCORE_LOOP end if end if @@ -1023,6 +1027,7 @@ contains if (micro_xs(i_nuclide) % fission > ZERO) then if (t % find_filter(FILTER_DELAYGROUP) > 0) then +!$omp critical lc = 1 do d = 1, n_delayed_groups @@ -1041,19 +1046,16 @@ contains score = micro_xs(i_nuclide) % delay_nu_fission * yield * & atom_density * flux - !$omp critical t % results(score_index, d) % value = & t % results(score_index, d) % value + score - !$omp critical end end do +!$omp end critical else score = micro_xs(i_nuclide) % delay_nu_fission * & atom_density * flux - !$omp critical t % results(score_index, 1) % value = & t % results(score_index, 1) % value + score - !$omp critical end end if end if @@ -1190,6 +1192,8 @@ contains if (p % material /= MATERIAL_VOID) then if (t % find_filter(FILTER_DELAYGROUP) > 0) then + +!$omp critical do d_nuclide = 1, materials(p % material) % n_nuclides if (micro_xs(d_nuclide) % fission > ZERO) then @@ -1211,21 +1215,18 @@ contains score = micro_xs(d_nuclide) % delay_nu_fission * yield * & materials(p % material) % atom_density(d_nuclide) * flux - !$omp critical t % results(score_index, d) % value = & t % results(score_index, d) % value + score - !$omp critical end end do end if end do +!$omp end critical else ! Delay-nu-fission cross section is pre-calculated score = material_xs % delay_nu_fission * flux - !$omp critical t % results(score_index, 1) % value = & t % results(score_index, 1) % value + score - !$omp critical end end if end if @@ -1454,6 +1455,7 @@ contains if (micro_xs(i_nuclide) % fission > ZERO) then if (t % find_filter(FILTER_DELAYGROUP) > 0) then +!$omp critical lc = 1 do d = 1, n_delayed_groups @@ -1472,19 +1474,16 @@ contains score = micro_xs(i_nuclide) % delay_nu_fission * yield * & atom_density * flux - !$omp critical t % results(score_index, d) % value = & t % results(score_index, d) % value + score - !$omp critical end end do +!$omp end critical else score = micro_xs(i_nuclide) % delay_nu_fission * & atom_density * flux - !$omp critical t % results(score_index, 1) % value = & t % results(score_index, 1) % value + score - !$omp critical end end if end if @@ -1633,6 +1632,7 @@ contains if (p % material /= MATERIAL_VOID) then if (t % find_filter(FILTER_DELAYGROUP) > 0) then +!$omp critical do d_nuclide = 1, materials(p % material) % n_nuclides if (micro_xs(d_nuclide) % fission > ZERO) then @@ -1654,21 +1654,18 @@ contains score = micro_xs(d_nuclide) % delay_nu_fission * yield * & materials(p % material) % atom_density(d_nuclide) * flux - !$omp critical t % results(score_index, d) % value = & t % results(score_index, d) % value + score - !$omp critical end end do end if end do +!$omp end critical else ! Delay-nu-fission cross section is pre-calculated score = material_xs % delay_nu_fission * flux - !$omp critical t % results(score_index, 1) % value = & t % results(score_index, 1) % value + score - !$omp critical end end if end if From 8158b7c685c42f32965d0e6e8ee4bb8e3ea1e31e Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Wed, 1 Apr 2015 21:11:44 -0400 Subject: [PATCH 04/38] fixed indentation error --- src/input_xml.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index f9cef299a..2a307eb0d 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2778,7 +2778,7 @@ contains ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG case ('diffusion') - call fatal_error("Diffusion score no longer supported for tallies, & + call fatal_error("Diffusion score no longer supported for tallies, & &please remove") case ('n1n') From 115cfc15ef91afb5113199375326d9943e51116d Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Thu, 2 Apr 2015 08:36:15 -0400 Subject: [PATCH 05/38] removed n_delayed_groups global variable --- src/ace.F90 | 8 -------- src/global.F90 | 1 - src/physics.F90 | 6 +++--- src/tally.F90 | 12 ++++++------ src/tracking.F90 | 5 +++-- 5 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index 3deceace5..d8ea5e879 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -650,14 +650,6 @@ contains &// " set in constants.F90 is " // trim(to_str(MAX_DELAYED_GROUPS))) end if - if (n_delayed_groups == 0) then - n_delayed_groups = NPCR - else if (n_delayed_groups /= NPCR) then - call fatal_error("Encountered nuclides with different numbers of " & - &// " delayed groups. Nuclides with " // trim(to_str(n_delayed_groups)) & - &// " and " // trim(to_str(NPCR)) // " delayed groups encountered.") - end if - nuc % n_precursor = NPCR allocate(nuc % nu_d_edist(NPCR)) diff --git a/src/global.F90 b/src/global.F90 index 007a772da..b26ebca50 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -71,7 +71,6 @@ module global integer :: n_nuclides_total ! Number of nuclide cross section tables integer :: n_sab_tables ! Number of S(a,b) thermal scattering tables integer :: n_listings ! Number of listings in cross_sections.xml - integer :: n_delayed_groups = 0 ! Number of delayed groups in cross section library ! Dictionaries to look up cross sections and listings type(DictCharInt) :: nuclide_dict diff --git a/src/physics.F90 b/src/physics.F90 index 2b728336e..ad142638f 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -1060,7 +1060,7 @@ contains integer, intent(in) :: i_reaction integer :: d ! delayed group index - integer :: nu_delay(n_delayed_groups) ! number of delayed neutrons born + integer :: nu_delay(MAX_DELAYED_GROUPS) ! number of delayed neutrons born integer :: i ! loop index integer :: nu ! actual number of neutrons produced integer :: ijk(3) ! indices in ufs mesh @@ -1122,7 +1122,7 @@ contains ! Initialize counter of delayed neutrons encountered for each delayed group ! to zero. - do d = 1, n_delayed_groups + do d = 1, MAX_DELAYED_GROUPS nu_delay(d) = 0 end do @@ -1165,7 +1165,7 @@ contains ! Store total and delayed weight banked for analog fission tallies p % n_bank = nu p % wgt_bank = nu/weight - do d = 1, n_delayed_groups + do d = 1, MAX_DELAYED_GROUPS p % n_delay_bank(d) = nu_delay(d) end do diff --git a/src/tally.F90 b/src/tally.F90 index a8e94027e..7bd5668cc 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -564,7 +564,7 @@ contains !$omp critical lc = 1 - do d = 1, n_delayed_groups + do d = 1, nuclides(p % event_nuclide) % n_precursor ! determine number of interpolation regions and energies NR = int(nuclides(p % event_nuclide) % nu_d_precursor_data(lc + 1)) @@ -625,7 +625,7 @@ contains ! ones are delayed. If a delayed neutron is encountered, add ! its contribution to the fission bank to the score. !$omp critical - do d = 1, n_delayed_groups + do d = 1, nuclides(p % event_nuclide) % n_precursor score = keff * p % wgt_bank / p % n_bank * p % n_delay_bank(d) if (t % find_filter(FILTER_DELAYGROUP) > 0) then @@ -1029,7 +1029,7 @@ contains !$omp critical lc = 1 - do d = 1, n_delayed_groups + do d = 1, nuclides(i_nuclide) % n_precursor ! determine number of interpolation regions and energies NR = int(nuclides(i_nuclide) % nu_d_precursor_data(lc + 1)) @@ -1198,7 +1198,7 @@ contains if (micro_xs(d_nuclide) % fission > ZERO) then lc = 1 - do d = 1, n_delayed_groups + do d = 1, nuclides(d_nuclide) % n_precursor ! determine number of interpolation regions and energies NR = int(nuclides(d_nuclide) % nu_d_precursor_data(lc + 1)) @@ -1457,7 +1457,7 @@ contains !$omp critical lc = 1 - do d = 1, n_delayed_groups + do d = 1, nuclides(i_nuclide) % n_precursor ! determine number of interpolation regions and energies NR = int(nuclides(i_nuclide) % nu_d_precursor_data(lc + 1)) @@ -1637,7 +1637,7 @@ contains if (micro_xs(d_nuclide) % fission > ZERO) then lc = 1 - do d = 1, n_delayed_groups + do d = 1, nuclides(d_nuclide) % n_precursor ! determine number of interpolation regions and energies NR = int(nuclides(d_nuclide) % nu_d_precursor_data(lc + 1)) diff --git a/src/tracking.F90 b/src/tracking.F90 index 772ce3dd3..e9fd2cf58 100644 --- a/src/tracking.F90 +++ b/src/tracking.F90 @@ -15,7 +15,8 @@ module tracking score_surface_current use track_output, only: initialize_particle_track, write_particle_track, & finalize_particle_track - + use constants, only: MAX_DELAYED_GROUPS + implicit none contains @@ -166,7 +167,7 @@ contains p % n_bank = 0 p % wgt_bank = ZERO - do d = 1, n_delayed_groups + do d = 1, MAX_DELAYED_GROUPS p % n_delay_bank = 0 end do From 430d1cf0c334573ed08baab92f33c6d8117f2ce7 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Thu, 2 Apr 2015 08:41:30 -0400 Subject: [PATCH 06/38] removed write_message from tally.F90 --- src/tally.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tally.F90 b/src/tally.F90 index 7bd5668cc..845c3a021 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -15,7 +15,6 @@ module tally use string, only: to_str use tally_header, only: TallyResult, TallyMapItem, TallyMapElement use fission, only: nu_total, nu_delayed - use output, only: write_message use interpolation, only: interpolate_tab1 #ifdef MPI From 19076823f117fe2a06065df91631880e74cec3dc Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Tue, 29 Sep 2015 14:47:55 -0400 Subject: [PATCH 07/38] fixed indentation errors in several files --- src/ace.F90 | 4 ++-- src/constants.F90 | 2 +- src/input_xml.F90 | 2 +- src/physics.F90 | 4 ++-- src/tally.F90 | 26 +++++++++++++------------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index 4db7cade9..b45c9f53e 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -646,8 +646,8 @@ contains ! of delayed groups if (NPCR > MAX_DELAYED_GROUPS) then call fatal_error("Encountered nuclide with " // trim(to_str(NPCR)) & - &// " delayed groups while the maximum number of delayed groups" & - &// " set in constants.F90 is " // trim(to_str(MAX_DELAYED_GROUPS))) + &// " delayed groups while the maximum number of delayed groups " & + &// "set in constants.F90 is " // trim(to_str(MAX_DELAYED_GROUPS))) end if nuc % n_precursor = NPCR diff --git a/src/constants.F90 b/src/constants.F90 index d00b94b34..897576bf1 100644 --- a/src/constants.F90 +++ b/src/constants.F90 @@ -313,7 +313,7 @@ module constants FILTER_ENERGYOUT = 8, & FILTER_DISTRIBCELL = 9, & FILTER_DELAYGROUP = 10 - + ! Mesh types integer, parameter :: & MESH_REGULAR = 1 diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 3ad934da1..fb2bde1a5 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2798,7 +2798,7 @@ contains if (t % find_filter(FILTER_DELAYGROUP) > 0) then call fatal_error("Cannot tally nu scatter with a & - &delaygroup energy filter.") + &delaygroup energy filter.") end if t % score_bins(j) = SCORE_NU_SCATTER diff --git a/src/physics.F90 b/src/physics.F90 index fbac1d4dd..d3aae9200 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -1259,8 +1259,8 @@ contains ! ==================================================================== ! PROMPT NEUTRON SAMPLED - ! set the delayed group for the particle born from fission to 0 - p % delayed_group = 0 + ! set the delayed group for the particle born from fission to 0 + p % delayed_group = 0 ! sample from prompt neutron energy distribution law = rxn % edist % law diff --git a/src/tally.F90 b/src/tally.F90 index f36c10ecd..9b89f8724 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -393,7 +393,7 @@ contains ! to get the proper score. score = keff * p % wgt_bank end if - + else if (i_nuclide > 0) then score = micro_xs(i_nuclide) % nu_fission * atom_density * flux @@ -422,25 +422,25 @@ contains ! nu-fission if (micro_xs(p % event_nuclide) % absorption > ZERO) then if (t % find_filter(FILTER_DELAYGROUP) > 0) then - + !$omp critical lc = 1 do d = 1, nuclides(p % event_nuclide) % n_precursor - + ! determine number of interpolation regions and energies NR = int(nuclides(p % event_nuclide) % nu_d_precursor_data(lc + 1)) NE = int(nuclides(p % event_nuclide) % nu_d_precursor_data(lc + 2 + 2*NR)) - + ! determine delayed neutron precursor yield for group d yield = interpolate_tab1(nuclides(p % event_nuclide) % nu_d_precursor_data( & lc+1:lc+2+2*NR+2*NE), p % E) - + ! advance pointer lc = lc + 2 + 2*NR + 2*NE + 1 - + score = p % absorb_wgt * yield * micro_xs(p % event_nuclide) % & delay_nu_fission / micro_xs(p % event_nuclide) % absorption - + t % results(score_index, d) % value = & t % results(score_index, d) % value + score end do @@ -448,10 +448,10 @@ contains else score = p % absorb_wgt * micro_xs(p % event_nuclide) % & delay_nu_fission / micro_xs(p % event_nuclide) % absorption - + t % results(score_index, 1) % value = & t % results(score_index, 1) % value + score - end if + end if else score = ZERO end if @@ -477,7 +477,7 @@ contains !$omp end critical cycle SCORE_LOOP end if - + else if (i_nuclide > 0) then score = micro_xs(i_nuclide) % nu_fission * atom_density * flux @@ -485,7 +485,7 @@ contains score = material_xs % nu_fission * flux end if end if - + case (SCORE_KAPPA_FISSION) if (t % estimator == ESTIMATOR_ANALOG) then if (survival_biasing) then @@ -986,7 +986,7 @@ contains ! check if outgoing energy is within specified range on filter if (E_out < t % filters(i) % real_bins(1) .or. & - E_out > t % filters(i) % real_bins(n)) cycle + E_out > t % filters(i) % real_bins(n)) cycle ! change outgoing energy bin matching_bins(i) = binary_search(t % filters(i) % real_bins, n, E_out) @@ -997,7 +997,7 @@ contains ! Add score to tally !$omp atomic t % results(i_score, i_filter) % value = & - t % results(i_score, i_filter) % value + score + t % results(i_score, i_filter) % value + score end if end do From 409360dd75aa25131a87a20570ea51de6f0cd282 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Tue, 29 Sep 2015 15:04:05 -0400 Subject: [PATCH 08/38] fixed line continuation errors in tally.F90 --- src/tally.F90 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tally.F90 b/src/tally.F90 index 9b89f8724..b2066319b 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -433,24 +433,24 @@ contains ! determine delayed neutron precursor yield for group d yield = interpolate_tab1(nuclides(p % event_nuclide) % nu_d_precursor_data( & - lc+1:lc+2+2*NR+2*NE), p % E) + lc+1:lc+2+2*NR+2*NE), p % E) ! advance pointer lc = lc + 2 + 2*NR + 2*NE + 1 score = p % absorb_wgt * yield * micro_xs(p % event_nuclide) % & - delay_nu_fission / micro_xs(p % event_nuclide) % absorption + delay_nu_fission / micro_xs(p % event_nuclide) % absorption t % results(score_index, d) % value = & - t % results(score_index, d) % value + score + t % results(score_index, d) % value + score end do !$omp end critical else score = p % absorb_wgt * micro_xs(p % event_nuclide) % & - delay_nu_fission / micro_xs(p % event_nuclide) % absorption + delay_nu_fission / micro_xs(p % event_nuclide) % absorption t % results(score_index, 1) % value = & - t % results(score_index, 1) % value + score + t % results(score_index, 1) % value + score end if else score = ZERO @@ -468,10 +468,10 @@ contains if (t % find_filter(FILTER_DELAYGROUP) > 0) then t % results(score_index, d) % value = & - t % results(score_index, d) % value + score + t % results(score_index, d) % value + score else t % results(score_index, 1) % value = & - t % results(score_index, 1) % value + score + t % results(score_index, 1) % value + score end if end do !$omp end critical From 42ea3ab706b5f8a6c27ac37268d180dc7e5dc5af Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Thu, 1 Oct 2015 07:42:19 -0400 Subject: [PATCH 09/38] changed delay to delayed to be consistent in describing delayed neutrons --- src/ace.F90 | 25 ++++++------ src/ace_header.F90 | 52 ++++++++++++------------- src/constants.F90 | 62 +++++++++++++++--------------- src/cross_section.F90 | 32 ++++++++-------- src/global.F90 | 6 +-- src/initialize.F90 | 12 +++--- src/input_xml.F90 | 84 ++++++++++++++++++++--------------------- src/output.F90 | 62 +++++++++++++++--------------- src/particle_header.F90 | 6 +-- src/physics.F90 | 26 ++++++------- src/tally.F90 | 28 ++++++++------ src/tracking.F90 | 2 +- 12 files changed, 200 insertions(+), 197 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index b45c9f53e..c5ed22665 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -375,10 +375,7 @@ contains if (nuc % fissionable .and. .not. data_0K) then call generate_nu_fission(nuc) - end if - - if (nuc % fissionable .and. .not. data_0K) then - call generate_delay_nu_fission(nuc) + call generate_delayed_nu_fission(nuc) end if case (ACE_THERMAL) @@ -465,7 +462,7 @@ contains allocate(nuc % fission(NE)) allocate(nuc % nu_fission(NE)) allocate(nuc % absorption(NE)) - allocate(nuc % delay_nu_fission(NE)) + allocate(nuc % delayed_nu_fission(NE)) ! initialize cross sections nuc % total = ZERO @@ -473,7 +470,7 @@ contains nuc % fission = ZERO nuc % nu_fission = ZERO nuc % absorption = ZERO - nuc % delay_nu_fission = ZERO + nuc % delayed_nu_fission = ZERO ! Read data from XSS -- only the energy grid, elastic scattering and heating ! cross section values are actually read from here. The total and absorption @@ -1407,26 +1404,26 @@ contains ! function does not need to be called during cross section lookups. !=============================================================================== - subroutine generate_delay_nu_fission(nuc) + subroutine generate_delayed_nu_fission(nuc) type(Nuclide), pointer :: nuc - integer :: i ! index on nuclide energy grid - real(8) :: E ! energy - real(8) :: nu_delay ! # of neutrons per fission + integer :: i ! index on nuclide energy grid + real(8) :: E ! energy + real(8) :: nu_d ! # of neutrons per fission do i = 1, nuc % n_grid ! determine energy E = nuc % energy(i) ! determine total nu at given energy - nu_delay = nu_delayed(nuc, E) + nu_d = nu_delayed(nuc, E) - ! determine delay-nu-fission microscopic cross section - nuc % delay_nu_fission(i) = nu_delay * nuc % fission(i) + ! determine delayed-nu-fission microscopic cross section + nuc % delayed_nu_fission(i) = nu_d * nuc % fission(i) end do - end subroutine generate_delay_nu_fission + end subroutine generate_delayed_nu_fission !=============================================================================== ! READ_THERMAL_DATA reads elastic and inelastic cross sections and corresponding diff --git a/src/ace_header.F90 b/src/ace_header.F90 index cc2ee8cc3..13681985d 100644 --- a/src/ace_header.F90 +++ b/src/ace_header.F90 @@ -107,13 +107,13 @@ module ace_header real(8), allocatable :: energy(:) ! energy values corresponding to xs ! Microscopic cross sections - real(8), allocatable :: total(:) ! total cross section - real(8), allocatable :: elastic(:) ! elastic scattering - real(8), allocatable :: fission(:) ! fission - real(8), allocatable :: nu_fission(:) ! neutron production - real(8), allocatable :: absorption(:) ! absorption (MT > 100) - real(8), allocatable :: heating(:) ! heating - real(8), allocatable :: delay_nu_fission(:) ! delayed neutron production + real(8), allocatable :: total(:) ! total cross section + real(8), allocatable :: elastic(:) ! elastic scattering + real(8), allocatable :: fission(:) ! fission + real(8), allocatable :: nu_fission(:) ! neutron production + real(8), allocatable :: absorption(:) ! absorption (MT > 100) + real(8), allocatable :: heating(:) ! heating + real(8), allocatable :: delayed_nu_fission(:) ! delayed neutron production ! Resonance scattering info logical :: resonant = .false. ! resonant scatterer? @@ -257,17 +257,17 @@ module ace_header !=============================================================================== type NuclideMicroXS - integer :: index_grid ! index on nuclide energy grid - integer :: index_temp ! temperature index for nuclide - real(8) :: last_E = ZERO ! last evaluated energy - real(8) :: interp_factor ! interpolation factor on nuc. energy grid - real(8) :: total ! microscropic total xs - real(8) :: elastic ! microscopic elastic scattering xs - real(8) :: absorption ! microscopic absorption xs - real(8) :: fission ! microscopic fission xs - real(8) :: nu_fission ! microscopic production xs - real(8) :: kappa_fission ! microscopic energy-released from fission - real(8) :: delay_nu_fission ! microscopic delayed production xs + integer :: index_grid ! index on nuclide energy grid + integer :: index_temp ! temperature index for nuclide + real(8) :: last_E = ZERO ! last evaluated energy + real(8) :: interp_factor ! interpolation factor on nuc. energy grid + real(8) :: total ! microscropic total xs + real(8) :: elastic ! microscopic elastic scattering xs + real(8) :: absorption ! microscopic absorption xs + real(8) :: fission ! microscopic fission xs + real(8) :: nu_fission ! microscopic production xs + real(8) :: kappa_fission ! microscopic energy-released from fission + real(8) :: delayed_nu_fission ! microscopic delayed production xs ! Information for S(a,b) use integer :: index_sab ! index in sab_tables (zero means no table) @@ -285,13 +285,13 @@ module ace_header !=============================================================================== type MaterialMacroXS - real(8) :: total ! macroscopic total xs - real(8) :: elastic ! macroscopic elastic scattering xs - real(8) :: absorption ! macroscopic absorption xs - real(8) :: fission ! macroscopic fission xs - real(8) :: nu_fission ! macroscopic production xs - real(8) :: kappa_fission ! macroscopic energy-released from fission - real(8) :: delay_nu_fission ! macroscopic delayed production xs + real(8) :: total ! macroscopic total xs + real(8) :: elastic ! macroscopic elastic scattering xs + real(8) :: absorption ! macroscopic absorption xs + real(8) :: fission ! macroscopic fission xs + real(8) :: nu_fission ! macroscopic production xs + real(8) :: kappa_fission ! macroscopic energy-released from fission + real(8) :: delayed_nu_fission ! macroscopic delayed production xs end type MaterialMacroXS contains @@ -378,7 +378,7 @@ module ace_header if (allocated(this % energy)) & deallocate(this % energy, this % total, this % elastic, & & this % fission, this % nu_fission, this % absorption, & - this % delay_nu_fission) + this % delayed_nu_fission) if (allocated(this % energy_0K)) & deallocate(this % energy_0K) diff --git a/src/constants.F90 b/src/constants.F90 index 897576bf1..0f9bd691d 100644 --- a/src/constants.F90 +++ b/src/constants.F90 @@ -258,27 +258,27 @@ module constants ! Tally score type integer, parameter :: N_SCORE_TYPES = 21 integer, parameter :: & - SCORE_FLUX = -1, & ! flux - SCORE_TOTAL = -2, & ! total reaction rate - SCORE_SCATTER = -3, & ! scattering rate - SCORE_NU_SCATTER = -4, & ! scattering production rate - SCORE_SCATTER_N = -5, & ! arbitrary scattering moment - SCORE_SCATTER_PN = -6, & ! system for scoring 0th through nth moment - SCORE_NU_SCATTER_N = -7, & ! arbitrary nu-scattering moment - SCORE_NU_SCATTER_PN = -8, & ! system for scoring 0th through nth nu-scatter moment - SCORE_TRANSPORT = -9, & ! transport reaction rate - SCORE_N_1N = -10, & ! (n,1n) rate - SCORE_ABSORPTION = -11, & ! absorption rate - SCORE_FISSION = -12, & ! fission rate - SCORE_NU_FISSION = -13, & ! neutron production rate - SCORE_KAPPA_FISSION = -14, & ! fission energy production rate - SCORE_CURRENT = -15, & ! partial current - SCORE_FLUX_YN = -16, & ! angular moment of flux - SCORE_TOTAL_YN = -17, & ! angular moment of total reaction rate - SCORE_SCATTER_YN = -18, & ! angular flux-weighted scattering moment (0:N) - SCORE_NU_SCATTER_YN = -19, & ! angular flux-weighted nu-scattering moment (0:N) - SCORE_EVENTS = -20, & ! number of events - SCORE_DELAY_NU_FISSION = -21 ! delayed neutron production rate + SCORE_FLUX = -1, & ! flux + SCORE_TOTAL = -2, & ! total reaction rate + SCORE_SCATTER = -3, & ! scattering rate + SCORE_NU_SCATTER = -4, & ! scattering production rate + SCORE_SCATTER_N = -5, & ! arbitrary scattering moment + SCORE_SCATTER_PN = -6, & ! system for scoring 0th through nth moment + SCORE_NU_SCATTER_N = -7, & ! arbitrary nu-scattering moment + SCORE_NU_SCATTER_PN = -8, & ! system for scoring 0th through nth nu-scatter moment + SCORE_TRANSPORT = -9, & ! transport reaction rate + SCORE_N_1N = -10, & ! (n,1n) rate + SCORE_ABSORPTION = -11, & ! absorption rate + SCORE_FISSION = -12, & ! fission rate + SCORE_NU_FISSION = -13, & ! neutron production rate + SCORE_KAPPA_FISSION = -14, & ! fission energy production rate + SCORE_CURRENT = -15, & ! partial current + SCORE_FLUX_YN = -16, & ! angular moment of flux + SCORE_TOTAL_YN = -17, & ! angular moment of total reaction rate + SCORE_SCATTER_YN = -18, & ! angular flux-weighted scattering moment (0:N) + SCORE_NU_SCATTER_YN = -19, & ! angular flux-weighted nu-scattering moment (0:N) + SCORE_EVENTS = -20, & ! number of events + SCORE_DELAYED_NU_FISSION = -21 ! delayed neutron production rate ! Maximum scattering order supported integer, parameter :: MAX_ANG_ORDER = 10 @@ -303,16 +303,16 @@ module constants ! Tally filter and map types integer, parameter :: N_FILTER_TYPES = 10 integer, parameter :: & - FILTER_UNIVERSE = 1, & - FILTER_MATERIAL = 2, & - FILTER_CELL = 3, & - FILTER_CELLBORN = 4, & - FILTER_SURFACE = 5, & - FILTER_MESH = 6, & - FILTER_ENERGYIN = 7, & - FILTER_ENERGYOUT = 8, & - FILTER_DISTRIBCELL = 9, & - FILTER_DELAYGROUP = 10 + FILTER_UNIVERSE = 1, & + FILTER_MATERIAL = 2, & + FILTER_CELL = 3, & + FILTER_CELLBORN = 4, & + FILTER_SURFACE = 5, & + FILTER_MESH = 6, & + FILTER_ENERGYIN = 7, & + FILTER_ENERGYOUT = 8, & + FILTER_DISTRIBCELL = 9, & + FILTER_DELAYEDGROUP = 10 ! Mesh types integer, parameter :: & diff --git a/src/cross_section.F90 b/src/cross_section.F90 index 67b3dfada..e64362f03 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -38,13 +38,13 @@ contains type(Material), pointer :: mat ! current material ! Set all material macroscopic cross sections to zero - material_xs % total = ZERO - material_xs % elastic = ZERO - material_xs % absorption = ZERO - material_xs % fission = ZERO - material_xs % nu_fission = ZERO - material_xs % kappa_fission = ZERO - material_xs % delay_nu_fission = ZERO + material_xs % total = ZERO + material_xs % elastic = ZERO + material_xs % absorption = ZERO + material_xs % fission = ZERO + material_xs % nu_fission = ZERO + material_xs % kappa_fission = ZERO + material_xs % delayed_nu_fission = ZERO ! Exit subroutine if material is void if (p % material == MATERIAL_VOID) return @@ -130,9 +130,10 @@ contains material_xs % kappa_fission = material_xs % kappa_fission + & atom_density * micro_xs(i_nuclide) % kappa_fission - ! Add contributions to material macroscopic delay-nu-fission cross section - material_xs % delay_nu_fission = material_xs % delay_nu_fission + & - atom_density * micro_xs(i_nuclide) % delay_nu_fission + ! Add contributions to material macroscopic delayed-nu-fission cross + ! section + material_xs % delayed_nu_fission = material_xs % delayed_nu_fission + & + atom_density * micro_xs(i_nuclide) % delayed_nu_fission end do end subroutine calculate_xs @@ -221,7 +222,7 @@ contains micro_xs(i_nuclide) % fission = ZERO micro_xs(i_nuclide) % nu_fission = ZERO micro_xs(i_nuclide) % kappa_fission = ZERO - micro_xs(i_nuclide) % delay_nu_fission = ZERO + micro_xs(i_nuclide) % delayed_nu_fission = ZERO ! Calculate microscopic nuclide total cross section micro_xs(i_nuclide) % total = (ONE - f) * nuc % total(i_grid) & @@ -252,8 +253,9 @@ contains micro_xs(i_nuclide) % fission ! Calculate microscopic nuclide delayed nu-fission cross section - micro_xs(i_nuclide) % delay_nu_fission = (ONE - f) * nuc % delay_nu_fission( & - i_grid) + f * nuc % delay_nu_fission(i_grid+1) + micro_xs(i_nuclide) % delayed_nu_fission = (ONE - f) * & + nuc % delayed_nu_fission(i_grid) + f * & + nuc % delayed_nu_fission(i_grid+1) end if @@ -520,11 +522,11 @@ contains micro_xs(i_nuclide) % fission = fission micro_xs(i_nuclide) % total = elastic + inelastic + capture + fission - ! Determine nu-fission and delay nu-fission cross section + ! Determine nu-fission and delayed nu-fission cross section if (nuc % fissionable) then micro_xs(i_nuclide) % nu_fission = nu_total(nuc, E) * & micro_xs(i_nuclide) % fission - micro_xs(i_nuclide) % delay_nu_fission = nu_delayed(nuc, E) * & + micro_xs(i_nuclide) % delayed_nu_fission = nu_delayed(nuc, E) * & micro_xs(i_nuclide) % fission end if diff --git a/src/global.F90 b/src/global.F90 index f2da51a13..398b72e14 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -69,9 +69,9 @@ module global type(NuclideMicroXS), allocatable :: micro_xs(:) ! Cache for each nuclide type(MaterialMacroXS) :: material_xs ! Cache for current material - integer :: n_nuclides_total ! Number of nuclide cross section tables - integer :: n_sab_tables ! Number of S(a,b) thermal scattering tables - integer :: n_listings ! Number of listings in cross_sections.xml + integer :: n_nuclides_total ! Number of nuclide cross section tables + integer :: n_sab_tables ! Number of S(a,b) thermal scattering tables + integer :: n_listings ! Number of listings in cross_sections.xml ! Dictionaries to look up cross sections and listings type(DictCharInt) :: nuclide_dict diff --git a/src/initialize.F90 b/src/initialize.F90 index 4d119c2df..e0d391c0c 100644 --- a/src/initialize.F90 +++ b/src/initialize.F90 @@ -183,22 +183,22 @@ contains subroutine initialize_mpi() - integer :: bank_blocks(5) ! Count for each datatype + integer :: bank_blocks(5) ! Count for each datatype #ifdef MPIF08 type(MPI_Datatype) :: bank_types(5) type(MPI_Datatype) :: result_types(1) type(MPI_Datatype) :: temp_type #else - integer :: bank_types(5) ! Datatypes + integer :: bank_types(5) ! Datatypes integer :: result_types(1) ! Datatypes - integer :: temp_type ! temporary derived type + integer :: temp_type ! temporary derived type #endif - integer(MPI_ADDRESS_KIND) :: bank_disp(5) ! Displacements + integer(MPI_ADDRESS_KIND) :: bank_disp(5) ! Displacements integer :: result_blocks(1) ! Count for each datatype integer(MPI_ADDRESS_KIND) :: result_disp(1) ! Displacements integer(MPI_ADDRESS_KIND) :: result_base_disp ! Base displacement - integer(MPI_ADDRESS_KIND) :: lower_bound ! Lower bound for TallyResult - integer(MPI_ADDRESS_KIND) :: extent ! Extent for TallyResult + integer(MPI_ADDRESS_KIND) :: lower_bound ! Lower bound for TallyResult + integer(MPI_ADDRESS_KIND) :: extent ! Extent for TallyResult type(Bank) :: b type(TallyResult) :: tr diff --git a/src/input_xml.F90 b/src/input_xml.F90 index fb2bde1a5..4e037ae1d 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2490,9 +2490,9 @@ contains ! Set to analog estimator t % estimator = ESTIMATOR_ANALOG - case ('delaygroup') + case ('delayedgroup') ! Set type of filter - t % filters(j) % type = FILTER_DELAYGROUP + t % filters(j) % type = FILTER_DELAYEDGROUP ! Set number of bins t % filters(j) % n_bins = MAX_DELAYED_GROUPS @@ -2732,9 +2732,9 @@ contains &filter.") end if - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally flux with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if case ('flux-yn') @@ -2749,9 +2749,9 @@ contains &filter.") end if - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally flux with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % score_bins(j : j + n_bins - 1) = SCORE_FLUX_YN @@ -2765,9 +2765,9 @@ contains &outgoing energy filter.") end if - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally total reaction rate with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if case ('total-yn') @@ -2776,9 +2776,9 @@ contains &outgoing energy filter.") end if - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally total reaction rate with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % score_bins(j : j + n_bins - 1) = SCORE_TOTAL_YN @@ -2787,18 +2787,18 @@ contains case ('scatter') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally scatter with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % score_bins(j) = SCORE_SCATTER case ('nu-scatter') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally nu scatter with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % score_bins(j) = SCORE_NU_SCATTER @@ -2807,9 +2807,9 @@ contains t % estimator = ESTIMATOR_ANALOG case ('scatter-n') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally scatter n with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if if (n_order == 0) then @@ -2823,9 +2823,9 @@ contains case ('nu-scatter-n') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally nu scatter n with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if ! Set tally estimator to analog @@ -2839,9 +2839,9 @@ contains case ('scatter-pn') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally scatter pn with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % estimator = ESTIMATOR_ANALOG @@ -2852,9 +2852,9 @@ contains case ('nu-scatter-pn') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally nu scatter pn with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % estimator = ESTIMATOR_ANALOG @@ -2865,9 +2865,9 @@ contains case ('scatter-yn') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally scatter yn with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % estimator = ESTIMATOR_ANALOG @@ -2878,9 +2878,9 @@ contains case ('nu-scatter-yn') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally nu scatter yn with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % estimator = ESTIMATOR_ANALOG @@ -2891,9 +2891,9 @@ contains case('transport') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally transport reaction rate with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % score_bins(j) = SCORE_TRANSPORT @@ -2905,9 +2905,9 @@ contains &please remove") case ('n1n') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally n1n with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % score_bins(j) = SCORE_N_1N @@ -2925,9 +2925,9 @@ contains case ('absorption') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally absorption rate with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % score_bins(j) = SCORE_ABSORPTION @@ -2937,9 +2937,9 @@ contains end if case ('fission') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally fission rate with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % score_bins(j) = SCORE_FISSION @@ -2949,9 +2949,9 @@ contains end if case ('nu-fission') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally nu fission rate with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % score_bins(j) = SCORE_NU_FISSION @@ -2959,26 +2959,26 @@ contains ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG end if - case ('delay-nu-fission') + case ('delayed-nu-fission') - t % score_bins(j) = SCORE_DELAY_NU_FISSION + t % score_bins(j) = SCORE_DELAYED_NU_FISSION if (t % find_filter(FILTER_ENERGYOUT) > 0) then ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG end if case ('kappa-fission') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally kappa fission with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % score_bins(j) = SCORE_KAPPA_FISSION case ('current') - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally current with a & - &delaygroup energy filter.") + &delayedgroup energy filter.") end if t % score_bins(j) = SCORE_CURRENT diff --git a/src/output.F90 b/src/output.F90 index e50c10dc6..d4b546a84 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -952,38 +952,38 @@ contains if (n_tallies == 0) return ! Initialize names for tally filter types - filter_name(FILTER_UNIVERSE) = "Universe" - filter_name(FILTER_MATERIAL) = "Material" - filter_name(FILTER_DISTRIBCELL) = "Distributed Cell" - filter_name(FILTER_CELL) = "Cell" - filter_name(FILTER_CELLBORN) = "Birth Cell" - filter_name(FILTER_SURFACE) = "Surface" - filter_name(FILTER_MESH) = "Mesh" - filter_name(FILTER_ENERGYIN) = "Incoming Energy" - filter_name(FILTER_ENERGYOUT) = "Outgoing Energy" - filter_name(FILTER_DELAYGROUP) = "Delay Group" + filter_name(FILTER_UNIVERSE) = "Universe" + filter_name(FILTER_MATERIAL) = "Material" + filter_name(FILTER_DISTRIBCELL) = "Distributed Cell" + filter_name(FILTER_CELL) = "Cell" + filter_name(FILTER_CELLBORN) = "Birth Cell" + filter_name(FILTER_SURFACE) = "Surface" + filter_name(FILTER_MESH) = "Mesh" + filter_name(FILTER_ENERGYIN) = "Incoming Energy" + filter_name(FILTER_ENERGYOUT) = "Outgoing Energy" + filter_name(FILTER_DELAYEDGROUP) = "Delayed Group" ! Initialize names for scores - score_names(abs(SCORE_FLUX)) = "Flux" - score_names(abs(SCORE_TOTAL)) = "Total Reaction Rate" - score_names(abs(SCORE_SCATTER)) = "Scattering Rate" - score_names(abs(SCORE_NU_SCATTER)) = "Scattering Production Rate" - score_names(abs(SCORE_TRANSPORT)) = "Transport Rate" - score_names(abs(SCORE_N_1N)) = "(n,1n) Rate" - score_names(abs(SCORE_ABSORPTION)) = "Absorption Rate" - score_names(abs(SCORE_FISSION)) = "Fission Rate" - score_names(abs(SCORE_NU_FISSION)) = "Nu-Fission Rate" - score_names(abs(SCORE_KAPPA_FISSION)) = "Kappa-Fission Rate" - score_names(abs(SCORE_EVENTS)) = "Events" - score_names(abs(SCORE_FLUX_YN)) = "Flux Moment" - score_names(abs(SCORE_TOTAL_YN)) = "Total Reaction Rate Moment" - score_names(abs(SCORE_SCATTER_N)) = "Scattering Rate Moment" - score_names(abs(SCORE_SCATTER_PN)) = "Scattering Rate Moment" - score_names(abs(SCORE_SCATTER_YN)) = "Scattering Rate Moment" - score_names(abs(SCORE_NU_SCATTER_N)) = "Scattering Prod. Rate Moment" - score_names(abs(SCORE_NU_SCATTER_PN)) = "Scattering Prod. Rate Moment" - score_names(abs(SCORE_NU_SCATTER_YN)) = "Scattering Prod. Rate Moment" - score_names(abs(SCORE_DELAY_NU_FISSION)) = "Delay-Nu-fission Rate" + score_names(abs(SCORE_FLUX)) = "Flux" + score_names(abs(SCORE_TOTAL)) = "Total Reaction Rate" + score_names(abs(SCORE_SCATTER)) = "Scattering Rate" + score_names(abs(SCORE_NU_SCATTER)) = "Scattering Production Rate" + score_names(abs(SCORE_TRANSPORT)) = "Transport Rate" + score_names(abs(SCORE_N_1N)) = "(n,1n) Rate" + score_names(abs(SCORE_ABSORPTION)) = "Absorption Rate" + score_names(abs(SCORE_FISSION)) = "Fission Rate" + score_names(abs(SCORE_NU_FISSION)) = "Nu-Fission Rate" + score_names(abs(SCORE_KAPPA_FISSION)) = "Kappa-Fission Rate" + score_names(abs(SCORE_EVENTS)) = "Events" + score_names(abs(SCORE_FLUX_YN)) = "Flux Moment" + score_names(abs(SCORE_TOTAL_YN)) = "Total Reaction Rate Moment" + score_names(abs(SCORE_SCATTER_N)) = "Scattering Rate Moment" + score_names(abs(SCORE_SCATTER_PN)) = "Scattering Rate Moment" + score_names(abs(SCORE_SCATTER_YN)) = "Scattering Rate Moment" + score_names(abs(SCORE_NU_SCATTER_N)) = "Scattering Prod. Rate Moment" + score_names(abs(SCORE_NU_SCATTER_PN)) = "Scattering Prod. Rate Moment" + score_names(abs(SCORE_NU_SCATTER_YN)) = "Scattering Prod. Rate Moment" + score_names(abs(SCORE_DELAYED_NU_FISSION)) = "Delayed-Nu-fission Rate" ! Create filename for tally output filename = trim(path_output) // "tallies.out" @@ -1404,7 +1404,7 @@ contains E0 = t % filters(i_filter) % real_bins(bin) E1 = t % filters(i_filter) % real_bins(bin + 1) label = "[" // trim(to_str(E0)) // ", " // trim(to_str(E1)) // ")" - case (FILTER_DELAYGROUP) + case (FILTER_DELAYEDGROUP) i = t % filters(i_filter) % int_bins(bin) label = to_str(i) end select diff --git a/src/particle_header.F90 b/src/particle_header.F90 index a729fdac1..477031757 100644 --- a/src/particle_header.F90 +++ b/src/particle_header.F90 @@ -70,8 +70,8 @@ module particle_header ! Post-collision physical data integer :: n_bank ! number of fission sites banked real(8) :: wgt_bank ! weight of fission sites banked - integer :: n_delay_bank(MAX_DELAYED_GROUPS) ! number of delayed fission - ! sites banked + integer :: n_delayed_bank(MAX_DELAYED_GROUPS) ! number of delayed fission + ! sites banked ! Indices for various arrays integer :: surface ! index for surface particle is on @@ -130,7 +130,7 @@ contains this % delayed_group = 0 do d = 1, MAX_DELAYED_GROUPS - this % n_delay_bank(d) = 0 + this % n_delayed_bank(d) = 0 end do ! Set up base level coordinates diff --git a/src/physics.F90 b/src/physics.F90 index d3aae9200..da46be851 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -1051,16 +1051,16 @@ contains integer, intent(in) :: i_nuclide integer, intent(in) :: i_reaction - integer :: d ! delayed group index - integer :: nu_delay(MAX_DELAYED_GROUPS) ! number of delayed neutrons born - integer :: i ! loop index - integer :: nu ! actual number of neutrons produced - integer :: ijk(3) ! indices in ufs mesh - real(8) :: nu_t ! total nu - real(8) :: mu ! fission neutron angular cosine - real(8) :: phi ! fission neutron azimuthal angle - real(8) :: weight ! weight adjustment for ufs method - logical :: in_mesh ! source site in ufs mesh? + integer :: d ! delayed group index + integer :: nu_delayed(MAX_DELAYED_GROUPS) ! number of delayed neutrons born + integer :: i ! loop index + integer :: nu ! actual number of neutrons produced + integer :: ijk(3) ! indices in ufs mesh + real(8) :: nu_t ! total nu + real(8) :: mu ! fission neutron angular cosine + real(8) :: phi ! fission neutron azimuthal angle + real(8) :: weight ! weight adjustment for ufs method + logical :: in_mesh ! source site in ufs mesh? type(Nuclide), pointer :: nuc type(Reaction), pointer :: rxn @@ -1114,7 +1114,7 @@ contains ! Initialize counter of delayed neutrons encountered for each delayed group ! to zero. do d = 1, MAX_DELAYED_GROUPS - nu_delay(d) = 0 + nu_delayed(d) = 0 end do p % fission = .true. ! Fission neutrons will be banked @@ -1146,7 +1146,7 @@ contains ! Increment the number of neutrons born delayed if (p % delayed_group > 0) then - nu_delay(p % delayed_group) = nu_delay(p % delayed_group) + 1 + nu_delayed(p % delayed_group) = nu_delayed(p % delayed_group) + 1 end if end do @@ -1157,7 +1157,7 @@ contains p % n_bank = nu p % wgt_bank = nu/weight do d = 1, MAX_DELAYED_GROUPS - p % n_delay_bank(d) = nu_delay(d) + p % n_delayed_bank(d) = nu_delayed(d) end do end subroutine create_fission_sites diff --git a/src/tally.F90 b/src/tally.F90 index b2066319b..d1dc95f30 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -403,7 +403,7 @@ contains end if - case (SCORE_DELAY_NU_FISSION) + case (SCORE_DELAYED_NU_FISSION) if (t % estimator == ESTIMATOR_ANALOG) then if (survival_biasing .or. p % fission) then if (t % find_filter(FILTER_ENERGYOUT) > 0) then @@ -421,25 +421,28 @@ contains ! calculate fraction of absorptions that would have resulted in ! nu-fission if (micro_xs(p % event_nuclide) % absorption > ZERO) then - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then !$omp critical lc = 1 do d = 1, nuclides(p % event_nuclide) % n_precursor ! determine number of interpolation regions and energies - NR = int(nuclides(p % event_nuclide) % nu_d_precursor_data(lc + 1)) - NE = int(nuclides(p % event_nuclide) % nu_d_precursor_data(lc + 2 + 2*NR)) + NR = int(nuclides(p % event_nuclide) & + % nu_d_precursor_data(lc + 1)) + NE = int(nuclides(p % event_nuclide) & + % nu_d_precursor_data(lc + 2 + 2*NR)) ! determine delayed neutron precursor yield for group d - yield = interpolate_tab1(nuclides(p % event_nuclide) % nu_d_precursor_data( & - lc+1:lc+2+2*NR+2*NE), p % E) + yield = interpolate_tab1(nuclides(p % event_nuclide) & + % nu_d_precursor_data(lc+1:lc+2+2*NR+2*NE), p % E) ! advance pointer lc = lc + 2 + 2*NR + 2*NE + 1 - score = p % absorb_wgt * yield * micro_xs(p % event_nuclide) % & - delay_nu_fission / micro_xs(p % event_nuclide) % absorption + score = p % absorb_wgt * yield * micro_xs(p % event_nuclide) & + % delayed_nu_fission / micro_xs(p % event_nuclide) & + % absorption t % results(score_index, d) % value = & t % results(score_index, d) % value + score @@ -447,7 +450,8 @@ contains !$omp end critical else score = p % absorb_wgt * micro_xs(p % event_nuclide) % & - delay_nu_fission / micro_xs(p % event_nuclide) % absorption + delayed_nu_fission / micro_xs(p % event_nuclide) % & + absorption t % results(score_index, 1) % value = & t % results(score_index, 1) % value + score @@ -464,9 +468,9 @@ contains ! its contribution to the fission bank to the score. !$omp critical do d = 1, nuclides(p % event_nuclide) % n_precursor - score = keff * p % wgt_bank / p % n_bank * p % n_delay_bank(d) + score = keff * p % wgt_bank / p % n_bank * p % n_delayed_bank(d) - if (t % find_filter(FILTER_DELAYGROUP) > 0) then + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then t % results(score_index, d) % value = & t % results(score_index, d) % value + score else @@ -1605,7 +1609,7 @@ contains n + 1, p % E) end if - case (FILTER_DELAYGROUP) + case (FILTER_DELAYEDGROUP) if (survival_biasing .and. t % find_filter(FILTER_ENERGYOUT) <= 0) then matching_bins(i) = 1 diff --git a/src/tracking.F90 b/src/tracking.F90 index cc43307ea..e49b554ce 100644 --- a/src/tracking.F90 +++ b/src/tracking.F90 @@ -167,7 +167,7 @@ contains p % wgt_bank = ZERO do d = 1, MAX_DELAYED_GROUPS - p % n_delay_bank = 0 + p % n_delayed_bank = 0 end do ! Reset fission logical From 82c9fce896dc4ad72db24d37be4bb5932fff818c Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Sat, 3 Oct 2015 15:25:33 -0400 Subject: [PATCH 10/38] fixed errors in tallying delayed nu fission --- src/ace.F90 | 3 +- src/ace_header.F90 | 5 +- src/cross_section.F90 | 20 ++++++-- src/fission.F90 | 59 +++++++++++++++++++++- src/output.F90 | 2 +- src/state_point.F90 | 2 + src/summary.F90 | 2 + src/tally.F90 | 111 +++++++++++++++++++++++++----------------- 8 files changed, 149 insertions(+), 55 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index c5ed22665..91653195b 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -684,6 +684,7 @@ contains else nuc % nu_d_type = NU_NONE + nuc % n_precursor = ZERO end if end subroutine read_nu_data @@ -1399,7 +1400,7 @@ contains end subroutine generate_nu_fission !=============================================================================== -! GENERATE_DELAYED_NU_FISSION precalculates the microscopic delay-nu-fission +! GENERATE_DELAYED_NU_FISSION precalculates the microscopic delayed-nu-fission ! cross section for a given nuclide. This is done so that the nu_delayed ! function does not need to be called during cross section lookups. !=============================================================================== diff --git a/src/ace_header.F90 b/src/ace_header.F90 index 13681985d..613cc44a4 100644 --- a/src/ace_header.F90 +++ b/src/ace_header.F90 @@ -1,6 +1,6 @@ module ace_header - use constants, only: MAX_FILE_LEN, ZERO + use constants, only: MAX_FILE_LEN, ZERO, MAX_DELAYED_GROUPS use endf_header, only: Tab1 use list_header, only: ListInt @@ -291,7 +291,8 @@ module ace_header real(8) :: fission ! macroscopic fission xs real(8) :: nu_fission ! macroscopic production xs real(8) :: kappa_fission ! macroscopic energy-released from fission - real(8) :: delayed_nu_fission ! macroscopic delayed production xs + real(8) :: delayed_nu_fission(MAX_DELAYED_GROUPS) ! macroscopic delayed + ! production xs end type MaterialMacroXS contains diff --git a/src/cross_section.F90 b/src/cross_section.F90 index e64362f03..463ef6e57 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -4,7 +4,7 @@ module cross_section use constants use energy_grid, only: grid_method, log_spacing use error, only: fatal_error - use fission, only: nu_total, nu_delayed + use fission, only: nu_total, nu_delayed, yield_delayed use global use list_header, only: ListElemInt use material_header, only: Material @@ -33,9 +33,12 @@ contains integer :: i_nuclide ! index into nuclides array integer :: i_sab ! index into sab_tables array integer :: j ! index in mat % i_sab_nuclides + integer :: d ! index for delayed precursor groups real(8) :: atom_density ! atom density of a nuclide + real(8) :: yield ! delayed neutron yield logical :: check_sab ! should we check for S(a,b) table? type(Material), pointer :: mat ! current material + type(Nuclide), pointer :: nuc ! current nuclide ! Set all material macroscopic cross sections to zero material_xs % total = ZERO @@ -44,7 +47,10 @@ contains material_xs % fission = ZERO material_xs % nu_fission = ZERO material_xs % kappa_fission = ZERO - material_xs % delayed_nu_fission = ZERO + + do d = 1, MAX_DELAYED_GROUPS + material_xs % delayed_nu_fission(d) = ZERO + end do ! Exit subroutine if material is void if (p % material == MATERIAL_VOID) return @@ -63,6 +69,7 @@ contains ! Add contribution from each nuclide in material do i = 1, mat % n_nuclides + ! ======================================================================== ! CHECK FOR S(A,B) TABLE @@ -92,6 +99,7 @@ contains ! Determine microscopic cross sections for this nuclide i_nuclide = mat % nuclide(i) + nuc => nuclides(i_nuclide) ! Calculate microscopic cross section for this nuclide if (p % E /= micro_xs(i_nuclide) % last_E) then @@ -132,8 +140,12 @@ contains ! Add contributions to material macroscopic delayed-nu-fission cross ! section - material_xs % delayed_nu_fission = material_xs % delayed_nu_fission + & - atom_density * micro_xs(i_nuclide) % delayed_nu_fission + do d = 1, nuclides(i_nuclide) % n_precursor + yield = yield_delayed(nuc, p % E, d) + material_xs % delayed_nu_fission(d) = & + material_xs % delayed_nu_fission(d) +& + atom_density * micro_xs(i_nuclide) % delayed_nu_fission * yield + end do end do end subroutine calculate_xs diff --git a/src/fission.F90 b/src/fission.F90 index 27143bf38..461fa7d26 100644 --- a/src/fission.F90 +++ b/src/fission.F90 @@ -63,7 +63,7 @@ contains ! since no prompt or delayed data is present, this means all neutron ! emission is prompt -- WARNING: This currently returns zero. The calling ! routine needs to know this situation is occurring since we don't want - ! to call nu_total unnecessarily if it's already been called + ! to call nu_total unnecessarily if it's already been called. nu = ZERO elseif (nuc % nu_p_type == NU_POLYNOMIAL) then ! determine number of coefficients @@ -94,6 +94,10 @@ contains real(8) :: nu ! number of delayed neutrons emitted per fission if (nuc % nu_d_type == NU_NONE) then + ! since no prompt or delayed data is present, this means all neutron + ! emission is prompt -- WARNING: This currently returns zero. The calling + ! routine needs to know this situation is occurring since we don't want + ! to call nu_delayed unnecessarily if it's already been called. nu = ZERO elseif (nuc % nu_d_type == NU_TABULAR) then ! use ENDF interpolation laws to determine nu @@ -102,4 +106,57 @@ contains end function nu_delayed +!=============================================================================== +! YIELD_DELAYED calculates the fractional yield of delayed neutrons emitted for +! a given nuclide and incoming neutron energy in a given delayed group. +!=============================================================================== + + function yield_delayed(nuc, E, g) result(yield) + + type(Nuclide), pointer :: nuc ! nuclide from which to find nu + real(8), intent(in) :: E ! energy of incoming neutron + real(8) :: yield ! delayed neutron precursor yield + integer :: g ! the delayed neutron precursor group + integer :: d ! precursor group + integer :: lc ! index before start of energies/nu values + integer :: NR ! number of interpolation regions + integer :: NE ! number of energies tabulated + + yield = ZERO + + if (g > nuc % n_precursor .or. g < 1) then + ! if the precursor group is outside the range of precursor groups for + ! the input nuclide, return ZERO. + yield = ZERO + else if (nuc % nu_d_type == NU_NONE) then + ! since no prompt or delayed data is present, this means all neutron + ! emission is prompt -- WARNING: This currently returns zero. The calling + ! routine needs to know this situation is occurring since we don't want + ! to call yield unnecessarily if it's already been called. + yield = ZERO + else if (nuc % nu_d_type == NU_TABULAR) then + + lc = 1 + + ! determine the yield for this group + do d = 1, nuc % n_precursor + + ! determine number of interpolation regions and energies + NR = int(nuc % nu_d_precursor_data(lc + 1)) + NE = int(nuc % nu_d_precursor_data(lc + 2 + 2*NR)) + + ! determine delayed neutron precursor yield for group d + yield = interpolate_tab1(nuc % nu_d_precursor_data( & + lc+1:lc+2+2*NR+2*NE), E) + + ! Check if this group is the requested group + if (d == g) exit + + ! advance pointer + lc = lc + 2 + 2*NR + 2*NE + 1 + end do + end if + + end function yield_delayed + end module fission diff --git a/src/output.F90 b/src/output.F90 index d4b546a84..6f6c44317 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -983,7 +983,7 @@ contains score_names(abs(SCORE_NU_SCATTER_N)) = "Scattering Prod. Rate Moment" score_names(abs(SCORE_NU_SCATTER_PN)) = "Scattering Prod. Rate Moment" score_names(abs(SCORE_NU_SCATTER_YN)) = "Scattering Prod. Rate Moment" - score_names(abs(SCORE_DELAYED_NU_FISSION)) = "Delayed-Nu-fission Rate" + score_names(abs(SCORE_DELAYED_NU_FISSION)) = "Delayed-Nu-Fission Rate" ! Create filename for tally output filename = trim(path_output) // "tallies.out" diff --git a/src/state_point.F90 b/src/state_point.F90 index 64ba7ef55..dc2710df9 100644 --- a/src/state_point.F90 +++ b/src/state_point.F90 @@ -326,6 +326,8 @@ contains 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) diff --git a/src/summary.F90 b/src/summary.F90 index b93bf120c..b96bebeed 100644 --- a/src/summary.F90 +++ b/src/summary.F90 @@ -578,6 +578,8 @@ contains 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) diff --git a/src/tally.F90 b/src/tally.F90 index d1dc95f30..5f7c87023 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -15,7 +15,7 @@ module tally use search, only: binary_search use string, only: to_str use tally_header, only: TallyResult, TallyMapItem, TallyMapElement - use fission, only: nu_total, nu_delayed + use fission, only: nu_total, nu_delayed, yield_delayed use interpolation, only: interpolate_tab1 #ifdef MPI @@ -55,10 +55,6 @@ contains integer :: i_energy ! index in nuclide energy grid integer :: score_bin ! scoring bin, e.g. SCORE_FLUX integer :: score_index ! scoring bin index - integer :: lc ! pointer for interpolating in precursor - ! yield table - integer :: NR ! number of interpolation regions - integer :: NE ! number of interpolation energies integer :: d ! delayed neutron index real(8) :: yield ! delayed neutron yield real(8) :: atom_density_ ! atom/b-cm @@ -69,6 +65,7 @@ contains real(8) :: uvw(3) ! particle direction type(Material), pointer :: mat type(Reaction), pointer :: rxn + type(Nuclide), pointer :: nuc i = 0 SCORE_LOOP: do q = 1, t % n_user_score_bins @@ -421,73 +418,95 @@ contains ! calculate fraction of absorptions that would have resulted in ! nu-fission if (micro_xs(p % event_nuclide) % absorption > ZERO) then - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - !$omp critical - lc = 1 - do d = 1, nuclides(p % event_nuclide) % n_precursor + nuc => nuclides(p % event_nuclide) - ! determine number of interpolation regions and energies - NR = int(nuclides(p % event_nuclide) & - % nu_d_precursor_data(lc + 1)) - NE = int(nuclides(p % event_nuclide) & - % nu_d_precursor_data(lc + 2 + 2*NR)) + !$omp critical + do d = 1, nuclides(p % event_nuclide) % n_precursor - ! determine delayed neutron precursor yield for group d - yield = interpolate_tab1(nuclides(p % event_nuclide) & - % nu_d_precursor_data(lc+1:lc+2+2*NR+2*NE), p % E) + yield = yield_delayed(nuc, p % E, d) - ! advance pointer - lc = lc + 2 + 2*NR + 2*NE + 1 - - score = p % absorb_wgt * yield * micro_xs(p % event_nuclide) & - % delayed_nu_fission / micro_xs(p % event_nuclide) & - % absorption + score = p % absorb_wgt * yield * micro_xs(p % event_nuclide) & + % delayed_nu_fission / micro_xs(p % event_nuclide) & + % absorption + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then t % results(score_index, d) % value = & t % results(score_index, d) % value + score - end do - !$omp end critical - else - score = p % absorb_wgt * micro_xs(p % event_nuclide) % & - delayed_nu_fission / micro_xs(p % event_nuclide) % & - absorption - - t % results(score_index, 1) % value = & - t % results(score_index, 1) % value + score - end if - else - score = ZERO + else + t % results(score_index, 1) % value = & + t % results(score_index, 1) % value + score + end if + end do + !$omp end critical end if + + cycle SCORE_LOOP + else + ! Skip any non-fission events + if (.not. p % fission) cycle SCORE_LOOP + ! If there is no outgoing energy filter, than we only need to + ! score to one bin. For the score to be 'analog', we need to + ! score the number of particles that were banked in the fission + ! bank. Since this was weighted by 1/keff, we multiply by keff + ! to get the proper score. Loop over the neutrons produced from + ! fission and check which ones are delayed. If a delayed neutron is + ! encountered, add its contribution to the fission bank to the + ! score. - score = ZERO - - ! Loop over the neutrons produce from fission and check which - ! ones are delayed. If a delayed neutron is encountered, add - ! its contribution to the fission bank to the score. !$omp critical do d = 1, nuclides(p % event_nuclide) % n_precursor score = keff * p % wgt_bank / p % n_bank * p % n_delayed_bank(d) if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then t % results(score_index, d) % value = & - t % results(score_index, d) % value + score + t % results(score_index, d) % value + score else t % results(score_index, 1) % value = & - t % results(score_index, 1) % value + score + t % results(score_index, 1) % value + score end if end do !$omp end critical - cycle SCORE_LOOP - end if + cycle SCORE_LOOP + + end if else if (i_nuclide > 0) then - score = micro_xs(i_nuclide) % nu_fission * atom_density * flux + + nuc => nuclides(i_nuclide) + + do d = 1, nuclides(i_nuclide) % n_precursor + yield = yield_delayed(nuc, p % E, d) + score = micro_xs(i_nuclide) % delayed_nu_fission * yield & + * atom_density * flux + + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then + t % results(score_index, d) % value = & + t % results(score_index, d) % value + score + else + t % results(score_index, 1) % value = & + t % results(score_index, 1) % value + score + end if + end do else - score = material_xs % nu_fission * flux + do d = 1, MAX_DELAYED_GROUPS + + score = material_xs % delayed_nu_fission(d) * flux + + if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then + t % results(score_index, d) % value = & + t % results(score_index, d) % value + score + else + t % results(score_index, 1) % value = & + t % results(score_index, 1) % value + score + end if + end do end if + + cycle SCORE_LOOP + end if case (SCORE_KAPPA_FISSION) From e16a3bd30d0383c6487420c5ccacb9c30b2005a8 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Sat, 3 Oct 2015 15:35:06 -0400 Subject: [PATCH 11/38] fixed syntax errors --- src/fission.F90 | 2 +- src/tally.F90 | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/fission.F90 b/src/fission.F90 index 461fa7d26..5b5b05a58 100644 --- a/src/fission.F90 +++ b/src/fission.F90 @@ -147,7 +147,7 @@ contains ! determine delayed neutron precursor yield for group d yield = interpolate_tab1(nuc % nu_d_precursor_data( & - lc+1:lc+2+2*NR+2*NE), E) + lc+1:lc+2+2*NR+2*NE), E) ! Check if this group is the requested group if (d == g) exit diff --git a/src/tally.F90 b/src/tally.F90 index 5f7c87023..1414f8c34 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -461,10 +461,10 @@ contains if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then t % results(score_index, d) % value = & - t % results(score_index, d) % value + score + t % results(score_index, d) % value + score else t % results(score_index, 1) % value = & - t % results(score_index, 1) % value + score + t % results(score_index, 1) % value + score end if end do !$omp end critical @@ -480,14 +480,14 @@ contains do d = 1, nuclides(i_nuclide) % n_precursor yield = yield_delayed(nuc, p % E, d) score = micro_xs(i_nuclide) % delayed_nu_fission * yield & - * atom_density * flux + * atom_density * flux if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then t % results(score_index, d) % value = & - t % results(score_index, d) % value + score + t % results(score_index, d) % value + score else t % results(score_index, 1) % value = & - t % results(score_index, 1) % value + score + t % results(score_index, 1) % value + score end if end do else @@ -497,10 +497,10 @@ contains if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then t % results(score_index, d) % value = & - t % results(score_index, d) % value + score + t % results(score_index, d) % value + score else t % results(score_index, 1) % value = & - t % results(score_index, 1) % value + score + t % results(score_index, 1) % value + score end if end do end if From e21e248a2d3d4494afc08b9ab4c643a0e14e4ef0 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Sat, 3 Oct 2015 15:45:29 -0400 Subject: [PATCH 12/38] removed unnecessary modification in cross_section.F90 --- src/cross_section.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cross_section.F90 b/src/cross_section.F90 index 91752e26c..d2885f150 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -42,12 +42,12 @@ contains type(Nuclide), pointer :: nuc ! current nuclide ! Set all material macroscopic cross sections to zero - material_xs % total = ZERO - material_xs % elastic = ZERO - material_xs % absorption = ZERO - material_xs % fission = ZERO - material_xs % nu_fission = ZERO - material_xs % kappa_fission = ZERO + material_xs % total = ZERO + material_xs % elastic = ZERO + material_xs % absorption = ZERO + material_xs % fission = ZERO + material_xs % nu_fission = ZERO + material_xs % kappa_fission = ZERO do d = 1, MAX_DELAYED_GROUPS material_xs % delayed_nu_fission(d) = ZERO From 1055bf56b52386f1995d217694202d34cb12ca3d Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Sat, 3 Oct 2015 16:43:03 -0400 Subject: [PATCH 13/38] added warning if delayedgroup filter is used with total nuclide tally --- src/input_xml.F90 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 4e037ae1d..610db2b24 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2562,6 +2562,21 @@ contains ! Check if total material was specified if (trim(sarray(j)) == 'total') then + + ! Check if a delayedgroup filter is present for this tally + do l = 1, t % n_filters + if (t % filters(l) % type == FILTER_DELAYEDGROUP) then + call warning("A delayedgroup filter was used on a total & + &nuclide tally. Cross section libraries are not & + &guaranteed to have the same delayed group structure & + &across all isotopes. In particular, ENDF/B-VII.1 does & + ¬ have a consistent delayed group structure across & + &all isotopes while the JEFF 3.1.1 library has the same & + &delayed group structure across all isotopes. Use with & + &caution!") + end if + end do + t % nuclide_bins(j) = -1 cycle end if From 55c599d21b949004164e486d327b0925082a51d5 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Sun, 4 Oct 2015 11:08:30 -0400 Subject: [PATCH 14/38] clean up delayed group tallies and added documentation --- docs/source/usersguide/input.rst | 24 +++- src/input_xml.F90 | 16 ++- src/tally.F90 | 211 ++++++++++++++++++++----------- 3 files changed, 167 insertions(+), 84 deletions(-) diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index b4d153f18..85cbb8237 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -1213,8 +1213,8 @@ The ```` element accepts the following sub-elements: :type: The type of the filter. Accepted options are "cell", "cellborn", - "material", "universe", "energy", "energyout", "mesh", and - "distribcell". + "material", "universe", "energy", "energyout", "mesh", "distribcell", + and "delayedgroup". :bins: For each filter type, the corresponding ``bins`` entry is given as @@ -1262,7 +1262,13 @@ The ```` element accepts the following sub-elements: not accept more than one cell ID. It is not recommended to combine this filter with a cell or mesh filter. - :nuclides: + :delayedgroup: + A list of delayed neutron precursor groups for which the tally should + be accumulated. For instance, to tally to all 6 delayed groups in the + ENDF/B-VII.1 library the filter is specified as ````. + +:nuclides: If specified, the scores listed will be for particular nuclides, not the summation of reactions from all nuclides. The format for nuclides should be [Atomic symbol]-[Mass number], e.g. "U-235". The reaction rate for all @@ -1291,10 +1297,10 @@ The ```` element accepts the following sub-elements: :scores: A space-separated list of the desired responses to be accumulated. Accepted options are "flux", "total", "scatter", "absorption", "fission", - "nu-fission", "kappa-fission", "nu-scatter", "scatter-N", "scatter-PN", - "scatter-YN", "nu-scatter-N", "nu-scatter-PN", "nu-scatter-YN", "flux-YN", - "total-YN", "current", and "events". These corresponding to the following - physical quantities: + "nu-fission", "delayed-nu-fission", "kappa-fission", "nu-scatter", + "scatter-N", "scatter-PN", "scatter-YN", "nu-scatter-N", "nu-scatter-PN", + "nu-scatter-YN", "flux-YN", "total-YN", "current", and "events". These + corresponding to the following physical quantities: :flux: Total flux in particle-cm per source particle. Note: The ``analog`` @@ -1319,6 +1325,10 @@ The ```` element accepts the following sub-elements: Total production of neutrons due to fission. Units are neutrons produced per source neutron. + :delayed-nu-fission: + Total production of delayed neutrons due to fission. Units are neutrons produced + per source neutron. + :kappa-fission: The recoverable energy production rate due to fission. The recoverable energy is defined as the fission product kinetic energy, prompt and diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 610db2b24..6cc41ad46 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2495,13 +2495,21 @@ contains t % filters(j) % type = FILTER_DELAYEDGROUP ! Set number of bins - t % filters(j) % n_bins = MAX_DELAYED_GROUPS + t % filters(j) % n_bins = n_words ! Allocate and store bins - allocate(t % filters(j) % int_bins(MAX_DELAYED_GROUPS)) + allocate(t % filters(j) % int_bins(n_words)) + call get_node_array(node_filt, "bins", t % filters(j) % int_bins) - do d = 1, MAX_DELAYED_GROUPS - t % filters(j) % int_bins(d) = d + ! Check bins to make sure all are between 1 and MAX_DELAYED_GROUPS + do d = 1, n_words + if (t % filters(j) % int_bins(d) < 1 .or. & + t % filters(j) % int_bins(d) > MAX_DELAYED_GROUPS) then + call fatal_error("Encountered delayedgroup bin with index " & + &// trim(to_str(t % filters(j) % int_bins(d))) & + &//" that is outside the range of 1 to MAX_DELAYED_GROUPS"& + &// " (" // trim(to_str(MAX_DELAYED_GROUPS)) // ")") + end if end do case default diff --git a/src/tally.F90 b/src/tally.F90 index 1414f8c34..9a4b70ab8 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -56,6 +56,10 @@ contains integer :: score_bin ! scoring bin, e.g. SCORE_FLUX integer :: score_index ! scoring bin index integer :: d ! delayed neutron index + integer :: d_bin ! delayed group bin index + integer :: n_bins ! number of delayed group bins + integer :: i_filter ! filter index + integer :: dg_filter ! index of delayed group filter real(8) :: yield ! delayed neutron yield real(8) :: atom_density_ ! atom/b-cm real(8) :: f ! interpolation factor @@ -401,6 +405,15 @@ contains case (SCORE_DELAYED_NU_FISSION) + + ! Set the delayedgroup filter index and the number of delayed group bins + dg_filter = t % find_filter(FILTER_DELAYEDGROUP) + n_bins = 0 + + if (dg_filter > 0) then + n_bins = t % filters(dg_filter) % n_bins + end if + if (t % estimator == ESTIMATOR_ANALOG) then if (survival_biasing .or. p % fission) then if (t % find_filter(FILTER_ENERGYOUT) > 0) then @@ -419,30 +432,27 @@ contains ! nu-fission if (micro_xs(p % event_nuclide) % absorption > ZERO) then - nuc => nuclides(p % event_nuclide) + ! Check if the delayed group filter is present + if (dg_filter > 0) then - !$omp critical - do d = 1, nuclides(p % event_nuclide) % n_precursor - - yield = yield_delayed(nuc, p % E, d) - - score = p % absorb_wgt * yield * micro_xs(p % event_nuclide) & + ! Loop over all delayed group bins and tally to them + ! individually + do d_bin = 1, n_bins + d = t % filters(dg_filter) % int_bins(d_bin) + nuc => nuclides(p % event_nuclide) + yield = yield_delayed(nuc, p % E, d) + score = p % absorb_wgt * yield * micro_xs(p % event_nuclide) & + % delayed_nu_fission / micro_xs(p % event_nuclide) & + % absorption + call score_fission_delayed_dg(t, d_bin, score, score_index) + end do + cycle SCORE_LOOP + else + score = p % absorb_wgt * micro_xs(p % event_nuclide) & % delayed_nu_fission / micro_xs(p % event_nuclide) & % absorption - - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - t % results(score_index, d) % value = & - t % results(score_index, d) % value + score - else - t % results(score_index, 1) % value = & - t % results(score_index, 1) % value + score - end if - end do - !$omp end critical + end if end if - - cycle SCORE_LOOP - else ! Skip any non-fission events if (.not. p % fission) cycle SCORE_LOOP @@ -455,60 +465,68 @@ contains ! encountered, add its contribution to the fission bank to the ! score. - !$omp critical - do d = 1, nuclides(p % event_nuclide) % n_precursor - score = keff * p % wgt_bank / p % n_bank * p % n_delayed_bank(d) - - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - t % results(score_index, d) % value = & - t % results(score_index, d) % value + score - else - t % results(score_index, 1) % value = & - t % results(score_index, 1) % value + score - end if - end do - !$omp end critical - - cycle SCORE_LOOP + ! Check if the delayed group filter is present + if (dg_filter > 0) then + ! Loop over all delayed group bins and tally to them individually + do d_bin = 1, t % filters(dg_filter) % n_bins + d = t % filters(dg_filter) % int_bins(d_bin) + score = keff * p % wgt_bank / p % n_bank * p % n_delayed_bank(d) + call score_fission_delayed_dg(t, d_bin, score, score_index) + end do + cycle SCORE_LOOP + else + score = ZERO + do d = 1, nuclides(p % event_nuclide) % n_precursor + score = score + keff * p % wgt_bank / p % n_bank * & + p % n_delayed_bank(d) + end do + end if end if else + + ! Check if material XS are present if (i_nuclide > 0) then - nuc => nuclides(i_nuclide) + ! Check if the delayed group filter is present + if (dg_filter > 0) then - do d = 1, nuclides(i_nuclide) % n_precursor - yield = yield_delayed(nuc, p % E, d) - score = micro_xs(i_nuclide) % delayed_nu_fission * yield & + ! Loop over all delayed group bins and tally to them individually + do d_bin = 1, t % filters(dg_filter) % n_bins + d = t % filters(dg_filter) % int_bins(d_bin) + nuc => nuclides(i_nuclide) + yield = yield_delayed(nuc, p % E, d) + score = micro_xs(i_nuclide) % delayed_nu_fission * yield & + * atom_density * flux + call score_fission_delayed_dg(t, d_bin, score, score_index) + end do + cycle SCORE_LOOP + else + score = micro_xs(i_nuclide) % delayed_nu_fission & * atom_density * flux - - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - t % results(score_index, d) % value = & - t % results(score_index, d) % value + score - else - t % results(score_index, 1) % value = & - t % results(score_index, 1) % value + score - end if - end do + end if else - do d = 1, MAX_DELAYED_GROUPS - score = material_xs % delayed_nu_fission(d) * flux + score = ZERO - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - t % results(score_index, d) % value = & - t % results(score_index, d) % value + score - else - t % results(score_index, 1) % value = & - t % results(score_index, 1) % value + score - end if - end do + ! Check if the delayed group filter is present + if (dg_filter > 0) then + ! Loop over all delayed group bins and tally to them individually + do d_bin = 1, t % filters(dg_filter) % n_bins + d = t % filters(dg_filter) % int_bins(d_bin) + score = score + material_xs % delayed_nu_fission(d) * flux + call score_fission_delayed_dg(t, d_bin, score, score_index) + end do + cycle SCORE_LOOP + else + do d = 1, MAX_DELAYED_GROUPS + score = score + material_xs % delayed_nu_fission(d) * flux + end do + end if end if - - cycle SCORE_LOOP - end if + case (SCORE_KAPPA_FISSION) if (t % estimator == ESTIMATOR_ANALOG) then if (survival_biasing) then @@ -971,17 +989,23 @@ contains type(TallyObject), pointer :: t integer, intent(in) :: i_score ! index for score - integer :: j ! delayed group integer :: i ! index of outgoing energy filter + integer :: j ! index of delayedgroup filter + integer :: d ! delayed group + integer :: g ! another delayed group + integer :: d_bin = 1 ! delayed group bin index integer :: n ! number of energies on filter integer :: k ! loop index for bank sites integer :: bin_energyout ! original outgoing energy bin + integer :: bin_delayedgroup ! original delayedgroup bin integer :: i_filter ! index for matching filter bin combination real(8) :: score ! actual score real(8) :: E_out ! energy of fission bank site + logical :: d_found = .FALSE. ! bool to inidicate if delayed group was found - ! save original outgoing energy bin and score index + ! save original outgoing energy and delayed group bins i = t % find_filter(FILTER_ENERGYOUT) + j = t % find_filter(FILTER_DELAYEDGROUP) bin_energyout = matching_bins(i) ! Get number of energies on filter @@ -996,10 +1020,11 @@ contains do k = 1, p % n_bank ! get the delayed group - j = fission_bank(n_bank - p % n_bank + k) % delayed_group + g = fission_bank(n_bank - p % n_bank + k) % delayed_group + d_found = .FALSE. ! check if the particle was born delayed - if (j /= 0) then + if (g /= 0) then ! determine score based on bank site weight and keff score = keff * fission_bank(n_bank - p % n_bank + k) % wgt @@ -1011,24 +1036,64 @@ contains if (E_out < t % filters(i) % real_bins(1) .or. & E_out > t % filters(i) % real_bins(n)) cycle + ! check if delayed group is in delayed group bins + if (j > 0) then + do d_bin = 1, t % filters(j) % n_bins + d = t % filters(j) % int_bins(d_bin) + if (d == g) then + d_found = .TRUE. + exit + end if + end do + + ! if the delayedgroup filter is present and the delayed group is not + ! one of the delayedgroup bins, go to next particle in bank. + if (d_found .eqv. .FALSE.) cycle + end if + ! change outgoing energy bin matching_bins(i) = binary_search(t % filters(i) % real_bins, n, E_out) - ! determine scoring index - i_filter = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1 - - ! Add score to tally - !$omp atomic - t % results(i_score, i_filter) % value = & - t % results(i_score, i_filter) % value + score + call score_fission_delayed_dg(t, d_bin, score, i_score) end if end do - ! reset outgoing energy bin and score index + ! reset outgoing energy bin matching_bins(i) = bin_energyout end subroutine score_fission_delayed_eout +!=============================================================================== +! SCORE_FISSION_DELAYED_DG helper function used to increment the tally when a +! delayed group filter is present. +!=============================================================================== + + subroutine score_fission_delayed_dg(t, d_bin, score, score_index) + + type(TallyObject), pointer :: t + integer, intent(in) :: score_index ! index for score + integer, intent(in) :: d_bin ! delayed group bin index + + integer :: bin_original ! original bin index + integer :: filter_index ! index for matching filter bin combination + real(8) :: score ! actual score + + ! save original delayed group bin + bin_original = matching_bins(t % find_filter(FILTER_DELAYEDGROUP)) + matching_bins(t % find_filter(FILTER_DELAYEDGROUP)) = d_bin + + ! Compute the filter index based on the modified matching_bins + filter_index = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1 + +!$omp atomic + t % results(score_index, filter_index) % value = & + t % results(score_index, filter_index) % value + score + + ! reset original delayed group bin + matching_bins(t % find_filter(FILTER_DELAYEDGROUP)) = bin_original + + end subroutine score_fission_delayed_dg + !=============================================================================== ! SCORE_TRACKLENGTH_TALLY calculates fluxes and reaction rates based on the ! track-length estimate of the flux. This is triggered at every event (surface From 0f691ad1799808622fb122240b2721d169a47480 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 28 Sep 2015 16:38:22 +0700 Subject: [PATCH 15/38] Add energy_min_neutron and energy_max_neutron variables to replace hard-coded instances of 20 MeV. --- src/ace.F90 | 9 +++++++++ src/cross_section.F90 | 2 +- src/energy_grid.F90 | 4 ++-- src/global.F90 | 4 ++++ src/physics.F90 | 8 ++++---- src/source.F90 | 13 +++++++------ 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index cccc57092..69ad2f1a9 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -482,6 +482,15 @@ contains ! Continue reading elastic scattering and heating nuc % elastic = get_real(NE) + ! Determine if minimum/maximum energy for this nuclide is greater/less + ! than the previous + energy_min_neutron = max(energy_min_neutron, nuc%energy(1)) + energy_max_neutron = min(energy_max_neutron, nuc%energy(NE)) + if (nuc%energy(NE) < 20.0_8) then + call warning("Maximum energy for " // trim(adjustl(nuc%name)) // & + " is " // trim(to_str(nuc%energy(NE))) // " MeV. Neutrons will & + ¬ be allowed to go above this energy.") + end if end if end subroutine read_esz diff --git a/src/cross_section.F90 b/src/cross_section.F90 index 4d8fb2f0f..1c56d961e 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -56,7 +56,7 @@ contains if (grid_method == GRID_MAT_UNION) then call find_energy_index(p % E, p % material) else if (grid_method == GRID_LOGARITHM) then - u = int(log(p % E/1.0e-11_8)/log_spacing) + u = int(log(p % E/energy_min_neutron)/log_spacing) end if ! Determine if this material has S(a,b) tables diff --git a/src/energy_grid.F90 b/src/energy_grid.F90 index 1473e5210..66419f83c 100644 --- a/src/energy_grid.F90 +++ b/src/energy_grid.F90 @@ -73,8 +73,8 @@ contains type(Nuclide), pointer :: nuc ! Set minimum/maximum energies - E_max = 20.0_8 - E_min = 1.0e-11_8 + E_max = energy_max_neutron + E_min = energy_min_neutron ! Determine equal-logarithmic energy spacing M = n_log_bins diff --git a/src/global.F90 b/src/global.F90 index 87d727829..a4c80daa7 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -74,6 +74,10 @@ module global integer :: n_sab_tables ! Number of S(a,b) thermal scattering tables integer :: n_listings ! Number of listings in cross_sections.xml + ! Minimum/maximum energies + real(8) :: energy_min_neutron = ZERO + real(8) :: energy_max_neutron = INFINITY + ! Dictionaries to look up cross sections and listings type(DictCharInt) :: nuclide_dict type(DictCharInt) :: sab_dict diff --git a/src/physics.F90 b/src/physics.F90 index 11bc3720f..a109eb1a6 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -1220,8 +1220,8 @@ contains call sample_energy(edist, E, E_out) end if - ! resample if energy is >= 20 MeV - if (E_out < 20) exit + ! resample if energy is greater than maximum neutron energy + if (E_out < energy_max_neutron) exit ! check for large number of resamples n_sample = n_sample + 1 @@ -1246,8 +1246,8 @@ contains call sample_energy(rxn%edist, E, E_out) end if - ! resample if energy is >= 20 MeV - if (E_out < 20) exit + ! resample if energy is greater than maximum neutron energy + if (E_out < energy_max_neutron) exit ! check for large number of resamples n_sample = n_sample + 1 diff --git a/src/source.F90 b/src/source.F90 index c46174947..6226517f3 100644 --- a/src/source.F90 +++ b/src/source.F90 @@ -211,8 +211,9 @@ contains case (SRC_ENERGY_MONO) ! Monoenergtic source site%E = external_source%params_energy(1) - if (site%E >= 20) then - call fatal_error("Source energies above 20 MeV not allowed.") + if (site%E >= energy_max_neutron) then + call fatal_error("Source energy above range of energies of at least & + &one cross section table") end if case (SRC_ENERGY_MAXWELL) @@ -221,8 +222,8 @@ contains ! Sample Maxwellian fission spectrum site%E = maxwell_spectrum(a) - ! resample if energy is >= 20 MeV - if (site%E < 20) exit + ! resample if energy is greater than maximum neutron energy + if (site%E < energy_max_neutron) exit end do case (SRC_ENERGY_WATT) @@ -232,8 +233,8 @@ contains ! Sample Watt fission spectrum site%E = watt_spectrum(a, b) - ! resample if energy is >= 20 MeV - if (site%E < 20) exit + ! resample if energy is greater than maximum neutron energy + if (site%E < energy_max_neutron) exit end do case default From a07300d53d5f1bffb325b177002876156a693579 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Mon, 5 Oct 2015 09:50:44 -0400 Subject: [PATCH 16/38] added delayedgroup filter and delayed-nu-fission tests and updated relaxng schema --- openmc/filter.py | 4 +- src/input_xml.F90 | 13 + src/relaxng/tallies.rnc | 6 +- src/relaxng/tallies.rng | 2 + tests/test_filter_delayedgroup/geometry.xml | 181 ++++++++++++ tests/test_filter_delayedgroup/materials.xml | 272 ++++++++++++++++++ .../test_filter_delayedgroup/results_true.dat | 15 + tests/test_filter_delayedgroup/settings.xml | 19 ++ tests/test_filter_delayedgroup/tallies.xml | 10 + .../test_filter_delayedgroup.py | 10 + tests/test_many_scores/results_true.dat | 2 + tests/test_many_scores/tallies.xml | 2 +- .../test_score_delayed_nufission/geometry.xml | 181 ++++++++++++ .../materials.xml | 272 ++++++++++++++++++ .../results_true.dat | 29 ++ .../test_score_delayed_nufission/settings.xml | 19 ++ .../test_score_delayed_nufission/tallies.xml | 21 ++ .../test_score_delayed_nufission.py | 10 + 18 files changed, 1063 insertions(+), 5 deletions(-) create mode 100644 tests/test_filter_delayedgroup/geometry.xml create mode 100644 tests/test_filter_delayedgroup/materials.xml create mode 100644 tests/test_filter_delayedgroup/results_true.dat create mode 100644 tests/test_filter_delayedgroup/settings.xml create mode 100644 tests/test_filter_delayedgroup/tallies.xml create mode 100644 tests/test_filter_delayedgroup/test_filter_delayedgroup.py create mode 100644 tests/test_score_delayed_nufission/geometry.xml create mode 100644 tests/test_score_delayed_nufission/materials.xml create mode 100644 tests/test_score_delayed_nufission/results_true.dat create mode 100644 tests/test_score_delayed_nufission/settings.xml create mode 100644 tests/test_score_delayed_nufission/tallies.xml create mode 100644 tests/test_score_delayed_nufission/test_score_delayed_nufission.py diff --git a/openmc/filter.py b/openmc/filter.py index 6dd4bdaff..fc217a410 100644 --- a/openmc/filter.py +++ b/openmc/filter.py @@ -9,7 +9,7 @@ from openmc.checkvalue import check_type, check_iterable_type, \ check_greater_than, _isinstance _FILTER_TYPES = ['universe', 'material', 'cell', 'cellborn', 'surface', - 'mesh', 'energy', 'energyout', 'distribcell'] + 'mesh', 'energy', 'energyout', 'distribcell', 'delayedgroup'] class Filter(object): """A filter used to constrain a tally to a specific criterion, e.g. only tally @@ -136,7 +136,7 @@ class Filter(object): bins = list(bins) if self.type in ['cell', 'cellborn', 'surface', 'material', - 'universe', 'distribcell']: + 'universe', 'distribcell', 'delayedgroup']: check_iterable_type('filter bins', bins, Integral) for edge in bins: check_greater_than('filter bin', edge, 0, equality=True) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 6cc41ad46..3d5d1f9a9 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2634,6 +2634,19 @@ contains allocate(t % nuclide_bins(1)) t % nuclide_bins(1) = -1 t % n_nuclide_bins = 1 + + ! Check if a delayedgroup filter is present for this tally + do l = 1, t % n_filters + if (t % filters(l) % type == FILTER_DELAYEDGROUP) then + call warning("A delayedgroup filter was used on a total nuclide & + &tally. Cross section libraries are not guaranteed to have the& + & same delayed group structure across all isotopes. In & + &particular, ENDF/B-VII.1 does not have a consistent delayed & + &group structure across all isotopes while the JEFF 3.1.1 & + &library has the same delayed group structure across all & + &isotopes. Use with caution!") + end if + end do end if ! ======================================================================= diff --git a/src/relaxng/tallies.rnc b/src/relaxng/tallies.rnc index ee93d273c..155f379d8 100644 --- a/src/relaxng/tallies.rnc +++ b/src/relaxng/tallies.rnc @@ -23,9 +23,11 @@ element tallies { attribute estimator { ( "analog" | "tracklength" ) })? & element filter { (element type { ( "cell" | "cellborn" | "material" | "universe" | - "surface" | "distribcell" | "mesh" | "energy" | "energyout" ) } | + "surface" | "distribcell" | "mesh" | "energy" | "energyout" | + "delayedgroup" ) } | attribute type { ( "cell" | "cellborn" | "material" | "universe" | - "surface" | "distribcell" | "mesh" | "energy" | "energyout" ) }) & + "surface" | "distribcell" | "mesh" | "energy" | "energyout" | + "delayedgroup" ) }) & (element bins { list { xsd:double+ } } | attribute bins { list { xsd:double+ } }) }* & diff --git a/src/relaxng/tallies.rng b/src/relaxng/tallies.rng index 76973e855..d2cd9271e 100644 --- a/src/relaxng/tallies.rng +++ b/src/relaxng/tallies.rng @@ -145,6 +145,7 @@ mesh energy energyout + delayedgroup @@ -158,6 +159,7 @@ mesh energy energyout + delayedgroup diff --git a/tests/test_filter_delayedgroup/geometry.xml b/tests/test_filter_delayedgroup/geometry.xml new file mode 100644 index 000000000..b85dd04df --- /dev/null +++ b/tests/test_filter_delayedgroup/geometry.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 17 17 + -10.71 -10.71 + 1.26 1.26 + + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 + 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 + 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + + + + + + 17 17 + -10.71 -10.71 + 1.26 1.26 + + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 3 3 4 3 3 4 3 3 4 3 3 3 3 3 + 3 3 3 4 3 3 3 3 3 3 3 3 3 4 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 4 3 3 3 3 3 3 3 3 3 4 3 3 3 + 3 3 3 3 3 4 3 3 4 3 3 4 3 3 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + + + + + + 21 21 + -224.91 -224.91 + 21.42 21.42 + + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 6 6 6 6 6 6 6 5 5 5 5 5 5 5 + 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 + 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 + 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 + 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 + 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 + 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 + 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 + 5 5 5 5 5 5 5 6 6 6 6 6 6 6 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + + + + + + 21 21 + -224.91 -224.91 + 21.42 21.42 + + 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 + 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 + 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 + 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 + 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 + 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 + 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 + 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 + 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 + + + + diff --git a/tests/test_filter_delayedgroup/materials.xml b/tests/test_filter_delayedgroup/materials.xml new file mode 100644 index 000000000..9c0b74f3f --- /dev/null +++ b/tests/test_filter_delayedgroup/materials.xml @@ -0,0 +1,272 @@ + + + + 71c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_filter_delayedgroup/results_true.dat b/tests/test_filter_delayedgroup/results_true.dat new file mode 100644 index 000000000..d6ba0cb6c --- /dev/null +++ b/tests/test_filter_delayedgroup/results_true.dat @@ -0,0 +1,15 @@ +k-combined: +1.005983E+00 2.248579E-02 +tally 1: +6.113115E-04 +7.519723E-08 +3.155402E-03 +2.003485E-06 +3.012421E-03 +1.826030E-06 +6.754096E-03 +9.179334E-06 +2.769084E-03 +1.542940E-06 +1.159960E-03 +2.707463E-07 diff --git a/tests/test_filter_delayedgroup/settings.xml b/tests/test_filter_delayedgroup/settings.xml new file mode 100644 index 000000000..517637a59 --- /dev/null +++ b/tests/test_filter_delayedgroup/settings.xml @@ -0,0 +1,19 @@ + + + + + 10 + 5 + 100 + + + + + + -160 -160 -183 + 160 160 183 + + + + + diff --git a/tests/test_filter_delayedgroup/tallies.xml b/tests/test_filter_delayedgroup/tallies.xml new file mode 100644 index 000000000..b3649b469 --- /dev/null +++ b/tests/test_filter_delayedgroup/tallies.xml @@ -0,0 +1,10 @@ + + + + + + delayed-nu-fission + U-235 + + + diff --git a/tests/test_filter_delayedgroup/test_filter_delayedgroup.py b/tests/test_filter_delayedgroup/test_filter_delayedgroup.py new file mode 100644 index 000000000..1777db993 --- /dev/null +++ b/tests/test_filter_delayedgroup/test_filter_delayedgroup.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +import sys +sys.path.insert(0, '..') +from testing_harness import TestHarness + + +if __name__ == '__main__': + harness = TestHarness('statepoint.10.*', True) + harness.main() diff --git a/tests/test_many_scores/results_true.dat b/tests/test_many_scores/results_true.dat index bb151ae0e..a71706b63 100644 --- a/tests/test_many_scores/results_true.dat +++ b/tests/test_many_scores/results_true.dat @@ -109,3 +109,5 @@ tally 1: 7.673412E-04 1.014000E+01 3.427342E+01 +7.652723E-03 +3.578992E-05 \ No newline at end of file diff --git a/tests/test_many_scores/tallies.xml b/tests/test_many_scores/tallies.xml index 1832acf67..2df5597d0 100644 --- a/tests/test_many_scores/tallies.xml +++ b/tests/test_many_scores/tallies.xml @@ -6,7 +6,7 @@ flux total scatter nu-scatter scatter-2 scatter-p2 nu-scatter-2 nu-scatter-p2 transport n1n absorption nu-fission kappa-fission - flux-y2 total-y2 scatter-y2 nu-scatter-y2 events + flux-y2 total-y2 scatter-y2 nu-scatter-y2 events delayed-nu-fission diff --git a/tests/test_score_delayed_nufission/geometry.xml b/tests/test_score_delayed_nufission/geometry.xml new file mode 100644 index 000000000..b85dd04df --- /dev/null +++ b/tests/test_score_delayed_nufission/geometry.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 17 17 + -10.71 -10.71 + 1.26 1.26 + + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 + 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 + 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + + + + + + 17 17 + -10.71 -10.71 + 1.26 1.26 + + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 3 3 4 3 3 4 3 3 4 3 3 3 3 3 + 3 3 3 4 3 3 3 3 3 3 3 3 3 4 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 4 3 3 3 3 3 3 3 3 3 4 3 3 3 + 3 3 3 3 3 4 3 3 4 3 3 4 3 3 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + + + + + + 21 21 + -224.91 -224.91 + 21.42 21.42 + + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 6 6 6 6 6 6 6 5 5 5 5 5 5 5 + 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 + 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 + 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 + 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 + 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 + 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 + 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 + 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 + 5 5 5 5 5 5 5 6 6 6 6 6 6 6 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + + + + + + 21 21 + -224.91 -224.91 + 21.42 21.42 + + 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 + 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 + 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 + 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 + 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 + 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 + 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 + 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 + 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 + 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 + + + + diff --git a/tests/test_score_delayed_nufission/materials.xml b/tests/test_score_delayed_nufission/materials.xml new file mode 100644 index 000000000..9c0b74f3f --- /dev/null +++ b/tests/test_score_delayed_nufission/materials.xml @@ -0,0 +1,272 @@ + + + + 71c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_score_delayed_nufission/results_true.dat b/tests/test_score_delayed_nufission/results_true.dat new file mode 100644 index 000000000..4af4a4961 --- /dev/null +++ b/tests/test_score_delayed_nufission/results_true.dat @@ -0,0 +1,29 @@ +k-combined: +1.005983E+00 2.248579E-02 +tally 1: +1.432287E-02 +4.518735E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.531355E-02 +5.079890E-05 +tally 2: +1.576415E-02 +2.485084E-04 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +tally 3: +1.365224E-02 +3.952118E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.442838E-02 +4.559807E-05 diff --git a/tests/test_score_delayed_nufission/settings.xml b/tests/test_score_delayed_nufission/settings.xml new file mode 100644 index 000000000..517637a59 --- /dev/null +++ b/tests/test_score_delayed_nufission/settings.xml @@ -0,0 +1,19 @@ + + + + + 10 + 5 + 100 + + + + + + -160 -160 -183 + 160 160 183 + + + + + diff --git a/tests/test_score_delayed_nufission/tallies.xml b/tests/test_score_delayed_nufission/tallies.xml new file mode 100644 index 000000000..5ca140985 --- /dev/null +++ b/tests/test_score_delayed_nufission/tallies.xml @@ -0,0 +1,21 @@ + + + + + + delayed-nu-fission + + + + + delayed-nu-fission + analog + + + + + delayed-nu-fission + collision + + + diff --git a/tests/test_score_delayed_nufission/test_score_delayed_nufission.py b/tests/test_score_delayed_nufission/test_score_delayed_nufission.py new file mode 100644 index 000000000..1777db993 --- /dev/null +++ b/tests/test_score_delayed_nufission/test_score_delayed_nufission.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +import sys +sys.path.insert(0, '..') +from testing_harness import TestHarness + + +if __name__ == '__main__': + harness = TestHarness('statepoint.10.*', True) + harness.main() From c20eda4f9e0109fc701912b139b502ef0aed714f Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Mon, 5 Oct 2015 10:01:05 -0400 Subject: [PATCH 17/38] added delayedgroup filter case to state point file --- src/state_point.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/state_point.F90 b/src/state_point.F90 index dc2710df9..d5267c416 100644 --- a/src/state_point.F90 +++ b/src/state_point.F90 @@ -258,6 +258,8 @@ contains call write_dataset(filter_group, "type", "energyout") case(FILTER_DISTRIBCELL) call write_dataset(filter_group, "type", "distribcell") + case(FILTER_DELAYEDGROUP) + call write_dataset(filter_group, "type", "delayedgroup") end select call write_dataset(filter_group, "offset", tally%filters(j)%offset) From 66ee8358d66d030689fd98b3f64da9861715713b Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Mon, 5 Oct 2015 10:12:04 -0400 Subject: [PATCH 18/38] added new line to end of test many scores results file --- tests/test_many_scores/results_true.dat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_many_scores/results_true.dat b/tests/test_many_scores/results_true.dat index a71706b63..6209bd6a2 100644 --- a/tests/test_many_scores/results_true.dat +++ b/tests/test_many_scores/results_true.dat @@ -110,4 +110,4 @@ tally 1: 1.014000E+01 3.427342E+01 7.652723E-03 -3.578992E-05 \ No newline at end of file +3.578992E-05 From c82f6946f4b6011e472ed16c6241f469383978ae Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Mon, 12 Oct 2015 14:06:20 -0400 Subject: [PATCH 19/38] removed macroscopic delayed nu fission cross section --- docs/source/usersguide/input.rst | 7 +- src/ace_header.F90 | 14 ++-- src/bank_header.F90 | 2 +- src/cross_section.F90 | 13 ---- src/fission.F90 | 16 ++--- src/initialize.F90 | 4 +- src/input_xml.F90 | 109 ++++--------------------------- src/particle_header.F90 | 29 ++++---- src/physics.F90 | 12 ++-- src/tally.F90 | 53 ++++++++++----- src/tracking.F90 | 5 +- 11 files changed, 89 insertions(+), 175 deletions(-) diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index 49cf5dcec..232e9bfe4 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -1279,8 +1279,11 @@ The ```` element accepts the following sub-elements: :delayedgroup: A list of delayed neutron precursor groups for which the tally should be accumulated. For instance, to tally to all 6 delayed groups in the - ENDF/B-VII.1 library the filter is specified as ````. + ENDF/B-VII.1 library the filter is specified as: + + .. code-block:: xml + + :nuclides: If specified, the scores listed will be for particular nuclides, not the diff --git a/src/ace_header.F90 b/src/ace_header.F90 index 613cc44a4..8acefba10 100644 --- a/src/ace_header.F90 +++ b/src/ace_header.F90 @@ -285,14 +285,12 @@ module ace_header !=============================================================================== type MaterialMacroXS - real(8) :: total ! macroscopic total xs - real(8) :: elastic ! macroscopic elastic scattering xs - real(8) :: absorption ! macroscopic absorption xs - real(8) :: fission ! macroscopic fission xs - real(8) :: nu_fission ! macroscopic production xs - real(8) :: kappa_fission ! macroscopic energy-released from fission - real(8) :: delayed_nu_fission(MAX_DELAYED_GROUPS) ! macroscopic delayed - ! production xs + real(8) :: total ! macroscopic total xs + real(8) :: elastic ! macroscopic elastic scattering xs + real(8) :: absorption ! macroscopic absorption xs + real(8) :: fission ! macroscopic fission xs + real(8) :: nu_fission ! macroscopic production xs + real(8) :: kappa_fission ! macroscopic energy-released from fission end type MaterialMacroXS contains diff --git a/src/bank_header.F90 b/src/bank_header.F90 index 34c7efc3f..0cb49af35 100644 --- a/src/bank_header.F90 +++ b/src/bank_header.F90 @@ -15,7 +15,7 @@ module bank_header real(C_DOUBLE) :: xyz(3) ! location of bank particle real(C_DOUBLE) :: uvw(3) ! diretional cosines real(C_DOUBLE) :: E ! energy - integer :: delayed_group ! delayed group + integer(C_INT) :: delayed_group ! delayed group end type Bank end module bank_header diff --git a/src/cross_section.F90 b/src/cross_section.F90 index d2885f150..1b94a1049 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -49,10 +49,6 @@ contains material_xs % nu_fission = ZERO material_xs % kappa_fission = ZERO - do d = 1, MAX_DELAYED_GROUPS - material_xs % delayed_nu_fission(d) = ZERO - end do - ! Exit subroutine if material is void if (p % material == MATERIAL_VOID) return @@ -142,15 +138,6 @@ contains ! Add contributions to material macroscopic energy release from fission material_xs % kappa_fission = material_xs % kappa_fission + & atom_density * micro_xs(i_nuclide) % kappa_fission - - ! Add contributions to material macroscopic delayed-nu-fission cross - ! section - do d = 1, nuclides(i_nuclide) % n_precursor - yield = yield_delayed(nuc, p % E, d) - material_xs % delayed_nu_fission(d) = & - material_xs % delayed_nu_fission(d) +& - atom_density * micro_xs(i_nuclide) % delayed_nu_fission * yield - end do end do end subroutine calculate_xs diff --git a/src/fission.F90 b/src/fission.F90 index 5b5b05a58..2624672d1 100644 --- a/src/fission.F90 +++ b/src/fission.F90 @@ -113,14 +113,14 @@ contains function yield_delayed(nuc, E, g) result(yield) - type(Nuclide), pointer :: nuc ! nuclide from which to find nu - real(8), intent(in) :: E ! energy of incoming neutron - real(8) :: yield ! delayed neutron precursor yield - integer :: g ! the delayed neutron precursor group - integer :: d ! precursor group - integer :: lc ! index before start of energies/nu values - integer :: NR ! number of interpolation regions - integer :: NE ! number of energies tabulated + type(Nuclide), intent(in) :: nuc ! nuclide from which to find nu + real(8), intent(in) :: E ! energy of incoming neutron + real(8) :: yield ! delayed neutron precursor yield + integer, intent(in) :: g ! the delayed neutron precursor group + integer :: d ! precursor group + integer :: lc ! index before start of energies/nu values + integer :: NR ! number of interpolation regions + integer :: NE ! number of energies tabulated yield = ZERO diff --git a/src/initialize.F90 b/src/initialize.F90 index b1bae554e..9d63eb4e9 100644 --- a/src/initialize.F90 +++ b/src/initialize.F90 @@ -234,7 +234,7 @@ contains ! Define MPI_BANK for fission sites bank_blocks = (/ 1, 3, 3, 1, 1 /) - bank_types = (/ MPI_REAL8, MPI_REAL8, MPI_REAL8, MPI_REAL8, MPI_REAL8 /) + bank_types = (/ MPI_REAL8, MPI_REAL8, MPI_REAL8, MPI_REAL8, MPI_INTEGER /) call MPI_TYPE_CREATE_STRUCT(5, bank_blocks, bank_disp, & bank_types, MPI_BANK, mpi_err) call MPI_TYPE_COMMIT(MPI_BANK, mpi_err) @@ -308,7 +308,7 @@ contains call h5tinsert_f(hdf5_bank_t, "E", h5offsetof(c_loc(tmpb(1)), & c_loc(tmpb(1)%E)), H5T_NATIVE_DOUBLE, hdf5_err) call h5tinsert_f(hdf5_bank_t, "delayed_group", h5offsetof(c_loc(tmpb(1)), & - c_loc(tmpb(1)%delayed_group)), H5T_NATIVE_DOUBLE, hdf5_err) + c_loc(tmpb(1)%delayed_group)), H5T_NATIVE_INTEGER, hdf5_err) ! Determine type for integer(8) hdf5_integer8_t = h5kind_to_type(8, H5_INTEGER_KIND) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 8092d5bf5..dd9220ebd 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2585,9 +2585,9 @@ contains if (t % filters(j) % int_bins(d) < 1 .or. & t % filters(j) % int_bins(d) > MAX_DELAYED_GROUPS) then call fatal_error("Encountered delayedgroup bin with index " & - &// trim(to_str(t % filters(j) % int_bins(d))) & - &//" that is outside the range of 1 to MAX_DELAYED_GROUPS"& - &// " (" // trim(to_str(MAX_DELAYED_GROUPS)) // ")") + // trim(to_str(t % filters(j) % int_bins(d))) // " that is& + & outside the range of 1 to MAX_DELAYED_GROUPS ( " & + // trim(to_str(MAX_DELAYED_GROUPS)) // ")") end if end do @@ -2833,6 +2833,14 @@ contains end do end if + ! Check if delayed group filter is used with any score besides + ! delayed-nu-fission + if (trim(score_name) /= 'delayed-nu-fission' .and. & + t % find_filter(FILTER_DELAYEDGROUP) > 0) then + call fatal_error("Cannot tally " // trim(score_name) // " with a & + &delayedgroup filter.") + end if + select case (trim(score_name)) case ('flux') ! Prohibit user from tallying flux for an individual nuclide @@ -2847,11 +2855,6 @@ contains &filter.") end if - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally flux with a & - &delayedgroup energy filter.") - end if - case ('flux-yn') ! Prohibit user from tallying flux for an individual nuclide if (.not. (t % n_nuclide_bins == 1 .and. & @@ -2864,11 +2867,6 @@ contains &filter.") end if - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally flux with a & - &delayedgroup energy filter.") - end if - t % score_bins(j : j + n_bins - 1) = SCORE_FLUX_YN t % moment_order(j : j + n_bins - 1) = n_order j = j + n_bins - 1 @@ -2880,53 +2878,28 @@ contains &outgoing energy filter.") end if - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally total reaction rate with a & - &delayedgroup energy filter.") - end if - case ('total-yn') if (t % find_filter(FILTER_ENERGYOUT) > 0) then call fatal_error("Cannot tally total reaction rate with an & &outgoing energy filter.") end if - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally total reaction rate with a & - &delayedgroup energy filter.") - end if - t % score_bins(j : j + n_bins - 1) = SCORE_TOTAL_YN t % moment_order(j : j + n_bins - 1) = n_order j = j + n_bins - 1 case ('scatter') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally scatter with a & - &delayedgroup energy filter.") - end if - t % score_bins(j) = SCORE_SCATTER case ('nu-scatter') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally nu scatter with a & - &delayedgroup energy filter.") - end if - t % score_bins(j) = SCORE_NU_SCATTER ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG case ('scatter-n') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally scatter n with a & - &delayedgroup energy filter.") - end if - if (n_order == 0) then t % score_bins(j) = SCORE_SCATTER else @@ -2938,11 +2911,6 @@ contains case ('nu-scatter-n') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally nu scatter n with a & - &delayedgroup energy filter.") - end if - ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG if (n_order == 0) then @@ -2954,11 +2922,6 @@ contains case ('scatter-pn') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally scatter pn with a & - &delayedgroup energy filter.") - end if - t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_SCATTER_PN @@ -2967,11 +2930,6 @@ contains case ('nu-scatter-pn') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally nu scatter pn with a & - &delayedgroup energy filter.") - end if - t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_NU_SCATTER_PN @@ -2980,11 +2938,6 @@ contains case ('scatter-yn') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally scatter yn with a & - &delayedgroup energy filter.") - end if - t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_SCATTER_YN @@ -2993,11 +2946,6 @@ contains case ('nu-scatter-yn') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally nu scatter yn with a & - &delayedgroup energy filter.") - end if - t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_NU_SCATTER_YN @@ -3006,11 +2954,6 @@ contains case('transport') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally transport reaction rate with a & - &delayedgroup energy filter.") - end if - t % score_bins(j) = SCORE_TRANSPORT ! Set tally estimator to analog @@ -3020,11 +2963,6 @@ contains &please remove") case ('n1n') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally n1n with a & - &delayedgroup energy filter.") - end if - t % score_bins(j) = SCORE_N_1N ! Set tally estimator to analog @@ -3040,11 +2978,6 @@ contains case ('absorption') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally absorption rate with a & - &delayedgroup energy filter.") - end if - t % score_bins(j) = SCORE_ABSORPTION if (t % find_filter(FILTER_ENERGYOUT) > 0) then call fatal_error("Cannot tally absorption rate with an outgoing & @@ -3052,11 +2985,6 @@ contains end if case ('fission') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally fission rate with a & - &delayedgroup energy filter.") - end if - t % score_bins(j) = SCORE_FISSION if (t % find_filter(FILTER_ENERGYOUT) > 0) then call fatal_error("Cannot tally fission rate with an outgoing & @@ -3064,11 +2992,6 @@ contains end if case ('nu-fission') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally nu fission rate with a & - &delayedgroup energy filter.") - end if - t % score_bins(j) = SCORE_NU_FISSION if (t % find_filter(FILTER_ENERGYOUT) > 0) then ! Set tally estimator to analog @@ -3083,19 +3006,9 @@ contains end if case ('kappa-fission') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally kappa fission with a & - &delayedgroup energy filter.") - end if - t % score_bins(j) = SCORE_KAPPA_FISSION case ('current') - if (t % find_filter(FILTER_DELAYEDGROUP) > 0) then - call fatal_error("Cannot tally current with a & - &delayedgroup energy filter.") - end if - t % score_bins(j) = SCORE_CURRENT t % type = TALLY_SURFACE_CURRENT diff --git a/src/particle_header.F90 b/src/particle_header.F90 index 477031757..b2f6c579e 100644 --- a/src/particle_header.F90 +++ b/src/particle_header.F90 @@ -116,22 +116,19 @@ contains this % alive = .true. ! clear attributes - this % surface = NONE - this % cell_born = NONE - this % material = NONE - this % last_material = NONE - this % wgt = ONE - this % last_wgt = ONE - this % absorb_wgt = ZERO - this % n_bank = 0 - this % wgt_bank = ZERO - this % n_collision = 0 - this % fission = .false. - this % delayed_group = 0 - - do d = 1, MAX_DELAYED_GROUPS - this % n_delayed_bank(d) = 0 - end do + this % surface = NONE + this % cell_born = NONE + this % material = NONE + this % last_material = NONE + this % wgt = ONE + this % last_wgt = ONE + this % absorb_wgt = ZERO + this % n_bank = 0 + this % wgt_bank = ZERO + this % n_collision = 0 + this % fission = .false. + this % delayed_group = 0 + this % n_delayed_bank(:) = 0 ! Set up base level coordinates this % coord(1) % universe = BASE_UNIVERSE diff --git a/src/physics.F90 b/src/physics.F90 index da46be851..5e9675b17 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -1052,7 +1052,7 @@ contains integer, intent(in) :: i_reaction integer :: d ! delayed group index - integer :: nu_delayed(MAX_DELAYED_GROUPS) ! number of delayed neutrons born + integer :: nu_d(MAX_DELAYED_GROUPS) ! number of delayed neutrons born integer :: i ! loop index integer :: nu ! actual number of neutrons produced integer :: ijk(3) ! indices in ufs mesh @@ -1113,9 +1113,7 @@ contains ! Initialize counter of delayed neutrons encountered for each delayed group ! to zero. - do d = 1, MAX_DELAYED_GROUPS - nu_delayed(d) = 0 - end do + nu_d(:) = 0 p % fission = .true. ! Fission neutrons will be banked do i = int(n_bank,4) + 1, int(min(n_bank + nu, int(size(fission_bank),8)),4) @@ -1146,7 +1144,7 @@ contains ! Increment the number of neutrons born delayed if (p % delayed_group > 0) then - nu_delayed(p % delayed_group) = nu_delayed(p % delayed_group) + 1 + nu_d(p % delayed_group) = nu_d(p % delayed_group) + 1 end if end do @@ -1156,9 +1154,7 @@ contains ! Store total and delayed weight banked for analog fission tallies p % n_bank = nu p % wgt_bank = nu/weight - do d = 1, MAX_DELAYED_GROUPS - p % n_delayed_bank(d) = nu_delayed(d) - end do + p % n_delayed_bank(:) = nu_d(:) end subroutine create_fission_sites diff --git a/src/tally.F90 b/src/tally.F90 index 9a4b70ab8..d93b721bf 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -485,7 +485,7 @@ contains end if else - ! Check if material XS are present + ! Check if tally is on a single nuclide if (i_nuclide > 0) then ! Check if the delayed group filter is present @@ -505,22 +505,45 @@ contains score = micro_xs(i_nuclide) % delayed_nu_fission & * atom_density * flux end if + + ! Tally is on total nuclides else - score = ZERO + ! Get pointer to current material + mat => materials(p % material) ! Check if the delayed group filter is present if (dg_filter > 0) then - ! Loop over all delayed group bins and tally to them individually - do d_bin = 1, t % filters(dg_filter) % n_bins - d = t % filters(dg_filter) % int_bins(d_bin) - score = score + material_xs % delayed_nu_fission(d) * flux - call score_fission_delayed_dg(t, d_bin, score, score_index) + + do l = 1, mat % n_nuclides + ! Get atom density + atom_density_ = mat % atom_density(l) + ! Get index in nuclides array + i_nuc = mat % nuclide(l) + + ! Loop over all delayed group bins and tally to them individually + do d_bin = 1, t % filters(dg_filter) % n_bins + d = t % filters(dg_filter) % int_bins(d_bin) + nuc => nuclides(i_nuc) + yield = yield_delayed(nuc, p % E, d) + score = micro_xs(i_nuc) % delayed_nu_fission * yield & + * atom_density_ * flux + call score_fission_delayed_dg(t, d_bin, score, score_index) + end do end do cycle SCORE_LOOP else - do d = 1, MAX_DELAYED_GROUPS - score = score + material_xs % delayed_nu_fission(d) * flux + + score = ZERO + + do l = 1, mat % n_nuclides + ! Get atom density + atom_density_ = mat % atom_density(l) + ! Get index in nuclides array + i_nuc = mat % nuclide(l) + + score = score + micro_xs(i_nuc) % delayed_nu_fission & + * atom_density_ * flux end do end if end if @@ -985,9 +1008,9 @@ contains subroutine score_fission_delayed_eout(p, t, i_score) - type(Particle), intent(in) :: p - type(TallyObject), pointer :: t - integer, intent(in) :: i_score ! index for score + type(Particle), intent(in) :: p + type(TallyObject), intent(in) :: t + integer, intent(in) :: i_score ! index for score integer :: i ! index of outgoing energy filter integer :: j ! index of delayedgroup filter @@ -1070,9 +1093,9 @@ contains subroutine score_fission_delayed_dg(t, d_bin, score, score_index) - type(TallyObject), pointer :: t - integer, intent(in) :: score_index ! index for score - integer, intent(in) :: d_bin ! delayed group bin index + type(TallyObject) :: t + integer, intent(in) :: score_index ! index for score + integer, intent(in) :: d_bin ! delayed group bin index integer :: bin_original ! original bin index integer :: filter_index ! index for matching filter bin combination diff --git a/src/tracking.F90 b/src/tracking.F90 index e49b554ce..d02df8d09 100644 --- a/src/tracking.F90 +++ b/src/tracking.F90 @@ -165,10 +165,7 @@ contains ! Reset banked weight during collision p % n_bank = 0 p % wgt_bank = ZERO - - do d = 1, MAX_DELAYED_GROUPS - p % n_delayed_bank = 0 - end do + p % n_delayed_bank(:) = 0 ! Reset fission logical p % fission = .false. From c8c2593a84f4c85b9e8cd700f0a63df474546cea Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Mon, 12 Oct 2015 14:23:12 -0400 Subject: [PATCH 20/38] fixed source code style issues --- src/input_xml.F90 | 2 +- src/tally.F90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 62aad18f2..477013c82 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2940,7 +2940,7 @@ contains if (trim(score_name) /= 'delayed-nu-fission' .and. & t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally " // trim(score_name) // " with a & - &delayedgroup filter.") + &delayedgroup filter.") end if ! Check to see if the mu filter is applied and if that makes sense. diff --git a/src/tally.F90 b/src/tally.F90 index 69ccd07d2..5477159d5 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -527,7 +527,7 @@ contains nuc => nuclides(i_nuc) yield = yield_delayed(nuc, p % E, d) score = micro_xs(i_nuc) % delayed_nu_fission * yield & - * atom_density_ * flux + * atom_density_ * flux call score_fission_delayed_dg(t, d_bin, score, score_index) end do end do From 62ed2f1e41a00e50bb5d7cce59d178adaf4302f3 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Mon, 12 Oct 2015 15:01:21 -0400 Subject: [PATCH 21/38] updatd score delayed nu fission test --- src/input_xml.F90 | 17 ----------------- .../results_true.dat | 8 ++++---- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 477013c82..528ea40f5 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2973,7 +2973,6 @@ contains call fatal_error("Cannot tally flux with an outgoing energy & &filter.") end if - case ('flux-yn') ! Prohibit user from tallying flux for an individual nuclide if (.not. (t % n_nuclide_bins == 1 .and. & @@ -3008,17 +3007,14 @@ contains j = j + n_bins - 1 case ('scatter') - t % score_bins(j) = SCORE_SCATTER case ('nu-scatter') - t % score_bins(j) = SCORE_NU_SCATTER ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG case ('scatter-n') - if (n_order == 0) then t % score_bins(j) = SCORE_SCATTER else @@ -3029,7 +3025,6 @@ contains t % moment_order(j) = n_order case ('nu-scatter-n') - ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG if (n_order == 0) then @@ -3040,7 +3035,6 @@ contains t % moment_order(j) = n_order case ('scatter-pn') - t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_SCATTER_PN @@ -3048,7 +3042,6 @@ contains j = j + n_bins - 1 case ('nu-scatter-pn') - t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_NU_SCATTER_PN @@ -3056,7 +3049,6 @@ contains j = j + n_bins - 1 case ('scatter-yn') - t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_SCATTER_YN @@ -3064,7 +3056,6 @@ contains j = j + n_bins - 1 case ('nu-scatter-yn') - t % estimator = ESTIMATOR_ANALOG ! Setup P0:Pn t % score_bins(j : j + n_bins - 1) = SCORE_NU_SCATTER_YN @@ -3072,7 +3063,6 @@ contains j = j + n_bins - 1 case('transport') - t % score_bins(j) = SCORE_TRANSPORT ! Set tally estimator to analog @@ -3081,7 +3071,6 @@ contains call fatal_error("Diffusion score no longer supported for tallies, & &please remove") case ('n1n') - t % score_bins(j) = SCORE_N_1N ! Set tally estimator to analog @@ -3096,38 +3085,32 @@ contains t % score_bins(j) = N_4N case ('absorption') - t % score_bins(j) = SCORE_ABSORPTION if (t % find_filter(FILTER_ENERGYOUT) > 0) then call fatal_error("Cannot tally absorption rate with an outgoing & &energy filter.") end if case ('fission') - t % score_bins(j) = SCORE_FISSION if (t % find_filter(FILTER_ENERGYOUT) > 0) then call fatal_error("Cannot tally fission rate with an outgoing & &energy filter.") end if case ('nu-fission') - t % score_bins(j) = SCORE_NU_FISSION if (t % find_filter(FILTER_ENERGYOUT) > 0) then ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG end if case ('delayed-nu-fission') - t % score_bins(j) = SCORE_DELAYED_NU_FISSION if (t % find_filter(FILTER_ENERGYOUT) > 0) then ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG end if case ('kappa-fission') - t % score_bins(j) = SCORE_KAPPA_FISSION case ('current') - t % score_bins(j) = SCORE_CURRENT t % type = TALLY_SURFACE_CURRENT diff --git a/tests/test_score_delayed_nufission/results_true.dat b/tests/test_score_delayed_nufission/results_true.dat index 4af4a4961..88dd5435e 100644 --- a/tests/test_score_delayed_nufission/results_true.dat +++ b/tests/test_score_delayed_nufission/results_true.dat @@ -2,13 +2,13 @@ k-combined: 1.005983E+00 2.248579E-02 tally 1: 1.432287E-02 -4.518735E-05 +4.518736E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 1.531355E-02 -5.079890E-05 +5.079891E-05 tally 2: 1.576415E-02 2.485084E-04 @@ -20,10 +20,10 @@ tally 2: 0.000000E+00 tally 3: 1.365224E-02 -3.952118E-05 +3.952119E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 1.442838E-02 -4.559807E-05 +4.559808E-05 From 129ca7b46c91977e9d6c44c701d014021b84608f Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Mon, 12 Oct 2015 16:12:25 -0400 Subject: [PATCH 22/38] fixed errors in comments --- src/ace.F90 | 2 +- src/cross_section.F90 | 2 -- src/fission.F90 | 6 +++--- src/physics.F90 | 22 +++++++++++----------- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index 91653195b..47f7c008b 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -1417,7 +1417,7 @@ contains ! determine energy E = nuc % energy(i) - ! determine total nu at given energy + ! determine nu delayed at given energy nu_d = nu_delayed(nuc, E) ! determine delayed-nu-fission microscopic cross section diff --git a/src/cross_section.F90 b/src/cross_section.F90 index 1b94a1049..24f48c570 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -70,7 +70,6 @@ contains ! Add contribution from each nuclide in material do i = 1, mat % n_nuclides - ! ======================================================================== ! CHECK FOR S(A,B) TABLE @@ -259,7 +258,6 @@ contains micro_xs(i_nuclide) % delayed_nu_fission = (ONE - f) * & nuc % delayed_nu_fission(i_grid) + f * & nuc % delayed_nu_fission(i_grid+1) - end if ! If there is S(a,b) data for this nuclide, we need to do a few diff --git a/src/fission.F90 b/src/fission.F90 index 2624672d1..c91d595e2 100644 --- a/src/fission.F90 +++ b/src/fission.F90 @@ -63,7 +63,7 @@ contains ! since no prompt or delayed data is present, this means all neutron ! emission is prompt -- WARNING: This currently returns zero. The calling ! routine needs to know this situation is occurring since we don't want - ! to call nu_total unnecessarily if it's already been called. + ! to call nu_total unnecessarily if it has already been called. nu = ZERO elseif (nuc % nu_p_type == NU_POLYNOMIAL) then ! determine number of coefficients @@ -97,7 +97,7 @@ contains ! since no prompt or delayed data is present, this means all neutron ! emission is prompt -- WARNING: This currently returns zero. The calling ! routine needs to know this situation is occurring since we don't want - ! to call nu_delayed unnecessarily if it's already been called. + ! to call nu_delayed unnecessarily if it has already been called. nu = ZERO elseif (nuc % nu_d_type == NU_TABULAR) then ! use ENDF interpolation laws to determine nu @@ -132,7 +132,7 @@ contains ! since no prompt or delayed data is present, this means all neutron ! emission is prompt -- WARNING: This currently returns zero. The calling ! routine needs to know this situation is occurring since we don't want - ! to call yield unnecessarily if it's already been called. + ! to call yield unnecessarily if it has already been called. yield = ZERO else if (nuc % nu_d_type == NU_TABULAR) then diff --git a/src/physics.F90 b/src/physics.F90 index 3bf0a4366..569b89bb0 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -1063,16 +1063,16 @@ contains integer, intent(in) :: i_nuclide integer, intent(in) :: i_reaction - integer :: d ! delayed group index - integer :: nu_d(MAX_DELAYED_GROUPS) ! number of delayed neutrons born - integer :: i ! loop index - integer :: nu ! actual number of neutrons produced - integer :: ijk(3) ! indices in ufs mesh - real(8) :: nu_t ! total nu - real(8) :: mu ! fission neutron angular cosine - real(8) :: phi ! fission neutron azimuthal angle - real(8) :: weight ! weight adjustment for ufs method - logical :: in_mesh ! source site in ufs mesh? + integer :: d ! delayed group index + integer :: nu_d(MAX_DELAYED_GROUPS) ! number of delayed neutrons born + integer :: i ! loop index + integer :: nu ! actual number of neutrons produced + integer :: ijk(3) ! indices in ufs mesh + real(8) :: nu_t ! total nu + real(8) :: mu ! fission neutron angular cosine + real(8) :: phi ! fission neutron azimuthal angle + real(8) :: weight ! weight adjustment for ufs method + logical :: in_mesh ! source site in ufs mesh? type(Nuclide), pointer :: nuc type(Reaction), pointer :: rxn @@ -1178,7 +1178,7 @@ contains type(Nuclide), pointer :: nuc type(Reaction), pointer :: rxn - type(Particle), intent(inout) :: p ! Particle caussing fission + type(Particle), intent(inout) :: p ! Particle causing fission real(8) :: E_out ! outgoing energy of fission neutron integer :: j ! index on nu energy grid / precursor group From 61f2fb6e6738b69350135eae2d93376ab39d60f1 Mon Sep 17 00:00:00 2001 From: samuel shaner Date: Tue, 13 Oct 2015 14:22:43 +0000 Subject: [PATCH 23/38] removed computation of delayed-nu-fission in cross_section.F90 --- examples/xml/lattice/simple/settings.xml | 2 +- src/ace.F90 | 32 +----------------------- src/ace_header.F90 | 7 ++---- src/cross_section.F90 | 15 ++--------- src/tally.F90 | 32 +++++++++++++----------- 5 files changed, 24 insertions(+), 64 deletions(-) diff --git a/examples/xml/lattice/simple/settings.xml b/examples/xml/lattice/simple/settings.xml index 2a6aaaf42..d1c9fd5b6 100644 --- a/examples/xml/lattice/simple/settings.xml +++ b/examples/xml/lattice/simple/settings.xml @@ -5,7 +5,7 @@ 20 10 - 10000 + 1000000 diff --git a/src/ace.F90 b/src/ace.F90 index 91653195b..d70c50259 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -5,7 +5,7 @@ module ace use constants use endf, only: reaction_name, is_fission, is_disappearance use error, only: fatal_error, warning - use fission, only: nu_total, nu_delayed + use fission, only: nu_total use global use list_header, only: ListInt use material_header, only: Material @@ -375,7 +375,6 @@ contains if (nuc % fissionable .and. .not. data_0K) then call generate_nu_fission(nuc) - call generate_delayed_nu_fission(nuc) end if case (ACE_THERMAL) @@ -462,7 +461,6 @@ contains allocate(nuc % fission(NE)) allocate(nuc % nu_fission(NE)) allocate(nuc % absorption(NE)) - allocate(nuc % delayed_nu_fission(NE)) ! initialize cross sections nuc % total = ZERO @@ -470,7 +468,6 @@ contains nuc % fission = ZERO nuc % nu_fission = ZERO nuc % absorption = ZERO - nuc % delayed_nu_fission = ZERO ! Read data from XSS -- only the energy grid, elastic scattering and heating ! cross section values are actually read from here. The total and absorption @@ -1399,33 +1396,6 @@ contains end subroutine generate_nu_fission -!=============================================================================== -! GENERATE_DELAYED_NU_FISSION precalculates the microscopic delayed-nu-fission -! cross section for a given nuclide. This is done so that the nu_delayed -! function does not need to be called during cross section lookups. -!=============================================================================== - - subroutine generate_delayed_nu_fission(nuc) - - type(Nuclide), pointer :: nuc - - integer :: i ! index on nuclide energy grid - real(8) :: E ! energy - real(8) :: nu_d ! # of neutrons per fission - - do i = 1, nuc % n_grid - ! determine energy - E = nuc % energy(i) - - ! determine total nu at given energy - nu_d = nu_delayed(nuc, E) - - ! determine delayed-nu-fission microscopic cross section - nuc % delayed_nu_fission(i) = nu_d * nuc % fission(i) - end do - - end subroutine generate_delayed_nu_fission - !=============================================================================== ! READ_THERMAL_DATA reads elastic and inelastic cross sections and corresponding ! secondary energy/angle distributions derived from experimental S(a,b) diff --git a/src/ace_header.F90 b/src/ace_header.F90 index 8acefba10..97c598161 100644 --- a/src/ace_header.F90 +++ b/src/ace_header.F90 @@ -1,6 +1,6 @@ module ace_header - use constants, only: MAX_FILE_LEN, ZERO, MAX_DELAYED_GROUPS + use constants, only: MAX_FILE_LEN, ZERO use endf_header, only: Tab1 use list_header, only: ListInt @@ -113,7 +113,6 @@ module ace_header real(8), allocatable :: nu_fission(:) ! neutron production real(8), allocatable :: absorption(:) ! absorption (MT > 100) real(8), allocatable :: heating(:) ! heating - real(8), allocatable :: delayed_nu_fission(:) ! delayed neutron production ! Resonance scattering info logical :: resonant = .false. ! resonant scatterer? @@ -267,7 +266,6 @@ module ace_header real(8) :: fission ! microscopic fission xs real(8) :: nu_fission ! microscopic production xs real(8) :: kappa_fission ! microscopic energy-released from fission - real(8) :: delayed_nu_fission ! microscopic delayed production xs ! Information for S(a,b) use integer :: index_sab ! index in sab_tables (zero means no table) @@ -376,8 +374,7 @@ module ace_header if (allocated(this % energy)) & deallocate(this % energy, this % total, this % elastic, & - & this % fission, this % nu_fission, this % absorption, & - this % delayed_nu_fission) + & this % fission, this % nu_fission, this % absorption) if (allocated(this % energy_0K)) & deallocate(this % energy_0K) diff --git a/src/cross_section.F90 b/src/cross_section.F90 index 1b94a1049..c5aa62150 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -4,7 +4,7 @@ module cross_section use constants use energy_grid, only: grid_method, log_spacing use error, only: fatal_error - use fission, only: nu_total, nu_delayed, yield_delayed + use fission, only: nu_total use global use list_header, only: ListElemInt use material_header, only: Material @@ -33,10 +33,8 @@ contains integer :: i_nuclide ! index into nuclides array integer :: i_sab ! index into sab_tables array integer :: j ! index in mat % i_sab_nuclides - integer :: d ! index for delayed precursor groups integer :: u ! index into logarithmic mapping array real(8) :: atom_density ! atom density of a nuclide - real(8) :: yield ! delayed neutron yield logical :: check_sab ! should we check for S(a,b) table? type(Material), pointer :: mat ! current material type(Nuclide), pointer :: nuc ! current nuclide @@ -225,7 +223,6 @@ contains micro_xs(i_nuclide) % fission = ZERO micro_xs(i_nuclide) % nu_fission = ZERO micro_xs(i_nuclide) % kappa_fission = ZERO - micro_xs(i_nuclide) % delayed_nu_fission = ZERO ! Calculate microscopic nuclide total cross section micro_xs(i_nuclide) % total = (ONE - f) * nuc % total(i_grid) & @@ -254,12 +251,6 @@ contains micro_xs(i_nuclide) % kappa_fission = & nuc % reactions(nuc % index_fission(1)) % Q_value * & micro_xs(i_nuclide) % fission - - ! Calculate microscopic nuclide delayed nu-fission cross section - micro_xs(i_nuclide) % delayed_nu_fission = (ONE - f) * & - nuc % delayed_nu_fission(i_grid) + f * & - nuc % delayed_nu_fission(i_grid+1) - end if ! If there is S(a,b) data for this nuclide, we need to do a few @@ -525,12 +516,10 @@ contains micro_xs(i_nuclide) % fission = fission micro_xs(i_nuclide) % total = elastic + inelastic + capture + fission - ! Determine nu-fission and delayed nu-fission cross section + ! Determine nu-fission cross section if (nuc % fissionable) then micro_xs(i_nuclide) % nu_fission = nu_total(nuc, E) * & micro_xs(i_nuclide) % fission - micro_xs(i_nuclide) % delayed_nu_fission = nu_delayed(nuc, E) * & - micro_xs(i_nuclide) % fission end if end subroutine calculate_urr_xs diff --git a/src/tally.F90 b/src/tally.F90 index 5477159d5..5311e767e 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -432,6 +432,9 @@ contains ! nu-fission if (micro_xs(p % event_nuclide) % absorption > ZERO) then + ! Get the event nuclide + nuc => nuclides(p % event_nuclide) + ! Check if the delayed group filter is present if (dg_filter > 0) then @@ -439,18 +442,17 @@ contains ! individually do d_bin = 1, n_bins d = t % filters(dg_filter) % int_bins(d_bin) - nuc => nuclides(p % event_nuclide) yield = yield_delayed(nuc, p % E, d) score = p % absorb_wgt * yield * micro_xs(p % event_nuclide) & - % delayed_nu_fission / micro_xs(p % event_nuclide) & - % absorption + % fission * nu_delayed(nuc, p % E) / & + micro_xs(p % event_nuclide) % absorption call score_fission_delayed_dg(t, d_bin, score, score_index) end do cycle SCORE_LOOP else score = p % absorb_wgt * micro_xs(p % event_nuclide) & - % delayed_nu_fission / micro_xs(p % event_nuclide) & - % absorption + % fission * nu_delayed(nuc, p % E) / & + micro_xs(p % event_nuclide) % absorption end if end if else @@ -488,21 +490,23 @@ contains ! Check if tally is on a single nuclide if (i_nuclide > 0) then + ! Get the nuclide of interest + nuc => nuclides(i_nuclide) + ! Check if the delayed group filter is present if (dg_filter > 0) then ! Loop over all delayed group bins and tally to them individually do d_bin = 1, t % filters(dg_filter) % n_bins d = t % filters(dg_filter) % int_bins(d_bin) - nuc => nuclides(i_nuclide) yield = yield_delayed(nuc, p % E, d) - score = micro_xs(i_nuclide) % delayed_nu_fission * yield & - * atom_density * flux + score = micro_xs(i_nuclide) % fission * yield & + * nu_delayed(nuc, p % E) * atom_density * flux call score_fission_delayed_dg(t, d_bin, score, score_index) end do cycle SCORE_LOOP else - score = micro_xs(i_nuclide) % delayed_nu_fission & + score = micro_xs(i_nuclide) % fission * nu_delayed(nuc, p % E)& * atom_density * flux end if @@ -526,8 +530,8 @@ contains d = t % filters(dg_filter) % int_bins(d_bin) nuc => nuclides(i_nuc) yield = yield_delayed(nuc, p % E, d) - score = micro_xs(i_nuc) % delayed_nu_fission * yield & - * atom_density_ * flux + score = micro_xs(i_nuc) % fission * yield & + * nu_delayed(nuc, p % E) * atom_density_ * flux call score_fission_delayed_dg(t, d_bin, score, score_index) end do end do @@ -541,9 +545,9 @@ contains atom_density_ = mat % atom_density(l) ! Get index in nuclides array i_nuc = mat % nuclide(l) - - score = score + micro_xs(i_nuc) % delayed_nu_fission & - * atom_density_ * flux + nuc => nuclides(i_nuc) + score = score + micro_xs(i_nuc) % fission & + * nu_delayed(nuc, p % E) * atom_density_ * flux end do end if end if From 2473011734fa31279a2ae73afd1cf7e3a560c0c3 Mon Sep 17 00:00:00 2001 From: samuel shaner Date: Tue, 13 Oct 2015 14:36:09 +0000 Subject: [PATCH 24/38] reverted simple lattice settings.xml to version in develop --- examples/xml/lattice/simple/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/xml/lattice/simple/settings.xml b/examples/xml/lattice/simple/settings.xml index d1c9fd5b6..2a6aaaf42 100644 --- a/examples/xml/lattice/simple/settings.xml +++ b/examples/xml/lattice/simple/settings.xml @@ -5,7 +5,7 @@ 20 10 - 1000000 + 10000 From f9340464bb667fc4fa32f3790939804928157c3a Mon Sep 17 00:00:00 2001 From: samuel shaner Date: Tue, 13 Oct 2015 14:40:21 +0000 Subject: [PATCH 25/38] reverted ace_header.F90 and cross_section.F90 to versions in develop --- src/ace_header.F90 | 32 ++++++++++++++++---------------- src/cross_section.F90 | 2 -- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/ace_header.F90 b/src/ace_header.F90 index 97c598161..467887c19 100644 --- a/src/ace_header.F90 +++ b/src/ace_header.F90 @@ -107,12 +107,12 @@ module ace_header real(8), allocatable :: energy(:) ! energy values corresponding to xs ! Microscopic cross sections - real(8), allocatable :: total(:) ! total cross section - real(8), allocatable :: elastic(:) ! elastic scattering - real(8), allocatable :: fission(:) ! fission - real(8), allocatable :: nu_fission(:) ! neutron production - real(8), allocatable :: absorption(:) ! absorption (MT > 100) - real(8), allocatable :: heating(:) ! heating + real(8), allocatable :: total(:) ! total cross section + real(8), allocatable :: elastic(:) ! elastic scattering + real(8), allocatable :: fission(:) ! fission + real(8), allocatable :: nu_fission(:) ! neutron production + real(8), allocatable :: absorption(:) ! absorption (MT > 100) + real(8), allocatable :: heating(:) ! heating ! Resonance scattering info logical :: resonant = .false. ! resonant scatterer? @@ -256,16 +256,16 @@ module ace_header !=============================================================================== type NuclideMicroXS - integer :: index_grid ! index on nuclide energy grid - integer :: index_temp ! temperature index for nuclide - real(8) :: last_E = ZERO ! last evaluated energy - real(8) :: interp_factor ! interpolation factor on nuc. energy grid - real(8) :: total ! microscropic total xs - real(8) :: elastic ! microscopic elastic scattering xs - real(8) :: absorption ! microscopic absorption xs - real(8) :: fission ! microscopic fission xs - real(8) :: nu_fission ! microscopic production xs - real(8) :: kappa_fission ! microscopic energy-released from fission + integer :: index_grid ! index on nuclide energy grid + integer :: index_temp ! temperature index for nuclide + real(8) :: last_E = ZERO ! last evaluated energy + real(8) :: interp_factor ! interpolation factor on nuc. energy grid + real(8) :: total ! microscropic total xs + real(8) :: elastic ! microscopic elastic scattering xs + real(8) :: absorption ! microscopic absorption xs + real(8) :: fission ! microscopic fission xs + real(8) :: nu_fission ! microscopic production xs + real(8) :: kappa_fission ! microscopic energy-released from fission ! Information for S(a,b) use integer :: index_sab ! index in sab_tables (zero means no table) diff --git a/src/cross_section.F90 b/src/cross_section.F90 index 2d001934c..4d8fb2f0f 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -37,7 +37,6 @@ contains real(8) :: atom_density ! atom density of a nuclide logical :: check_sab ! should we check for S(a,b) table? type(Material), pointer :: mat ! current material - type(Nuclide), pointer :: nuc ! current nuclide ! Set all material macroscopic cross sections to zero material_xs % total = ZERO @@ -97,7 +96,6 @@ contains ! Determine microscopic cross sections for this nuclide i_nuclide = mat % nuclide(i) - nuc => nuclides(i_nuclide) ! Calculate microscopic cross section for this nuclide if (p % E /= micro_xs(i_nuclide) % last_E) then From 0b7ee32a88d0de0f0ece2c99fc8aa566aca42b5c Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Tue, 13 Oct 2015 11:13:40 -0400 Subject: [PATCH 26/38] fixed values id delayedgroup and delayed-nu-fission tests --- tests/test_filter_delayedgroup/results_true.dat | 10 +++++----- .../results_true.dat | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/test_filter_delayedgroup/results_true.dat b/tests/test_filter_delayedgroup/results_true.dat index d6ba0cb6c..f44821a23 100644 --- a/tests/test_filter_delayedgroup/results_true.dat +++ b/tests/test_filter_delayedgroup/results_true.dat @@ -1,14 +1,14 @@ k-combined: 1.005983E+00 2.248579E-02 tally 1: -6.113115E-04 -7.519723E-08 +6.113116E-04 +7.519725E-08 3.155402E-03 2.003485E-06 3.012421E-03 -1.826030E-06 -6.754096E-03 -9.179334E-06 +1.826031E-06 +6.754097E-03 +9.179336E-06 2.769084E-03 1.542940E-06 1.159960E-03 diff --git a/tests/test_score_delayed_nufission/results_true.dat b/tests/test_score_delayed_nufission/results_true.dat index 88dd5435e..6818f88e4 100644 --- a/tests/test_score_delayed_nufission/results_true.dat +++ b/tests/test_score_delayed_nufission/results_true.dat @@ -1,14 +1,14 @@ k-combined: 1.005983E+00 2.248579E-02 tally 1: -1.432287E-02 -4.518736E-05 +1.432292E-02 +4.518762E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.531355E-02 -5.079891E-05 +1.531359E-02 +5.079909E-05 tally 2: 1.576415E-02 2.485084E-04 @@ -19,11 +19,11 @@ tally 2: 0.000000E+00 0.000000E+00 tally 3: -1.365224E-02 -3.952119E-05 +1.369800E-02 +3.974018E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.442838E-02 -4.559808E-05 +1.447073E-02 +4.579588E-05 From 133bbb510b08f84f84758e2c12c292e0a2264246 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Fri, 16 Oct 2015 08:41:32 -0400 Subject: [PATCH 27/38] added comments to delayed-nu-fission tally --- src/fission.F90 | 17 +++++++++------- src/tally.F90 | 54 +++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 56 insertions(+), 15 deletions(-) diff --git a/src/fission.F90 b/src/fission.F90 index c91d595e2..f69ffc962 100644 --- a/src/fission.F90 +++ b/src/fission.F90 @@ -132,25 +132,28 @@ contains ! since no prompt or delayed data is present, this means all neutron ! emission is prompt -- WARNING: This currently returns zero. The calling ! routine needs to know this situation is occurring since we don't want - ! to call yield unnecessarily if it has already been called. + ! to call yield_delayed unnecessarily if it has already been called. yield = ZERO else if (nuc % nu_d_type == NU_TABULAR) then lc = 1 - ! determine the yield for this group + ! loop over delayed groups and determine the yield for the desired group do d = 1, nuc % n_precursor ! determine number of interpolation regions and energies NR = int(nuc % nu_d_precursor_data(lc + 1)) NE = int(nuc % nu_d_precursor_data(lc + 2 + 2*NR)) - ! determine delayed neutron precursor yield for group d - yield = interpolate_tab1(nuc % nu_d_precursor_data( & - lc+1:lc+2+2*NR+2*NE), E) + ! check if this is the desired group + if (d == g) then - ! Check if this group is the requested group - if (d == g) exit + ! determine delayed neutron precursor yield for group g + yield = interpolate_tab1(nuc % nu_d_precursor_data( & + lc+1:lc+2+2*NR+2*NE), E) + + exit + end if ! advance pointer lc = lc + 2 + 2*NR + 2*NE + 1 diff --git a/src/tally.F90 b/src/tally.F90 index 5311e767e..87102d224 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -57,7 +57,6 @@ contains integer :: score_index ! scoring bin index integer :: d ! delayed neutron index integer :: d_bin ! delayed group bin index - integer :: n_bins ! number of delayed group bins integer :: i_filter ! filter index integer :: dg_filter ! index of delayed group filter real(8) :: yield ! delayed neutron yield @@ -408,11 +407,6 @@ contains ! Set the delayedgroup filter index and the number of delayed group bins dg_filter = t % find_filter(FILTER_DELAYEDGROUP) - n_bins = 0 - - if (dg_filter > 0) then - n_bins = t % filters(dg_filter) % n_bins - end if if (t % estimator == ESTIMATOR_ANALOG) then if (survival_biasing .or. p % fission) then @@ -429,7 +423,7 @@ contains if (survival_biasing) then ! No fission events occur if survival biasing is on -- need to ! calculate fraction of absorptions that would have resulted in - ! nu-fission + ! delayed-nu-fission if (micro_xs(p % event_nuclide) % absorption > ZERO) then ! Get the event nuclide @@ -440,9 +434,15 @@ contains ! Loop over all delayed group bins and tally to them ! individually - do d_bin = 1, n_bins + do d_bin = 1, t % filters(dg_filter) % n_bins + + ! Get the delayed group for this bin d = t % filters(dg_filter) % int_bins(d_bin) + + ! Compute the yield for this delayed group yield = yield_delayed(nuc, p % E, d) + + ! Compute the score and tally to bin score = p % absorb_wgt * yield * micro_xs(p % event_nuclide) & % fission * nu_delayed(nuc, p % E) / & micro_xs(p % event_nuclide) % absorption @@ -450,6 +450,9 @@ contains end do cycle SCORE_LOOP else + ! If the delayed group filter is not present, compute the score + ! by multiplying the absorbed weight by the fraction of the + ! delayed-nu-fission xs to the absorption xs score = p % absorb_wgt * micro_xs(p % event_nuclide) & % fission * nu_delayed(nuc, p % E) / & micro_xs(p % event_nuclide) % absorption @@ -472,13 +475,21 @@ contains ! Loop over all delayed group bins and tally to them individually do d_bin = 1, t % filters(dg_filter) % n_bins + + ! Get the delayed group for this bin d = t % filters(dg_filter) % int_bins(d_bin) + + ! Compute the score and tally to bin score = keff * p % wgt_bank / p % n_bank * p % n_delayed_bank(d) call score_fission_delayed_dg(t, d_bin, score, score_index) end do cycle SCORE_LOOP else + score = ZERO + + ! Loop over all delayed groups and accumulate the contribution + ! from each group do d = 1, nuclides(p % event_nuclide) % n_precursor score = score + keff * p % wgt_bank / p % n_bank * & p % n_delayed_bank(d) @@ -498,14 +509,23 @@ contains ! Loop over all delayed group bins and tally to them individually do d_bin = 1, t % filters(dg_filter) % n_bins + + ! Get the delayed group for this bin d = t % filters(dg_filter) % int_bins(d_bin) + + ! Compute the yield for this delayed group yield = yield_delayed(nuc, p % E, d) + + ! Compute the score and tally to bin score = micro_xs(i_nuclide) % fission * yield & * nu_delayed(nuc, p % E) * atom_density * flux call score_fission_delayed_dg(t, d_bin, score, score_index) end do cycle SCORE_LOOP else + + ! If the delayed group filter is not present, compute the score + ! by multiplying the delayed-nu-fission macro xs by the flux score = micro_xs(i_nuclide) % fission * nu_delayed(nuc, p % E)& * atom_density * flux end if @@ -519,17 +539,28 @@ contains ! Check if the delayed group filter is present if (dg_filter > 0) then + ! Loop over all nuclides in the current material do l = 1, mat % n_nuclides + ! Get atom density atom_density_ = mat % atom_density(l) + ! Get index in nuclides array i_nuc = mat % nuclide(l) ! Loop over all delayed group bins and tally to them individually do d_bin = 1, t % filters(dg_filter) % n_bins + + ! Get the delayed group for this bin d = t % filters(dg_filter) % int_bins(d_bin) + + ! Get the current nuclide nuc => nuclides(i_nuc) + + ! Get the yield for the desired nuclide and delayed group yield = yield_delayed(nuc, p % E, d) + + ! Compute the score and tally to bin score = micro_xs(i_nuc) % fission * yield & * nu_delayed(nuc, p % E) * atom_density_ * flux call score_fission_delayed_dg(t, d_bin, score, score_index) @@ -540,12 +571,19 @@ contains score = ZERO + ! Loop over all nuclides in the current material do l = 1, mat % n_nuclides + ! Get atom density atom_density_ = mat % atom_density(l) + ! Get index in nuclides array i_nuc = mat % nuclide(l) + + ! Get the current nuclide nuc => nuclides(i_nuc) + + ! Accumulate the contribution from each nuclide score = score + micro_xs(i_nuc) % fission & * nu_delayed(nuc, p % E) * atom_density_ * flux end do From 3dd1292111e708cdffaecbfa1211f38f898d9440 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Fri, 16 Oct 2015 08:45:31 -0400 Subject: [PATCH 28/38] fixed syntax error in documentation --- docs/source/usersguide/input.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index 4f8e4b6c0..0c10756ba 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -1387,7 +1387,7 @@ The ```` element accepts the following sub-elements: "nu-fission", "delayed-nu-fission", "kappa-fission", "nu-scatter", "scatter-N", "scatter-PN", "scatter-YN", "nu-scatter-N", "nu-scatter-PN", "nu-scatter-YN", "flux-YN", "total-YN", "current", and "events". These - corresponding to the following physical quantities: + correspond to the following physical quantities: :flux: Total flux in particle-cm per source particle. Note: The ``analog`` From 4e75a2e15cf16c5dbfeb22ccd8bf95a6ca37fde3 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Fri, 16 Oct 2015 10:55:00 -0400 Subject: [PATCH 29/38] removed unnecessary variables and includes in tally and tracking --- src/tally.F90 | 5 +---- src/tracking.F90 | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/tally.F90 b/src/tally.F90 index 87102d224..7ad174c9b 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -57,7 +57,6 @@ contains integer :: score_index ! scoring bin index integer :: d ! delayed neutron index integer :: d_bin ! delayed group bin index - integer :: i_filter ! filter index integer :: dg_filter ! index of delayed group filter real(8) :: yield ! delayed neutron yield real(8) :: atom_density_ ! atom/b-cm @@ -1058,12 +1057,10 @@ contains integer :: j ! index of delayedgroup filter integer :: d ! delayed group integer :: g ! another delayed group - integer :: d_bin = 1 ! delayed group bin index + integer :: d_bin ! delayed group bin index integer :: n ! number of energies on filter integer :: k ! loop index for bank sites integer :: bin_energyout ! original outgoing energy bin - integer :: bin_delayedgroup ! original delayedgroup bin - integer :: i_filter ! index for matching filter bin combination real(8) :: score ! actual score real(8) :: E_out ! energy of fission bank site logical :: d_found = .FALSE. ! bool to inidicate if delayed group was found diff --git a/src/tracking.F90 b/src/tracking.F90 index d02df8d09..391199bc0 100644 --- a/src/tracking.F90 +++ b/src/tracking.F90 @@ -16,7 +16,6 @@ module tracking score_collision_tally, score_surface_current use track_output, only: initialize_particle_track, write_particle_track, & add_particle_track, finalize_particle_track - use constants, only: MAX_DELAYED_GROUPS implicit none From 37c4d9fa897cc661678fdfbfc9c5adb9148371dd Mon Sep 17 00:00:00 2001 From: samuel shaner Date: Tue, 20 Oct 2015 15:35:14 +0000 Subject: [PATCH 30/38] fixed issue with statepoint.py modifying delayed-nu-fission score --- openmc/statepoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmc/statepoint.py b/openmc/statepoint.py index 133bd766c..4279133e9 100644 --- a/openmc/statepoint.py +++ b/openmc/statepoint.py @@ -431,7 +431,7 @@ class StatePoint(object): for j, score in enumerate(scores): score = score.decode() # If this is a scattering moment, insert the scattering order - if '-n' in score: + if '-n' in score and 'delayed' not in score: score = score.replace('-n', '-' + moments[j].decode()) elif '-pn' in score: score = score.replace('-pn', '-' + moments[j].decode()) From 4fcdd7f0d67d80cf1306fa674a2505ae71a99b4b Mon Sep 17 00:00:00 2001 From: samuel shaner Date: Tue, 20 Oct 2015 17:55:17 +0000 Subject: [PATCH 31/38] added summary output of delayedgroup filter type --- src/summary.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/summary.F90 b/src/summary.F90 index f3edbe719..f088cb7bb 100644 --- a/src/summary.F90 +++ b/src/summary.F90 @@ -575,6 +575,8 @@ contains call write_dataset(filter_group, "type", "polar") case(FILTER_AZIMUTHAL) call write_dataset(filter_group, "type", "azimuthal") + case(FILTER_DELAYEDGROUP) + call write_dataset(filter_group, "type", "delayedgroup") end select call close_group(filter_group) From 82483b64901618639ec3929b08557315e6b72db1 Mon Sep 17 00:00:00 2001 From: samuel shaner Date: Tue, 20 Oct 2015 19:46:59 +0000 Subject: [PATCH 32/38] generalized the insertion of the momemt order in statepoint.py --- openmc/statepoint.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/openmc/statepoint.py b/openmc/statepoint.py index 4279133e9..c551346da 100644 --- a/openmc/statepoint.py +++ b/openmc/statepoint.py @@ -1,6 +1,6 @@ import copy import sys - +import re import numpy as np import openmc @@ -429,14 +429,12 @@ class StatePoint(object): # Add the scores to the Tally for j, score in enumerate(scores): - score = score.decode() - # If this is a scattering moment, insert the scattering order - if '-n' in score and 'delayed' not in score: - score = score.replace('-n', '-' + moments[j].decode()) - elif '-pn' in score: - score = score.replace('-pn', '-' + moments[j].decode()) - elif '-yn' in score: - score = score.replace('-yn', '-' + moments[j].decode()) + + # If this is a moment, use generic moment order + regexp = re.compile(r'-n$|-pn$|-yn$') + if regexp.search(score) is not None: + score = score.strip(regexp.findall(score)[0]) + score += '-' + moments[j] tally.add_score(score) From 7670e3847e0cd4f9586a636291584a9717aff6e7 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Wed, 21 Oct 2015 11:59:04 -0400 Subject: [PATCH 33/38] modified regular expression code to be python 3 compatible --- openmc/statepoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmc/statepoint.py b/openmc/statepoint.py index c551346da..014830d58 100644 --- a/openmc/statepoint.py +++ b/openmc/statepoint.py @@ -434,7 +434,7 @@ class StatePoint(object): regexp = re.compile(r'-n$|-pn$|-yn$') if regexp.search(score) is not None: score = score.strip(regexp.findall(score)[0]) - score += '-' + moments[j] + score += '-' + moments[j].decode() tally.add_score(score) From 370a0f2677d0dae641901491ccda04fd138d4760 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Wed, 21 Oct 2015 12:04:54 -0400 Subject: [PATCH 34/38] added decoding of score in statepoint.py --- openmc/statepoint.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openmc/statepoint.py b/openmc/statepoint.py index 014830d58..e7e8d8e08 100644 --- a/openmc/statepoint.py +++ b/openmc/statepoint.py @@ -429,6 +429,7 @@ class StatePoint(object): # Add the scores to the Tally for j, score in enumerate(scores): + score = score.decode() # If this is a moment, use generic moment order regexp = re.compile(r'-n$|-pn$|-yn$') From deccc6a82d18943bacd614b0f3a3d7954579c8fb Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Thu, 22 Oct 2015 21:00:45 -0400 Subject: [PATCH 35/38] updated tests so input files are generated with openmc API --- tests/test_filter_delayedgroup/geometry.xml | 181 ------------ .../test_filter_delayedgroup/inputs_true.dat | 1 + tests/test_filter_delayedgroup/materials.xml | 272 ------------------ .../test_filter_delayedgroup/results_true.dat | 26 +- tests/test_filter_delayedgroup/settings.xml | 19 -- tests/test_filter_delayedgroup/tallies.xml | 10 - .../test_filter_delayedgroup.py | 26 +- .../test_score_delayed_nufission/geometry.xml | 181 ------------ .../inputs_true.dat | 1 + .../materials.xml | 272 ------------------ .../results_true.dat | 22 +- .../test_score_delayed_nufission/settings.xml | 19 -- .../test_score_delayed_nufission/tallies.xml | 21 -- .../test_score_delayed_nufission.py | 28 +- 14 files changed, 74 insertions(+), 1005 deletions(-) delete mode 100644 tests/test_filter_delayedgroup/geometry.xml create mode 100644 tests/test_filter_delayedgroup/inputs_true.dat delete mode 100644 tests/test_filter_delayedgroup/materials.xml delete mode 100644 tests/test_filter_delayedgroup/settings.xml delete mode 100644 tests/test_filter_delayedgroup/tallies.xml delete mode 100644 tests/test_score_delayed_nufission/geometry.xml create mode 100644 tests/test_score_delayed_nufission/inputs_true.dat delete mode 100644 tests/test_score_delayed_nufission/materials.xml delete mode 100644 tests/test_score_delayed_nufission/settings.xml delete mode 100644 tests/test_score_delayed_nufission/tallies.xml diff --git a/tests/test_filter_delayedgroup/geometry.xml b/tests/test_filter_delayedgroup/geometry.xml deleted file mode 100644 index b85dd04df..000000000 --- a/tests/test_filter_delayedgroup/geometry.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 17 - -10.71 -10.71 - 1.26 1.26 - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 - 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 - 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - - - - - - 17 17 - -10.71 -10.71 - 1.26 1.26 - - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 3 3 4 3 3 4 3 3 4 3 3 3 3 3 - 3 3 3 4 3 3 3 3 3 3 3 3 3 4 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 4 3 3 3 3 3 3 3 3 3 4 3 3 3 - 3 3 3 3 3 4 3 3 4 3 3 4 3 3 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - 21 21 - -224.91 -224.91 - 21.42 21.42 - - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 6 6 6 6 6 6 6 5 5 5 5 5 5 5 - 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 - 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 - 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 - 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 - 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 - 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 - 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 - 5 5 5 5 5 5 5 6 6 6 6 6 6 6 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - - - - - - 21 21 - -224.91 -224.91 - 21.42 21.42 - - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 - 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 - 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 - 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 - 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - diff --git a/tests/test_filter_delayedgroup/inputs_true.dat b/tests/test_filter_delayedgroup/inputs_true.dat new file mode 100644 index 000000000..21bce00fd --- /dev/null +++ b/tests/test_filter_delayedgroup/inputs_true.dat @@ -0,0 +1 @@ +e771470681d3b4af57a70d148f5eb728df57f1fd7bdb5d6f76ac556b69f10bf0cdd5645fe488f1e17f07cbb72e9fb34af2fd7ede95c8e39c5ffa6ea9b6c5810e \ No newline at end of file diff --git a/tests/test_filter_delayedgroup/materials.xml b/tests/test_filter_delayedgroup/materials.xml deleted file mode 100644 index 9c0b74f3f..000000000 --- a/tests/test_filter_delayedgroup/materials.xml +++ /dev/null @@ -1,272 +0,0 @@ - - - - 71c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_filter_delayedgroup/results_true.dat b/tests/test_filter_delayedgroup/results_true.dat index f44821a23..9db6de256 100644 --- a/tests/test_filter_delayedgroup/results_true.dat +++ b/tests/test_filter_delayedgroup/results_true.dat @@ -1,15 +1,15 @@ k-combined: -1.005983E+00 2.248579E-02 +9.903196E-01 4.279617E-02 tally 1: -6.113116E-04 -7.519725E-08 -3.155402E-03 -2.003485E-06 -3.012421E-03 -1.826031E-06 -6.754097E-03 -9.179336E-06 -2.769084E-03 -1.542940E-06 -1.159960E-03 -2.707463E-07 +8.141852E-04 +1.337187E-07 +4.849156E-03 +4.744020E-06 +4.460252E-03 +4.015453E-06 +1.028479E-02 +2.136252E-05 +5.002274E-03 +5.056965E-06 +1.974747E-03 +7.882970E-07 diff --git a/tests/test_filter_delayedgroup/settings.xml b/tests/test_filter_delayedgroup/settings.xml deleted file mode 100644 index 517637a59..000000000 --- a/tests/test_filter_delayedgroup/settings.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - 10 - 5 - 100 - - - - - - -160 -160 -183 - 160 160 183 - - - - - diff --git a/tests/test_filter_delayedgroup/tallies.xml b/tests/test_filter_delayedgroup/tallies.xml deleted file mode 100644 index b3649b469..000000000 --- a/tests/test_filter_delayedgroup/tallies.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - delayed-nu-fission - U-235 - - - diff --git a/tests/test_filter_delayedgroup/test_filter_delayedgroup.py b/tests/test_filter_delayedgroup/test_filter_delayedgroup.py index 1777db993..bdad3cc95 100644 --- a/tests/test_filter_delayedgroup/test_filter_delayedgroup.py +++ b/tests/test_filter_delayedgroup/test_filter_delayedgroup.py @@ -1,10 +1,30 @@ #!/usr/bin/env python +import os import sys -sys.path.insert(0, '..') -from testing_harness import TestHarness +sys.path.insert(0, os.pardir) +from testing_harness import TestHarness, PyAPITestHarness +import openmc + + +class FilterDelayedgroupTestHarness(PyAPITestHarness): + def _build_inputs(self): + filt = openmc.Filter(type='delayedgroup', + bins=(1, 2, 3, 4, 5, 6)) + tally = openmc.Tally(tally_id=1) + tally.add_filter(filt) + tally.add_score('delayed-nu-fission') + self._input_set.tallies = openmc.TalliesFile() + self._input_set.tallies.add_tally(tally) + + super(FilterDelayedgroupTestHarness, self)._build_inputs() + + def _cleanup(self): + super(FilterDelayedgroupTestHarness, self)._cleanup() + f = os.path.join(os.getcwd(), 'tallies.xml') + if os.path.exists(f): os.remove(f) if __name__ == '__main__': - harness = TestHarness('statepoint.10.*', True) + harness = FilterDelayedgroupTestHarness('statepoint.10.*', True) harness.main() diff --git a/tests/test_score_delayed_nufission/geometry.xml b/tests/test_score_delayed_nufission/geometry.xml deleted file mode 100644 index b85dd04df..000000000 --- a/tests/test_score_delayed_nufission/geometry.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 17 - -10.71 -10.71 - 1.26 1.26 - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 - 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 - 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - - - - - - 17 17 - -10.71 -10.71 - 1.26 1.26 - - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 3 3 4 3 3 4 3 3 4 3 3 3 3 3 - 3 3 3 4 3 3 3 3 3 3 3 3 3 4 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 4 3 3 3 3 3 3 3 3 3 4 3 3 3 - 3 3 3 3 3 4 3 3 4 3 3 4 3 3 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - 21 21 - -224.91 -224.91 - 21.42 21.42 - - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 6 6 6 6 6 6 6 5 5 5 5 5 5 5 - 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 - 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 - 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 - 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 - 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 - 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 - 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 - 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 - 5 5 5 5 5 5 5 6 6 6 6 6 6 6 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - - - - - - 21 21 - -224.91 -224.91 - 21.42 21.42 - - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 - 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 - 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 - 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 - 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 - 7 7 7 7 7 7 7 8 8 8 8 8 8 8 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - diff --git a/tests/test_score_delayed_nufission/inputs_true.dat b/tests/test_score_delayed_nufission/inputs_true.dat new file mode 100644 index 000000000..5a0ec8a21 --- /dev/null +++ b/tests/test_score_delayed_nufission/inputs_true.dat @@ -0,0 +1 @@ +f3c246a1c83b1283163b22069f78231e3f6623fa3c2eb664ce400d0fff07105b6106d0fa8c6dfd49512a7eb676c80e4ee602e19063a9fc453394fe07a94a1bdd \ No newline at end of file diff --git a/tests/test_score_delayed_nufission/materials.xml b/tests/test_score_delayed_nufission/materials.xml deleted file mode 100644 index 9c0b74f3f..000000000 --- a/tests/test_score_delayed_nufission/materials.xml +++ /dev/null @@ -1,272 +0,0 @@ - - - - 71c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_score_delayed_nufission/results_true.dat b/tests/test_score_delayed_nufission/results_true.dat index 6818f88e4..d797baf18 100644 --- a/tests/test_score_delayed_nufission/results_true.dat +++ b/tests/test_score_delayed_nufission/results_true.dat @@ -1,29 +1,29 @@ k-combined: -1.005983E+00 2.248579E-02 +9.903196E-01 4.279617E-02 tally 1: -1.432292E-02 -4.518762E-05 +1.711611E-02 +5.967549E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.531359E-02 -5.079909E-05 +1.026930E-02 +2.198717E-05 tally 2: -1.576415E-02 -2.485084E-04 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 +1.976462E-02 +1.953328E-04 tally 3: -1.369800E-02 -3.974018E-05 +1.687894E-02 +5.776176E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.447073E-02 -4.579588E-05 +1.061803E-02 +2.308636E-05 diff --git a/tests/test_score_delayed_nufission/settings.xml b/tests/test_score_delayed_nufission/settings.xml deleted file mode 100644 index 517637a59..000000000 --- a/tests/test_score_delayed_nufission/settings.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - 10 - 5 - 100 - - - - - - -160 -160 -183 - 160 160 183 - - - - - diff --git a/tests/test_score_delayed_nufission/tallies.xml b/tests/test_score_delayed_nufission/tallies.xml deleted file mode 100644 index 5ca140985..000000000 --- a/tests/test_score_delayed_nufission/tallies.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - delayed-nu-fission - - - - - delayed-nu-fission - analog - - - - - delayed-nu-fission - collision - - - diff --git a/tests/test_score_delayed_nufission/test_score_delayed_nufission.py b/tests/test_score_delayed_nufission/test_score_delayed_nufission.py index 1777db993..0738520e2 100644 --- a/tests/test_score_delayed_nufission/test_score_delayed_nufission.py +++ b/tests/test_score_delayed_nufission/test_score_delayed_nufission.py @@ -1,10 +1,32 @@ #!/usr/bin/env python +import os import sys -sys.path.insert(0, '..') -from testing_harness import TestHarness +sys.path.insert(0, os.pardir) +from testing_harness import TestHarness, PyAPITestHarness +import openmc + + +class ScoreDelayedNuFissionTestHarness(PyAPITestHarness): + def _build_inputs(self): + filt = openmc.Filter(type='cell', bins=(21, 22, 23, 27)) + tallies = [openmc.Tally(tally_id=i) for i in range(1, 4)] + [t.add_filter(filt) for t in tallies] + [t.add_score('delayed-nu-fission') for t in tallies] + tallies[0].estimator = 'tracklength' + tallies[1].estimator = 'analog' + tallies[2].estimator = 'collision' + self._input_set.tallies = openmc.TalliesFile() + [self._input_set.tallies.add_tally(t) for t in tallies] + + super(ScoreDelayedNuFissionTestHarness, self)._build_inputs() + + def _cleanup(self): + super(ScoreDelayedNuFissionTestHarness, self)._cleanup() + f = os.path.join(os.getcwd(), 'tallies.xml') + if os.path.exists(f): os.remove(f) if __name__ == '__main__': - harness = TestHarness('statepoint.10.*', True) + harness = ScoreDelayedNuFissionTestHarness('statepoint.10.*', True) harness.main() From 65bd95fea09e1c0e01dac631003822f9e70e7fd0 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 23 Oct 2015 13:56:52 -0500 Subject: [PATCH 36/38] Show maximum neutron transport energy and corresponding nuclide --- src/ace.F90 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index 69ad2f1a9..a10af729c 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -215,6 +215,16 @@ contains end do MATERIAL_LOOP3 + ! Show which nuclide results in lowest energy for neutron transport + do i = 1, n_nuclides_total + if (nuclides(i)%energy(nuclides(i)%n_grid) == energy_max_neutron) then + call write_message("Maximum neutron transport energy: " // & + trim(to_str(energy_max_neutron)) // " MeV for " // & + trim(adjustl(nuclides(i)%name)), 6) + exit + end if + end do + end subroutine read_xs !=============================================================================== @@ -486,11 +496,6 @@ contains ! than the previous energy_min_neutron = max(energy_min_neutron, nuc%energy(1)) energy_max_neutron = min(energy_max_neutron, nuc%energy(NE)) - if (nuc%energy(NE) < 20.0_8) then - call warning("Maximum energy for " // trim(adjustl(nuc%name)) // & - " is " // trim(to_str(nuc%energy(NE))) // " MeV. Neutrons will & - ¬ be allowed to go above this energy.") - end if end if end subroutine read_esz From a0193b13a5c7409f5231a4457a996d28d3d4d5b2 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Fri, 23 Oct 2015 17:27:28 -0400 Subject: [PATCH 37/38] fixed merging of tallies with delayedgroup filters in python API and other small issues --- docs/source/usersguide/input.rst | 2 +- openmc/filter.py | 2 +- openmc/statepoint.py | 6 ++---- openmc/tallies.py | 15 +++++++++++++++ src/ace.F90 | 6 +++--- src/fission.F90 | 6 +++--- src/input_xml.F90 | 2 +- src/particle_header.F90 | 1 - src/physics.F90 | 1 - src/tally.F90 | 29 ++++++++++------------------- src/tracking.F90 | 1 - 11 files changed, 36 insertions(+), 35 deletions(-) diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index 0c10756ba..f89e95157 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -1355,7 +1355,7 @@ The ```` element accepts the following sub-elements: -:nuclides: + :nuclides: If specified, the scores listed will be for particular nuclides, not the summation of reactions from all nuclides. The format for nuclides should be [Atomic symbol]-[Mass number], e.g. "U-235". The reaction rate for all diff --git a/openmc/filter.py b/openmc/filter.py index bd42039ed..6c4377ff3 100644 --- a/openmc/filter.py +++ b/openmc/filter.py @@ -271,7 +271,7 @@ class Filter(object): merged_filter = copy.deepcopy(self) # Merge unique filter bins - merged_bins = list(set(self.bins + filter.bins)) + merged_bins = list(set(np.concatenate((self.bins, filter.bins)))) merged_filter.bins = merged_bins merged_filter.num_bins = len(merged_bins) diff --git a/openmc/statepoint.py b/openmc/statepoint.py index e7e8d8e08..56b6eaf34 100644 --- a/openmc/statepoint.py +++ b/openmc/statepoint.py @@ -432,10 +432,8 @@ class StatePoint(object): score = score.decode() # If this is a moment, use generic moment order - regexp = re.compile(r'-n$|-pn$|-yn$') - if regexp.search(score) is not None: - score = score.strip(regexp.findall(score)[0]) - score += '-' + moments[j].decode() + pattern = r'-n$|-pn$|-yn$' + score = re.sub(pattern, '-' + moments[j].decode(), score) tally.add_score(score) diff --git a/openmc/tallies.py b/openmc/tallies.py index a0f617d08..610b6689c 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -565,6 +565,21 @@ class Tally(object): if len(self.filters) != len(tally.filters): return False + # Check if only one tally contains a delayed group filter + tally1_dg = False + for filter1 in self.filters: + if filter1.type == 'delayedgroup': + tally1_dg = True + + tally2_dg = False + for filter2 in tally.filters: + if filter2.type == 'delayedgroup': + tally2_dg = True + + # Return False if only one tally has a delayed group filter + if (tally1_dg or tally2_dg) and not (tally1_dg and tally2_dg): + return False + # Look to see if all filters are the same, or one or more can be merged for filter1 in self.filters: mergeable_filter = False diff --git a/src/ace.F90 b/src/ace.F90 index d70c50259..f7d4bec69 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -640,8 +640,8 @@ contains ! of delayed groups if (NPCR > MAX_DELAYED_GROUPS) then call fatal_error("Encountered nuclide with " // trim(to_str(NPCR)) & - &// " delayed groups while the maximum number of delayed groups " & - &// "set in constants.F90 is " // trim(to_str(MAX_DELAYED_GROUPS))) + // " delayed groups while the maximum number of delayed groups & + &set in constants.F90 is " // trim(to_str(MAX_DELAYED_GROUPS))) end if nuc % n_precursor = NPCR @@ -681,7 +681,7 @@ contains else nuc % nu_d_type = NU_NONE - nuc % n_precursor = ZERO + nuc % n_precursor = 0 end if end subroutine read_nu_data diff --git a/src/fission.F90 b/src/fission.F90 index f69ffc962..7b2911997 100644 --- a/src/fission.F90 +++ b/src/fission.F90 @@ -89,9 +89,9 @@ contains function nu_delayed(nuc, E) result(nu) - type(Nuclide), pointer :: nuc ! nuclide from which to find nu - real(8), intent(in) :: E ! energy of incoming neutron - real(8) :: nu ! number of delayed neutrons emitted per fission + type(Nuclide), intent(in) :: nuc ! nuclide from which to find nu + real(8), intent(in) :: E ! energy of incoming neutron + real(8) :: nu ! number of delayed neutrons emitted per fission if (nuc % nu_d_type == NU_NONE) then ! since no prompt or delayed data is present, this means all neutron diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 528ea40f5..e36dc6021 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2937,7 +2937,7 @@ contains ! Check if delayed group filter is used with any score besides ! delayed-nu-fission - if (trim(score_name) /= 'delayed-nu-fission' .and. & + if (score_name /= 'delayed-nu-fission' .and. & t % find_filter(FILTER_DELAYEDGROUP) > 0) then call fatal_error("Cannot tally " // trim(score_name) // " with a & &delayedgroup filter.") diff --git a/src/particle_header.F90 b/src/particle_header.F90 index b2f6c579e..0b9b251ee 100644 --- a/src/particle_header.F90 +++ b/src/particle_header.F90 @@ -106,7 +106,6 @@ contains subroutine initialize_particle(this) class(Particle) :: this - integer :: d ! Clear coordinate lists call this % clear() diff --git a/src/physics.F90 b/src/physics.F90 index 569b89bb0..52e65a4c5 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -1063,7 +1063,6 @@ contains integer, intent(in) :: i_nuclide integer, intent(in) :: i_reaction - integer :: d ! delayed group index integer :: nu_d(MAX_DELAYED_GROUPS) ! number of delayed neutrons born integer :: i ! loop index integer :: nu ! actual number of neutrons produced diff --git a/src/tally.F90 b/src/tally.F90 index 7ad174c9b..c997d3e37 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -485,14 +485,8 @@ contains cycle SCORE_LOOP else - score = ZERO - - ! Loop over all delayed groups and accumulate the contribution - ! from each group - do d = 1, nuclides(p % event_nuclide) % n_precursor - score = score + keff * p % wgt_bank / p % n_bank * & - p % n_delayed_bank(d) - end do + ! Add the contribution from all delayed groups + score = keff * p % wgt_bank / p % n_bank * sum(p % n_delayed_bank) end if end if else @@ -579,12 +573,9 @@ contains ! Get index in nuclides array i_nuc = mat % nuclide(l) - ! Get the current nuclide - nuc => nuclides(i_nuc) - ! Accumulate the contribution from each nuclide score = score + micro_xs(i_nuc) % fission & - * nu_delayed(nuc, p % E) * atom_density_ * flux + * nu_delayed(nuclides(i_nuc), p % E) * atom_density_ * flux end do end if end if @@ -1049,9 +1040,9 @@ contains subroutine score_fission_delayed_eout(p, t, i_score) - type(Particle), intent(in) :: p - type(TallyObject), intent(in) :: t - integer, intent(in) :: i_score ! index for score + type(Particle), intent(in) :: p + type(TallyObject), intent(inout) :: t + integer, intent(in) :: i_score ! index for score integer :: i ! index of outgoing energy filter integer :: j ! index of delayedgroup filter @@ -1063,7 +1054,7 @@ contains integer :: bin_energyout ! original outgoing energy bin real(8) :: score ! actual score real(8) :: E_out ! energy of fission bank site - logical :: d_found = .FALSE. ! bool to inidicate if delayed group was found + logical :: d_found = .false. ! bool to inidicate if delayed group was found ! save original outgoing energy and delayed group bins i = t % find_filter(FILTER_ENERGYOUT) @@ -1132,9 +1123,9 @@ contains subroutine score_fission_delayed_dg(t, d_bin, score, score_index) - type(TallyObject) :: t - integer, intent(in) :: score_index ! index for score - integer, intent(in) :: d_bin ! delayed group bin index + type(TallyObject), intent(inout) :: t + integer, intent(in) :: score_index ! index for score + integer, intent(in) :: d_bin ! delayed group bin index integer :: bin_original ! original bin index integer :: filter_index ! index for matching filter bin combination diff --git a/src/tracking.F90 b/src/tracking.F90 index 391199bc0..2e4503e13 100644 --- a/src/tracking.F90 +++ b/src/tracking.F90 @@ -29,7 +29,6 @@ contains type(Particle), intent(inout) :: p - integer :: d ! delayed group index integer :: j ! coordinate level integer :: next_level ! next coordinate level to check integer :: surface_crossed ! surface which particle is on From 2ddc445cba9a079c9efde49c13ae7ecb2655e0c2 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Sun, 25 Oct 2015 10:25:02 -0400 Subject: [PATCH 38/38] modified score_fission_delayed_eout to provide more clarity --- src/tally.F90 | 54 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/tally.F90 b/src/tally.F90 index c997d3e37..4d4d6bf93 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -1052,29 +1052,29 @@ contains integer :: n ! number of energies on filter integer :: k ! loop index for bank sites integer :: bin_energyout ! original outgoing energy bin + integer :: i_filter ! index for matching filter bin combination real(8) :: score ! actual score real(8) :: E_out ! energy of fission bank site - logical :: d_found = .false. ! bool to inidicate if delayed group was found - ! save original outgoing energy and delayed group bins + ! Save original outgoing energy bin i = t % find_filter(FILTER_ENERGYOUT) - j = t % find_filter(FILTER_DELAYEDGROUP) bin_energyout = matching_bins(i) + ! Get the index of delayed group filter + j = t % find_filter(FILTER_DELAYEDGROUP) + ! Get number of energies on filter n = size(t % filters(i) % real_bins) ! Since the creation of fission sites is weighted such that it is ! expected to create n_particles sites, we need to multiply the - ! score by keff to get the true nu-fission rate. Otherwise, the sum - ! of all nu-fission rates would be ~1.0. + ! score by keff to get the true delayed-nu-fission rate. ! loop over number of particles banked do k = 1, p % n_bank ! get the delayed group g = fission_bank(n_bank - p % n_bank + k) % delayed_group - d_found = .FALSE. ! check if the particle was born delayed if (g /= 0) then @@ -1089,25 +1089,35 @@ contains if (E_out < t % filters(i) % real_bins(1) .or. & E_out > t % filters(i) % real_bins(n)) cycle - ! check if delayed group is in delayed group bins - if (j > 0) then - do d_bin = 1, t % filters(j) % n_bins - d = t % filters(j) % int_bins(d_bin) - if (d == g) then - d_found = .TRUE. - exit - end if - end do - - ! if the delayedgroup filter is present and the delayed group is not - ! one of the delayedgroup bins, go to next particle in bank. - if (d_found .eqv. .FALSE.) cycle - end if - ! change outgoing energy bin matching_bins(i) = binary_search(t % filters(i) % real_bins, n, E_out) - call score_fission_delayed_dg(t, d_bin, score, i_score) + ! if the delayed group filter is present, tally to corresponding + ! delayed group bin if it exists + if (j > 0) then + + ! loop over delayed group bins until the corresponding bin is found + do d_bin = 1, t % filters(j) % n_bins + d = t % filters(j) % int_bins(d_bin) + + ! check whether the delayed group of the particle is equal to the + ! delayed group of this bin + if (d == g) then + call score_fission_delayed_dg(t, d_bin, score, i_score) + end if + end do + + ! if the delayed group filter is not present, add score to tally + else + + ! determine scoring index + i_filter = sum((matching_bins(1:t%n_filters) - 1) * t % stride) + 1 + + ! Add score to tally +!$omp atomic + t % results(i_score, i_filter) % value = & + t % results(i_score, i_filter) % value + score + end if end if end do