Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Tagging (sub)meshes for separate top level objects

More
4 years 2 months ago #2389 by bhaveshshrimali
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;
I generate the mesh as follows:
Code:
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!
More
4 years 2 months ago #2391 by christopher
Hi,
not sure, but I think, every volume domain (toplevelobject) corresponds to a physical group in the gmsh mesh afterwards. The index is 100000+element index in Netgen.
Note Netgen does only support exporting to an old gmsh v2 file format. Maybe that is the problem?
Best
Christopher
More
4 years 2 months ago #2394 by bhaveshshrimali
Thanks for your reply Christopher. I would try to manually write the gmsh file and see.
Time to create page: 0.112 seconds