openmc.model.RectangularParallelepiped usage

Hi all !
I’m trying to insert a openmc.model.RectangularParallelepiped() in another openmc.model.RectangularParallelepiped() : method introduced with 0.12 version).

Following XML geometry code is produced by python code below.

<geometry>
  <cell id="1" material="1" name="Cell1" region="1 -2 3 -4 5 -6" universe="1" />
  <cell id="2" material="2" name="Cell2" region="7 -8 9 -10 11 -12 (-1 | 4 | -3 | 4 | -5 | 6)" universe="1" />
  <surface coeffs="-5.0" id="1" type="x-plane" />
  <surface coeffs="5.0" id="2" type="x-plane" />
  <surface coeffs="-5.0" id="3" type="y-plane" />
  <surface coeffs="5.0" id="4" type="y-plane" />
  <surface coeffs="-5.0" id="5" type="z-plane" />
  <surface coeffs="5.0" id="6" type="z-plane" />
  <surface coeffs="-10.0" id="7" type="x-plane" />
  <surface coeffs="10.0" id="8" type="x-plane" />
  <surface coeffs="-10.0" id="9" type="y-plane" />
  <surface coeffs="10.0" id="10" type="y-plane" />
  <surface coeffs="-10.0" id="11" type="z-plane" />
  <surface coeffs="10.0" id="12" type="z-plane" />
</geometry>

Produced by this python code :

import openmc

mat_meat = openmc.Material()
mat_meat.add_nuclide("U235", 1.0, "wo")
mat_meat.set_density("g/cm3", 1.0)

mat_al = openmc.Material()
mat_al.add_nuclide("Al27", 1.0, "ao")
mat_al.set_density("g/cm3", 2.7)

mats = openmc.Materials([mat_meat, mat_al])
mats.cross_sections = "/home/julien/Documents/codes/endfb80_hdf5/cross_sections.xml"
mats.export_to_xml()

dim=[10.,10., 10.]
dim2=[20.,20., 20.]

parrallelepiped_surf = openmc.model.RectangularParallelepiped(-dim[0]/2,dim[0]/2,-dim[1]/2,dim[1]/2,-dim[2]/2,dim[2]/2)
parrallelepiped_surf2 = openmc.model.RectangularParallelepiped(-dim2[0]/2,dim2[0]/2,-dim2[1]/2,dim2[1]/2,-dim2[2]/2,dim2[2]/2)

parrallelepiped_cell = openmc.Cell(name="Cell1" , fill=mat_meat, region = -parrallelepiped_surf)
parrallelepiped_cell2 = openmc.Cell(name="Cell2" , fill=mat_al, region = -parrallelepiped_surf2 & +parrallelepiped_surf)

p = openmc.Universe()
p.add_cells([parrallelepiped_cell, parrallelepiped_cell2])

geom = openmc.Geometry(p)
geom.export_to_xml()

plot_xy= openmc.Plot()
plot_xy.origin = (0, 0, 0)
plot_xy.width = (50.,50.)
plot_xy.pixels = (1000, 1000)
plot_xy.basis = 'xy'
plot_xy.id = 1
plot_xy.colors={mat_meat:"Red", mat_al:"Gray"}
plot_xy.color_by='material'

openmc.plot_inline(plots=[plot_xy])

I was expecting this definition for 2nd cell:
<cell id="2" material="2" name="Cell2" region="7 -8 9 -10 11 -12 (-1 | 2 | -3 | 4 | -5 | 6)" universe="1" />

Is there a misuse or a problem ?

Best regards,

Julien

Hi Julien! Thank you for reporting this.

This is indeed a bug and is specific to the use of the positive halfspace of the RectangularParallelepiped object. I’ll submit a fix for this ASAP.

@pshriwise’s fix has been merged in the develop branch, so this will be part of the next release.

Thx for your answers and for fixing it. For my information, when is planned the next release ?

Best

Julien

We should have another release out by the end of the year or sooner.