# Model angular Cylinder sarfaces

**URL:** <https://openmc.discourse.group/t/model-angular-cylinder-sarfaces/408>\
**Category:** User Support\
**Created:** [February 28, 2019, 12:01am UTC](https://openmc.discourse.group/t/model-angular-cylinder-sarfaces/408 "2019-02-28T00:01:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shabudarda](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shabudarda/32/497_2.png) [@shabudarda](https://openmc.discourse.group/u/shabudarda)\
**Post date:** [February 28, 2019, 12:01am UTC](https://openmc.discourse.group/t/model-angular-cylinder-sarfaces/408/1 "2019-02-28T00:01:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Shimwell](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shimwell/32/3876_2.png) [@Shimwell](https://openmc.discourse.group/u/Shimwell)\
**Post date:** [February 28, 2019, 8:20am UTC](https://openmc.discourse.group/t/model-angular-cylinder-sarfaces/408/2 "2019-02-28T08:20:21Z")

</div>

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](https://openmc.readthedocs.io/en/stable/pythonapi/generated/openmc.Cell.html)

best

Jon

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [February 28, 2019, 1:23pm UTC](https://openmc.discourse.group/t/model-angular-cylinder-sarfaces/408/3 "2019-02-28T13:23:53Z")

</div>

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](https://openmc.readthedocs.io/en/stable/pythonapi/generated/openmc.Quadric.html#openmc.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

---

<div class="post-metadata">

**Author:** ![shabudarda](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shabudarda/32/497_2.png) [@shabudarda](https://openmc.discourse.group/u/shabudarda)\
**Post date:** [February 28, 2019, 2:46pm UTC](https://openmc.discourse.group/t/model-angular-cylinder-sarfaces/408/4 "2019-02-28T14:46:50Z")

</div>

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()
