0
$\begingroup$

I'm want to load a mesh from a file, generated by triangle, and I want to use the boundary marks of its nodes (boundary marks of the file). It is possible?

Also, I can change the mesh generator (or convert its output file), but I want to use the marks of the nodes of the file, is it possible?

$\endgroup$
  • $\begingroup$ You can write a tiny tool to convert your mesh file to a format which GMSH can read. $\endgroup$ – chuyenvien94 Feb 10 at 0:06
  • $\begingroup$ My question is the same, if I have the mesh en gmsh, how can I load the its boundary node marks? $\endgroup$ – yemino Feb 10 at 5:36
2
$\begingroup$

Since GMSH was mentioned in the comments as a possible meshing tool, the common way to deal with it there is to create a Physical Line.

The simplest .geo (modeling and meshing a square):

cl=0.5;
Point(1) = {1.,1.,0.,cl};
Point(2) = {-1.,1.,0.,cl};
Point(3) = {-1.,-1.,0.,cl};
Point(4) = {1.,-1.,0.,cl};

Line(1) = {1,2};
Line(2) = {2,3};
Line(3) = {3,4};
Line(4) = {4,1};

Line Loop (1) = {1,2,3,4};
Surface(1) = {1};
Physical Surface(1) = {1};   // that is "1" the tag for your 2-D elements, by default, triangles
Physical Line(2) = {1,2,3,4}; // that is the tag "2" for your contour lines; thus, boundary nodes

After meshing, it will create both 2-D and 1-D mesh elements. Looking inside the generated *.msh, you will be able to easily distinguish between them. In that way, it would also be easy to assign different boundary conditions to different lines (simply by creating several Physical Line's).

$\endgroup$
  • $\begingroup$ Thanks, but when I try to generate a mesh in xml format (to be the input of a fenics code, for example with dolfin-convert) only generates a mesh.xml, but I also need load the marks of the nodes For example: mesh = Mesh("mesh.xml") bd = MeshFunction("size_t", mesh, "mesh_facet_region.xml") ds = Measure("ds", subdomain_data=bd) How can I generate the "mesh_facet_region.xml", or, how can I load the marks of faces and nodes of the file mesh in fenics? $\endgroup$ – yemino Feb 14 at 5:05
  • $\begingroup$ Hmmm, I am not actually a Fenics user. But take a look here: fenicsproject.org/qa/9983/… the second answer implies that dolphin-convert ignores Physical Surfaces and Lines if only one region is there. $\endgroup$ – Anton Menshov Feb 14 at 5:22
  • $\begingroup$ Thanks @anton, but my question is related with fenics only. I don't know why that solutions doesn't work for me, and I don't have information in the fenics manual. $\endgroup$ – yemino Feb 14 at 17:02
  • $\begingroup$ @yemino If I were you, I would write a tiny tool which converts .msh file of GMSH to xml file. I wrote such a tool except my output is a .dat file for Tecplot and/or .vtk file for Paraview. Have a look at my repository: github.com/truongd8593/gmsh-to-vtk-and-tecplot $\endgroup$ – chuyenvien94 Feb 15 at 5:55
  • $\begingroup$ Thanks @chuyenvien94 for share your Fortran code, but, Can I load the *.vtk or *.dat mesh data (with boundary conditions fo the nodes) in fenics? Because that is my question: how load the mesh (with the boundary marks) in fenics. $\endgroup$ – yemino yesterday

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.