51 namespace MultiRegions
63 DisContField2D::DisContField2D(
void)
65 m_bndCondExpansions(),
73 const bool DeclareCoeffPhysArrays)
75 m_bndCondExpansions (In.m_bndCondExpansions),
76 m_bndConditions (In.m_bndConditions),
77 m_globalBndMat (In.m_globalBndMat),
78 m_traceMap (In.m_traceMap),
79 m_locTraceToTraceMap (In.m_locTraceToTraceMap),
80 m_boundaryEdges (In.m_boundaryEdges),
81 m_periodicVerts (In.m_periodicVerts),
82 m_periodicEdges (In.m_periodicEdges),
83 m_periodicFwdCopy (In.m_periodicFwdCopy),
84 m_periodicBwdCopy (In.m_periodicBwdCopy),
85 m_leftAdjacentEdges (In.m_leftAdjacentEdges)
90 *boost::dynamic_pointer_cast<ExpList1D>(In.
m_trace),
91 DeclareCoeffPhysArrays);
102 const std::string &variable,
103 const bool SetUpJustDG,
104 const bool DeclareCoeffPhysArrays)
105 :
ExpList2D(pSession, graph2D, DeclareCoeffPhysArrays, variable),
106 m_bndCondExpansions(),
115 if (variable.compare(
"DefaultVar") != 0)
119 DeclareCoeffPhysArrays);
121 if (DeclareCoeffPhysArrays)
147 for(e = 0; e < locExpList->GetExpSize(); ++e)
150 (*m_exp)[ElmtID[cnt+e]]->
151 as<LocalRegions::Expansion2D>();
153 locExpList->GetExp(e)->
154 as<LocalRegions::Expansion1D>();
156 locExpList->GetExp(e)->
157 as<LocalRegions::Expansion> ();
159 exp2d->SetEdgeExp(EdgeID[cnt+e], exp1d);
160 exp1d->SetAdjacentElementExp(EdgeID[cnt+e], exp2d);
165 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
167 std::string ProjectStr =
169 if((ProjectStr ==
"MixedCGDG") ||
170 (ProjectStr ==
"Mixed_CG_Discontinuous"))
194 const std::string &variable,
195 const bool SetUpJustDG,
196 const bool DeclareCoeffPhysArrays)
202 if(variable.compare(
"DefaultVar") != 0)
207 if (DeclareCoeffPhysArrays)
235 for(e = 0; e < locExpList->GetExpSize(); ++e)
238 = (*m_exp)[ElmtID[cnt+e]]->
239 as<LocalRegions::Expansion2D>();
241 = locExpList->GetExp(e)->
242 as<LocalRegions::Expansion1D>();
244 = locExpList->GetExp(e)->
245 as<LocalRegions::Expansion> ();
247 exp2d->SetEdgeExp(EdgeID[cnt+e], exp1d);
248 exp1d->SetAdjacentElementExp(EdgeID[cnt+e],
256 if (
m_session->DefinesSolverInfo(
"PROJECTION"))
258 std::string ProjectStr =
261 if ((ProjectStr ==
"MixedCGDG") ||
262 (ProjectStr ==
"Mixed_CG_Discontinuous"))
317 for (e = 0; e < locExpList->GetExpSize(); ++e)
320 = (*m_exp)[ElmtID[cnt+e]]->
321 as<LocalRegions::Expansion2D>();
323 = locExpList->GetExp(e)->
324 as<LocalRegions::Expansion1D>();
326 = locExpList->GetExp(e)->
327 as<LocalRegions::Expansion> ();
329 exp2d->SetEdgeExp(EdgeID[cnt+e], exp1d);
330 exp1d->SetAdjacentElementExp(EdgeID[cnt+e],
353 "Routine currently only tested for HybridDGHelmholtz");
356 "The local to global map is not set up for the requested "
365 (*m_globalBndMat)[mkey] = glo_matrix;
369 glo_matrix = matrixIter->second;
407 if (
m_session->DefinesCmdLineArgument(
"verbose"))
409 m_traceMap->PrintStats(std::cout, variable);
413 &elmtToTrace = m_traceMap->GetElmtToTrace();
420 for (
int i = 0; i <
m_exp->size(); ++i)
422 for (
int j = 0; j < (*m_exp)[i]->GetNedges(); ++j)
429 exp2d->SetEdgeExp (j, exp1d);
430 exp1d->SetAdjacentElementExp(j, exp2d);
438 for (
int i = 0; i <
m_trace->GetExpSize(); ++i)
443 int offset =
m_trace->GetPhys_Offset(i);
444 int traceGeomId = traceEl->GetGeom1D()->GetGlobalID();
449 if (traceGeomId != min(pIt->second[0].id, traceGeomId))
451 traceEl->GetLeftAdjacentElementExp()->NegateEdgeNormal(
452 traceEl->GetLeftAdjacentElementEdge());
455 else if (m_traceMap->GetTraceToUniversalMapUnique(offset) < 0)
457 traceEl->GetLeftAdjacentElementExp()->NegateEdgeNormal(
458 traceEl->GetLeftAdjacentElementEdge());
473 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
480 boost::unordered_map<int,pair<int,int> > perEdgeToExpMap;
481 boost::unordered_map<int,pair<int,int> >
::iterator it2;
482 for (cnt = n = 0; n <
m_exp->size(); ++n)
484 for (e = 0; e < (*m_exp)[n]->GetNedges(); ++e, ++cnt)
487 (*
m_exp)[n]->GetGeom()->GetEid(e));
491 perEdgeToExpMap[it->first] = make_pair(n, e);
499 for (
int i = 0; i <
m_exp->size(); ++i)
501 for (
int j = 0; j < (*m_exp)[i]->GetNedges(); ++j, ++cnt)
509 for (
int n = 0; n <
m_exp->size(); ++n)
511 for (
int e = 0; e < (*m_exp)[n]->GetNedges(); ++e, ++cnt)
513 int edgeGeomId = (*m_exp)[n]->GetGeom()->GetEid(e);
514 int offset =
m_trace->GetPhys_Offset(
515 elmtToTrace[n][e]->GetElmtId());
523 it2 = perEdgeToExpMap.find(ent.
id);
525 if (it2 == perEdgeToExpMap.end())
528 GetRowComm()->GetSize() > 1 && !ent.
isLocal)
534 ASSERTL1(
false,
"Periodic edge not found!");
539 "Periodic edge in non-forward space?");
541 int offset2 =
m_trace->GetPhys_Offset(
542 elmtToTrace[it2->second.first][it2->second.second]->
547 int nquad = elmtToTrace[n][e]->GetNumPoints(0);
549 vector<int> tmpBwd(nquad);
550 vector<int> tmpFwd(nquad);
554 for (
int i = 0; i < nquad; ++i)
556 tmpBwd[i] = offset2 + i;
557 tmpFwd[i] = offset + i;
562 for (
int i = 0; i < nquad; ++i)
564 tmpBwd[i] = offset2 + i;
565 tmpFwd[i] = offset + nquad - i - 1;
569 for (
int i = 0; i < nquad; ++i)
593 bool returnval =
true;
613 int vSame = (returnval?1:0);
637 const std::string &variable,
638 const bool DeclareCoeffPhysArrays)
647 SpatialDomains::BoundaryRegionCollection::const_iterator it;
650 for (it = bregions.begin(); it != bregions.end(); ++it)
668 for (it = bregions.begin(); it != bregions.end(); ++it)
676 DeclareCoeffPhysArrays, variable);
679 m_bndConditions[cnt] = bc;
682 std::string type = m_bndConditions[cnt]->GetUserDefined();
687 if((bc->GetBoundaryConditionType() !=
689 boost::iequals(type,
"I") ||
690 boost::iequals(type,
"CalcBC"))
713 const std::string &variable)
720 = boost::dynamic_pointer_cast<
722 SpatialDomains::BoundaryRegionCollection::const_iterator it;
736 map<int,int> perComps;
737 map<int,vector<int> > allVerts;
739 map<int,StdRegions::Orientation> allEdges;
741 int region1ID, region2ID, i, j, k, cnt;
745 for(i = 0; i < (*m_exp).size(); ++i)
747 for(j = 0; j < (*m_exp)[i]->GetNverts(); ++j)
749 int id = (*m_exp)[i]->GetGeom()->GetVid(j);
755 for (it = bregions.begin(); it != bregions.end(); ++it)
758 bconditions, it->first, variable);
760 if (locBCond->GetBoundaryConditionType()
767 region1ID = it->first;
768 region2ID = boost::static_pointer_cast<
770 locBCond)->m_connectedBoundaryRegion;
775 if (vComm->GetSize() == 1)
777 cId1 = it->second->begin()->first;
778 cId2 = bregions.find(region2ID)->second->begin()->first;
782 cId1 = bndRegOrder.find(region1ID)->second[0];
783 cId2 = bndRegOrder.find(region2ID)->second[0];
787 "Boundary region "+boost::lexical_cast<
string>(
788 region1ID)+
" should only contain 1 composite.");
793 vector<unsigned int> tmpOrder;
795 for (i = 0; i < c->size(); ++i)
798 boost::dynamic_pointer_cast<
800 ASSERTL0(segGeom,
"Unable to cast to shared ptr");
803 graph2D->GetElementsFromEdge(segGeom);
805 "The periodic boundaries belong to "
806 "more than one element of the mesh");
810 (*elmt)[0]->m_Element);
812 allEdges[(*c)[i]->GetGlobalID()] =
813 geom->GetEorient((*elmt)[0]->m_EdgeIndx);
817 if (vComm->GetSize() == 1)
819 tmpOrder.push_back((*c)[i]->GetGlobalID());
822 vector<int> vertList(2);
823 vertList[0] = segGeom->GetVid(0);
824 vertList[1] = segGeom->GetVid(1);
825 allVerts[(*c)[i]->GetGlobalID()] = vertList;
828 if (vComm->GetSize() == 1)
830 compOrder[it->second->begin()->first] = tmpOrder;
835 if (perComps.count(cId1) == 0)
837 if (perComps.count(cId2) == 0)
839 perComps[cId1] = cId2;
843 std::stringstream ss;
844 ss <<
"Boundary region " << cId2 <<
" should be "
845 <<
"periodic with " << perComps[cId2] <<
" but "
846 <<
"found " << cId1 <<
" instead!";
847 ASSERTL0(perComps[cId2] == cId1, ss.str());
852 std::stringstream ss;
853 ss <<
"Boundary region " << cId1 <<
" should be "
854 <<
"periodic with " << perComps[cId1] <<
" but "
855 <<
"found " << cId2 <<
" instead!";
856 ASSERTL0(perComps[cId1] == cId1, ss.str());
861 int n = vComm->GetSize();
862 int p = vComm->GetRank();
868 edgecounts[
p] = allEdges.size();
872 for (i = 1; i < n; ++i)
874 edgeoffset[i] = edgeoffset[i-1] + edgecounts[i-1];
884 for (i = 0, sIt = allEdges.begin(); sIt != allEdges.end(); ++sIt)
886 edgeIds [edgeoffset[
p] + i ] = sIt->first;
887 edgeOrient[edgeoffset[
p] + i ] = sIt->second;
888 edgeVerts [edgeoffset[
p] + i++] = allVerts[sIt->first].size();
910 for (i = 0; i < n; ++i)
912 if (edgecounts[i] > 0)
915 edgecounts[i], edgeVerts + edgeoffset[i], 1);
924 for (i = 1; i < n; ++i)
926 vertoffset[i] = vertoffset[i-1] + procVerts[i-1];
930 for (i = 0, sIt = allEdges.begin(); sIt != allEdges.end(); ++sIt)
932 for (j = 0; j < allVerts[sIt->first].size(); ++j)
934 vertIds[vertoffset[
p] + i++] = allVerts[sIt->first][j];
941 map<int, StdRegions::Orientation> orientMap;
942 map<int, vector<int> > vertMap;
944 for (cnt = i = 0; i < totEdges; ++i)
946 ASSERTL0(orientMap.count(edgeIds[i]) == 0,
947 "Already found edge in orientation map!");
950 vector<int> verts(edgeVerts[i]);
952 for (j = 0; j < edgeVerts[i]; ++j)
954 verts[j] = vertIds[cnt++];
956 vertMap[edgeIds[i]] = verts;
963 map<int,int>::const_iterator oIt;
965 map<int,int> allCompPairs;
974 for (cIt = perComps.begin(); cIt != perComps.end(); ++cIt)
977 const int id1 = cIt->first;
978 const int id2 = cIt->second;
979 std::string id1s = boost::lexical_cast<
string>(id1);
980 std::string id2s = boost::lexical_cast<
string>(id2);
982 if (compMap.count(id1) > 0)
987 if (compMap.count(id2) > 0)
993 "Both composites not found on this process!");
998 map<int,int> compPairs;
1001 "Unable to find composite "+id1s+
" in order map.");
1003 "Unable to find composite "+id2s+
" in order map.");
1004 ASSERTL0(compOrder[id1].size() == compOrder[id2].size(),
1005 "Periodic composites "+id1s+
" and "+id2s+
1006 " should have the same number of elements.");
1007 ASSERTL0(compOrder[id1].size() > 0,
1008 "Periodic composites "+id1s+
" and "+id2s+
1012 for (i = 0; i < compOrder[id1].size(); ++i)
1014 int eId1 = compOrder[id1][i];
1015 int eId2 = compOrder[id2][i];
1017 ASSERTL0(compPairs.count(eId1) == 0,
1020 if (compPairs.count(eId2) != 0)
1022 ASSERTL0(compPairs[eId2] == eId1,
"Pairing incorrect");
1024 compPairs[eId1] = eId2;
1031 for (i = 0; i < 2; ++i)
1038 if (c[i]->size() > 0)
1040 for (j = 0; j < c[i]->size(); ++j)
1042 locEdges.insert(c[i]->at(j)->GetGlobalID());
1048 for (pIt = compPairs.begin(); pIt != compPairs.end(); ++pIt)
1050 int ids [2] = {pIt->first, pIt->second};
1051 bool local[2] = {locEdges.count(pIt->first) > 0,
1052 locEdges.count(pIt->second) > 0};
1054 ASSERTL0(orientMap.count(ids[0]) > 0 &&
1055 orientMap.count(ids[1]) > 0,
1056 "Unable to find edge in orientation map.");
1058 allCompPairs[pIt->first ] = pIt->second;
1059 allCompPairs[pIt->second] = pIt->first;
1061 for (i = 0; i < 2; ++i)
1068 int other = (i+1) % 2;
1071 orientMap[ids[i]] == orientMap[ids[other]] ?
1080 for (i = 0; i < 2; ++i)
1082 int other = (i+1) % 2;
1085 orientMap[ids[i]] == orientMap[ids[other]] ?
1090 vector<int> perVerts1 = vertMap[ids[i]];
1091 vector<int> perVerts2 = vertMap[ids[other]];
1093 map<int, pair<int, bool> > tmpMap;
1097 tmpMap[perVerts1[0]] = make_pair(
1098 perVerts2[0], locVerts.count(perVerts2[0]) > 0);
1099 tmpMap[perVerts1[1]] = make_pair(
1100 perVerts2[1], locVerts.count(perVerts2[1]) > 0);
1104 tmpMap[perVerts1[0]] = make_pair(
1105 perVerts2[1], locVerts.count(perVerts2[1]) > 0);
1106 tmpMap[perVerts1[1]] = make_pair(
1107 perVerts2[0], locVerts.count(perVerts2[0]) > 0);
1110 for (mIt = tmpMap.begin(); mIt != tmpMap.end(); ++mIt)
1115 mIt->second.second);
1119 if (perIt == periodicVerts.end())
1121 periodicVerts[mIt->first].push_back(ent2);
1122 perIt = periodicVerts.find(mIt->first);
1127 for (j = 0; j < perIt->second.size(); ++j)
1129 if (perIt->second[j].id == mIt->second.first)
1138 perIt->second.push_back(ent2);
1147 pairSizes[
p] = allCompPairs.size();
1155 for (i = 1; i < n; ++i)
1157 pairOffsets[i] = pairOffsets[i-1] + pairSizes[i-1];
1163 cnt = pairOffsets[
p];
1165 for (pIt = allCompPairs.begin(); pIt != allCompPairs.end(); ++pIt)
1167 first [cnt ] = pIt->first;
1168 second[cnt++] = pIt->second;
1174 allCompPairs.clear();
1176 for(cnt = 0; cnt < totPairSizes; ++cnt)
1178 allCompPairs[first[cnt]] = second[cnt];
1184 for (cnt = i = 0; i < totEdges; ++i)
1186 int edgeId = edgeIds[i];
1188 ASSERTL0(allCompPairs.count(edgeId) > 0,
1189 "Unable to find matching periodic edge.");
1191 int perEdgeId = allCompPairs[edgeId];
1193 for (j = 0; j < edgeVerts[i]; ++j, ++cnt)
1195 int vId = vertIds[cnt];
1199 if (perId == periodicVerts.end())
1206 orientMap[edgeId] == orientMap[perEdgeId] ?
1207 vertMap[perEdgeId][(j+1)%2] : vertMap[perEdgeId][j];
1211 locVerts.count(perVertexId) > 0);
1213 periodicVerts[vId].push_back(ent);
1221 for (perIt = periodicVerts.begin();
1222 perIt != periodicVerts.end(); ++perIt)
1225 for (i = 0; i < perIt->second.size(); ++i)
1227 perIt2 = periodicVerts.find(perIt->second[i].id);
1228 ASSERTL0(perIt2 != periodicVerts.end(),
1229 "Couldn't find periodic vertex.");
1231 for (j = 0; j < perIt2->second.size(); ++j)
1233 if (perIt2->second[j].id == perIt->first)
1239 for (k = 0; k < perIt->second.size(); ++k)
1241 if (perIt2->second[j].id == perIt->second[k].id)
1250 perIt->second.push_back(perIt2->second[j]);
1258 for (perIt = periodicVerts.begin();
1259 perIt != periodicVerts.end(); ++perIt)
1261 if (locVerts.count(perIt->first) > 0)
1273 as<LocalRegions::Expansion1D>();
1277 if (traceEl->GetLeftAdjacentElementEdge () == -1 ||
1278 traceEl->GetRightAdjacentElementEdge() == -1)
1288 int traceGeomId = traceEl->GetGeom1D()->GetGlobalID();
1294 fwd = traceGeomId == min(traceGeomId,pIt->second[0].id);
1298 int offset =
m_trace->GetPhys_Offset(traceEl->GetElmtId());
1301 GetTraceToUniversalMapUnique(offset) >= 0;
1305 else if (traceEl->GetLeftAdjacentElementEdge () != -1 &&
1306 traceEl->GetRightAdjacentElementEdge() != -1)
1310 (traceEl->GetLeftAdjacentElementExp().get()) ==
1315 ASSERTL2(
false,
"Unconnected trace element!");
1362 int cnt, n, e,
npts, phys_offset;
1381 GetNFwdLocTracePts();
1390 boost::unordered_map<int,pair<int,int> >
::iterator it3;
1396 for(cnt = n = 0; n < nexp; ++n)
1401 for(e = 0; e < exp2d->GetNedges(); ++e, ++cnt)
1403 int offset =
m_trace->GetPhys_Offset(
1404 elmtToTrace[n][e]->GetElmtId());
1408 exp2d->GetEdgePhysVals(e, elmtToTrace[n][e],
1409 field + phys_offset,
1410 e_tmp = Fwd + offset);
1414 exp2d->GetEdgePhysVals(e, elmtToTrace[n][e],
1415 field + phys_offset,
1416 e_tmp = Bwd + offset);
1436 GetBndCondTraceToGlobalTraceMap(cnt+e));
1454 "Method not set up for non-zero Neumann "
1455 "boundary condition");
1456 id2 =
m_trace->GetPhys_Offset(
1457 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1467 "Method not set up for this boundary condition.");
1487 "Field must be in physical state to extract trace space.");
1509 int n, e, offset, phys_offset;
1515 "input array is of insufficient length");
1518 for(n = 0; n < nexp; ++n)
1522 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1524 offset =
m_trace->GetPhys_Offset(
1525 elmtToTrace[n][e]->GetElmtId());
1526 (*m_exp)[n]->GetEdgePhysVals(e, elmtToTrace[n][e],
1527 inarray + phys_offset,
1528 e_tmp = outarray + offset);
1538 int e, n, offset, t_offset;
1546 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1548 t_offset =
GetTrace()->GetPhys_Offset(
1549 elmtToTrace[n][e]->GetElmtId());
1551 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1552 e,elmtToTrace[n][e],
1555 e_outarray = outarray+offset);
1586 m_trace->IProductWRTBase(Fn, Fcoeffs);
1593 int e, n, offset, t_offset;
1601 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1603 t_offset =
GetTrace()->GetPhys_Offset(
1604 elmtToTrace[n][e]->GetElmtId());
1605 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1606 e, elmtToTrace[n][e],
1608 e_outarray = outarray+offset);
1642 int e,n,offset, t_offset;
1650 for (e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1652 t_offset =
GetTrace()->GetPhys_Offset(
1653 elmtToTrace[n][e]->GetElmtId());
1658 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1659 e, elmtToTrace[n][e], Fwd+t_offset,
1660 e_outarray = outarray+offset);
1664 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1665 e, elmtToTrace[n][e], Bwd+t_offset,
1666 e_outarray = outarray+offset);
1683 map<int, int> globalIdMap;
1696 globalIdMap[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
1716 as<LocalRegions::Expansion1D>();
1719 graph2D->GetElementsFromEdge(exp1d->GetGeom1D());
1722 m_Element->GetGlobalID()];
1723 m_BCtoEdgMap[cnt] = (*tmp)[0]->m_EdgeIndx;
1732 boost::shared_ptr<ExpList> &result,
1733 const bool DeclareCoeffPhysArrays)
1736 int offsetOld, offsetNew;
1737 std::vector<unsigned int> eIDs;
1743 for (cnt = n = 0; n < i; ++n)
1751 eIDs.push_back(ElmtID[cnt+n]);
1757 (*
this, eIDs, DeclareCoeffPhysArrays);
1760 if( DeclareCoeffPhysArrays)
1763 for (n = 0; n < result->GetExpSize(); ++n)
1765 nq =
GetExp(ElmtID[cnt+n])->GetTotPoints();
1767 offsetNew = result->GetPhys_Offset(n);
1769 tmp2 = result->UpdatePhys()+ offsetNew, 1);
1771 nq =
GetExp(ElmtID[cnt+n])->GetNcoeffs();
1773 offsetNew = result->GetCoeff_Offset(n);
1775 tmp2 = result->UpdateCoeffs()+ offsetNew, 1);
1808 int i,e,ncoeff_edge;
1818 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1822 edge_lambda = loc_lambda;
1832 int nEdges = (*m_exp)[i]->GetNedges();
1835 for(e = 0; e < nEdges; ++e)
1837 edgedir = (*m_exp)[eid]->GetEorient(e);
1838 ncoeff_edge = elmtToTrace[eid][e]->GetNcoeffs();
1840 Vmath::Vcopy(ncoeff_edge, edge_lambda, 1, edgeCoeffs[e], 1);
1841 elmtToTrace[eid][e]->SetCoeffsToOrientation(
1842 edgedir, edgeCoeffs[e], edgeCoeffs[e]);
1843 edge_lambda = edge_lambda + ncoeff_edge;
1846 (*m_exp)[eid]->DGDeriv(dir,
1850 out_tmp = out_d+cnt);
1851 cnt += (*m_exp)[eid]->GetNcoeffs();
1866 const bool PhysSpaceForcing)
1869 int i,j,n,cnt,cnt1,nbndry;
1880 if(PhysSpaceForcing)
1893 int GloBndDofs =
m_traceMap->GetNumGlobalBndCoeffs();
1894 int NumDirichlet =
m_traceMap->GetNumLocalDirBndCoeffs();
1915 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1924 for(cnt = cnt1 = n = 0; n < nexp; ++n)
1930 e_l = loc_lambda + cnt1;
1937 Floc =
Transpose(*(HDGLamToU->GetBlock(n,n)))*ElmtFce;
1956 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
1965 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
1975 if(GloBndDofs - NumDirichlet > 0)
1994 m_traceMap->GlobalToLocalBnd(BndSol,loc_lambda);
1997 out = (*InvHDGHelm)*F + (*HDGLamToU)*LocLambda;
2015 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
2020 m_traceMap->GlobalToLocalBnd(inarray, loc_lambda);
2021 LocLambda = (*HDGHelm) * LocLambda;
2022 m_traceMap->AssembleBnd(loc_lambda,outarray);
2040 map<int, RobinBCInfoSharedPtr> returnval;
2056 int npoints = locExpList->GetNpoints();
2062 locExpList->GetCoords(x0, x1, x2);
2065 boost::static_pointer_cast<
2070 coeffeqn.
Evaluate(x0, x1, x2, 0.0, coeffphys);
2072 for(e = 0; e < locExpList->GetExpSize(); ++e)
2078 Array_tmp = coeffphys +
2079 locExpList->GetPhys_Offset(e));
2081 elmtid = ElmtID[cnt+e];
2083 if(returnval.count(elmtid) != 0)
2085 rInfo->next = returnval.find(elmtid)->second;
2087 returnval[elmtid] = rInfo;
2119 int i,cnt,e,ncoeff_edge;
2126 int eid,nq_elmt, nm_elmt;
2127 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
2132 edge_lambda = loc_lambda;
2139 nq_elmt = (*m_exp)[eid]->GetTotPoints();
2140 nm_elmt = (*m_exp)[eid]->GetNcoeffs();
2144 out_tmp = force + nm_elmt;
2147 int num_points0 = (*m_exp)[eid]->GetBasis(0)->GetNumPoints();
2148 int num_points1 = (*m_exp)[eid]->GetBasis(1)->GetNumPoints();
2149 int num_modes0 = (*m_exp)[eid]->GetBasis(0)->GetNumModes();
2150 int num_modes1 = (*m_exp)[eid]->GetBasis(1)->GetNumModes();
2155 int nEdges = (*m_exp)[i]->GetNedges();
2158 for(e = 0; e < (*m_exp)[eid]->GetNedges(); ++e)
2160 edgedir = (*m_exp)[eid]->GetEorient(e);
2161 ncoeff_edge = elmtToTrace[eid][e]->GetNcoeffs();
2163 Vmath::Vcopy(ncoeff_edge, edge_lambda, 1, edgeCoeffs[e], 1);
2164 elmtToTrace[eid][e]->SetCoeffsToOrientation(
2165 edgedir, edgeCoeffs[e], edgeCoeffs[e]);
2166 edge_lambda = edge_lambda + ncoeff_edge;
2194 ASSERTL0(
false,
"Wrong shape type, HDG postprocessing is not implemented");
2200 (*m_exp)[eid]->DGDeriv(
2202 elmtToTrace[eid], edgeCoeffs, out_tmp);
2203 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2205 ppExp->IProductWRTDerivBase(0,qrhs,force);
2209 (*m_exp)[eid]->DGDeriv(
2211 elmtToTrace[eid], edgeCoeffs, out_tmp);
2213 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2215 ppExp->IProductWRTDerivBase(1,qrhs,out_tmp);
2220 (*m_exp)[eid]->BwdTrans(
2222 force[0] = (*m_exp)[eid]->Integral(qrhs);
2236 ppExp->BwdTrans(out.
GetPtr(), work);
2237 (*m_exp)[eid]->FwdTrans(work, tmp_coeffs = outarray +
m_coeff_offset[eid]);
2255 const std::string varName,
2265 for (i = 0; i < nbnd; ++i)
2271 npoints = locExpList->GetNpoints();
2279 locExpList->GetCoords(x0, x1, x2);
2283 locExpList->GetCoords(x0, x1, x2);
2291 = boost::static_pointer_cast<
2303 boost::static_pointer_cast<
2306 m_dirichletCondition;
2308 condition.
Evaluate(x0, x1, x2, time,
2309 locExpList->UpdatePhys());
2312 locExpList->FwdTrans_BndConstrained(
2313 locExpList->GetPhys(),
2314 locExpList->UpdateCoeffs());
2330 boost::static_pointer_cast<
2334 condition.
Evaluate(x0, x1, x2, time,
2335 locExpList->UpdatePhys());
2338 locExpList->IProductWRTBase(
2339 locExpList->GetPhys(),
2340 locExpList->UpdateCoeffs());
2357 boost::static_pointer_cast<
2361 condition.
Evaluate(x0, x1, x2, time,
2362 locExpList->UpdatePhys());
2365 locExpList->IProductWRTBase(
2366 locExpList->GetPhys(),
2367 locExpList->UpdateCoeffs());
2371 ASSERTL0(
false,
"This type of BC not implemented yet");
2381 locExpList->FwdTrans_IterPerExp(
2382 locExpList->GetPhys(),
2383 locExpList->UpdateCoeffs());
2387 ASSERTL0(
false,
"This type of BC not implemented yet");
GlobalSysSolnType GetGlobalSysSolnType() const
Return the associated solution type.
const DNekScalBlkMatSharedPtr & GetBlockMatrix(const GlobalMatrixKey &gkey)
const Array< OneD, const NekDouble > & GetCoeffs() const
This function returns (a reference to) the array (implemented as m_coeffs) containing all local expa...
virtual void v_ExtractTracePhys(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This method extracts the trace (edges in 2D) from the field inarray and puts the values in outarray...
#define ASSERTL0(condition, msg)
virtual void v_Reset()
Reset geometry information, metrics, matrix managers and geometry information.
void FindPeriodicEdges(const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
Determine the periodic edges and vertices for the given graph.
void ExtractFileBCs(const std::string &fileName, LibUtilities::CommSharedPtr comm, const std::string &varName, const boost::shared_ptr< ExpList > locExpList)
virtual void v_AddTraceIntegral(const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
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.
Array< OneD, int > m_BCtoElmMap
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...
std::vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
const BoundaryConditionCollection & GetBoundaryConditions(void) const
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
boost::shared_ptr< RobinBCInfo > RobinBCInfoSharedPtr
boost::shared_ptr< QuadGeom > QuadGeomSharedPtr
const boost::shared_ptr< LocalRegions::ExpansionVector > GetExp() const
This function returns the vector of elements in the expansion.
GlobalLinSysSharedPtr GetGlobalBndLinSys(const GlobalLinSysKey &mkey)
Lagrange Polynomials using the Gauss points .
PeriodicMap m_periodicEdges
A map which identifies pairs of periodic edges.
void BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
std::map< int, std::vector< unsigned int > > BndRegionOrdering
std::map< ConstFactorType, NekDouble > ConstFactorMap
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
void GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Array< OneD, NekDouble > m_phys
The global expansion evaluated at the quadrature points.
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.
std::map< int, std::vector< unsigned int > > CompositeOrdering
boost::shared_ptr< NeumannBoundaryCondition > NeumannBCShPtr
Array< OneD, NekDouble > m_coeffs
Concatenation of all local expansion coefficients.
boost::shared_ptr< MeshGraph2D > MeshGraph2DSharedPtr
int GetExpSize(void)
This function returns the number of elements in the expansion.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual std::map< int, RobinBCInfoSharedPtr > v_GetRobinBCInfo()
Search through the edge expansions and identify which ones have Robin/Mixed type boundary conditions...
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, .
virtual void v_GetBndElmtExpansion(int i, boost::shared_ptr< ExpList > &result, const bool DeclareCoeffPhysArrays)
Principle Orthogonal Functions .
boost::shared_ptr< DirichletBoundaryCondition > DirichletBCShPtr
bool SameTypeOfBoundaryConditions(const DisContField2D &In)
Array< OneD, int > m_coeff_offset
Offset of elemental data into the array m_coeffs.
Base class for all multi-elemental spectral/hp expansions.
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
DisContField2D()
Default constructor.
The base class for all shapes.
boost::shared_ptr< ExpList > & GetTrace()
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
std::vector< int > m_periodicBwdCopy
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
boost::shared_ptr< LocalRegions::ExpansionVector > m_exp
The list of local expansions.
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)
boost::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
virtual ~DisContField2D()
Default destructor.
std::vector< bool > m_leftAdjacentEdges
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
boost::shared_ptr< SegGeom > SegGeomSharedPtr
std::set< int > m_boundaryEdges
A set storing the global IDs of any boundary edges.
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 .
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, const bool PhysSpaceForcing)
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
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Principle Orthogonal Functions .
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
SpatialDomains::MeshGraphSharedPtr m_graph
Mesh associated with this expansion list.
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.
boost::shared_ptr< Expansion > ExpansionSharedPtr
std::map< int, BoundaryConditionMapShPtr > BoundaryConditionCollection
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
boost::shared_ptr< GeometryVector > Composite
bool IsLeftAdjacentEdge(const int n, const int e)
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
virtual void v_Reset()
Reset this field, so that geometry information can be updated.
static const NekDouble kNekUnsetDouble
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.
AssemblyMapDGSharedPtr m_traceMap
const Array< OneD, const NekDouble > & GetPhys() const
This function returns (a reference to) the array (implemented as m_phys) containing the function ev...
void SetUpDG(const std::string="DefaultVar")
Set up all DG member variables and maps.
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
boost::shared_ptr< ElementEdgeVector > ElementEdgeVectorSharedPtr
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
LibUtilities::CommSharedPtr m_comm
Communicator.
static AssemblyMapSharedPtr NullAssemblyMapSharedPtr
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
GlobalLinSysMapShPtr m_globalBndMat
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
int GetNcoeffs(void) const
Returns the total number of local degrees of freedom .
virtual void v_GetFwdBwdTracePhys(const Array< OneD, const NekDouble > &field, 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...
boost::shared_ptr< TriGeom > TriGeomSharedPtr
void EvaluateHDGPostProcessing(Array< OneD, NekDouble > &outarray)
Evaluate HDG post-processing to increase polynomial order of solution.
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.
const BoundaryRegionCollection & GetBoundaryRegions(void) const
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...
Array< OneD, int > m_BCtoEdgMap
boost::shared_ptr< BoundaryConditionBase > BoundaryConditionShPtr
boost::shared_ptr< Basis > BasisSharedPtr
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
void GenerateBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph2D, const SpatialDomains::BoundaryConditions &bcs, const std::string &variable, const bool DeclareCoeffPhysArrays=true)
This function discretises the boundary conditions by setting up a list of one-dimensional boundary ex...
virtual void v_GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Set up a list of element IDs and edge IDs that link to the boundary conditions.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
boost::shared_ptr< Expansion1D > Expansion1DSharedPtr
NekDouble L2(const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &soln=NullNekDouble1DArray)
This function calculates the error with respect to soln of the global spectral/hp element approximat...
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
NekDouble L2_DGDeriv(const int dir, const Array< OneD, const NekDouble > &soln)
Calculate the error of the derivative using the consistent DG evaluation of .
Describes the specification for a Basis.
Array< OneD, DataType > & GetPtr()
boost::shared_ptr< RobinBoundaryCondition > RobinBCShPtr
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.
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr