50 namespace MultiRegions
54 m_bndCondExpansions(),
62 const bool DeclareCoeffPhysArrays)
64 m_bndCondExpansions (In.m_bndCondExpansions),
65 m_bndConditions (In.m_bndConditions),
66 m_globalBndMat (In.m_globalBndMat),
67 m_traceMap (In.m_traceMap),
68 m_boundaryEdges (In.m_boundaryEdges),
69 m_periodicVerts (In.m_periodicVerts),
70 m_periodicEdges (In.m_periodicEdges),
71 m_periodicFwdCopy (In.m_periodicFwdCopy),
72 m_periodicBwdCopy (In.m_periodicBwdCopy),
73 m_leftAdjacentEdges (In.m_leftAdjacentEdges)
78 *boost::dynamic_pointer_cast<ExpList1D>(In.
m_trace),
79 DeclareCoeffPhysArrays);
86 const std::string &variable,
87 const bool SetUpJustDG,
88 const bool DeclareCoeffPhysArrays)
89 :
ExpList2D(pSession,graph2D,DeclareCoeffPhysArrays,variable),
90 m_bndCondExpansions(),
99 if(variable.compare(
"DefaultVar") != 0)
103 DeclareCoeffPhysArrays);
105 if (DeclareCoeffPhysArrays)
122 Array<OneD, int> ElmtID, EdgeID;
131 for(e = 0; e < locExpList->GetExpSize(); ++e)
134 (*m_exp)[ElmtID[cnt+e]]->
135 as<LocalRegions::Expansion2D>();
137 locExpList->GetExp(e)->
138 as<LocalRegions::Expansion1D>();
140 locExpList->GetExp(e)->
141 as<LocalRegions::Expansion> ();
143 exp2d->SetEdgeExp(EdgeID[cnt+e], exp);
144 exp1d->SetAdjacentElementExp(EdgeID[cnt+e], exp2d);
149 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
151 std::string ProjectStr =
153 if((ProjectStr ==
"MixedCGDG") ||
154 (ProjectStr ==
"Mixed_CG_Discontinuous"))
176 const std::string &variable,
177 const bool SetUpJustDG,
178 const bool DeclareCoeffPhysArrays)
184 if(variable.compare(
"DefaultVar") != 0)
189 if (DeclareCoeffPhysArrays)
207 Array<OneD, int> ElmtID,EdgeID;
217 for(e = 0; e < locExpList->GetExpSize(); ++e)
220 = (*m_exp)[ElmtID[cnt+e]]->
221 as<LocalRegions::Expansion2D>();
223 = locExpList->GetExp(e)->
224 as<LocalRegions::Expansion1D>();
226 = locExpList->GetExp(e)->
227 as<LocalRegions::Expansion> ();
229 exp2d->SetEdgeExp(EdgeID[cnt+e],exp);
230 exp1d->SetAdjacentElementExp(EdgeID[cnt+e],exp2d);
236 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
238 std::string ProjectStr =
241 if((ProjectStr ==
"MixedCGDG") ||
242 (ProjectStr ==
"Mixed_CG_Discontinuous"))
285 Array<OneD, int> ElmtID, EdgeID;
295 for(e = 0; e < locExpList->GetExpSize(); ++e)
298 = (*m_exp)[ElmtID[cnt+e]]->
299 as<LocalRegions::Expansion2D>();
301 = locExpList->GetExp(e)->
302 as<LocalRegions::Expansion1D>();
304 = locExpList->GetExp(e)->
305 as<LocalRegions::Expansion> ();
307 exp2d->SetEdgeExp(EdgeID[cnt+e],exp);
308 exp1d->SetAdjacentElementExp(EdgeID[cnt+e],exp2d);
330 "Routine currently only tested for HybridDGHelmholtz");
333 "The local to global map is not set up for the requested "
342 (*m_globalBndMat)[mkey] = glo_matrix;
346 glo_matrix = matrixIter->second;
384 Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
385 &elmtToTrace = m_traceMap->GetElmtToTrace();
392 for (
int i = 0; i <
m_exp->size(); ++i)
394 for (
int j = 0; j < (*m_exp)[i]->GetNedges(); ++j)
401 exp2d->SetEdgeExp (j, exp );
410 for (
int i = 0; i <
m_trace->GetExpSize(); ++i)
415 int offset =
m_trace->GetPhys_Offset(i);
416 int traceGeomId = traceEl->GetGeom1D()->GetGlobalID();
422 if (traceGeomId != min(pIt->second[0].id, traceGeomId))
424 traceEl->GetLeftAdjacentElementExp()->NegateEdgeNormal(
425 traceEl->GetLeftAdjacentElementEdge());
428 else if (m_traceMap->GetTraceToUniversalMapUnique(offset) < 0)
430 traceEl->GetLeftAdjacentElementExp()->NegateEdgeNormal(
431 traceEl->GetLeftAdjacentElementEdge());
446 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
453 boost::unordered_map<int,pair<int,int> > perEdgeToExpMap;
454 boost::unordered_map<int,pair<int,int> >
::iterator it2;
455 for (cnt = n = 0; n <
m_exp->size(); ++n)
457 for (e = 0; e < (*m_exp)[n]->GetNedges(); ++e, ++cnt)
460 (*
m_exp)[n]->GetGeom()->GetEid(e));
464 perEdgeToExpMap[it->first] = make_pair(n, e);
472 for (
int i = 0; i <
m_exp->size(); ++i)
474 for (
int j = 0; j < (*m_exp)[i]->GetNedges(); ++j, ++cnt)
482 for (
int n = 0; n <
m_exp->size(); ++n)
484 for (
int e = 0; e < (*m_exp)[n]->GetNedges(); ++e, ++cnt)
486 int edgeGeomId = (*m_exp)[n]->GetGeom()->GetEid(e);
487 int offset =
m_trace->GetPhys_Offset(
488 elmtToTrace[n][e]->GetElmtId());
496 it2 = perEdgeToExpMap.find(ent.
id);
498 if (it2 == perEdgeToExpMap.end())
500 if (
m_session->GetComm()->GetRowComm()->GetSize() > 1 &&
507 ASSERTL1(
false,
"Periodic edge not found!");
512 "Periodic edge in non-forward space?");
514 int offset2 =
m_trace->GetPhys_Offset(
515 elmtToTrace[it2->second.first][it2->second.second]->
520 int nquad = elmtToTrace[n][e]->GetNumPoints(0);
522 vector<int> tmpBwd(nquad);
523 vector<int> tmpFwd(nquad);
527 for (
int i = 0; i < nquad; ++i)
529 tmpBwd[i] = offset2 + i;
530 tmpFwd[i] = offset + i;
535 for (
int i = 0; i < nquad; ++i)
537 tmpBwd[i] = offset2 + i;
538 tmpFwd[i] = offset + nquad - i - 1;
542 for (
int i = 0; i < nquad; ++i)
562 bool returnval =
true;
582 int vSame = (returnval?1:0);
606 const std::string &variable,
607 const bool DeclareCoeffPhysArrays)
616 SpatialDomains::BoundaryRegionCollection::const_iterator it;
619 for (it = bregions.begin(); it != bregions.end(); ++it)
630 Array<OneD, MultiRegions::ExpListSharedPtr>(cnt);
632 Array<OneD, SpatialDomains::BoundaryConditionShPtr>(cnt);
637 for (it = bregions.begin(); it != bregions.end(); ++it)
645 DeclareCoeffPhysArrays, variable);
648 if(bc->GetBoundaryConditionType() !=
655 m_bndConditions[cnt] = bc;
657 m_bndConditions[cnt++]->GetUserDefined();
680 const std::string &variable)
687 = boost::dynamic_pointer_cast<
689 SpatialDomains::BoundaryRegionCollection::const_iterator it;
703 map<int,int> perComps;
704 map<int,vector<int> > allVerts;
706 map<int,StdRegions::Orientation> allEdges;
708 int region1ID, region2ID, i, j, k, cnt;
712 for(i = 0; i < (*m_exp).size(); ++i)
714 for(j = 0; j < (*m_exp)[i]->GetNverts(); ++j)
716 int id = (*m_exp)[i]->GetGeom()->GetVid(j);
722 for (it = bregions.begin(); it != bregions.end(); ++it)
725 bconditions, it->first, variable);
727 if (locBCond->GetBoundaryConditionType()
734 region1ID = it->first;
735 region2ID = boost::static_pointer_cast<
737 locBCond)->m_connectedBoundaryRegion;
742 if (vComm->GetSize() == 1)
744 cId1 = it->second->begin()->first;
745 cId2 = bregions.find(region2ID)->second->begin()->first;
749 cId1 = bndRegOrder.find(region1ID)->second[0];
750 cId2 = bndRegOrder.find(region2ID)->second[0];
754 "Boundary region "+boost::lexical_cast<
string>(
755 region1ID)+
" should only contain 1 composite.");
760 vector<unsigned int> tmpOrder;
762 for (i = 0; i < c->size(); ++i)
765 boost::dynamic_pointer_cast<
767 ASSERTL0(segGeom,
"Unable to cast to shared ptr");
770 graph2D->GetElementsFromEdge(segGeom);
772 "The periodic boundaries belong to "
773 "more than one element of the mesh");
777 (*elmt)[0]->m_Element);
779 allEdges[(*c)[i]->GetGlobalID()] =
780 geom->GetEorient((*elmt)[0]->m_EdgeIndx);
784 if (vComm->GetSize() == 1)
786 tmpOrder.push_back((*c)[i]->GetGlobalID());
789 vector<int> vertList(2);
790 vertList[0] = segGeom->GetVid(0);
791 vertList[1] = segGeom->GetVid(1);
792 allVerts[(*c)[i]->GetGlobalID()] = vertList;
795 if (vComm->GetSize() == 1)
797 compOrder[it->second->begin()->first] = tmpOrder;
802 if (perComps.count(cId1) == 0)
804 if (perComps.count(cId2) == 0)
806 perComps[cId1] = cId2;
810 std::stringstream ss;
811 ss <<
"Boundary region " << cId2 <<
" should be "
812 <<
"periodic with " << perComps[cId2] <<
" but "
813 <<
"found " << cId1 <<
" instead!";
814 ASSERTL0(perComps[cId2] == cId1, ss.str());
819 std::stringstream ss;
820 ss <<
"Boundary region " << cId1 <<
" should be "
821 <<
"periodic with " << perComps[cId1] <<
" but "
822 <<
"found " << cId2 <<
" instead!";
823 ASSERTL0(perComps[cId1] == cId1, ss.str());
828 int n = vComm->GetSize();
829 int p = vComm->GetRank();
831 Array<OneD, int> edgecounts(n,0);
832 Array<OneD, int> edgeoffset(n,0);
833 Array<OneD, int> vertoffset(n,0);
835 edgecounts[p] = allEdges.size();
839 for (i = 1; i < n; ++i)
841 edgeoffset[i] = edgeoffset[i-1] + edgecounts[i-1];
845 Array<OneD, int> edgeIds (totEdges, 0);
846 Array<OneD, int> edgeOrient(totEdges, 0);
847 Array<OneD, int> edgeVerts (totEdges, 0);
851 for (i = 0, sIt = allEdges.begin(); sIt != allEdges.end(); ++sIt)
853 edgeIds [edgeoffset[p] + i ] = sIt->first;
854 edgeOrient[edgeoffset[p] + i ] = sIt->second;
855 edgeVerts [edgeoffset[p] + i++] = allVerts[sIt->first].size();
863 Array<OneD, int> procVerts(n,0);
877 for (i = 0; i < n; ++i)
879 if (edgecounts[i] > 0)
882 edgecounts[i], edgeVerts + edgeoffset[i], 1);
891 for (i = 1; i < n; ++i)
893 vertoffset[i] = vertoffset[i-1] + procVerts[i-1];
896 Array<OneD, int> vertIds(nTotVerts, 0);
897 for (i = 0, sIt = allEdges.begin(); sIt != allEdges.end(); ++sIt)
899 for (j = 0; j < allVerts[sIt->first].size(); ++j)
901 vertIds[vertoffset[p] + i++] = allVerts[sIt->first][j];
908 map<int, StdRegions::Orientation> orientMap;
909 map<int, vector<int> > vertMap;
911 for (cnt = i = 0; i < totEdges; ++i)
913 ASSERTL0(orientMap.count(edgeIds[i]) == 0,
914 "Already found edge in orientation map!");
917 vector<int> verts(edgeVerts[i]);
919 for (j = 0; j < edgeVerts[i]; ++j)
921 verts[j] = vertIds[cnt++];
923 vertMap[edgeIds[i]] = verts;
930 map<int,int>::const_iterator oIt;
932 map<int,int> allCompPairs;
941 for (cIt = perComps.begin(); cIt != perComps.end(); ++cIt)
944 const int id1 = cIt->first;
945 const int id2 = cIt->second;
946 std::string id1s = boost::lexical_cast<
string>(id1);
947 std::string id2s = boost::lexical_cast<
string>(id2);
949 if (compMap.count(id1) > 0)
954 if (compMap.count(id2) > 0)
960 "Both composites not found on this process!");
965 map<int,int> compPairs;
968 "Unable to find composite "+id1s+
" in order map.");
970 "Unable to find composite "+id2s+
" in order map.");
971 ASSERTL0(compOrder[id1].size() == compOrder[id2].size(),
972 "Periodic composites "+id1s+
" and "+id2s+
973 " should have the same number of elements.");
975 "Periodic composites "+id1s+
" and "+id2s+
979 for (i = 0; i < compOrder[id1].size(); ++i)
981 int eId1 = compOrder[id1][i];
982 int eId2 = compOrder[id2][i];
984 ASSERTL0(compPairs.count(eId1) == 0,
987 if (compPairs.count(eId2) != 0)
989 ASSERTL0(compPairs[eId2] == eId1,
"Pairing incorrect");
991 compPairs[eId1] = eId2;
998 for (i = 0; i < 2; ++i)
1005 if (c[i]->size() > 0)
1007 for (j = 0; j < c[i]->size(); ++j)
1009 locEdges.insert(c[i]->at(j)->GetGlobalID());
1015 for (pIt = compPairs.begin(); pIt != compPairs.end(); ++pIt)
1017 int ids [2] = {pIt->first, pIt->second};
1018 bool local[2] = {locEdges.count(pIt->first) > 0,
1019 locEdges.count(pIt->second) > 0};
1021 ASSERTL0(orientMap.count(ids[0]) > 0 &&
1022 orientMap.count(ids[1]) > 0,
1023 "Unable to find edge in orientation map.");
1025 allCompPairs[pIt->first ] = pIt->second;
1026 allCompPairs[pIt->second] = pIt->first;
1028 for (i = 0; i < 2; ++i)
1035 int other = (i+1) % 2;
1038 orientMap[ids[i]] == orientMap[ids[other]] ?
1047 for (i = 0; i < 2; ++i)
1049 int other = (i+1) % 2;
1052 orientMap[ids[i]] == orientMap[ids[other]] ?
1057 vector<int> perVerts1 = vertMap[ids[i]];
1058 vector<int> perVerts2 = vertMap[ids[other]];
1060 map<int, pair<int, bool> > tmpMap;
1064 tmpMap[perVerts1[0]] = make_pair(
1065 perVerts2[0], locVerts.count(perVerts2[0]) > 0);
1066 tmpMap[perVerts1[1]] = make_pair(
1067 perVerts2[1], locVerts.count(perVerts2[1]) > 0);
1071 tmpMap[perVerts1[0]] = make_pair(
1072 perVerts2[1], locVerts.count(perVerts2[1]) > 0);
1073 tmpMap[perVerts1[1]] = make_pair(
1074 perVerts2[0], locVerts.count(perVerts2[0]) > 0);
1077 for (mIt = tmpMap.begin(); mIt != tmpMap.end(); ++mIt)
1082 mIt->second.second);
1086 if (perIt == periodicVerts.end())
1088 periodicVerts[mIt->first].push_back(ent2);
1089 perIt = periodicVerts.find(mIt->first);
1094 for (j = 0; j < perIt->second.size(); ++j)
1096 if (perIt->second[j].id == mIt->second.first)
1105 perIt->second.push_back(ent2);
1113 Array<OneD, int> pairSizes(n, 0);
1114 pairSizes[p] = allCompPairs.size();
1119 Array<OneD, int> pairOffsets(n, 0);
1122 for (i = 1; i < n; ++i)
1124 pairOffsets[i] = pairOffsets[i-1] + pairSizes[i-1];
1127 Array<OneD, int> first (totPairSizes, 0);
1128 Array<OneD, int> second(totPairSizes, 0);
1130 cnt = pairOffsets[p];
1132 for (pIt = allCompPairs.begin(); pIt != allCompPairs.end(); ++pIt)
1134 first [cnt ] = pIt->first;
1135 second[cnt++] = pIt->second;
1141 allCompPairs.clear();
1143 for(cnt = 0; cnt < totPairSizes; ++cnt)
1145 allCompPairs[first[cnt]] = second[cnt];
1151 for (cnt = i = 0; i < totEdges; ++i)
1153 int edgeId = edgeIds[i];
1155 ASSERTL0(allCompPairs.count(edgeId) > 0,
1156 "Unable to find matching periodic edge.");
1158 int perEdgeId = allCompPairs[edgeId];
1160 for (j = 0; j < edgeVerts[i]; ++j, ++cnt)
1162 int vId = vertIds[cnt];
1166 if (perId == periodicVerts.end())
1173 orientMap[edgeId] == orientMap[perEdgeId] ?
1174 vertMap[perEdgeId][(j+1)%2] : vertMap[perEdgeId][j];
1178 locVerts.count(perVertexId) > 0);
1180 periodicVerts[vId].push_back(ent);
1188 for (perIt = periodicVerts.begin();
1189 perIt != periodicVerts.end(); ++perIt)
1192 for (i = 0; i < perIt->second.size(); ++i)
1194 perIt2 = periodicVerts.find(perIt->second[i].id);
1195 ASSERTL0(perIt2 != periodicVerts.end(),
1196 "Couldn't find periodic vertex.");
1198 for (j = 0; j < perIt2->second.size(); ++j)
1200 if (perIt2->second[j].id == perIt->first)
1206 for (k = 0; k < perIt->second.size(); ++k)
1208 if (perIt2->second[j].id == perIt->second[k].id)
1217 perIt->second.push_back(perIt2->second[j]);
1225 for (perIt = periodicVerts.begin();
1226 perIt != periodicVerts.end(); ++perIt)
1228 if (locVerts.count(perIt->first) > 0)
1240 as<LocalRegions::Expansion1D>();
1244 if (traceEl->GetLeftAdjacentElementEdge () == -1 ||
1245 traceEl->GetRightAdjacentElementEdge() == -1)
1255 int traceGeomId = traceEl->GetGeom1D()->GetGlobalID();
1261 fwd = traceGeomId == min(traceGeomId,pIt->second[0].id);
1265 int offset =
m_trace->GetPhys_Offset(traceEl->GetElmtId());
1268 GetTraceToUniversalMapUnique(offset) >= 0;
1272 else if (traceEl->GetLeftAdjacentElementEdge () != -1 &&
1273 traceEl->GetRightAdjacentElementEdge() != -1)
1277 (traceEl->GetLeftAdjacentElementExp().get()) ==
1282 ASSERTL2(
false,
"Unconnected trace element!");
1293 Array<OneD, NekDouble> &Fwd,
1294 Array<OneD, NekDouble> &Bwd)
1325 const Array<OneD, const NekDouble> &field,
1326 Array<OneD, NekDouble> &Fwd,
1327 Array<OneD, NekDouble> &Bwd)
1331 int cnt, n, e,
npts, phys_offset;
1332 Array<OneD,NekDouble> e_tmp;
1334 boost::unordered_map<int,pair<int,int> >
::iterator it3;
1337 Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
1344 for(cnt = n = 0; n < nexp; ++n)
1349 for(e = 0; e < exp2d->GetNedges(); ++e, ++cnt)
1351 int offset =
m_trace->GetPhys_Offset(
1352 elmtToTrace[n][e]->GetElmtId());
1356 exp2d->GetEdgePhysVals(e, elmtToTrace[n][e],
1357 field + phys_offset,
1358 e_tmp = Fwd + offset);
1362 exp2d->GetEdgePhysVals(e, elmtToTrace[n][e],
1363 field + phys_offset,
1364 e_tmp = Bwd + offset);
1381 id2 =
m_trace->GetPhys_Offset(
1382 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1400 "Method not set up for non-zero Neumann "
1401 "boundary condition");
1402 id2 =
m_trace->GetPhys_Offset(
1403 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1413 "Method not set up for this boundary condition.");
1434 Array<OneD, NekDouble> &outarray)
1437 "Field must be in physical state to extract trace space.");
1454 const Array<OneD, const NekDouble> &inarray,
1455 Array<OneD, NekDouble> &outarray)
1459 int n, e, offset, phys_offset;
1460 Array<OneD,NekDouble> e_tmp;
1461 Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
1465 "input array is of insufficient length");
1468 for(n = 0; n < nexp; ++n)
1472 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1474 offset =
m_trace->GetPhys_Offset(
1475 elmtToTrace[n][e]->GetElmtId());
1476 (*m_exp)[n]->GetEdgePhysVals(e, elmtToTrace[n][e],
1477 inarray + phys_offset,
1478 e_tmp = outarray + offset);
1484 const Array<OneD, const NekDouble> &Fx,
1485 const Array<OneD, const NekDouble> &Fy,
1486 Array<OneD, NekDouble> &outarray)
1488 int e, n, offset, t_offset;
1489 Array<OneD, NekDouble> e_outarray;
1490 Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
1496 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1498 t_offset =
GetTrace()->GetPhys_Offset(
1499 elmtToTrace[n][e]->GetElmtId());
1501 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1502 e,elmtToTrace[n][e],
1505 e_outarray = outarray+offset);
1528 const Array<OneD, const NekDouble> &Fn,
1529 Array<OneD, NekDouble> &outarray)
1531 int e, n, offset, t_offset;
1532 Array<OneD, NekDouble> e_outarray;
1533 Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
1539 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1541 t_offset =
GetTrace()->GetPhys_Offset(
1542 elmtToTrace[n][e]->GetElmtId());
1543 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1544 e, elmtToTrace[n][e], Fn+t_offset,
1545 e_outarray = outarray+offset);
1574 const Array<OneD, const NekDouble> &Fwd,
1575 const Array<OneD, const NekDouble> &Bwd,
1576 Array<OneD, NekDouble> &outarray)
1578 int e,n,offset, t_offset;
1579 Array<OneD, NekDouble> e_outarray;
1580 Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
1586 for (e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1588 t_offset =
GetTrace()->GetPhys_Offset(
1589 elmtToTrace[n][e]->GetElmtId());
1594 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1595 e, elmtToTrace[n][e], Fwd+t_offset,
1596 e_outarray = outarray+offset);
1600 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1601 e, elmtToTrace[n][e], Bwd+t_offset,
1602 e_outarray = outarray+offset);
1614 Array<OneD, int> &ElmtID,
1615 Array<OneD, int> &EdgeID)
1617 map<int, int> globalIdMap;
1630 globalIdMap[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
1640 if(ElmtID.num_elements() != nbcs)
1642 ElmtID = Array<OneD, int>(nbcs);
1645 if(EdgeID.num_elements() != nbcs)
1647 EdgeID = Array<OneD, int>(nbcs);
1657 as<LocalRegions::Expansion1D>();
1660 graph2D->GetElementsFromEdge(exp1d->GetGeom1D());
1662 ElmtID[cnt] = globalIdMap[(*tmp)[0]->
1663 m_Element->GetGlobalID()];
1664 EdgeID[cnt] = (*tmp)[0]->m_EdgeIndx;
1681 const Array<OneD, const NekDouble> &soln)
1683 int i,e,ncoeff_edge;
1684 Array<OneD, const NekDouble> tmp_coeffs;
1685 Array<OneD, NekDouble> out_d(
m_ncoeffs), out_tmp;
1687 Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
1693 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1694 Array<OneD, NekDouble> loc_lambda(LocBndCoeffs), edge_lambda;
1697 edge_lambda = loc_lambda;
1707 int nEdges = (*m_exp)[i]->GetNedges();
1708 Array<OneD, Array<OneD, NekDouble> > edgeCoeffs(nEdges);
1710 for(e = 0; e < nEdges; ++e)
1712 edgedir = (*m_exp)[eid]->GetEorient(e);
1713 ncoeff_edge = elmtToTrace[eid][e]->GetNcoeffs();
1714 edgeCoeffs[e] = Array<OneD, NekDouble>(ncoeff_edge);
1715 Vmath::Vcopy(ncoeff_edge, edge_lambda, 1, edgeCoeffs[e], 1);
1716 elmtToTrace[eid][e]->SetCoeffsToOrientation(
1717 edgedir, edgeCoeffs[e], edgeCoeffs[e]);
1718 edge_lambda = edge_lambda + ncoeff_edge;
1721 (*m_exp)[eid]->DGDeriv(dir,
1725 out_tmp = out_d+cnt);
1726 cnt += (*m_exp)[eid]->GetNcoeffs();
1735 const Array<OneD, const NekDouble> &inarray,
1736 Array<OneD, NekDouble> &outarray,
1740 const Array<OneD, const NekDouble> &dirForcing)
1742 int i,j,n,cnt,cnt1,nbndry;
1748 Array<OneD,NekDouble> e_f, e_l;
1759 int GloBndDofs =
m_traceMap->GetNumGlobalBndCoeffs();
1760 int NumDirichlet =
m_traceMap->GetNumLocalDirBndCoeffs();
1771 Array<OneD,NekDouble> BndSol =
m_trace->UpdateCoeffs();
1774 Array<OneD,NekDouble> BndRhs(GloBndDofs,0.0);
1781 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1782 Array<OneD, NekDouble> loc_lambda(LocBndCoeffs);
1790 for(cnt = cnt1 = n = 0; n < nexp; ++n)
1796 e_l = loc_lambda + cnt1;
1803 Floc =
Transpose(*(HDGLamToU->GetBlock(n,n)))*ElmtFce;
1822 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
1831 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
1841 if(GloBndDofs - NumDirichlet > 0)
1860 m_traceMap->GlobalToLocalBnd(BndSol,loc_lambda);
1863 out = (*InvHDGHelm)*F + (*HDGLamToU)*LocLambda;
1877 const Array<OneD,const NekDouble> &inarray,
1878 Array<OneD, NekDouble> &outarray,
1881 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1882 Array<OneD, NekDouble> loc_lambda(LocBndCoeffs);
1886 m_traceMap->GlobalToLocalBnd(inarray, loc_lambda);
1887 LocLambda = (*HDGHelm) * LocLambda;
1888 m_traceMap->AssembleBnd(loc_lambda,outarray);
1906 map<int, RobinBCInfoSharedPtr> returnval;
1907 Array<OneD, int> ElmtID,EdgeID;
1918 Array<OneD, NekDouble> Array_tmp;
1922 for(e = 0; e < locExpList->GetExpSize(); ++e)
1927 Array_tmp = locExpList->GetPhys() +
1928 locExpList->GetPhys_Offset(e));
1929 elmtid = ElmtID[cnt+e];
1931 if(returnval.count(elmtid) != 0)
1933 rInfo->next = returnval.find(elmtid)->second;
1935 returnval[elmtid] = rInfo;
1965 Array<OneD, NekDouble> &outarray)
1967 int i,cnt,e,ncoeff_edge;
1968 Array<OneD, NekDouble> force, out_tmp, qrhs, qrhs1;
1969 Array<OneD, Array< OneD, LocalRegions::ExpansionSharedPtr> >
1974 int eid,nq_elmt, nm_elmt;
1975 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1976 Array<OneD, NekDouble> loc_lambda(LocBndCoeffs), edge_lambda;
1977 Array<OneD, NekDouble> tmp_coeffs;
1980 edge_lambda = loc_lambda;
1987 nq_elmt = (*m_exp)[eid]->GetTotPoints();
1988 nm_elmt = (*m_exp)[eid]->GetNcoeffs();
1989 qrhs = Array<OneD, NekDouble>(nq_elmt);
1990 qrhs1 = Array<OneD, NekDouble>(nq_elmt);
1991 force = Array<OneD, NekDouble>(2*nm_elmt);
1992 out_tmp = force + nm_elmt;
1995 int num_points0 = (*m_exp)[eid]->GetBasis(0)->GetNumPoints();
1996 int num_points1 = (*m_exp)[eid]->GetBasis(1)->GetNumPoints();
1997 int num_modes0 = (*m_exp)[eid]->GetBasis(0)->GetNumModes();
1998 int num_modes1 = (*m_exp)[eid]->GetBasis(1)->GetNumModes();
2003 int nEdges = (*m_exp)[i]->GetNedges();
2004 Array<OneD, Array<OneD, NekDouble> > edgeCoeffs(nEdges);
2006 for(e = 0; e < (*m_exp)[eid]->GetNedges(); ++e)
2008 edgedir = (*m_exp)[eid]->GetEorient(e);
2009 ncoeff_edge = elmtToTrace[eid][e]->GetNcoeffs();
2010 edgeCoeffs[e] = Array<OneD, NekDouble>(ncoeff_edge);
2011 Vmath::Vcopy(ncoeff_edge, edge_lambda, 1, edgeCoeffs[e], 1);
2012 elmtToTrace[eid][e]->SetCoeffsToOrientation(
2013 edgedir, edgeCoeffs[e], edgeCoeffs[e]);
2014 edge_lambda = edge_lambda + ncoeff_edge;
2042 ASSERTL0(
false,
"Wrong shape type, HDG postprocessing is not implemented");
2061 (*m_exp)[eid]->DGDeriv(
2063 elmtToTrace[eid], edgeCoeffs, out_tmp);
2064 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2066 ppExp->IProductWRTDerivBase(0,qrhs,force);
2070 (*m_exp)[eid]->DGDeriv(
2072 elmtToTrace[eid], edgeCoeffs, out_tmp);
2074 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2076 ppExp->IProductWRTDerivBase(1,qrhs,out_tmp);
2081 (*m_exp)[eid]->BwdTrans(
2083 force[0] = (*m_exp)[eid]->Integral(qrhs);
2096 Array<OneD, NekDouble> work(nq_elmt);
2097 ppExp->BwdTrans(out.
GetPtr(), work);
2098 (*m_exp)[eid]->FwdTrans(work, tmp_coeffs = outarray +
m_coeff_offset[eid]);
2116 const std::string varName,
2126 for (i = 0; i < nbnd; ++i)
2133 npoints = locExpList->GetNpoints();
2134 Array<OneD, NekDouble> x0(npoints, 0.0);
2135 Array<OneD, NekDouble> x1(npoints, 0.0);
2136 Array<OneD, NekDouble> x2(npoints, 0.0);
2141 locExpList->GetCoords(x0, x1, x2);
2145 locExpList->GetCoords(x0, x1, x2);
2152 string filebcs = boost::static_pointer_cast<
2163 boost::static_pointer_cast<
2166 m_dirichletCondition;
2168 condition.
Evaluate(x0, x1, x2, time,
2169 locExpList->UpdatePhys());
2172 locExpList->FwdTrans_BndConstrained(
2173 locExpList->GetPhys(),
2174 locExpList->UpdateCoeffs());
2179 string filebcs = boost::static_pointer_cast<
2190 boost::static_pointer_cast<
2194 condition.
Evaluate(x0, x1, x2, time,
2195 locExpList->UpdatePhys());
2198 locExpList->IProductWRTBase(
2199 locExpList->GetPhys(),
2200 locExpList->UpdateCoeffs());
2205 string filebcs = boost::static_pointer_cast<
2216 boost::static_pointer_cast<
2220 condition.
Evaluate(x0, x1, x2, time,
2221 locExpList->UpdatePhys());
2225 boost::static_pointer_cast<
2228 locExpList->IProductWRTBase(
2229 locExpList->GetPhys(),
2230 locExpList->UpdateCoeffs());
2235 locExpList->UpdatePhys());
2239 ASSERTL0(
false,
"This type of BC not implemented yet");