66from saltproc .app import read_main_input , get_extraction_processes
77from 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+
62108def 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