3
$\begingroup$

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. enter image description here

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

$\endgroup$
1
  • 2
    $\begingroup$ See this question. $\endgroup$
    – user21
    Aug 3 '21 at 15:23
8
$\begingroup$

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"];
(*Load MeshTools package*)
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]]]

Combined extruded mesh

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.