-
Notifications
You must be signed in to change notification settings - Fork 2
OpenMC-only R2S Transport & Depletion #30
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
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks @anu1217 - just one high-level comment on reusing the code in the OpenMC input file that relies on ALARA
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.
This has a lot of overlap with the OpenMC input file that relies on ALARA for activation. Do you think we can combine them somehow or reuse the pieces. A major reason to do so will be to guarantee that we are actually solving the same problem in both cases.
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.
It should be fairly straightforward to combine them. I imagine some new argparse options and/or methods will take care of the choice of sources used for photon transport...will commit these changes shortly.
Replacing with updated version that can also perform PyNE R2S
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.
I've left several final (?) comments. We can probably move on from here to start focusing on comparing results.
WC_Layers/OpenMC_R2S.py
Outdated
) | ||
return photon_model | ||
|
||
def run_depletion(inputs, neutron_model): |
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.
Can we combine this with deplete_wc
? The only thing this does differently is unpack the inputs
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.
Yes, we can unpack inputs
in main()
instead
args = parser.parse_args() | ||
return args | ||
|
||
def read_yaml(args): |
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.
This might make more sense if you just pass in the arg with the filename than all the args
inputs = yaml.safe_load(transport_file) | ||
return inputs | ||
|
||
def create_materials_obj(inputs): |
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.
(apologies if this is contradicting earlier advice, but...)
This can probably be combined with make_materials()
since it doesn't do much other than get the densities first.
WC_Layers/OpenMC_R2S.py
Outdated
|
||
else: | ||
photon_source = openmc.IndependentSource( | ||
energy = openmc.stats.Discrete(0, 1.0), |
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.
For consistency, make this energy = None
like above, maybe?
if str(mat.id) in activated_mats_list : | ||
mat = results[-1].get_material(str(mat.id)) | ||
energy = mat.get_decay_photon_energy() |
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.
This might be a good place for a little function
energy = get_decay_photon_energies(mat, results[-1])
if args.neutron_transport == True: | ||
neutron_model.tallies = make_neutron_tallies(inputs['filename_dict']['mesh_file']) | ||
neutron_model.export_to_model_xml("neutron_model.xml") | ||
else: |
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.
It seems as though args.neutron_transport == False
is treated the same as args.photon_transport == True
in this case, even though you don't actually check args.photon_transport
.
I guess a bunch of this logic is kind of vague here. It might be useful to rethink this so that it's a little more clear...
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.
It might even make sense to have a pyne_r2s
function and an openmc_r2s
function where each tackles the neutron/photon steps as necessary.
num_cooling_steps = (inputs['dep_params']['source_rates']).count(0) | ||
photon_model = make_openmc_photon_sources(num_cooling_steps, activation_mats, unstructured_mesh, neutron_model, inputs) | ||
|
||
photon_tallies = make_photon_tallies(inputs['coeff_geom'], photon_model, num_cooling_steps) |
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.
Do you ever write this photon model to an XML file?
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.
Yes, this happens towards the end of the make_photon_tallies() function
WC_Layers/OpenMC_R2S.py
Outdated
if args.pyne_r2s == True: | ||
if args.neutron_transport == True: | ||
neutron_model.tallies = make_neutron_tallies(inputs['filename_dict']['mesh_file']) | ||
neutron_model.export_to_model_xml("neutron_model.xml") |
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.
Can't you also run OpenMC directly from here?
- Generalize make_settings() to take source as input instead of neutron_source - Call make_settings() twice to assign neutron settings and photon settings separately - Rearrange some .export_to_model_xml() calls
This PR contains a script that performs all the necessary R2S physics steps using only OpenMC. It works as intended for the model with W and C spherical shells, and works with some modifications for the HCPB model. The latter may also require some variance reduction that could be hard-coded into the script, or perhaps selected using argparse.