Good morning.
I ma new to OpenMC. I am trying to implement an example pincell model but i get the following error.
The following is my input. I am using a windows 10 OS
import os
import openmc
Set the OPENMC_CROSS_SECTIONS environment variable
os.environ[“OPENMC_CROSS_SECTIONS”] = r"C:\Jupyter_notebook\endfb-vii.1-hdf5\cross_sections.xml"
Verify the environment variable
print(f"OPENMC_CROSS_SECTIONS is set to: {os.environ[‘OPENMC_CROSS_SECTIONS’]}")
Define materials
fuel = openmc.Material(name=‘fuel’)
fuel.add_element(‘U’, 1.0, enrichment=4.25)
fuel.add_element(‘O’, 2.0)
fuel.set_density(‘g/cm3’, 10.5)
water = openmc.Material(name=‘water’)
water.add_element(‘H’, 2.0)
water.add_element(‘O’, 1.0)
water.set_density(‘g/cm3’, 1.0)
water.add_s_alpha_beta(‘c_H_in_H2O’)
materials = openmc.Materials([fuel, water])
materials.export_to_xml()
Define geometry
fuel_radius = openmc.ZCylinder(r=0.39)
fuel_region = -fuel_radius
water_region = +fuel_radius
fuel_cell = openmc.Cell(region=fuel_region, fill=fuel)
water_cell = openmc.Cell(region=water_region, fill=water)
root_universe = openmc.Universe(cells=[fuel_cell, water_cell])
geometry = openmc.Geometry(root_universe)
geometry.export_to_xml()
Define settings
settings = openmc.Settings()
settings.batches = 100
settings.inactive = 10
settings.particles = 1000
settings.export_to_xml()
Run OpenMC
openmc.run()
here is the error messsage
OSError Traceback (most recent call last)
Cell In[12], line 13
11 # Define materials
12 fuel = openmc.Material(name=‘fuel’)
—> 13 fuel.add_element(‘U’, 1.0, enrichment=4.25)
14 fuel.add_element(‘O’, 2.0)
15 fuel.set_density(‘g/cm3’, 10.5)
File /openmc_venv/lib/python3.11/site-packages/openmc/material.py:791, in Material.add_element(self, element, percent, percent_type, enrichment, enrichment_target, enrichment_type, cross_sections)
789 # Add naturally-occuring isotopes
790 element = openmc.Element(element)
→ 791 for nuclide in element.expand(percent,
792 percent_type,
793 enrichment,
794 enrichment_target,
795 enrichment_type,
796 cross_sections):
797 self.add_nuclide(*nuclide)
File /openmc_venv/lib/python3.11/site-packages/openmc/element.py:143, in Element.expand(self, percent, percent_type, enrichment, enrichment_target, enrichment_type, cross_sections)
141 if cross_sections is not None:
142 library_nuclides = set()
→ 143 tree = ET.parse(cross_sections)
144 root = tree.getroot()
145 for child in root.findall(‘library’):
File src/lxml/etree.pyx:3590, in lxml.etree.parse()
File src/lxml/parser.pxi:1952, in lxml.etree._parseDocument()
File src/lxml/parser.pxi:1978, in lxml.etree._parseDocumentFromURL()
File src/lxml/parser.pxi:1881, in lxml.etree._parseDocFromFile()
File src/lxml/parser.pxi:1200, in lxml.etree._BaseParser._parseDocFromFile()
File src/lxml/parser.pxi:633, in lxml.etree._ParserContext._handleParseResultDoc()
File src/lxml/parser.pxi:743, in lxml.etree._handleParseResult()
File src/lxml/parser.pxi:670, in lxml.etree._raiseParseError()
OSError: Error reading file ‘/root/nndc_hdf5/cross_sections.xml’: failed to load external entity “/root/nndc_hdf5/cross_sections.xml”
Please help me to resolve the isuue