[Dune] Boundary conditions, segments and indexing

Carsten Gräser graeser at mi.fu-berlin.de
Mon Aug 24 10:34:50 CEST 2020


Hi Max,

Am 24.08.20 um 09:46 schrieb Firmbach, Max:
[...]
> For the simple one element, hexaeder case the tags are read into
> the boundaryEntity vector like [0, 0, 3, 0, 1, 0]. So on four faces
> there is just a 0, which means no B.C. is applied. For front and back
> either B.C. 1 or 3 should be applied. Looping over the boundary
> intersections my insertion index for the segments is something like
> [0, 1, 2, 4, 3, 5], which is identical to the boundarySegmentIndex()
> method (somewhere it's said that they don't need to be identical
> somehow, for this case they are).
in general they are not, because a grid may renumber them
during creation. The GridFactory::insertionIndex() method
exists, to keep track of such renumberings. However, UGGrid
does not do any renumbering, as you observed. So that's not
the problem here (but you may still adjust your code to not
depend on implementation details).

There's another potential issue in your code. But since
you've only send a code fragment, it's not clear if it
really is a problem:

> for( const auto& element : elements(gridView)) {
>     for( const auto& isect : intersections(gridView, element)) {
> 
>       GeometryType elementGeometry = element.type();
>       using Factory = ReferenceElements<double, dim>;
>       const auto &ref = Factory::general(elementGeometry);
[...]
>             for(int i=0; i<ref.size(isect.indexInInside(), 1, dim); i++) {
>               int row = indexSet.subIndex(element, ref.subEntity(isect.indexInInside(), 1, i, dim), dim); 
>              loadVector[row] = Load;              
If Load is a fixed value, that's OK. If it's computed depending
on i, then this is probably a bug, because the subentity
orientation in the reference element and grid elements
does in general not coincide. To avoid ever using i
directly better use re.subEntities(isect.indexInInside(), 1, dim)
instead.


> As written before, for 2d meshes it works pretty well,
> but for 3d it's the complete opposite and I don't really
> understand why.
Can you be a little more precise and describe what
"it does not work" means? A minimal complete example
would also be helpful.

Best,
Carsten




More information about the Dune mailing list