I designed a simulation using gold as my only material, and I created a singular geometry (a box) to be filled with my gold. But how do I do that for 4 separate materials, without overwriting each other? I want 4 ‘regions’ filled with different materials and eventually create four statepoint files.
<code>Tin = openmc.Material (material_id = 3, name = 'Tin')
Tin.add_nuclide('Sn114', 1.0, 'ao')
Tin.set_density('g/cc' , 7.3)
Potassium = openmc.Material(material_id = 4, name= 'Potassium')
Potassium.add_nuclide('K41', 1.0, 'ao')
Potassium.set_density('g/cc', .89)
Lithium = openmc.Material(material_id = 5, name= 'Litihum')
Lithium.add_nuclide('Li6' , 1.0, 'ao')
Lithium.set_density ('g/cc' , .53)
Silver = openmc.Material(material_id = 6, name='Silver')
Silver.add_nuclide('Ag107', 1.0, 'ao')
Silver.set_density('g/cc' , 10.49)
Air = openmc.Material(material_id= 2, name= 'Air')
Air.add_nuclide("C0",7.4919E-09,'ao')
Air.add_nuclide("N14",3.8987E-05,'ao')
Air.add_nuclide("N15",1.4243E-07,'ao')
Air.add_nuclide("O16",1.0487E-05,'ao')
Air.add_nuclide("O17",3.9948E-09,'ao')
Air.add_nuclide("Ar36",7.8407E-10,'ao')
Air.add_nuclide("Ar38",1.4726E-10,'ao')
Air.add_nuclide("Ar40",2.3208E-07,'ao')
Air.set_density('g/cc',0.001205)
materials = openmc.Materials([Tin, Potassium, Lithium, Silver, Air])
materials.export_to_xml()
min_x = openmc.XPlane(x0= -25.0, boundary_type='transmission')
max_x = openmc.XPlane(x0= 25.0, boundary_type='transmission')
min_y = openmc.YPlane(y0= -25.0, boundary_type='transmission')
max_y = openmc.YPlane(y0= 25.0, boundary_type='transmission')
min_z = openmc.ZPlane(z0= -25.0, boundary_type='transmission')
max_z = openmc.ZPlane(z0= 25.0, boundary_type='transmission')
box = +min_x & -max_x & +min_y & -max_y & +min_z & -max_z
sphere = openmc.Sphere(r = 60, boundary_type = 'vacuum')
Tin_box = openmc.Cell(cell_id = 3, name = 'Tin Box', fill = Tin, region = box1)
Potassium_box = openmc.Cell(cell_id= 4, name = 'Potassium box', fill = Potassium, region = box2)
Lithium_box = openmc.Cell(cell_id = 5, name = 'Lithium box' , fill= Lithium, region = box3)
Silver_box = openmc.Cell(cell_id = 6, name = 'Silver Box' , fill = Silver, region = box4)
universe_sphere1= openmc.Cell(name = 'Universe 1', fill = Air, region= -sphere & ~box1) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_sphere2= openmc.Cell(name = 'Universe 2', fill = Air, region= -sphere & ~box2) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_sphere3= openmc.Cell(name = 'Universe 3', fill = Air, region= -sphere & ~box3) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_sphere4= openmc.Cell(name = 'Universe 4', fill = Air, region= -sphere & ~box4) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_total.add_cells([Tin_box,universe_sphere1,Potassium_box,universe_sphere2,Lithium_box,universe_sphere3,Silver_box,universe_sphere4])
geometry= openmc.Geometry(universe_total)
<code>Tin = openmc.Material (material_id = 3, name = 'Tin')
Tin.add_nuclide('Sn114', 1.0, 'ao')
Tin.set_density('g/cc' , 7.3)
Potassium = openmc.Material(material_id = 4, name= 'Potassium')
Potassium.add_nuclide('K41', 1.0, 'ao')
Potassium.set_density('g/cc', .89)
Lithium = openmc.Material(material_id = 5, name= 'Litihum')
Lithium.add_nuclide('Li6' , 1.0, 'ao')
Lithium.set_density ('g/cc' , .53)
Silver = openmc.Material(material_id = 6, name='Silver')
Silver.add_nuclide('Ag107', 1.0, 'ao')
Silver.set_density('g/cc' , 10.49)
Air = openmc.Material(material_id= 2, name= 'Air')
Air.add_nuclide("C0",7.4919E-09,'ao')
Air.add_nuclide("N14",3.8987E-05,'ao')
Air.add_nuclide("N15",1.4243E-07,'ao')
Air.add_nuclide("O16",1.0487E-05,'ao')
Air.add_nuclide("O17",3.9948E-09,'ao')
Air.add_nuclide("Ar36",7.8407E-10,'ao')
Air.add_nuclide("Ar38",1.4726E-10,'ao')
Air.add_nuclide("Ar40",2.3208E-07,'ao')
Air.set_density('g/cc',0.001205)
print(Air)
materials = openmc.Materials([Tin, Potassium, Lithium, Silver, Air])
materials.export_to_xml()
min_x = openmc.XPlane(x0= -25.0, boundary_type='transmission')
max_x = openmc.XPlane(x0= 25.0, boundary_type='transmission')
min_y = openmc.YPlane(y0= -25.0, boundary_type='transmission')
max_y = openmc.YPlane(y0= 25.0, boundary_type='transmission')
min_z = openmc.ZPlane(z0= -25.0, boundary_type='transmission')
max_z = openmc.ZPlane(z0= 25.0, boundary_type='transmission')
box = +min_x & -max_x & +min_y & -max_y & +min_z & -max_z
sphere = openmc.Sphere(r = 60, boundary_type = 'vacuum')
Tin_box = openmc.Cell(cell_id = 3, name = 'Tin Box', fill = Tin, region = box1)
Potassium_box = openmc.Cell(cell_id= 4, name = 'Potassium box', fill = Potassium, region = box2)
Lithium_box = openmc.Cell(cell_id = 5, name = 'Lithium box' , fill= Lithium, region = box3)
Silver_box = openmc.Cell(cell_id = 6, name = 'Silver Box' , fill = Silver, region = box4)
universe_sphere1= openmc.Cell(name = 'Universe 1', fill = Air, region= -sphere & ~box1) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_sphere2= openmc.Cell(name = 'Universe 2', fill = Air, region= -sphere & ~box2) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_sphere3= openmc.Cell(name = 'Universe 3', fill = Air, region= -sphere & ~box3) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_sphere4= openmc.Cell(name = 'Universe 4', fill = Air, region= -sphere & ~box4) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_total.add_cells([Tin_box,universe_sphere1,Potassium_box,universe_sphere2,Lithium_box,universe_sphere3,Silver_box,universe_sphere4])
geometry= openmc.Geometry(universe_total)
geometry.export_to_xml()
....
</code>
Tin = openmc.Material (material_id = 3, name = 'Tin')
Tin.add_nuclide('Sn114', 1.0, 'ao')
Tin.set_density('g/cc' , 7.3)
Potassium = openmc.Material(material_id = 4, name= 'Potassium')
Potassium.add_nuclide('K41', 1.0, 'ao')
Potassium.set_density('g/cc', .89)
Lithium = openmc.Material(material_id = 5, name= 'Litihum')
Lithium.add_nuclide('Li6' , 1.0, 'ao')
Lithium.set_density ('g/cc' , .53)
Silver = openmc.Material(material_id = 6, name='Silver')
Silver.add_nuclide('Ag107', 1.0, 'ao')
Silver.set_density('g/cc' , 10.49)
Air = openmc.Material(material_id= 2, name= 'Air')
Air.add_nuclide("C0",7.4919E-09,'ao')
Air.add_nuclide("N14",3.8987E-05,'ao')
Air.add_nuclide("N15",1.4243E-07,'ao')
Air.add_nuclide("O16",1.0487E-05,'ao')
Air.add_nuclide("O17",3.9948E-09,'ao')
Air.add_nuclide("Ar36",7.8407E-10,'ao')
Air.add_nuclide("Ar38",1.4726E-10,'ao')
Air.add_nuclide("Ar40",2.3208E-07,'ao')
Air.set_density('g/cc',0.001205)
print(Air)
materials = openmc.Materials([Tin, Potassium, Lithium, Silver, Air])
materials.export_to_xml()
min_x = openmc.XPlane(x0= -25.0, boundary_type='transmission')
max_x = openmc.XPlane(x0= 25.0, boundary_type='transmission')
min_y = openmc.YPlane(y0= -25.0, boundary_type='transmission')
max_y = openmc.YPlane(y0= 25.0, boundary_type='transmission')
min_z = openmc.ZPlane(z0= -25.0, boundary_type='transmission')
max_z = openmc.ZPlane(z0= 25.0, boundary_type='transmission')
box = +min_x & -max_x & +min_y & -max_y & +min_z & -max_z
sphere = openmc.Sphere(r = 60, boundary_type = 'vacuum')
Tin_box = openmc.Cell(cell_id = 3, name = 'Tin Box', fill = Tin, region = box1)
Potassium_box = openmc.Cell(cell_id= 4, name = 'Potassium box', fill = Potassium, region = box2)
Lithium_box = openmc.Cell(cell_id = 5, name = 'Lithium box' , fill= Lithium, region = box3)
Silver_box = openmc.Cell(cell_id = 6, name = 'Silver Box' , fill = Silver, region = box4)
universe_sphere1= openmc.Cell(name = 'Universe 1', fill = Air, region= -sphere & ~box1) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_sphere2= openmc.Cell(name = 'Universe 2', fill = Air, region= -sphere & ~box2) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_sphere3= openmc.Cell(name = 'Universe 3', fill = Air, region= -sphere & ~box3) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_sphere4= openmc.Cell(name = 'Universe 4', fill = Air, region= -sphere & ~box4) # ~ acts like the inverse of the volumes
# I am putting the box inside the universe so -sphere is within
universe_total.add_cells([Tin_box,universe_sphere1,Potassium_box,universe_sphere2,Lithium_box,universe_sphere3,Silver_box,universe_sphere4])
geometry= openmc.Geometry(universe_total)
geometry.export_to_xml()
....
In my geometry.xml it’s combining all the materials into a singular region instead of four separate regions.