I have this square region and I want to generate a mesh it using quadrilateral elements for it and get the coordinates and incidents
Asked
Active
Viewed 470 times
3
-
8Have you tried anything? Mesh+F1 can get you quite far. Notice that your question could be migrated to any related site and no one would know it had anything to do with Mathematica. – Kuba Apr 30 '18 at 19:38
3 Answers
8
Here is something to get you started:
r1 = Rectangle[{0, 0}, {30, 30}];
r2 = Rectangle[{10, 10}, {20, 20}];
reg = DiscretizeRegion@RegionDifference[r1, r2]
MeshCoordinates @ reg

MarcoB
- 67,153
- 18
- 91
- 189
6
How about:
Needs["NDSolve`FEM`"]
mesh = ToElementMesh[
RegionDifference[Rectangle[{-15, -15}, {15, 15}],
Rectangle[{-5, -5}, {5, 5}]], "MeshOrder" -> 1]
mesh["Wireframe"]
mesh["Coordinates"]
{{5., -5.}, {5., -3.33333},...}
ElementIncidents[mesh["MeshElements"]]
{{{265, 303, 87}, {25, 57, 176}, ....
Update:
If you want quad elements you can get those with the FEMAddOns Paclet.
Install the current paclet with:
ResourceFunction["FEMAddOnsInstall"][]
The load the paclet:
Needs["FEMAddOns`"]
Convert the triangle mesh to a quad mesh:
quadMesh = ToQuadMesh[mesh]
quadMesh["Wireframe"]
user21
- 39,710
- 8
- 110
- 167
-
thank you that is great but I want to use quadrilateral element instead or triangular one – Amr Saleh May 01 '18 at 15:45
-
3
DiscretizeRegion[LaminaData["FilledSquareWithSquareHole", "Region"][30, 10]]
Use the option MeshCellStyle -> {2 -> None, 1->Black} in DiscretizeRegion to get
LaminaData["FilledSquareWithSquareHole", "Diagram"]
kglr
- 394,356
- 18
- 477
- 896
-
may I ask a question, how can we install FEMAddOns in windows? I give a try, however, i have no idea how to install FEMAddOns.paclet, I never find such FEMAddOns.paclet folder... – ABCDEMMM Mar 16 '19 at 21:39
-
@ABCDEMMM, you can find installation instructions in the link given in user21's answer: GitHub FEMAAddOns package – kglr Mar 16 '19 at 21:43
-
-





