tucanos and pytucanos

Tucanos

Mesh

Mesh adaptation applies only to simplex meshes, i.e. triangles in 2D and tetrahedra in 3d.

Simplex meshes

Mesh adaptation can only be applied to conformal meshes made only of simplex elements, i.e. triangles in 2D and tetrahedra in 3d. For other types of meshes, the elements must initially be split into simplices: algorithms for standard elements are given in How to Subdivide Pyramids, Prisms and Hexahedra into Tetrahedra, Julien Dompierre Paul Labbé Marie-Gabrielle Vallet Ricardo Camarero and implemented in tucanos.

Mesh

A mesh consists of

  • Vertices
  • Elements and element tags
  • Tagged faces and face tags

It is characterized by a spatial dimension as well as a cell dimension (3 for tetrahedra, 2 for triangles, ...). The set of mesh entities of dimension is denoted .

A mesh is valid if

  • All the elements have a volume ,
  • All the faces must be either either
    • tagged if
      • belong to only one element. In this case, they must be oriented outwards
      • belong to two elements with different tags
      • (belong to more than two elements)
    • untagged

and consistent with the geometry (i.e. a CAD-like model) if all the vertices of the tagged faces lie on the corresponding geometry surfaces.

Topology

Metric

A metric field is used in order to prescribe the element sizes and orientations to be used during remeshing. The continuous mesh framework establishes a duality between this (continuous) metric field and the resulting discrete mesh : for more details, see A. Loseille and F. Alauzet, Continuous mesh framework. Part I: well-posed continuous interpolation error, SIAM J. Numer. Anal., Vol. 49, Issue 1, pp. 38-60, 2011. PDF

Riemannian metrics

Riemannian metric & unit mesh

A Riemanian metric is a symmetric positive definite (SPD) tensor field , defined everywhere in the computational domain, such that the length of an edge is given by

This field can then be used to define the size and orientations of mesh elements through the generation of a (quasi) unit mesh, i.e. a mesh for which all edges have a unit length:

Local sizes and directions

The metric is a SPD tensor: it can be characterized locally by its eigenvalues and an orthonormal basis of eigenvectors . The edges with a local size are unit edges in metric space (if is constant over ).

In order to generate an isotropic mesh with local size , the metric should be

Metric complexity

The physical volume of and equilateral element with unit edges in the (uniform) metric space (i.e. ideal elements) in dimensions is where is the volume associated with metric and .

The number of ideal elements per unit physical volume is thefore so the ideal elements to fill a domain is

The complexity is

Discrete metric field

In the context of remeshing, only a discrete metric field is known. A metric is defined at each vertex of the input mesh.

Metric interpolation

log interpolation

Logarithmic interpolation is used to interpolate between metrics: as it verifies a maximum principle, i.e. if then for

When interpolating a discrete metric field at is approximated as which is consistent with the assumption of geometric progression of sizes.

Why not linear interpolation?

linear interpolation

Linear interpolation between and is given by and does not respect the maximum principle:

Edge length in metric space

In order to compute the length of an edge , logarithmic interpolation is considered along the edge leading to: with and .

Element quality in metric space

The quality of an element in metric space is given by where the normalization factor is a such that of equilateral elements:

The same metric is used to compute all the edge lengths: among the metrics defined at all the vertices of element , the one with minimum volume is used in the formula above

Invalid elements have a quality

Metric operations

Building a metric that is suitable for remeshing may require combining information from different sources or imposing constraints (e.g. minimum or maximum edge lengths, smooth variation with respect to the input mesh, ... ),

Metric intersection

Given two metrics and , the intersection corresponds to a metric that imposes the largest sizes that are smaller than those imposed by and :

h:12cm center

It is computed as follows: let be the generalized eigenvectors of : then with . The intersection is then with .

See proof

Metric gradation

It is sometimes desirable to control how fast edge lengths grow from from element to the next. This idea can be translated into constraints on the variation of the metric field on the edges of the mesh (see Size gradation control of anisotropic meshes, F. Alauzet, 2010 pdf) summarized as follows:

  • The gradation on an edge is (with )
  • Given a metric , is is possible to span a field at any location as
    with so that the gradation along is
  • In practice a maximum gradation is enforces along edge , by modifying to
    and
  • Achieving a maximum gradation over all the edges in the mesh would require operations; in practices, the above operations is only applied on all the edges of the mesh a small number of times.

Thresholds on the local sizes

In order to ensure that the metric field will generate meshes with edge sizes between and , the metric with is modified as with .

Element-implied metric

Given an element , defined by its vertices , the element-implied metric is the metric for which the element is equilateral

If is the jacobian of the transformation from the reference equilateral element to the physical element, the element-implied metric is

In practice is computed as where - is the jacobian of transformation from the reference orthogonal element to the physical element - is the jacobian of transformation from the reference equilateral element to the reference orthogonal element (independent of )

Controling the step between two metrics

In the remeshing process, it may be interesting to limit the step between the element-implied and target metrics

Given two metric fields and , the objective is to find as close as possible from such that, for all edges i.e. to have

  • If as close as possible is defined as minimizing the Froebenius norm , the optimal is computed as follows
    • compute ,
    • compute the eigenvalue decomposition ,
    • compute where ,
    • compute .

h:12cm center

(the thin blue lines represent and )

See proof

Metric scaling

  • The "ideal" metric is modified using a series of constraints
    • Minimum and maximum edge sizes and ,
    • Maximum gradation ,
    • Maximum step with respect to the element implied metric ,
    • A minimum curvature radius to edge lenth ratio (and optionally ), giving a fixed metric
  • A scaling is applied, such that the actual metric used for remeshing is
  • is chosen to have a given complexity
  • A simple bisection is used to compute if all the constraints can be met.

Maths

Notations

  • One denotes the Frobenius norm of a matrix by . This norm is associated with the scalar product .
  • One denotes by the partial order in the symmetric matrices space : if , i.e. for all , .

Projection on a closed convex subset of the symmetric matrices

The following theorem has been proven in Computing a nearest symmetric positive semidefinite matrix, Higham Nicholas J, 1988:

Theorem 1 Let . Then, is a closed convex subset of the space and then there exists a projection application such that Let and its diagonalisation in an orthonormal basis: , . Then,

Proof

Let and its diagonalisation in a orthonomal basis . As is invariant by linear isometry (, one gets and then the change of variable together with , leads to the following problem This problem can be computed explicitly. Since , ( the canonical basis vectors) This lower bound is reached for the following diagonal matrix , where , and moreover, and is in , which ends the proof.

Generalization

One can generalize the Theorem above as follow:

Theorem 2 Given two symmetric real numbers , let . is a compact convex subset of and then let us denote the associated projection application: Given and its diagonalisation in an orthonormal basis: , . Then,

Proof

The proof follows the one above very closely. The lower bound is got using the inequality: : which is reached for where if , if and otherwise . Again, the matrix is symmetric and indeed in (because since is diagonal, ) and thus is the unique solution of the problem (existence and uniqueness beeing given by the projection on closed convex sets in a Hilbert space).

Metric optimization problem

Given two metrics . The deformation ratio between a metric and is defined as a function of

The problem.

Given two metrics , and two real numbers , let be the set of metrics which are not to stretched with regard to : Again, this set is compact and convex. Given a matrix norm , we want to find which minimize the distance to , i.e. find such that:

lemma : Let two metrics > and . The function is bounded and reaches its bounds which are the minimum and maximum of the eigenvalues of . Thus,

Thanks to this lemma, the admissible set can be re-writen as

In the -twisted Frobenius norm

First, one studies the case of choosing The above problem reads as follows. Find such that: It is then clear that the change of variable leads to a problem of the form of Theorem 2. Denoting the problem reads find such that Then, from Theorem 2, the solution is and can be computed as follows:

  • Compute ,
  • Find such that .
  • Compute .
  • Compute

Remark Maybe a more suitable formulation would minimizing the Frobenius norm . This leads to a different problem. For instance, if where . One gets, denoting the error instead of The two distance measures give very different results... does it matter in practice?

Intersection of metrics

Problem.

Given two metrics , we want to find a metric which respects the most restrictive length of and . Moreover, we want that this metric beeing maximal. More formally, the lenght restriction can be expressed by indeed, is the length of associated with a metric . The local volume associated with a metric is its determinant: , so that the optimization problem reads such that

Solution of the problem.

First, one multiplies by on each side of the constraints, which leads to Then, denoting and applying the change of variable , one gets the simplified problem: such that

This problem can be even more simplified using (does not change the objective as ) and by diagonalization of in an orthonomal basis: Indeed, and , and let us change again the variable , with , the problem is finally: such that

This problem can now to be solved explicitly by finding an upper bound. Let such that , then Hadamard inequality provides . Moreover, , from which and then, using the two constraints: , one gets the upper bound reached for the diagonal matrix . Moreover, this matrix is symmetric and verifies and .

Finally, applying the two changes of variables, the unique solution of the problem is

Hadamard inequality

Given a matrix , one has with equality iff the are orthogonal.

The result if clear if is singular, if not let , so that one has to show that . is hermitian hence diagonalizable in an orthonomal basis, denoting its eigenvalues, one has

Curvature metric

A metric field can be defined on the boundaries of the computational domain to ensure an accurate representation of the curvature

  • the curvature tensor is computed on an accurate geometrical model, giving principal directions and and the associated curvature radii and .
  • along direction , a size is imposed (with a given value of , typically )
  • along the normal direction the edge length can be chosen arbitrarily. It the representation of the curvature is the only objective, one can chose .

This metric field, defined on the boundary of the computational domain, can then be extended into the domain using a fixed gradation

boundary-normal size for turbulent boundary layers

For the simulation of turbulent boundary layers, it may be interesting to ensure that the mesh will be fine enough to capture the linear (or log if a wall model is available) layer. In this case, the boundary normal size can be chosen to have a target value of .

In order to estimate the wall shear stress, required to estimate the target edge length in the normal direction, a wall model should be used (as the initial mesh is in practive much too coarse to resolve the turbulent boundary layer)

Remesher

Input metricAdapted mesh
metricadapted mesh

The idea is to perform a series of local modification on an input mesh to have a

  • edge lengths that are of approximately unit length in the metric space
  • element qualities as high as possible

In order to ensure the validity of the final mesh, validity is enforced at each step.

The remeshing algorithm is a sequence of steps applied to the edges or vertices of the mesh

  • collapse
  • split
  • (edge) swap
  • smooth

Collapse

collapse

The collapse operation aims at removing "small" edges. It is applied to edges whose length (in metric space) is smaller than .

It can however introduce

  • "long" edges
  • element of low quality (including invalid elements)
  • a poor representation of the geometry that will be difficult to recovered later

These 3 criteria have to be assessed to determine if a collapse operation is accepted or not

Split

split

The collapse operations aims at splitting "long" edges. It is applied to edges whose length (in metric space) is larger than .

It can however introduce

  • "short" edges
  • element of low quality (including invalid elements)

These 2 criteria have to be assessed to determine if a split operation is accepted or not

When introducing new vertices on boundaries, a projection step is required to ensure the consistency with the CAD model.

Edge swap

swap

The swap operation aims at improving the quality of the elements.

It can however introduce

  • "long" or "short" edges
  • a poor representation of the geometry that will be difficult to recovered later
  • inconsistent tagging

These 3 criteria have to be assessed to determine if a swap operation is accepted or not

Smoothing

The smoothing operation aims at improving the quality of the elements by moving vertices to some average of the locations of its neighbors.

In order to have a consistent smoothing on the boundaries of the computational domain, only the neighbors tagged on the same topological entity or one of its children are considered for smoothing. A projection step is still required for boundary vertices to ensure the consistency with the CAD model.

TODO: smoothing algorithms

Remeshing algorithm

The remeshing algorithm is iterative, and consists is multiple passes over the mesh edges / vertices to apply collapse, split, swap and smoothing.

The detail of the algorithm (order of the steps, number of iterations, criteria for acceptable operation, ...) controls the quality of remeshing as well as computational cost.

While most remeshing libraries share the same basic steps, they use different empirical rules to build the overall algorithm leading to significantly different results.

Remeshing quality

quality

Enforcing mesh validity at each remeshing step ensures that the output of the remeshing algorithm is a valid mesh.

Given the remeshing algorithm (split and collapse operations), the target is not to reach a final mesh where all edges are of unit length in metric space, but only that these lengths lie in the interval

The quality of remeshing is usually considered in terms of the histograms of edge lengths and element qualities.