fusion-energy / paramak

Create parametric 3D fusion reactor CAD and neutronics models
https://paramak.readthedocs.io/en/main/
MIT License
57 stars 17 forks source link

Understanding of material's volumes assignments #325

Open gglamzn opened 3 weeks ago

gglamzn commented 3 weeks ago

Hi , I have done a simple code in order to highlight something I have hard time understanding about CAD geometries and their implementation in OpenMC:

Code

my_reactor = paramak.FlfSystemCodeReactor( inner_blanket_radius=100., blanket_thickness=70., blanket_height=500., lower_blanket_thickness=50., upper_blanket_thickness=40., blanket_vv_gap=20., upper_vv_thickness=10., vv_thickness=10., lower_vv_thickness=10., rotation_angle=180, )

cadquery_object = my_reactor.solid my_model = CadToDagmc()

Creates a DAGMC h5m file of the geometry with material tags automatically assigned.

my_model.add_cadquery_object( cadquery_object, material_tags=["uo2"], )

uo2 is on the materials I am defining later on my code.

I get , intentionally , this error:

ValueError: When setting material_tags, the number of material_tags should be equal to the number of volumes in the CAD geometry. 6 volumes found in the model and 1 material_tags found.

This is where I am having a hard time. I don't understand how those material tags are working , how they apply to my geometry , how do I know those 6 volumes {for this particular example } define which part of my geometry, are those volumes have to be defined in my CAD software? Best regards.

shimwell commented 3 weeks ago

The number of material tags should be equal to the number of cad volumes in the geometry.

It is difficult to know which material tag corresponds to which volume

the order that the volumes are added to the caquery assembly is the same order as they are exspected to be in for the materials tags

As you have used a reactor then the user does not know the order of the volumes added to the cadquery object without peaking at the source code or exporting the assembly and visually inspecting it.

I hope to make this better and clear in the refactor of the paramak I'm working on

for now this would make your error go way as it makes 6 materials as expected by the code.

cadquery_object,
    material_tags=["mat1", "mat2", "mat3", "mat4", "mat5", "mat6"],
)

you could then plot it in openmc to see which material is which