# 3D meshing of cyllindrical domain into hexahedral elements

I need a solution for generating a hexahedral mesh for a cyllindrical domain in Mathematica/AceFEM. Ideally, it should be close to cyllindrical symmetry not very far from the center. The best option would be to program this directly in Mathematica, but calling some external software installed on Windows and accessible via cmd by Mathematica's Run command would also do a job.

Do you have any ideas how to cope with such a problem?

• See this question. Aug 3 '21 at 15:23

In addition to @user21's comment/linked answer, you may want to combine the DiskMesh with an AnnulusMesh. You could do so with the following code:

(*Install MeshTools*)
ResourceFunction["GitHubInstall"]["c3m-labs", "MeshTools"];
Needs["MeshTools"]
combineMeshes[mesh1_, mesh2_] :=
Module[{crd1, crd2, newcrd, numinc1, inc1, inc2, mrk1, mrk2, melms},
crd1 = mesh1["Coordinates"];
crd2 = mesh2["Coordinates"];
numinc1 = First@Dimensions@crd1;
newcrd = crd1~Join~ crd2;
inc1 =  ElementIncidents[mesh1["MeshElements"]][[1]];
inc2 =  ElementIncidents[mesh2["MeshElements"]][[1]];
mrk1 = ElementMarkers[mesh1["MeshElements"]][[1]];
mrk2 = ElementMarkers[mesh2["MeshElements"]][[1]];
melms = {QuadElement[inc1~Join~(numinc1 + inc2), mrk1~Join~mrk2]};
ToElementMesh["Coordinates" -> newcrd, "MeshElements" -> melms]
]
meshd = DiskMesh[6];
mesha = AnnulusMesh[{0, 0}, {1, 4}, {0, 2 Pi}, {24, 5}];
meshc = combineMeshes[meshd, mesha];
mesh = ExtrudeMesh[meshc, 1, 5];
mesh["Wireframe"["MeshElementStyle" -> FaceForm[Green]]]
`

You should be able to combine additional annular layers to obtain your desired discretization.