Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6896f02
add machinery to set depletion settings for openmc in main input file
yardasol Nov 28, 2022
745c037
fix json schema (format, defaults)
yardasol Nov 28, 2022
91b1e69
move default schema code to new file; fix missing param in Reactor
yardasol Nov 30, 2022
c663d58
fix input schema
yardasol Nov 30, 2022
6ec1362
fix file_interface_serpent integration test
yardasol Nov 30, 2022
a33d3c9
Merge branch 'master' into openmc-depletion-settings
yardasol Dec 6, 2022
a854654
add reactor fixutres; cleanup timestep handling; fix failing integrat…
yardasol Dec 7, 2022
68b210e
move lowercasing 'codename' to its first needed case
yardasol Dec 7, 2022
ee6210b
update releasenotes
yardasol Dec 7, 2022
a1b2447
remove cruft comments
yardasol Dec 7, 2022
dd6c8cc
cleanup _process_main_input_reactor_params()
yardasol Dec 7, 2022
544f35e
add more coverage to test_read_main_input()
yardasol Dec 7, 2022
434ac51
remove input variables from input files that are equal to their defaults
yardasol Dec 8, 2022
d138aa5
add default values for various parameters; consistency changes in cod…
yardasol Dec 8, 2022
be03b9d
update releasenotes
yardasol Dec 8, 2022
4b77fd2
Merge branch 'master' into openmc-depletion-settings
yardasol Jan 9, 2023
3bdc6d4
typo fixes in input_schema.json
yardasol Jan 10, 2023
ffaf326
overhaul input file description in docpages
yardasol Jan 10, 2023
c1f8835
add unevaluatedProperties keyword to limit json input to declared sch…
yardasol Jan 11, 2023
3cc1a18
Revert "add unevaluatedProperties keyword to limit json input to decl…
yardasol Jan 11, 2023
398cb13
Add tests that check various cases for OpenMC depletion input
yardasol Jan 11, 2023
9344619
changes from @LukeSeifert's review
yardasol Jan 11, 2023
df31b93
Changes from @LukeSeifert's second review
yardasol Jan 17, 2023
80625ae
Add tests for timestep validating and scaling functions; changes from
yardasol Jan 17, 2023
1f1d8af
update the endfb71 msbr serpent model to match the new syntax
yardasol Jan 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions doc/releasenotes/v0.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,26 @@ Python API Changes

- Input file format changes:

- Added default values for certain input parameters
- Added depletion settings for OpenMC
- ``num_depsteps`` → ``n_depletion_steps``
- ``depcode['template_inputfile_path']`` → ``depcode['template_input_file_path']``
- The ``depcode['template_input_file_path']`` input variable now has the following depletion-code-depentent types:

- ``str`` for ``Serpent2``
- ``dict`` of ``str`` to ``str`` for ``openmc``

- ``depcode['iter_inputfile']`` → (removed)
- ``depcode['iter_matfile']`` → (removed)
- ``depcode['npop']`` → (removed)
- ``depcode['active_cycles']`` → (removed)
- ``depcode['inactive_cycles']`` → (removed)
- ``reactor['dep_step_length_cumulative']`` → ``depletion_timesteps``
- (new) → ``reactor['timestep_type']``
- (new) → ``reactor['timestep_units']``

.. note:: While the ``iter_inputfile`` and ``iter_matfile`` variables have been removed from the saltproc input file,
they remain part of the ``DepcodeSerpent`` class as attributes. Their use is unchanged, save for the fact they can no
longer be initialized by the user during object creation.
.. note:: Variables that have been removed from the saltproc input file
remain part of the ``Depcode`` classes as attributes. Their use is unchanged, save for the fact they can no
longer be initialized by the user from the SaltProc input file.


- New/changed classes, methods, and attributes:
Expand All @@ -130,6 +138,7 @@ Python API Changes
- ``write_depcode_input()`` → ``write_runtime_input()``
- ``iter_inputfile`` → ``runtime_inputfile``
- ``iter_matfile`` → ``runtime_matfile``
- ``geo_files`` → ``geo_file_paths``

- ``DepcodeSerpent`` → ``SerpentDepcode``

Expand All @@ -155,6 +164,7 @@ Python API Changes
- ``write_depcode_input()`` → ``write_runtime_input()``
- ``iter_inputfile`` → ``runtime_inputfile``
- ``iter_matfile`` → ``runtime_matfile``
- ``geo_files`` → ``geo_file_paths``


- ``OpenMCDepcode`` is a ``Depcode`` subclass that interfaces with ``openmc``. This class implements the following functions
Expand All @@ -177,6 +187,12 @@ Python API Changes

- ``calc_rem_efficiency()`` → ``calculate_removal_efficiency``

- ``Reactor``

- ``dep_step_length_cumulative`` → ``depletion_timesteps``
- (new) → ``timestep_units``
- (new) → ``timestep_type``

- ``Sparger``

- ``calc_rem_efficiency()`` → ``calculate_removal_efficiency``
Expand Down
12 changes: 4 additions & 8 deletions examples/msbr/msbr_main.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
{
"proc_input_file": "msbr_objects.json",
"dot_input_file": "msbr.dot",
"output_path": "data",
"num_depsteps": 12,
"n_depletion_steps": 12,
"depcode": {
"codename": "serpent",
"exec_path": "sss2",
"template_input_file_path": "msbr.serpent",
"geo_file_paths": ["geometry/msbr_full.ini"]
},
"simulation": {
"sim_name": "msbr_example_simulation",
"db_name": "msbr_kl_100_saltproc.h5",
"restart_flag": false,
"adjust_geo": false
"sim_name": "msbr_kl_100_simulation"
},
"reactor": {
"volume": 1.0,
"mass_flowrate": 9920000,
"power_levels": [ 2250000000 ],
"dep_step_length_cumulative": [ 3 ]
"depletion_timesteps": [ 3 ],
"timestep_units": "d"
}
}
11 changes: 4 additions & 7 deletions examples/tap/tap_main.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"proc_input_file": "tap_objects.json",
"dot_input_file": "tap.dot",
"output_path": "data",
"num_depsteps": 3,
"n_depletion_steps": 3,
"depcode": {
"codename": "serpent",
"exec_path": "sss2",
"template_input_file_path": "tap.serpent",
"geo_file_paths": [
"geometry/347_base.ini",
Expand All @@ -26,15 +24,14 @@
]
},
"simulation": {
"sim_name": "test_simulation",
"db_name": "db_saltproc.h5",
"restart_flag": false,
"sim_name": "tap_example_simulation",
"adjust_geo": true
},
"reactor": {
"volume": 1.0,
"mass_flowrate": 9920000,
"power_levels": [ 1250000000 ],
"dep_step_length_cumulative": [ 2 ]
"depletion_timesteps": [ 2 ],
"timestep_units": "d"
}
}
21 changes: 21 additions & 0 deletions saltproc/_schema_default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from jsonschema import Draft202012Validator, validators

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment here describing what this is used for

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean a doc string for extend_with_default?

def extend_with_default(validator_class):
validate_properties = validator_class.VALIDATORS["properties"]

def set_defaults(validator, properties, instance, schema):
for property, subschema in properties.items():
if "default" in subschema:
instance.setdefault(property, subschema["default"])

for error in validate_properties(
validator, properties, instance, schema,
):
yield error

return validators.extend(
validator_class, {"properties" : set_defaults},
)
Comment on lines +3 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't catch this before, but what is the purpose of having nested function definitions? Why not break this into two functions that can both be unit-tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. I pulled this block of code from here

Copy link
Contributor Author

@yardasol yardasol Jan 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samgdotson I actually created an issue to look into this as there is a bug that exists with the current setup.



DefaultValidatingValidator = extend_with_default(Draft202012Validator)
8 changes: 4 additions & 4 deletions saltproc/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self,
output_path,
exec_path,
template_input_file_path,
geo_files):
geo_file_paths):
"""Initialize a Depcode object.

Parameters
Expand All @@ -47,7 +47,7 @@ def __init__(self,
the input type (e.g. material, geometry, settings, etc.) as a
string are keys, and the path to the input file are values.
Type depends on depletion code in use.
geo_files : str or list, optional
geo_file_paths : str or list, optional
Path to file that contains the reactor geometry.
List of `str` if reactivity control by
switching geometry is `On` or just `str` otherwise.
Expand All @@ -57,7 +57,7 @@ def __init__(self,
self.output_path = output_path
self.exec_path = exec_path
self.template_input_file_path = template_input_file_path
self.geo_files = geo_files
self.geo_file_paths = geo_file_paths
self.neutronics_parameters = {}
self.step_metadata = {}
self.runtime_inputfile = None
Expand Down Expand Up @@ -115,7 +115,7 @@ def run_depletion_step(self, cores, nodes):
@abstractmethod
def switch_to_next_geometry(self):
"""Changes the geometry used in the depletion code simulation to the
next geometry file in ``geo_files``
next geometry file in ``geo_file_paths``
"""

@abstractmethod
Expand Down
Loading