Rotating the source

Hi,

I am converting the source term defined in mcnp format to openmc format. In mcnp I have source defined by following way:

sdef  x=d1 y=d2 z=110.0 vec=0 0 1 dir=1 erg=4.0E-8  wgt=2.839E+9 par=n tr=176 
c
si1 -1.27 1.27
sp1  0.0  1
si2 -2.54 2.54
sp2  0.0  1

tr176 0 -610.0920133 322.1794357 0 90 90 90 35.38 54.62

When I am trying to convert it to openmc format , I am creating the following steps;

x_dist = openmc.stats.Discrete([-1.27, 1.27], [0.0,1])
y_dist = openmc.stats.Discrete([-2.54, 2.54], [0.0, 1])
z_dist = openmc.stats.Discrete([110],[1])

spatial1 = openmc.stats.CartesianIndependent(x_dist, y_dist, z_dist)
source = openmc.Source(spatial1)

my question if how I can rotate the source object as mcnp does with the transform card tr176 0 -610.0920133 322.1794357 0 90 90 90 35.38 54.62
Thanks,
Fahima

Good question @Fahima. At present, there’s no option in OpenMC for performing a transformation on a source. If you wanted to do this, right now you’d have to resort to writing your own custom source routine that manually does a transformation.

Also, looking at that MCNP source, I think to match it you’d want to use openmc.stats.Uniform for x_dist and y_dist, not openmc.stats.Discrete.