3

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

plate

user21
  • 39,710
  • 8
  • 110
  • 167
Amr Saleh
  • 105
  • 3
  • 8
    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. – Kuba Apr 30 '18 at 19:38

3 Answers3

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

region

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"]

enter image description here

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"]

enter image description here

user21
  • 39,710
  • 8
  • 110
  • 167
3
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

kglr
  • 394,356
  • 18
  • 477
  • 896