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 the name to the cells in OpenMC to improve identification #61

Merged
merged 1 commit into from
Apr 23, 2024
Merged
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
13 changes: 8 additions & 5 deletions src/GEOUNED/Write/OpenMCFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,18 @@ def __write_xml_surface_block__(self):
def __write_xml_cells__(self,cell):
""" Write the cell in xml OpenMC format """
index = cell.label
cellName = ". ".join(cell.Comments.splitlines())
if cell.__id__ is None : return

if cell.Material == 0:
matName = 'void'
else:
matName = '{}'.format(cell.Material)

OMCcell = ' <cell id="{}" material="{}" region="{}" universe="1"/>\n'.format( \
OMCcell = ' <cell id="{}" material="{}" name="{}" region="{}" universe="1"/>\n'.format( \
index,\
matName,\
cellName,\
writeOpenMCregion(cell.Definition,'XML') )
self.inpfile.write(OMCcell)
return
Expand Down Expand Up @@ -146,7 +148,7 @@ def __write_py_surface_block__(self):


def __write_py_surfaces__(self,surface,boundary=False):
""" Write the surfaces in xml OpenMC format """
""" Write the surfaces in python OpenMC format """

surfType,coeffs = OpenMCSurface(surface.Type, surface.Surf, outXML = False, quadricForm = opt.quadricPY)

Expand Down Expand Up @@ -174,15 +176,16 @@ def __write_py_cell_block__(self):


def __write_py_cells__(self,cell):
""" Write the cell in xml OpenMC format """
""" Write the cell in python OpenMC format """
index = cell.label
cellName = ". ".join(cell.Comments.splitlines())
if cell.__id__ is None : return

if cell.Material == 0:
OMCcell = 'C{} = openmc.Cell(region={})\n'.format(index, writeOpenMCregion(cell.Definition,'PY') )
OMCcell = 'C{} = openmc.Cell(name="{}", region={})\n'.format(index, cellName, writeOpenMCregion(cell.Definition,'PY') )
else:
matName = 'M{}'.format(cell.Material)
OMCcell = 'C{} = openmc.Cell(fill={}, region={})\n'.format(index, matName, writeOpenMCregion(cell.Definition,'PY') )
OMCcell = 'C{} = openmc.Cell(name="{}", fill={}, region={})\n'.format(index, cellName, matName, writeOpenMCregion(cell.Definition,'PY') )
self.inpfile.write(OMCcell)
return

Expand Down