diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 6a2efa2e75..93bb1e733c 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -264,16 +264,18 @@ contains end if end if - ! Read run parameters - call get_run_parameters(node_mode) + if (run_mode == MODE_EIGENVALUE .or. run_mode == MODE_FIXEDSOURCE) then + ! Read run parameters + call get_run_parameters(node_mode) - ! Check number of active batches, inactive batches, and particles - if (n_active <= 0) then - call fatal_error("Number of active batches must be greater than zero.") - elseif (n_inactive < 0) then - call fatal_error("Number of inactive batches must be non-negative.") - elseif (n_particles <= 0) then - call fatal_error("Number of particles must be greater than zero.") + ! Check number of active batches, inactive batches, and particles + if (n_active <= 0) then + call fatal_error("Number of active batches must be greater than zero.") + elseif (n_inactive < 0) then + call fatal_error("Number of inactive batches must be non-negative.") + elseif (n_particles <= 0) then + call fatal_error("Number of particles must be greater than zero.") + end if end if ! Copy random number seed if specified @@ -317,7 +319,10 @@ contains ! Get point to list of elements and make sure there is at least one call get_node_list(doc, "source", node_source_list) n = get_list_size(node_source_list) - if (n == 0) call fatal_error("No source specified in settings XML file.") + + if (run_mode == MODE_EIGENVALUE .or. run_mode == MODE_FIXEDSOURCE) then + if (n == 0) call fatal_error("No source specified in settings XML file.") + end if ! Allocate array for sources allocate(external_source(n)) diff --git a/src/main.F90 b/src/main.F90 index 8582ef7039..1cd3a9e547 100644 --- a/src/main.F90 +++ b/src/main.F90 @@ -8,6 +8,7 @@ program main use particle_restart, only: run_particle_restart use plot, only: run_plot use simulation, only: run_simulation + use volume_calc, only: run_volume_calculations implicit none @@ -26,6 +27,8 @@ program main call run_plot() case (MODE_PARTICLE) if (master) call run_particle_restart() + case (MODE_VOLUME) + call run_volume_calculations() end select ! finalize run diff --git a/src/simulation.F90 b/src/simulation.F90 index 187632836e..707f427378 100644 --- a/src/simulation.F90 +++ b/src/simulation.F90 @@ -39,9 +39,6 @@ contains type(Particle) :: p integer(8) :: i_work - ! Volume calculations - if (size(volume_calcs) > 0) call run_volume_calculations() - if (.not. restart_run) call initialize_source() ! Display header diff --git a/tests/test_volume_calc/inputs_true.dat b/tests/test_volume_calc/inputs_true.dat index 28b4928cd9..627d30a404 100644 --- a/tests/test_volume_calc/inputs_true.dat +++ b/tests/test_volume_calc/inputs_true.dat @@ -26,15 +26,7 @@ - eigenvalue - 1000 - 4 - 0 - - - -1.0 -1.0 -5.0 1.0 1.0 5.0 - - + volume cell 1 2 3 diff --git a/tests/test_volume_calc/results_true.dat b/tests/test_volume_calc/results_true.dat index a36e61fb5e..8eb2a61acf 100644 --- a/tests/test_volume_calc/results_true.dat +++ b/tests/test_volume_calc/results_true.dat @@ -1,4 +1,3 @@ -k-combined: 4.165450e-02 3.582533e-04 Volume calculation 0 Domain 1: 31.4693 +/- 0.0721 cm^3 Domain 2: 2.0933 +/- 0.0310 cm^3 diff --git a/tests/test_volume_calc/test_volume_calc.py b/tests/test_volume_calc/test_volume_calc.py index fa267efb6a..cb4ecc2d74 100644 --- a/tests/test_volume_calc/test_volume_calc.py +++ b/tests/test_volume_calc/test_volume_calc.py @@ -52,22 +52,12 @@ class VolumeTest(PyAPITestHarness): # Define settings settings = openmc.Settings() - settings.particles = 1000 - settings.batches = 4 - settings.inactive = 0 - settings.source = openmc.Source(space=openmc.stats.Box( - [-1., -1., -5.], [1., 1., 5.])) + settings.run_mode = 'volume' settings.volume_calculations = vol_calcs settings.export_to_xml() def _get_results(self): - # Read the statepoint file. - statepoint = os.path.join(os.getcwd(), self._sp_name) - sp = openmc.StatePoint(statepoint) - - # Write out k-combined. - outstr = 'k-combined: {:12.6e} {:12.6e}\n'.format(*sp.k_combined) - + outstr = '' for i, filename in enumerate(sorted(glob.glob(os.path.join( os.getcwd(), 'volume_*.h5')))): outstr += 'Volume calculation {}\n'.format(i) @@ -83,6 +73,9 @@ class VolumeTest(PyAPITestHarness): return outstr + def _test_output_created(self): + pass + if __name__ == '__main__': - harness = VolumeTest('statepoint.4.h5') + harness = VolumeTest('') harness.main()