## 3 PolyCISAMR Algorithm
### Meshing an Individual Grain Using CISAMR  
In the PolyCISAMR algorithm, the CISAMR technique is first employed to discretize individual grains as independent meshing problems, followed by merging the resulting meshes to build the final FE model. However, due to the presence of grains' sharp corners, creating a high-quality conforming mesh for each grain requires adding new algorithmic features to CISAMR. Because the sharp corners of each grain \(\mathcal{C}_{i}\) are already identified during the preprocessing phase (see Section 2.3), we first implement a BBox-based quad-tree search to quickly locate the background elements that contain each sharp corner. In most cases where the grain does not have an acute angle at the sharp corner, a small modification to the CISAMR algorithm is sufficient to generate an appropriate conforming mesh. As illustrated in Figure 16, after performing \(h\)-adaptivity (SAMR), the closest mesh node to the sharp corner is identified and snapped to that. The subsequent phases of the CISAMR algorithm (\(r\)-adaptivity and sub-triangulation) are carried out in the same way as described in Section 3.1 to construct the conforming mesh. For sharp corners corresponding to an acute angle, which can be categorized into three different scenarios, the following additional treatments are required (cf. Figure 17):  
* **Case 1:** As shown for the highlighted background element in Figure 17a, although this element intersects the grain, all of its nodes are located outside the grain boundaries. This would be a special case, as the relative location of a background element with respect to the grain boundaries (inside, outside, on the boundary) is determined based on the relative location of its nodes. Therefore, it is important to ensure that such cases are not misclassified during CISAMR implementation, as any element for which all four nodes are outside the grain is typically categorized as an outside element. Fortunately, because such special cases always occur in the vicinity of the background element containing the sharp corner, it is easy to identify such misclassified elements. In this approach, if all four nodes of the background element containing a sharp corner fall outside the grain, we perform an additional check on the relative location of its neighboring elements to ensure that at least one of them intersects the grain boundaries. If this is not the case (similar to the special case discussed here), the location of midpoints, quarter points, etc., of all edges of these elements relative to the grain boundaries is recursively checked until an intersecting element is identified. * **Case 2:** This scenario, which is also depicted in Figure 17a and often accompanies Case 1, occurs during the \(r\)-adaptivity phase. Here, the background element edge identified with nodes \(\mathcal{N}_{1}\)-\(\mathcal{N}_{2}\) intersects with the grain boundary twice and both intersection points are in the same half of the edge, i.e., \(d<0.5h\) for both intersections points relative to \(\mathcal{N}_{1}\). Therefore, because node \(\mathcal{N}_{2}\) does not relocate and node \(\mathcal{N}_{1}\) can only relocate to one of these intersection points (the closest intersection point), the resulting grain geometry would be unrealistic without any treatment (see Figure 17a). The treatment is rather simple: introducing a new midpoint node (hanging node) on edge \(\mathcal{N}_{1}\)-\(\mathcal{N}_{2}\), which can then be relocated to the other intersection point during \(r\)-adaptivity. As shown in the \"after treatment\" configuration in Figure 17a, this simple modification yields an appropriate conforming mesh while accurately capturing the grain geometry. * **Case 3:** Similar to Case 2, in this scenario a background mesh node must be relocated to two intersection points, this time on two different edges connected to that and not  
Figure 16: Handling a sharp corner with a wide angle in the modified CISAMR algorithm. on the same edge, as shown for \(\mathcal{N}_{1}\) in Figure 17b).