Hello everyone,
I am new openmc. I want to make a simple geometry of a wall filled with rock with thickness 0.5m. I have created the geometry following the examples. I tried to plot the geometry and I just see a 2D image which is not very clear to me. I was expecting the wall in 3D. this is my code and the output. how can I visualise my geometry well. thank you all.
“”"
import openmc
import numpy as np
import openmc.data
import matplotlib.pyplot as plt
import os
os.environ[“OPENMC_CROSS_SECTIONS”] = “/home/harriet/OPENMC/mcnp_endfb70/cross_sections.xml”
print(os.environ[“OPENMC_CROSS_SECTIONS”])
###############################################################################
Simulation Input File Parameters
###############################################################################
OpenMC simulation parameters
batches = 20
inactive = 10
particles = 10000
###############################################################################
Exporting to OpenMC materials.xml file
###############################################################################
Create materials
rock = openmc.Material(material_id=1, name=‘Rock’)
rock.add_element(‘Si’, 0.277)
rock.add_nuclide(‘O16’, 0.622)
rock.add_element(‘Al’, 0.101)
rock.add_element(‘Fe’,1.0)
rock.set_density(‘g/cm3’, 2.65)
water = openmc.Material(material_id=2,name=‘Water’)
water.add_element(‘H’, 2)
water.add_nuclide(‘O16’, 1)
water.set_density(‘g/cm3’, 1.0)
water.add_s_alpha_beta(‘c_H_in_H2O’)
Instantiate a Materials collection and export to XML
materials_file = openmc.Materials([water, rock])
materials_file.export_to_xml()
###############################################################################
Exporting to OpenMC geometry.xml file
###############################################################################
Create surfaces
wall_thickness = 0.5
water_thickness = 0.5
wall_length= 1.5
Create surfaces for rock wall
left_surface_rock = openmc.XPlane(surface_id=1,x0=-wall_length/2, boundary_type=‘vacuum’)
right_surface_rock = openmc.XPlane(surface_id=2,x0=wall_length/2, boundary_type=‘vacuum’)
bottom_surface_rock = openmc.YPlane(surface_id=3,y0=-wall_length/2, boundary_type=‘vacuum’)
top_surface_rock = openmc.YPlane(surface_id=4,y0=wall_length/2, boundary_type=‘vacuum’)
front_surface_rock = openmc.ZPlane(surface_id=5,z0=-wall_thickness/2, boundary_type=‘vacuum’)
back_surface_rock = openmc.ZPlane(surface_id=6,z0=wall_thickness/2, boundary_type=‘vacuum’)
Instantiate Cells
cell1 = openmc.Cell(cell_id=1, name=‘Cell 1’)
cell1.region = +left_surface_rock & -right_surface_rock & +bottom_surface_rock & -top_surface_rock & +front_surface_rock & -back_surface_rock
Register Materials with Cells
cell1.fill = rock
Create universe
root = openmc.Universe(universe_id=0, name=‘root universe’)
root.add_cell(cell1)
Instantiate a Geometry, register the root Universe, and export to XML
geometry = openmc.Geometry(root)
geometry.export_to_xml()
plot=openmc.Plot()
plot.geometry=geometry
openmc.plot_inline(plot)
“”