svalinn / parastell

Parametric 3D CAD modeling toolset for stellarator fusion devices
MIT License
23 stars 10 forks source link

Edge Recovery Error in CAD-to-DAGMC Workflow #79

Open connoramoreno opened 4 months ago

connoramoreno commented 4 months ago

When trying to export a DAGMC model of the test in-vessel build geometry using the export_cad_to_dagmc method of the InVesselBuild class, I am running into the following error during the 2-D meshing step:

Info    : Meshing 2D...
Info    : [  0%] Meshing surface 1 (BSpline surface, MeshAdapt)
Info    : [ 10%] Meshing surface 2 (Plane, MeshAdapt)
Info    : [ 20%] Meshing surface 3 (Plane, MeshAdapt)
Info    : [ 30%] Meshing surface 4 (BSpline surface, MeshAdapt)
Info    : [ 40%] Meshing surface 5 (Plane, MeshAdapt)
Info    : [ 50%] Meshing surface 6 (Plane, MeshAdapt)
Info    : [ 60%] Meshing surface 7 (BSpline surface, MeshAdapt)
Info    : [ 70%] Meshing surface 8 (Plane, MeshAdapt)
Info    : [ 80%] Meshing surface 9 (Plane, MeshAdapt)
Info    : [ 90%] Meshing surface 10 (BSpline surface, MeshAdapt)
Warning : Impossible to recover edge 1496 1496 (error tag -1)
Warning : Impossible to recover edge 4 4 (error tag -1)
Error   : Unable to recover the edge 1500 (364/364) on curve 4 (on surface 10)

I am unsure if this error is specific to ParaStell or CAD-to-DAGMC. The geometry used is that of the test in-vessel build; that is, the geometry includes a plasma (yellow), scrape-off layer (green), and a single generic component (purple/pink), pictured below.

Screenshot 2024-04-08 at 6 59 09 PMScreenshot 2024-04-08 at 6 59 39 PM

Interestingly, as the 2-D meshing occurs after surface merging, there should only be 3 BSpline surfaces (surfaces 1, 4, and 7). This has been cross-checked against the WISTELL-D stellarator configuration, using the same workflow and geometry definition, and against the same testing configuration where a reduced geometry definition is used, such that the toroidal extent is reduced to 30 degrees rather than 90 (both alternatives mesh successfully and don't include surface 10).

It is this mysterious surface 10 that is causing the error, but I'm unsure why the surface is there at all. Perhaps @shimwell has a better idea of what's going on?

shimwell commented 4 months ago

Sorry to hear the meshing part in export_cad_to_dagmc is not working and thanks for trying.

Out of interest does export_gmsh_mesh_file manage to produce a mesh?

Another thing to try is exporting the step file and then opening it with gmsh to take a look at the geometry and see if it can be manually meshed in the gmsh gui.

Another thing to try is reducing the min_mesh_size argument for export_cad_to_dagmc, it defaults to 1 but it can go smaller

I was just looking into adding another method of surface meshing so perhaps this is a good reason to add that extra meshing option

connoramoreno commented 4 months ago

Looks like export_gmsh_mesh_file fails similarly on surface 10 as above. Same goes for using min_mesh_size=0.5.

We'd like to be able to automate this process within ParaStell, rather than needing to manually mesh the geometry, though it may be a good idea to look at the geometry in the Gmsh GUI for any obvious issues.