neutronics-workshop icon indicating copy to clipboard operation
neutronics-workshop copied to clipboard

adding 3d ray trace plots

Open shimwell opened this issue 10 months ago • 0 comments

With the PR for raytracing plots going into openmc it would be nice to add an example, here is one I started

import openmc

#todo add geoemtry

mat1 = openmc.Material(name="mat1")
mat1.add_nuclide("C12", 1)
mat1.set_density("g/cm3", 0.5)
mat2 = openmc.Material(name="mat2")
mat2.add_nuclide("C12", 1)
mat2.set_density("g/cm3", 0.5)
mat3 = openmc.Material(name="mat3")
mat3.add_nuclide("C12", 1)
mat3.set_density("g/cm3", 0.5)
mat4 = openmc.Material(name="mat4")
mat4.add_nuclide("C12", 1)
mat4.set_density("g/cm3", 0.5)
mat5 = openmc.Material(name="mat5")
mat5.add_nuclide("C12", 1)
mat5.set_density("g/cm3", 0.5)

plots=openmc.Plots()

p = openmc.PhongPlot()
p.camera_position = [3000, 2000, 3000]
# p.light
p.diffuse_fraction = 0.3
p.pixels = (1000, 1000)
p.filename = 'p.png'
p.color_by='material'
p.opaque_domains = [
    mat1,mat2,mat3,mat4,mat5
]
# p.colors 
plots.append(p)
plots.export_to_xml()
my_model.export_to_xml()

shimwell avatar Aug 31 '23 16:08 shimwell