Skip to content

Commit

Permalink
avoid redundant cross-section downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
davidepettinari committed Jan 8, 2025
1 parent 3b21cbf commit 7fd6319
Showing 1 changed file with 10 additions and 6 deletions.
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
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

0 comments on commit 7fd6319

Please sign in to comment.