Model angular Cylinder sarfaces

Right now, openmc.XCylinder, openmc.YCylinder, openmc.ZCylinder, can be modeled on its axis. How can I model XCylinder in 45, 135, 225, 315-degree angle? surrounding a Zcylinder?

Any help is appreciated.

Thanks
Sharif Abu Darda

Hi Sharif

I have not used this myself but perhaps you can use the cell.rotate operation

https://openmc.readthedocs.io/en/stable/pythonapi/generated/openmc.Cell.html

best

Jon

That would be one option, although note the description – it rotates the universe that is being used to fill the cell, so you’d have to put your x-cylinder inside of a universe that is then filled in another cell. If you just want a plain rotated cylinder, you could do this with a Quadric surface; you’d have to figure out the appropriate coefficients (I’m not math savvy enough to tell you off the top of my head what it would be!)

Best,
Paul

Hello, Dr. Thanks for the guide. There seems to be so many coordinates to work here b, c, d, e, f, g, h, j, k not sure how to get that many coordinates. Also, the coordinates for the origin of the xcylinders? Dr, a demo of the behavior would be very helpful to understand.

I have a sample octagon surrounding z cylinders. I have 2 x cylinders and 2 y cylinders piercing the z cylinders I want to put another 4 cylinders on the inclined corners of the octagon and up to z cylinder 7. Below is the code for the octagon and the piercing 2 x cylinders and 2 y cylinders. How to do that with quadric surface? Can you please look? Thank you.

pur=openmc.Plane(surface_id=1, A=-1,B=-1,D=-3)
pul=openmc.Plane(surface_id=2, A=1,B=-1,D=-3)
plr=openmc.Plane(surface_id=3, A=-1,B=-1,D=3)
pll=openmc.Plane(surface_id=4, A=1,B=-1,D=3)

xp1=openmc.XPlane(surface_id=5, x0=2)
xp2=openmc.XPlane(surface_id=6, x0=-2)
xp3=openmc.XPlane(surface_id=7, x0=0.0)
xp4=openmc.XPlane(surface_id=8, x0=0.4)
xp5=openmc.XPlane(surface_id=9, x0=-0.4)
yp1=openmc.YPlane(surface_id=10, y0=2)
yp2=openmc.YPlane(surface_id=11, y0=-2)
yp3=openmc.YPlane(surface_id=12, y0=0.0)
yp4=openmc.YPlane(surface_id=13, y0=0.4)
yp5=openmc.YPlane(surface_id=14, y0=-0.4)
zp1=openmc.ZPlane(surface_id=15, z0=2)
zp2=openmc.ZPlane(surface_id=16, z0=-2)

zc1=openmc.ZCylinder(surface_id=17, R=0.3)
zc2=openmc.ZCylinder(surface_id=18, R=0.5)
zc3=openmc.ZCylinder(surface_id=19, R=0.7)
zc4=openmc.ZCylinder(surface_id=20, R=0.9)
zc5=openmc.ZCylinder(surface_id=21, R=1.1)
zc6=openmc.ZCylinder(surface_id=22, R=1.3)
zc7=openmc.ZCylinder(surface_id=23, R=1.5)

xc1=openmc.XCylinder(surface_id=24, R=0.3)
xc2=openmc.XCylinder(surface_id=25, R=0.3)
yc1=openmc.YCylinder(surface_id=26, R=0.3)
yc2=openmc.YCylinder(surface_id=27, R=0.3)

xp10=openmc.XPlane(surface_id=28, x0=0.3)
yp10=openmc.YPlane(surface_id=29, y0=0.5)
xp11=openmc.XPlane(surface_id=30, x0=-0.7)
yp11=openmc.YPlane(surface_id=31, y0=-0.9)

#origin = (0., 0., 0.)
#print('pur: ', pur.evaluate(origin))
#print('pul: ', pul.evaluate(origin))
#print('plr: ', plr.evaluate(origin))
#print('pll: ', pll.evaluate(origin))

region1 = openmc.Cell(cell_id=1, name=‘cell 3’)
region2 = openmc.Cell(cell_id=2, name=‘cell 3’)
region3 = openmc.Cell(cell_id=3, name=‘cell 3’)
region4 = openmc.Cell(cell_id=4, name=‘cell 3’)
region5 = openmc.Cell(cell_id=5, name=‘cell 3’)
region6 = openmc.Cell(cell_id=6, name=‘cell 3’)
region7 = openmc.Cell(cell_id=7, name=‘cell 3’)
region8 = openmc.Cell(cell_id=8, name=‘cell 3’)
region9 = openmc.Cell(cell_id=9, name=‘cell 3’)
region10 = openmc.Cell(cell_id=10, name=‘cell 3’)
region11 = openmc.Cell(cell_id=11, name=‘cell 3’)
region12 = openmc.Cell(cell_id=12, name=‘cell 3’)

region1.region=-zc1&-zp1&+zp2
region2.region=(-zc2&+zc1&-zp1&+zp2&-xp3) | (-zc2&+zc1&-zp1&+zp2&+xc1)
region3.region=(-zc3&+zc2&-zp1&+zp2&-xp5) | (-zc3&+zc2&-zp1&+zp2&+xp4&+xc1) | (-zc3&+zc2&-zp1&+zp2&-yp3&-xp4&+xp5) | (-zc3&+zc2&-zp1&+zp2&+yc1&-xp4&+xp5&+yp3)
region4.region=(-zc4&+zc3&-zp1&+zp2&-xp5&+xc2) | (-zc4&+zc3&-zp1&+zp2&+xp4&+xc1) | (-zc4&+zc3&-zp1&+zp2&-yp3&-xp4&+xp5) | (-zc4&+zc3&-zp1&+zp2&+yc1&-xp4&+xp5&+yp3)
region5.region=(-zc5&+zc4&-zp1&+zp2&-xp5&+xc2) | (-zc5&+zc4&-zp1&+zp2&+xp4&+xc1) | (-zc5&+zc4&-zp1&+zp2&-yp3&+yc2&-xp4&+xp5) | (-zc5&+zc4&-zp1&+zp2&+yc1&+yp3&-xp4&+xp5)
region6.region=(-zc6&+zc5&-zp1&+zp2&-xp5&+xc2) | (-zc6&+zc5&-zp1&+zp2&+xp4&+xc1) | (-zc6&+zc5&-zp1&+zp2&-yp3&+yc2&-xp4&+xp5) | (-zc6&+zc5&-zp1&+zp2&+yc1&+yp3&-xp4&+xp5)
region7.region=(-zc7&+zc6&-zp1&+zp2&-xp5&+xc2) | (-zc7&+zc6&-zp1&+zp2&+xp4&+xc1) | (-zc7&+zc6&-zp1&+zp2&-yp3&+yc2&-xp4&+xp5) | (-zc7&+zc6&-zp1&+zp2&+yc1&+yp3&-xp4&+xp5)
region8.region=-xc1&+zc1&-xp1&+xp3
region9.region=-yc1&+zc2&-yp1&+yp3
region10.region=-xc2&+zc3&+xp2&-xp3
region11.region=-yc2&+zc4&+yp2&-yp3
region12.region=(+xp2&-yp1&+yp2&-zp1&+zp2&+pur&+pul&-plr&-pll&+zc7&+xc2&-xp5) | (-xp1&-yp1&+yp2&-zp1&+zp2&+pur&+pul&-plr&-pll&+zc7&+xc1&+xp4) | (+yp2&-zp1&+zp2&+zc7&+yc2&-yp3&-xp4&+xp5) | (-yp1&-zp1&+zp2&+zc7&+yc1&+yp3&-xp4&+xp5)

Instantiate ZCylinder surfaces

root = openmc.Universe(universe_id=0, name=‘root universe’)

Register Materials with Cells

region1.fill = SS304
region2.fill = water
region3.fill = SS304
region4.fill = water
region5.fill = SS304
region6.fill = water
region7.fill = SS304
region8.fill = graphite
region9.fill = graphite
region10.fill = graphite
region11.fill = graphite
region12.fill = air

Instantiate Universe

root.add_cells([region1,region2,region3,region4,region5,region6,region7,region8,region9,region10,region11,region12])

Instantiate a Geometry, register the root Universe, and export to XML

geometry = openmc.Geometry(root)
geometry.export_to_xml()