QiangF / glvis

Automatically exported from code.google.com/p/glvis
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Mfem file format for curved elements #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

 would it please be possible to provide examples of curved meshes in mfem file format in 2D and 3D? Ideally I would like to have an example mesh with one or two P2/P3 triangles in 2D, one P2/P3 tetra in 3D and so on.
  From your description on the wiki, I don't understand how to write a curved mesh to a file. Looking at escher-p2.mesh, for example, it seems that only the vertices of the tetra and boundary triangles are given in connectivity sections. Does it mean that the mesh nodes have to be indexed so that the first N nodes are only P1 vertices and the remaining nodes of the mesh (with index higher than N) are the additional nodes?
 It's not clear to me what is the ordering convention in the 'FiniteElementSpace' section and what do the numbers actually mean. You say that the mesh description is 'based on a vector finite element grid function with degrees of freedom in the "nodes" of the mesh'. What function? Some values are smaller than -1 or bigger than 1, so I suppose it's not Lagrange shape function values that you store here. Does 'nodes' mean all nodes (i.e. higher-order nodes included)? How are they indexed - is there any correspondence with the node ordering in the 'elements' section? Could you please provide a sketch or an example of a __very__ simple mesh file for each element shape? Deciphering your conventions from a 3D mesh with more than 10 elements is just too hard.

Mfem supports discontinuous elements. Is it possible to store a discontinuous 
mesh, i.e. mesh where each element has it's own degrees of freedom not shared 
with its neighbours, in native mfem file format?

 Thank you for your help and for making glvis opensource.

Best regards,

   Martin Vymazal

Original issue reported on code.google.com by Martin.V...@gmail.com on 25 Dec 2013 at 12:00

GoogleCodeExporter commented 9 years ago
Hi Martin,

We realize that the documentation of high-order curved meshes in MFEM is 
lacking, in particular with respect to the complexity of how to number the 
nodes.

I have attached the simplest second order mesh of the canonical triangle, 
tetrahedron, quadrilateral and hexahedron. Let me try to explain the format 
with the quad-q2.mesh:

The first section of the file:

dimension
2

elements
1
1 3 0 1 2 3

boundary
4
1 1 0 1
1 1 1 2
1 1 2 3
1 1 3 0

vertices
4

describes only the "topological" structure of the mesh -- what are the elements 
and the relationships between them. There are no coordinates here, it is just 
elements as lists of vertices (which are identified by indices). In this 
particular example we have one quadrilateral (geom type 3) with vertices 0, 1, 
2, 3 and 4 boundary elements, which are the segments (geom type 1): 01, 12, 23, 
30. The shape of the element (including the coordinates of its vertices),  and 
the curvature of its boundary segments are not specified yet.

This "topological description of the mesh", is all that we need in order to 
define a finite element space on it. Specifically, if we associate locally some 
finite element degrees of freedom with element vertices, edges, faces or 
interiors, then we can identify the (unique) global degrees of freedom, since 
we know which elements share vertices, edges and faces (as well as their 
orientation).

This is how we define isoparametric meshes in MFEM: we just describe the 
coordinates of the mesh notes as a GridFunction in a FiniteElementSpace based 
on the topological description. In particular there is no issue with 
discontinuous meshes - you just need a topologically disjoint mesh.

In the quad-q2.mesh file we use a Q2 finite element space with degrees of 
freedom in the vertices, edge mid-points and the centers of the elements, and 
the function in that space with the high-order node coordinates is:

nodes
FiniteElementSpace
FiniteElementCollection: Quadratic
VDim: 2
Ordering: 0

0
1
1
0
0.5
1
0.5
0
0.5
0
0
1
1
0
0.5
1
0.5
0.

This is a vector function and by default its ordering is x-coordinate first, 
then y-coordinates. In other words the Q2 nodes in this example are:

(0,0), (1,0), (1,1) and (0,1) - the 4 vertices in counter-clockwise enumeration

(0.5,0), (1,0.5), (0.5,1), (0,0.5) - the 4 edge mid-points for edges from 
vertices 01, 12, 23, and 30 

(0.5,0.5) - the element center

Now, what is the numbering when we have more elements? 

We first number the vertex-based degrees of freedom, visiting the elements in 
order, using the above counter-clockwise enumeration, and skipping the already 
numbered vertices.

We next number the edge-based degrees of freedom (i.e. those in the interior of 
edges), visiting the elements in order, using the above local edge ordering, 
and enumerating the degrees of freedom according to the direction of the edge 
(again we skip a degree of freedom if it has already been numbered by another 
element).

We next number the degrees of freedom associated with interiors of element 
faces, following a similar pattern, and we finally enumerate the degrees of 
freedom inside the elements.

Hopefully this makes sense. I will be happy to send you more  examples of 
simple meshes to clarify things.

Cheers,
Tzanio

Original comment by tzanio on 31 Dec 2013 at 12:39

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by tzanio on 13 Mar 2014 at 10:05