I'm trying to plot a finite element mesh with its node id's. But i'm facing a problem with the ListLinePlot, which connects all poits, instead connect only the neighbour node. I need to eliminate the diagonal lines from the following ListLinePlot:
topol={{4, 1, 5, 8, 3, 2, 6, 7}, {5, 13, 17, 8, 10, 15, 11, 6},
{30, 37, 35, 26, 33, 36, 31, 28}, {35, 32, 24, 26, 34, 29, 25, 31},
{17, 23, 18, 8, 20, 21, 12, 11}, {4, 8, 18, 14, 7, 12, 16, 9},
{24, 14, 18, 26, 19, 16, 22, 25}, {26, 18, 23, 30, 22, 21, 27, 28}};
nnodes = {{0, 6}, {0, 4.5}, {2.5, 6}, {0, 3}, {2.5, 3}, {0, 1.5}, {5, 6},
{5, 4.5}, {5, 3}, {0, 0}, {2.5, 0}, {5, 1.5}, {7.5, 6}, {5, 0},
{7.5, 3}, {7.5, 0}, {10, 6}, {10, 4.5}, {10, 3}, {10, 1.5}, {10, 0}};
allcoords = {{{5, 0}, {5, 3}, {0, 3}, {0, 0}, {5, 1.5}, {2.5, 3}, {0, 1.5}, {2.5, 0}},
{{10, 0}, {10, 3}, {5, 3}, {5, 0}, {10, 1.5}, {7.5, 3}, {5, 1.5}, {7.5, 0}},
{{5, 3}, {5, 6}, {0, 6}, {0, 3}, {5, 4.5}, {2.5, 6}, {0, 4.5}, {2.5, 3}},
{{10, 3}, {10, 6}, {5, 6}, {5, 3}, {10, 4.5}, {7.5, 6}, {5, 4.5}, {7.5, 3}}};
nodeids =
ListPlot[Table[Labeled[nnodes[[i]], i], {i, Length@nnodes}],
AspectRatio -> Automatic];
undefplot =
ListLinePlot[Tooltip[allcoords], AspectRatio -> Automatic,
PlotMarkers -> Automatic, PlotStyle -> {Thick}];
Show[nodeids, undefplot]
I need something like this:
Needs["NDSolve`FEM`"]
q = QuadElement[topol]
mesh = ToElementMesh["Coordinates" -> nnodes, "MeshElements" -> {q}]
Show[mesh["Wireframe"],
mesh["Wireframe"["MeshElement" -> "PointElements",
"MeshElementStyle" -> Directive[Red, PointSize[0.02]],
"MeshElementIDStyle" -> Blue]]]
But in the figure above is missing the interior nodes.
How can i do that? Thank you!



allcoords? Is it output from some code? – BlacKow Jan 05 '17 at 21:07allcoords = Table[nnodes[[ topol[[i]][[j]] ]], {i, 1, Length[topol]}, {j, 1, 8}];– Stratus Jan 05 '17 at 21:10topois ...? It will be useful if you show a plot of desired result - maybe hardcoding coordinates fro demonstration purposes. – BlacKow Jan 05 '17 at 21:11topol = Transpose@Drop[Transpose@Import["file.txt", "Table"], 1];– Stratus Jan 05 '17 at 21:12topol={{4, 1, 5, 8, 3, 2, 6, 7}, {5, 13, 17, 8, 10, 15, 11, 6}, {30, 37, 35, 26, 33, 36, 31, 28}, {35, 32, 24, 26, 34, 29, 25, 31}, {17, 23, 18, 8, 20, 21, 12, 11}, {4, 8, 18, 14, 7, 12, 16, 9}, {24, 14, 18, 26, 19, 16, 22, 25}, {26, 18, 23, 30, 22, 21, 27, 28}}– Stratus Jan 05 '17 at 21:13