diff --git a/saltproc/app.py b/saltproc/app.py index 45b28fdb6..63a4682b7 100644 --- a/saltproc/app.py +++ b/saltproc/app.py @@ -160,7 +160,6 @@ def read_main_input(main_inp_file): schema = json.load(s) try: DefaultValidatingValidator(schema).validate(input_parameters) - #jsonschema.validate(instance=j, schema=v) except jsonschema.exceptions.ValidationError: print("Your input file is improperly structured.\ Please see saltproc/tests/test.json for an example.") @@ -205,8 +204,8 @@ def read_main_input(main_inp_file): depcode_input['chain_file_path']).resolve()) else: raise ValueError( - f'{codename} is not a supported depletion code.' - 'Accepts: "serpent" or "openmc".') + f'{depcode_input["codename"]} is not a supported depletion' + ' code. Accepts: "serpent" or "openmc".') depcode_input['output_path'] = output_path geo_list = depcode_input['geo_file_paths'] @@ -245,17 +244,7 @@ def _create_depcode_object(depcode_input): """Helper function for `run()` """ codename = depcode_input.pop('codename') depcode = _codename_map[codename] - - if codename == 'openmc': - depletion_settings = depcode_input.pop('depletion_settings') - chain_file_path = depcode_input.pop('chain_file_path') - depcode = depcode(**depcode_input) - - if codename == 'openmc': - depcode.chain_file_path = chain_file_path - depcode.depletion_settings = depletion_settings - depcode_input['codename'] = codename return depcode @@ -280,11 +269,13 @@ def _create_reactor_object(reactor_input): return msr -def _process_main_input_reactor_params(reactor_input, n_depletion_steps, codename): +def _process_main_input_reactor_params(reactor_input, + n_depletion_steps, + codename): """ Process SaltProc reactor class input parameters based on the value and - data type of the `n_depletion_steps` parameter, and throw errors if the input - parameters are incorrect. + data type of the `n_depletion_steps` parameter as well as the depeltion code + being used, and throw errors if the input parameters are incorrect. """ depletion_timesteps = reactor_input['depletion_timesteps'] diff --git a/saltproc/input_schema.json b/saltproc/input_schema.json index dafcd559c..73ca0936e 100644 --- a/saltproc/input_schema.json +++ b/saltproc/input_schema.json @@ -271,7 +271,7 @@ "default": false} }, "default": {}, - "required": ["sim_name", "db_name"] + "required": ["sim_name"] }, "reactor": { "description": "Reactor class input parameters", diff --git a/saltproc/openmc_depcode.py b/saltproc/openmc_depcode.py index 32d0cc6b2..1dea7aa44 100644 --- a/saltproc/openmc_depcode.py +++ b/saltproc/openmc_depcode.py @@ -36,10 +36,6 @@ class OpenMCDepcode(Depcode): Number of active cycles. inactive_cycles : int Number of inactive cycles. - depletion_settings : dict - Keyword arguments to pass to :func:`openmc.model.deplete()`. - chain_file_path : str - Path to depletion chain file """ @@ -47,7 +43,10 @@ def __init__(self, output_path, exec_path, template_input_file_path, - geo_file_paths): + geo_file_paths, + depletion_settings, + chain_file_path + ): """Initialize a OpenMCDepcode object. Parameters @@ -65,6 +64,10 @@ def __init__(self, Path to file that contains the reactor geometry. List of `str` if reactivity control by switching geometry is `On` or just `str` otherwise. + depletion_settings : dict + Keyword arguments to pass to :func:`openmc.model.deplete()`. + chain_file_path : str + Path to depletion chain file """ @@ -74,6 +77,9 @@ def __init__(self, else: exec_path == (Path(template_input_file_path['settings'].parents[0]) / exec_path).resolve() + self.depletion_settings = depletion_settings + self.chain_file_path = chain_file_path + super().__init__("openmc", output_path, exec_path,