A Coarsening Algorithm on Adaptive Red-Green-Blue Refined Meshes

Adaptive meshing is a fundamental component of adaptive finite element methods. This includes refining and coarsening meshes locally. In this work, we are concerned with the red-green-blue refinement strategy and its counterpart - coarsening. In general, coarsening algorithms are mostly based on an explicitly given refinement history. In this work, we present a coarsening algorithm on adaptive red-green-blue meshes without explicitly knowing the refinement history. To this end, we examine the local structure of these meshes, find an easy-to-verify criterion to coarsen red-green-blue meshes and prove that this criterion generates meshes with the desired properties. However, it does not guarantee that the set of nodes admissible for coarsening is non-empty. Therefore, we also present an additional algorithm that uses the main ideas of this criterion to always allow for local coarsening. We present a MATLAB implementation built on the red-green-blue refinement routine of the ameshref-package.


Introduction
Adaptive meshing is a popular tool to efficiently solve partial differential equations where solutions exhibit local singularities [15]. In time-dependent problems, singularities, interfaces and forces may move or change in time. This requires coarsening meshes locally. Otherwise the algorithm's efficiency would decrease with time since degrees of freedom needed for an earlier time step are not released as the singularity or interface progresses. To this end, it is common to deploy coarsening algorithms to maintain the adaptive efficiency [2,18]. Furthermore, coarsening routines are used in multigrid techniques where a sequence of coarse and fine meshes is needed [14,16].
Local geometric refinement is a major part of adaptive meshing. The goal is to reduce the element size by adding further nodes to a given mesh. Several refinement strategies are known which have desired properties and are therefore well suited for adaptive meshing. An overview and a list of public code is provided by Schneiders in [19]. Local coarsening is the counterpart of local refinement and is thus also an important part of adaptive meshing. There are different approaches to coarsening. Local coarsening refers to deleting nodes from a given mesh to increase the element size. Possible approaches are based on edge collapsing [1,16], centroidal Voronoi tessellations [21] or the refinement history [2,4,13,18]. The latter approach aims to invert the refinement based on the refinement history. Desired properties such as the inscribed ball condition [5] are automatically fulfilled during coarsening. The first two approaches, in contrast, do not use the refinement history. Desired properties are thus not automatically preserved within the coarsening process.
Early works on coarsening based on the refinement history refer to the hierarchical structure of the refinement and use this information to coarsen elements to their corresponding father element [13,18]. Chen and Zhang proposed a new concept to identify admissible-to-coarsen nodes without explicitly knowing the hierarchical structure for the newest vertex bisection (NVB) [4]. Bartels and Schreier extended this result to three dimensions [2]. To the best of our knowledge, this has not been done for other refinement strategies in two dimensions. To this end, we bridge the gap and present a new criterion to adaptively coarsen meshes generated by the red-green-blue refinement strategy introduced in [3] and implemented in the ameshref-package [9,10]. The only information we use to describe a mesh is the element-connectivity and the coordinates of the vertices. No information about neighbours or fatherchild connections is stored. A key observation within this paper is that this minimal data structure can also be kept for coarsening, i.e., no additional information is needed to coarsen the meshes. However, as hierarchical data is non-present, the determination of nodes that can be eliminated -while preserving desired properties -is more difficult. We present an algorithm that determines those "admissible" nodes.
This paper is organized as follows. First of all, we introduce some notations and definitions and shortly present the red-green-blue refinement and its implementation in the ameshref-package in Section 2. In Section 3, we focus on coarsening requirements and present a coarsening algorithm that fulfils these requirements. Unfortunately, it is not suitable in practice. To this end, in Section 4 an adapted coarsening algorithm based on the ideas of Section 3 is presented. In Section 5, we focus on the efficient implementation in MATLAB by use of vectorization and conclude with numerical experiments presented in Section 6.

Preliminaries
Let Ω be a polygonal domain in R 2 . An element T ⊂ R 2 is a triangle including edges. We call T a triangulation of Ω if • T is a finite set of elements T with positive area |T | > 0 , • the union of all elements in T covers the closure Ω, whereT denotes the interior of T . We denote the set of all vertices of a triangulation T with N , and the set of all edges with E. With this, N (T ) := {v ∈ N | v ∈ T } is the set of nodes of an element T ∈ T . Analogously, E(T ) := {e ∈ E | e ⊂ ∂T } is the set of edges of an element T ∈ T . We call T a regular triangulation of Ω if additionally • for all T i , T j with T i = T j for i = j holds that T i ∩ T j is the empty set, a common node or a common edge. The aforementioned definition prevents a triangulation from having hanging nodes. A node v ∈ N is called hanging node if for some element K ∈ T it satisfies v ∈ ∂K \N (K). We define an extended regular triangulation (T , ref T ) where T is a regular triangulation and ref T is a mapping ref T : T → E(T ) that assigns a reference edge to each triangle T ∈ T such that for T ∈ T holds: ref T (T ) ∈ E(T ). For a triangle T ∈ T with reference edge ref T , a refinement (r(T ), ref r(T ) ) is a finite set of triangles such that • for allT ,T ∈ r(T ) withT =T holds thatT ∪T is the empty set, a common node or a common edge, and • for allT ∈ r(T ) a new reference edge ref r(T ) : r(T ) → E(r(T )) is assigned such that forT ∈ r(T ) holds ref r(T ) (T ) ∈ E(T ).
We call (T , refT ) a refinement of a triangulation T if , and • the resulting triangulation (T , refT ) is an extended regular triangulation. The last point in particular ensures that the resulting triangulation does not have any hanging nodes. Eliminating hanging nodes by refining further elements is called CLOSURE. For further details we refer to Section 2.1 and [10].
In this work, we are concerned with the red-green-blue refinement.
Definition (red-green-blue refinement (RGB), cf. [3]). We call a refinement (r(T ), ref r(T ) ) of a triangle T with reference edge ref(T ) a red-green-blue refinement if it follows the patterns and assignment of reference edges shown in Figure 1.
Reference edges are chosen such that during the refinement process all formed triangles starting from an initial triangle T 0 fall into at most four similarity classes [17,20]. This ensures that degeneracies are avoided and Ciarlet's inscribed ball condition [5] is satisified for a family of triangulations T h formed by the refinements. This property is often referred to as shape regularity of a triangulation. The assignment of reference edges is clearly prescribed through the refinement process. There still remains the question of how to select the reference edges in the initial triangulation T 0 . Obviously, the choice has some impact on the locality of the adaptive mesh. An intuitive choice is, e.g., the longest edge. Further possibilities are discussed in [3,22]. However, in two dimensions a proper choice of reference edges in T 0 is not essential [12]. In depictions we refrain from labeling the reference edges whenever it is irrelevant for the context.
In this work, we occasionally interpret a triangulation T as a graph G. To this end, we give some formal definitions and terminologies. For a more detailed overview, we refer to [6]. A graph is a pair G = (V, E) of sets with the set of vertices V and the set of edges E.
is the graph whose vertex set is V and whose egde set consists of all of the edges E that have both endpoints in V . A vertex-weighted graph G = (V, E, ω v ) is a graph with vertex set V and edge set E and a weight ω v is assigned to each vertex v ∈ V . A path is a non-empty graph P = (V, E) with the vertex set V = {v 0 , v 1 , . . . , v k } and the edge set A non-empty graph G is called connected if any two vertices are linked by a path in G. A maximal connected subgraph of G is called a component of G. The definition of a triangulation ensures that the graphs we are dealing with in this work are all planar graphs. In planar graphs G, the edges divide the plane into different regions f , called faces and denoted by F (G). The degree k of a face is the number of edges incident with it, in short this face is called a k-face.
2.1. MATLAB Implementation of RGB Refinement. In this section, we give some insights into the implementation of the RGB refinement in the ameshref-package [9,10,11]. We focus on the parts that are essential for our coarsening routine. For a more thorough explanation, we refer to [10,11]. We represent a triangulation T = {T 1 , . . . , T M } with nodes N = {v 1 , . . . , v N } as follows: The x-and ycoordinates of the nodes N are stored within an N × 2 array coordinates. Furthermore, we represent the element-connectivity within an M × 3 array elements where one row stores the indices of the element's three vertices v i , v j , v k ∈ N with i, j, k ∈ {1, . . . , N }. Optionally, boundary edges can be stored in an additional array with indices of the edge's two vertices. As depicted in Figure 1, reference edges play a crucial role. Instead of storing this information in an additional data structure, we capture the reference edge implicitly as the edge between the first two vertices of an element indexed by the first two entries in the array elements. Elements are numbered counterclockwise.
In adaptive procedures, a set of marked elements M is given. We flag elements T ∈ M by marking each edge of the element for bisection. Obviously, neighbouring elements T ∈ M are affected indirectly by this marking. A CLOSURE step is performed to avoid creating hanging nodes. As mentioned, the assignment of reference edges ensures the shape regularity of the triangulation. To this end, the reference edge needs to be bisected before any other edge of this element is refined. For this reason, we mark edges according to the hash map shown in Table 1 and loop through this CLOSURE step until no further markers are added. Then, we refine the elements according to Figure 1 and save the new elements at the corresponding position in the array as depicted exemplarily in Figure 2. This is essential for coarsening of more than just one layer as the recursive information is implicitly given in the array elements. Without this, any hierarchical information is lost and thus, coarsening of more than one layer is impossible. As direct consequence of this way of storing the refined elements, adjacent blue and green patterns can no longer be distinguished from each other, cf. Figure 3.
Remark 1. In this work, the implementation of the proposed coarsening algorithm is built on the RGB refinement implementation in the ameshref-package. This is why we focus on this concrete data structure. However, the proposed coarsening algorithm can also be based on other RGB refinement implementations without explicit refinement history. For this to work, the following must be ensured: First, reference edges must be incorporated in the data structure. Second, elements have to be numbered in a way that a blue refinement leads to the same numbering as an application of two green refinements.  1 2 3 4 5 6 7 8 9 10 11 12 13 14 Child elements of T 3 Child elements of T 8 Figure 2. Numbering of elements before (left) and after refinement (right). Third, the data structure needs to be designed such that the middle element of red refinement patterns, cf. Figure 6, and newest vertices, cf. Figure 7, can easily be determined. And last, child elements are to be stored consecutively at the former position of the father element, cf. Figure 2.

Coarsening Requirements
The goal of geometric refinement is to reduce the element size by adding further nodes to a given triangulation. In other words, one wants to increase the number of degrees of freedom. Coarsening, conversely, decreases the number of degrees of freedom in a triangulation, i. e. , eliminates nodes of a triangulation. However, there are still some questions remaining. LetT be a refinement of a triangulation T satisfying shape regularity. How to eliminate nodes • to receive a triangular mesh (i.e., quadrilateral elements are not part of the triangulation)?
• to receive a shape regular mesh (i.e., the inscribed ball condition is satisfied)?
• to receive a regular triangulation (i.e., a triangulation without hanging nodes)?
• to undo/invert a refinement without knowing the refinement history explicitly? In literature, there are different approaches on coarsening -dealing with these details in different manners. The most common approach is to use edge collapsing known from Delaunay algorithms. This does not require to know the refinement history at all and the mesh quality is assured in the process of edge collapsing. We refer to [1,16]. Coarsening can also be done by clustering into regions via the centroidal Voronoi tesselation, cf. [21]. The new mesh is then constructed via its dual -a Delaunay triangulation. As a further coarsening algorithm, we would like to mention the concept of using the refinement history. More precisely, the history is used to invert the refinement procedure. Most works Only v 2 can be removed.
Although all nodes in both pictures could be removed the NVB-criteria cannot cover these cases, because this criterion demands #R v to be 2 or 4. based on this approach use a hierarchical structure, i.e., store the refinement history explicitly, see e. g. [13,18]. To the best of our knowledge, in 2D, there is only one work on non-hierarchical coarsening for the refinement procedure newest vertex bisection by Chen and Zhang [4]. They found an easy-to-verify criterion to determine whether nodes are allowed to be eliminated or not. This works well because NVB is implemented by a sequence of bisections and those can easily be undone. In other words, NVB consists of successive green refinements. The same is not true for the above mentioned red-green-blue refinement. We still see that the green pattern emerges from a bisection and the blue pattern arises from two subsequent bisections, cf. Figure 1. However, the red pattern does not originate from a bisection of elements and thus the criterion proposed by Chen and Zhang fails to work for the RGB refinement. In this work, we discuss this issue and propose an easy-to-verify criterion to determine nodes for elimination in an RGB refined triangulation.
To this end, let us first investigate Chen and Zhang's approach to determine admissible nodes for the newest vertex bisection (in their paper called "good-for-coarsening node"), cf. [4]. Defining the ring R v := {T ∈ T | v ∈ T }, the valence #R v counts the elements that are contiguous to a node v ∈ N . Let N new := {v ∈ N (T ) | v is newest vertex of some T ∈ T } be the set of newest nodes in a triangulation T . Chen and Zhang claim that the set of admissible nodes is characterized by the set N adm := {v ∈ N new : #R v = 4 or #R v = 2}. In Figure 4, this idea is illustrated. The set N adm is shown to be non-empty. This is an important requirement if one wants to assure that this criterion is useful in practical implementations. In short, a set of admissible nodes N adm is determined with this criterion. Adaptive coarsening can then be pursued by elimination of the set of nodes N adm ∩ N mark where N mark is the set of nodes that are marked through a given marking strategy.
Let us now apply this easy-to-verify criterion for the red-green-blue refinement. One can easily see that green and blue refinements carry over, i.e., green refinements are removed for a valence of two or four and blue refinements are removed in a two-step-process -deleting one green refinement and then the subsequent one. This is favorable because, as already mentioned, adjacent green and blue patterns cannot be distinguished in our data structure. However, as blue patterns are not considered separately, but only as a sequence of green patterns, this does not pose any implementation problems. Applying this criterion to red patterns, it fails to detect the nodes that can be deleted, cf. Figure 5.
For this reason, a new criterion needs to be developed to cover red and green patterns at once. Let us remark that checking only one node for a red pattern is inadequate. During a red refinement, three new nodes are created at once. To this end, it does not suffice to look at only one node. Moreover, checking all three nodes of a red pattern is not enough either, because the neighbouring pattern may be a red pattern and thus additional two nodes need to be taken into account. In the process of eliminating nodes, a whole chain of red patterns has to be followed to determine which nodes can actually be eliminated without creating a hanging node. Algorithm 1 determines the set of admissible nodes for the RGB strategy. The procedure is illustrated in Figure 8.

2:
M ← {T ∈ T | T is a red middle element} see Figure 6 3: Figure 7 5: are the centroids of all 3-faces in G * , E are the edges between two vertices v 1 , v 2 ∈ V if the corresponding two 3-faces f 1 , f 2 ∈ F (G * ) share a common vertex, and if for any v ∈ V holds ω v = 0 in a component C of G then see component 10: C is a bad component, 11: else 12: C is a good component.

13:
end if 14:   in Figure 10. Algorithm 1 outputs N adm = ∅ since the vertex v with weight ω v = 5 blocks all vertices in the graph from deletion. These vertices are connected through red middle elements along the loop.   Figure 8. Determination of N adm for an RGB refined mesh. The mesh is interpreted as a vertex-weighted graph G with weights ω v = # T ∈ T | v ∈ N (T ), T ∈ M C . We then proceed to generate new graphs G * and G and check a criterion to separate into good and bad components. Successively, this information is handed over to the original graph G which yields N adm . Nodes in N new \ N (M) are checked separately.
Remark 3. Algorithm 1 is designed to determine nodes of green and red patterns that can be removed. For this reason, a deletion function must only coarsen green and red patterns. This justifies Algorithm 2 as a deletion function. for all T ∈ T * do 4: Create new elements and reference edges (T , refT ) according to Figure 11.

5:
end for 6: return (T , refT ) 7: end procedure Let us elaborate whether a hanging node can be created through Algorithm 1 and Algorithm 2. A hanging node can be created by deleting either a red or a green pattern. Let us first assume that we delete a red pattern, i.e., Assumption 1 in Figure 12. A hanging node can only arise if there are neighbouring elements involved. Let us therefore consider different neighbouring patterns to a red pattern.
First, let the neighbouring pattern be a green pattern. In this case, if Algorithm 2 removes the red pattern, Algorithm 2 automatically removes the green pattern as well, because this node is in the set N adm determined in Algorithm 1.
Second, let the neighbouring pattern be a red pattern. Then a hanging node cannot appear because if all nodes of one red pattern are in N adm then all nodes of a neighbouring pattern are also in N adm and thus Algorithm 2 removes it. The graph G is divided into bad and good components and thus either all nodes of neighbouring red patterns are in N adm or none, i.e., Algorithm 2 removes either all patterns or none.
Third, let the neighbouring pattern be a blue pattern. The given vertex-weight ω = 5 blocks the whole component of G and thus this red pattern is not removed with Algorithm 2, i.e., no hanging nodes are created. Further situations arise as shown in iv), v) and vi) where the vertex-weight ω is not equal to two and four. Therefore, in G this pattern is part of a bad component and thus the corresponding vertices are not in N adm . Therefore, Algorithm 2 does not remove a red pattern and thus no hanging node is created. Further refined patterns not depicted in Figure 12 are conceivable where the vertex-weight ω is unequal to two or four. With the same argument, no hanging nodes are generated in these cases.
Let us now assume that a hanging node is created after deleting a green pattern, i.e., Assumption 2 in Figure 12. Then, there are the same neighbouring possibilities. First, let the neighbouring pattern be a green pattern. Then, this node is in N adm due to Lines 17-21 of Algorithm 1 and thus Algorithm 2 deletes both green patterns.
Second, let the neighbouring pattern be a red pattern. An analogous good/bad component argument for G yields that either all patterns are removed or none. Thus, no hanging node is created.
Third, let the neighbouring pattern be a blue pattern. Again, the given vertex-weight ω = 5 ensures that this node is not in N adm and thus this green pattern is not removed with Algorithm 2, i.e., no hanging node is generated.
In all other cases, the vertex-weight ω is not equal to two or four and thus the whole component in G is blocked and a green pattern is not removed. This shows:  Due to Remark 2, this method is not suitable for practical purposes as we may end up in a case where the mesh is not coarsened at all. In addition, we have not even considered adaptivity here. In contrast to Chen and Zhang's method we cannot use the set of nodes N adm ∩ N mark for adaptive deletion. In our case, we need to include N mark within the determination of admissible nodes N adm since we considered a whole chain of red patterns to avoid the creation of hanging nodes. If a node in this chain is not marked for deletion, it causes the same blockage as a node with valence unequal to two or four. This makes it all the more impractical. To this end, we need to find a more practical version of this algorithm.

The RGB Coarsening Algorithm
In this section, we present an adapted RGB coarsening algorithm. To this end, we use the ideas presented in Section 3. There are basically two steps that are important in the RGB coarsening algorithm. The first one is to find the newest nodes in a triangulation T . The second one is to determine which pattern is present at a new node. The main goal is to perform these steps efficiently with a non-hierarchical data structure. As soon as the pattern is determined, deleting the pattern is an easy task. We have seen in Algorithm 1 and Theorem 1 that it is necessary to look at the chain of red patterns to ensure that no hanging nodes are created within the deletion process. However, we have seen that this is impractical, cf. Remark 2. To this end, we allow for the creation of hanging nodes in the coarsening step. Subsequently, we perform an additional CLOSURE step to eliminate hanging nodes and obtain a regular triangulation. This makes it more practical and ensures that coarsening is done locally. Algorithm 3 describes our practical version of a coarsening algorithm with an additional CLOSURE step. Figure 14 illustrates this procedure.   Interpret T as graph G = (V, E).

2:
M ← {T ∈ T | T is a red middle element} see Figure 6 3: Figure 7 5:  Create new elements and reference edges (T , refT ) according to Figure 13. 15: return (T , refT ) 16: end procedure Figure 13. Create new elements and reference edges (T , refT ) according to the depiction for nodes in N adm (in red) and N hang (in white).

Matlab Implementation of the Coarsening Algorithm
In the previous section, we have presented our RGB coarsening algorithm. In this section, we focus on the concrete implementation in MATLAB based on the refinement routine TrefineRGB.m, see [9]. We have already discussed the data structure used in the refinement procedure in Section 2.1. This will also play a major role in the implementation of the coarsening routine. Let us recap quickly the main structures: Elements T ∈ T are defined by their vertices v i , i = 1, 2, 3 and numbered counterclockwise.  Figure 14. Coarsening of an RGB triangulation with N mark = N . The mesh is interpreted as a graph G with weights ω v = # T ∈ T | v ∈ N (T ), T ∈ M C . We then proceed to classify nodes into hanging nodes N hang = N block ∩N new and admissible nodes N adm . With this information, the mesh is coarsened according to Figure 13.
• Lines 5-7: A triangulation is represented by the array elements and coordinates. The auxiliary functions provideGeometricData and createEdge2Elements adv provide more geometric information on the mesh. The array element2edges specifies the edges of each element, cf. [10], and the array edge2elements specifies the elements containing this edge and the position of this edge within an element for all edges. E. g. , for  (abs(. . .))=0)+3, cf. Figure 15. Note, that this characterizes a red pattern uniquely and thus this criterion to find red middle elements is appropriate. • Lines 11-13: In this part, the newest node of each element is detected. The newest node of an element is stored on position three in elements. We only consider nodes for coarsening that are not part of the initial triangulation T 0 (Line 12). Note that we make a systematic error for red patterns, as an additional node is detected as newest node even though it is not a new one, cf. Figure 16. We have to consider this systematic error in the course of our implementation. If an element is marked for coarsening, we mark all nodes of this element for coarsening (Line 13). systematic error Figure 16. Systematic error made by taking elements(:,3) as newest nodes.
• Lines 15-21: Let red node be the set of newest nodes of a red pattern. The term valence computed in Line 17 is the weight ω v in the graph G = (V, E, ω v ) defined in Algorithm 3. Nodes of green patterns are then all new nodes that are not red. Note that the array green node includes the systematic errors. • Lines 22-29: The admissible set N adm = {v ∈ N | ω v ∈ {2, 4} and v ∈ N new and v ∈ N mark } and N block = N \ N adm are computed. As the reference edge plays a crucial role, we need to do a CLOSURE step to ensure that the shape regularity still holds when coarsening. We again consider the patterns shown in Figure 1. We make sure that at least the reference edge of the father element is marked. Differently said, at least the third vertex of the red middle element needs to be blocked if any other vertex in this element is blocked (Lines 27-28). We loop through this process until no further changes are made. • Lines 30-37: Hanging nodes are then given by N hang = N block ∩ N new (Line 30). With this, we determine the coarsening pattern regarding to these hanging nodes. For green patterns, this is either coarsen or not coarsen. For red patterns, we have more cases to consider, see Figure 13.
To this end, we form the weighted sum of hanging nodes. A red pattern can then be coarsened to the patterns: none (000), green (001), blue r (101), blue (011) and red (111). In the weighted sum computed in Line 33 these patterns correspond to the values 0, 4, 5, 6 and 7. The value 7 is not considered separately as in this case the elements are kept as they are and are not coarsened. We omit the presentation of the rest of the code (further 70 Lines), as it is a straightforward implementation of element updates. We distinguish between former red patterns, former green patterns neighbouring a red pattern and former green patterns not neighbouring red patterns. Note, that for the latter the corresponding array includes the systematic error made earlier. To this end, we only consider subsequent elements for coarsening, the case shown in Figure 17 is out of question. The weight is ω v = 2 but the elements containing v are not numbered consecutively and thus are not considered. In a next step, the old triangulation is deleted. If provided, boundary data is updated. Again, nodes are eliminated only if they are not blocked and they do not stem from the systematic error shown in Figure 16. Lastly, surplus nodes are deleted and the new coordinates and elements are updated. The interested reader may download the full code from [8].

5.2.
Examples and Demo Files. The coarsening routine for RGB meshes is part of the toolbox ameshcoars -Efficient Implementation of Adaptive Mesh Coarsening in 2D [8]. Numerical examples and demo files based on the interplay of refinement and coarsening are provided in subdirectories of the ameshcoars-toolbox: • example1/: refinement along a moving circle, • example2/: adaptive finite element implementation following [7] for a quasi-stationary partial differential equation, • example3/: triangulation of a GIF, • example4/: local coarsening of a uniformly refined triangulation.

Numerical Experiments
In this section, we test our coarsening routine with MATLAB 2018a. We present some results based on example1/ and example4/ of the ameshcoars-toolbox [8]. In particular, we look at the interplay of refinement and coarsening and how well moving singularities can be captured by this procedure. Further, we take a look at the efficiency of our coarsening algorithm. We know that our coarsening implementation is not inverse to the refinement but that it can fully recover the initial triangulation. To this end, we want to examine what element-and coordinate-ratios we get between each refinement/coarsening step to get a feeling of how efficient our coarsening routine is. Lastly, we show that coarsening can be done locally.
6.1. Interplay of Refinement and Coarsening. Let us start with a basic example. Adaptive coarsening is widely used to release degrees of freedom that are not needed anymore as, e .g. , a singularity advances. We imitate the behavior by a moving circle, which is supposed to represent the singularity. Starting off with an initial triangulation (T 0 , ref T 0 ), we refine along the circle at time t 0 . To capture the singularity in t 1 > t 0 , we could start off again from (T 0 , ref T 0 ) and only use the refinement procedure. However, as the circle progresses steadily, only a few nodes need to be released and only a few nodes need to be added. To this end, we use our coarsening routine to set the corresponding coordinates free and the refinement routine to add further coordinates to capture the shape of the circle. The comparison of number of degrees of freedom between refinement only and refinement combined with coarsening is illustrated in Figure 18. We first explain the procedure in this example. We define a circle with center and radius. If this circle intersects an element we mark this element for refinement. This is done by the function markcircle and together with the refinement routine this ensures that we capture the shape of the circle. We do this until a maximal number N max of coordinates is reached, or the element size becomes too small. We then mark all elements for coarsening, coarsen and repeat this until we fall below a given minimal number N min of nodes. Subsequently, in the next time step t 1 , we again refine along the circle (now moved to another position!), but do not start from the initial mesh but from the coarsened mesh from time step t 0 . This is done consecutively, and we get a sequence of triangulations capturing the moving circle, see left column of Figure 19 and cf. example1/ in [8].
Note, that the triangulations we get are highly sensitive to the choice of the parameter N min . We observe a pollution effect if N min is chosen too big, see right column of Figure 19. However, in general, a pollution effect does not falsify the computation. It only means that the shape of the circle is not captured in the best possible way and nodes exist where they are not necessarily needed. In principal, it is not just the parameter N min that is responsible for a pollution effect. It also depends on how fast the front for refinement advances, how many time steps are considered, how N max is chosen, etc. . However, in most applications the pollution effect is controlled as error estimators are often used to regulate the error and thus also adapt the mesh, cf. example2/ and example3/ in [11].
6.2. Efficiency of the Coarsening Routine. We want to determine how efficient our coarsening routine is in the sense of element-and coordinate-ratios in between two coarsening steps in comparison to two refinement steps. Let therefore T i be the triangulation after i refinement steps and N i denotes the set of nodes of the triangulation T i . We determine the element-ratio and the coordinate-ratio in each refinement step. Let N be the number refinement steps. We expect 1 ≤ ρ i elem ≤ 4 for all i = 1, . . . , N due to the refinement patterns. We compute the actual ratios for an adaptive refinement along a circle. They are presented in Table 2. We see that the geometric means are ρ elem = 2.40 and ρ coord = 2.15.
Analogously, we determine the ratios for coarsening steps. To this end, letT j be the triangulation received after j coarsening steps, j ∈ {1, . . . , M }, andN j is the corresponding set of nodes. Note, that T N =T 0 , i. e. , we start our coarsening routine from the finest mesh and mark all elements for coarsening. As our coarsening routine is not inverse we need more coarsening steps than refinement steps to recover the initial triangulation. In other words, M ≥ N . A blue refinement is coarsened in a two-step procedure. Thus, we expect a refinement-coarsening step ratio of about 1 : 2 and consequently M ≈ 2 · N . For a better quantification, we compute the element-ratiô in each coarsening step j. The results are shown in Table 3. The geometric means are given bŷ ρ elem = 1.55 andρ coord = 1.47. In this example we get M = 2 · N and in other experiments we also observed M ≈ 2 · N . In terms of efficiency, this means that our coarsening strategy is not as efficient as its refinement counterpart. We need to expect twice as many coarsening steps to undo the refinement as is needed for refining. To get a better feeling about time efficiency, we measured the time for the refinement and coarsening part for this example. The computational time for the refinement part is 0.0665 seconds while the coarsening part takes 0.2171 seconds. Since twice as many coarsening steps are required than refinement steps, we conclude that one coarsening step is slightly more time-consuming than one refinement step. However, coarsening from 10 4 degrees of freedom to 6 can be done in about a fifth of a second, which is still very efficient.  This time, we want to show that our algorithm can be used in an adaptive setting, cf. example2/ or example3/ or more generally, for local coarsening. To this end, we define a discrete point set and mark elements for coarsening that include this point, see Section 5.1. We start with a fine triangulation and proceed with this marking strategy and our coarsening algorithm. Figure 20 shows possible local coarsened meshes. In summary, our proposed coarsening algorithm can be used in an interplay of refinement and coarsening, can coarsen locally and recover the initial triangulation -although not quite as efficiently. However, the latter point does usually not play a major role, as only a few coarsening steps are integrated in an adaptive routine.