Needs["NDSolve`FEM`"]
To illustrate the process of making use of ElementMarkers in a simulation we create a simple mesh that has ElementMarkers in the MeshElements, BoundaryElements and "PointElements".
mesh = ToElementMesh[
"Coordinates" -> {{1.293, 0.228}, {1., 0.}, {0.94, 0.342}, {1.293,
0.}, {1.215, 0.442}, {2., 0.}, {1.879, 0.684}},
"MeshElements" -> {TriangleElement[{{1, 3, 2}, {1, 2, 4}, {1, 4,
6}, {1, 6, 7}, {1, 7, 5}, {1, 5, 3}}, {66, 66, 66, 44, 44,
44}]},
"BoundaryElements" -> {LineElement[{{3, 2}, {1, 3}, {2, 4}, {4,
6}, {6, 1}, {6, 7}, {7, 5}, {5, 3}}, {11, 22, 33, 33, 22, 44,
55, 55}]},
"PointElements" -> {PointElement[{{1}, {2}, {3}, {4}, {5}, {6}, \
{7}}, {1, 2, 2, 3, 3, 4, 4}]}]
Visualize the mesh and the IDs of the nodes.
Show[mesh["Wireframe"],
mesh["Wireframe"["MeshElement" -> "PointElements",
"MeshElementIDStyle" -> Brown]]]
Visualize the mesh with markers in the "MeshElements" in blue, the markers in the "BoundaryElements" inn red and the markers in the "PointElements" in brown.
Show[
mesh["Wireframe"],
mesh["Wireframe"["MeshElementMarkerStyle" -> Blue]],
mesh["Wireframe"["MeshElement" -> "BoundaryElements",
"MeshElementMarkerStyle" -> Red]],
mesh["Wireframe"["MeshElement" -> "PointElements",
"MeshElementMarkerStyle" -> Brown]]
]
Note that the boundary edge from node 6 to node 7 has a marker of 44 while the mesh element made up of nodes {1,6,7} also has a marker of 44 set.
As an example a Poisson type equation with a right hand side that depends on the markers in the "MeshElements" is used. If a mesh element has a marker of 44 then 10 is used as the value of the right hand side. In all other cases 1 is used. Also a NeumannValue of -1 is set on all edges that have a marker set to 44. A DirichletCondtion is set on the point that has an ElementMarker of 1.
ufun = NDSolveValue[{Laplacian[u[x, y], {x, y}] ==
If[ElementMarker == 44, 10, 1] +
NeumannValue[-1, ElementMarker == 44],
DirichletCondition[u[x, y] == 0, ElementMarker == 1]},
u, {x, y} \[Element] mesh]
Visualize the solution.
Plot3D[ufun[x, y], {x, y} \[Element] mesh]
Note that the fact that both the mesh elements and boundary elements make use of a marker with number 44 does not matter. ElementMarkers used in coefficients like the If statement operate on the markers present in the mesh elements. References to ElementMarkers in NeumannValue refer to markers on "BoundaryElements" and makers in DirichletCondition refer to markers in "PointElements"