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

error caused by expanding an element #40

Open
shimwell opened this issue Apr 4, 2023 · 1 comment
Open

error caused by expanding an element #40

shimwell opened this issue Apr 4, 2023 · 1 comment

Comments

@shimwell
Copy link
Contributor

shimwell commented Apr 4, 2023

error caused when expanding a element without a cross section file set

import openmc
import openmc_data_downloader

openmc.config['cross_sections']=''

mat1 = openmc.Material()
mat1.add_element('Li', 1)
mat1.set_density('g/cm3',1)
materials=openmc.Materials([mat1])
materials.download_cross_section_data(
        libraries=["FENDL-3.1d"],
        set_OPENMC_CROSS_SECTIONS=True,
        particles=["neutron"],
    )

surf1 = openmc.Sphere(r=10, boundary_type='vacuum')
region1 = -surf1
cell1=openmc.Cell(region=region1,fill=mat1)
geometry=openmc.Geometry([cell1])

point = openmc.stats.Point((0, 0, 0))
energy = openmc.stats.Discrete([14.1e6], [1.0])
source = openmc.Source(space=point, energy=energy)

settings = openmc.Settings()
settings.source = source
settings.run_mode = 'fixed source'
settings.particles = 10000
settings.batches = 10

model = openmc.Model(geometry, materials, settings)
model.run()
ile ~/venv/openmc_env/lib/python3.8/site-packages/openmc/material.py:744, in Material.add_element(self, element, percent, percent_type, enrichment, enrichment_target, enrichment_type)
    742 # Add naturally-occuring isotopes
    743 element = openmc.Element(element)
--> 744 for nuclide in element.expand(percent,
    745                               percent_type,
    746                               enrichment,
    747                               enrichment_target,
    748                               enrichment_type):
    749     self.add_nuclide(*nuclide)

File ~/venv/openmc_env/lib/python3.8/site-packages/openmc/element.py:138, in Element.expand(self, percent, percent_type, enrichment, enrichment_target, enrichment_type, cross_sections)
    136 if cross_sections is not None:
    137     library_nuclides = set()
--> 138     tree = ET.parse(cross_sections)
    139     root = tree.getroot()
    140     for child in root.findall('library'):

File /usr/lib/python3.8/xml/etree/ElementTree.py:1202, in parse(source, parser)
   1193 """Parse XML document into element tree.
@shimwell
Copy link
Contributor Author

shimwell commented Apr 4, 2023

perhaps natural element compositions could be used if a cross section xml file is not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant