I have a 3D mesh generated from a .geo
file with two TopLevelObjects
. These are to be assigned different materials. Basically, something like
[code]algrbraic3d
solid p1=plane (0,0,0;0,0,-1);
solid p2=plane (1,1,1;0,0,1);
solid p3=plane (0,0,0;0,-1,0);
solid p4=plane (1,1,1;0,1,0);
solid p5=plane (0,0,0;-1,0,0);
solid p6=plane (1,1,1;1,0,0);
solid cube=p1 and p2 and p3 and p4 and p5 and p6;
solid sph = sphere(0.5, 0.5, 0.5; 0.1);
solid matrix=cube and not sph;
solid part = cube and sph
tlo matrix -transparent;
tlo parts -col=[1,0,0];
identify periodic p1 p2;
identify periodic p3 p4;
identify periodic p5 p6;
[/code]
I generate the mesh as follows:
from netgen.csg import *
from ngsolve import *
geo = CSGeometry("Cube_Sphere.geo")
msh = geo.GenerateMesh(maxh=0.05)
msh.Export("AbaqusMesh.inp", "Abaqus Format") #this creates separate 'parts'
msh.Export("Gmsh_mesh.msh", "Gmsh2 Format") #this does not create separate physical tags
Is it possible to extract the corresponding meshes for each “TopLevelObject” (namely parts and matrix) and assign them physical tags them before exporting to gmsh. I need to eventually export the mesh in dolfin
xdmf
format. Since that is not naively supported, I want to export the mesh to gmsh-format and then manually convert it to dolfin xdmf (using meshio).
Thanks in advance!