Skip to content

Commit

Permalink
Changes from @LukeSeifert's second review
Browse files Browse the repository at this point in the history
  • Loading branch information
yardasol committed Jan 17, 2023
1 parent 9344619 commit 0a95c29
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
23 changes: 7 additions & 16 deletions saltproc/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand All @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion saltproc/input_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
"default": false}
},
"default": {},
"required": ["sim_name", "db_name"]
"required": ["sim_name"]
},
"reactor": {
"description": "Reactor class input parameters",
Expand Down
16 changes: 11 additions & 5 deletions saltproc/openmc_depcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,17 @@ 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
"""

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
Expand All @@ -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
"""

Expand All @@ -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,
Expand Down

0 comments on commit 0a95c29

Please sign in to comment.