370 std::vector < std::vector<int> >& elemVertMap)
372 BoundaryTypes bcType;
374 int eIdxGlobal =
problem_.variables().index(element);
376 const ElementGeometry& geometry = element.geometry();
377 const auto refElement = referenceElement(geometry);
379 int levelI = element.level();
382 for (
const auto& intersection : intersections(
problem_.gridView(), element))
384 int indexInInside = intersection.indexInInside();
386 DimVector
normal = intersection.centerUnitOuterNormal();
388 const IntersectionGeometry& isGeometry = intersection.geometry();
390 Scalar faceVol = isGeometry.volume();
392 const DimVector& globalPosFace = isGeometry.center();
394 bool takeIntersection =
true;
395 if (intersection.neighbor())
397 auto outside = intersection.outside();
398 int eIdxGlobalJ =
problem_.variables().index(outside);
400 if (levelI == outside.level() && eIdxGlobal > eIdxGlobalJ)
401 takeIntersection =
false;
402 if (levelI < outside.level())
403 takeIntersection =
false;
406 if (takeIntersection)
409 if (intersection.neighbor())
411 int eIdxGlobalJ =
problem_.variables().index(intersection.outside());
415 for (
int i = 0; i < isGeometry.corners(); i++)
417 int localVertIdx = refElement.subEntity(indexInInside, 1, i, dim);
419 int vIdxGlobal =
problem_.variables().vertexMapper().subIndex(element, localVertIdx, dim);
423 if (elemVertMap[vIdxGlobal][0] == eIdxGlobal)
425 if (indexInInside == 1)
431 if (intersection.neighbor())
433 int indexInOutside = intersection.indexInOutside();
436 DimVector normalOutside =
normal;
442 else if (indexInInside == 3)
448 if (intersection.neighbor())
450 int indexInOutside = intersection.indexInOutside();
453 DimVector normalOutside =
normal;
459 else if (indexInInside == 5)
465 if (intersection.neighbor())
467 int indexInOutside = intersection.indexInOutside();
470 DimVector normalOutside =
normal;
477 if (elemVertMap[vIdxGlobal][1] == eIdxGlobal)
479 if (indexInInside == 3)
485 if (intersection.neighbor())
487 int indexInOutside = intersection.indexInOutside();
490 DimVector normalOutside =
normal;
496 else if (indexInInside == 0)
502 if (intersection.neighbor())
504 int indexInOutside = intersection.indexInOutside();
507 DimVector normalOutside =
normal;
513 else if (indexInInside == 5)
519 if (intersection.neighbor())
521 int indexInOutside = intersection.indexInOutside();
524 DimVector normalOutside =
normal;
531 if (elemVertMap[vIdxGlobal][2] == eIdxGlobal)
533 if (indexInInside == 2)
539 if (intersection.neighbor())
541 int indexInOutside = intersection.indexInOutside();
544 DimVector normalOutside =
normal;
550 else if (indexInInside == 1)
556 if (intersection.neighbor())
558 int indexInOutside = intersection.indexInOutside();
561 DimVector normalOutside =
normal;
567 else if (indexInInside == 5)
573 if (intersection.neighbor())
575 int indexInOutside = intersection.indexInOutside();
578 DimVector normalOutside =
normal;
585 if (elemVertMap[vIdxGlobal][3] == eIdxGlobal)
587 if (indexInInside == 0)
593 if (intersection.neighbor())
595 int indexInOutside = intersection.indexInOutside();
598 DimVector normalOutside =
normal;
604 else if (indexInInside == 2)
610 if (intersection.neighbor())
612 int indexInOutside = intersection.indexInOutside();
615 DimVector normalOutside =
normal;
621 else if (indexInInside == 5)
627 if (intersection.neighbor())
629 int indexInOutside = intersection.indexInOutside();
632 DimVector normalOutside =
normal;
639 if (elemVertMap[vIdxGlobal][4] == eIdxGlobal)
641 if (indexInInside == 4)
647 if (intersection.neighbor())
649 int indexInOutside = intersection.indexInOutside();
652 DimVector normalOutside =
normal;
658 else if (indexInInside == 1)
664 if (intersection.neighbor())
666 int indexInOutside = intersection.indexInOutside();
669 DimVector normalOutside =
normal;
675 else if (indexInInside == 3)
681 if (intersection.neighbor())
683 int indexInOutside = intersection.indexInOutside();
686 DimVector normalOutside =
normal;
693 if (elemVertMap[vIdxGlobal][5] == eIdxGlobal)
695 if (indexInInside == 4)
701 if (intersection.neighbor())
703 int indexInOutside = intersection.indexInOutside();
706 DimVector normalOutside =
normal;
712 else if (indexInInside == 3)
718 if (intersection.neighbor())
720 int indexInOutside = intersection.indexInOutside();
723 DimVector normalOutside =
normal;
730 else if (indexInInside == 0)
736 if (intersection.neighbor())
738 int indexInOutside = intersection.indexInOutside();
741 DimVector normalOutside =
normal;
748 if (elemVertMap[vIdxGlobal][6] == eIdxGlobal)
750 if (indexInInside == 4)
756 if (intersection.neighbor())
758 int indexInOutside = intersection.indexInOutside();
761 DimVector normalOutside =
normal;
767 else if (indexInInside == 2)
773 if (intersection.neighbor())
775 int indexInOutside = intersection.indexInOutside();
778 DimVector normalOutside =
normal;
784 else if (indexInInside == 1)
790 if (intersection.neighbor())
792 int indexInOutside = intersection.indexInOutside();
795 DimVector normalOutside =
normal;
802 if (elemVertMap[vIdxGlobal][7] == eIdxGlobal)
804 if (indexInInside == 4)
810 if (intersection.neighbor())
812 int indexInOutside = intersection.indexInOutside();
815 DimVector normalOutside =
normal;
821 else if (indexInInside == 0)
827 if (intersection.neighbor())
829 int indexInOutside = intersection.indexInOutside();
832 DimVector normalOutside =
normal;
838 else if (indexInInside == 2)
844 if (intersection.neighbor())
846 int indexInOutside = intersection.indexInOutside();
849 DimVector normalOutside =
normal;
856 if (intersection.boundary())
858 if (elemVertMap[vIdxGlobal][0] == eIdxGlobal)
860 if (indexInInside == 1)
862 problem_.boundaryTypes(bcType, intersection);
863 PrimaryVariables boundValues(0.0);
866 if (bcType.isNeumann(pressureEqIdx))
868 problem_.neumann(boundValues, intersection);
869 boundValues *= faceVol/4.0;
872 if (bcType.hasDirichlet())
874 problem_.dirichlet(boundValues, intersection);
878 else if (indexInInside == 3)
880 problem_.boundaryTypes(bcType, intersection);
881 PrimaryVariables boundValues(0.0);
884 if (bcType.isNeumann(pressureEqIdx))
886 problem_.neumann(boundValues, intersection);
887 boundValues *= faceVol/4.0;
890 if (bcType.hasDirichlet())
892 problem_.dirichlet(boundValues, intersection);
896 else if (indexInInside == 5)
898 problem_.boundaryTypes(bcType, intersection);
899 PrimaryVariables boundValues(0.0);
902 if (bcType.isNeumann(pressureEqIdx))
904 problem_.neumann(boundValues, intersection);
905 boundValues *= faceVol/4.0;
908 if (bcType.hasDirichlet())
910 problem_.dirichlet(boundValues, intersection);
915 if (elemVertMap[vIdxGlobal][1] == eIdxGlobal)
917 if (indexInInside == 3)
919 problem_.boundaryTypes(bcType, intersection);
920 PrimaryVariables boundValues(0.0);
923 if (bcType.isNeumann(pressureEqIdx))
925 problem_.neumann(boundValues, intersection);
926 boundValues *= faceVol/4.0;
929 if (bcType.hasDirichlet())
931 problem_.dirichlet(boundValues, intersection);
935 else if (indexInInside == 0)
937 problem_.boundaryTypes(bcType, intersection);
938 PrimaryVariables boundValues(0.0);
941 if (bcType.isNeumann(pressureEqIdx))
943 problem_.neumann(boundValues, intersection);
944 boundValues *= faceVol/4.0;
947 if (bcType.hasDirichlet())
949 problem_.dirichlet(boundValues, intersection);
953 else if (indexInInside == 5)
955 problem_.boundaryTypes(bcType, intersection);
956 PrimaryVariables boundValues(0.0);
959 if (bcType.isNeumann(pressureEqIdx))
961 problem_.neumann(boundValues, intersection);
962 boundValues *= faceVol/4.0;
965 if (bcType.hasDirichlet())
967 problem_.dirichlet(boundValues, intersection);
972 if (elemVertMap[vIdxGlobal][2] == eIdxGlobal)
974 if (indexInInside == 2)
976 problem_.boundaryTypes(bcType, intersection);
977 PrimaryVariables boundValues(0.0);
980 if (bcType.isNeumann(pressureEqIdx))
982 problem_.neumann(boundValues, intersection);
983 boundValues *= faceVol/4.0;
986 if (bcType.hasDirichlet())
988 problem_.dirichlet(boundValues, intersection);
992 else if (indexInInside == 1)
994 problem_.boundaryTypes(bcType, intersection);
995 PrimaryVariables boundValues(0.0);
998 if (bcType.isNeumann(pressureEqIdx))
1000 problem_.neumann(boundValues, intersection);
1001 boundValues *= faceVol/4.0;
1004 if (bcType.hasDirichlet())
1006 problem_.dirichlet(boundValues, intersection);
1010 else if (indexInInside == 5)
1012 problem_.boundaryTypes(bcType, intersection);
1013 PrimaryVariables boundValues(0.0);
1016 if (bcType.isNeumann(pressureEqIdx))
1018 problem_.neumann(boundValues, intersection);
1019 boundValues *= faceVol/4.0;
1022 if (bcType.hasDirichlet())
1024 problem_.dirichlet(boundValues, intersection);
1029 if (elemVertMap[vIdxGlobal][3] == eIdxGlobal)
1031 if (indexInInside == 0)
1033 problem_.boundaryTypes(bcType, intersection);
1034 PrimaryVariables boundValues(0.0);
1037 if (bcType.isNeumann(pressureEqIdx))
1039 problem_.neumann(boundValues, intersection);
1040 boundValues *= faceVol/4.0;
1043 if (bcType.hasDirichlet())
1045 problem_.dirichlet(boundValues, intersection);
1049 else if (indexInInside == 2)
1051 problem_.boundaryTypes(bcType, intersection);
1052 PrimaryVariables boundValues(0.0);
1055 if (bcType.isNeumann(pressureEqIdx))
1057 problem_.neumann(boundValues, intersection);
1058 boundValues *= faceVol/4.0;
1061 if (bcType.hasDirichlet())
1063 problem_.dirichlet(boundValues, intersection);
1067 else if (indexInInside == 5)
1069 problem_.boundaryTypes(bcType, intersection);
1070 PrimaryVariables boundValues(0.0);
1073 if (bcType.isNeumann(pressureEqIdx))
1075 problem_.neumann(boundValues, intersection);
1076 boundValues *= faceVol/4.0;
1079 if (bcType.hasDirichlet())
1081 problem_.dirichlet(boundValues, intersection);
1086 if (elemVertMap[vIdxGlobal][4] == eIdxGlobal)
1088 if (indexInInside == 4)
1090 problem_.boundaryTypes(bcType, intersection);
1091 PrimaryVariables boundValues(0.0);
1094 if (bcType.isNeumann(pressureEqIdx))
1096 problem_.neumann(boundValues, intersection);
1097 boundValues *= faceVol/4.0;
1100 if (bcType.hasDirichlet())
1102 problem_.dirichlet(boundValues, intersection);
1106 else if (indexInInside == 1)
1108 problem_.boundaryTypes(bcType, intersection);
1109 PrimaryVariables boundValues(0.0);
1112 if (bcType.isNeumann(pressureEqIdx))
1114 problem_.neumann(boundValues, intersection);
1115 boundValues *= faceVol/4.0;
1118 if (bcType.hasDirichlet())
1120 problem_.dirichlet(boundValues, intersection);
1124 else if (indexInInside == 3)
1126 problem_.boundaryTypes(bcType, intersection);
1127 PrimaryVariables boundValues(0.0);
1130 if (bcType.isNeumann(pressureEqIdx))
1132 problem_.neumann(boundValues, intersection);
1133 boundValues *= faceVol/4.0;
1136 if (bcType.hasDirichlet())
1138 problem_.dirichlet(boundValues, intersection);
1143 if (elemVertMap[vIdxGlobal][5] == eIdxGlobal)
1145 if (indexInInside == 4)
1147 problem_.boundaryTypes(bcType, intersection);
1148 PrimaryVariables boundValues(0.0);
1151 if (bcType.isNeumann(pressureEqIdx))
1153 problem_.neumann(boundValues, intersection);
1154 boundValues *= faceVol/4.0;
1157 if (bcType.hasDirichlet())
1159 problem_.dirichlet(boundValues, intersection);
1163 else if (indexInInside == 3)
1165 problem_.boundaryTypes(bcType, intersection);
1166 PrimaryVariables boundValues(0.0);
1169 if (bcType.isNeumann(pressureEqIdx))
1171 problem_.neumann(boundValues, intersection);
1172 boundValues *= faceVol/4.0;
1175 if (bcType.hasDirichlet())
1177 problem_.dirichlet(boundValues, intersection);
1181 else if (indexInInside == 0)
1183 problem_.boundaryTypes(bcType, intersection);
1184 PrimaryVariables boundValues(0.0);
1187 if (bcType.isNeumann(pressureEqIdx))
1189 problem_.neumann(boundValues, intersection);
1190 boundValues *= faceVol/4.0;
1193 if (bcType.hasDirichlet())
1195 problem_.dirichlet(boundValues, intersection);
1200 if (elemVertMap[vIdxGlobal][6] == eIdxGlobal)
1202 if (indexInInside == 4)
1204 problem_.boundaryTypes(bcType, intersection);
1205 PrimaryVariables boundValues(0.0);
1208 if (bcType.isNeumann(pressureEqIdx))
1210 problem_.neumann(boundValues, intersection);
1211 boundValues *= faceVol/4.0;
1214 if (bcType.hasDirichlet())
1216 problem_.dirichlet(boundValues, intersection);
1220 else if (indexInInside == 2)
1222 problem_.boundaryTypes(bcType, intersection);
1223 PrimaryVariables boundValues(0.0);
1226 if (bcType.isNeumann(pressureEqIdx))
1228 problem_.neumann(boundValues, intersection);
1229 boundValues *= faceVol/4.0;
1232 if (bcType.hasDirichlet())
1234 problem_.dirichlet(boundValues, intersection);
1238 else if (indexInInside == 1)
1240 problem_.boundaryTypes(bcType, intersection);
1241 PrimaryVariables boundValues(0.0);
1244 if (bcType.isNeumann(pressureEqIdx))
1246 problem_.neumann(boundValues, intersection);
1247 boundValues *= faceVol/4.0;
1250 if (bcType.hasDirichlet())
1252 problem_.dirichlet(boundValues, intersection);
1257 if (elemVertMap[vIdxGlobal][7] == eIdxGlobal)
1259 if (indexInInside == 4)
1261 problem_.boundaryTypes(bcType, intersection);
1262 PrimaryVariables boundValues(0.0);
1265 if (bcType.isNeumann(pressureEqIdx))
1267 problem_.neumann(boundValues, intersection);
1268 boundValues *= faceVol/4.0;
1271 if (bcType.hasDirichlet())
1273 problem_.dirichlet(boundValues, intersection);
1277 else if (indexInInside == 0)
1279 problem_.boundaryTypes(bcType, intersection);
1280 PrimaryVariables boundValues(0.0);
1283 if (bcType.isNeumann(pressureEqIdx))
1285 problem_.neumann(boundValues, intersection);
1286 boundValues *= faceVol/4.0;
1289 if (bcType.hasDirichlet())
1291 problem_.dirichlet(boundValues, intersection);
1295 else if (indexInInside == 2)
1297 problem_.boundaryTypes(bcType, intersection);
1298 PrimaryVariables boundValues(0.0);
1301 if (bcType.isNeumann(pressureEqIdx))
1303 problem_.neumann(boundValues, intersection);
1304 boundValues *= faceVol/4.0;
1307 if (bcType.hasDirichlet())
1309 problem_.dirichlet(boundValues, intersection);
1476 const Vertex& vertex)
1478 const DimVector& centerPos = vertex.geometry().center();
1988 DUNE_THROW(Dune::NotImplemented,
"Boundary shape not implemented");