fusion-energy / paramak

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

EU-DEMO material tag and generation issues. #327

Open g-blackett opened 2 months ago

g-blackett commented 2 months ago

Hello,

I am trying to generate the EU-DEMO model but keep running into issues.

The first method is as below:


my_reactor = paramak.EuDemoFrom2015PaperDiagram(
rotation_angle=360,
number_of_tf_coils=16,
)

my_reactor.export_dagmc_h5m(filename = 'demotest.h5m')

However this throws an error saying the number of material tags does not match the number of volumes.

Screenshot 2024-07-22 171844

Rerunning the code with rotation angle equal to anything less than 360 throws 'ValueError: Null TopoDS_Shape object. From looking at forum posts online this may be related to how the geometry is sliced when selecting an angle < 360.

Screenshot 2024-07-22 172237

I also followed the method as stated in a previous thread raised here (https://github.com/fusion-energy/paramak/issues/306) where the paramak reactor object is exported as a .brep file then imported with the brep_to_h5m command. To perform this method the appropriate material tags are required. From looking at the code for the EU-DEMO model there should be 16 volumes in the order stated below?

from brep_to_h5m import brep_to_h5m
import openmc
brep_to_h5m(
   brep_filename='demotest.brep',
    material_tags=['plasma',
                    'outboard_pf_coil_1',
                    'outboard_pf_coil_2',
                    'outboard_pf_coil_3',
                    'outboard_pf_coil_4',
                    'outboard_pf_coil_5',
                    'outboard_pf_coil_6',
                    'pf_coils_1',
                    'pf_coils_2',
                    'pf_coils_3',
                    'pf_coils_4',
                    'pf_coils_5',
                    'blanket',
                    'divertor',
                    'vessel_inner',
                    'tf_coil_casing'],
    h5m_filename='demotest.h5m',
    min_mesh_size= 1,
    max_mesh_size = 20,
    mesh_algorithm = 1,
)

dag_univ = openmc.DAGMCUniverse(filename='demotest.h5m').bounded_universe()
print(dag_univ.material_names)

However this throws the error "ValueError: 34 volumes found in Brep file is not equal to the number of material_tags 16 provided." Should there be 34 volumes? What would their material tags be, I cannot see from the EU-DEMO code what these would be.

Thank you for any help!

shimwell commented 2 months ago

Yes sorry, paramak needs a rewrite (which is happening)

But in the meantime perhaps the work around is to export to step file and use cad-to-dagmc or one of the other converters with the step file.

The step file can also be opened in freecad or other step file viewers so you can see the order of the solids and number of solids

g-blackett commented 2 months ago

No worries, thank you for the response. I will give this method a go.