45 #include <boost/assign/std/vector.hpp>
51 namespace MultiRegions
63 DisContField3D::DisContField3D() :
65 m_bndCondExpansions (),
78 const std::string &variable,
79 const bool SetUpJustDG)
81 m_bndCondExpansions(),
85 if(variable.compare(
"DefaultVar") != 0)
112 for(f = 0; f < locExpList->GetExpSize(); ++f)
115 = (*m_exp)[ElmtID[cnt+f]]->
116 as<LocalRegions::Expansion3D>();
118 = locExpList->GetExp(f)->
119 as<LocalRegions::Expansion2D>();
121 exp3d->SetFaceExp(FaceID[cnt+f],exp2d);
122 exp2d->SetAdjacentElementExp(FaceID[cnt+f],exp3d);
136 const std::string &variable,
137 const bool SetUpJustDG)
167 for(f = 0; f < locExpList->GetExpSize(); ++f)
170 = (*m_exp)[ElmtID[cnt+f]]->
171 as<LocalRegions::Expansion3D>();
173 = locExpList->GetExp(f)->
174 as<LocalRegions::Expansion2D>();
176 exp3d->SetFaceExp(FaceID[cnt+f],exp2d);
177 exp2d->SetAdjacentElementExp(FaceID[cnt+f],exp3d);
216 for(f = 0; f < locExpList->GetExpSize(); ++f)
219 = (*m_exp)[ElmtID[cnt+f]]->
220 as<LocalRegions::Expansion3D>();
222 = locExpList->GetExp(f)->
223 as<LocalRegions::Expansion2D>();
225 exp3d->SetFaceExp(FaceID[cnt+f],exp2d);
226 exp2d->SetAdjacentElementExp(FaceID[cnt+f],exp3d);
232 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
234 std::string ProjectStr =
236 if (ProjectStr ==
"MixedCGDG" ||
237 ProjectStr ==
"Mixed_CG_Discontinuous")
259 m_bndCondExpansions (In.m_bndCondExpansions),
260 m_bndConditions (In.m_bndConditions),
261 m_globalBndMat (In.m_globalBndMat),
262 m_trace (In.m_trace),
263 m_traceMap (In.m_traceMap),
264 m_periodicFaces (In.m_periodicFaces),
265 m_periodicEdges (In.m_periodicEdges),
266 m_periodicVerts (In.m_periodicVerts)
281 "Routine currently only tested for HybridDGHelmholtz");
284 "The local to global map is not set up for the requested "
293 (*m_globalBndMat)[mkey] = glo_matrix;
297 glo_matrix = matrixIter->second;
324 bool UseGenSegExp =
true;
342 for (
int i = 0; i <
m_exp->size(); ++i)
344 for (
int j = 0; j < (*m_exp)[i]->GetNfaces(); ++j)
350 exp3d->SetFaceExp (j, exp2d);
359 for (
int i = 0; i <
m_trace->GetExpSize(); ++i)
364 int offset =
m_trace->GetPhys_Offset(i);
365 int traceGeomId = traceEl->GetGeom2D()->GetGlobalID();
371 if (traceGeomId != min(pIt->second[0].id, traceGeomId))
373 traceEl->GetLeftAdjacentElementExp()->NegateFaceNormal(
374 traceEl->GetLeftAdjacentElementFace());
377 else if (
m_traceMap->GetTraceToUniversalMapUnique(offset) < 0)
379 traceEl->GetLeftAdjacentElementExp()->NegateFaceNormal(
380 traceEl->GetLeftAdjacentElementFace());
395 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
402 boost::unordered_map<int,pair<int,int> > perFaceToExpMap;
403 boost::unordered_map<int,pair<int,int> >
::iterator it2;
406 for (
int n = 0; n <
m_exp->size(); ++n)
409 for (
int e = 0; e < exp3d->GetNfaces(); ++e, ++cnt)
412 exp3d->GetGeom3D()->GetFid(e));
416 perFaceToExpMap[it->first] = make_pair(n, e);
424 for (
int i = 0; i <
m_exp->size(); ++i)
426 for (
int j = 0; j < (*m_exp)[i]->GetNfaces(); ++j, ++cnt)
434 for (
int n = 0; n <
m_exp->size(); ++n)
437 for (
int e = 0; e < exp3d->GetNfaces(); ++e, ++cnt)
439 int faceGeomId = exp3d->
GetGeom3D()->GetFid(e);
440 int offset =
m_trace->GetPhys_Offset(
441 elmtToTrace[n][e]->GetElmtId());
449 it2 = perFaceToExpMap.find(ent.
id);
451 if (it2 == perFaceToExpMap.end())
453 if (
m_session->GetComm()->GetSize() > 1 &&
460 ASSERTL1(
false,
"Periodic edge not found!");
465 "Periodic face in non-forward space?");
467 int offset2 =
m_trace->GetPhys_Offset(
468 elmtToTrace[it2->second.first][it2->second.second]->
473 int nquad1 = elmtToTrace[n][e]->GetNumPoints(0);
474 int nquad2 = elmtToTrace[n][e]->GetNumPoints(1);
476 vector<int> tmpBwd(nquad1*nquad2);
477 vector<int> tmpFwd(nquad1*nquad2);
484 for (
int i = 0; i < nquad2; ++i)
486 for (
int j = 0; j < nquad1; ++j)
488 tmpBwd[i*nquad1+j] = offset2 + i*nquad1+j;
489 tmpFwd[i*nquad1+j] = offset + j*nquad2+i;
495 for (
int i = 0; i < nquad2; ++i)
497 for (
int j = 0; j < nquad1; ++j)
499 tmpBwd[i*nquad1+j] = offset2 + i*nquad1+j;
500 tmpFwd[i*nquad1+j] = offset + i*nquad1+j;
511 for (
int i = 0; i < nquad2; ++i)
513 for (
int j = 0; j < nquad1/2; ++j)
515 swap(tmpFwd[i*nquad1 + j],
516 tmpFwd[i*nquad1 + nquad1-j-1]);
527 for (
int j = 0; j < nquad1; ++j)
529 for (
int i = 0; i < nquad2/2; ++i)
531 swap(tmpFwd[i*nquad1 + j],
532 tmpFwd[(nquad2-i-1)*nquad1 + j]);
537 for (
int i = 0; i < nquad1*nquad2; ++i)
558 bool returnval =
true;
578 int vSame = returnval ? 1 : 0;
599 const std::string &variable)
609 SpatialDomains::BoundaryRegionCollection::const_iterator it;
612 for (it = bregions.begin(); it != bregions.end(); ++it)
616 if (boundaryCondition->GetBoundaryConditionType() !=
629 for (it = bregions.begin(); it != bregions.end(); ++it)
632 bconditions, it->first, variable);
634 if(locBCond->GetBoundaryConditionType()
642 if(locBCond->GetBoundaryConditionType() !=
649 m_bndConditions[cnt++] = locBCond;
663 const std::string &variable)
670 = boost::dynamic_pointer_cast<
672 SpatialDomains::BoundaryRegionCollection::const_iterator it;
695 map<int,int> perComps;
696 map<int,vector<int> > allVerts;
697 map<int,SpatialDomains::PointGeomVector> allCoord;
698 map<int,vector<int> > allEdges;
699 map<int,vector<StdRegions::Orientation> > allOrient;
704 int region1ID, region2ID, i, j, k, cnt;
708 for(i = 0; i < (*m_exp).size(); ++i)
710 for(j = 0; j < (*m_exp)[i]->GetNverts(); ++j)
712 int id = (*m_exp)[i]->GetGeom()->GetVid(j);
716 for(j = 0; j < (*m_exp)[i]->GetNedges(); ++j)
718 int id = (*m_exp)[i]->GetGeom()->GetEid(j);
726 for (it = bregions.begin(); it != bregions.end(); ++it)
729 bconditions, it->first, variable);
731 if (locBCond->GetBoundaryConditionType()
738 region1ID = it->first;
739 region2ID = boost::static_pointer_cast<
741 locBCond)->m_connectedBoundaryRegion;
745 "Boundary region "+boost::lexical_cast<
string>(
746 region1ID)+
" should only contain 1 composite.");
754 if (vComm->GetSize() == 1)
756 cId1 = it->second->begin()->first;
757 cId2 = bregions.find(region2ID)->second->begin()->first;
761 cId1 = bndRegOrder.find(region1ID)->second[0];
762 cId2 = bndRegOrder.find(region2ID)->second[0];
766 vector<unsigned int> tmpOrder;
772 for (i = 0; i < c->size(); ++i)
775 boost::dynamic_pointer_cast<
777 ASSERTL1(faceGeom,
"Unable to cast to shared ptr");
780 int faceId = (*c)[i]->GetGlobalID();
781 locFaces.insert(faceId);
785 if (vComm->GetSize() == 1)
787 tmpOrder.push_back((*c)[i]->GetGlobalID());
792 vector<int> vertList, edgeList;
794 vector<StdRegions::Orientation> orientVec;
795 for (j = 0; j < faceGeom->GetNumVerts(); ++j)
797 vertList .push_back(faceGeom->GetVid (j));
798 edgeList .push_back(faceGeom->GetEid (j));
799 coordVec .push_back(faceGeom->GetVertex(j));
800 orientVec.push_back(faceGeom->GetEorient(j));
803 allVerts [faceId] = vertList;
804 allEdges [faceId] = edgeList;
805 allCoord [faceId] = coordVec;
806 allOrient[faceId] = orientVec;
811 if (vComm->GetSize() == 1)
813 compOrder[it->second->begin()->first] = tmpOrder;
819 if (perComps.count(cId1) == 0)
821 if (perComps.count(cId2) == 0)
823 perComps[cId1] = cId2;
827 std::stringstream ss;
828 ss <<
"Boundary region " << cId2 <<
" should be "
829 <<
"periodic with " << perComps[cId2] <<
" but "
830 <<
"found " << cId1 <<
" instead!";
831 ASSERTL0(perComps[cId2] == cId1, ss.str());
836 std::stringstream ss;
837 ss <<
"Boundary region " << cId1 <<
" should be "
838 <<
"periodic with " << perComps[cId1] <<
" but "
839 <<
"found " << cId2 <<
" instead!";
840 ASSERTL0(perComps[cId1] == cId1, ss.str());
846 int n = vComm->GetSize();
847 int p = vComm->GetRank();
855 facecounts[p] = locFaces.size();
861 for (i = 1; i < n; ++i)
863 faceoffset[i] = faceoffset[i-1] + facecounts[i-1];
878 for (i = 0, sIt = locFaces.begin(); sIt != locFaces.end(); ++sIt)
880 faceIds [faceoffset[p] + i ] = *sIt;
881 faceVerts[faceoffset[p] + i++] = allVerts[*sIt].size();
904 for (i = 0; i < n; ++i)
906 if (facecounts[i] > 0)
909 facecounts[i], faceVerts + faceoffset[i], 1);
920 for (i = 1; i < n; ++i)
922 vertoffset[i] = vertoffset[i-1] + procVerts[i-1];
936 for (cnt = 0, sIt = locFaces.begin();
937 sIt != locFaces.end(); ++sIt)
939 for (j = 0; j < allVerts[*sIt].size(); ++j)
941 int vertId = allVerts[*sIt][j];
942 vertIds[vertoffset[p] + cnt ] = vertId;
943 vertX [vertoffset[p] + cnt ] = (*allCoord[*sIt][j])(0);
944 vertY [vertoffset[p] + cnt ] = (*allCoord[*sIt][j])(1);
945 vertZ [vertoffset[p] + cnt ] = (*allCoord[*sIt][j])(2);
946 edgeIds[vertoffset[p] + cnt ] = allEdges [*sIt][j];
947 edgeOrt[vertoffset[p] + cnt++] = allOrient[*sIt][j];
962 map<int, vector<int> > vertMap;
963 map<int, vector<int> > edgeMap;
964 map<int, SpatialDomains::PointGeomVector> coordMap;
970 map<int, SpatialDomains::PointGeomSharedPtr> vCoMap;
971 map<int, pair<int, int> > eIdMap;
973 for (cnt = i = 0; i < totFaces; ++i)
975 vector<int> edges(faceVerts[i]);
976 vector<int> verts(faceVerts[i]);
982 for (j = 0; j < faceVerts[i]; ++j, ++cnt)
984 edges[j] = edgeIds[cnt];
985 verts[j] = vertIds[cnt];
988 3, verts[j], vertX[cnt], vertY[cnt], vertZ[cnt]);
989 vCoMap[vertIds[cnt]] = coord[j];
992 pair<map<int, pair<int, int> >
::iterator,
bool> testIns =
993 eIdMap.insert(make_pair(
995 make_pair(vertIds[tmp+j],
996 vertIds[tmp+((j+1) % faceVerts[i])])));
998 if (testIns.second ==
false)
1010 swap(testIns.first->second.first,
1011 testIns.first->second.second);
1015 vertMap [faceIds[i]] = verts;
1016 edgeMap [faceIds[i]] = edges;
1017 coordMap[faceIds[i]] = coord;
1024 map<int,int>::const_iterator oIt;
1038 map<int, map<StdRegions::Orientation, vector<int> > > vmap;
1039 map<int, map<StdRegions::Orientation, vector<int> > > emap;
1041 map<StdRegions::Orientation, vector<int> > quadVertMap;
1051 map<StdRegions::Orientation, vector<int> > quadEdgeMap;
1061 map<StdRegions::Orientation, vector<int> > triVertMap;
1065 map<StdRegions::Orientation, vector<int> > triEdgeMap;
1069 vmap[3] = triVertMap;
1070 vmap[4] = quadVertMap;
1071 emap[3] = triEdgeMap;
1072 emap[4] = quadEdgeMap;
1074 map<int,int> allCompPairs;
1079 for (cIt = perComps.begin(); cIt != perComps.end(); ++cIt)
1082 const int id1 = cIt->first;
1083 const int id2 = cIt->second;
1084 std::string id1s = boost::lexical_cast<
string>(id1);
1085 std::string id2s = boost::lexical_cast<
string>(id2);
1087 if (compMap.count(id1) > 0)
1089 c[0] = compMap[id1];
1092 if (compMap.count(id2) > 0)
1094 c[1] = compMap[id2];
1098 "Neither composite not found on this process!");
1103 map<int,int> compPairs;
1106 "Unable to find composite "+id1s+
" in order map.");
1108 "Unable to find composite "+id2s+
" in order map.");
1109 ASSERTL0(compOrder[id1].size() == compOrder[id2].size(),
1110 "Periodic composites "+id1s+
" and "+id2s+
1111 " should have the same number of elements.");
1112 ASSERTL0(compOrder[id1].size() > 0,
1113 "Periodic composites "+id1s+
" and "+id2s+
1117 for (i = 0; i < compOrder[id1].size(); ++i)
1119 int eId1 = compOrder[id1][i];
1120 int eId2 = compOrder[id2][i];
1122 ASSERTL0(compPairs.count(eId1) == 0,
1126 if (compPairs.count(eId2) != 0)
1128 ASSERTL0(compPairs[eId2] == eId1,
"Pairing incorrect");
1130 compPairs[eId1] = eId2;
1136 for (pIt = compPairs.begin(); pIt != compPairs.end(); ++pIt)
1138 int ids [2] = {pIt->first, pIt->second};
1139 bool local[2] = {locFaces.count(pIt->first) > 0,
1140 locFaces.count(pIt->second) > 0};
1142 ASSERTL0(coordMap.count(ids[0]) > 0 &&
1143 coordMap.count(ids[1]) > 0,
1144 "Unable to find face in coordinate map");
1146 allCompPairs[pIt->first ] = pIt->second;
1147 allCompPairs[pIt->second] = pIt->first;
1152 = { coordMap[ids[0]], coordMap[ids[1]] };
1154 ASSERTL0(tmpVec[0].size() == tmpVec[1].size(),
1155 "Two periodic faces have different number "
1166 for (i = 0; i < 2; ++i)
1174 int other = (i+1) % 2;
1177 if (tmpVec[0].size() == 3)
1180 tmpVec[i], tmpVec[other]);
1185 tmpVec[i], tmpVec[other]);
1195 int nFaceVerts = vertMap[ids[0]].size();
1198 for (i = 0; i < 2; ++i)
1200 int other = (i+1) % 2;
1203 if (tmpVec[0].size() == 3)
1206 tmpVec[i], tmpVec[other]);
1211 tmpVec[i], tmpVec[other]);
1214 if (nFaceVerts == 3)
1219 "Unsupported face orientation for face "+
1220 boost::lexical_cast<string>(ids[i]));
1224 vector<int> per1 = vertMap[ids[i]];
1225 vector<int> per2 = vertMap[ids[other]];
1229 map<int, pair<int, bool> > tmpMap;
1234 for (j = 0; j < nFaceVerts; ++j)
1236 int v = vmap[nFaceVerts][o][j];
1237 tmpMap[per1[j]] = make_pair(
1238 per2[v], locVerts.count(per2[v]) > 0);
1242 for (mIt = tmpMap.begin(); mIt != tmpMap.end(); ++mIt)
1246 mIt->second.second);
1252 if (perIt == periodicVerts.end())
1256 periodicVerts[mIt->first].push_back(ent2);
1257 perIt = periodicVerts.find(mIt->first);
1264 for (k = 0; k < perIt->second.size(); ++k)
1266 if (perIt->second[k].id == mIt->second.first)
1272 if (k == perIt->second.size())
1274 perIt->second.push_back(ent2);
1282 for (i = 0; i < 2; ++i)
1284 int other = (i+1) % 2;
1286 if (tmpVec[0].size() == 3)
1289 tmpVec[i], tmpVec[other]);
1294 tmpVec[i], tmpVec[other]);
1297 vector<int> per1 = edgeMap[ids[i]];
1298 vector<int> per2 = edgeMap[ids[other]];
1300 map<int, pair<int, bool> > tmpMap;
1303 for (j = 0; j < nFaceVerts; ++j)
1305 int e = emap[nFaceVerts][o][j];
1306 tmpMap[per1[j]] = make_pair(
1307 per2[e], locEdges.count(per2[e]) > 0);
1310 for (mIt = tmpMap.begin(); mIt != tmpMap.end(); ++mIt)
1316 mIt->second.second);
1320 if (perIt == periodicEdges.end())
1322 periodicEdges[mIt->first].push_back(ent2);
1323 perIt = periodicEdges.find(mIt->first);
1327 for (k = 0; k < perIt->second.size(); ++k)
1329 if (perIt->second[k].id == mIt->second.first)
1335 if (k == perIt->second.size())
1337 perIt->second.push_back(ent2);
1346 pairSizes[p] = allCompPairs.size();
1354 for (i = 1; i < n; ++i)
1356 pairOffsets[i] = pairOffsets[i-1] + pairSizes[i-1];
1362 cnt = pairOffsets[p];
1364 for (pIt = allCompPairs.begin(); pIt != allCompPairs.end(); ++pIt)
1366 first [cnt ] = pIt->first;
1367 second[cnt++] = pIt->second;
1373 allCompPairs.clear();
1375 for(cnt = 0; cnt < totPairSizes; ++cnt)
1377 allCompPairs[first[cnt]] = second[cnt];
1384 for (cnt = i = 0; i < totFaces; ++i)
1386 int faceId = faceIds[i];
1388 ASSERTL0(allCompPairs.count(faceId) > 0,
1389 "Unable to find matching periodic face.");
1391 int perFaceId = allCompPairs[faceId];
1393 for (j = 0; j < faceVerts[i]; ++j, ++cnt)
1395 int vId = vertIds[cnt];
1399 if (perId == periodicVerts.end())
1407 = { coordMap[faceId], coordMap[perFaceId] };
1409 int nFaceVerts = tmpVec[0].size();
1412 tmpVec[0], tmpVec[1]) :
1414 tmpVec[0], tmpVec[1]);
1418 int perVertexId = vertMap[perFaceId][vmap[nFaceVerts][o][j]];
1423 locVerts.count(perVertexId) > 0);
1425 periodicVerts[vId].push_back(ent);
1428 int eId = edgeIds[cnt];
1430 perId = periodicEdges.find(eId);
1432 if (perId == periodicEdges.end())
1440 = { coordMap[faceId], coordMap[perFaceId] };
1442 int nFaceEdges = tmpVec[0].size();
1445 tmpVec[0], tmpVec[1]) :
1447 tmpVec[0], tmpVec[1]);
1451 int perEdgeId = edgeMap[perFaceId][emap[nFaceEdges][o][j]];
1456 locEdges.count(perEdgeId) > 0);
1458 periodicEdges[eId].push_back(ent);
1466 for (perIt = periodicVerts.begin();
1467 perIt != periodicVerts.end(); ++perIt)
1470 for (i = 0; i < perIt->second.size(); ++i)
1473 perIt2 = periodicVerts.find(perIt->second[i].id);
1474 ASSERTL0(perIt2 != periodicVerts.end(),
1475 "Couldn't find periodic vertex.");
1480 for (j = 0; j < perIt2->second.size(); ++j)
1482 if (perIt2->second[j].id == perIt->first)
1487 for (k = 0; k < perIt->second.size(); ++k)
1489 if (perIt2->second[j].id == perIt->second[k].id)
1495 if (k == perIt->second.size())
1497 perIt->second.push_back(perIt2->second[j]);
1503 for (perIt = periodicEdges.begin();
1504 perIt != periodicEdges.end(); ++perIt)
1506 for (i = 0; i < perIt->second.size(); ++i)
1508 perIt2 = periodicEdges.find(perIt->second[i].id);
1509 ASSERTL0(perIt2 != periodicEdges.end(),
1510 "Couldn't find periodic edge.");
1512 for (j = 0; j < perIt2->second.size(); ++j)
1514 if (perIt2->second[j].id == perIt->first)
1519 for (k = 0; k < perIt->second.size(); ++k)
1521 if (perIt2->second[j].id == perIt->second[k].id)
1527 if (k == perIt->second.size())
1529 perIt->second.push_back(perIt2->second[j]);
1536 for (perIt = periodicEdges.begin();
1537 perIt != periodicEdges.end(); perIt++)
1541 = eIdMap.find(perIt->first);
1543 *vCoMap[eIt->second.first],
1544 *vCoMap[eIt->second.second]
1550 for (i = 0; i < perIt->second.size(); ++i)
1552 eIt = eIdMap.find(perIt->second[i].id);
1555 *vCoMap[eIt->second.first],
1556 *vCoMap[eIt->second.second]
1559 NekDouble cx = 0.5*(w[0](0)-v[0](0)+w[1](0)-v[1](0));
1560 NekDouble cy = 0.5*(w[0](1)-v[0](1)+w[1](1)-v[1](1));
1561 NekDouble cz = 0.5*(w[0](2)-v[0](2)+w[1](2)-v[1](2));
1563 int vMap[2] = {-1,-1};
1564 for (j = 0; j < 2; ++j)
1569 for (k = 0; k < 2; ++k)
1575 if (sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y)+(z1-z)*(z1-z))
1585 ASSERTL0(vMap[0] >= 0 && vMap[1] >= 0,
1586 "Unable to align periodic vertices.");
1587 ASSERTL0((vMap[0] == 0 || vMap[0] == 1) &&
1588 (vMap[1] == 0 || vMap[1] == 1) &&
1589 (vMap[0] != vMap[1]),
1590 "Unable to align periodic vertices.");
1603 for (perIt = periodicVerts.begin();
1604 perIt != periodicVerts.end(); ++perIt)
1606 if (locVerts.count(perIt->first) > 0)
1612 for (perIt = periodicEdges.begin();
1613 perIt != periodicEdges.end(); ++perIt)
1615 if (locEdges.count(perIt->first) > 0)
1627 as<LocalRegions::Expansion2D>();
1629 int offset =
m_trace->GetPhys_Offset(traceEl->GetElmtId());
1632 if (traceEl->GetLeftAdjacentElementFace () == -1 ||
1633 traceEl->GetRightAdjacentElementFace() == -1)
1643 int traceGeomId = traceEl->GetGeom2D()->GetGlobalID();
1649 fwd = traceGeomId == min(traceGeomId,pIt->second[0].id);
1654 GetTraceToUniversalMapUnique(offset) >= 0;
1658 else if (traceEl->GetLeftAdjacentElementFace () != -1 &&
1659 traceEl->GetRightAdjacentElementFace() != -1)
1663 (traceEl->GetLeftAdjacentElementExp().get()) ==
1668 ASSERTL2(
false,
"Unconnected trace element!");
1713 int cnt, n, e,
npts, offset, phys_offset;
1721 boost::unordered_map<int,pair<int,int> >
::iterator it3;
1730 for(cnt = n = 0; n < nexp; ++n)
1734 for(e = 0; e < exp3d->GetNfaces(); ++e, ++cnt)
1736 offset =
m_trace->GetPhys_Offset(
1737 elmtToTrace[n][e]->GetElmtId());
1742 exp3d->GetFacePhysVals(e, elmtToTrace[n][e],
1743 field + phys_offset,
1744 e_tmp = Fwd + offset);
1748 exp3d->GetFacePhysVals(e, elmtToTrace[n][e],
1749 field + phys_offset,
1750 e_tmp = Bwd + offset);
1768 id2 =
m_trace->GetPhys_Offset(
1769 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1786 id2 =
m_trace->GetPhys_Offset(
1787 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1790 "method not set up for non-zero Neumann "
1791 "boundary condition");
1800 ASSERTL0(
false,
"Method only set up for Dirichlet, Neumann "
1801 "and Robin conditions.");
1820 "Field is not in physical space.");
1831 int n,e,offset,phys_offset;
1837 "input array is of insufficient length");
1840 for(n = 0; n < nexp; ++n)
1844 for(e = 0; e < (*m_exp)[n]->GetNfaces(); ++e)
1846 offset =
m_trace->GetPhys_Offset(elmtToTrace[n][e]->GetElmtId());
1847 (*m_exp)[n]->GetFacePhysVals(e, elmtToTrace[n][e],
1848 inarray + phys_offset,
1849 e_tmp = outarray + offset);
1876 int e,n,offset, t_offset;
1884 e_outarray = outarray+offset;
1885 for(e = 0; e < (*m_exp)[n]->GetNfaces(); ++e)
1887 t_offset =
m_trace->GetPhys_Offset(
1888 elmtToTrace[n][e]->GetElmtId());
1889 (*m_exp)[n]->AddFaceNormBoundaryInt(e,
1924 int e,n,offset, t_offset;
1932 for(e = 0; e < (*m_exp)[n]->GetNfaces(); ++e)
1934 t_offset =
m_trace->GetPhys_Offset(elmtToTrace[n][e]->GetElmtId());
1939 (*m_exp)[n]->AddFaceNormBoundaryInt(
1940 e, elmtToTrace[n][e], Fwd + t_offset,
1941 e_outarray = outarray+offset);
1945 (*m_exp)[n]->AddFaceNormBoundaryInt(
1946 e, elmtToTrace[n][e], Bwd + t_offset,
1947 e_outarray = outarray+offset);
1961 map<int,int> globalIdMap;
1976 globalIdMap[exp3d->GetGeom3D()->GetGlobalID()] = i;
1986 if(ElmtID.num_elements() != nbcs)
1991 if(FaceID.num_elements() != nbcs)
2002 as<LocalRegions::Expansion2D>();
2005 graph3D->GetElementsFromFace(exp2d->GetGeom2D());
2007 ElmtID[cnt] = globalIdMap[(*tmp)[0]->
2008 m_Element->GetGlobalID()];
2009 FaceID[cnt] = (*tmp)[0]->m_FaceIndx;
2039 int i,j,n,cnt,cnt1,nbndry;
2056 int GloBndDofs =
m_traceMap->GetNumGlobalBndCoeffs();
2057 int NumDirichlet =
m_traceMap->GetNumLocalDirBndCoeffs();
2075 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
2084 for(cnt = cnt1 = n = 0; n < nexp; ++n)
2090 e_l = loc_lambda + cnt1;
2097 Floc =
Transpose(*(HDGLamToU->GetBlock(n,n)))*ElmtFce;
2115 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
2124 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
2134 if(GloBndDofs - NumDirichlet > 0)
2151 m_traceMap->GlobalToLocalBnd(BndSol,loc_lambda);
2154 out = (*InvHDGHelm)*F + (*HDGLamToU)*LocLambda;
2171 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
2176 m_traceMap->GlobalToLocalBnd(inarray, loc_lambda);
2177 LocLambda = (*HDGHelm) * LocLambda;
2178 m_traceMap->AssembleBnd(loc_lambda,outarray);
2197 map<int, RobinBCInfoSharedPtr> returnval;
2212 for(e = 0; e < locExpList->GetExpSize(); ++e)
2215 elmtid = ElmtID[cnt+e];
2217 if(returnval.count(elmtid) != 0)
2219 rInfo->next = returnval.find(elmtid)->second;
2221 returnval[elmtid] = rInfo;
2253 int i,cnt,f,ncoeff_face;
2258 int eid,nq_elmt, nm_elmt;
2259 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
2264 face_lambda = loc_lambda;
2273 nq_elmt = (*m_exp)[eid]->GetTotPoints();
2274 nm_elmt = (*m_exp)[eid]->GetNcoeffs();
2278 out_tmp = force + nm_elmt;
2281 int num_points0 = (*m_exp)[eid]->GetBasis(0)->GetNumPoints();
2282 int num_points1 = (*m_exp)[eid]->GetBasis(1)->GetNumPoints();
2283 int num_points2 = (*m_exp)[eid]->GetBasis(2)->GetNumPoints();
2284 int num_modes0 = (*m_exp)[eid]->GetBasis(0)->GetNumModes();
2285 int num_modes1 = (*m_exp)[eid]->GetBasis(1)->GetNumModes();
2286 int num_modes2 = (*m_exp)[eid]->GetBasis(2)->GetNumModes();
2291 int nFaces = (*m_exp)[eid]->GetNfaces();
2293 for(f = 0; f < nFaces; ++f)
2295 ncoeff_face = elmtToTrace[eid][f]->GetNcoeffs();
2297 Vmath::Vcopy(ncoeff_face, face_lambda, 1, faceCoeffs[f], 1);
2298 exp->SetFaceToGeomOrientation(f, faceCoeffs[f]);
2299 face_lambda = face_lambda + ncoeff_face;
2343 ASSERTL0(
false,
"Wrong shape type, HDG postprocessing is not implemented");
2349 (*m_exp)[eid]->DGDeriv(
2351 elmtToTrace[eid], faceCoeffs, out_tmp);
2352 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2353 ppExp->IProductWRTDerivBase(0,qrhs,force);
2357 (*m_exp)[eid]->DGDeriv(
2359 elmtToTrace[eid], faceCoeffs, out_tmp);
2360 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2361 ppExp->IProductWRTDerivBase(1,qrhs,out_tmp);
2366 (*m_exp)[eid]->DGDeriv(
2368 elmtToTrace[eid], faceCoeffs, out_tmp);
2369 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2370 ppExp->IProductWRTDerivBase(2,qrhs,out_tmp);
2374 (*m_exp)[eid]->BwdTrans(
2376 force[0] = (*m_exp)[eid]->Integral(qrhs);
2390 ppExp->BwdTrans(out.
GetPtr(), work);
2391 (*m_exp)[eid]->FwdTrans(work,
2430 const std::string varName,
2439 for (i = 0; i < nbnd; ++i)
2444 npoints = locExpList->GetNpoints();
2450 locExpList->GetCoords(x0, x1, x2);
2455 string filebcs = boost::static_pointer_cast<
2469 condition.
Evaluate(x0, x1, x2, time,
2470 locExpList->UpdatePhys());
2472 locExpList->FwdTrans_BndConstrained(
2473 locExpList->GetPhys(),
2474 locExpList->UpdateCoeffs());
2485 condition.
Evaluate(x0, x1, x2, time,
2486 locExpList->UpdatePhys());
2488 locExpList->IProductWRTBase(locExpList->GetPhys(),
2489 locExpList->UpdateCoeffs());
2504 condition.
Evaluate(x0, x1, x2, time,
2505 locExpList->UpdatePhys());
2507 locExpList->IProductWRTBase(locExpList->GetPhys(),
2508 locExpList->UpdateCoeffs());
2512 coeff.Evaluate(x0, x1, x2, time,
2513 locExpList->UpdatePhys());
2518 ASSERTL0(
false,
"This type of BC not implemented yet");
GlobalSysSolnType GetGlobalSysSolnType() const
Return the associated solution type.
const DNekScalBlkMatSharedPtr & GetBlockMatrix(const GlobalMatrixKey &gkey)
boost::shared_ptr< MeshGraph3D > MeshGraph3DSharedPtr
#define ASSERTL0(condition, msg)
virtual void v_Reset()
Reset geometry information, metrics, matrix managers and geometry information.
virtual ~DisContField3D()
Destructor.
GlobalLinSysSharedPtr GetGlobalBndLinSys(const GlobalLinSysKey &mkey)
boost::shared_ptr< ElementFaceVector > ElementFaceVectorSharedPtr
virtual void v_ExtractTracePhys(Array< OneD, NekDouble > &outarray)
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
int GetCoeff_Offset(int n) const
Get the start offset position for a global list of m_coeffs correspoinding to element n...
static ExpListSharedPtr NullExpListSharedPtr
void EvaluateBoundaryConditions(const NekDouble time=0.0, const std::string varName="", const NekDouble=NekConstants::kNekUnsetDouble, const NekDouble=NekConstants::kNekUnsetDouble)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
std::map< int, vector< PeriodicEntity > > PeriodicMap
std::vector< PointGeomSharedPtr > PointGeomVector
void SetAdjacentElementExp(int face, Expansion3DSharedPtr &f)
bool isLocal
Flag specifying if this entity is local to this partition.
int GetPhys_Offset(int n) const
Get the start offset position for a global list of m_phys correspoinding to element n...
bool IsLeftAdjacentFace(const int n, const int e)
const BoundaryConditionCollection & GetBoundaryConditions(void) const
void ExtractFileBCs(const std::string &fileName, const std::string &varName, const boost::shared_ptr< ExpList > locExpList)
GlobalLinSysMapShPtr m_globalBndMat
boost::shared_ptr< RobinBCInfo > RobinBCInfoSharedPtr
SpatialDomains::Geometry3DSharedPtr GetGeom3D() const
std::set< int > m_boundaryFaces
A set storing the global IDs of any boundary faces.
PeriodicMap m_periodicFaces
A map which identifies pairs of periodic faces.
virtual void v_GetFwdBwdTracePhys(Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
This method extracts the "forward" and "backward" trace data from the array field and puts the data i...
std::map< int, std::vector< unsigned int > > BndRegionOrdering
std::map< ConstFactorType, NekDouble > ConstFactorMap
void GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Array< OneD, NekDouble > m_phys
The global expansion evaluated at the quadrature points.
void EvaluateHDGPostProcessing(Array< OneD, NekDouble > &outarray)
Evaluate HDG post-processing to increase polynomial order of solution.
std::map< int, std::vector< unsigned int > > CompositeOrdering
virtual void v_AddFwdBwdTraceIntegral(const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &outarray)
Add trace contributions into elemental coefficient spaces.
void ApplyGeomInfo()
Apply geometry information to each expansion.
boost::shared_ptr< HexGeom > HexGeomSharedPtr
Array< OneD, NekDouble > m_coeffs
Concatenation of all local expansion coefficients.
int GetExpSize(void)
This function returns the number of elements in the expansion.
virtual void v_EvaluateBoundaryConditions(const NekDouble time=0.0, const std::string varName="", const NekDouble x2_in=NekConstants::kNekUnsetDouble, const NekDouble x3_in=NekConstants::kNekUnsetDouble)
This function evaluates the boundary conditions at a certain time-level.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
boost::shared_ptr< GlobalLinSys > GenGlobalBndLinSys(const GlobalLinSysKey &mkey, const AssemblyMapSharedPtr &locToGloMap)
Generate a GlobalLinSys from information provided by the key "mkey" and the mapping provided in LocTo...
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
Gauss Radau pinned at x=-1, .
Principle Orthogonal Functions .
void FindPeriodicFaces(const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
Determine the periodic faces, edges and vertices for the given graph.
vector< bool > m_leftAdjacentFaces
Array< OneD, int > m_coeff_offset
Offset of elemental data into the array m_coeffs.
virtual map< int, RobinBCInfoSharedPtr > v_GetRobinBCInfo()
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
static StdRegions::Orientation GetFaceOrientation(const QuadGeom &face1, const QuadGeom &face2)
Get the orientation of face1.
The base class for all shapes.
boost::shared_ptr< LocalRegions::ExpansionVector > m_exp
The list of local expansions.
DisContField3D()
Default constructor.
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
vector< int > m_periodicBwdCopy
boost::shared_ptr< Expansion3D > Expansion3DSharedPtr
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
int id
Geometry ID of entity.
bool m_physState
The state of the array m_phys.
NekDouble Evaluate() const
int m_ncoeffs
The total number of local degrees of freedom. m_ncoeffs .
Array< OneD, int > m_offset_elmt_id
Array containing the element id m_offset_elmt_id[n] that the n^th consecutive block of data in m_coef...
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
boost::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Principle Orthogonal Functions .
Principle Orthogonal Functions .
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
SpatialDomains::MeshGraphSharedPtr m_graph
Mesh associated with this expansion list.
void GenerateBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph3D, const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
virtual void v_GeneralMatrixOp(const GlobalMatrixKey &gkey, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
Calculates the result of the multiplication of a global matrix of type specified by mkey with a vecto...
LibUtilities::SessionReaderSharedPtr m_session
Session.
Defines a specification for a set of points.
void Neg(int n, T *x, const int incx)
Negate x = -x.
void SetUpDG(const std::string="DefaultVar")
Set up all DG member variables and maps.
bool SameTypeOfBoundaryConditions(const DisContField3D &In)
std::map< int, BoundaryConditionMapShPtr > BoundaryConditionCollection
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
boost::shared_ptr< GeometryVector > Composite
Describe a linear system.
std::map< int, Composite > CompositeMap
StdRegions::Orientation orient
Orientation of entity within higher dimensional entity.
StdRegions::MatrixType GetMatrixType() const
Return the matrix type.
Describes a matrix with ordering defined by a local to global map.
const Array< OneD, const NekDouble > & GetPhys() const
This function returns (a reference to) the array (implemented as m_phys) containing the function ev...
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
LibUtilities::CommSharedPtr m_comm
Communicator.
static AssemblyMapSharedPtr NullAssemblyMapSharedPtr
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
virtual void v_HelmSolve(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const FlagList &flags, const StdRegions::ConstFactorMap &factors, const StdRegions::VarCoeffMap &varcoeff, const Array< OneD, const NekDouble > &dirForcing)
virtual void v_GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &FaceID)
Set up a list of elemeent IDs and edge IDs that link to the boundary conditions.
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
virtual void v_Reset()
Reset this field, so that geometry information can be updated.
boost::shared_ptr< Expansion > ExpansionSharedPtr
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
boost::shared_ptr< PrismGeom > PrismGeomSharedPtr
vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
Gauss Radau pinned at x=-1, .
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
int GetNcoeffs(void) const
Returns the total number of local degrees of freedom .
AssemblyMapDGSharedPtr m_traceMap
boost::shared_ptr< TetGeom > TetGeomSharedPtr
Abstraction of a three-dimensional multi-elemental expansion which is merely a collection of local ex...
static SpatialDomains::BoundaryConditionShPtr GetBoundaryCondition(const SpatialDomains::BoundaryConditionCollection &collection, unsigned int index, const std::string &variable)
boost::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
static StdRegions::Orientation GetFaceOrientation(const TriGeom &face1, const TriGeom &face2)
const BoundaryRegionCollection & GetBoundaryRegions(void) const
boost::shared_ptr< BoundaryConditionBase > BoundaryConditionShPtr
T Vsum(int n, const T *x, const int incx)
Subtract return sum(x)
void Zero(int n, T *x, const int incx)
Zero vector.
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Describes the specification for a Basis.
Array< OneD, DataType > & GetPtr()
1D Gauss-Lobatto-Legendre quadrature points
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
virtual void v_AddTraceIntegral(const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
Add trace contributions into elemental coefficient spaces.
PeriodicMap m_periodicEdges
A map which identifies groups of periodic edges.
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr