372 std::vector < std::vector<int> >& elemVertMap)
374 BoundaryTypes bcType;
376 int eIdxGlobal =
problem_.variables().index(element);
378 const ElementGeometry& geometry = element.geometry();
380 const auto referenceElement = ReferenceElements::general(geometry.type());
382 int levelI = element.level();
385 for (
const auto& intersection : intersections(
problem_.gridView(), element))
387 int indexInInside = intersection.indexInInside();
389 DimVector normal = intersection.centerUnitOuterNormal();
391 const IntersectionGeometry& isGeometry = intersection.geometry();
393 Scalar faceVol = isGeometry.volume();
395 const DimVector& globalPosFace = isGeometry.center();
397 bool takeIntersection =
true;
398 if (intersection.neighbor())
400 auto outside = intersection.outside();
401 int eIdxGlobalJ =
problem_.variables().index(outside);
403 if (levelI == outside.level() && eIdxGlobal > eIdxGlobalJ)
404 takeIntersection =
false;
405 if (levelI < outside.level())
406 takeIntersection =
false;
409 if (takeIntersection)
412 if (intersection.neighbor())
414 int eIdxGlobalJ =
problem_.variables().index(intersection.outside());
418 for (
int i = 0; i < isGeometry.corners(); i++)
420 int localVertIdx = referenceElement.subEntity(indexInInside, 1, i, dim);
422 int vIdxGlobal =
problem_.variables().vertexMapper().subIndex(element, localVertIdx, dim);
426 if (elemVertMap[vIdxGlobal][0] == eIdxGlobal)
428 if (indexInInside == 1)
434 if (intersection.neighbor())
436 int indexInOutside = intersection.indexInOutside();
439 DimVector normalOutside = normal;
445 else if (indexInInside == 3)
451 if (intersection.neighbor())
453 int indexInOutside = intersection.indexInOutside();
456 DimVector normalOutside = normal;
462 else if (indexInInside == 5)
468 if (intersection.neighbor())
470 int indexInOutside = intersection.indexInOutside();
473 DimVector normalOutside = normal;
480 if (elemVertMap[vIdxGlobal][1] == eIdxGlobal)
482 if (indexInInside == 3)
488 if (intersection.neighbor())
490 int indexInOutside = intersection.indexInOutside();
493 DimVector normalOutside = normal;
499 else if (indexInInside == 0)
505 if (intersection.neighbor())
507 int indexInOutside = intersection.indexInOutside();
510 DimVector normalOutside = normal;
516 else if (indexInInside == 5)
522 if (intersection.neighbor())
524 int indexInOutside = intersection.indexInOutside();
527 DimVector normalOutside = normal;
534 if (elemVertMap[vIdxGlobal][2] == eIdxGlobal)
536 if (indexInInside == 2)
542 if (intersection.neighbor())
544 int indexInOutside = intersection.indexInOutside();
547 DimVector normalOutside = normal;
553 else if (indexInInside == 1)
559 if (intersection.neighbor())
561 int indexInOutside = intersection.indexInOutside();
564 DimVector normalOutside = normal;
570 else if (indexInInside == 5)
576 if (intersection.neighbor())
578 int indexInOutside = intersection.indexInOutside();
581 DimVector normalOutside = normal;
588 if (elemVertMap[vIdxGlobal][3] == eIdxGlobal)
590 if (indexInInside == 0)
596 if (intersection.neighbor())
598 int indexInOutside = intersection.indexInOutside();
601 DimVector normalOutside = normal;
607 else if (indexInInside == 2)
613 if (intersection.neighbor())
615 int indexInOutside = intersection.indexInOutside();
618 DimVector normalOutside = normal;
624 else if (indexInInside == 5)
630 if (intersection.neighbor())
632 int indexInOutside = intersection.indexInOutside();
635 DimVector normalOutside = normal;
642 if (elemVertMap[vIdxGlobal][4] == eIdxGlobal)
644 if (indexInInside == 4)
650 if (intersection.neighbor())
652 int indexInOutside = intersection.indexInOutside();
655 DimVector normalOutside = normal;
661 else if (indexInInside == 1)
667 if (intersection.neighbor())
669 int indexInOutside = intersection.indexInOutside();
672 DimVector normalOutside = normal;
678 else if (indexInInside == 3)
684 if (intersection.neighbor())
686 int indexInOutside = intersection.indexInOutside();
689 DimVector normalOutside = normal;
696 if (elemVertMap[vIdxGlobal][5] == eIdxGlobal)
698 if (indexInInside == 4)
704 if (intersection.neighbor())
706 int indexInOutside = intersection.indexInOutside();
709 DimVector normalOutside = normal;
715 else if (indexInInside == 3)
721 if (intersection.neighbor())
723 int indexInOutside = intersection.indexInOutside();
726 DimVector normalOutside = normal;
733 else if (indexInInside == 0)
739 if (intersection.neighbor())
741 int indexInOutside = intersection.indexInOutside();
744 DimVector normalOutside = normal;
751 if (elemVertMap[vIdxGlobal][6] == eIdxGlobal)
753 if (indexInInside == 4)
759 if (intersection.neighbor())
761 int indexInOutside = intersection.indexInOutside();
764 DimVector normalOutside = normal;
770 else if (indexInInside == 2)
776 if (intersection.neighbor())
778 int indexInOutside = intersection.indexInOutside();
781 DimVector normalOutside = normal;
787 else if (indexInInside == 1)
793 if (intersection.neighbor())
795 int indexInOutside = intersection.indexInOutside();
798 DimVector normalOutside = normal;
805 if (elemVertMap[vIdxGlobal][7] == eIdxGlobal)
807 if (indexInInside == 4)
813 if (intersection.neighbor())
815 int indexInOutside = intersection.indexInOutside();
818 DimVector normalOutside = normal;
824 else if (indexInInside == 0)
830 if (intersection.neighbor())
832 int indexInOutside = intersection.indexInOutside();
835 DimVector normalOutside = normal;
841 else if (indexInInside == 2)
847 if (intersection.neighbor())
849 int indexInOutside = intersection.indexInOutside();
852 DimVector normalOutside = normal;
859 if (intersection.boundary())
861 if (elemVertMap[vIdxGlobal][0] == eIdxGlobal)
863 if (indexInInside == 1)
865 problem_.boundaryTypes(bcType, intersection);
866 PrimaryVariables boundValues(0.0);
869 if (bcType.isNeumann(pressureEqIdx))
871 problem_.neumann(boundValues, intersection);
872 boundValues *= faceVol/4.0;
875 if (bcType.hasDirichlet())
877 problem_.dirichlet(boundValues, intersection);
881 else if (indexInInside == 3)
883 problem_.boundaryTypes(bcType, intersection);
884 PrimaryVariables boundValues(0.0);
887 if (bcType.isNeumann(pressureEqIdx))
889 problem_.neumann(boundValues, intersection);
890 boundValues *= faceVol/4.0;
893 if (bcType.hasDirichlet())
895 problem_.dirichlet(boundValues, intersection);
899 else if (indexInInside == 5)
901 problem_.boundaryTypes(bcType, intersection);
902 PrimaryVariables boundValues(0.0);
905 if (bcType.isNeumann(pressureEqIdx))
907 problem_.neumann(boundValues, intersection);
908 boundValues *= faceVol/4.0;
911 if (bcType.hasDirichlet())
913 problem_.dirichlet(boundValues, intersection);
918 if (elemVertMap[vIdxGlobal][1] == eIdxGlobal)
920 if (indexInInside == 3)
922 problem_.boundaryTypes(bcType, intersection);
923 PrimaryVariables boundValues(0.0);
926 if (bcType.isNeumann(pressureEqIdx))
928 problem_.neumann(boundValues, intersection);
929 boundValues *= faceVol/4.0;
932 if (bcType.hasDirichlet())
934 problem_.dirichlet(boundValues, intersection);
938 else if (indexInInside == 0)
940 problem_.boundaryTypes(bcType, intersection);
941 PrimaryVariables boundValues(0.0);
944 if (bcType.isNeumann(pressureEqIdx))
946 problem_.neumann(boundValues, intersection);
947 boundValues *= faceVol/4.0;
950 if (bcType.hasDirichlet())
952 problem_.dirichlet(boundValues, intersection);
956 else if (indexInInside == 5)
958 problem_.boundaryTypes(bcType, intersection);
959 PrimaryVariables boundValues(0.0);
962 if (bcType.isNeumann(pressureEqIdx))
964 problem_.neumann(boundValues, intersection);
965 boundValues *= faceVol/4.0;
968 if (bcType.hasDirichlet())
970 problem_.dirichlet(boundValues, intersection);
975 if (elemVertMap[vIdxGlobal][2] == eIdxGlobal)
977 if (indexInInside == 2)
979 problem_.boundaryTypes(bcType, intersection);
980 PrimaryVariables boundValues(0.0);
983 if (bcType.isNeumann(pressureEqIdx))
985 problem_.neumann(boundValues, intersection);
986 boundValues *= faceVol/4.0;
989 if (bcType.hasDirichlet())
991 problem_.dirichlet(boundValues, intersection);
995 else if (indexInInside == 1)
997 problem_.boundaryTypes(bcType, intersection);
998 PrimaryVariables boundValues(0.0);
1001 if (bcType.isNeumann(pressureEqIdx))
1003 problem_.neumann(boundValues, intersection);
1004 boundValues *= faceVol/4.0;
1007 if (bcType.hasDirichlet())
1009 problem_.dirichlet(boundValues, intersection);
1013 else if (indexInInside == 5)
1015 problem_.boundaryTypes(bcType, intersection);
1016 PrimaryVariables boundValues(0.0);
1019 if (bcType.isNeumann(pressureEqIdx))
1021 problem_.neumann(boundValues, intersection);
1022 boundValues *= faceVol/4.0;
1025 if (bcType.hasDirichlet())
1027 problem_.dirichlet(boundValues, intersection);
1032 if (elemVertMap[vIdxGlobal][3] == eIdxGlobal)
1034 if (indexInInside == 0)
1036 problem_.boundaryTypes(bcType, intersection);
1037 PrimaryVariables boundValues(0.0);
1040 if (bcType.isNeumann(pressureEqIdx))
1042 problem_.neumann(boundValues, intersection);
1043 boundValues *= faceVol/4.0;
1046 if (bcType.hasDirichlet())
1048 problem_.dirichlet(boundValues, intersection);
1052 else if (indexInInside == 2)
1054 problem_.boundaryTypes(bcType, intersection);
1055 PrimaryVariables boundValues(0.0);
1058 if (bcType.isNeumann(pressureEqIdx))
1060 problem_.neumann(boundValues, intersection);
1061 boundValues *= faceVol/4.0;
1064 if (bcType.hasDirichlet())
1066 problem_.dirichlet(boundValues, intersection);
1070 else if (indexInInside == 5)
1072 problem_.boundaryTypes(bcType, intersection);
1073 PrimaryVariables boundValues(0.0);
1076 if (bcType.isNeumann(pressureEqIdx))
1078 problem_.neumann(boundValues, intersection);
1079 boundValues *= faceVol/4.0;
1082 if (bcType.hasDirichlet())
1084 problem_.dirichlet(boundValues, intersection);
1089 if (elemVertMap[vIdxGlobal][4] == eIdxGlobal)
1091 if (indexInInside == 4)
1093 problem_.boundaryTypes(bcType, intersection);
1094 PrimaryVariables boundValues(0.0);
1097 if (bcType.isNeumann(pressureEqIdx))
1099 problem_.neumann(boundValues, intersection);
1100 boundValues *= faceVol/4.0;
1103 if (bcType.hasDirichlet())
1105 problem_.dirichlet(boundValues, intersection);
1109 else if (indexInInside == 1)
1111 problem_.boundaryTypes(bcType, intersection);
1112 PrimaryVariables boundValues(0.0);
1115 if (bcType.isNeumann(pressureEqIdx))
1117 problem_.neumann(boundValues, intersection);
1118 boundValues *= faceVol/4.0;
1121 if (bcType.hasDirichlet())
1123 problem_.dirichlet(boundValues, intersection);
1127 else if (indexInInside == 3)
1129 problem_.boundaryTypes(bcType, intersection);
1130 PrimaryVariables boundValues(0.0);
1133 if (bcType.isNeumann(pressureEqIdx))
1135 problem_.neumann(boundValues, intersection);
1136 boundValues *= faceVol/4.0;
1139 if (bcType.hasDirichlet())
1141 problem_.dirichlet(boundValues, intersection);
1146 if (elemVertMap[vIdxGlobal][5] == eIdxGlobal)
1148 if (indexInInside == 4)
1150 problem_.boundaryTypes(bcType, intersection);
1151 PrimaryVariables boundValues(0.0);
1154 if (bcType.isNeumann(pressureEqIdx))
1156 problem_.neumann(boundValues, intersection);
1157 boundValues *= faceVol/4.0;
1160 if (bcType.hasDirichlet())
1162 problem_.dirichlet(boundValues, intersection);
1166 else if (indexInInside == 3)
1168 problem_.boundaryTypes(bcType, intersection);
1169 PrimaryVariables boundValues(0.0);
1172 if (bcType.isNeumann(pressureEqIdx))
1174 problem_.neumann(boundValues, intersection);
1175 boundValues *= faceVol/4.0;
1178 if (bcType.hasDirichlet())
1180 problem_.dirichlet(boundValues, intersection);
1184 else if (indexInInside == 0)
1186 problem_.boundaryTypes(bcType, intersection);
1187 PrimaryVariables boundValues(0.0);
1190 if (bcType.isNeumann(pressureEqIdx))
1192 problem_.neumann(boundValues, intersection);
1193 boundValues *= faceVol/4.0;
1196 if (bcType.hasDirichlet())
1198 problem_.dirichlet(boundValues, intersection);
1203 if (elemVertMap[vIdxGlobal][6] == eIdxGlobal)
1205 if (indexInInside == 4)
1207 problem_.boundaryTypes(bcType, intersection);
1208 PrimaryVariables boundValues(0.0);
1211 if (bcType.isNeumann(pressureEqIdx))
1213 problem_.neumann(boundValues, intersection);
1214 boundValues *= faceVol/4.0;
1217 if (bcType.hasDirichlet())
1219 problem_.dirichlet(boundValues, intersection);
1223 else if (indexInInside == 2)
1225 problem_.boundaryTypes(bcType, intersection);
1226 PrimaryVariables boundValues(0.0);
1229 if (bcType.isNeumann(pressureEqIdx))
1231 problem_.neumann(boundValues, intersection);
1232 boundValues *= faceVol/4.0;
1235 if (bcType.hasDirichlet())
1237 problem_.dirichlet(boundValues, intersection);
1241 else if (indexInInside == 1)
1243 problem_.boundaryTypes(bcType, intersection);
1244 PrimaryVariables boundValues(0.0);
1247 if (bcType.isNeumann(pressureEqIdx))
1249 problem_.neumann(boundValues, intersection);
1250 boundValues *= faceVol/4.0;
1253 if (bcType.hasDirichlet())
1255 problem_.dirichlet(boundValues, intersection);
1260 if (elemVertMap[vIdxGlobal][7] == eIdxGlobal)
1262 if (indexInInside == 4)
1264 problem_.boundaryTypes(bcType, intersection);
1265 PrimaryVariables boundValues(0.0);
1268 if (bcType.isNeumann(pressureEqIdx))
1270 problem_.neumann(boundValues, intersection);
1271 boundValues *= faceVol/4.0;
1274 if (bcType.hasDirichlet())
1276 problem_.dirichlet(boundValues, intersection);
1280 else if (indexInInside == 0)
1282 problem_.boundaryTypes(bcType, intersection);
1283 PrimaryVariables boundValues(0.0);
1286 if (bcType.isNeumann(pressureEqIdx))
1288 problem_.neumann(boundValues, intersection);
1289 boundValues *= faceVol/4.0;
1292 if (bcType.hasDirichlet())
1294 problem_.dirichlet(boundValues, intersection);
1298 else if (indexInInside == 2)
1300 problem_.boundaryTypes(bcType, intersection);
1301 PrimaryVariables boundValues(0.0);
1304 if (bcType.isNeumann(pressureEqIdx))
1306 problem_.neumann(boundValues, intersection);
1307 boundValues *= faceVol/4.0;
1310 if (bcType.hasDirichlet())
1312 problem_.dirichlet(boundValues, intersection);
1479 const Vertex& vertex)
1481 const DimVector& centerPos = vertex.geometry().center();
1991 DUNE_THROW(Dune::NotImplemented,
"Boundary shape not implemented");