diff --git a/doc/io_formats/depcode_input.rst b/doc/io_formats/depcode_input.rst index 1d2714f51..7baf80643 100644 --- a/doc/io_formats/depcode_input.rst +++ b/doc/io_formats/depcode_input.rst @@ -366,23 +366,6 @@ OpenMC-specific properties ``null`` -``dilute_initial`` -~~~~~~~~~~~~~~~~~~ - - :description: - Initial atom density to add for nuclides that are zero in initial - condition. - - :type: - ``number`` - - :minimum: - 0 - - :default: - 1000 - - ``fission_yield_mode`` ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/saltproc/input_schema.json b/saltproc/input_schema.json index 3dd9ab501..fcd50fbbb 100644 --- a/saltproc/input_schema.json +++ b/saltproc/input_schema.json @@ -216,11 +216,6 @@ "description": "Path to fission Q values", "type": ["string", "null"], "default": null}, - "dilute_initial": { - "description": "Initial atom density to add for nuclides that are zero in initial condition.", - "type": "number", - "minimum": 0, - "default": 1000}, "fission_yield_mode": { "description": "Determine what fission energy helper is used", "type": "string", diff --git a/saltproc/openmc_depcode.py b/saltproc/openmc_depcode.py index 08c763ddb..8b63c5c15 100644 --- a/saltproc/openmc_depcode.py +++ b/saltproc/openmc_depcode.py @@ -444,12 +444,7 @@ def write_runtime_input(self, reactor, depletion_step, restart): self.inactive_cycles = settings.inactive self.active_cycles = settings.batches - self.inactive_cycles - diluted_model = openmc.Model(materials=materials, geometry=geometry, settings=settings) - reactions, diluted_materials = MicroXS._add_dilute_nuclides(self.chain_file_path, - diluted_model, - 1e3) - - diluted_materials.export_to_xml(self.runtime_matfile) + materials.export_to_xml(self.runtime_matfile) geometry.export_to_xml(self.runtime_inputfile['geometry']) settings.export_to_xml(self.runtime_inputfile['settings']) self.write_depletion_settings(reactor, depletion_step) diff --git a/saltproc/results.py b/saltproc/results.py index 8d14530c0..179e98406 100644 --- a/saltproc/results.py +++ b/saltproc/results.py @@ -8,7 +8,10 @@ class Results(): Parameters ---------- - path + path : str + Path of results file + load_in_out_streams : bool + Switch on whether or not to load waste streams. Attributes ---------- @@ -28,15 +31,25 @@ class Results(): power_level : numpy.ndarray Power in [W]. beta_eff : numpy.ndarray - ... + Timeseries of delayed neutron fractions. lambda_eff : numpy.ndarray - ... - depcode_metadata : ... - depletion_step_metadata : ... - nuclide_ids : ... - material_composition : ... - material_parameters : ... - waste_streams : ... + Timesereis of delayed neutron precursor decay constants. + depcode_metadata : dict of str to object + Depletion code metadata, such as depletion code name, version, etc. + depletion_step_metadata : dict of str to object + Depletion step metadata, such as step runtime, memory usage, etc. + nuclide_idx : dict of str to int + A dictionary mapping nuclide name as a string to index. + material_composition : dict of str to numpy.ndarray + A dictionary mapping material name as a string to nuclide composition + over time. + material_parameters : dict of str to object + A dictionary mapping material name as a string to material parameters + (density, volume, burnup, etc.) + waste_streams : dict of str to dict + A dictionary mapping material name as a string to a dictionary mapping + waste stream names as a string to the waste streams mass [g] as a + timeseries. """ def __init__(self, path, load_in_out_streams=True): @@ -59,10 +72,6 @@ def __init__(self, path, load_in_out_streams=True): # metadata self.depcode_metadata = self._collect_metadata(f, 'depcode_metadata') self.depletion_step_metadata = self._collect_metadata(f, 'depletion_step_metadata', array=True) - #metadata = pd.DataFrame.from_records(metadata[:]).to_dict() - #for key, value in metadata.items(): - # metadata[key] = value[0#] - ##self.depcode_metadata = metadata # Materials materials = root.materials @@ -171,6 +180,23 @@ def _collect_waste_streams(self, waste_stream, stream_name): # methods to get timeseries of various values def get_nuclide_mass(self, material, nuclide, timestep=None): + """Get nuclide mass as a timeseries. If :attr:`timestep` is `None`, + then return the mass at all times. + + Parameters + ---------- + material : str + Material name + nuclide : str + Nuclide string (e.g. 'U235') + timestep : idx + Timestep index + + Returns + ------- + nuclide_mass : numpy.ndarray + + """ nucmap = self.nuclide_idx[material] comp = self.material_composition[material] nuclide_mass = comp[nucmap[nuclide]] diff --git a/tests/conftest.py b/tests/conftest.py index ff149a8c5..1e8786334 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,10 +1,23 @@ from pathlib import Path import pytest +from tests.integration_tests import config as integration_config + from saltproc.app import read_main_input, _create_depcode_object, _create_simulation_object, _create_reactor_object from saltproc import Simulation +def pytest_addoption(parser): + parser.addoption('--update', action='store_true') + + +def pytest_configure(config): + opts = ['update'] + for opt in opts: + if config.getoption(opt) is not None: + integration_config[opt] = config.getoption(opt) + + @pytest.fixture(scope='session') def cwd(): return Path(__file__).parents[0] diff --git a/tests/integration_tests/__init__.py b/tests/integration_tests/__init__.py new file mode 100644 index 000000000..7a5c24d31 --- /dev/null +++ b/tests/integration_tests/__init__.py @@ -0,0 +1,3 @@ +config = { + 'update': False +} diff --git a/tests/integration_tests/run_constant_reprocessing_openmc/pincell_reference_results.h5 b/tests/integration_tests/run_constant_reprocessing_openmc/pincell_reference_results.h5 index d5fa687bf..943d3f336 100644 Binary files a/tests/integration_tests/run_constant_reprocessing_openmc/pincell_reference_results.h5 and b/tests/integration_tests/run_constant_reprocessing_openmc/pincell_reference_results.h5 differ diff --git a/tests/integration_tests/run_constant_reprocessing_openmc/test.py b/tests/integration_tests/run_constant_reprocessing_openmc/test.py index 68e066814..5ef3ef2a4 100644 --- a/tests/integration_tests/run_constant_reprocessing_openmc/test.py +++ b/tests/integration_tests/run_constant_reprocessing_openmc/test.py @@ -1,4 +1,6 @@ """Run SaltProc with reprocessing""" +from tests.integration_tests import config + import os import shutil from pathlib import Path @@ -35,12 +37,15 @@ def test_integration_2step_constant_ideal_removal_heavy(setup): args, check=True, cwd=cwd, - stdout=sys.stdout, + stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) + if config['update']: + shutil.copyfile(test_db, ref_db) + return np.testing.assert_allclose(read_keff(test_db), read_keff(ref_db), atol=atol) assert_db_allclose(test_db, ref_db, atol, rtol) - #shutil.rmtree(cwd / 'saltproc_runtime') + shutil.rmtree(cwd / 'saltproc_runtime') def read_keff(file): db = tb.open_file(file, mode='r') diff --git a/tests/integration_tests/run_constant_reprocessing_serpent/test.py b/tests/integration_tests/run_constant_reprocessing_serpent/test.py index f72e76c8c..7e03d2fc8 100644 --- a/tests/integration_tests/run_constant_reprocessing_serpent/test.py +++ b/tests/integration_tests/run_constant_reprocessing_serpent/test.py @@ -31,8 +31,9 @@ def test_integration_2step_constant_ideal_removal_heavy(setup): args, check=True, cwd=cwd, - stdout=sys.stdout, + stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) + np.testing.assert_allclose(read_keff(test_db)[0], read_keff(ref_db)[0], rtol=5e-2) np.testing.assert_allclose(read_keff(test_db)[1], read_keff(ref_db)[1], rtol=5e-1) assert_db_allclose(test_db, ref_db, tol) diff --git a/tests/integration_tests/run_no_reprocessing_openmc/ref_saltproc_results.h5 b/tests/integration_tests/run_no_reprocessing_openmc/ref_saltproc_results.h5 index 1b093b583..8a64b037e 100644 Binary files a/tests/integration_tests/run_no_reprocessing_openmc/ref_saltproc_results.h5 and b/tests/integration_tests/run_no_reprocessing_openmc/ref_saltproc_results.h5 differ diff --git a/tests/integration_tests/run_no_reprocessing_openmc/reference_error b/tests/integration_tests/run_no_reprocessing_openmc/reference_error index 5b2555c76..fcc71a0ed 100644 --- a/tests/integration_tests/run_no_reprocessing_openmc/reference_error +++ b/tests/integration_tests/run_no_reprocessing_openmc/reference_error @@ -1,421 +1,232 @@ -0.0 -0.0 -0.0 -0.0 --6.617444900424222e-24 -0.0 -0.0 -0.0 -0.0 -0.0 --4.930380657631324e-31 -0.0 -0.0 -0.0 --3.009265538105056e-36 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 --3.2311742677852644e-27 --3.877409121342317e-26 --1.4791141972893971e-31 -0.0 -0.0 --2.0679515313825692e-25 -0.0 -0.0 -8.271806125530277e-25 --1.1555579666323415e-33 -0.0 -0.0 -2.6469779601696886e-23 --2.6469779601696886e-23 --2.117582368135751e-22 -0.0 -0.0 --2.117582368135751e-22 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 --3.3881317890172014e-21 --1.2924697071141057e-26 -0.0 --9.244463733058732e-33 -1.6155871338926322e-27 --1.6155871338926322e-27 -0.0 -5.522654816098038e-19 -2.290377089375628e-18 -2.0011153378882846e-20 -3.5486048278524887e-22 -4.909402962285925e-18 -1.122897681540735e-22 -1.0799670077492329e-19 --1.0164395367051604e-20 -0.0 --4.0657581468206416e-20 --1.3552527156068805e-20 --1.0503208545953324e-19 -0.0 -0.0 --2.117582368135751e-22 -0.0 -1.1832913578315177e-30 --6.617444900424222e-24 --1.0339757656912846e-24 -0.0 -5.082197683525802e-20 -4.743384504624082e-20 -0.0 -4.2351647362715017e-20 -0.0 -8.011868568650901e-32 -1.1890721305449773e-24 -1.2407709188295415e-23 -0.0 --1.3552527156068805e-20 -0.0 --1.6940658945086007e-21 -9.529120656610879e-22 -0.0 -0.0 -6.564505341220828e-21 -0.0 -6.203854594147708e-25 -2.541098841762901e-21 -0.0 -0.0 --5.293955920339377e-23 -0.0 --1.3016204936146695e-29 --1.852884572118782e-22 -0.0 --2.1002632740604218e-26 -0.0 --7.489798825710024e-21 --5.22772977254685e-21 -0.0 --3.970466940254533e-23 -3.970466940254533e-23 --2.6469779601696886e-23 -0.0 -0.0 -2.524354896707238e-29 -0.0 --1.2587480345416504e-24 -3.1638346569104994e-29 -0.0 -0.0 --1.2924697071141057e-26 -0.0 -0.0 -0.0 -0.0 -2.514629062161204e-22 --8.271806125530277e-25 --1.5881867761018131e-22 --6.617444900424221e-23 -0.0 --1.9852334701272664e-23 -9.26442286059391e-23 -0.0 --3.1763735522036263e-22 -0.0 -0.0 -0.0 -0.0 --3.2311742677852644e-27 -3.101927297073854e-25 -0.0 -0.0 --3.3881317890172014e-21 -0.0 -0.0 --1.0587911840678754e-22 -0.0 --8.470329472543003e-22 -1.2924697071141057e-25 --1.3552527156068805e-20 -0.0 -0.0 -0.0 -0.0 -6.462348535570529e-27 -0.0 -0.0 --2.541098841762901e-21 -0.0 -0.0 -0.0 -2.117582368135751e-22 --4.0657581468206416e-20 -0.0 --8.271806125530277e-25 -0.0 -0.0 -0.0 -0.0 -0.0 --9.244463733058732e-33 --2.4233807008389483e-27 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 --1.1832913578315177e-30 -0.0 -0.0 --2.0328790734103208e-20 -0.0 --1.0164395367051604e-20 -2.0328790734103208e-20 -0.0 -0.0 -0.0 --2.5849394142282115e-26 -0.0 -1.0587911840678754e-22 --3.3881317890172014e-21 -0.0 -8.470329472543003e-21 --1.6940658945086007e-21 -3.3881317890172014e-21 -0.0 -0.0 -9.740878893424454e-21 -0.0 -0.0 -0.0 -0.0 -0.0 -1.2281977735187355e-20 -1.376428539288238e-21 -0.0 -2.541098841762901e-21 --1.0587911840678754e-22 -1.1540823906339842e-20 -1.2924697071141057e-26 -8.077935669463161e-28 --1.0587911840678754e-21 --3.5155176033503676e-24 -1.291725244562808e-20 -3.441071348220595e-22 --1.6543612251060553e-24 -0.0 -0.0 --1.6155871338926322e-27 -1.209751645858803e-23 -3.8050308177439273e-23 -0.0 -3.3087224502121107e-23 -0.0 -5.37667398159468e-23 -2.50416005753358e-26 -0.0 -0.0 -2.145701662201152e-28 --2.055026834311428e-23 -0.0 --7.754818242684634e-26 -0.0 -4.52364397489937e-26 -4.733165431326071e-30 -0.0 --7.153366036640847e-29 --2.4233807008389483e-27 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 --1.0592614694129797e-33 -0.0 --9.62964972193618e-35 -0.0 --1.0344410472546892e-29 --1.8184408451954978e-22 --5.515358419680371e-23 -4.647195563142155e-22 --1.4426860100818241e-24 --7.817847306972832e-26 --3.0108785044334803e-30 --3.800367455409357e-27 -4.403937402452376e-23 -2.1021990959120226e-26 --7.510587522725791e-29 --3.3752704263273485e-23 --5.1417420650970905e-24 --4.4280703947439335e-27 -0.0 -0.0 -0.0 -0.0 -0.0 -3.4606553688208144e-35 -0.0 -0.0 -0.0 --7.888609052210118e-31 -0.0 --2.7685242950566515e-34 --6.225059175280048e-26 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -5.169878828456423e-26 -0.0 -5.240936861163766e-32 --1.355854680848614e-31 -2.208810534618833e-29 -0.0 -0.0 -1.6263032587282567e-19 --6.183936465303629e-23 -3.87474277148267e-25 -0.0 -5.421010862427522e-20 -2.117582368135751e-22 --4.1359030627651384e-24 -4.8467614016778965e-27 -4.930380657631324e-31 -0.0 -0.0 -2.643218478049957e-31 -4.1167179655501634e-23 -5.030072954528629e-26 -5.009266748153425e-29 -1.2157432773944426e-33 -1.0002263240136667e-26 -1.2759285881565438e-33 --3.325617037048124e-21 -8.82773397047721e-22 -6.043873602568886e-25 -7.460330380827006e-29 --5.008188227384568e-30 --1.219210944097263e-22 --1.091515252192121e-25 -1.1433860893838142e-29 -8.517425179052551e-32 -6.450525250137303e-37 -0.0 --1.0122037705323662e-21 --1.4535805861860903e-24 --2.763413358466734e-28 -3.120487992393419e-31 -1.925929944387236e-34 -9.4039548065783e-38 -0.0 -1.8792261432358454e-31 -3.851859888774472e-34 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 \ No newline at end of file +1.5119890468527587e-11 +4.065027524366237e-10 +-1.6299973593092432e-09 +5.901636276027522e-12 +1.0058259415790447e-17 +6.055268993871537e-16 +3.268867431423211e-15 +1.3726239665047139e-14 +2.1384622008398624e-14 +1.721313394259131e-14 +2.232677370797632e-14 +4.661478661854402e-15 +5.3842226426989725e-14 +-2.1927578188751274e-14 +-1.2488461133812734e-12 +-3.044357424095886e-13 +-1.6354400572855837e-15 +-7.819735727650765e-13 +-5.321714568500848e-12 +-6.856192721530405e-12 +-5.195268827371149e-11 +-6.916023579041131e-11 +-4.037379064108138e-15 +-7.050110845604825e-11 +-6.425293339802339e-16 +-2.0533233601352012e-13 +-8.806843872762599e-11 +-8.564990071507859e-11 +-8.850799338746227e-11 +-4.836038637603214e-10 +-2.6566817855856596e-10 +8.734769763256804e-13 +-6.507017638115873e-10 +4.348785652091783e-14 +-2.8002619014271664e-14 +-9.747851398578266e-10 +-1.343699641073189e-09 +-1.7779560184007356e-09 +-2.7783441939425967e-11 +-6.388237318243265e-14 +-1.0564490612614136e-09 +-9.052679936961425e-15 +-1.5817098480592836e-11 +-1.0681330371781813e-09 +-9.371012090799975e-10 +-1.2820576036955415e-09 +-1.0039008770804168e-09 +-3.035670792972574e-10 +3.623878062634076e-18 +1.6813887739533036e-15 +-1.864141658802511e-11 +7.989134585506207e-17 +-7.547577383191812e-13 +1.530128503126368e-12 +-2.315155682893193e-10 +4.916518736659196e-11 +1.538285733974985e-11 +3.198357264322664e-10 +-2.0375416480410428e-10 +1.0138348158352697e-15 +2.0096221478379623e-10 +7.082703942586674e-10 +1.650601123775417e-09 +2.4497485217864944e-09 +2.5032286782877177e-09 +2.317376470545537e-10 +1.709996446651662e-09 +6.415105576535204e-11 +9.931463602363242e-10 +-1.960284097789959e-12 +7.711586022555048e-10 +5.28454192416791e-10 +1.0755457494293338e-09 +4.856531134240449e-10 +1.0989628980545293e-10 +1.574064913092152e-10 +4.365775265243026e-11 +1.4639327251351812e-14 +-8.369433150474823e-17 +3.0354099612526337e-13 +6.510511418337447e-12 +2.106121226787296e-11 +8.747198836979853e-12 +4.1404862304980984e-11 +2.326586379447995e-11 +1.2901785143104952e-12 +5.142299790618626e-17 +7.894037138756894e-13 +3.021075402067874e-13 +5.02011804515428e-12 +2.0301164349011486e-11 +2.7703178642014608e-11 +2.334305920225588e-11 +2.3615129063317203e-11 +2.3885796382117878e-11 +2.1623123178503145e-13 +1.94520260408304e-11 +1.7122931616266313e-12 +2.645079292937375e-12 +1.0920899230327131e-11 +2.6775484601957207e-11 +-2.6304623610801217e-13 +1.344374569141788e-11 +-2.2195178795547087e-13 +8.143803878190516e-14 +1.9025658368455618e-17 +-2.2803537759903022e-15 +1.0020159729474946e-14 +-1.3829865756518979e-12 +-4.796657464423493e-11 +1.083712281883326e-10 +6.04099787459623e-10 +-3.4836292322902733e-13 +4.926677494323182e-11 +-2.3701208494540843e-12 +3.4672344298425283e-10 +3.7568032998133623e-13 +3.7318095362245225e-10 +9.276399292326847e-11 +7.952793271820873e-13 +1.8781693770955076e-17 +9.982784520453103e-13 +1.5347738729451052e-10 +1.5045063436081735e-10 +-1.0001789449280186e-11 +-2.918915017257142e-10 +2.992775983301024e-09 +-1.751485688013493e-08 +-1.5775245732036164e-10 +1.5410010735902777e-10 +1.5218474756231197e-08 +4.927130239853403e-11 +-1.4793870239216767e-10 +-1.1376280894621395e-17 +1.670000061043744e-13 +2.1509660726688934e-16 +3.3718356446067196e-12 +-7.171819690941674e-15 +-1.086487077206716e-09 +-4.796997876436375e-10 +-3.54267141527312e-14 +-8.213759874280114e-10 +-3.033570018118274e-11 +-1.0369006969813676e-18 +-2.1788229343154277e-15 +-1.451544355963365e-11 +-3.9950363329988026e-10 +-1.4638858522998763e-09 +-7.748121082802036e-10 +-1.0904445211102742e-09 +-1.3818975419786658e-11 +5.26353210485017e-13 +-6.420570552816401e-10 +6.854182394155806e-13 +-4.3501559703e-11 +-6.137885502765225e-11 +-1.3427622111672173e-10 +4.0186853356429463e-10 +2.7234415283975777e-10 +5.179707809855553e-10 +6.80843350807924e-10 +-9.422235819690454e-11 +5.509103927413717e-11 +3.513979928969029e-10 +1.765689417834657e-10 +5.2736074920330054e-11 +-1.492816686829708e-13 +9.957386777003333e-12 +2.5244633102303585e-09 +-2.3184848489123976e-09 +4.0984773228270975e-10 +2.9737333211010003e-10 +1.0889719672497838e-10 +1.2895633577583777e-10 +3.282599452071855e-15 +7.103815014888384e-15 +6.246945044367561e-11 +1.263076433061896e-11 +2.128286120832277e-11 +1.6387452433425937e-10 +1.0583156429356799e-11 +3.4486259007079665e-15 +1.134096457183409e-13 +9.840346170621273e-12 +6.367107795602626e-11 +-1.93291775733344e-11 +4.141650027236221e-12 +6.231054426176675e-12 +7.163873485704885e-15 +8.373923225809402e-17 +2.028863398905383e-13 +4.279105723645883e-13 +3.043873246834808e-13 +1.5996926841888497e-13 +9.096647179411245e-14 +6.989085141514259e-17 +8.236634772967325e-15 +4.732029264305888e-14 +3.820505425395893e-14 +1.2824368476930067e-14 +2.0623985790953217e-15 +1.2284278121600062e-16 +-6.5729087597434285e-15 +3.342779884556801e-15 +8.464561623698627e-17 +-8.162392655005332e-18 +3.515677906986006e-15 +3.071447175021852e-17 +2.0260602689211787e-17 +-4.261544429775526e-14 +-2.6743791681289347e-11 +2.916128448091082e-08 +-5.314554373525571e-07 +6.415356347960754e-07 +1.0529531572273734e-07 +-1.7628932642566042e-06 +1.1861845383141402e-08 +3.5560472104647697e-12 +3.822434678502136e-15 +1.6938561699725884e-08 +1.7728704420604463e-11 +9.990133581716466e-07 +-1.7129364305371126e-14 +6.620552491229667e-12 +4.910889738310757e-07 +7.402327398619843e-09 +1.4342486700991526e-10 +1.0423430907551459e-13 +2.060321634951517e-14 +3.5934513357509504e-17 +-1.9038296962987594e-17 +2.6237559647086758e-17 \ No newline at end of file diff --git a/tests/integration_tests/run_no_reprocessing_openmc/test_openmc.py b/tests/integration_tests/run_no_reprocessing_openmc/test_openmc.py index 9e8e52532..b505248bc 100644 --- a/tests/integration_tests/run_no_reprocessing_openmc/test_openmc.py +++ b/tests/integration_tests/run_no_reprocessing_openmc/test_openmc.py @@ -1,4 +1,6 @@ """Run SaltProc without reprocessing""" +from tests.integration_tests import config + import sys import shutil from pathlib import Path @@ -8,8 +10,7 @@ import tables as tb import subprocess -from openmc.deplete import Results -from saltproc import app +from saltproc import app, Results @pytest.mark.slow def test_integration_2step_saltproc_no_reproc_heavy(): @@ -19,18 +20,38 @@ def test_integration_2step_saltproc_no_reproc_heavy(): args, check=True, cwd=cwd, - stdout=sys.stdout, + stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) - ref_results = tb.File('ref_saltproc_results.h5') - test_results = tb.File('saltproc_runtime/saltproc_results.h5') - - ref_mdens_error = np.loadtxt('reference_error') - - ref_fuel_mdens = ref_results.root.materials.fuel.before_reproc.comp[-1] - test_fuel_mdens = test_results.root.materials.fuel.before_reproc.comp[-1] - - test_mdens_error = np.array(ref_fuel_mdens) - np.array(test_fuel_mdens) - np.testing.assert_array_almost_equal(test_mdens_error, ref_mdens_error) - - shutil.rmtree('saltproc_runtime') + ref_path = cwd + '/ref_saltproc_results.h5' + test_path = cwd + '/saltproc_runtime/saltproc_results.h5' + if config['update']: + shutil.copyfile(test_path, ref_path) + + ref_results = Results(ref_path, load_in_out_streams=False) + test_results = Results(test_path, load_in_out_streams=False) + + def _get_nucs(res): + nucs = res.nuclide_idx['fuel'] + mass = [] + for nuc in nucs: + m = res.get_nuclide_mass('fuel', nuc, -1) + if np.abs(m) > 1e-15: + mass += [m] + return mass + ref_fuel_mass = _get_nucs(ref_results) + test_fuel_mass = _get_nucs(test_results) + + test_mass_error = np.array(ref_fuel_mass) - np.array(test_fuel_mass) + with open(cwd + '/test_error', mode='w') as f: + test_mass_error.tofile(f, sep='\n') + + if config['update']: + with open(cwd + '/reference_error', mode='w') as f: + test_mass_error.tofile(f, sep='\n') + return + + ref_mass_error = np.loadtxt(cwd + '/reference_error') + np.testing.assert_array_almost_equal(test_mass_error, ref_mass_error) + + shutil.rmtree(cwd + '/saltproc_runtime') diff --git a/tests/integration_tests/run_no_reprocessing_serpent/test_serpent.py b/tests/integration_tests/run_no_reprocessing_serpent/test_serpent.py index bdf08c6a0..b5992e64a 100644 --- a/tests/integration_tests/run_no_reprocessing_serpent/test_serpent.py +++ b/tests/integration_tests/run_no_reprocessing_serpent/test_serpent.py @@ -18,18 +18,23 @@ def test_integration_2step_saltproc_no_reproc_heavy(): args, check=True, cwd=cwd, - stdout=sys.stdout, + stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) - ref_result = serpentTools.read(cwd + '/reference_dep.m') - test_result = serpentTools.read(cwd + '/saltproc_runtime/step_1_data/runtime_input.serpent_dep.m') + test_path = cwd + '/saltproc_runtime/step_1_data/runtime_input.serpent_dep.m' + ref_path = cwd + '/reference_dep.m' + + ref_result = serpentTools.read(ref_path) + test_result = serpentTools.read(test_path) - ref_mdens_error = np.loadtxt(cwd + '/reference_error') ref_fuel_mdens = ref_result.materials['fuel'].mdens[:, -2] test_fuel_mdens = test_result.materials['fuel'].mdens[:, -1] test_mdens_error = np.array(ref_fuel_mdens - test_fuel_mdens) + + ref_mdens_error = np.loadtxt(cwd + '/reference_error') + np.testing.assert_array_almost_equal(test_mdens_error, ref_mdens_error) shutil.rmtree(cwd + '/saltproc_runtime') diff --git a/tests/openmc_data/depletion_settings.json b/tests/openmc_data/depletion_settings.json index 5a0a6c7d3..bd8bd1bc5 100644 --- a/tests/openmc_data/depletion_settings.json +++ b/tests/openmc_data/depletion_settings.json @@ -3,7 +3,6 @@ "fission_q": "serpent_fissq.json", "diff_burnable_mats": false, "normalization_mode": "fission-q", - "dilute_initial": 1000, "fission_yield_mode": "constant", "fission_yield_opts": null, "reaction_rate_mode": "direct", diff --git a/tests/openmc_data/msbr_geometry_base.xml b/tests/openmc_data/msbr_geometry_base.xml index 259d3d628..8e4524714 100644 --- a/tests/openmc_data/msbr_geometry_base.xml +++ b/tests/openmc_data/msbr_geometry_base.xml @@ -1,319 +1,319 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10.16 10.16 45 45 @@ -373,600 +373,600 @@ 9 10 10 9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/openmc_data/msbr_geometry_switch.xml b/tests/openmc_data/msbr_geometry_switch.xml index b393d870e..4544c2386 100644 --- a/tests/openmc_data/msbr_geometry_switch.xml +++ b/tests/openmc_data/msbr_geometry_switch.xml @@ -1,308 +1,308 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10.16 10.16 45 45 @@ -362,600 +362,600 @@ 9 9 9 9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/openmc_data/msbr_materials_ao.xml b/tests/openmc_data/msbr_materials_ao.xml index 90892be5d..f629d69ce 100644 --- a/tests/openmc_data/msbr_materials_ao.xml +++ b/tests/openmc_data/msbr_materials_ao.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/openmc_data/msbr_materials_nameless.xml b/tests/openmc_data/msbr_materials_nameless.xml index a6209d41d..994dd96b5 100644 --- a/tests/openmc_data/msbr_materials_nameless.xml +++ b/tests/openmc_data/msbr_materials_nameless.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/openmc_data/msbr_materials_wo.xml b/tests/openmc_data/msbr_materials_wo.xml index ae04a68cc..4562c0224 100644 --- a/tests/openmc_data/msbr_materials_wo.xml +++ b/tests/openmc_data/msbr_materials_wo.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/openmc_data/msbr_settings.xml b/tests/openmc_data/msbr_settings.xml index aab04d40f..1a7702523 100644 --- a/tests/openmc_data/msbr_settings.xml +++ b/tests/openmc_data/msbr_settings.xml @@ -1,4 +1,4 @@ - + eigenvalue 1000 diff --git a/tests/unit_tests/__init__.py b/tests/unit_tests/__init__.py new file mode 100644 index 000000000..e69de29bb