diff --git a/saltproc/abc.py b/saltproc/abc.py index 5149e0dd1..b179143c7 100644 --- a/saltproc/abc.py +++ b/saltproc/abc.py @@ -15,6 +15,8 @@ class Depcode(ABC): step_metadata : dict of str to type Holds depletion code depletion step metadata. Metadata labels are keys and metadata values are values. + exec_path : str + Path to depletion code executable. runtime_inputfile : str Path to input file used to run depletion step. runtime_matfile : str @@ -25,7 +27,6 @@ class Depcode(ABC): def __init__(self, codename, - exec_path, template_input_file_path, geo_files=None, npop=50, @@ -37,8 +38,6 @@ def __init__(self, ---------- codename : str Name of depletion code. - exec_path : str - Path to depletion code executable. template_input_file_path : str or dict of str to str Path(s) to depletion code input file(s), or a dictionary where the input type (e.g. material, geometry, settings, etc.) as a @@ -57,7 +56,6 @@ def __init__(self, """ self.codename = codename - self.exec_path = exec_path self.template_input_file_path = template_input_file_path self.geo_files = geo_files self.npop = npop diff --git a/saltproc/app.py b/saltproc/app.py index 236c4bcd1..450ba692e 100644 --- a/saltproc/app.py +++ b/saltproc/app.py @@ -247,12 +247,13 @@ def _create_depcode_object(depcode_input): raise ValueError( f'{depcode_input["codename"]} is not a supported depletion code') - depcode = depcode(depcode_input['exec_path'], - depcode_input['template_input_file_path'], + depcode = depcode(depcode_input['template_input_file_path'], geo_files=depcode_input['geo_file_paths'], npop=depcode_input['npop'], active_cycles=depcode_input['active_cycles'], inactive_cycles=depcode_input['inactive_cycles']) + if codename != 'openmc': + depcode.exec_path = depcode_input['exec_path'] return depcode diff --git a/saltproc/input_schema.json b/saltproc/input_schema.json index 78cefd81f..b4540e6db 100644 --- a/saltproc/input_schema.json +++ b/saltproc/input_schema.json @@ -63,6 +63,9 @@ }, "then": { "properties": { + "exec_path": { + "description": "Path to depletion code executable", + "type": "string" }, "template_input_file_path": { "description": "Path to Serpent template inputfile", "type": "string", diff --git a/saltproc/openmc_depcode.py b/saltproc/openmc_depcode.py index e5063ba82..155fdc27d 100644 --- a/saltproc/openmc_depcode.py +++ b/saltproc/openmc_depcode.py @@ -26,6 +26,8 @@ class OpenMCDepcode(Depcode): step_metadata : dict of str to type Holds OpenMC depletion step metadata. Metadata labels are keys and metadata values are values. + exec_path : str + Path to OpenMC depletion script. runtime_inputfile : dict of str to str Paths to OpenMC input files used to run depletion step. Contains neutron settings and geometry. @@ -36,7 +38,6 @@ class OpenMCDepcode(Depcode): """ def __init__(self, - exec_path="openmc_deplete.py", template_input_file_path={"geometry": "./geometry.xml", "settings": "./settings.xml", "chain_file": "./chain_simple.xml"}, @@ -48,8 +49,6 @@ def __init__(self, Parameters ---------- - exec_path : str - Path to OpenMC depletion script. template_input_file_path : dict of str to str Path to user input files (``.xml`` file for geometry, material, and settings) for OpenMC. File type as strings @@ -68,12 +67,12 @@ def __init__(self, """ super().__init__("openmc", - exec_path, template_input_file_path, geo_files, npop, active_cycles, inactive_cycles) + self.exec_path='openmc_deplete.py' self.runtime_inputfile = {'geometry': './geometry.xml', 'settings': './settings.xml'}, self.runtime_matfile = './materials.xml' diff --git a/saltproc/serpent_depcode.py b/saltproc/serpent_depcode.py index c55b9a40d..d2967f63a 100644 --- a/saltproc/serpent_depcode.py +++ b/saltproc/serpent_depcode.py @@ -25,6 +25,8 @@ class SerpentDepcode(Depcode): step_metadata : dict of str to type Holds Serpent2 depletion step metadata. Metadata labels are keys and metadata values are values. + exec_path : str + Path to Serpent2 executable. runtime_inputfile : str Path to Serpent2 input file used to run depletion step. Contains neutron settings and non-burnable materials. @@ -35,7 +37,6 @@ class SerpentDepcode(Depcode): """ def __init__(self, - exec_path="sss2", template_input_file_path="reactor.serpent", geo_files=None, npop=50, @@ -45,8 +46,6 @@ def __init__(self, Parameters ---------- - exec_path : str - Path to Serpent2 executable. template_input_file_path : str Path to user input file for Serpent2 geo_files : str or list, optional @@ -62,7 +61,6 @@ def __init__(self, """ super().__init__("serpent", - exec_path, template_input_file_path, geo_files=geo_files, npop=npop, @@ -414,6 +412,9 @@ def run_depletion_step(self, cores, nodes): """ + if self.exec_path is None: + raise RuntimeError('Attribute exec_path needs to be set before' + 'running depletion step') args = (self.exec_path, '-omp', str(cores), self.runtime_inputfile) print('Running %s' % (self.codename)) try: