4
$\begingroup$

I have created a 3d region for Laplace's eqn

Needs["NDSolve`FEM`"]
Needs["MeshTools`"]

r=1.12;
R2d1 = 
  RegionUnion[Disk[{1 + r, 0}, r], Disk[{-1 - r, 0}, r], 
   Disk[{0, -1 - r}, r], Disk[{0, 1 + r}, r]];
R2d = RegionDifference[Disk[{0, 0}, 4], R2d1];

M2d = ToElementMesh[R2d, "MeshOrder" -> 1, 
  MaxCellMeasure -> {"Length" -> 0.1}];
S2d = SmoothenMesh@TriangleToQuadMesh[M2d];
mesh3D = ExtrudeMesh[S2d, 5, 15];

and I managed to use this successfully in NDSolve, (and it had worked using the standard NDSolve FEM package), but I need to do more (at which NDSolve failed).

I need to add simple cylindrical regions at both ends (for z<0 and z>5).

I cannot figure out how to translate (shift) 3d meshes created by MeshTools (in order to merge them). The TransformMesh function appears to be limited to 2d meshes, and ExtrudeMesh doesn't seem to have the option to set the initial z-coordinate; or am I missing something?

$\endgroup$
5
  • 1
    $\begingroup$ Do you really use this mesh ElementMesh[{{-4., 4.}, {-4., 4.}, {0., 5.}}, {HexahedronElement[ "<" 810045 ">"]}]? $\endgroup$ May 31 '20 at 23:28
  • $\begingroup$ TransformMesh function should work just fine with 3D meshes, try TransformMesh[mesh3D, TranslationTransform[{0, 0, 5}]]. It is true that ExtrudeMesh doesn't have the option to set the Z coordinate, because one can use TransformMesh for all subsequent transformations. $\endgroup$
    – Pinti
    Jun 1 '20 at 10:55
  • 3
    $\begingroup$ See also this answer for ideas on how to combine different extruded meshes. As as sidenote I suggest that you start experimenting with less dense meshes, make your approach work and then refine the mesh for producing the final result (if required). $\endgroup$
    – Pinti
    Jun 1 '20 at 11:06
  • $\begingroup$ thank you, Pinti, this works well! $\endgroup$
    – markoh
    Jun 2 '20 at 2:36
  • 2
    $\begingroup$ @markoh, you could selfanswer your question. May be useful for future visitors. $\endgroup$
    – user21
    Jun 2 '20 at 4:47
1
$\begingroup$

You can make use of the FEMAddOns to do this now:

ResourceFunction["FEMAddOnsInstall"][]
Needs["FEMAddOns`"]
r = 1.12;
R2d1 = RegionUnion[Disk[{1 + r, 0}, r], Disk[{-1 - r, 0}, r], 
   Disk[{0, -1 - r}, r], Disk[{0, 1 + r}, r]];
R2d = RegionDifference[Disk[{0, 0}, 4], R2d1];

M2d = ToElementMesh[R2d, "MeshOrder" -> 1(*,
   MaxCellMeasure\[Rule]{"Length"\[Rule]0.1}*)];
S2d = ElementMeshSmoothing[ToQuadMesh[M2d]];
mesh3D = ExtrudeMesh[S2d, 5, 15];
mesh3D["Wireframe"]

enter image description here

$\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.