I've imported a 2D element mesh from another program as a list of triangle coordinates {{x1,y1},{x2,y2}....} ("nodes") and element connections {{n1,n2,n3},...} ("elements"). Then I create an ElementMesh as follows:
mesh = ToElementMesh["Coordinates" -> nodes,
"MeshElements" -> {TriangleElement[elements]},
"BoundaryMarkerFunction" -> boundaryMarkerFunction];
I was hoping this would automatically assign ElementMarkers to each boundary edge, using the boundaryMarkerFunction specified in the documentation for ToBoundaryMesh:
boundaryMarkerFunction =
Compile[{{boundaryElementCoords, _Real, 3}, {pointMarkres, _Integer,
2}}, Range[Length[boundaryElementCoords]]];
However, no boundary edges actually get ElementMarkers assigned to them:
How can I assign ElementMarkers to these boundary edges? (Even a randomized assignment would be okay, as long as each edge gets a unique marker). I just need a way to reference particular boundary edges for a NeumannValue condition.
Any help would be greatly appreciated. Thanks!
Edit: Here is what I get from running
Show[
mesh["Wireframe"],
mesh["Wireframe"["MeshElement" -> "BoundaryElements",
"MeshElementMarkerStyle" -> Red]]]
: