4
$\begingroup$

I need help to make the elements id visible in the meshing code

Needs["NDSolve`FEM`"]

nx = 401;
ny = 51;
coordinates = 
 Flatten[Table[{r Cos[\[Theta]], r Sin[\[Theta]]}, {r, 2., 3., 
    1/(ny - 1)}, {\[Theta], 0., 3 Pi/3., (3 Pi/3.)/(nx - 1)}], 1]

incidents = 
  Flatten[Table[{j*nx + i, 
     j*nx + i + 1, (j - 1)*nx + i + 1, (j - 1)*nx + i}, {i, 1, 
     nx - 1}, {j, 1, ny - 1}], 1];

MatrixForm[incidents];

mesh = ToElementMesh["Coordinates" -> coordinates, 
   "MeshElements" -> {QuadElement[incidents]}];

mesh["Wireframe"]

mesh["ElementConnectivity"];

Show[mesh["Wireframe"["MeshElementIDStyle" -> Red]]]

Show[mesh["Wireframe"["MeshElementIDStyle" -> Red]], 
 mesh["Wireframe"["MeshElement" -> "PointElements", 
   "MeshElementIDStyle" -> Blue]]]

when I run it I get the results as in the figure I need to make numbering smaller to be able to see it enter image description here

$\endgroup$
5
$\begingroup$

You can get smaller font size with

mesh["Wireframe"["MeshElement" -> "PointElements",
  "MeshElementIDStyle" -> Directive[Red, "FontSize" -> 2]]
 ]
$\endgroup$
3
  • $\begingroup$ I tried that but give me nodes only with out numbering $\endgroup$ – Amr Saleh Apr 29 '18 at 18:10
  • $\begingroup$ Oh I did it and it is ok thank you $\endgroup$ – Amr Saleh Apr 29 '18 at 18:12
  • $\begingroup$ You're welcome! And good luck with reading those tiny numbers! :) $\endgroup$ – Henrik Schumacher Apr 29 '18 at 18:14

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.