Skip to content

The problem with using openmc_to_cad #21

Description

@wwwo-dx123

What is the reason for the following error when I am using openmc_to_cad?
Traceback (most recent call last):
File "/home/lee/anaconda3/envs/openmc-env/bin/openmc_to_cad", line 8, in
sys.exit(openmc_to_cad())
File "/home/lee/anaconda3/envs/openmc-env/lib/python3.10/site-packages/openmc_cad_adapter/to_cubit_journal.py", line 628, in openmc_to_cad
to_cubit_journal(model.geometry, world=args.world_size, filename=args.output, cells=args.cells, to_cubit=args.to_cubit)
File "/home/lee/anaconda3/envs/openmc-env/lib/python3.10/site-packages/openmc_cad_adapter/to_cubit_journal.py", line 548, in to_cubit_journal
do_cell( cell )
File "/home/lee/anaconda3/envs/openmc-env/lib/python3.10/site-packages/openmc_cad_adapter/to_cubit_journal.py", line 523, in do_cell
vol_or_body = process_node_or_fill( cell, w )
File "/home/lee/anaconda3/envs/openmc-env/lib/python3.10/site-packages/openmc_cad_adapter/to_cubit_journal.py", line 363, in process_node_or_fill
id = process_node_or_fill( node.fill, w, indent + 1, offset, inner_world )
File "/home/lee/anaconda3/envs/openmc-env/lib/python3.10/site-packages/openmc_cad_adapter/to_cubit_journal.py", line 468, in process_node_or_fill
r = ( len( uss ) - i -1 ) * pitch[0]
UnboundLocalError: local variable 'uss' referenced before assignment


plane1 = openmc.ZPlane(z0 = 0 , boundary_type='reflective')
plane2 = openmc.ZPlane(z0 = 20 , boundary_type='reflective')
r1 = openmc.ZCylinder(r = 0.45)
r2 = openmc.ZCylinder(r = 0.5)

s1 = openmc.YPlane(y0 = 4.335,  boundary_type='reflective')
s2 = openmc.Plane(1.7320508076, 1, 0, 8.67,  boundary_type='reflective')
s3 = openmc.Plane(1.7320508076, -1, 0, 8.67,  boundary_type='reflective')
s4 = openmc.YPlane(y0 = -4.335,  boundary_type='reflective')
s5 = openmc.Plane(1.7320508076, 1, 0, -8.67,  boundary_type='reflective')
s6 = openmc.Plane(1.7320508076, -1, 0, -8.67,  boundary_type='reflective')

cell1 = openmc.Cell(fill = m1, region = -r1 & -plane2  & +plane1)
cell3 = openmc.Cell(fill = m5, region = +r1 & -plane2  & +plane1)

u9000 = openmc.Universe()
u9000.add_cells([cell1,cell3])

outer = openmc.Cell(fill = m5)
outer_un = openmc.Universe(cells = (outer,) )

hexlat90 = openmc.HexLattice()
hexlat90.center = (0,0)
hexlat90.pitch = [1.4]  
hexlat90.outer = outer_un

outer_ring = [u9000] * 18
third_ring = [u9000] * 12
middle_ring = [u9000] * 6 
inner_ring = [u9000]
hexlat90.universes = [outer_ring, third_ring, middle_ring, inner_ring]
hexlat90.orientation = 'x'

main_cell0 = openmc.Cell(fill=hexlat90, region = -plane2  & +plane1
                         & -s1 & -s2 & -s3 & +s4 & +s5 & +s6)
hex0 = openmc.Universe(cells = (main_cell0, ))

geom = openmc.Geometry(hex0)
# geom.orientation = 'x'
# geom.export_to_xml()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions