fusion-energy / neutronics-workshop

A workshop covering a range of fusion relevant analysis and simulations with OpenMC, DAGMC, Paramak and other open source fusion neutronics tools
MIT License
111 stars 50 forks source link

adding 3d ray trace plots #242

Open shimwell opened 11 months ago

shimwell commented 11 months ago

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()