diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index 4c1f238238..d6802075e5 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -688,7 +688,7 @@ attributes/sub-elements: *Default*: false - :source_write: + :write: If this element is set to "false", source sites are not written to the state point or source point file. This can substantially reduce the size of state points if large numbers of particles per batch are used. diff --git a/src/ace.F90 b/src/ace.F90 index cbe14b6ae8..170c885f02 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -913,7 +913,7 @@ contains ! Skip total inelastic level scattering, gas production cross sections ! (MT=200+), etc. - if (rxn % MT == N_LEVEL) cycle + if (rxn % MT == N_LEVEL .or. rxn % MT == N_NONELASTIC) cycle if (rxn % MT > N_5N2P .and. rxn % MT < N_P0) cycle ! Skip level cross sections if total is available diff --git a/src/constants.F90 b/src/constants.F90 index f6e82d9bdc..b3e5ed89b1 100644 --- a/src/constants.F90 +++ b/src/constants.F90 @@ -186,28 +186,28 @@ module constants ! Reaction types integer, parameter :: & - TOTAL_XS = 1, ELASTIC = 2, N_LEVEL = 4, MISC = 5, N_2ND = 11, & - N_2N = 16, N_3N = 17, N_FISSION = 18, N_F = 19, N_NF = 20, & - N_2NF = 21, N_NA = 22, N_N3A = 23, N_2NA = 24, N_3NA = 25, & - N_NP = 28, N_N2A = 29, N_2N2A = 30, N_ND = 32, N_NT = 33, & - N_N3HE = 34, N_ND2A = 35, N_NT2A = 36, N_4N = 37, N_3NF = 38, & - N_2NP = 41, N_3NP = 42, N_N2P = 44, N_NPA = 45, N_N1 = 51, & - N_N40 = 90, N_NC = 91, N_DISAPPEAR = 101, N_GAMMA = 102, N_P = 103, & - N_D = 104, N_T = 105, N_3HE = 106, N_A = 107, N_2A = 108, & - N_3A = 109, N_2P = 111, N_PA = 112, N_T2A = 113, N_D2A = 114, & - N_PD = 115, N_PT = 116, N_DA = 117, N_5N = 152, N_6N = 153, & - N_2NT = 154, N_TA = 155, N_4NP = 156, N_3ND = 157, N_NDA = 158, & - N_2NPA = 159, N_7N = 160, N_8N = 161, N_5NP = 162, N_6NP = 163, & - N_7NP = 164, N_4NA = 165, N_5NA = 166, N_6NA = 167, N_7NA = 168, & - N_4ND = 169, N_5ND = 170, N_6ND = 171, N_3NT = 172, N_4NT = 173, & - N_5NT = 174, N_6NT = 175, N_2N3HE = 176, N_3N3HE = 177, N_4N3HE = 178, & - N_3N2P = 179, N_3N3A = 180, N_3NPA = 181, N_DT = 182, N_NPD = 183, & - N_NPT = 184, N_NDT = 185, N_NP3HE = 186, N_ND3HE = 187, N_NT3HE = 188, & - N_NTA = 189, N_2N2P = 190, N_P3HE = 191, N_D3HE = 192, N_3HEA = 193, & - N_4N2P = 194, N_4N2A = 195, N_4NPA = 196, N_3P = 197, N_N3P = 198, & - N_3N2PA = 199, N_5N2P = 200, N_P0 = 600, N_PC = 649, N_D0 = 650, & - N_DC = 699, N_T0 = 700, N_TC = 749, N_3HE0 = 750, N_3HEC = 799, & - N_A0 = 800, N_AC = 849, N_2N0 = 875, N_2NC = 891 + TOTAL_XS = 1, ELASTIC = 2, N_NONELASTIC = 3, N_LEVEL = 4, MISC = 5, & + N_2ND = 11, N_2N = 16, N_3N = 17, N_FISSION = 18, N_F = 19, & + N_NF = 20, N_2NF = 21, N_NA = 22, N_N3A = 23, N_2NA = 24, & + N_3NA = 25, N_NP = 28, N_N2A = 29, N_2N2A = 30, N_ND = 32, & + N_NT = 33, N_N3HE = 34, N_ND2A = 35, N_NT2A = 36, N_4N = 37, & + N_3NF = 38, N_2NP = 41, N_3NP = 42, N_N2P = 44, N_NPA = 45, & + N_N1 = 51, N_N40 = 90, N_NC = 91, N_DISAPPEAR = 101, N_GAMMA = 102, & + N_P = 103, N_D = 104, N_T = 105, N_3HE = 106, N_A = 107, & + N_2A = 108, N_3A = 109, N_2P = 111, N_PA = 112, N_T2A = 113, & + N_D2A = 114, N_PD = 115, N_PT = 116, N_DA = 117, N_5N = 152, & + N_6N = 153, N_2NT = 154, N_TA = 155, N_4NP = 156, N_3ND = 157, & + N_NDA = 158, N_2NPA = 159, N_7N = 160, N_8N = 161, N_5NP = 162, & + N_6NP = 163, N_7NP = 164, N_4NA = 165, N_5NA = 166, N_6NA = 167, & + N_7NA = 168, N_4ND = 169, N_5ND = 170, N_6ND = 171, N_3NT = 172, & + N_4NT = 173, N_5NT = 174, N_6NT = 175, N_2N3HE = 176, N_3N3HE = 177, & + N_4N3HE = 178, N_3N2P = 179, N_3N3A = 180, N_3NPA = 181, N_DT = 182, & + N_NPD = 183, N_NPT = 184, N_NDT = 185, N_NP3HE = 186, N_ND3HE = 187, & + N_NT3HE = 188, N_NTA = 189, N_2N2P = 190, N_P3HE = 191, N_D3HE = 192, & + N_3HEA = 193, N_4N2P = 194, N_4N2A = 195, N_4NPA = 196, N_3P = 197, & + N_N3P = 198, N_3N2PA = 199, N_5N2P = 200, N_P0 = 600, N_PC = 649, & + N_D0 = 650, N_DC = 699, N_T0 = 700, N_TC = 749, N_3HE0 = 750, & + N_3HEC = 799, N_A0 = 800, N_AC = 849, N_2N0 = 875, N_2NC = 891 ! ACE table types integer, parameter :: & diff --git a/src/particle_restart.F90 b/src/particle_restart.F90 index e5cca17bf8..846d37160d 100644 --- a/src/particle_restart.F90 +++ b/src/particle_restart.F90 @@ -97,10 +97,15 @@ contains call read_dataset(p % id, file_id, 'id') call read_dataset(p % wgt, file_id, 'weight') call read_dataset(p % E, file_id, 'energy') - call read_dataset(p % g, file_id, 'energy_group') call read_dataset(p % coord(1) % xyz, file_id, 'xyz') call read_dataset(p % coord(1) % uvw, file_id, 'uvw') + ! Set energy group and average energy in multi-group mode + if (.not. run_CE) then + p % g = int(p % E) + p % E = energy_bin_avg(p % g) + end if + ! Set particle last attributes p % last_wgt = p % wgt p % last_xyz = p % coord(1)%xyz diff --git a/src/simulation.F90 b/src/simulation.F90 index b762979d73..3321dc70fa 100644 --- a/src/simulation.F90 +++ b/src/simulation.F90 @@ -17,7 +17,7 @@ module simulation print_batch_keff, print_generation use particle_header, only: Particle use random_lcg, only: set_particle_seed - use source, only: initialize_source + use source, only: initialize_source, sample_external_source use state_point, only: write_state_point, write_source_point use string, only: to_str use tally, only: synchronize_tallies, setup_active_usertallies, & @@ -227,6 +227,8 @@ contains subroutine finalize_generation() + integer(8) :: i + ! Update global tallies with the omp private accumulation variables !$omp parallel !$omp critical @@ -271,6 +273,12 @@ contains ! Write generation output if (master .and. current_gen /= gen_per_batch) call print_generation() + elseif (run_mode == MODE_FIXEDSOURCE) then + ! For fixed-source mode, we need to sample the external source + do i = 1, work + call set_particle_seed(overall_gen*n_particles + work_index(rank) + i) + call sample_external_source(source_bank(i)) + end do end if end subroutine finalize_generation diff --git a/tests/test_fixed_source/results_true.dat b/tests/test_fixed_source/results_true.dat index c7ddf3c0b5..6246dfaf62 100644 --- a/tests/test_fixed_source/results_true.dat +++ b/tests/test_fixed_source/results_true.dat @@ -1,6 +1,6 @@ tally 1: -4.518784E+02 -2.056386E+04 +4.448476E+02 +1.984373E+04 leakage: -9.750000E+00 -9.508100E+00 +9.790000E+00 +9.588300E+00 diff --git a/tests/test_particle_restart_fixed/results_true.dat b/tests/test_particle_restart_fixed/results_true.dat index de42a0c68e..047760a2d5 100644 --- a/tests/test_particle_restart_fixed/results_true.dat +++ b/tests/test_particle_restart_fixed/results_true.dat @@ -3,14 +3,14 @@ current batch: current gen: 1.000000E+00 particle id: -9.280000E+02 +1.440000E+02 run mode: fixed source particle weight: 1.000000E+00 particle energy: -4.412022E+00 +5.749729E+00 particle xyz: -5.572639E+00 -9.139472E+00 -1.974824E+00 +8.754675E+00 2.551620E+00 4.394350E-01 particle uvw: -1.410422E-01 5.330426E-01 -8.342498E-01 +-5.971721E-01 -4.845709E-01 6.391999E-01 diff --git a/tests/test_particle_restart_fixed/test_particle_restart_fixed.py b/tests/test_particle_restart_fixed/test_particle_restart_fixed.py index 5af7454894..df0398c6eb 100644 --- a/tests/test_particle_restart_fixed/test_particle_restart_fixed.py +++ b/tests/test_particle_restart_fixed/test_particle_restart_fixed.py @@ -7,5 +7,5 @@ from testing_harness import ParticleRestartTestHarness if __name__ == '__main__': - harness = ParticleRestartTestHarness('particle_7_928.*') + harness = ParticleRestartTestHarness('particle_7_144.h5') harness.main()