Skip to content

Object oriented CSG geometry - #97

Draft
SteSeg wants to merge 27 commits into
LIBRA-project:mainfrom
SteSeg:object_oriented_neutronics_model
Draft

SteSeg wants to merge 27 commits into
LIBRA-project:mainfrom
SteSeg:object_oriented_neutronics_model

Conversation

@SteSeg

@SteSeg SteSeg commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

New geometry definition for LIBRA

I noticed that the current geometry is not friendly in several ways:

  • every time we have a new run the component position changes, the experiment in the room changes both position and orientation, right now this means change the geometry component surface by surface and diagnose gaps and overlaps (which consistently happen)
  • how we manage the geometry right now is hard to understand and can be an entry barrier for new contributors/analysts, takes also much more time than expected for PR reviewers who already know the model's architecture.

I want to try a new geometry configuration that treats libra components as objects that the user can instantiate and move around without directly interacting with each surface of the component. It still uses openmc's native csg but does not require the user to interact with it. The user will only interact with Components and Assembly objects that have already been prebuilt and available to be moved and orientated around.

What is already available to test

This is still a work in progress but there are already some things available:

  • the Component and Assembly classes
  • Some pre-built components (Vessel1L, Heater, Table, LeadBrick and many others)
  • One ready Assembly (i.e. BreederVessel1LAssembly)
  • Specifically, the Vessel1L component has an easy way to be filled with the salt and headspace gas that can be seen in the BreederVessel1LAssembly
  • It is possible to place and orient Assemblies in the vault room
  • There is an example.py script that shows how how to use it with the present capabilities (script that will be removed later)

There are many things to implement (add Components and Assemblies, build and an entire experiment to test usability, check for errors, remove examples scripts etc.)

Usage

Every component can be instantiated, filled with a material and has its own reference system. A component should be built with the information on where the center of its reference system is:

from libra_toolbox.neutronics.materials import *
from libra_toolbox.neutronics.components import *

vessel = Vessel1L(
    name="Vessel1L",
    material=Inconel625,
)

print(vessel.reference_point)
print(vessel.local_axis_description)

Should give

"Center of the vessel bottom's bottom cylindricalsurface (z=0)."
"+z points from the bottom toward the lid"

Components can be aggregated in Assembly objects and placed in the assembly by placing their reference_point:

experiment = Assembly("Experiment")

experiment.add(
    vessel,
    position=(0, 0, 0),
)

experiment.add(
    table,
    position=(0, 0, -25),
)

experiment.add(
    brick,
    position=(15, 0, 10),
    rotation=(0, 0, 90),
)

or:

breeder_assembly = Assembly("BreederAssembly")
breeder_assembly.add(vessel)
breeder_assembly.add(breeder, position=(0, 0, 0.786))
breeder_assembly.add(headspace)

experiment.add(
    breeder_assembly,
    position=(0, 0, 20),
)

I'm working right now on a clean way to decide and expose the assembly's reference_point to be able to position it in the vault. Right now there's only the example of the BreederVessel1LAssembly being placed in the vault model and it gets positioned according to the Vessel1L Component's reference_point.

assembly = BreederVessel1LAssembly(
    name="BreederVessel1LAssembly",
    vessel=vessel,
    breeder=breeder,
    headspace=headspace,
)

model = build_vault_model(
    settings=settings,
    tallies=tallies,
    experiment_placements=[
        {
            "assembly": assembly,
            "position": (500.0, 300.0, 10.16),
            "rotation": (0.0, 0.0, 45.0),
            "envelope_radius": 30.0,
        }
    ],
)

Feedback request

I open the PR as draft since I would like to have some feedback by other contributors before investing more of my time on this.

I want to give a little try to this configuration just to avoid the additional layer of meshing the geometry, and if the usability is still not great we will probably move to a cadquery+gmsh workflow. But I am open to talk about skipping this attempt and move to CAD directly.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants