Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
16 changes: 10 additions & 6 deletions libra_toolbox/neutronics/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def build_vault_model(
try:
import openmc
import openmc.model
import openmc_data_downloader as odd
import os

if "OPENMC_CROSS_SECTIONS" not in os.environ:
import openmc_data_downloader as odd
Comment on lines +58 to +59
Copy link
Collaborator

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

except ModuleNotFoundError:
raise ModuleNotFoundError("openmc and openmc_data_downloader are required.")

Expand Down Expand Up @@ -91,11 +94,12 @@ def build_vault_model(
# Add materials from imported model
materials += added_materials

materials.download_cross_section_data(
libraries=["ENDFB-8.0-NNDC"],
set_OPENMC_CROSS_SECTIONS=True,
particles=["neutron"],
)
if "OPENMC_CROSS_SECTIONS" not in os.environ:
materials.download_cross_section_data(
libraries=["ENDFB-8.0-NNDC"],
set_OPENMC_CROSS_SECTIONS=True,
particles=["neutron"],
)
#
# Definition of the spherical void/blackhole boundary
Surface_95 = openmc.Sphere(x0=0.0, y0=0.0, z0=0.0, r=2500.0, boundary_type="vacuum")
Expand Down
Loading