fusion-energy / openmc_geometry_plot

Create axis slice plots of OpenMC geomtry with specified zoom
6 stars 0 forks source link

faster plotting with openmc lib #8

Closed shimwell closed 1 year ago

shimwell commented 1 year ago

perhaps the openmc.lib.find method is quicker that the openmc.Geometry.find as it is on the C side instead of the python side

Also I think this openmc.lib approach will work with DAGMC geometry. The python side DAGMCGeometry class does not have a find method.

minimal example

import openmc.lib

openmc_material = openmc.Material()
openmc_material.id = 1
openmc_material.add_nuclide('Li6', 1)

my_materials = openmc.Materials([openmc_material])
my_materials.export_to_xml()

spheres = [openmc.Sphere(r=r) for r in [10, 20, 30, 40, 50]]

spheres[-1].boundary_type = "vacuum"

regions = openmc.model.subdivide(spheres)

cells = [openmc.Cell(fill=openmc_material, region=r) for r in regions[:-1]]

my_geometry = openmc.Geometry(cells)
my_geometry.export_to_xml()

my_settings = openmc.Settings()
my_settings.particles=1
my_settings.batches=1
my_settings.export_to_xml()

openmc.lib.init()
mat = openmc.lib.find_material((0,0,0))
print(mat)

todo write to tmp folder speed test

shimwell commented 1 year ago

@RemDelaporteMathurin I plan to update the find method used in this package with the faster one in openmc.lib. once this is done it should be possible to combine with dagmc_geometry_slice_plotter to make the outline of the materials or cells