Independent Disc Source in x-dir

Is there a way to create an independent disc source facing x-dir? I have created a rectangular one and a cylindrical one facing z-dir, but I cannot get it to face x-dir. I have tried, but the rotation does not seem to work:
spatial_dist = stats.CylindricalIndependent(
r=stats.Uniform(0.0, 15.0),
phi=stats.Uniform(0.0, 2 * np.pi),
z=stats.Discrete([0.0], [1.0]),
origin=(0.0, 0.0, 0.0)
)
spatial_dist.rotation = (0, 90, 0)

angular_dist = stats.Monodirectional(reference_uvw=(1.0, 0.0, 0.0))

src = openmc.IndependentSource(space=spatial_dist, angle=angular_dist)

src.space.origin = (-99.0, 0.0, 15.0)
src.energy = stats.Discrete([5e4], [1.0])
src.particle = ‘neutron’

Hi! I’ve faced a similar issue with not having the option of x-axis oriented cylindrical sources. Instead of rotating the source I got around it by just creating a point cloud source (openmc.stats.PointCloud — OpenMC Documentation) with appropriate radial and axial distributions. Not elegant, but it works.

Hi,

it was recently added

**kwargs – Keyword arguments passed directly to CylindricalIndependent (e.g., origin, r_dir, z_dir).

https://docs.openmc.org/en/latest/pythonapi/generated/openmc.stats.cylindrical_uniform.html#openmc.stats.cylindrical_uniform

Thank you! I did something like that where I sampled from a spatial source I define. I will try the PointCloud.

Oh, brilliant! Thanks for the heads up

So which argument controls the orientation?

r_dir

Python

spatial_dist = openmc.stats.CylindricalIndependent(
    r=openmc.stats.Uniform(0.0, 15.0),
    phi=openmc.stats.Uniform(0.0, 2*np.pi),
    z=openmc.stats.Discrete([0.0], [1.0]),
    origin=(-99.0, 0.0, 15.0),
    r_dir=(0.0, 1.0, 0.0),
    z_dir=(1.0, 0.0, 0.0),
)

XML

<space type="cylindrical"
       origin="-99.0 0.0 15.0"
       r_dir="0.0 1.0 0.0"
       z_dir="1.0 0.0 0.0">
  <r   type="uniform"  parameters="0.0 15.0"/>
  <phi type="uniform"  parameters="0.0 6.283185307179586"/>
  <z   type="discrete" parameters="0.0 1.0"/>
</space>