<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hello DUNE-developers,</p>
<p><br>
</p>
<p>I have a question regarding the boundary segment indexing and</p>
<p>connecting tags corresponding to the segments with boundary conditions.</p>
<p><br>
</p>
<p>Right now, I load a gmsh-file and obtain a vector with boundary tags.</p>
<p>Those tags should trigger some kind of boundary condition for example</p>
<p>set some values in a block-vector or sparse-matrix.</p>
<p>After reading the book from Mr. Sander and some how-to's I think I <br>
</p>
<p>understood the principle concept of intersections and so, but still</p>
<p>something is not working right for me.<br>
</p>
<p>My actual code loops over all elements of the gridview and over</p>
<p>the corresponding intersections. Inside the loop i check if</p>
<p>the intersection is in contact with the boundary (because I</p>
<p>want to set boundary conditions). If that is true, a switch</p>
<p>should select the right b.c. code, depending on the tag that is</p>
<p>stored inside the boundaryEntitity vector I obtain from loading the</p>
<p>gmsh-file. The array-entry of the boundaryEntitiy vector is</p>
<p>selected via the intersection boundary segment index (is this the right</p>
<p>approach ?).</p>
<p><br>
</p>
<p>And here starts my actual question ... in two dimensions that is working</p>
<p>fine (even for complex geometries and several tags), but for three dimensions <br>
</p>
<p>it's not working properly even for a single element (for example a hexa-element
<br>
</p>
<p>with different tags on each of the boundary faces). <br>
</p>
<p>So is my description the common approach to handle the boundary situation <br>
</p>
<p>or is there a more efficient or better way ? Or am I missing something ?<br>
</p>
<p><br>
</p>
<p>My code looks like this (the 3 lines after the double loop and the</p>
<p>code inside case 1 should set the corresponding entry in a block-</p>
<p>vector, by looping over the vertices of the intersection geometry and</p>
<p>getting the "global" index for that position):<br>
</p>
<p><br>
</p>
<p></p>
<div>for( const auto& element : elements(gridView)) {<br>
    for( const auto& isect : intersections(gridView, element)) {</div>
<div><br>
</div>
<div><br>
      GeometryType elementGeometry = element.type();<br>
      using Factory = ReferenceElements<double, dim>;<br>
      const auto &ref = Factory::general(elementGeometry);</div>
<div><br>
</div>
<div><br>
      if(isect.boundary()) {<br>
       <br>
        switch(boundaryEntity[isect.boundarySegmentIndex()]) {<br>
          case 0:</div>
<div>            ...<br>
            break;<br>
          case 1:</div>
<div><br>
            for(int i=0; i<ref.size(isect.indexInInside(), 1, dim); i++) {<br>
              int row = indexSet.subIndex(element, ref.subEntity(isect.indexInInside(), 1, i, dim), dim); 
<br>
              loadVector[row] = Load;              <br>
            }</div>
<div><br>
</div>
<div>           ...<br>
        }<br>
      }<br>
    }<br>
  }</div>
<div><br>
</div>
<div>As written before, for 2d meshes it works pretty well, but for 3d it's the complete</div>
<div>opposite and I don't really understand why.<br>
</div>
<div><br>
</div>
<div>Thanks for your help and best regards,</div>
<div>Max<br>
</div>
<br>
<p></p>
</div>
</body>
</html>