91 int nConvectiveFields = pFields.size();
92 int nDim = pFields[0]->GetCoordim(0);
93 int nSolutionPts = pFields[0]->GetTotPoints();
94 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
114 for (i = 0; i < nConvectiveFields; ++i)
130 for (j = 0; j < nDim; ++j)
169 int nLocalSolutionPts;
170 int nElements = pFields[0]->GetExpSize();
171 int nDimensions = pFields[0]->GetCoordim(0);
172 int nSolutionPts = pFields[0]->GetTotPoints();
173 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
176 for (i = 0; i < nDimensions; ++i)
195 for (n = 0; n < nElements; ++n)
197 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
198 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
199 phys_offset = pFields[0]->GetPhys_Offset(n);
206 for (i = 0; i < nLocalSolutionPts; ++i)
208 m_jac[i + phys_offset] = jac[0];
226 for (n = 0; n < nElements; ++n)
228 base = pFields[0]->GetExp(n)->GetBase();
229 nquad0 = base[0]->GetNumPoints();
230 nquad1 = base[1]->GetNumPoints();
238 pFields[0]->GetExp(n)->GetTraceQFactors(0, auxArray1 =
240 pFields[0]->GetExp(n)->GetTraceQFactors(1, auxArray1 =
242 pFields[0]->GetExp(n)->GetTraceQFactors(2, auxArray1 =
244 pFields[0]->GetExp(n)->GetTraceQFactors(3, auxArray1 =
247 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
248 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
249 phys_offset = pFields[0]->GetPhys_Offset(n);
262 ->GetDerivFactors(ptsKeys);
271 for (i = 0; i < nLocalSolutionPts; ++i)
273 m_jac[i + phys_offset] = jac[i];
274 m_gmat[0][i + phys_offset] = gmat[0][i];
275 m_gmat[1][i + phys_offset] = gmat[1][i];
276 m_gmat[2][i + phys_offset] = gmat[2][i];
277 m_gmat[3][i + phys_offset] = gmat[3][i];
282 for (i = 0; i < nLocalSolutionPts; ++i)
284 m_jac[i + phys_offset] = jac[0];
285 m_gmat[0][i + phys_offset] = gmat[0][0];
286 m_gmat[1][i + phys_offset] = gmat[1][0];
287 m_gmat[2][i + phys_offset] = gmat[2][0];
288 m_gmat[3][i + phys_offset] = gmat[3][0];
296 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
301 ASSERTL0(
false,
"Expansion dimension not recognised");
332 int nquad0, nquad1, nquad2;
333 int nmodes0, nmodes1, nmodes2;
336 int nElements = pFields[0]->GetExpSize();
337 int nDim = pFields[0]->GetCoordim(0);
346 for (n = 0; n < nElements; ++n)
348 base = pFields[0]->GetExp(n)->GetBase();
349 nquad0 = base[0]->GetNumPoints();
350 nmodes0 = base[0]->GetNumModes();
354 base[0]->GetZW(z0, w0);
366 int p0 = nmodes0 - 1;
373 std::tgamma(2 * p0 + 1) /
374 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
384 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
385 (ap0 * std::tgamma(p0 + 1)) *
386 (ap0 * std::tgamma(p0 + 1)));
390 c0 = 2.0 * (p0 + 1.0) /
391 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
392 (ap0 * std::tgamma(p0 + 1)));
397 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
398 (ap0 * std::tgamma(p0 + 1)));
402 c0 = 10000000000000000.0;
405 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
406 (ap0 * std::tgamma(p0 + 1)) *
407 (ap0 * std::tgamma(p0 + 1));
409 NekDouble overeta0 = 1.0 / (1.0 + etap0);
422 for (i = 0; i < nquad0; ++i)
432 for (i = 0; i < nquad0; ++i)
455 for (n = 0; n < nElements; ++n)
457 base = pFields[0]->GetExp(n)->GetBase();
458 nquad0 = base[0]->GetNumPoints();
459 nquad1 = base[1]->GetNumPoints();
460 nmodes0 = base[0]->GetNumModes();
461 nmodes1 = base[1]->GetNumModes();
468 base[0]->GetZW(z0, w0);
469 base[1]->GetZW(z1, w1);
486 int p0 = nmodes0 - 1;
487 int p1 = nmodes1 - 1;
495 std::tgamma(2 * p0 + 1) /
496 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
499 std::tgamma(2 * p1 + 1) /
500 (pow(2.0, p1) * std::tgamma(p1 + 1) * std::tgamma(p1 + 1));
511 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
512 (ap0 * std::tgamma(p0 + 1)) *
513 (ap0 * std::tgamma(p0 + 1)));
516 ((2.0 * p1 + 1.0) * (p1 + 1.0) *
517 (ap1 * std::tgamma(p1 + 1)) *
518 (ap1 * std::tgamma(p1 + 1)));
522 c0 = 2.0 * (p0 + 1.0) /
523 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
524 (ap0 * std::tgamma(p0 + 1)));
526 c1 = 2.0 * (p1 + 1.0) /
527 ((2.0 * p1 + 1.0) * p1 * (ap1 * std::tgamma(p1 + 1)) *
528 (ap1 * std::tgamma(p1 + 1)));
533 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
534 (ap0 * std::tgamma(p0 + 1)));
537 -2.0 / ((2.0 * p1 + 1.0) * (ap1 * std::tgamma(p1 + 1)) *
538 (ap1 * std::tgamma(p1 + 1)));
542 c0 = 10000000000000000.0;
543 c1 = 10000000000000000.0;
546 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
547 (ap0 * std::tgamma(p0 + 1)) *
548 (ap0 * std::tgamma(p0 + 1));
550 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0) *
551 (ap1 * std::tgamma(p1 + 1)) *
552 (ap1 * std::tgamma(p1 + 1));
554 NekDouble overeta0 = 1.0 / (1.0 + etap0);
555 NekDouble overeta1 = 1.0 / (1.0 + etap1);
574 for (i = 0; i < nquad0; ++i)
584 for (i = 0; i < nquad1; ++i)
594 for (i = 0; i < nquad0; ++i)
604 for (i = 0; i < nquad1; ++i)
624 for (n = 0; n < nElements; ++n)
626 base = pFields[0]->GetExp(n)->GetBase();
627 nquad0 = base[0]->GetNumPoints();
628 nquad1 = base[1]->GetNumPoints();
629 nquad2 = base[2]->GetNumPoints();
630 nmodes0 = base[0]->GetNumModes();
631 nmodes1 = base[1]->GetNumModes();
632 nmodes2 = base[2]->GetNumModes();
641 base[0]->GetZW(z0, w0);
642 base[1]->GetZW(z1, w1);
643 base[1]->GetZW(z2, w2);
665 int p0 = nmodes0 - 1;
666 int p1 = nmodes1 - 1;
667 int p2 = nmodes2 - 1;
676 std::tgamma(2 * p0 + 1) /
677 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
681 std::tgamma(2 * p1 + 1) /
682 (pow(2.0, p1) * std::tgamma(p1 + 1) * std::tgamma(p1 + 1));
686 std::tgamma(2 * p2 + 1) /
687 (pow(2.0, p2) * std::tgamma(p2 + 1) * std::tgamma(p2 + 1));
699 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
700 (ap0 * std::tgamma(p0 + 1)) *
701 (ap0 * std::tgamma(p0 + 1)));
704 ((2.0 * p1 + 1.0) * (p1 + 1.0) *
705 (ap1 * std::tgamma(p1 + 1)) *
706 (ap1 * std::tgamma(p1 + 1)));
709 ((2.0 * p2 + 1.0) * (p2 + 1.0) *
710 (ap2 * std::tgamma(p2 + 1)) *
711 (ap2 * std::tgamma(p2 + 1)));
715 c0 = 2.0 * (p0 + 1.0) /
716 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
717 (ap0 * std::tgamma(p0 + 1)));
719 c1 = 2.0 * (p1 + 1.0) /
720 ((2.0 * p1 + 1.0) * p1 * (ap1 * std::tgamma(p1 + 1)) *
721 (ap1 * std::tgamma(p1 + 1)));
723 c2 = 2.0 * (p2 + 1.0) /
724 ((2.0 * p2 + 1.0) * p2 * (ap2 * std::tgamma(p2 + 1)) *
725 (ap2 * std::tgamma(p2 + 1)));
730 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
731 (ap0 * std::tgamma(p0 + 1)));
734 -2.0 / ((2.0 * p1 + 1.0) * (ap1 * std::tgamma(p1 + 1)) *
735 (ap1 * std::tgamma(p1 + 1)));
738 -2.0 / ((2.0 * p2 + 1.0) * (ap2 * std::tgamma(p2 + 1)) *
739 (ap2 * std::tgamma(p2 + 1)));
743 c0 = 10000000000000000.0;
744 c1 = 10000000000000000.0;
745 c2 = 10000000000000000.0;
748 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
749 (ap0 * std::tgamma(p0 + 1)) *
750 (ap0 * std::tgamma(p0 + 1));
752 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0) *
753 (ap1 * std::tgamma(p1 + 1)) *
754 (ap1 * std::tgamma(p1 + 1));
756 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0) *
757 (ap2 * std::tgamma(p2 + 1)) *
758 (ap2 * std::tgamma(p2 + 1));
760 NekDouble overeta0 = 1.0 / (1.0 + etap0);
761 NekDouble overeta1 = 1.0 / (1.0 + etap1);
762 NekDouble overeta2 = 1.0 / (1.0 + etap2);
787 for (i = 0; i < nquad0; ++i)
797 for (i = 0; i < nquad1; ++i)
807 for (i = 0; i < nquad2; ++i)
817 for (i = 0; i < nquad0; ++i)
827 for (i = 0; i < nquad1; ++i)
837 for (i = 0; i < nquad2; ++i)
850 ASSERTL0(
false,
"Expansion dimension not recognised");
862 const std::size_t nConvectiveFields,
874 Basis = fields[0]->GetExp(0)->GetBase();
876 int nElements = fields[0]->GetExpSize();
877 int nDim = fields[0]->GetCoordim(0);
878 int nSolutionPts = fields[0]->GetTotPoints();
879 int nCoeffs = fields[0]->GetNcoeffs();
882 for (i = 0; i < nConvectiveFields; ++i)
895 for (i = 0; i < nConvectiveFields; ++i)
899 for (n = 0; n < nElements; n++)
901 phys_offset = fields[0]->GetPhys_Offset(n);
903 fields[i]->GetExp(n)->PhysDeriv(
904 0, auxArray1 = inarray[i] + phys_offset,
905 auxArray2 =
m_DU1[i][0] + phys_offset);
921 1, &
m_D1[i][0][0], 1);
931 for (i = 0; i < nConvectiveFields; ++i)
935 for (n = 0; n < nElements; n++)
937 phys_offset = fields[0]->GetPhys_Offset(n);
939 fields[i]->GetExp(n)->PhysDeriv(
940 0, auxArray1 =
m_D1[i][0] + phys_offset,
941 auxArray2 =
m_DD1[i][0] + phys_offset);
957 1, &outarray[i][0], 1);
960 if (!(
Basis[0]->Collocation()))
962 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
963 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
971 for (i = 0; i < nConvectiveFields; ++i)
973 for (j = 0; j < nDim; ++j)
982 &
m_gmat[0][0], 1, &u1_hat[0], 1);
988 &
m_gmat[1][0], 1, &u2_hat[0], 1);
996 &
m_gmat[2][0], 1, &u1_hat[0], 1);
1002 &
m_gmat[3][0], 1, &u2_hat[0], 1);
1008 for (n = 0; n < nElements; n++)
1010 phys_offset = fields[0]->GetPhys_Offset(n);
1012 fields[i]->GetExp(n)->StdPhysDeriv(
1013 0, auxArray1 = u1_hat + phys_offset,
1014 auxArray2 =
m_tmp1[i][j] + phys_offset);
1016 fields[i]->GetExp(n)->StdPhysDeriv(
1017 1, auxArray1 = u2_hat + phys_offset,
1018 auxArray2 =
m_tmp2[i][j] + phys_offset);
1026 &
m_DU1[i][j][0], 1);
1030 DerCFlux_2D(nConvectiveFields, j, fields, inarray[i],
1036 for (j = 0; j < nSolutionPts; ++j)
1057 for (j = 0; j < nSolutionPts; j++)
1069 for (j = 0; j < nDim; ++j)
1082 for (i = 0; i < nConvectiveFields; ++i)
1087 for (j = 0; j < nSolutionPts; j++)
1098 for (n = 0; n < nElements; n++)
1100 phys_offset = fields[0]->GetPhys_Offset(n);
1102 fields[0]->GetExp(n)->StdPhysDeriv(
1103 0, auxArray1 = f_hat + phys_offset,
1104 auxArray2 =
m_DD1[i][0] + phys_offset);
1106 fields[0]->GetExp(n)->StdPhysDeriv(
1107 1, auxArray1 = g_hat + phys_offset,
1108 auxArray2 =
m_DD1[i][1] + phys_offset);
1116 if (
Basis[0]->GetPointsType() ==
1118 Basis[1]->GetPointsType() ==
1132 &outarray[i][0], 1);
1137 &outarray[i][0], 1);
1140 if (!(
Basis[0]->Collocation()))
1142 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1143 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1151 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1167 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1168 int nvariables = fields.size();
1169 int nDim = fields[0]->GetCoordim(0);
1177 for (i = 0; i < nDim; ++i)
1185 for (j = 0; j < nDim; ++j)
1187 for (i = 0; i < nvariables; ++i)
1190 fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd);
1200 fields[i]->GetTrace()->Upwind(Vn, Fwd, Bwd, fluxtemp);
1211 if (fields[0]->GetBndCondExpansions().size())
1242 int nBndEdgePts, nBndEdges;
1244 int nBndRegions = fields[var]->GetBndCondExpansions().size();
1245 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1249 fields[var]->ExtractTracePhys(ufield, uplus);
1252 for (i = 0; i < nBndRegions; ++i)
1255 nBndEdges = fields[var]->GetBndCondExpansions()[i]->GetExpSize();
1258 for (e = 0; e < nBndEdges; ++e)
1261 nBndEdgePts = fields[var]
1262 ->GetBndCondExpansions()[i]
1267 id1 = fields[var]->GetBndCondExpansions()[i]->GetPhys_Offset(e);
1270 id2 = fields[0]->GetTrace()->GetPhys_Offset(
1271 fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt++));
1275 ->GetBndConditions()[i]
1280 &(fields[var]->GetBndCondExpansions()[i]->GetPhys())[id1],
1281 1, &penaltyflux[id2], 1);
1284 else if ((fields[var]->GetBndConditions()[i])
1285 ->GetBoundaryConditionType() ==
1288 Vmath::Vcopy(nBndEdgePts, &uplus[id2], 1, &penaltyflux[id2], 1);
1305 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1306 int nvariables = fields.size();
1307 int nDim = fields[0]->GetCoordim(0);
1320 for (i = 0; i < nDim; ++i)
1327 for (i = 0; i < nvariables; ++i)
1330 for (j = 0; j < nDim; ++j)
1333 fields[i]->GetFwdBwdTracePhys(qfield[i][j], qFwd, qBwd);
1347 fields[i]->GetTrace()->Upwind(Vn, qBwd, qFwd, qfluxtemp);
1353 if (fields[0]->GetBndCondExpansions().size())
1362 Vmath::Vadd(nTracePts, qfluxtemp, 1, qflux[i], 1, qflux[i], 1);
1377 int nBndEdges, nBndEdgePts;
1378 int nBndRegions = fields[var]->GetBndCondExpansions().size();
1379 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1385 fields[var]->ExtractTracePhys(qfield, qtemp);
1387 for (i = 0; i < nBndRegions; ++i)
1389 nBndEdges = fields[var]->GetBndCondExpansions()[i]->GetExpSize();
1392 for (e = 0; e < nBndEdges; ++e)
1394 nBndEdgePts = fields[var]
1395 ->GetBndCondExpansions()[i]
1399 id1 = fields[var]->GetBndCondExpansions()[i]->GetPhys_Offset(e);
1401 id2 = fields[0]->GetTrace()->GetPhys_Offset(
1402 fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt++));
1407 ->GetBndConditions()[i]
1411 &qtemp[id2], 1, &penaltyflux[id2], 1);
1414 else if ((fields[var]->GetBndConditions()[i])
1415 ->GetBoundaryConditionType() ==
1420 &(fields[var]->GetBndCondExpansions()[i]->GetPhys())[id1],
1421 1, &penaltyflux[id2], 1);
1438 [[maybe_unused]]
const int nConvectiveFields,
1444 int nLocalSolutionPts, phys_offset, t_offset;
1452 Basis = fields[0]->GetExp(0)->GetBasis(0);
1454 int nElements = fields[0]->GetExpSize();
1455 int nSolutionPts = fields[0]->GetTotPoints();
1457 vector<bool> leftAdjacentTraces =
1458 std::static_pointer_cast<MultiRegions::DisContField>(fields[0])
1459 ->GetLeftAdjacentTraces();
1470 fields[0]->GetTraceMap()->GetElmtToTrace();
1472 for (n = 0; n < nElements; ++n)
1474 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1475 phys_offset = fields[0]->GetPhys_Offset(n);
1479 Vmath::Vcopy(nLocalSolutionPts, &flux[phys_offset], 1, &tmparrayX1[0],
1482 fields[0]->GetExp(n)->GetTracePhysVals(0, elmtToTrace[n][0], tmparrayX1,
1485 t_offset = fields[0]->GetTrace()->GetPhys_Offset(
1486 elmtToTrace[n][0]->GetElmtId());
1488 if (leftAdjacentTraces[2 * n])
1490 JumpL[n] = -iFlux[t_offset] - tmpFluxVertex[0];
1494 JumpL[n] = iFlux[t_offset] - tmpFluxVertex[0];
1497 t_offset = fields[0]->GetTrace()->GetPhys_Offset(
1498 elmtToTrace[n][1]->GetElmtId());
1500 fields[0]->GetExp(n)->GetTracePhysVals(1, elmtToTrace[n][1], tmparrayX1,
1502 if (leftAdjacentTraces[2 * n + 1])
1504 JumpR[n] = iFlux[t_offset] - tmpFluxVertex[0];
1508 JumpR[n] = -iFlux[t_offset] - tmpFluxVertex[0];
1512 for (n = 0; n < nElements; ++n)
1514 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1515 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1516 phys_offset = fields[0]->GetPhys_Offset(n);
1524 JumpL[n] = JumpL[n] * jac[0];
1525 JumpR[n] = JumpR[n] * jac[0];
1536 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1537 &derCFlux[phys_offset], 1);
1557 [[maybe_unused]]
const int nConvectiveFields,
const int direction,
1562 int n, e, i, j, cnt;
1566 int nElements = fields[0]->GetExpSize();
1567 int trace_offset, phys_offset;
1568 int nLocalSolutionPts;
1576 fields[0]->GetTraceMap()->GetElmtToTrace();
1579 for (n = 0; n < nElements; ++n)
1582 phys_offset = fields[0]->GetPhys_Offset(n);
1583 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1584 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1593 base = fields[0]->GetExp(n)->GetBase();
1594 nquad0 = base[0]->GetNumPoints();
1595 nquad1 = base[1]->GetNumPoints();
1603 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1606 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1612 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1613 elmtToTrace[n][e]->GetElmtId());
1618 fields[0]->GetExp(n)->GetTracePhysVals(
1619 e, elmtToTrace[n][e], flux + phys_offset, auxArray1 = tmparray);
1624 Vmath::Vsub(nEdgePts, &iFlux[trace_offset], 1, &tmparray[0], 1,
1629 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1638 ->as<LocalRegions::Expansion2D>()
1646 fields[0]->GetExp(n)->GetTracePhysVals(
1647 e, elmtToTrace[n][e], jac, auxArray1 = jacEdge);
1651 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1659 for (j = 0; j < nEdgePts; j++)
1661 fluxJumps[j] = fluxJumps[j] * jacEdge[j];
1669 Vmath::Smul(nEdgePts, jac[0], fluxJumps, 1, fluxJumps, 1);
1678 for (i = 0; i < nquad0; ++i)
1680 for (j = 0; j < nquad1; ++j)
1682 cnt = i + j * nquad0;
1683 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1688 for (i = 0; i < nquad1; ++i)
1690 for (j = 0; j < nquad0; ++j)
1692 cnt = (nquad0)*i + j;
1693 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1698 for (i = 0; i < nquad0; ++i)
1700 for (j = 0; j < nquad1; ++j)
1702 cnt = j * nquad0 + i;
1703 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1708 for (i = 0; i < nquad1; ++i)
1710 for (j = 0; j < nquad0; ++j)
1712 cnt = j + i * nquad0;
1713 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1719 ASSERTL0(
false,
"edge value (< 3) is out of range");
1728 Vmath::Vadd(nLocalSolutionPts, &divCFluxE1[0], 1, &divCFluxE3[0], 1,
1729 &derCFlux[phys_offset], 1);
1731 else if (direction == 1)
1733 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE2[0], 1,
1734 &derCFlux[phys_offset], 1);
1753 [[maybe_unused]]
const int nConvectiveFields,
1760 int n, e, i, j, cnt;
1762 int nElements = fields[0]->GetExpSize();
1764 int nLocalSolutionPts;
1775 fields[0]->GetTraceMap()->GetElmtToTrace();
1778 for (n = 0; n < nElements; ++n)
1781 phys_offset = fields[0]->GetPhys_Offset(n);
1782 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1784 base = fields[0]->GetExp(n)->GetBase();
1785 nquad0 = base[0]->GetNumPoints();
1786 nquad1 = base[1]->GetNumPoints();
1794 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1797 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1806 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1807 elmtToTrace[n][e]->GetElmtId());
1811 fields[0]->GetExp(n)->GetTraceNormal(e);
1815 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
1816 fluxX1 + phys_offset,
1817 auxArray1 = tmparrayX1);
1821 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
1822 fluxX2 + phys_offset,
1823 auxArray1 = tmparrayX2);
1826 for (i = 0; i < nEdgePts; ++i)
1833 Vmath::Vsub(nEdgePts, &numericalFlux[trace_offset], 1, &fluxN[0], 1,
1837 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1841 auxArray2 = fluxJumps, 1);
1844 for (i = 0; i < nEdgePts; ++i)
1849 fluxJumps[i] = -fluxJumps[i];
1857 for (i = 0; i < nquad0; ++i)
1860 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
1862 for (j = 0; j < nquad1; ++j)
1864 cnt = i + j * nquad0;
1865 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1870 for (i = 0; i < nquad1; ++i)
1873 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
1875 for (j = 0; j < nquad0; ++j)
1877 cnt = (nquad0)*i + j;
1878 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1883 for (i = 0; i < nquad0; ++i)
1886 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
1888 for (j = 0; j < nquad1; ++j)
1890 cnt = j * nquad0 + i;
1891 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1896 for (i = 0; i < nquad1; ++i)
1899 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
1900 for (j = 0; j < nquad0; ++j)
1902 cnt = j + i * nquad0;
1903 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1909 ASSERTL0(
false,
"edge value (< 3) is out of range");
1915 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE1[0], 1,
1916 &divCFlux[phys_offset], 1);
1918 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1919 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1921 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1922 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
1941 [[maybe_unused]]
const int nConvectiveFields,
1948 int n, e, i, j, cnt;
1950 int nElements = fields[0]->GetExpSize();
1951 int nLocalSolutionPts;
1962 fields[0]->GetTraceMap()->GetElmtToTrace();
1965 for (n = 0; n < nElements; ++n)
1968 phys_offset = fields[0]->GetPhys_Offset(n);
1969 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1971 base = fields[0]->GetExp(n)->GetBase();
1972 nquad0 = base[0]->GetNumPoints();
1973 nquad1 = base[1]->GetNumPoints();
1981 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1984 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1993 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1994 elmtToTrace[n][e]->GetElmtId());
1998 fields[0]->GetExp(n)->GetTraceNormal(e);
2007 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2008 fluxX2 + phys_offset,
2009 auxArray1 = fluxN_D);
2014 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2018 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2022 auxArray2 = fluxN, 1);
2025 auxArray2 = fluxN_D, 1);
2029 for (i = 0; i < nquad0; ++i)
2032 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
2035 for (i = 0; i < nEdgePts; ++i)
2042 fluxN_R[i] = -fluxN_R[i];
2048 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2053 for (i = 0; i < nquad0; ++i)
2055 for (j = 0; j < nquad1; ++j)
2057 cnt = i + j * nquad0;
2058 divCFluxE0[cnt] = -fluxJumps[i] *
m_dGL_xi2[n][j];
2066 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2067 fluxX1 + phys_offset,
2068 auxArray1 = fluxN_D);
2071 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2075 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2079 auxArray2 = fluxN, 1);
2082 auxArray2 = fluxN_D, 1);
2086 for (i = 0; i < nquad1; ++i)
2089 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
2092 for (i = 0; i < nEdgePts; ++i)
2099 fluxN_R[i] = -fluxN_R[i];
2105 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2110 for (i = 0; i < nquad1; ++i)
2112 for (j = 0; j < nquad0; ++j)
2114 cnt = (nquad0)*i + j;
2115 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
2125 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2126 fluxX2 + phys_offset,
2127 auxArray1 = fluxN_D);
2130 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2134 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2138 auxArray2 = fluxN, 1);
2141 auxArray2 = fluxN_D, 1);
2145 for (i = 0; i < nquad0; ++i)
2148 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
2151 for (i = 0; i < nEdgePts; ++i)
2158 fluxN_R[i] = -fluxN_R[i];
2165 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2170 for (i = 0; i < nquad0; ++i)
2172 for (j = 0; j < nquad1; ++j)
2174 cnt = j * nquad0 + i;
2175 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
2184 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2185 fluxX1 + phys_offset,
2186 auxArray1 = fluxN_D);
2190 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2194 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2198 auxArray2 = fluxN, 1);
2201 auxArray2 = fluxN_D, 1);
2205 for (i = 0; i < nquad1; ++i)
2208 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
2211 for (i = 0; i < nEdgePts; ++i)
2218 fluxN_R[i] = -fluxN_R[i];
2225 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2230 for (i = 0; i < nquad1; ++i)
2232 for (j = 0; j < nquad0; ++j)
2234 cnt = j + i * nquad0;
2235 divCFluxE3[cnt] = -fluxJumps[i] *
m_dGL_xi1[n][j];
2240 ASSERTL0(
false,
"edge value (< 3) is out of range");
2246 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE1[0], 1,
2247 &divCFlux[phys_offset], 1);
2249 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2250 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2252 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2253 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
#define ASSERTL0(condition, msg)
Represents a basis of a given type.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
const SpatialDomains::GeomFactorsSharedPtr & GetMetricInfo() const
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tmp2
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi2
void v_Diffuse(const size_t nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd) override
Calculate FR Diffusion for the linear problems using an LDG interface flux.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_IF1
Array< OneD, NekDouble > m_jac
void DerCFlux_1D(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const NekDouble > &flux, const Array< OneD, const NekDouble > &iFlux, Array< OneD, NekDouble > &derCFlux)
Compute the derivative of the corrective flux for 1D problems.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DFC1
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DD1
DiffusionLFR(std::string diffType)
DiffusionLFR uses the Flux Reconstruction (FR) approach to compute the diffusion term....
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi1
Array< OneD, Array< OneD, NekDouble > > m_divFC
void DerCFlux_2D(const int nConvectiveFields, const int direction, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const NekDouble > &flux, const Array< OneD, NekDouble > &iFlux, Array< OneD, NekDouble > &derCFlux)
Compute the derivative of the corrective flux wrt a given coordinate for 2D problems.
void SetupMetrics(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Setup the metric terms to compute the contravariant fluxes. (i.e. this special metric terms transform...
LibUtilities::SessionReaderSharedPtr m_session
void WeakPenaltyforScalar(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const Array< OneD, const NekDouble > &ufield, Array< OneD, NekDouble > &penaltyflux)
Imposes appropriate bcs for the 1st order derivatives.
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi2
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi1
static std::string type[]
void WeakPenaltyforVector(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const int dir, const Array< OneD, const NekDouble > &qfield, Array< OneD, NekDouble > &penaltyflux, NekDouble C11)
Imposes appropriate bcs for the 2nd order derivatives.
void SetupCFunctions(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Setup the derivatives of the correction functions. For more details see J Sci Comput (2011) 47: 50–72...
void DivCFlux_2D(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const NekDouble > &fluxX1, const Array< OneD, const NekDouble > &fluxX2, const Array< OneD, const NekDouble > &numericalFlux, Array< OneD, NekDouble > &divCFlux)
Compute the divergence of the corrective flux for 2D problems.
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi3
void NumFluxforVector(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
Build the numerical flux for the 2nd order derivatives.
static DiffusionSharedPtr create(std::string diffType)
Array< OneD, Array< OneD, NekDouble > > m_gmat
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e0
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DU1
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DFC2
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e3
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tmp1
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e2
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_D1
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi3
void NumFluxforScalar(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
Builds the numerical flux for the 1st order derivatives.
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e1
void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields) override
Initiliase DiffusionLFR objects and store them before starting the time-stepping.
Array< OneD, Array< OneD, NekDouble > > m_IF2
Array< OneD, Array< OneD, NekDouble > > m_divFD
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_BD1
void DivCFlux_2D_Gauss(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const NekDouble > &fluxX1, const Array< OneD, const NekDouble > &fluxX2, const Array< OneD, const NekDouble > &numericalFlux, Array< OneD, NekDouble > &divCFlux)
Compute the divergence of the corrective flux for 2D problems where POINTSTYPE="GaussGaussLegendre".
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::vector< PointsKey > PointsKeyVector
@ eGaussGaussLegendre
1D Gauss-Gauss-Legendre quadrature points
DiffusionFactory & GetDiffusionFactory()
@ eDeformed
Geometry is curved or has non-constant factors.
void jacobd(const int np, const double *z, double *polyd, const int n, const double alpha, const double beta)
Calculate the derivative of Jacobi polynomials.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvp (scalar times vector plus vector): z = alpha*x + y.
void Neg(int n, T *x, const int incx)
Negate x = -x.
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.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
void Reverse(int n, const T *x, const int incx, T *y, const int incy)
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
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.