39#include <boost/algorithm/string/predicate.hpp>
84 WARNINGL0(
false,
"LFRNS is deprecated, use LDGNS instead");
101 int nConvectiveFields = pFields.size();
102 int nScalars = nConvectiveFields - 1;
103 int nDim = pFields[0]->GetCoordim(0);
104 int nSolutionPts = pFields[0]->GetTotPoints();
105 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
108 if (pSession->DefinesSolverInfo(
"HOMOGENEOUS"))
138 for (i = 0; i < nScalars; ++i)
147 for (j = 0; j < nDim; ++j)
158 for (i = 0; i < nConvectiveFields; ++i)
166 for (j = 0; j < nDim; ++j)
177 for (j = 0; j < nScalars; ++j)
187 for (j = 0; j < nScalars + 1; ++j)
217 int nLocalSolutionPts;
218 int nElements = pFields[0]->GetExpSize();
219 int nDimensions = pFields[0]->GetCoordim(0);
220 int nSolutionPts = pFields[0]->GetTotPoints();
221 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
224 for (i = 0; i < nDimensions; ++i)
243 for (n = 0; n < nElements; ++n)
245 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
246 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
247 phys_offset = pFields[0]->GetPhys_Offset(n);
254 for (i = 0; i < nLocalSolutionPts; ++i)
256 m_jac[i + phys_offset] = jac[0];
274 for (n = 0; n < nElements; ++n)
276 base = pFields[0]->GetExp(n)->GetBase();
277 nquad0 = base[0]->GetNumPoints();
278 nquad1 = base[1]->GetNumPoints();
286 pFields[0]->GetExp(n)->GetTraceQFactors(0, auxArray1 =
288 pFields[0]->GetExp(n)->GetTraceQFactors(1, auxArray1 =
290 pFields[0]->GetExp(n)->GetTraceQFactors(2, auxArray1 =
292 pFields[0]->GetExp(n)->GetTraceQFactors(3, auxArray1 =
295 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
296 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
297 phys_offset = pFields[0]->GetPhys_Offset(n);
310 ->GetDerivFactors(ptsKeys);
319 for (i = 0; i < nLocalSolutionPts; ++i)
321 m_jac[i + phys_offset] = jac[i];
322 m_gmat[0][i + phys_offset] = gmat[0][i];
323 m_gmat[1][i + phys_offset] = gmat[1][i];
324 m_gmat[2][i + phys_offset] = gmat[2][i];
325 m_gmat[3][i + phys_offset] = gmat[3][i];
330 for (i = 0; i < nLocalSolutionPts; ++i)
332 m_jac[i + phys_offset] = jac[0];
333 m_gmat[0][i + phys_offset] = gmat[0][0];
334 m_gmat[1][i + phys_offset] = gmat[1][0];
335 m_gmat[2][i + phys_offset] = gmat[2][0];
336 m_gmat[3][i + phys_offset] = gmat[3][0];
344 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
349 ASSERTL0(
false,
"Expansion dimension not recognised");
379 int nquad0, nquad1, nquad2;
380 int nmodes0, nmodes1, nmodes2;
383 int nElements = pFields[0]->GetExpSize();
384 int nDim = pFields[0]->GetCoordim(0);
393 for (n = 0; n < nElements; ++n)
395 base = pFields[0]->GetExp(n)->GetBase();
396 nquad0 = base[0]->GetNumPoints();
397 nmodes0 = base[0]->GetNumModes();
401 base[0]->GetZW(z0, w0);
413 int p0 = nmodes0 - 1;
420 std::tgamma(2 * p0 + 1) /
421 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
431 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
432 (ap0 * std::tgamma(p0 + 1)) *
433 (ap0 * std::tgamma(p0 + 1)));
437 c0 = 2.0 * (p0 + 1.0) /
438 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
439 (ap0 * std::tgamma(p0 + 1)));
444 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
445 (ap0 * std::tgamma(p0 + 1)));
449 c0 = 10000000000000000.0;
452 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
453 (ap0 * std::tgamma(p0 + 1)) *
454 (ap0 * std::tgamma(p0 + 1));
456 NekDouble overeta0 = 1.0 / (1.0 + etap0);
469 for (i = 0; i < nquad0; ++i)
479 for (i = 0; i < nquad0; ++i)
502 for (n = 0; n < nElements; ++n)
504 base = pFields[0]->GetExp(n)->GetBase();
505 nquad0 = base[0]->GetNumPoints();
506 nquad1 = base[1]->GetNumPoints();
507 nmodes0 = base[0]->GetNumModes();
508 nmodes1 = base[1]->GetNumModes();
515 base[0]->GetZW(z0, w0);
516 base[1]->GetZW(z1, w1);
533 int p0 = nmodes0 - 1;
534 int p1 = nmodes1 - 1;
542 std::tgamma(2 * p0 + 1) /
543 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
546 std::tgamma(2 * p1 + 1) /
547 (pow(2.0, p1) * std::tgamma(p1 + 1) * std::tgamma(p1 + 1));
558 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
559 (ap0 * std::tgamma(p0 + 1)) *
560 (ap0 * std::tgamma(p0 + 1)));
563 ((2.0 * p1 + 1.0) * (p1 + 1.0) *
564 (ap1 * std::tgamma(p1 + 1)) *
565 (ap1 * std::tgamma(p1 + 1)));
569 c0 = 2.0 * (p0 + 1.0) /
570 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
571 (ap0 * std::tgamma(p0 + 1)));
573 c1 = 2.0 * (p1 + 1.0) /
574 ((2.0 * p1 + 1.0) * p1 * (ap1 * std::tgamma(p1 + 1)) *
575 (ap1 * std::tgamma(p1 + 1)));
580 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
581 (ap0 * std::tgamma(p0 + 1)));
584 -2.0 / ((2.0 * p1 + 1.0) * (ap1 * std::tgamma(p1 + 1)) *
585 (ap1 * std::tgamma(p1 + 1)));
589 c0 = 10000000000000000.0;
590 c1 = 10000000000000000.0;
593 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
594 (ap0 * std::tgamma(p0 + 1)) *
595 (ap0 * std::tgamma(p0 + 1));
597 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0) *
598 (ap1 * std::tgamma(p1 + 1)) *
599 (ap1 * std::tgamma(p1 + 1));
601 NekDouble overeta0 = 1.0 / (1.0 + etap0);
602 NekDouble overeta1 = 1.0 / (1.0 + etap1);
621 for (i = 0; i < nquad0; ++i)
631 for (i = 0; i < nquad1; ++i)
641 for (i = 0; i < nquad0; ++i)
651 for (i = 0; i < nquad1; ++i)
671 for (n = 0; n < nElements; ++n)
673 base = pFields[0]->GetExp(n)->GetBase();
674 nquad0 = base[0]->GetNumPoints();
675 nquad1 = base[1]->GetNumPoints();
676 nquad2 = base[2]->GetNumPoints();
677 nmodes0 = base[0]->GetNumModes();
678 nmodes1 = base[1]->GetNumModes();
679 nmodes2 = base[2]->GetNumModes();
688 base[0]->GetZW(z0, w0);
689 base[1]->GetZW(z1, w1);
690 base[1]->GetZW(z2, w2);
712 int p0 = nmodes0 - 1;
713 int p1 = nmodes1 - 1;
714 int p2 = nmodes2 - 1;
723 std::tgamma(2 * p0 + 1) /
724 (pow(2.0, p0) * std::tgamma(p0 + 1) * std::tgamma(p0 + 1));
728 std::tgamma(2 * p1 + 1) /
729 (pow(2.0, p1) * std::tgamma(p1 + 1) * std::tgamma(p1 + 1));
733 std::tgamma(2 * p2 + 1) /
734 (pow(2.0, p2) * std::tgamma(p2 + 1) * std::tgamma(p2 + 1));
746 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
747 (ap0 * std::tgamma(p0 + 1)) *
748 (ap0 * std::tgamma(p0 + 1)));
751 ((2.0 * p1 + 1.0) * (p1 + 1.0) *
752 (ap1 * std::tgamma(p1 + 1)) *
753 (ap1 * std::tgamma(p1 + 1)));
756 ((2.0 * p2 + 1.0) * (p2 + 1.0) *
757 (ap2 * std::tgamma(p2 + 1)) *
758 (ap2 * std::tgamma(p2 + 1)));
762 c0 = 2.0 * (p0 + 1.0) /
763 ((2.0 * p0 + 1.0) * p0 * (ap0 * std::tgamma(p0 + 1)) *
764 (ap0 * std::tgamma(p0 + 1)));
766 c1 = 2.0 * (p1 + 1.0) /
767 ((2.0 * p1 + 1.0) * p1 * (ap1 * std::tgamma(p1 + 1)) *
768 (ap1 * std::tgamma(p1 + 1)));
770 c2 = 2.0 * (p2 + 1.0) /
771 ((2.0 * p2 + 1.0) * p2 * (ap2 * std::tgamma(p2 + 1)) *
772 (ap2 * std::tgamma(p2 + 1)));
777 -2.0 / ((2.0 * p0 + 1.0) * (ap0 * std::tgamma(p0 + 1)) *
778 (ap0 * std::tgamma(p0 + 1)));
781 -2.0 / ((2.0 * p1 + 1.0) * (ap1 * std::tgamma(p1 + 1)) *
782 (ap1 * std::tgamma(p1 + 1)));
785 -2.0 / ((2.0 * p2 + 1.0) * (ap2 * std::tgamma(p2 + 1)) *
786 (ap2 * std::tgamma(p2 + 1)));
790 c0 = 10000000000000000.0;
791 c1 = 10000000000000000.0;
792 c2 = 10000000000000000.0;
795 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
796 (ap0 * std::tgamma(p0 + 1)) *
797 (ap0 * std::tgamma(p0 + 1));
799 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0) *
800 (ap1 * std::tgamma(p1 + 1)) *
801 (ap1 * std::tgamma(p1 + 1));
803 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0) *
804 (ap2 * std::tgamma(p2 + 1)) *
805 (ap2 * std::tgamma(p2 + 1));
807 NekDouble overeta0 = 1.0 / (1.0 + etap0);
808 NekDouble overeta1 = 1.0 / (1.0 + etap1);
809 NekDouble overeta2 = 1.0 / (1.0 + etap2);
834 for (i = 0; i < nquad0; ++i)
844 for (i = 0; i < nquad1; ++i)
854 for (i = 0; i < nquad2; ++i)
864 for (i = 0; i < nquad0; ++i)
874 for (i = 0; i < nquad1; ++i)
884 for (i = 0; i < nquad2; ++i)
897 ASSERTL0(
false,
"Expansion dimension not recognised");
912 const std::size_t nConvectiveFields,
925 Basis = fields[0]->GetExp(0)->GetBase();
927 int nElements = fields[0]->GetExpSize();
928 int nDim = fields[0]->GetCoordim(0);
929 int nScalars = inarray.size();
930 int nSolutionPts = fields[0]->GetTotPoints();
931 int nCoeffs = fields[0]->GetNcoeffs();
934 for (i = 0; i < nConvectiveFields; ++i)
947 for (i = 0; i < nScalars; ++i)
951 for (n = 0; n < nElements; n++)
953 phys_offset = fields[0]->GetPhys_Offset(n);
955 fields[i]->GetExp(n)->PhysDeriv(
956 0, auxArray1 = inarray[i] + phys_offset,
957 auxArray2 =
m_DU1[i][0] + phys_offset);
973 1, &
m_D1[i][0][0], 1);
986 for (i = 0; i < nConvectiveFields; ++i)
990 for (n = 0; n < nElements; n++)
992 phys_offset = fields[0]->GetPhys_Offset(n);
994 fields[i]->GetExp(n)->PhysDeriv(
996 auxArray2 =
m_DD1[i][0] + phys_offset);
1012 1, &outarray[i][0], 1);
1015 if (!(
Basis[0]->Collocation()))
1017 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1018 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1026 for (i = 0; i < nScalars; ++i)
1028 for (j = 0; j < nDim; ++j)
1037 &
m_gmat[0][0], 1, &u1_hat[0], 1);
1043 &
m_gmat[1][0], 1, &u2_hat[0], 1);
1051 &
m_gmat[2][0], 1, &u1_hat[0], 1);
1057 &
m_gmat[3][0], 1, &u2_hat[0], 1);
1063 for (n = 0; n < nElements; n++)
1065 phys_offset = fields[0]->GetPhys_Offset(n);
1067 fields[i]->GetExp(n)->StdPhysDeriv(
1068 auxArray1 = u1_hat + phys_offset,
1069 auxArray2 =
m_tmp1[i][j] + phys_offset);
1071 fields[i]->GetExp(n)->StdPhysDeriv(
1072 auxArray1 = u2_hat + phys_offset,
1074 auxArray2 =
m_tmp2[i][j] + phys_offset);
1082 &
m_DU1[i][j][0], 1);
1086 DerCFlux_2D(nConvectiveFields, j, fields, inarray[i],
1092 for (j = 0; j < nSolutionPts; ++j)
1113 for (j = 0; j < nSolutionPts; j++)
1125 for (j = 0; j < nDim; ++j)
1135 for (i = 0; i < nScalars; ++i)
1150 for (i = 0; i < nConvectiveFields; ++i)
1156 for (j = 0; j < nSolutionPts; j++)
1167 for (n = 0; n < nElements; n++)
1169 phys_offset = fields[0]->GetPhys_Offset(n);
1171 fields[0]->GetExp(n)->StdPhysDeriv(
1172 auxArray1 = f_hat + phys_offset,
1173 auxArray2 =
m_DD1[i][0] + phys_offset);
1175 fields[0]->GetExp(n)->StdPhysDeriv(
1177 auxArray2 =
m_DD1[i][1] + phys_offset);
1185 if (
Basis[0]->GetPointsType() ==
1187 Basis[1]->GetPointsType() ==
1201 &outarray[i][0], 1);
1206 &outarray[i][0], 1);
1209 if (!(
Basis[0]->Collocation()))
1211 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1212 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1220 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1236 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1237 int nScalars = inarray.size();
1238 int nDim = fields[0]->GetCoordim(0);
1244 for (i = 0; i < nDim; ++i)
1246 fields[0]->ExtractTracePhys(inarray[i],
m_traceVel[i]);
1256 for (i = 0; i < nScalars; ++i)
1261 fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
1262 fields[0]->GetTrace()->Upwind(Vn, Fwd[i], Bwd[i], numflux[i]);
1266 if (fields[0]->GetBndCondExpansions().size())
1272 for (j = 0; j < nDim; ++j)
1274 for (i = 0; i < nScalars; ++i)
1276 Vmath::Vcopy(nTracePts, numflux[i], 1, numericalFluxO1[i][j], 1);
1294 int nBndEdgePts, nBndEdges, nBndRegions;
1296 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1297 int nScalars = inarray.size();
1307 for (i = 0; i < nScalars; ++i)
1312 fields[i]->ExtractTracePhys(inarray[i], uplus[i]);
1316 for (i = 0; i < nScalars - 1; ++i)
1321 nBndRegions = fields[i + 1]->GetBndCondExpansions().size();
1322 for (j = 0; j < nBndRegions; ++j)
1325 ->GetBndConditions()[j]
1331 nBndEdges = fields[i + 1]->GetBndCondExpansions()[j]->GetExpSize();
1332 for (e = 0; e < nBndEdges; ++e)
1334 nBndEdgePts = fields[i + 1]
1335 ->GetBndCondExpansions()[j]
1340 fields[i + 1]->GetBndCondExpansions()[j]->GetPhys_Offset(e);
1342 id2 = fields[0]->GetTrace()->GetPhys_Offset(
1343 fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(
1348 fields[i]->GetBndConditions()[j]->GetUserDefined(),
1351 fields[i]->GetBndConditions()[j]->GetUserDefined(),
1354 Vmath::Zero(nBndEdgePts, &scalarVariables[i][id2], 1);
1359 ->GetBndConditions()[j]
1360 ->GetBoundaryConditionType() ==
1365 ->GetBndCondExpansions()[j]
1366 ->UpdatePhys())[id1],
1369 ->GetBndCondExpansions()[j]
1370 ->UpdatePhys())[id1],
1371 1, &scalarVariables[i][id2], 1);
1376 ->GetBndConditions()[j]
1377 ->GetBoundaryConditionType() ==
1381 &penaltyfluxO1[i][id2], 1);
1385 else if ((fields[i]->GetBndConditions()[j])
1386 ->GetBoundaryConditionType() ==
1390 &penaltyfluxO1[i][id2], 1);
1394 Vmath::Vmul(nBndEdgePts, &scalarVariables[i][id2], 1,
1395 &scalarVariables[i][id2], 1, &tmp1[id2], 1);
1397 Vmath::Smul(nBndEdgePts, 0.5, &tmp1[id2], 1, &tmp1[id2], 1);
1399 Vmath::Vadd(nBndEdgePts, &tmp2[id2], 1, &tmp1[id2], 1,
1407 nBndRegions = fields[nScalars]->GetBndCondExpansions().size();
1408 for (j = 0; j < nBndRegions; ++j)
1410 nBndEdges = fields[nScalars]->GetBndCondExpansions()[j]->GetExpSize();
1412 if (fields[nScalars]
1413 ->GetBndConditions()[j]
1419 for (e = 0; e < nBndEdges; ++e)
1421 nBndEdgePts = fields[nScalars]
1422 ->GetBndCondExpansions()[j]
1427 fields[nScalars]->GetBndCondExpansions()[j]->GetPhys_Offset(e);
1429 id2 = fields[0]->GetTrace()->GetPhys_Offset(
1430 fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt++));
1434 fields[i]->GetBndConditions()[j]->GetUserDefined(),
1438 &scalarVariables[nScalars - 1][id2], 1);
1443 ->GetBndConditions()[j]
1444 ->GetBoundaryConditionType() ==
1451 ->GetBndCondExpansions()[j]
1453 1, &(fields[0]->GetBndCondExpansions()[j]->GetPhys())[id1],
1454 1, &scalarVariables[nScalars - 1][id2], 1);
1457 Vmath::Vsub(nBndEdgePts, &scalarVariables[nScalars - 1][id2], 1,
1458 &tmp2[id2], 1, &scalarVariables[nScalars - 1][id2],
1463 &scalarVariables[nScalars - 1][id2], 1,
1464 &scalarVariables[nScalars - 1][id2], 1);
1468 if (fields[nScalars]
1469 ->GetBndConditions()[j]
1470 ->GetBoundaryConditionType() ==
1473 fields[nScalars]->GetBndConditions()[j]->GetUserDefined(),
1476 Vmath::Vcopy(nBndEdgePts, &scalarVariables[nScalars - 1][id2],
1477 1, &penaltyfluxO1[nScalars - 1][id2], 1);
1481 else if (((fields[nScalars]->GetBndConditions()[j])
1482 ->GetBoundaryConditionType() ==
1484 boost::iequals(fields[nScalars]
1485 ->GetBndConditions()[j]
1489 Vmath::Vcopy(nBndEdgePts, &uplus[nScalars - 1][id2], 1,
1490 &penaltyfluxO1[nScalars - 1][id2], 1);
1507 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1508 int nVariables = fields.size();
1509 int nDim = fields[0]->GetCoordim(0);
1520 for (i = 0; i < nDim; ++i)
1522 fields[0]->ExtractTracePhys(ufield[i],
m_traceVel[i]);
1530 for (i = 1; i < nVariables; ++i)
1533 for (j = 0; j < nDim; ++j)
1536 fields[i]->GetFwdBwdTracePhys(qfield[j][i], qFwd, qBwd);
1539 fields[i]->GetTrace()->Upwind(Vn, qBwd, qFwd, qfluxtemp);
1546 if (fields[0]->GetBndCondExpansions().size())
1552 Vmath::Vadd(nTracePts, qfluxtemp, 1, qflux[i], 1, qflux[i], 1);
1567 int nBndEdges, nBndEdgePts;
1571 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1572 int nBndRegions = fields[var]->GetBndCondExpansions().size();
1578 fields[var]->ExtractTracePhys(qfield, qtemp);
1581 for (i = 0; i < nBndRegions; ++i)
1584 nBndEdges = fields[var]->GetBndCondExpansions()[i]->GetExpSize();
1586 if (fields[var]->GetBndConditions()[i]->GetBoundaryConditionType() ==
1593 for (e = 0; e < nBndEdges; ++e)
1595 nBndEdgePts = fields[var]
1596 ->GetBndCondExpansions()[i]
1600 id2 = fields[0]->GetTrace()->GetPhys_Offset(
1601 fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt++));
1606 ->GetBndConditions()[i]
1607 ->GetBoundaryConditionType() ==
1610 fields[var]->GetBndConditions()[i]->GetUserDefined(),
1614 &qtemp[id2], 1, &penaltyflux[id2], 1);
1618 else if ((fields[var]->GetBndConditions()[i])
1619 ->GetBoundaryConditionType() ==
1622 ASSERTL0(
false,
"Neumann bcs not implemented for LFRNS");
1624 else if (boost::iequals(
1625 fields[var]->GetBndConditions()[i]->GetUserDefined(),
1636 &qtemp[id2], 1, &penaltyflux[id2], 1);
1654 [[maybe_unused]]
const int nConvectiveFields,
1660 int nLocalSolutionPts, phys_offset;
1668 Basis = fields[0]->GetExp(0)->GetBasis(0);
1670 int nElements = fields[0]->GetExpSize();
1671 int nPts = fields[0]->GetTotPoints();
1682 fields[0]->GetTraceMap()->GetElmtToTrace();
1684 for (n = 0; n < nElements; ++n)
1686 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1687 phys_offset = fields[0]->GetPhys_Offset(n);
1691 Vmath::Vcopy(nLocalSolutionPts, &flux[phys_offset], 1, &tmparrayX1[0],
1694 fields[0]->GetExp(n)->GetTracePhysVals(0, elmtToTrace[n][0], tmparrayX1,
1696 JumpL[n] = iFlux[n] - tmpFluxVertex[0];
1698 fields[0]->GetExp(n)->GetTracePhysVals(1, elmtToTrace[n][1], tmparrayX1,
1700 JumpR[n] = iFlux[n + 1] - tmpFluxVertex[0];
1703 for (n = 0; n < nElements; ++n)
1705 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1706 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1707 phys_offset = fields[0]->GetPhys_Offset(n);
1715 JumpL[n] = JumpL[n] * jac[0];
1716 JumpR[n] = JumpR[n] * jac[0];
1727 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1728 &derCFlux[phys_offset], 1);
1748 [[maybe_unused]]
const int nConvectiveFields,
const int direction,
1753 int n, e, i, j, cnt;
1757 int nElements = fields[0]->GetExpSize();
1758 int trace_offset, phys_offset;
1759 int nLocalSolutionPts;
1767 fields[0]->GetTraceMap()->GetElmtToTrace();
1770 for (n = 0; n < nElements; ++n)
1773 phys_offset = fields[0]->GetPhys_Offset(n);
1774 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1775 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
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);
1803 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1804 elmtToTrace[n][e]->GetElmtId());
1809 fields[0]->GetExp(n)->GetTracePhysVals(
1810 e, elmtToTrace[n][e], flux + phys_offset, auxArray1 = tmparray);
1815 Vmath::Vsub(nEdgePts, &iFlux[trace_offset], 1, &tmparray[0], 1,
1820 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1829 ->as<LocalRegions::Expansion2D>()
1837 fields[0]->GetExp(n)->GetTracePhysVals(
1838 e, elmtToTrace[n][e], jac, auxArray1 = jacEdge);
1842 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1850 for (j = 0; j < nEdgePts; j++)
1852 fluxJumps[j] = fluxJumps[j] * jacEdge[j];
1860 Vmath::Smul(nEdgePts, jac[0], fluxJumps, 1, fluxJumps, 1);
1869 for (i = 0; i < nquad0; ++i)
1871 for (j = 0; j < nquad1; ++j)
1873 cnt = i + j * nquad0;
1874 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1879 for (i = 0; i < nquad1; ++i)
1881 for (j = 0; j < nquad0; ++j)
1883 cnt = (nquad0)*i + j;
1884 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1889 for (i = 0; i < nquad0; ++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)
1901 for (j = 0; j < nquad0; ++j)
1903 cnt = j + i * nquad0;
1904 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1910 ASSERTL0(
false,
"edge value (< 3) is out of range");
1919 Vmath::Vadd(nLocalSolutionPts, &divCFluxE1[0], 1, &divCFluxE3[0], 1,
1920 &derCFlux[phys_offset], 1);
1922 else if (direction == 1)
1924 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE2[0], 1,
1925 &derCFlux[phys_offset], 1);
1944 [[maybe_unused]]
const int nConvectiveFields,
1951 int n, e, i, j, cnt;
1953 int nElements = fields[0]->GetExpSize();
1955 int nLocalSolutionPts;
1966 fields[0]->GetTraceMap()->GetElmtToTrace();
1969 for (n = 0; n < nElements; ++n)
1972 phys_offset = fields[0]->GetPhys_Offset(n);
1973 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1975 base = fields[0]->GetExp(n)->GetBase();
1976 nquad0 = base[0]->GetNumPoints();
1977 nquad1 = base[1]->GetNumPoints();
1985 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1988 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1997 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1998 elmtToTrace[n][e]->GetElmtId());
2002 fields[0]->GetExp(n)->GetTraceNormal(e);
2006 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2007 fluxX1 + phys_offset,
2008 auxArray1 = tmparrayX1);
2012 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2013 fluxX2 + phys_offset,
2014 auxArray1 = tmparrayX2);
2017 for (i = 0; i < nEdgePts; ++i)
2024 Vmath::Vsub(nEdgePts, &numericalFlux[trace_offset], 1, &fluxN[0], 1,
2028 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2032 auxArray2 = fluxJumps, 1);
2035 for (i = 0; i < nEdgePts; ++i)
2040 fluxJumps[i] = -fluxJumps[i];
2048 for (i = 0; i < nquad0; ++i)
2051 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
2053 for (j = 0; j < nquad1; ++j)
2055 cnt = i + j * nquad0;
2056 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
2061 for (i = 0; i < nquad1; ++i)
2064 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
2066 for (j = 0; j < nquad0; ++j)
2068 cnt = (nquad0)*i + j;
2069 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
2074 for (i = 0; i < nquad0; ++i)
2077 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
2079 for (j = 0; j < nquad1; ++j)
2081 cnt = j * nquad0 + i;
2082 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
2087 for (i = 0; i < nquad1; ++i)
2090 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
2091 for (j = 0; j < nquad0; ++j)
2093 cnt = j + i * nquad0;
2094 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
2100 ASSERTL0(
false,
"edge value (< 3) is out of range");
2106 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE1[0], 1,
2107 &divCFlux[phys_offset], 1);
2109 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2110 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2112 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2113 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
2132 [[maybe_unused]]
const int nConvectiveFields,
2139 int n, e, i, j, cnt;
2141 int nElements = fields[0]->GetExpSize();
2142 int nLocalSolutionPts;
2153 fields[0]->GetTraceMap()->GetElmtToTrace();
2156 for (n = 0; n < nElements; ++n)
2159 phys_offset = fields[0]->GetPhys_Offset(n);
2160 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
2162 base = fields[0]->GetExp(n)->GetBase();
2163 nquad0 = base[0]->GetNumPoints();
2164 nquad1 = base[1]->GetNumPoints();
2172 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
2175 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
2184 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
2185 elmtToTrace[n][e]->GetElmtId());
2189 fields[0]->GetExp(n)->GetTraceNormal(e);
2198 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2199 fluxX2 + phys_offset,
2200 auxArray1 = fluxN_D);
2205 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2209 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2213 auxArray2 = fluxN, 1);
2216 auxArray2 = fluxN_D, 1);
2220 for (i = 0; i < nquad0; ++i)
2223 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
2226 for (i = 0; i < nEdgePts; ++i)
2233 fluxN_R[i] = -fluxN_R[i];
2239 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2244 for (i = 0; i < nquad0; ++i)
2246 for (j = 0; j < nquad1; ++j)
2248 cnt = i + j * nquad0;
2249 divCFluxE0[cnt] = -fluxJumps[i] *
m_dGL_xi2[n][j];
2257 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2258 fluxX1 + phys_offset,
2259 auxArray1 = fluxN_D);
2262 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2266 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2270 auxArray2 = fluxN, 1);
2273 auxArray2 = fluxN_D, 1);
2277 for (i = 0; i < nquad1; ++i)
2280 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
2283 for (i = 0; i < nEdgePts; ++i)
2290 fluxN_R[i] = -fluxN_R[i];
2296 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2301 for (i = 0; i < nquad1; ++i)
2303 for (j = 0; j < nquad0; ++j)
2305 cnt = (nquad0)*i + j;
2306 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
2316 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2317 fluxX2 + phys_offset,
2318 auxArray1 = fluxN_D);
2321 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2325 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2329 auxArray2 = fluxN, 1);
2332 auxArray2 = fluxN_D, 1);
2336 for (i = 0; i < nquad0; ++i)
2339 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
2342 for (i = 0; i < nEdgePts; ++i)
2349 fluxN_R[i] = -fluxN_R[i];
2356 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2361 for (i = 0; i < nquad0; ++i)
2363 for (j = 0; j < nquad1; ++j)
2365 cnt = j * nquad0 + i;
2366 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
2375 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
2376 fluxX1 + phys_offset,
2377 auxArray1 = fluxN_D);
2381 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
2385 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2389 auxArray2 = fluxN, 1);
2392 auxArray2 = fluxN_D, 1);
2396 for (i = 0; i < nquad1; ++i)
2399 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
2402 for (i = 0; i < nEdgePts; ++i)
2409 fluxN_R[i] = -fluxN_R[i];
2416 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
2421 for (i = 0; i < nquad1; ++i)
2423 for (j = 0; j < nquad0; ++j)
2425 cnt = j + i * nquad0;
2426 divCFluxE3[cnt] = -fluxJumps[i] *
m_dGL_xi1[n][j];
2431 ASSERTL0(
false,
"edge value (< 3) is out of range");
2437 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE1[0], 1,
2438 &divCFlux[phys_offset], 1);
2440 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2441 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2443 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2444 &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
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.
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 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.