Skip to content

Commit 7fd6319

Browse files
avoid redundant cross-section downloads
1 parent 3b21cbf commit 7fd6319

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

libra_toolbox/neutronics/vault.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def build_vault_model(
5353
try:
5454
import openmc
5555
import openmc.model
56-
import openmc_data_downloader as odd
56+
import os
57+
58+
if "OPENMC_CROSS_SECTIONS" not in os.environ:
59+
import openmc_data_downloader as odd
5760
except ModuleNotFoundError:
5861
raise ModuleNotFoundError("openmc and openmc_data_downloader are required.")
5962

@@ -91,11 +94,12 @@ def build_vault_model(
9194
# Add materials from imported model
9295
materials += added_materials
9396

94-
materials.download_cross_section_data(
95-
libraries=["ENDFB-8.0-NNDC"],
96-
set_OPENMC_CROSS_SECTIONS=True,
97-
particles=["neutron"],
98-
)
97+
if "OPENMC_CROSS_SECTIONS" not in os.environ:
98+
materials.download_cross_section_data(
99+
libraries=["ENDFB-8.0-NNDC"],
100+
set_OPENMC_CROSS_SECTIONS=True,
101+
particles=["neutron"],
102+
)
99103
#
100104
# Definition of the spherical void/blackhole boundary
101105
Surface_95 = openmc.Sphere(x0=0.0, y0=0.0, z0=0.0, r=2500.0, boundary_type="vacuum")

0 commit comments

Comments
 (0)