-
Notifications
You must be signed in to change notification settings - Fork 16
Add OpenMC depletion settings to input file #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
6896f02
745c037
91b1e69
c663d58
6ec1362
a33d3c9
a854654
68b210e
ee6210b
a1b2447
dd6c8cc
544f35e
434ac51
d138aa5
be03b9d
4b77fd2
3bdc6d4
ffaf326
c1f8835
3cc1a18
398cb13
9344619
df31b93
80625ae
1f1d8af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| from jsonschema import Draft202012Validator, validators | ||
|
|
||
| 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure. I pulled this block of code from here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?