I meshed a 3D Cube in COMSOL using a free tetrahedral mesh. I wanted to export this mesh into some format which is readable by legacy fenics.
Unfortunately (cf. p. 6 of https://www.comsol.com/model/download/1273541/COMSOL_MeshImportExportGuide.pdf ) Comsol does just support NASTRAN and Comsol-multiphysics files for the export of full 3D meshes, while the other formats (as .stl or .ply) just support the export of the surface part.
I now wanted to convert the exported .nas file to an .xml file using meshio 5.3.5, i.e.:
meshio convert foo.nas foo.xml
But this gives the error:
meshio._exceptions.WriteError: DOLFIN XML only supports triangles and tetrahedra. Consider using XDMF instead.
However, the .nas file looks like it would contain a tetrahedral mesh (although it is not clear to me, what +CONT means in the element data section), as you can see from the following snippet of the .nas file:
$ Generated by COMSOL 6.1.0.357
$ Sep 19 2024, 12:52
BEGIN BULK
$ Grid data section
GRID 1 0.0000000.0000000.000000
GRID 2 0.0000000.0000000.100000
GRID 3 0.0000000.0620530.064720
GRID 4 0.0000000.1000000.000000
GRID 5 0.0000000.0000000.200000
[...]
GRID 23665 0.9762760.9757490.899960
GRID 23666 0.9525530.9014980.949920
$ Element data section
CTETRA 1 1 4 7 3 1 4018 5473+CONT
+CONT 3291 3179 4017 3289
CTETRA 2 1 6 3 2 9 5474 3290+CONT
+CONT 5475 5476 3294 3292
CTETRA 3 1 6 9 2 5 5476 3292+CONT
+CONT 5475 5477 3293 3170
CTETRA 4 1 1 3 10 7 3289 5478+CONT
+CONT 3653 4017 5473 5479
[...]
CTETRA 16563 1 3166 3164 3168 3163 4741 4744+CONT
+CONT 3278 5471 23662 5472
$ Property data section
PSOLID 1
ENDDATA
Do you have an idea, how I can convert this into a 3D mesh that is usable in legacy fenics, presumably in the .xml format?