fuel = openmc.Material()
fuel.add_nuclide('U235', 1.0)
water = openmc.Material()
water.add_element('H', 2.0)
water.add_element('O', 1.0)
water.add_s_alpha_beta('c_H_in_H2O')
metal = openmc.Material()
metal.add_element('Zr', 1.0)
mats = openmc.Materials([fuel, water, metal])
mats.export_to_xml()
cyl = openmc.ZCylinder(r=1.0)
fuel_cell = openmc.Cell(fill=fuel, region=-cyl)
water_cell = openmc.Cell(fill=water, region=+cyl)
pin_univ = openmc.Universe(cells=[fuel_cell, water_cell])
only_water_cell = openmc.Cell(fill=water)
water_univ = openmc.Universe(cells=[only_water_cell])
# Lattice has three rings with only water and all others filled with pin universe
hex_lattice = openmc.HexLattice()
hex_lattice.center = (0., 0.)
hex_lattice.pitch = (3.,)
hex_lattice.universes = [[water_univ]*12, [water_univ]*6, [water_univ]]
hex_lattice.outer = pin_univ
hex_lattice.orientation = 'x'
inner_cyl = openmc.ZCylinder(r=6.0)
outer_cyl1 = openmc.ZCylinder(r=15.0)
outer_cyl2 = openmc.ZCylinder(r=17.0, boundary_type='reflective')
inner_target = openmc.Cell(fill=metal, region=-inner_cyl)
# Notice how when this cell is filled with the lattice, the region consists of
# everything outside the inner cylinder (+inner_cyl) and inside the outer
# cylinder (-outer_cyl1)
lattice_cell = openmc.Cell(fill=hex_lattice, region=+inner_cyl & -outer_cyl1)
outer_cell = openmc.Cell(fill=metal, region=+outer_cyl1 & -outer_cyl2)
geom = openmc.Geometry([inner_target, lattice_cell, outer_cell])
geom.export_to_xml()
settings = openmc.Settings()
settings.batches = 150
settings.inactive = 50
settings.particles = 1000
settings.export_to_xml()