85 WARNINGL0(
false,
"LFR is deprecated, use LDG instead");
93 int nConvectiveFields = pFields.size();
94 int nDim = pFields[0]->GetCoordim(0);
95 int nSolutionPts = pFields[0]->GetTotPoints();
96 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
116 for (i = 0; i < nConvectiveFields; ++i)
132 for (j = 0; j < nDim; ++j)
171 int nLocalSolutionPts;
172 int nElements = pFields[0]->GetExpSize();
173 int nDimensions = pFields[0]->GetCoordim(0);
174 int nSolutionPts = pFields[0]->GetTotPoints();
175 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
178 for (i = 0; i < nDimensions; ++i)
197 for (n = 0; n < nElements; ++n)
199 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
200 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
201 phys_offset = pFields[0]->GetPhys_Offset(n);
208 for (i = 0; i < nLocalSolutionPts; ++i)
210 m_jac[i + phys_offset] = jac[0];
228 for (n = 0; n < nElements; ++n)
230 base = pFields[0]->GetExp(n)->GetBase();
231 nquad0 = base[0]->GetNumPoints();
232 nquad1 = base[1]->GetNumPoints();
240 pFields[0]->GetExp(n)->GetTraceQFactors(0, auxArray1 =
242 pFields[0]->GetExp(n)->GetTraceQFactors(1, auxArray1 =
244 pFields[0]->GetExp(n)->GetTraceQFactors(2, auxArray1 =
246 pFields[0]->GetExp(n)->GetTraceQFactors(3, auxArray1 =
249 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
250 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
251 phys_offset = pFields[0]->GetPhys_Offset(n);
264 ->GetDerivFactors(ptsKeys);
273 for (i = 0; i < nLocalSolutionPts; ++i)
275 m_jac[i + phys_offset] = jac[i];
276 m_gmat[0][i + phys_offset] = gmat[0][i];
277 m_gmat[1][i + phys_offset] = gmat[1][i];
278 m_gmat[2][i + phys_offset] = gmat[2][i];
279 m_gmat[3][i + phys_offset] = gmat[3][i];
284 for (i = 0; i < nLocalSolutionPts; ++i)
286 m_jac[i + phys_offset] = jac[0];
287 m_gmat[0][i + phys_offset] = gmat[0][0];
288 m_gmat[1][i + phys_offset] = gmat[1][0];
289 m_gmat[2][i + phys_offset] = gmat[2][0];
290 m_gmat[3][i + phys_offset] = gmat[3][0];
298 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
303 ASSERTL0(
false,
"Expansion dimension not recognised");
334 int nquad0, nquad1, nquad2;
335 int nmodes0, nmodes1, nmodes2;
338 int nElements = pFields[0]->GetExpSize();
339 int nDim = pFields[0]->GetCoordim(0);
348 for (n = 0; n < nElements; ++n)
350 base = pFields[0]->GetExp(n)->GetBase();
351 nquad0 = base[0]->GetNumPoints();
352 nmodes0 = base[0]->GetNumModes();
356 base[0]->GetZW(z0, w0);
368 int p0 = nmodes0 - 1;
375 std::tgamma(2 * p0 + 1) /
376 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
386 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
387 (ap0 * std::tgamma(p0 + 1)) *
388 (ap0 * std::tgamma(p0 + 1)));
392 c0 = 2.0 * (p0 + 1.0) /
393 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
394 (ap0 * std::tgamma(p0 + 1)));
399 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
400 (ap0 * std::tgamma(p0 + 1)));
404 c0 = 10000000000000000.0;
407 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
408 (ap0 * std::tgamma(p0 + 1)) *
409 (ap0 * std::tgamma(p0 + 1));
411 NekDouble overeta0 = 1.0 / (1.0 + etap0);
424 for (i = 0; i < nquad0; ++i)
434 for (i = 0; i < nquad0; ++i)
457 for (n = 0; n < nElements; ++n)
459 base = pFields[0]->GetExp(n)->GetBase();
460 nquad0 = base[0]->GetNumPoints();
461 nquad1 = base[1]->GetNumPoints();
462 nmodes0 = base[0]->GetNumModes();
463 nmodes1 = base[1]->GetNumModes();
470 base[0]->GetZW(z0, w0);
471 base[1]->GetZW(z1, w1);
488 int p0 = nmodes0 - 1;
489 int p1 = nmodes1 - 1;
497 std::tgamma(2 * p0 + 1) /
498 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
501 std::tgamma(2 * p1 + 1) /
502 (pow(2.0, p1) * std::tgamma(p1 + 1) * std::tgamma(p1 + 1));
513 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
514 (ap0 * std::tgamma(p0 + 1)) *
515 (ap0 * std::tgamma(p0 + 1)));
518 ((2.0 * p1 + 1.0) * (p1 + 1.0) *
519 (ap1 * std::tgamma(p1 + 1)) *
520 (ap1 * std::tgamma(p1 + 1)));
524 c0 = 2.0 * (p0 + 1.0) /
525 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
526 (ap0 * std::tgamma(p0 + 1)));
528 c1 = 2.0 * (p1 + 1.0) /
529 ((2.0 * p1 + 1.0) * p1 * (ap1 * std::tgamma(p1 + 1)) *
530 (ap1 * std::tgamma(p1 + 1)));
535 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
536 (ap0 * std::tgamma(p0 + 1)));
539 -2.0 / ((2.0 * p1 + 1.0) * (ap1 * std::tgamma(p1 + 1)) *
540 (ap1 * std::tgamma(p1 + 1)));
544 c0 = 10000000000000000.0;
545 c1 = 10000000000000000.0;
548 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
549 (ap0 * std::tgamma(p0 + 1)) *
550 (ap0 * std::tgamma(p0 + 1));
552 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0) *
553 (ap1 * std::tgamma(p1 + 1)) *
554 (ap1 * std::tgamma(p1 + 1));
556 NekDouble overeta0 = 1.0 / (1.0 + etap0);
557 NekDouble overeta1 = 1.0 / (1.0 + etap1);
576 for (i = 0; i < nquad0; ++i)
586 for (i = 0; i < nquad1; ++i)
596 for (i = 0; i < nquad0; ++i)
606 for (i = 0; i < nquad1; ++i)
626 for (n = 0; n < nElements; ++n)
628 base = pFields[0]->GetExp(n)->GetBase();
629 nquad0 = base[0]->GetNumPoints();
630 nquad1 = base[1]->GetNumPoints();
631 nquad2 = base[2]->GetNumPoints();
632 nmodes0 = base[0]->GetNumModes();
633 nmodes1 = base[1]->GetNumModes();
634 nmodes2 = base[2]->GetNumModes();
643 base[0]->GetZW(z0, w0);
644 base[1]->GetZW(z1, w1);
645 base[1]->GetZW(z2, w2);
667 int p0 = nmodes0 - 1;
668 int p1 = nmodes1 - 1;
669 int p2 = nmodes2 - 1;
678 std::tgamma(2 * p0 + 1) /
679 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
683 std::tgamma(2 * p1 + 1) /
684 (pow(2.0, p1) * std::tgamma(p1 + 1) * std::tgamma(p1 + 1));
688 std::tgamma(2 * p2 + 1) /
689 (pow(2.0, p2) * std::tgamma(p2 + 1) * std::tgamma(p2 + 1));
701 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
702 (ap0 * std::tgamma(p0 + 1)) *
703 (ap0 * std::tgamma(p0 + 1)));
706 ((2.0 * p1 + 1.0) * (p1 + 1.0) *
707 (ap1 * std::tgamma(p1 + 1)) *
708 (ap1 * std::tgamma(p1 + 1)));
711 ((2.0 * p2 + 1.0) * (p2 + 1.0) *
712 (ap2 * std::tgamma(p2 + 1)) *
713 (ap2 * std::tgamma(p2 + 1)));
717 c0 = 2.0 * (p0 + 1.0) /
718 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
719 (ap0 * std::tgamma(p0 + 1)));
721 c1 = 2.0 * (p1 + 1.0) /
722 ((2.0 * p1 + 1.0) * p1 * (ap1 * std::tgamma(p1 + 1)) *
723 (ap1 * std::tgamma(p1 + 1)));
725 c2 = 2.0 * (p2 + 1.0) /
726 ((2.0 * p2 + 1.0) * p2 * (ap2 * std::tgamma(p2 + 1)) *
727 (ap2 * std::tgamma(p2 + 1)));
732 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
733 (ap0 * std::tgamma(p0 + 1)));
736 -2.0 / ((2.0 * p1 + 1.0) * (ap1 * std::tgamma(p1 + 1)) *
737 (ap1 * std::tgamma(p1 + 1)));
740 -2.0 / ((2.0 * p2 + 1.0) * (ap2 * std::tgamma(p2 + 1)) *
741 (ap2 * std::tgamma(p2 + 1)));
745 c0 = 10000000000000000.0;
746 c1 = 10000000000000000.0;
747 c2 = 10000000000000000.0;
750 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
751 (ap0 * std::tgamma(p0 + 1)) *
752 (ap0 * std::tgamma(p0 + 1));
754 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0) *
755 (ap1 * std::tgamma(p1 + 1)) *
756 (ap1 * std::tgamma(p1 + 1));
758 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0) *
759 (ap2 * std::tgamma(p2 + 1)) *
760 (ap2 * std::tgamma(p2 + 1));
762 NekDouble overeta0 = 1.0 / (1.0 + etap0);
763 NekDouble overeta1 = 1.0 / (1.0 + etap1);
764 NekDouble overeta2 = 1.0 / (1.0 + etap2);
789 for (i = 0; i < nquad0; ++i)
799 for (i = 0; i < nquad1; ++i)
809 for (i = 0; i < nquad2; ++i)
819 for (i = 0; i < nquad0; ++i)
829 for (i = 0; i < nquad1; ++i)
839 for (i = 0; i < nquad2; ++i)
852 ASSERTL0(
false,
"Expansion dimension not recognised");
864 const std::size_t nConvectiveFields,
876 Basis = fields[0]->GetExp(0)->GetBase();
878 int nElements = fields[0]->GetExpSize();
879 int nDim = fields[0]->GetCoordim(0);
880 int nSolutionPts = fields[0]->GetTotPoints();
881 int nCoeffs = fields[0]->GetNcoeffs();
884 for (i = 0; i < nConvectiveFields; ++i)
897 for (i = 0; i < nConvectiveFields; ++i)
901 for (n = 0; n < nElements; n++)
903 phys_offset = fields[0]->GetPhys_Offset(n);
905 fields[i]->GetExp(n)->PhysDeriv(
906 0, auxArray1 = inarray[i] + phys_offset,
907 auxArray2 =
m_DU1[i][0] + phys_offset);
923 1, &
m_D1[i][0][0], 1);
933 for (i = 0; i < nConvectiveFields; ++i)
937 for (n = 0; n < nElements; n++)
939 phys_offset = fields[0]->GetPhys_Offset(n);
941 fields[i]->GetExp(n)->PhysDeriv(
942 0, auxArray1 =
m_D1[i][0] + phys_offset,
943 auxArray2 =
m_DD1[i][0] + phys_offset);
959 1, &outarray[i][0], 1);
962 if (!(
Basis[0]->Collocation()))
964 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
965 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
973 for (i = 0; i < nConvectiveFields; ++i)
975 for (j = 0; j < nDim; ++j)
984 &
m_gmat[0][0], 1, &u1_hat[0], 1);
990 &
m_gmat[1][0], 1, &u2_hat[0], 1);
998 &
m_gmat[2][0], 1, &u1_hat[0], 1);
1004 &
m_gmat[3][0], 1, &u2_hat[0], 1);
1010 for (n = 0; n < nElements; n++)
1012 phys_offset = fields[0]->GetPhys_Offset(n);
1014 fields[i]->GetExp(n)->StdPhysDeriv(
1015 auxArray1 = u1_hat + phys_offset,
1016 auxArray2 =
m_tmp1[i][j] + phys_offset);
1018 fields[i]->GetExp(n)->StdPhysDeriv(
1019 auxArray1 = u2_hat + phys_offset,
1021 auxArray2 =
m_tmp2[i][j] + phys_offset);
1029 &
m_DU1[i][j][0], 1);
1033 DerCFlux_2D(nConvectiveFields, j, fields, inarray[i],
1039 for (j = 0; j < nSolutionPts; ++j)
1060 for (j = 0; j < nSolutionPts; j++)
1072 for (j = 0; j < nDim; ++j)
1085 for (i = 0; i < nConvectiveFields; ++i)
1090 for (j = 0; j < nSolutionPts; j++)
1101 for (n = 0; n < nElements; n++)
1103 phys_offset = fields[0]->GetPhys_Offset(n);
1105 fields[0]->GetExp(n)->StdPhysDeriv(
1106 auxArray1 = f_hat + phys_offset,
1107 auxArray2 =
m_DD1[i][0] + phys_offset);
1109 fields[0]->GetExp(n)->StdPhysDeriv(
1111 auxArray2 =
m_DD1[i][1] + phys_offset);
1119 if (
Basis[0]->GetPointsType() ==
1121 Basis[1]->GetPointsType() ==
1135 &outarray[i][0], 1);
1140 &outarray[i][0], 1);
1143 if (!(
Basis[0]->Collocation()))
1145 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1146 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1154 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1170 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1171 int nvariables = fields.size();
1172 int nDim = fields[0]->GetCoordim(0);
1180 for (i = 0; i < nDim; ++i)
1188 for (j = 0; j < nDim; ++j)
1190 for (i = 0; i < nvariables; ++i)
1193 fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd);
1203 fields[i]->GetTrace()->Upwind(Vn, Fwd, Bwd, fluxtemp);
1214 if (fields[0]->GetBndCondExpansions().size())
1245 int nBndEdgePts, nBndEdges;
1247 int nBndRegions = fields[var]->GetBndCondExpansions().size();
1248 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1252 fields[var]->ExtractTracePhys(ufield, uplus);
1255 for (i = 0; i < nBndRegions; ++i)
1258 nBndEdges = fields[var]->GetBndCondExpansions()[i]->GetExpSize();
1261 for (e = 0; e < nBndEdges; ++e)
1264 nBndEdgePts = fields[var]
1265 ->GetBndCondExpansions()[i]
1270 id1 = fields[var]->GetBndCondExpansions()[i]->GetPhys_Offset(e);
1273 id2 = fields[0]->GetTrace()->GetPhys_Offset(
1274 fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt++));
1278 ->GetBndConditions()[i]
1283 &(fields[var]->GetBndCondExpansions()[i]->GetPhys())[id1],
1284 1, &penaltyflux[id2], 1);
1287 else if ((fields[var]->GetBndConditions()[i])
1288 ->GetBoundaryConditionType() ==
1291 Vmath::Vcopy(nBndEdgePts, &uplus[id2], 1, &penaltyflux[id2], 1);
1308 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1309 int nvariables = fields.size();
1310 int nDim = fields[0]->GetCoordim(0);
1323 for (i = 0; i < nDim; ++i)
1330 for (i = 0; i < nvariables; ++i)
1333 for (j = 0; j < nDim; ++j)
1336 fields[i]->GetFwdBwdTracePhys(qfield[i][j], qFwd, qBwd);
1350 fields[i]->GetTrace()->Upwind(Vn, qBwd, qFwd, qfluxtemp);
1356 if (fields[0]->GetBndCondExpansions().size())
1365 Vmath::Vadd(nTracePts, qfluxtemp, 1, qflux[i], 1, qflux[i], 1);
1380 int nBndEdges, nBndEdgePts;
1381 int nBndRegions = fields[var]->GetBndCondExpansions().size();
1382 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1388 fields[var]->ExtractTracePhys(qfield, qtemp);
1390 for (i = 0; i < nBndRegions; ++i)
1392 nBndEdges = fields[var]->GetBndCondExpansions()[i]->GetExpSize();
1395 for (e = 0; e < nBndEdges; ++e)
1397 nBndEdgePts = fields[var]
1398 ->GetBndCondExpansions()[i]
1402 id1 = fields[var]->GetBndCondExpansions()[i]->GetPhys_Offset(e);
1404 id2 = fields[0]->GetTrace()->GetPhys_Offset(
1405 fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt++));
1410 ->GetBndConditions()[i]
1414 &qtemp[id2], 1, &penaltyflux[id2], 1);
1417 else if ((fields[var]->GetBndConditions()[i])
1418 ->GetBoundaryConditionType() ==
1423 &(fields[var]->GetBndCondExpansions()[i]->GetPhys())[id1],
1424 1, &penaltyflux[id2], 1);
1441 [[maybe_unused]]
const int nConvectiveFields,
1447 int nLocalSolutionPts, phys_offset, t_offset;
1455 Basis = fields[0]->GetExp(0)->GetBasis(0);
1457 int nElements = fields[0]->GetExpSize();
1458 int nSolutionPts = fields[0]->GetTotPoints();
1460 vector<bool> leftAdjacentTraces =
1461 std::static_pointer_cast<MultiRegions::DisContField>(fields[0])
1462 ->GetLeftAdjacentTraces();
1473 fields[0]->GetTraceMap()->GetElmtToTrace();
1475 for (n = 0; n < nElements; ++n)
1477 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1478 phys_offset = fields[0]->GetPhys_Offset(n);
1482 Vmath::Vcopy(nLocalSolutionPts, &flux[phys_offset], 1, &tmparrayX1[0],
1485 fields[0]->GetExp(n)->GetTracePhysVals(0, elmtToTrace[n][0], tmparrayX1,
1488 t_offset = fields[0]->GetTrace()->GetPhys_Offset(
1489 elmtToTrace[n][0]->GetElmtId());
1491 if (leftAdjacentTraces[2 * n])
1493 JumpL[n] = -iFlux[t_offset] - tmpFluxVertex[0];
1497 JumpL[n] = iFlux[t_offset] - tmpFluxVertex[0];
1500 t_offset = fields[0]->GetTrace()->GetPhys_Offset(
1501 elmtToTrace[n][1]->GetElmtId());
1503 fields[0]->GetExp(n)->GetTracePhysVals(1, elmtToTrace[n][1], tmparrayX1,
1505 if (leftAdjacentTraces[2 * n + 1])
1507 JumpR[n] = iFlux[t_offset] - tmpFluxVertex[0];
1511 JumpR[n] = -iFlux[t_offset] - tmpFluxVertex[0];
1515 for (n = 0; n < nElements; ++n)
1517 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1518 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1519 phys_offset = fields[0]->GetPhys_Offset(n);
1527 JumpL[n] = JumpL[n] * jac[0];
1528 JumpR[n] = JumpR[n] * jac[0];
1539 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1540 &derCFlux[phys_offset], 1);
1560 [[maybe_unused]]
const int nConvectiveFields,
const int direction,
1565 int n, e, i, j, cnt;
1569 int nElements = fields[0]->GetExpSize();
1570 int trace_offset, phys_offset;
1571 int nLocalSolutionPts;
1579 fields[0]->GetTraceMap()->GetElmtToTrace();
1582 for (n = 0; n < nElements; ++n)
1585 phys_offset = fields[0]->GetPhys_Offset(n);
1586 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1587 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1596 base = fields[0]->GetExp(n)->GetBase();
1597 nquad0 = base[0]->GetNumPoints();
1598 nquad1 = base[1]->GetNumPoints();
1606 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1609 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1615 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1616 elmtToTrace[n][e]->GetElmtId());
1621 fields[0]->GetExp(n)->GetTracePhysVals(
1622 e, elmtToTrace[n][e], flux + phys_offset, auxArray1 = tmparray);
1627 Vmath::Vsub(nEdgePts, &iFlux[trace_offset], 1, &tmparray[0], 1,
1632 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1641 ->as<LocalRegions::Expansion2D>()
1649 fields[0]->GetExp(n)->GetTracePhysVals(
1650 e, elmtToTrace[n][e], jac, auxArray1 = jacEdge);
1654 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1662 for (j = 0; j < nEdgePts; j++)
1664 fluxJumps[j] = fluxJumps[j] * jacEdge[j];
1672 Vmath::Smul(nEdgePts, jac[0], fluxJumps, 1, fluxJumps, 1);
1681 for (i = 0; i < nquad0; ++i)
1683 for (j = 0; j < nquad1; ++j)
1685 cnt = i + j * nquad0;
1686 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1691 for (i = 0; i < nquad1; ++i)
1693 for (j = 0; j < nquad0; ++j)
1695 cnt = (nquad0)*i + j;
1696 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1701 for (i = 0; i < nquad0; ++i)
1703 for (j = 0; j < nquad1; ++j)
1705 cnt = j * nquad0 + i;
1706 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1711 for (i = 0; i < nquad1; ++i)
1713 for (j = 0; j < nquad0; ++j)
1715 cnt = j + i * nquad0;
1716 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1722 ASSERTL0(
false,
"edge value (< 3) is out of range");
1731 Vmath::Vadd(nLocalSolutionPts, &divCFluxE1[0], 1, &divCFluxE3[0], 1,
1732 &derCFlux[phys_offset], 1);
1734 else if (direction == 1)
1736 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE2[0], 1,
1737 &derCFlux[phys_offset], 1);
1756 [[maybe_unused]]
const int nConvectiveFields,
1763 int n, e, i, j, cnt;
1765 int nElements = fields[0]->GetExpSize();
1767 int nLocalSolutionPts;
1778 fields[0]->GetTraceMap()->GetElmtToTrace();
1781 for (n = 0; n < nElements; ++n)
1784 phys_offset = fields[0]->GetPhys_Offset(n);
1785 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1787 base = fields[0]->GetExp(n)->GetBase();
1788 nquad0 = base[0]->GetNumPoints();
1789 nquad1 = base[1]->GetNumPoints();
1797 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1800 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1809 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1810 elmtToTrace[n][e]->GetElmtId());
1814 fields[0]->GetExp(n)->GetTraceNormal(e);
1818 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
1819 fluxX1 + phys_offset,
1820 auxArray1 = tmparrayX1);
1824 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
1825 fluxX2 + phys_offset,
1826 auxArray1 = tmparrayX2);
1829 for (i = 0; i < nEdgePts; ++i)
1836 Vmath::Vsub(nEdgePts, &numericalFlux[trace_offset], 1, &fluxN[0], 1,
1840 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1844 auxArray2 = fluxJumps, 1);
1847 for (i = 0; i < nEdgePts; ++i)
1852 fluxJumps[i] = -fluxJumps[i];
1860 for (i = 0; i < nquad0; ++i)
1863 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
1865 for (j = 0; j < nquad1; ++j)
1867 cnt = i + j * nquad0;
1868 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1873 for (i = 0; i < nquad1; ++i)
1876 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
1878 for (j = 0; j < nquad0; ++j)
1880 cnt = (nquad0)*i + j;
1881 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1886 for (i = 0; i < nquad0; ++i)
1889 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
1891 for (j = 0; j < nquad1; ++j)
1893 cnt = j * nquad0 + i;
1894 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1899 for (i = 0; i < nquad1; ++i)
1902 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
1903 for (j = 0; j < nquad0; ++j)
1905 cnt = j + i * nquad0;
1906 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1912 ASSERTL0(
false,
"edge value (< 3) is out of range");
1918 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE1[0], 1,
1919 &divCFlux[phys_offset], 1);
1921 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1922 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1924 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1925 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
1944 [[maybe_unused]]
const int nConvectiveFields,
1951 int n, e, i, j, cnt;
1953 int nElements = fields[0]->GetExpSize();
1954 int nLocalSolutionPts;
1965 fields[0]->GetTraceMap()->GetElmtToTrace();
1968 for (n = 0; n < nElements; ++n)
1971 phys_offset = fields[0]->GetPhys_Offset(n);
1972 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1974 base = fields[0]->GetExp(n)->GetBase();
1975 nquad0 = base[0]->GetNumPoints();
1976 nquad1 = base[1]->GetNumPoints();
1984 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1987 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1996 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1997 elmtToTrace[n][e]->GetElmtId());
2001 fields[0]->GetExp(n)->GetTraceNormal(e);
2010 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2011 fluxX2 + phys_offset,
2012 auxArray1 = fluxN_D);
2017 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2021 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2025 auxArray2 = fluxN, 1);
2028 auxArray2 = fluxN_D, 1);
2032 for (i = 0; i < nquad0; ++i)
2035 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
2038 for (i = 0; i < nEdgePts; ++i)
2045 fluxN_R[i] = -fluxN_R[i];
2051 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2056 for (i = 0; i < nquad0; ++i)
2058 for (j = 0; j < nquad1; ++j)
2060 cnt = i + j * nquad0;
2061 divCFluxE0[cnt] = -fluxJumps[i] *
m_dGL_xi2[n][j];
2069 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2070 fluxX1 + phys_offset,
2071 auxArray1 = fluxN_D);
2074 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2078 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2082 auxArray2 = fluxN, 1);
2085 auxArray2 = fluxN_D, 1);
2089 for (i = 0; i < nquad1; ++i)
2092 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
2095 for (i = 0; i < nEdgePts; ++i)
2102 fluxN_R[i] = -fluxN_R[i];
2108 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2113 for (i = 0; i < nquad1; ++i)
2115 for (j = 0; j < nquad0; ++j)
2117 cnt = (nquad0)*i + j;
2118 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
2128 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2129 fluxX2 + phys_offset,
2130 auxArray1 = fluxN_D);
2133 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2137 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2141 auxArray2 = fluxN, 1);
2144 auxArray2 = fluxN_D, 1);
2148 for (i = 0; i < nquad0; ++i)
2151 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
2154 for (i = 0; i < nEdgePts; ++i)
2161 fluxN_R[i] = -fluxN_R[i];
2168 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2173 for (i = 0; i < nquad0; ++i)
2175 for (j = 0; j < nquad1; ++j)
2177 cnt = j * nquad0 + i;
2178 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
2187 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2188 fluxX1 + phys_offset,
2189 auxArray1 = fluxN_D);
2193 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2197 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2201 auxArray2 = fluxN, 1);
2204 auxArray2 = fluxN_D, 1);
2208 for (i = 0; i < nquad1; ++i)
2211 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
2214 for (i = 0; i < nEdgePts; ++i)
2221 fluxN_R[i] = -fluxN_R[i];
2228 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2233 for (i = 0; i < nquad1; ++i)
2235 for (j = 0; j < nquad0; ++j)
2237 cnt = j + i * nquad0;
2238 divCFluxE3[cnt] = -fluxJumps[i] *
m_dGL_xi1[n][j];
2243 ASSERTL0(
false,
"edge value (< 3) is out of range");
2249 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE1[0], 1,
2250 &divCFlux[phys_offset], 1);
2252 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2253 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2255 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2256 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
#define ASSERTL0(condition, msg)
#define WARNINGL0(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.
static Array< OneD, NekDouble > NullNekDouble1DArray
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.