5
$\begingroup$

How can one apply a NeumannValue on an ElementMarker on the boundary of an ElementMesh for a mesh already defined (i.e. with ElementMarkers being defined as 1,2,3 etc)?

It is not so clear what ElementMarkers actually correspond to, for example it is possible to have boundary elements with the same label as mesh elements.

$\endgroup$
  • $\begingroup$ I can certainly help you with this. But before I do that I am curious to know how you tried to search for it in the documentation? $\endgroup$ – user21 Nov 20 '18 at 8:09
  • $\begingroup$ I'd like to improve the searching. $\endgroup$ – user21 Nov 20 '18 at 8:19
  • $\begingroup$ @user21 Basically I tried going through all the FE documentation (searching for NeumannValue, and BoundaryElementMarker). I did searches over the Stackexchange site, as well as in general on Google, but didn't really find any examples that fit. $\endgroup$ – Dunlop Nov 20 '18 at 8:20
  • $\begingroup$ OK, got it, thanks. Hang in a few more minutes while I prepare an answer. $\endgroup$ – user21 Nov 20 '18 at 8:22
  • $\begingroup$ Ah ok, I see why you are interested. One problem is it seems that when one searches in a combined way NeumannValue and BoundaryElementMarker together then one gets very few search hits. The other problem is the search of the FE typically comes to the very long tutorials which you then have to search inside of. Great if this helps you improve the searching $\endgroup$ – Dunlop Nov 20 '18 at 8:23
5
$\begingroup$
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]]]

enter image description here

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

enter image description here

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]

enter image description here

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"

$\endgroup$
  • $\begingroup$ Super this is really helpful! $\endgroup$ – Dunlop Nov 20 '18 at 8:49
  • $\begingroup$ @Dunlop I have put it in the documentation, though in the ElementMesh generation tutorial $\endgroup$ – user21 Nov 20 '18 at 8:52
  • $\begingroup$ Thanks again! I think I got a bit confused with the labelling for BoundaryElement etc. I see the problem though that if these terms are not system context symbols then it is difficult to write documentation for them $\endgroup$ – Dunlop Nov 20 '18 at 9:30
  • $\begingroup$ Should I edit the question so that your response makes more sense and it would be more useful to others and hopefully easier to find? $\endgroup$ – Dunlop Nov 21 '18 at 5:55
  • $\begingroup$ @Dunlop,I don't know. What do you think? $\endgroup$ – user21 Nov 21 '18 at 6:42

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.