40 #include <boost/core/ignore_unused.hpp>
41 #include <boost/math/special_functions/gamma.hpp>
51 std::string DiffusionLFR::type[] = {
53 "LFRDG", DiffusionLFR::create),
55 "LFRSD", DiffusionLFR::create),
57 "LFRHU", DiffusionLFR::create),
59 "LFRcmin", DiffusionLFR::create),
61 "LFRcinf", DiffusionLFR::create)};
71 DiffusionLFR::DiffusionLFR(std::string diffType):m_diffType(diffType)
95 int nConvectiveFields = pFields.size();
96 int nDim = pFields[0]->GetCoordim(0);
97 int nSolutionPts = pFields[0]->GetTotPoints();
98 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
125 for (i = 0; i < nConvectiveFields; ++i)
141 for (j = 0; j < nDim; ++j)
178 boost::ignore_unused(pSession);
183 int nLocalSolutionPts;
184 int nElements = pFields[0]->GetExpSize();
185 int nDimensions = pFields[0]->GetCoordim(0);
186 int nSolutionPts = pFields[0]->GetTotPoints();
187 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
190 for (i = 0; i < nDimensions; ++i)
209 for (n = 0; n < nElements; ++n)
211 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
212 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
213 phys_offset = pFields[0]->GetPhys_Offset(n);
214 jac = pFields[0]->GetExp(n)
217 for (i = 0; i < nLocalSolutionPts; ++i)
219 m_jac[i+phys_offset] = jac[0];
237 for (n = 0; n < nElements; ++n)
239 base = pFields[0]->GetExp(n)->GetBase();
240 nquad0 = base[0]->GetNumPoints();
241 nquad1 = base[1]->GetNumPoints();
249 pFields[0]->GetExp(n)->GetTraceQFactors(
251 pFields[0]->GetExp(n)->GetTraceQFactors(
253 pFields[0]->GetExp(n)->GetTraceQFactors(
255 pFields[0]->GetExp(n)->GetTraceQFactors(
258 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
259 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
260 phys_offset = pFields[0]->GetPhys_Offset(n);
262 jac = pFields[0]->GetExp(n)
265 gmat = pFields[0]->GetExp(n)
269 if (pFields[0]->GetExp(n)
274 for (i = 0; i < nLocalSolutionPts; ++i)
276 m_jac[i+phys_offset] = jac[i];
277 m_gmat[0][i+phys_offset] = gmat[0][i];
278 m_gmat[1][i+phys_offset] = gmat[1][i];
279 m_gmat[2][i+phys_offset] = gmat[2][i];
280 m_gmat[3][i+phys_offset] = gmat[3][i];
285 for (i = 0; i < nLocalSolutionPts; ++i)
287 m_jac[i+phys_offset] = jac[0];
288 m_gmat[0][i+phys_offset] = gmat[0][0];
289 m_gmat[1][i+phys_offset] = gmat[1][0];
290 m_gmat[2][i+phys_offset] = gmat[2][0];
291 m_gmat[3][i+phys_offset] = gmat[3][0];
299 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
304 ASSERTL0(
false,
"Expansion dimension not recognised");
330 boost::ignore_unused(pSession);
336 int nquad0, nquad1, nquad2;
337 int nmodes0, nmodes1, nmodes2;
340 int nElements = pFields[0]->GetExpSize();
341 int nDim = pFields[0]->GetCoordim(0);
350 for (n = 0; n < nElements; ++n)
352 base = pFields[0]->GetExp(n)->GetBase();
353 nquad0 = base[0]->GetNumPoints();
354 nmodes0 = base[0]->GetNumModes();
358 base[0]->GetZW(z0, w0);
370 int p0 = nmodes0 - 1;
376 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
378 * boost::math::tgamma(p0 + 1)
379 * boost::math::tgamma(p0 + 1));
388 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
389 * (ap0 * boost::math::tgamma(p0 + 1))
390 * (ap0 * boost::math::tgamma(p0 + 1)));
394 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
395 * (ap0 * boost::math::tgamma(p0 + 1))
396 * (ap0 * boost::math::tgamma(p0 + 1)));
400 c0 = -2.0 / ((2.0 * p0 + 1.0)
401 * (ap0 * boost::math::tgamma(p0 + 1))
402 * (ap0 * boost::math::tgamma(p0 + 1)));
406 c0 = 10000000000000000.0;
409 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
410 * (ap0 * boost::math::tgamma(p0 + 1))
411 * (ap0 * boost::math::tgamma(p0 + 1));
413 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;
496 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
498 * boost::math::tgamma(p0 + 1)
499 * boost::math::tgamma(p0 + 1));
501 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
503 * boost::math::tgamma(p1 + 1)
504 * boost::math::tgamma(p1 + 1));
514 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
515 * (ap0 * boost::math::tgamma(p0 + 1))
516 * (ap0 * boost::math::tgamma(p0 + 1)));
518 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
519 * (ap1 * boost::math::tgamma(p1 + 1))
520 * (ap1 * boost::math::tgamma(p1 + 1)));
524 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
525 * (ap0 * boost::math::tgamma(p0 + 1))
526 * (ap0 * boost::math::tgamma(p0 + 1)));
528 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
529 * (ap1 * boost::math::tgamma(p1 + 1))
530 * (ap1 * boost::math::tgamma(p1 + 1)));
534 c0 = -2.0 / ((2.0 * p0 + 1.0)
535 * (ap0 * boost::math::tgamma(p0 + 1))
536 * (ap0 * boost::math::tgamma(p0 + 1)));
538 c1 = -2.0 / ((2.0 * p1 + 1.0)
539 * (ap1 * boost::math::tgamma(p1 + 1))
540 * (ap1 * boost::math::tgamma(p1 + 1)));
544 c0 = 10000000000000000.0;
545 c1 = 10000000000000000.0;
548 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
549 * (ap0 * boost::math::tgamma(p0 + 1))
550 * (ap0 * boost::math::tgamma(p0 + 1));
552 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
553 * (ap1 * boost::math::tgamma(p1 + 1))
554 * (ap1 * boost::math::tgamma(p1 + 1));
556 NekDouble overeta0 = 1.0 / (1.0 + etap0);
557 NekDouble overeta1 = 1.0 / (1.0 + etap1);
572 for(i = 0; i < nquad0; ++i)
582 for(i = 0; i < nquad1; ++i)
592 for(i = 0; i < nquad0; ++i)
602 for(i = 0; i < nquad1; ++i)
622 for (n = 0; n < nElements; ++n)
624 base = pFields[0]->GetExp(n)->GetBase();
625 nquad0 = base[0]->GetNumPoints();
626 nquad1 = base[1]->GetNumPoints();
627 nquad2 = base[2]->GetNumPoints();
628 nmodes0 = base[0]->GetNumModes();
629 nmodes1 = base[1]->GetNumModes();
630 nmodes2 = base[2]->GetNumModes();
639 base[0]->GetZW(z0, w0);
640 base[1]->GetZW(z1, w1);
641 base[1]->GetZW(z2, w2);
663 int p0 = nmodes0 - 1;
664 int p1 = nmodes1 - 1;
665 int p2 = nmodes2 - 1;
673 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
675 * boost::math::tgamma(p0 + 1)
676 * boost::math::tgamma(p0 + 1));
679 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
681 * boost::math::tgamma(p1 + 1)
682 * boost::math::tgamma(p1 + 1));
685 NekDouble ap2 = boost::math::tgamma(2 * p2 + 1)
687 * boost::math::tgamma(p2 + 1)
688 * boost::math::tgamma(p2 + 1));
699 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
700 * (ap0 * boost::math::tgamma(p0 + 1))
701 * (ap0 * boost::math::tgamma(p0 + 1)));
703 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
704 * (ap1 * boost::math::tgamma(p1 + 1))
705 * (ap1 * boost::math::tgamma(p1 + 1)));
707 c2 = 2.0 * p2 / ((2.0 * p2 + 1.0) * (p2 + 1.0)
708 * (ap2 * boost::math::tgamma(p2 + 1))
709 * (ap2 * boost::math::tgamma(p2 + 1)));
713 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
714 * (ap0 * boost::math::tgamma(p0 + 1))
715 * (ap0 * boost::math::tgamma(p0 + 1)));
717 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
718 * (ap1 * boost::math::tgamma(p1 + 1))
719 * (ap1 * boost::math::tgamma(p1 + 1)));
721 c2 = 2.0 * (p2 + 1.0) / ((2.0 * p2 + 1.0) * p2
722 * (ap2 * boost::math::tgamma(p2 + 1))
723 * (ap2 * boost::math::tgamma(p2 + 1)));
727 c0 = -2.0 / ((2.0 * p0 + 1.0)
728 * (ap0 * boost::math::tgamma(p0 + 1))
729 * (ap0 * boost::math::tgamma(p0 + 1)));
731 c1 = -2.0 / ((2.0 * p1 + 1.0)
732 * (ap1 * boost::math::tgamma(p1 + 1))
733 * (ap1 * boost::math::tgamma(p1 + 1)));
735 c2 = -2.0 / ((2.0 * p2 + 1.0)
736 * (ap2 * boost::math::tgamma(p2 + 1))
737 * (ap2 * boost::math::tgamma(p2 + 1)));
741 c0 = 10000000000000000.0;
742 c1 = 10000000000000000.0;
743 c2 = 10000000000000000.0;
746 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
747 * (ap0 * boost::math::tgamma(p0 + 1))
748 * (ap0 * boost::math::tgamma(p0 + 1));
750 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
751 * (ap1 * boost::math::tgamma(p1 + 1))
752 * (ap1 * boost::math::tgamma(p1 + 1));
754 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0)
755 * (ap2 * boost::math::tgamma(p2 + 1))
756 * (ap2 * boost::math::tgamma(p2 + 1));
758 NekDouble overeta0 = 1.0 / (1.0 + etap0);
759 NekDouble overeta1 = 1.0 / (1.0 + etap1);
760 NekDouble overeta2 = 1.0 / (1.0 + etap2);
779 for(i = 0; i < nquad0; ++i)
789 for(i = 0; i < nquad1; ++i)
799 for(i = 0; i < nquad2; ++i)
809 for(i = 0; i < nquad0; ++i)
819 for(i = 0; i < nquad1; ++i)
829 for(i = 0; i < nquad2; ++i)
842 ASSERTL0(
false,
"Expansion dimension not recognised");
854 const std::size_t nConvectiveFields,
861 boost::ignore_unused(pFwd, pBwd);
870 Basis = fields[0]->GetExp(0)->GetBase();
872 int nElements = fields[0]->GetExpSize();
873 int nDim = fields[0]->GetCoordim(0);
874 int nSolutionPts = fields[0]->GetTotPoints();
875 int nCoeffs = fields[0]->GetNcoeffs();
878 for (i = 0; i < nConvectiveFields; ++i)
891 for (i = 0; i < nConvectiveFields; ++i)
895 for (n = 0; n < nElements; n++)
897 phys_offset = fields[0]->GetPhys_Offset(n);
899 fields[i]->GetExp(n)->PhysDeriv(0,
900 auxArray1 = inarray[i] + phys_offset,
901 auxArray2 =
m_DU1[i][0] + phys_offset);
927 for (i = 0; i < nConvectiveFields; ++i)
931 for (n = 0; n < nElements; n++)
933 phys_offset = fields[0]->GetPhys_Offset(n);
935 fields[i]->GetExp(n)->PhysDeriv(0,
936 auxArray1 =
m_D1[i][0] + phys_offset,
937 auxArray2 =
m_DD1[i][0] + phys_offset);
953 &
m_DD1[i][0][0], 1, &outarray[i][0], 1);
956 if (!(
Basis[0]->Collocation()))
958 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
959 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
967 for(i = 0; i < nConvectiveFields; ++i)
969 for (j = 0; j < nDim; ++j)
978 &
m_gmat[0][0], 1, &u1_hat[0], 1);
981 &
m_jac[0], 1, &u1_hat[0], 1);
984 &
m_gmat[1][0], 1, &u2_hat[0], 1);
987 &
m_jac[0], 1, &u2_hat[0], 1);
992 &
m_gmat[2][0], 1, &u1_hat[0], 1);
995 &
m_jac[0], 1, &u1_hat[0], 1);
998 &
m_gmat[3][0], 1, &u2_hat[0], 1);
1001 &
m_jac[0], 1, &u2_hat[0], 1);
1004 for (n = 0; n < nElements; n++)
1006 phys_offset = fields[0]->GetPhys_Offset(n);
1008 fields[i]->GetExp(n)->StdPhysDeriv(0,
1009 auxArray1 = u1_hat + phys_offset,
1010 auxArray2 =
m_tmp1[i][j] + phys_offset);
1012 fields[i]->GetExp(n)->StdPhysDeriv(1,
1013 auxArray1 = u2_hat + phys_offset,
1014 auxArray2 =
m_tmp2[i][j] + phys_offset);
1019 &
m_DU1[i][j][0], 1);
1028 inarray[i],
m_IF1[i][j],
1034 for (j = 0; j < nSolutionPts; ++j)
1057 for (j = 0; j < nSolutionPts; j++)
1071 for (j = 0; j < nDim; ++j)
1085 for (i = 0; i < nConvectiveFields; ++i)
1090 for (j = 0; j < nSolutionPts; j++)
1099 for (n = 0; n < nElements; n++)
1101 phys_offset = fields[0]->GetPhys_Offset(n);
1103 fields[0]->GetExp(n)->StdPhysDeriv(0,
1104 auxArray1 = f_hat + phys_offset,
1105 auxArray2 =
m_DD1[i][0] + phys_offset);
1107 fields[0]->GetExp(n)->StdPhysDeriv(1,
1108 auxArray1 = g_hat + phys_offset,
1109 auxArray2 =
m_DD1[i][1] + phys_offset);
1119 if (
Basis[0]->GetPointsType() ==
1121 Basis[1]->GetPointsType() ==
1137 &
m_divFC[i][0], 1, &outarray[i][0], 1);
1142 &
m_jac[0], 1, &outarray[i][0], 1);
1145 if (!(
Basis[0]->Collocation()))
1147 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1148 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1156 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1172 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1173 int nvariables = fields.size();
1174 int nDim = fields[0]->GetCoordim(0);
1182 for (i = 0; i < nDim; ++i)
1191 for (j = 0; j < nDim; ++j)
1193 for (i = 0; i < nvariables ; ++i)
1196 fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd);
1206 fields[i]->GetTrace()->Upwind(Vn, Fwd, Bwd, fluxtemp);
1217 if(fields[0]->GetBndCondExpansions().size())
1249 int nBndEdgePts, nBndEdges;
1251 int nBndRegions = fields[var]->GetBndCondExpansions().size();
1252 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1256 fields[var]->ExtractTracePhys(ufield, uplus);
1259 for (i = 0; i < nBndRegions; ++i)
1262 nBndEdges = fields[var]->
1263 GetBndCondExpansions()[i]->GetExpSize();
1266 for (e = 0; e < nBndEdges ; ++e)
1269 nBndEdgePts = fields[var]->
1270 GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
1274 GetBndCondExpansions()[i]->GetPhys_Offset(e);
1277 id2 = fields[0]->GetTrace()->
1278 GetPhys_Offset(fields[0]->GetTraceMap()->
1279 GetBndCondIDToGlobalTraceID(cnt++));
1282 if (fields[var]->GetBndConditions()[i]->
1287 GetBndCondExpansions()[i]->
1289 &penaltyflux[id2], 1);
1292 else if ((fields[var]->GetBndConditions()[i])->
1297 &penaltyflux[id2], 1);
1313 boost::ignore_unused(ufield);
1316 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1317 int nvariables = fields.size();
1318 int nDim = fields[0]->GetCoordim(0);
1331 for(i = 0; i < nDim; ++i)
1339 for (i = 0; i < nvariables; ++i)
1342 for (j = 0; j < nDim; ++j)
1345 fields[i]->GetFwdBwdTracePhys(qfield[i][j], qFwd, qBwd);
1359 fields[i]->GetTrace()->Upwind(Vn, qBwd, qFwd, qfluxtemp);
1384 if (fields[0]->GetBndCondExpansions().size())
1413 boost::ignore_unused(C11);
1416 int nBndEdges, nBndEdgePts;
1417 int nBndRegions = fields[var]->GetBndCondExpansions().size();
1418 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1424 fields[var]->ExtractTracePhys(qfield, qtemp);
1426 for (i = 0; i < nBndRegions; ++i)
1428 nBndEdges = fields[var]->
1429 GetBndCondExpansions()[i]->GetExpSize();
1432 for (e = 0; e < nBndEdges ; ++e)
1434 nBndEdgePts = fields[var]->
1435 GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
1438 GetBndCondExpansions()[i]->GetPhys_Offset(e);
1440 id2 = fields[0]->GetTrace()->
1441 GetPhys_Offset(fields[0]->GetTraceMap()->
1442 GetBndCondIDToGlobalTraceID(cnt++));
1446 if (fields[var]->GetBndConditions()[i]->
1450 &qtemp[id2], 1, &penaltyflux[id2], 1);
1453 else if ((fields[var]->GetBndConditions()[i])->
1457 &(fields[var]->GetBndCondExpansions()[i]->
1458 GetPhys())[id1], 1, &penaltyflux[id2], 1);
1475 const int nConvectiveFields,
1481 boost::ignore_unused(nConvectiveFields);
1484 int nLocalSolutionPts, phys_offset, t_offset;
1492 Basis = fields[0]->GetExp(0)->GetBasis(0);
1494 int nElements = fields[0]->GetExpSize();
1495 int nSolutionPts = fields[0]->GetTotPoints();
1497 vector<bool> negatedFluxNormal =
1498 std::static_pointer_cast<MultiRegions::DisContField>(
1499 fields[0])->GetNegatedFluxNormal();
1510 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1512 for (n = 0; n < nElements; ++n)
1514 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1515 phys_offset = fields[0]->GetPhys_Offset(n);
1520 &flux[phys_offset], 1,
1523 fields[0]->GetExp(n)->GetTracePhysVals(0, elmtToTrace[n][0],
1527 t_offset = fields[0]->GetTrace()
1528 ->GetPhys_Offset(elmtToTrace[n][0]->GetElmtId());
1530 if(negatedFluxNormal[2*n])
1532 JumpL[n] = iFlux[t_offset] - tmpFluxVertex[0];
1536 JumpL[n] = -iFlux[t_offset] - tmpFluxVertex[0];
1539 t_offset = fields[0]->GetTrace()
1540 ->GetPhys_Offset(elmtToTrace[n][1]->GetElmtId());
1542 fields[0]->GetExp(n)->GetTracePhysVals(1, elmtToTrace[n][1],
1545 if(negatedFluxNormal[2*n+1])
1547 JumpR[n] = -iFlux[t_offset] - tmpFluxVertex[0];
1551 JumpR[n] = iFlux[t_offset] - tmpFluxVertex[0];
1555 for (n = 0; n < nElements; ++n)
1557 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1558 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1559 phys_offset = fields[0]->GetPhys_Offset(n);
1560 jac = fields[0]->GetExp(n)
1564 JumpL[n] = JumpL[n] * jac[0];
1565 JumpR[n] = JumpR[n] * jac[0];
1576 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1577 &derCFlux[phys_offset], 1);
1597 const int nConvectiveFields,
1598 const int direction,
1604 boost::ignore_unused(nConvectiveFields);
1606 int n, e, i, j, cnt;
1611 int nElements = fields[0]->GetExpSize();
1613 int trace_offset, phys_offset;
1614 int nLocalSolutionPts;
1622 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1625 for (n = 0; n < nElements; ++n)
1628 phys_offset = fields[0]->GetPhys_Offset(n);
1629 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1630 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1635 base = fields[0]->GetExp(n)->GetBase();
1636 nquad0 = base[0]->GetNumPoints();
1637 nquad1 = base[1]->GetNumPoints();
1645 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1648 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1654 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1655 elmtToTrace[n][e]->GetElmtId());
1664 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
1666 auxArray1 = tmparray);
1672 &tmparray[0], 1, &fluxJumps[0], 1);
1676 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1685 if (fields[0]->GetExp(n)->as<LocalRegions::Expansion2D>()
1686 ->GetGeom2D()->GetMetricInfo()->GetGtype()
1692 fields[0]->GetExp(n)->GetTracePhysVals(
1693 e, elmtToTrace[n][e],
1694 jac, auxArray1 = jacEdge);
1698 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1708 for (j = 0; j < nEdgePts; j++)
1710 fluxJumps[j] = fluxJumps[j] * jacEdge[j];
1728 for (i = 0; i < nquad0; ++i)
1733 for (j = 0; j < nquad1; ++j)
1736 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1741 for (i = 0; i < nquad1; ++i)
1746 for (j = 0; j < nquad0; ++j)
1748 cnt = (nquad0)*i + j;
1749 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1754 for (i = 0; i < nquad0; ++i)
1759 for (j = 0; j < nquad1; ++j)
1762 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1767 for (i = 0; i < nquad1; ++i)
1771 for (j = 0; j < nquad0; ++j)
1774 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1780 ASSERTL0(
false,
"edge value (< 3) is out of range");
1790 &divCFluxE3[0], 1, &derCFlux[phys_offset], 1);
1792 else if (direction == 1)
1795 &divCFluxE2[0], 1, &derCFlux[phys_offset], 1);
1814 const int nConvectiveFields,
1821 boost::ignore_unused(nConvectiveFields);
1823 int n, e, i, j, cnt;
1825 int nElements = fields[0]->GetExpSize();
1827 int nLocalSolutionPts;
1838 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1841 for(n = 0; n < nElements; ++n)
1844 phys_offset = fields[0]->GetPhys_Offset(n);
1845 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1847 base = fields[0]->GetExp(n)->GetBase();
1848 nquad0 = base[0]->GetNumPoints();
1849 nquad1 = base[1]->GetNumPoints();
1857 for(e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1860 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1869 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1870 elmtToTrace[n][e]->GetElmtId());
1874 fields[0]->GetExp(n)->GetTraceNormal(e);
1878 fields[0]->GetExp(n)->GetTracePhysVals(
1879 e, elmtToTrace[n][e],
1880 fluxX1 + phys_offset,
1881 auxArray1 = tmparrayX1);
1885 fields[0]->GetExp(n)->GetTracePhysVals(
1886 e, elmtToTrace[n][e],
1887 fluxX2 + phys_offset,
1888 auxArray1 = tmparrayX2);
1891 for (i = 0; i < nEdgePts; ++i)
1900 &numericalFlux[trace_offset], 1,
1901 &fluxN[0], 1, &fluxJumps[0], 1);
1904 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1908 auxArray1 = fluxJumps, 1,
1909 auxArray2 = fluxJumps, 1);
1912 for (i = 0; i < nEdgePts; ++i)
1917 fluxJumps[i] = -fluxJumps[i];
1925 for (i = 0; i < nquad0; ++i)
1928 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
1930 for (j = 0; j < nquad1; ++j)
1933 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1938 for (i = 0; i < nquad1; ++i)
1941 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
1943 for (j = 0; j < nquad0; ++j)
1945 cnt = (nquad0)*i + j;
1946 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1951 for (i = 0; i < nquad0; ++i)
1954 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
1956 for (j = 0; j < nquad1; ++j)
1959 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1964 for (i = 0; i < nquad1; ++i)
1967 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
1968 for (j = 0; j < nquad0; ++j)
1971 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1977 ASSERTL0(
false,
"edge value (< 3) is out of range");
1984 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
1986 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1987 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1989 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1990 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
2009 const int nConvectiveFields,
2016 boost::ignore_unused(nConvectiveFields);
2018 int n, e, i, j, cnt;
2020 int nElements = fields[0]->GetExpSize();
2021 int nLocalSolutionPts;
2032 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
2035 for(n = 0; n < nElements; ++n)
2038 phys_offset = fields[0]->GetPhys_Offset(n);
2039 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
2041 base = fields[0]->GetExp(n)->GetBase();
2042 nquad0 = base[0]->GetNumPoints();
2043 nquad1 = base[1]->GetNumPoints();
2051 for(e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
2054 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
2063 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
2064 elmtToTrace[n][e]->GetElmtId());
2068 fields[0]->GetExp(n)->GetTraceNormal(e);
2077 fields[0]->GetExp(n)->GetTracePhysVals(
2078 e, elmtToTrace[n][e],
2079 fluxX2 + phys_offset,
2080 auxArray1 = fluxN_D);
2086 &numericalFlux[trace_offset], 1,
2090 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2094 auxArray1 = fluxN, 1,
2095 auxArray2 = fluxN, 1);
2098 auxArray1 = fluxN_D, 1,
2099 auxArray2 = fluxN_D, 1);
2103 for (i = 0; i < nquad0; ++i)
2106 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
2109 for (i = 0; i < nEdgePts; ++i)
2116 fluxN_R[i] = -fluxN_R[i];
2124 &fluxN_D[0], 1, &fluxJumps[0], 1);
2128 for (i = 0; i < nquad0; ++i)
2130 for (j = 0; j < nquad1; ++j)
2142 fields[0]->GetExp(n)->GetTracePhysVals(
2143 e, elmtToTrace[n][e],
2144 fluxX1 + phys_offset,
2145 auxArray1 = fluxN_D);
2149 &numericalFlux[trace_offset], 1,
2153 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2157 auxArray1 = fluxN, 1,
2158 auxArray2 = fluxN, 1);
2161 auxArray1 = fluxN_D, 1,
2162 auxArray2 = fluxN_D, 1);
2166 for (i = 0; i < nquad1; ++i)
2169 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
2172 for (i = 0; i < nEdgePts; ++i)
2179 fluxN_R[i] = -fluxN_R[i];
2187 &fluxN_D[0], 1, &fluxJumps[0], 1);
2191 for (i = 0; i < nquad1; ++i)
2193 for (j = 0; j < nquad0; ++j)
2195 cnt = (nquad0)*i + j;
2207 fields[0]->GetExp(n)->GetTracePhysVals(
2208 e, elmtToTrace[n][e],
2209 fluxX2 + phys_offset,
2210 auxArray1 = fluxN_D);
2214 &numericalFlux[trace_offset], 1,
2218 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2222 auxArray1 = fluxN, 1,
2223 auxArray2 = fluxN, 1);
2226 auxArray1 = fluxN_D, 1,
2227 auxArray2 = fluxN_D, 1);
2231 for (i = 0; i < nquad0; ++i)
2234 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
2237 for (i = 0; i < nEdgePts; ++i)
2244 fluxN_R[i] = -fluxN_R[i];
2253 &fluxN_D[0], 1, &fluxJumps[0], 1);
2257 for (i = 0; i < nquad0; ++i)
2259 for (j = 0; j < nquad1; ++j)
2272 fields[0]->GetExp(n)->GetTracePhysVals(
2273 e, elmtToTrace[n][e],
2274 fluxX1 + phys_offset,
2275 auxArray1 = fluxN_D);
2280 &numericalFlux[trace_offset], 1,
2284 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2288 auxArray1 = fluxN, 1,
2289 auxArray2 = fluxN, 1);
2292 auxArray1 = fluxN_D, 1,
2293 auxArray2 = fluxN_D, 1);
2297 for (i = 0; i < nquad1; ++i)
2300 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
2303 for (i = 0; i < nEdgePts; ++i)
2310 fluxN_R[i] = -fluxN_R[i];
2319 &fluxN_D[0], 1, &fluxJumps[0], 1);
2323 for (i = 0; i < nquad1; ++i)
2325 for (j = 0; j < nquad0; ++j)
2334 ASSERTL0(
false,
"edge value (< 3) is out of range");
2342 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
2344 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2345 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2347 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2348 &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
virtual void v_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.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tmp2
virtual void v_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, NekDouble > > m_dGL_xi2
virtual void v_Diffuse(const std::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)
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
virtual void v_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.
virtual void v_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.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DFC1
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DD1
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi1
virtual void v_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...
virtual void v_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, NekDouble > > m_divFC
virtual void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initiliase DiffusionLFR objects and store them before starting the time-stepping.
LibUtilities::SessionReaderSharedPtr m_session
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi2
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi1
virtual void v_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.
virtual void v_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, NekDouble > > m_dGR_xi3
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
virtual void v_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, NekDouble > > m_Q2D_e2
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_D1
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi3
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e1
Array< OneD, Array< OneD, NekDouble > > m_IF2
Array< OneD, Array< OneD, NekDouble > > m_divFD
virtual void v_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, Array< OneD, NekDouble > > > m_BD1
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.
The above copyright notice and this permission notice shall be included.
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.