2
$\begingroup$

I'm searching for a way to generate a mesh that consists mostly of the same elements and i mean not only the same type, but the exact same size to ease the FEM-calculation.

Is there a particular algorithm or software package i should look into?

$\endgroup$
  • 1
    $\begingroup$ Gmsh is pretty good tool, which generate fine meshes. Results mostly depend from geometry. $\endgroup$ – Krzysztof Bzowski Nov 13 '13 at 11:26
  • 1
    $\begingroup$ If you're happy with triangles, use Chewchuk's 'triangle' package. $\endgroup$ – Wolfgang Bangerth Nov 13 '13 at 12:16
  • 1
    $\begingroup$ The above 2 comments are good suggestions, but if even one element is of a different size than the others, you're going to have to deal with it. For simple geometries like cubes and squares, you the mesh generation is trivial, and you can do it yourself. If the geometry is even slightly more complicated than this, you're going to have to account for elements of different size. $\endgroup$ – Bill Barth Nov 13 '13 at 13:58
  • 1
    $\begingroup$ Maybe something like marching cubes is appropriate, to enforce the uniform size constraint. (with a postprocessing pass to split each cube into e.g. tetrahedra or prisms - whatever your solver ingests). Capturing arbitrary boundaries will only be approximate - that goal seems at odds with the uniform size criterion. $\endgroup$ – rchilton1980 Nov 13 '13 at 17:01
1
$\begingroup$

Generating exactly the same elements is not entirely straightforward, and algorithms marching cubes-like algorithms might be needed to make the mesh-generation process completely automatic. However, as mentioned in the comments, you will not be able to capture arbitrary boundaries with that.

Depending on your goals, you might decide to help the mesher software to generate the conformal mesh that satisfies both requirements: as little sizes/orientations of the elements as possible, and conformal to the boundary. I will use GMSH as a software of choice.

Consider, the following 2-D example that you want to mesh: enter image description here

Here, we have a challenge of capturing the boundary at the bottom, but a lot of the potential to have a "structured mesh" in the top half (which is a square).

Attempt 1: just use the characteristic length at the points of the geometry and rely on the mesher's best effort:

enter image description here

cl=0.1; z=0.;

Point(1) = {0.5,0.5,z,cl};
Point(2) = {-0.5,0.5,z,cl};
Point(3) = {-0.5,-0.5,z,cl};
Point(4) = {0.5,-0.5,z,cl};
Point(6) = {0.0, -0.5, z, cl};

Line(1)={1,2};
Line(2)={2,3};
Line(4)={4,1};
Circle(5) = {3,6,4};
Line Loop(1) = {1,2,5,4};
Plane Surface(1) = {1};

Unfortunately, the mesher created a mesh that certainly does not satisfy the requirement of "same-size" triangles.

Attempt 2: specify structured mesh in an obvious region:

enter image description here

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

Line(1)={1,2};  Transfinite Line{1} = 10;
Line(2)={2,3};  Transfinite Line{2} = 10;
Line(3)={3,4};  Transfinite Line{3} = 10;
Line(4)={4,1};  Transfinite Line{4} = 10;
Line Loop(1) = {1,2,3,4};   
Plane Surface(1) = {1}; Transfinite Surface{1};

Point(6) = {0.0, -0.5, z, cl};
Circle(5) = {3,6,4};
Line Loop(2) = {5,-3};
Plane Surface(2) = {2};

Now, in one region, the mesh consists of exactly the same triangles and is conformal to the mesh in the other region.

Can we do better?

Attempt 3: manually add another region with a specified mesh:

enter image description here

cl=0.1; z=0.;

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

Line(1)={1,2};  Transfinite Line{1} = 11;
Line(2)={2,3};  Transfinite Line{2} = 11;
Line(3)={3,4};  Transfinite Line{3} = 11;
Line(4)={4,1};  Transfinite Line{4} = 11;
Line Loop(1) = {1,2,3,4};   
Plane Surface(1) = {1}; Transfinite Surface{1};

Point(10) = {-0.4,-0.5,z,cl};
Point(11) = {0.4,-0.5,z,cl};
Point(12) = {0.4,-0.7,z,cl};
Point(13) = {-0.4,-0.7,z,cl};

Line(10) = {10,13}; Transfinite Line{10} = 3;
Line(11) = {13,12}; Transfinite Line{11} = 9;
Line(12) = {12,11}; Transfinite Line{12} = 3;
Line(13) = {11,10}; Transfinite Line{13} = 9;
Line Loop(3) = {10,11,12,13};   
Plane Surface(3) = {3}; Transfinite Surface{3};

Point(6) = {0.0, -0.5, z, cl};
Circle(5) = {3,6,4};
Line(21) = {4,11};
Line(22) = {10,3};

Line Loop(2) = {5,21,-12,-11,-10,22};
Plane Surface(2) = {2};

Effectively, what I have done -> is applied marching cubes manually. I am not aware if GMSH contains something built-in to perform this kind of meshing. However, one would certainly be able to write a script that performs a marching cube-type algorithm to generate a GMSH-compliant geometry file.

It is also possible to have structured mesh regions with different triangle sizes to connect with the help of a relatively small number of triangles (unstructured mesh regions).

NB: I used a very primitive way to instruct GMSH on the mesh, there are better ways to do it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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