Skip to content

Commit 398cb13

Browse files
committed
Add tests that check various cases for OpenMC depletion input
1 parent 3cc1a18 commit 398cb13

4 files changed

Lines changed: 154 additions & 12 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"proc_input_file": "../tap_processes.json",
3+
"dot_input_file": "../tap_paths.dot",
4+
"n_depletion_steps": 2,
5+
"depcode": {
6+
"codename": "openmc",
7+
"template_input_file_path": {
8+
"materials": "tap_materials.xml",
9+
"settings": "tap_settings.xml"
10+
},
11+
"geo_file_paths": ["tap_geometry_base.xml"],
12+
"chain_file_path": "test_chain.xml",
13+
"depletion_settings": {
14+
"operator_kwargs": {
15+
"fission_yield_mode": "constant",
16+
"fission_yield_opts": {"energy": 0.0253}
17+
}
18+
}
19+
},
20+
"simulation": {
21+
"sim_name": "tap_test_simulation_openmc"
22+
},
23+
"reactor": {
24+
"volume": 1.0,
25+
"mass_flowrate": 9.92E+6,
26+
"power_levels": [ 1.250E+9 ],
27+
"depletion_timesteps": [ 5 ],
28+
"timestep_units": "d"
29+
}
30+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"proc_input_file": "../tap_processes.json",
3+
"dot_input_file": "../tap_paths.dot",
4+
"n_depletion_steps": 2,
5+
"depcode": {
6+
"codename": "openmc",
7+
"template_input_file_path": {
8+
"materials": "tap_materials.xml",
9+
"settings": "tap_settings.xml"
10+
},
11+
"geo_file_paths": ["tap_geometry_base.xml"],
12+
"chain_file_path": "test_chain.xml",
13+
"depletion_settings": {
14+
"operator_kwargs": {
15+
"fission_yield_mode": "cutoff",
16+
"fission_yield_opts": {
17+
"cutoff": 112.0,
18+
"thermal_energy": 0.0253,
19+
"fast_energy": 500000.0}
20+
}
21+
}
22+
},
23+
"simulation": {
24+
"sim_name": "tap_test_simulation_openmc"
25+
},
26+
"reactor": {
27+
"volume": 1.0,
28+
"mass_flowrate": 9.92E+6,
29+
"power_levels": [ 1.250E+9 ],
30+
"depletion_timesteps": [ 5 ],
31+
"timestep_units": "d"
32+
}
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"proc_input_file": "../tap_processes.json",
3+
"dot_input_file": "../tap_paths.dot",
4+
"n_depletion_steps": 2,
5+
"depcode": {
6+
"codename": "openmc",
7+
"template_input_file_path": {
8+
"materials": "tap_materials.xml",
9+
"settings": "tap_settings.xml"
10+
},
11+
"geo_file_paths": ["tap_geometry_base.xml"],
12+
"chain_file_path": "test_chain.xml",
13+
"depletion_settings": {
14+
"operator_kwargs": {
15+
"reaction_rate_mode": "flux",
16+
"reaction_rate_opts": {
17+
"energies": [0.0253, 500000.0],
18+
"reactions": ["(n,gamma)"],
19+
"nuclides": ["U235", "Pu239"]}
20+
}
21+
}
22+
},
23+
"simulation": {
24+
"sim_name": "tap_test_simulation_openmc"
25+
},
26+
"reactor": {
27+
"volume": 1.0,
28+
"mass_flowrate": 9.92E+6,
29+
"power_levels": [ 1.250E+9 ],
30+
"depletion_timesteps": [ 5 ],
31+
"timestep_units": "d"
32+
}
33+
}

tests/unit_tests/test_app.py

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@
66
from saltproc.app import read_main_input, get_extraction_processes
77
from saltproc.app import get_feeds, get_extraction_process_paths
88

9+
expected_depletion_settings = {'method': 'predictor',
10+
'final_step': True,
11+
'operator_kwargs': {
12+
'diff_burnable_mats': False,
13+
'normalization_mode': 'fission-q',
14+
'fission_q': None,
15+
'dilute_initial': 1000,
16+
'fission_yield_mode': 'constant',
17+
'fission_yield_opts': None,
18+
'reaction_rate_mode': 'direct',
19+
'reaction_rate_opts': None,
20+
'reduce_chain': False,
21+
'reduce_chain_level': None},
22+
'output': True,
23+
'integrator_kwargs': {}}
924

1025
@pytest.mark.parametrize("codename, ext", [
1126
("serpent", ".ini"),
@@ -30,18 +45,7 @@ def test_read_main_input(cwd, codename, ext):
3045
assert depcode_input['chain_file_path'] == \
3146
str((input_path / 'test_chain.xml').resolve())
3247
assert depcode_input['depletion_settings'] == \
33-
{'method': 'predictor',
34-
'final_step': True,
35-
'operator_kwargs': {'normalization_mode': 'fission-q',
36-
'fission_q': None,
37-
'dilute_initial': 1000,
38-
'fission_yield_mode': 'constant',
39-
'reaction_rate_mode': 'direct',
40-
'reaction_rate_opts': None,
41-
'reduce_chain': False,
42-
'reduce_chain_level': None},
43-
'output': True,
44-
'integrator_kwargs': {}}
48+
expected_depletion_settings
4549
elif codename == 'serpent':
4650
assert depcode_input['template_input_file_path'] == \
4751
str((input_path / 'tap_template.ini').resolve())
@@ -59,6 +63,48 @@ def test_read_main_input(cwd, codename, ext):
5963
assert reactor_input['timestep_units'] == 'd'
6064
assert reactor_input['timestep_type'] == 'stepwise'
6165

66+
@pytest.mark.parametrize("filename", [
67+
"constant_fission_yield",
68+
"cutoff_fission_yield",
69+
"flux_reaction_rate"])
70+
def test_openmc_depletion_settings(cwd, filename):
71+
data_path = 'openmc_data'
72+
data_path = cwd / data_path
73+
main_input = str(data_path / f'{filename}_input.json')
74+
out = read_main_input(main_input)
75+
input_path, process_input_file, path_input_file, object_input = out
76+
depcode_input, simulation_input, reactor_input = object_input
77+
78+
assert depcode_input['template_input_file_path'] == \
79+
{'materials': str((input_path / 'tap_materials.xml').resolve()),
80+
'settings': str((input_path / 'tap_settings.xml').resolve())}
81+
assert depcode_input['chain_file_path'] == \
82+
str((input_path / 'test_chain.xml').resolve())
83+
84+
modified_operator_kwargs = expected_depletion_settings['operator_kwargs'].copy()
85+
if filename == 'constant_fission_yield':
86+
87+
operator_kwargs = {'fission_yield_opts': {'energy': 0.0253}}
88+
modified_operator_kwargs.update(operator_kwargs)
89+
elif filename == 'cutoff_fission_yield':
90+
operator_kwargs = {'fission_yield_mode': 'cutoff',
91+
'fission_yield_opts': {'cutoff': 112.0,
92+
'thermal_energy': 0.0253,
93+
'fast_energy': 5.0e5}}
94+
modified_operator_kwargs.update(operator_kwargs)
95+
96+
elif filename == 'flux_reaction_rate':
97+
operator_kwargs = {'reaction_rate_mode': 'flux',
98+
'reaction_rate_opts': {'energies': [0.0253, 500000.0],
99+
'reactions': ['(n,gamma)'],
100+
'nuclides': ['U235', 'Pu239']}
101+
}
102+
modified_operator_kwargs.update(operator_kwargs)
103+
104+
assert depcode_input['depletion_settings']['operator_kwargs'] == \
105+
modified_operator_kwargs
106+
107+
62108
def test_get_extraction_processes(proc_test_file):
63109
procs = get_extraction_processes(proc_test_file)
64110
assert procs['fuel']['heat_exchanger'].volume == 1.37E+7

0 commit comments

Comments
 (0)