-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add functionality to avoid redundant cross-section downloads if environment variable is set #46
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 @davidepettinari @SteSeg for this!
I have one concern: what happens if one has OPENMC_CROSS_SECTIONS
in the environment variables but the library is not ENDFB-8.0-NNDC?
Is there a way to ensure the correct library is used?
if "OPENMC_CROSS_SECTIONS" not in os.environ: | ||
import openmc_data_downloader as odd |
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 don't think the import needs to be optional here
@RemDelaporteMathurin usually neutronics people want to test the model with their cross section library of choice. Also, for tritium production calculation the neutronics community tends to prefer FENDL over ENDF anyways. import argparse
def _parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("-xs", "--use_original_library", type=Bool, default=True)
args = parser.parse_args()
return args
if not args.use_original_library:
if "OPENMC_CROSS_SECTIONS" not in os.environ:
import openmc_data_downloader as odd |
I respect that, but it's also a matter of reproducibility of results here
Do you remember why we went with ENDF then?
Argparse is useful when executing a script, but with import libra_toolbox.neutronics
# change the cross sections library
libra_toolbox.neutronics.library = "another valid library"
baby_openmc_model = libra_toolbox.neutronics.model(......)
baby_openmc_model.run() |
Maybe FENDL was not downloadable? I don't know. Locally I always used FENDL by the way.
Sure, this will do as well. We will implement it on this PR. |
@SteSeg @davidepettinari maybe it's better to add it as an argument of libra-toolbox/libra_toolbox/neutronics/vault.py Lines 1 to 7 in 7fd6319
Something like: def build_vault_model(
settings=None,
tallies=None,
added_cells=[],
added_materials=[],
overall_exclusion_region=None,
cross_section_library: str="ENDFB-8.0-NNDC" Then: if cross_section_library != "local":
if "OPENMC_CROSS_SECTIONS" not in os.environ:
materials.download_cross_section_data(
libraries=[cross_section_library],
set_OPENMC_CROSS_SECTIONS=True,
particles=["neutron"],
) |
@shimwell is FENDL downloadable in ODD? @eepeterson what do you think would be the best option here? the thing that worries me is how to know which library was used in a certain model (python script) if we rely on "local" libraries |
@SteSeg @davidepettinari it seems like FENDL-3.1d can be downloaded: |
Unfortunately the h5 files made don't contain any identify info such as "FENDL 3.2c processed by". Although I like the idea and also would like this ability to add tags. See issue openmc-dev/data#54 let us try and see if this issue can be solved, otherwise we can add a custom hdf5 attribute to the data, but best to try an official way first Looks like the newest FENDL is 3.2c, I have not tried to process that one yet but I can give it a go. I have processed the other releases and have all the scripts in this repo. I should mention the official processing scripts can be found here. |
@shimwell I just tried running this analysis with FENDL 3.2c and things seem to work fine! For reproducibility it's really a shame that there is no way of knowing the source of the cross sections that were used without asking the person who ran it directly..... |
I just put in this PR which can help by adding a string attribute to the h5 file, the string can contain things like "FENDL 3.2c" |
Just release an update to openmc-data so it includes the ability to make h5 files for FENDL 3.2c. |
This pull request implements a feature to prevent the redundant download of nuclear data cross-sections for OpenMC if the required environment variable (
OPENMC_CROSS_SECTIONS
) is already defined on the system. This enhancement ensures efficient usage of resources and avoids unnecessary downloads, especially for systems where the cross-section libraries are already available.These changes were developed collaboratively with @SteSeg .