39#include <boost/algorithm/string/predicate.hpp>
99 int nConvectiveFields = pFields.size();
100 int nScalars = nConvectiveFields - 1;
101 int nDim = pFields[0]->GetCoordim(0);
102 int nSolutionPts = pFields[0]->GetTotPoints();
103 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
106 if (pSession->DefinesSolverInfo(
"HOMOGENEOUS"))
136 for (i = 0; i < nScalars; ++i)
145 for (j = 0; j < nDim; ++j)
156 for (i = 0; i < nConvectiveFields; ++i)
164 for (j = 0; j < nDim; ++j)
175 for (j = 0; j < nScalars; ++j)
185 for (j = 0; j < nScalars + 1; ++j)
215 int nLocalSolutionPts;
216 int nElements = pFields[0]->GetExpSize();
217 int nDimensions = pFields[0]->GetCoordim(0);
218 int nSolutionPts = pFields[0]->GetTotPoints();
219 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
222 for (i = 0; i < nDimensions; ++i)
241 for (n = 0; n < nElements; ++n)
243 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
244 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
245 phys_offset = pFields[0]->GetPhys_Offset(n);
252 for (i = 0; i < nLocalSolutionPts; ++i)
254 m_jac[i + phys_offset] = jac[0];
272 for (n = 0; n < nElements; ++n)
274 base = pFields[0]->GetExp(n)->GetBase();
275 nquad0 = base[0]->GetNumPoints();
276 nquad1 = base[1]->GetNumPoints();
284 pFields[0]->GetExp(n)->GetTraceQFactors(0, auxArray1 =
286 pFields[0]->GetExp(n)->GetTraceQFactors(1, auxArray1 =
288 pFields[0]->GetExp(n)->GetTraceQFactors(2, auxArray1 =
290 pFields[0]->GetExp(n)->GetTraceQFactors(3, auxArray1 =
293 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
294 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
295 phys_offset = pFields[0]->GetPhys_Offset(n);
308 ->GetDerivFactors(ptsKeys);
317 for (i = 0; i < nLocalSolutionPts; ++i)
319 m_jac[i + phys_offset] = jac[i];
320 m_gmat[0][i + phys_offset] = gmat[0][i];
321 m_gmat[1][i + phys_offset] = gmat[1][i];
322 m_gmat[2][i + phys_offset] = gmat[2][i];
323 m_gmat[3][i + phys_offset] = gmat[3][i];
328 for (i = 0; i < nLocalSolutionPts; ++i)
330 m_jac[i + phys_offset] = jac[0];
331 m_gmat[0][i + phys_offset] = gmat[0][0];
332 m_gmat[1][i + phys_offset] = gmat[1][0];
333 m_gmat[2][i + phys_offset] = gmat[2][0];
334 m_gmat[3][i + phys_offset] = gmat[3][0];
342 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
347 ASSERTL0(
false,
"Expansion dimension not recognised");
377 int nquad0, nquad1, nquad2;
378 int nmodes0, nmodes1, nmodes2;
381 int nElements = pFields[0]->GetExpSize();
382 int nDim = pFields[0]->GetCoordim(0);
391 for (n = 0; n < nElements; ++n)
393 base = pFields[0]->GetExp(n)->GetBase();
394 nquad0 = base[0]->GetNumPoints();
395 nmodes0 = base[0]->GetNumModes();
399 base[0]->GetZW(z0, w0);
411 int p0 = nmodes0 - 1;
418 std::tgamma(2 * p0 + 1) /
419 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
429 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
430 (ap0 * std::tgamma(p0 + 1)) *
431 (ap0 * std::tgamma(p0 + 1)));
435 c0 = 2.0 * (p0 + 1.0) /
436 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
437 (ap0 * std::tgamma(p0 + 1)));
442 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
443 (ap0 * std::tgamma(p0 + 1)));
447 c0 = 10000000000000000.0;
450 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
451 (ap0 * std::tgamma(p0 + 1)) *
452 (ap0 * std::tgamma(p0 + 1));
454 NekDouble overeta0 = 1.0 / (1.0 + etap0);
467 for (i = 0; i < nquad0; ++i)
477 for (i = 0; i < nquad0; ++i)
500 for (n = 0; n < nElements; ++n)
502 base = pFields[0]->GetExp(n)->GetBase();
503 nquad0 = base[0]->GetNumPoints();
504 nquad1 = base[1]->GetNumPoints();
505 nmodes0 = base[0]->GetNumModes();
506 nmodes1 = base[1]->GetNumModes();
513 base[0]->GetZW(z0, w0);
514 base[1]->GetZW(z1, w1);
531 int p0 = nmodes0 - 1;
532 int p1 = nmodes1 - 1;
540 std::tgamma(2 * p0 + 1) /
541 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
544 std::tgamma(2 * p1 + 1) /
545 (pow(2.0, p1) * std::tgamma(p1 + 1) * std::tgamma(p1 + 1));
556 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
557 (ap0 * std::tgamma(p0 + 1)) *
558 (ap0 * std::tgamma(p0 + 1)));
561 ((2.0 * p1 + 1.0) * (p1 + 1.0) *
562 (ap1 * std::tgamma(p1 + 1)) *
563 (ap1 * std::tgamma(p1 + 1)));
567 c0 = 2.0 * (p0 + 1.0) /
568 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
569 (ap0 * std::tgamma(p0 + 1)));
571 c1 = 2.0 * (p1 + 1.0) /
572 ((2.0 * p1 + 1.0) * p1 * (ap1 * std::tgamma(p1 + 1)) *
573 (ap1 * std::tgamma(p1 + 1)));
578 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
579 (ap0 * std::tgamma(p0 + 1)));
582 -2.0 / ((2.0 * p1 + 1.0) * (ap1 * std::tgamma(p1 + 1)) *
583 (ap1 * std::tgamma(p1 + 1)));
587 c0 = 10000000000000000.0;
588 c1 = 10000000000000000.0;
591 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
592 (ap0 * std::tgamma(p0 + 1)) *
593 (ap0 * std::tgamma(p0 + 1));
595 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0) *
596 (ap1 * std::tgamma(p1 + 1)) *
597 (ap1 * std::tgamma(p1 + 1));
599 NekDouble overeta0 = 1.0 / (1.0 + etap0);
600 NekDouble overeta1 = 1.0 / (1.0 + etap1);
619 for (i = 0; i < nquad0; ++i)
629 for (i = 0; i < nquad1; ++i)
639 for (i = 0; i < nquad0; ++i)
649 for (i = 0; i < nquad1; ++i)
669 for (n = 0; n < nElements; ++n)
671 base = pFields[0]->GetExp(n)->GetBase();
672 nquad0 = base[0]->GetNumPoints();
673 nquad1 = base[1]->GetNumPoints();
674 nquad2 = base[2]->GetNumPoints();
675 nmodes0 = base[0]->GetNumModes();
676 nmodes1 = base[1]->GetNumModes();
677 nmodes2 = base[2]->GetNumModes();
686 base[0]->GetZW(z0, w0);
687 base[1]->GetZW(z1, w1);
688 base[1]->GetZW(z2, w2);
710 int p0 = nmodes0 - 1;
711 int p1 = nmodes1 - 1;
712 int p2 = nmodes2 - 1;
721 std::tgamma(2 * p0 + 1) /
722 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
726 std::tgamma(2 * p1 + 1) /
727 (pow(2.0, p1) * std::tgamma(p1 + 1) * std::tgamma(p1 + 1));
731 std::tgamma(2 * p2 + 1) /
732 (pow(2.0, p2) * std::tgamma(p2 + 1) * std::tgamma(p2 + 1));
744 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
745 (ap0 * std::tgamma(p0 + 1)) *
746 (ap0 * std::tgamma(p0 + 1)));
749 ((2.0 * p1 + 1.0) * (p1 + 1.0) *
750 (ap1 * std::tgamma(p1 + 1)) *
751 (ap1 * std::tgamma(p1 + 1)));
754 ((2.0 * p2 + 1.0) * (p2 + 1.0) *
755 (ap2 * std::tgamma(p2 + 1)) *
756 (ap2 * std::tgamma(p2 + 1)));
760 c0 = 2.0 * (p0 + 1.0) /
761 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
762 (ap0 * std::tgamma(p0 + 1)));
764 c1 = 2.0 * (p1 + 1.0) /
765 ((2.0 * p1 + 1.0) * p1 * (ap1 * std::tgamma(p1 + 1)) *
766 (ap1 * std::tgamma(p1 + 1)));
768 c2 = 2.0 * (p2 + 1.0) /
769 ((2.0 * p2 + 1.0) * p2 * (ap2 * std::tgamma(p2 + 1)) *
770 (ap2 * std::tgamma(p2 + 1)));
775 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
776 (ap0 * std::tgamma(p0 + 1)));
779 -2.0 / ((2.0 * p1 + 1.0) * (ap1 * std::tgamma(p1 + 1)) *
780 (ap1 * std::tgamma(p1 + 1)));
783 -2.0 / ((2.0 * p2 + 1.0) * (ap2 * std::tgamma(p2 + 1)) *
784 (ap2 * std::tgamma(p2 + 1)));
788 c0 = 10000000000000000.0;
789 c1 = 10000000000000000.0;
790 c2 = 10000000000000000.0;
793 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
794 (ap0 * std::tgamma(p0 + 1)) *
795 (ap0 * std::tgamma(p0 + 1));
797 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0) *
798 (ap1 * std::tgamma(p1 + 1)) *
799 (ap1 * std::tgamma(p1 + 1));
801 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0) *
802 (ap2 * std::tgamma(p2 + 1)) *
803 (ap2 * std::tgamma(p2 + 1));
805 NekDouble overeta0 = 1.0 / (1.0 + etap0);
806 NekDouble overeta1 = 1.0 / (1.0 + etap1);
807 NekDouble overeta2 = 1.0 / (1.0 + etap2);
832 for (i = 0; i < nquad0; ++i)
842 for (i = 0; i < nquad1; ++i)
852 for (i = 0; i < nquad2; ++i)
862 for (i = 0; i < nquad0; ++i)
872 for (i = 0; i < nquad1; ++i)
882 for (i = 0; i < nquad2; ++i)
895 ASSERTL0(
false,
"Expansion dimension not recognised");
910 const std::size_t nConvectiveFields,
923 Basis = fields[0]->GetExp(0)->GetBase();
925 int nElements = fields[0]->GetExpSize();
926 int nDim = fields[0]->GetCoordim(0);
927 int nScalars = inarray.size();
928 int nSolutionPts = fields[0]->GetTotPoints();
929 int nCoeffs = fields[0]->GetNcoeffs();
932 for (i = 0; i < nConvectiveFields; ++i)
945 for (i = 0; i < nScalars; ++i)
949 for (n = 0; n < nElements; n++)
951 phys_offset = fields[0]->GetPhys_Offset(n);
953 fields[i]->GetExp(n)->PhysDeriv(
954 0, auxArray1 = inarray[i] + phys_offset,
955 auxArray2 =
m_DU1[i][0] + phys_offset);
971 1, &
m_D1[i][0][0], 1);
984 for (i = 0; i < nConvectiveFields; ++i)
988 for (n = 0; n < nElements; n++)
990 phys_offset = fields[0]->GetPhys_Offset(n);
992 fields[i]->GetExp(n)->PhysDeriv(
994 auxArray2 =
m_DD1[i][0] + phys_offset);
1010 1, &outarray[i][0], 1);
1013 if (!(
Basis[0]->Collocation()))
1015 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1016 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1024 for (i = 0; i < nScalars; ++i)
1026 for (j = 0; j < nDim; ++j)
1035 &
m_gmat[0][0], 1, &u1_hat[0], 1);
1041 &
m_gmat[1][0], 1, &u2_hat[0], 1);
1049 &
m_gmat[2][0], 1, &u1_hat[0], 1);
1055 &
m_gmat[3][0], 1, &u2_hat[0], 1);
1061 for (n = 0; n < nElements; n++)
1063 phys_offset = fields[0]->GetPhys_Offset(n);
1065 fields[i]->GetExp(n)->StdPhysDeriv(
1066 0, auxArray1 = u1_hat + phys_offset,
1067 auxArray2 =
m_tmp1[i][j] + phys_offset);
1069 fields[i]->GetExp(n)->StdPhysDeriv(
1070 1, auxArray1 = u2_hat + phys_offset,
1071 auxArray2 =
m_tmp2[i][j] + phys_offset);
1079 &
m_DU1[i][j][0], 1);
1083 DerCFlux_2D(nConvectiveFields, j, fields, inarray[i],
1089 for (j = 0; j < nSolutionPts; ++j)
1110 for (j = 0; j < nSolutionPts; j++)
1122 for (j = 0; j < nDim; ++j)
1132 for (i = 0; i < nScalars; ++i)
1147 for (i = 0; i < nConvectiveFields; ++i)
1153 for (j = 0; j < nSolutionPts; j++)
1164 for (n = 0; n < nElements; n++)
1166 phys_offset = fields[0]->GetPhys_Offset(n);
1168 fields[0]->GetExp(n)->StdPhysDeriv(
1169 0, auxArray1 = f_hat + phys_offset,
1170 auxArray2 =
m_DD1[i][0] + phys_offset);
1172 fields[0]->GetExp(n)->StdPhysDeriv(
1173 1, auxArray1 = g_hat + phys_offset,
1174 auxArray2 =
m_DD1[i][1] + phys_offset);
1182 if (
Basis[0]->GetPointsType() ==
1184 Basis[1]->GetPointsType() ==
1198 &outarray[i][0], 1);
1203 &outarray[i][0], 1);
1206 if (!(
Basis[0]->Collocation()))
1208 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1209 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1217 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1233 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1234 int nScalars = inarray.size();
1235 int nDim = fields[0]->GetCoordim(0);
1241 for (i = 0; i < nDim; ++i)
1243 fields[0]->ExtractTracePhys(inarray[i],
m_traceVel[i]);
1253 for (i = 0; i < nScalars; ++i)
1258 fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
1259 fields[0]->GetTrace()->Upwind(Vn, Fwd[i], Bwd[i], numflux[i]);
1263 if (fields[0]->GetBndCondExpansions().size())
1269 for (j = 0; j < nDim; ++j)
1271 for (i = 0; i < nScalars; ++i)
1273 Vmath::Vcopy(nTracePts, numflux[i], 1, numericalFluxO1[i][j], 1);
1291 int nBndEdgePts, nBndEdges, nBndRegions;
1293 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1294 int nScalars = inarray.size();
1304 for (i = 0; i < nScalars; ++i)
1309 fields[i]->ExtractTracePhys(inarray[i], uplus[i]);
1313 for (i = 0; i < nScalars - 1; ++i)
1318 nBndRegions = fields[i + 1]->GetBndCondExpansions().size();
1319 for (j = 0; j < nBndRegions; ++j)
1322 ->GetBndConditions()[j]
1328 nBndEdges = fields[i + 1]->GetBndCondExpansions()[j]->GetExpSize();
1329 for (e = 0; e < nBndEdges; ++e)
1331 nBndEdgePts = fields[i + 1]
1332 ->GetBndCondExpansions()[j]
1337 fields[i + 1]->GetBndCondExpansions()[j]->GetPhys_Offset(e);
1339 id2 = fields[0]->GetTrace()->GetPhys_Offset(
1340 fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(
1345 fields[i]->GetBndConditions()[j]->GetUserDefined(),
1348 fields[i]->GetBndConditions()[j]->GetUserDefined(),
1351 Vmath::Zero(nBndEdgePts, &scalarVariables[i][id2], 1);
1356 ->GetBndConditions()[j]
1357 ->GetBoundaryConditionType() ==
1362 ->GetBndCondExpansions()[j]
1363 ->UpdatePhys())[id1],
1366 ->GetBndCondExpansions()[j]
1367 ->UpdatePhys())[id1],
1368 1, &scalarVariables[i][id2], 1);
1373 ->GetBndConditions()[j]
1374 ->GetBoundaryConditionType() ==
1378 &penaltyfluxO1[i][id2], 1);
1382 else if ((fields[i]->GetBndConditions()[j])
1383 ->GetBoundaryConditionType() ==
1387 &penaltyfluxO1[i][id2], 1);
1391 Vmath::Vmul(nBndEdgePts, &scalarVariables[i][id2], 1,
1392 &scalarVariables[i][id2], 1, &tmp1[id2], 1);
1394 Vmath::Smul(nBndEdgePts, 0.5, &tmp1[id2], 1, &tmp1[id2], 1);
1396 Vmath::Vadd(nBndEdgePts, &tmp2[id2], 1, &tmp1[id2], 1,
1404 nBndRegions = fields[nScalars]->GetBndCondExpansions().size();
1405 for (j = 0; j < nBndRegions; ++j)
1407 nBndEdges = fields[nScalars]->GetBndCondExpansions()[j]->GetExpSize();
1409 if (fields[nScalars]
1410 ->GetBndConditions()[j]
1416 for (e = 0; e < nBndEdges; ++e)
1418 nBndEdgePts = fields[nScalars]
1419 ->GetBndCondExpansions()[j]
1424 fields[nScalars]->GetBndCondExpansions()[j]->GetPhys_Offset(e);
1426 id2 = fields[0]->GetTrace()->GetPhys_Offset(
1427 fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt++));
1431 fields[i]->GetBndConditions()[j]->GetUserDefined(),
1435 &scalarVariables[nScalars - 1][id2], 1);
1440 ->GetBndConditions()[j]
1441 ->GetBoundaryConditionType() ==
1448 ->GetBndCondExpansions()[j]
1450 1, &(fields[0]->GetBndCondExpansions()[j]->GetPhys())[id1],
1451 1, &scalarVariables[nScalars - 1][id2], 1);
1454 Vmath::Vsub(nBndEdgePts, &scalarVariables[nScalars - 1][id2], 1,
1455 &tmp2[id2], 1, &scalarVariables[nScalars - 1][id2],
1460 &scalarVariables[nScalars - 1][id2], 1,
1461 &scalarVariables[nScalars - 1][id2], 1);
1465 if (fields[nScalars]
1466 ->GetBndConditions()[j]
1467 ->GetBoundaryConditionType() ==
1470 fields[nScalars]->GetBndConditions()[j]->GetUserDefined(),
1473 Vmath::Vcopy(nBndEdgePts, &scalarVariables[nScalars - 1][id2],
1474 1, &penaltyfluxO1[nScalars - 1][id2], 1);
1478 else if (((fields[nScalars]->GetBndConditions()[j])
1479 ->GetBoundaryConditionType() ==
1481 boost::iequals(fields[nScalars]
1482 ->GetBndConditions()[j]
1486 Vmath::Vcopy(nBndEdgePts, &uplus[nScalars - 1][id2], 1,
1487 &penaltyfluxO1[nScalars - 1][id2], 1);
1504 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1505 int nVariables = fields.size();
1506 int nDim = fields[0]->GetCoordim(0);
1517 for (i = 0; i < nDim; ++i)
1519 fields[0]->ExtractTracePhys(ufield[i],
m_traceVel[i]);
1527 for (i = 1; i < nVariables; ++i)
1530 for (j = 0; j < nDim; ++j)
1533 fields[i]->GetFwdBwdTracePhys(qfield[j][i], qFwd, qBwd);
1536 fields[i]->GetTrace()->Upwind(Vn, qBwd, qFwd, qfluxtemp);
1543 if (fields[0]->GetBndCondExpansions().size())
1549 Vmath::Vadd(nTracePts, qfluxtemp, 1, qflux[i], 1, qflux[i], 1);
1564 int nBndEdges, nBndEdgePts;
1568 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1569 int nBndRegions = fields[var]->GetBndCondExpansions().size();
1575 fields[var]->ExtractTracePhys(qfield, qtemp);
1578 for (i = 0; i < nBndRegions; ++i)
1581 nBndEdges = fields[var]->GetBndCondExpansions()[i]->GetExpSize();
1583 if (fields[var]->GetBndConditions()[i]->GetBoundaryConditionType() ==
1590 for (e = 0; e < nBndEdges; ++e)
1592 nBndEdgePts = fields[var]
1593 ->GetBndCondExpansions()[i]
1597 id2 = fields[0]->GetTrace()->GetPhys_Offset(
1598 fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt++));
1603 ->GetBndConditions()[i]
1604 ->GetBoundaryConditionType() ==
1607 fields[var]->GetBndConditions()[i]->GetUserDefined(),
1611 &qtemp[id2], 1, &penaltyflux[id2], 1);
1615 else if ((fields[var]->GetBndConditions()[i])
1616 ->GetBoundaryConditionType() ==
1619 ASSERTL0(
false,
"Neumann bcs not implemented for LFRNS");
1621 else if (boost::iequals(
1622 fields[var]->GetBndConditions()[i]->GetUserDefined(),
1633 &qtemp[id2], 1, &penaltyflux[id2], 1);
1651 [[maybe_unused]]
const int nConvectiveFields,
1657 int nLocalSolutionPts, phys_offset;
1665 Basis = fields[0]->GetExp(0)->GetBasis(0);
1667 int nElements = fields[0]->GetExpSize();
1668 int nPts = fields[0]->GetTotPoints();
1679 fields[0]->GetTraceMap()->GetElmtToTrace();
1681 for (n = 0; n < nElements; ++n)
1683 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1684 phys_offset = fields[0]->GetPhys_Offset(n);
1688 Vmath::Vcopy(nLocalSolutionPts, &flux[phys_offset], 1, &tmparrayX1[0],
1691 fields[0]->GetExp(n)->GetTracePhysVals(0, elmtToTrace[n][0], tmparrayX1,
1693 JumpL[n] = iFlux[n] - tmpFluxVertex[0];
1695 fields[0]->GetExp(n)->GetTracePhysVals(1, elmtToTrace[n][1], tmparrayX1,
1697 JumpR[n] = iFlux[n + 1] - tmpFluxVertex[0];
1700 for (n = 0; n < nElements; ++n)
1702 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1703 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1704 phys_offset = fields[0]->GetPhys_Offset(n);
1712 JumpL[n] = JumpL[n] * jac[0];
1713 JumpR[n] = JumpR[n] * jac[0];
1724 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1725 &derCFlux[phys_offset], 1);
1745 [[maybe_unused]]
const int nConvectiveFields,
const int direction,
1750 int n, e, i, j, cnt;
1754 int nElements = fields[0]->GetExpSize();
1755 int trace_offset, phys_offset;
1756 int nLocalSolutionPts;
1764 fields[0]->GetTraceMap()->GetElmtToTrace();
1767 for (n = 0; n < nElements; ++n)
1770 phys_offset = fields[0]->GetPhys_Offset(n);
1771 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1772 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1781 base = fields[0]->GetExp(n)->GetBase();
1782 nquad0 = base[0]->GetNumPoints();
1783 nquad1 = base[1]->GetNumPoints();
1791 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1794 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1800 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1801 elmtToTrace[n][e]->GetElmtId());
1806 fields[0]->GetExp(n)->GetTracePhysVals(
1807 e, elmtToTrace[n][e], flux + phys_offset, auxArray1 = tmparray);
1812 Vmath::Vsub(nEdgePts, &iFlux[trace_offset], 1, &tmparray[0], 1,
1817 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1826 ->as<LocalRegions::Expansion2D>()
1834 fields[0]->GetExp(n)->GetTracePhysVals(
1835 e, elmtToTrace[n][e], jac, auxArray1 = jacEdge);
1839 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1847 for (j = 0; j < nEdgePts; j++)
1849 fluxJumps[j] = fluxJumps[j] * jacEdge[j];
1857 Vmath::Smul(nEdgePts, jac[0], fluxJumps, 1, fluxJumps, 1);
1866 for (i = 0; i < nquad0; ++i)
1868 for (j = 0; j < nquad1; ++j)
1870 cnt = i + j * nquad0;
1871 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1876 for (i = 0; i < nquad1; ++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)
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)
1898 for (j = 0; j < nquad0; ++j)
1900 cnt = j + i * nquad0;
1901 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1907 ASSERTL0(
false,
"edge value (< 3) is out of range");
1916 Vmath::Vadd(nLocalSolutionPts, &divCFluxE1[0], 1, &divCFluxE3[0], 1,
1917 &derCFlux[phys_offset], 1);
1919 else if (direction == 1)
1921 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE2[0], 1,
1922 &derCFlux[phys_offset], 1);
1941 [[maybe_unused]]
const int nConvectiveFields,
1948 int n, e, i, j, cnt;
1950 int nElements = fields[0]->GetExpSize();
1952 int nLocalSolutionPts;
1963 fields[0]->GetTraceMap()->GetElmtToTrace();
1966 for (n = 0; n < nElements; ++n)
1969 phys_offset = fields[0]->GetPhys_Offset(n);
1970 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1972 base = fields[0]->GetExp(n)->GetBase();
1973 nquad0 = base[0]->GetNumPoints();
1974 nquad1 = base[1]->GetNumPoints();
1982 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1985 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1994 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1995 elmtToTrace[n][e]->GetElmtId());
1999 fields[0]->GetExp(n)->GetTraceNormal(e);
2003 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2004 fluxX1 + phys_offset,
2005 auxArray1 = tmparrayX1);
2009 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2010 fluxX2 + phys_offset,
2011 auxArray1 = tmparrayX2);
2014 for (i = 0; i < nEdgePts; ++i)
2021 Vmath::Vsub(nEdgePts, &numericalFlux[trace_offset], 1, &fluxN[0], 1,
2025 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2029 auxArray2 = fluxJumps, 1);
2032 for (i = 0; i < nEdgePts; ++i)
2037 fluxJumps[i] = -fluxJumps[i];
2045 for (i = 0; i < nquad0; ++i)
2048 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
2050 for (j = 0; j < nquad1; ++j)
2052 cnt = i + j * nquad0;
2053 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
2058 for (i = 0; i < nquad1; ++i)
2061 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
2063 for (j = 0; j < nquad0; ++j)
2065 cnt = (nquad0)*i + j;
2066 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
2071 for (i = 0; i < nquad0; ++i)
2074 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
2076 for (j = 0; j < nquad1; ++j)
2078 cnt = j * nquad0 + i;
2079 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
2084 for (i = 0; i < nquad1; ++i)
2087 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
2088 for (j = 0; j < nquad0; ++j)
2090 cnt = j + i * nquad0;
2091 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
2097 ASSERTL0(
false,
"edge value (< 3) is out of range");
2103 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE1[0], 1,
2104 &divCFlux[phys_offset], 1);
2106 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2107 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2109 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2110 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
2129 [[maybe_unused]]
const int nConvectiveFields,
2136 int n, e, i, j, cnt;
2138 int nElements = fields[0]->GetExpSize();
2139 int nLocalSolutionPts;
2150 fields[0]->GetTraceMap()->GetElmtToTrace();
2153 for (n = 0; n < nElements; ++n)
2156 phys_offset = fields[0]->GetPhys_Offset(n);
2157 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
2159 base = fields[0]->GetExp(n)->GetBase();
2160 nquad0 = base[0]->GetNumPoints();
2161 nquad1 = base[1]->GetNumPoints();
2169 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
2172 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
2181 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
2182 elmtToTrace[n][e]->GetElmtId());
2186 fields[0]->GetExp(n)->GetTraceNormal(e);
2195 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2196 fluxX2 + phys_offset,
2197 auxArray1 = fluxN_D);
2202 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2206 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2210 auxArray2 = fluxN, 1);
2213 auxArray2 = fluxN_D, 1);
2217 for (i = 0; i < nquad0; ++i)
2220 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
2223 for (i = 0; i < nEdgePts; ++i)
2230 fluxN_R[i] = -fluxN_R[i];
2236 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2241 for (i = 0; i < nquad0; ++i)
2243 for (j = 0; j < nquad1; ++j)
2245 cnt = i + j * nquad0;
2246 divCFluxE0[cnt] = -fluxJumps[i] *
m_dGL_xi2[n][j];
2254 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2255 fluxX1 + phys_offset,
2256 auxArray1 = fluxN_D);
2259 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2263 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2267 auxArray2 = fluxN, 1);
2270 auxArray2 = fluxN_D, 1);
2274 for (i = 0; i < nquad1; ++i)
2277 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
2280 for (i = 0; i < nEdgePts; ++i)
2287 fluxN_R[i] = -fluxN_R[i];
2293 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2298 for (i = 0; i < nquad1; ++i)
2300 for (j = 0; j < nquad0; ++j)
2302 cnt = (nquad0)*i + j;
2303 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
2313 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2314 fluxX2 + phys_offset,
2315 auxArray1 = fluxN_D);
2318 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2322 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2326 auxArray2 = fluxN, 1);
2329 auxArray2 = fluxN_D, 1);
2333 for (i = 0; i < nquad0; ++i)
2336 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
2339 for (i = 0; i < nEdgePts; ++i)
2346 fluxN_R[i] = -fluxN_R[i];
2353 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2358 for (i = 0; i < nquad0; ++i)
2360 for (j = 0; j < nquad1; ++j)
2362 cnt = j * nquad0 + i;
2363 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
2372 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2373 fluxX1 + phys_offset,
2374 auxArray1 = fluxN_D);
2378 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2382 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2386 auxArray2 = fluxN, 1);
2389 auxArray2 = fluxN_D, 1);
2393 for (i = 0; i < nquad1; ++i)
2396 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
2399 for (i = 0; i < nEdgePts; ++i)
2406 fluxN_R[i] = -fluxN_R[i];
2413 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2418 for (i = 0; i < nquad1; ++i)
2420 for (j = 0; j < nquad0; ++j)
2422 cnt = j + i * nquad0;
2423 divCFluxE3[cnt] = -fluxJumps[i] *
m_dGL_xi1[n][j];
2428 ASSERTL0(
false,
"edge value (< 3) is out of range");
2434 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE1[0], 1,
2435 &divCFlux[phys_offset], 1);
2437 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2438 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2440 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2441 &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
DiffusionFluxVecCBNS m_fluxVectorNS
void v_Diffuse(const std::size_t nConvective, 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 Navier-Stokes (NS) equations using an LDG interface flux.
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...
NekDouble m_thermalConductivity
static std::string type[]
Array< OneD, Array< OneD, NekDouble > > m_traceVel
Array< OneD, Array< OneD, NekDouble > > m_divFD
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.
void NumericalFluxO1(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &numericalFluxO1)
Builds the numerical flux for the 1st order derivatives.
Array< OneD, Array< OneD, NekDouble > > m_viscFlux
void WeakPenaltyO1(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &penaltyfluxO1)
Imposes appropriate bcs for the 1st order derivatives.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tmp2
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e1
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DFC2
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi2
Array< OneD, Array< OneD, NekDouble > > m_divFC
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DFC1
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi3
Array< OneD, Array< OneD, NekDouble > > m_gmat
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e3
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e2
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi2
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_viscTensor
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...
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tmp1
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi3
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e0
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.
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.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_IF1
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".
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_D1
DiffusionLFRNS(std::string diffType)
DiffusionLFRNS uses the Flux Reconstruction (FR) approach to compute the diffusion term....
LibUtilities::SessionReaderSharedPtr m_session
Array< OneD, Array< OneD, NekDouble > > m_homoDerivs
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_BD1
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi1
void NumericalFluxO2(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, Array< OneD, NekDouble > > > m_DU1
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DD1
void WeakPenaltyO2(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const int dir, const Array< OneD, const NekDouble > &qfield, Array< OneD, NekDouble > &penaltyflux)
Imposes appropriate bcs for the 2nd order derivatives.
void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields) override
Initiliase DiffusionLFRNS objects and store them before starting the time-stepping.
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi1
std::string m_ViscosityType
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 Neg(int n, T *x, const int incx)
Negate x = -x.
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
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 Zero(int n, T *x, const int incx)
Zero vector.
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.