This question already has an answer here:

I have this square region and I want to generate a mesh it using quadrilateral elements for it and get the coordinates and incidents



marked as duplicate by Jason B., Henrik Schumacher, MarcoB, b3m2a1, Coolwater May 2 '18 at 8:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 8
    $\begingroup$ Have 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. $\endgroup$ – Kuba Apr 30 '18 at 19:38

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



How about:

mesh = ToElementMesh[
  RegionDifference[Rectangle[{-15, -15}, {15, 15}], 
   Rectangle[{-5, -5}, {5, 5}]], "MeshOrder" -> 1]

enter image description here

{{5., -5.}, {5., -3.33333},...}

{{{265, 303, 87}, {25, 57, 176}, ....


If you want quad elements you can get those with the FEMAddOns Paclet.

Install the paclet with (check that this is the current version):


The load the paclet:


Convert the triangle mesh to a quad mesh:

quadMesh = ToQuadMesh[mesh]

enter image description here

  • $\begingroup$ thank you that is great but I want to use quadrilateral element instead or triangular one $\endgroup$ – Amr Saleh May 1 '18 at 15:45
  • $\begingroup$ @AmrSaleh, see update for quad element mesh. $\endgroup$ – user21 Oct 5 '18 at 11:01
DiscretizeRegion[LaminaData["FilledSquareWithSquareHole", "Region"][30, 10]]

enter image description here

Use the option MeshCellStyle -> {2 -> None, 1->Black} in DiscretizeRegion to get

enter image description here

LaminaData["FilledSquareWithSquareHole", "Diagram"]

enter image description here

  • $\begingroup$ 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... $\endgroup$ – ABCDEMMM Mar 16 at 21:39
  • $\begingroup$ @ABCDEMMM, you can find installation instructions in the link given in user21's answer: GitHub FEMAAddOns package $\endgroup$ – kglr Mar 16 at 21:43
  • $\begingroup$ thanks! but the form of a .paclet file??? $\endgroup$ – ABCDEMMM Mar 16 at 21:44
  • $\begingroup$ okay, I find paclet file! thanks! $\endgroup$ – ABCDEMMM Mar 16 at 21:47

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