I am using AceFEM command SMTTriangularToQuad
to convert 2D triangular mesh (created by Mathematica) to unstructured quadrilateral mesh. This mesh has internal "domains" (e.g. regions inside the mesh that have different material properties) and conversion failed. Is there a way to solve the problem illustrated in the example bellow?
First I define some filled (primitive) geometric regions and plot their edges.
r1 = Rectangle[{0, 0}, {4, 4}];
r2 = Rectangle[{0.25, 0.25}, {3.75, 3.75}];
d1 = Disk[{2, 2}, 1.25];
d2 = Disk[{2, 2}, 0.5];
Graphics[{
{FaceForm[], EdgeForm[Black], r1},
{FaceForm[], EdgeForm[Blue], r2},
{FaceForm[], EdgeForm[Red], d1},
{FaceForm[], EdgeForm[Orange], d2}
}, ImageSize -> 150]
Then I create a derived geometric region with RegionUnion
and mesh it with ToElementMesh
. Innermost disk is not meshed, it is defined to be a hole. Rectangular and circular internal border is still visible as a path over element edges.
<< NDSolve`FEM`;
(* For conversion to quadrilaterals it is essential that "MeshOrder"->1. *)
mesh = ToElementMesh[
RegionUnion[
RegionDifference[r1, r2],
RegionDifference[d1, d2]
],
"RegionHoles" -> {{2, 2}}, "MeshOrder" -> 1];
Show[mesh["Wireframe"], ImageSize -> 250]
Conversion to quadrilaterals does not respect internal borders between regions. This is visible as a lack of circle shaped path over element edges inside the domain.
<< AceFEM`;
(* SMTTriangularToQuad doesn't load with the package. You have to \
search for it in documentation and evaluate the cell with its \
definition manually. *)
quadMesh = SMTTriangularToQuad[mesh];
Show[quadMesh["Wireframe"], ImageSize -> 250]