35 #include <boost/core/ignore_unused.hpp>
47 #include <boost/math/special_functions/gamma.hpp>
58 std::string AdvectionFR::type[] = {
65 AdvectionFR::create)};
75 AdvectionFR::AdvectionFR(std::string advType) : m_advType(advType)
118 boost::ignore_unused(pSession);
122 int nLocalSolutionPts;
123 int nElements = pFields[0]->GetExpSize();
124 int nDimensions = pFields[0]->GetCoordim(0);
125 int nSolutionPts = pFields[0]->GetTotPoints();
126 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
141 for (n = 0; n < nElements; ++n)
143 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
144 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
145 phys_offset = pFields[0]->GetPhys_Offset(n);
152 for (i = 0; i < nLocalSolutionPts; ++i)
154 m_jac[i + phys_offset] = jac[0];
174 for (n = 0; n < nElements; ++n)
176 base = pFields[0]->GetExp(n)->GetBase();
177 nquad0 = base[0]->GetNumPoints();
178 nquad1 = base[1]->GetNumPoints();
186 pFields[0]->GetExp(n)->GetTraceQFactors(0, auxArray1 =
188 pFields[0]->GetExp(n)->GetTraceQFactors(1, auxArray1 =
190 pFields[0]->GetExp(n)->GetTraceQFactors(2, auxArray1 =
192 pFields[0]->GetExp(n)->GetTraceQFactors(3, auxArray1 =
195 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
196 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
197 phys_offset = pFields[0]->GetPhys_Offset(n);
210 ->GetDerivFactors(ptsKeys);
219 for (i = 0; i < nLocalSolutionPts; ++i)
221 m_jac[i + phys_offset] = jac[i];
222 m_gmat[0][i + phys_offset] = gmat[0][i];
223 m_gmat[1][i + phys_offset] = gmat[1][i];
224 m_gmat[2][i + phys_offset] = gmat[2][i];
225 m_gmat[3][i + phys_offset] = gmat[3][i];
230 for (i = 0; i < nLocalSolutionPts; ++i)
232 m_jac[i + phys_offset] = jac[0];
233 m_gmat[0][i + phys_offset] = gmat[0][0];
234 m_gmat[1][i + phys_offset] = gmat[1][0];
235 m_gmat[2][i + phys_offset] = gmat[2][0];
236 m_gmat[3][i + phys_offset] = gmat[3][0];
242 for (i = 0; i < nDimensions; ++i)
252 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
257 ASSERTL0(
false,
"Expansion dimension not recognised");
283 boost::ignore_unused(pSession);
289 int nquad0, nquad1, nquad2;
290 int nmodes0, nmodes1, nmodes2;
293 int nElements = pFields[0]->GetExpSize();
294 int nDimensions = pFields[0]->GetCoordim(0);
303 for (n = 0; n < nElements; ++n)
305 base = pFields[0]->GetExp(n)->GetBase();
306 nquad0 = base[0]->GetNumPoints();
307 nmodes0 = base[0]->GetNumModes();
311 base[0]->GetZW(z0, w0);
323 int p0 = nmodes0 - 1;
329 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1) /
330 (pow(2.0, p0) * boost::math::tgamma(p0 + 1) *
331 boost::math::tgamma(p0 + 1));
341 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
342 (ap0 * boost::math::tgamma(p0 + 1)) *
343 (ap0 * boost::math::tgamma(p0 + 1)));
347 c0 = 2.0 * (p0 + 1.0) /
348 ((2.0 * p0 + 1.0) * p0 *
349 (ap0 * boost::math::tgamma(p0 + 1)) *
350 (ap0 * boost::math::tgamma(p0 + 1)));
354 c0 = -2.0 / ((2.0 * p0 + 1.0) *
355 (ap0 * boost::math::tgamma(p0 + 1)) *
356 (ap0 * boost::math::tgamma(p0 + 1)));
360 c0 = 10000000000000000.0;
363 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
364 (ap0 * boost::math::tgamma(p0 + 1)) *
365 (ap0 * boost::math::tgamma(p0 + 1));
367 NekDouble overeta0 = 1.0 / (1.0 + etap0);
380 for (i = 0; i < nquad0; ++i)
390 for (i = 0; i < nquad0; ++i)
413 for (n = 0; n < nElements; ++n)
415 base = pFields[0]->GetExp(n)->GetBase();
416 nquad0 = base[0]->GetNumPoints();
417 nquad1 = base[1]->GetNumPoints();
418 nmodes0 = base[0]->GetNumModes();
419 nmodes1 = base[1]->GetNumModes();
426 base[0]->GetZW(z0, w0);
427 base[1]->GetZW(z1, w1);
444 int p0 = nmodes0 - 1;
445 int p1 = nmodes1 - 1;
452 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1) /
453 (pow(2.0, p0) * boost::math::tgamma(p0 + 1) *
454 boost::math::tgamma(p0 + 1));
456 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1) /
457 (pow(2.0, p1) * boost::math::tgamma(p1 + 1) *
458 boost::math::tgamma(p1 + 1));
469 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
470 (ap0 * boost::math::tgamma(p0 + 1)) *
471 (ap0 * boost::math::tgamma(p0 + 1)));
474 ((2.0 * p1 + 1.0) * (p1 + 1.0) *
475 (ap1 * boost::math::tgamma(p1 + 1)) *
476 (ap1 * boost::math::tgamma(p1 + 1)));
480 c0 = 2.0 * (p0 + 1.0) /
481 ((2.0 * p0 + 1.0) * p0 *
482 (ap0 * boost::math::tgamma(p0 + 1)) *
483 (ap0 * boost::math::tgamma(p0 + 1)));
485 c1 = 2.0 * (p1 + 1.0) /
486 ((2.0 * p1 + 1.0) * p1 *
487 (ap1 * boost::math::tgamma(p1 + 1)) *
488 (ap1 * boost::math::tgamma(p1 + 1)));
492 c0 = -2.0 / ((2.0 * p0 + 1.0) *
493 (ap0 * boost::math::tgamma(p0 + 1)) *
494 (ap0 * boost::math::tgamma(p0 + 1)));
496 c1 = -2.0 / ((2.0 * p1 + 1.0) *
497 (ap1 * boost::math::tgamma(p1 + 1)) *
498 (ap1 * boost::math::tgamma(p1 + 1)));
502 c0 = 10000000000000000.0;
503 c1 = 10000000000000000.0;
506 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
507 (ap0 * boost::math::tgamma(p0 + 1)) *
508 (ap0 * boost::math::tgamma(p0 + 1));
510 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0) *
511 (ap1 * boost::math::tgamma(p1 + 1)) *
512 (ap1 * boost::math::tgamma(p1 + 1));
514 NekDouble overeta0 = 1.0 / (1.0 + etap0);
515 NekDouble overeta1 = 1.0 / (1.0 + etap1);
534 for (i = 0; i < nquad0; ++i)
544 for (i = 0; i < nquad1; ++i)
554 for (i = 0; i < nquad0; ++i)
564 for (i = 0; i < nquad1; ++i)
584 for (n = 0; n < nElements; ++n)
586 base = pFields[0]->GetExp(n)->GetBase();
587 nquad0 = base[0]->GetNumPoints();
588 nquad1 = base[1]->GetNumPoints();
589 nquad2 = base[2]->GetNumPoints();
590 nmodes0 = base[0]->GetNumModes();
591 nmodes1 = base[1]->GetNumModes();
592 nmodes2 = base[2]->GetNumModes();
601 base[0]->GetZW(z0, w0);
602 base[1]->GetZW(z1, w1);
603 base[1]->GetZW(z2, w2);
625 int p0 = nmodes0 - 1;
626 int p1 = nmodes1 - 1;
627 int p2 = nmodes2 - 1;
634 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1) /
635 (pow(2.0, p0) * boost::math::tgamma(p0 + 1) *
636 boost::math::tgamma(p0 + 1));
639 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1) /
640 (pow(2.0, p1) * boost::math::tgamma(p1 + 1) *
641 boost::math::tgamma(p1 + 1));
644 NekDouble ap2 = boost::math::tgamma(2 * p2 + 1) /
645 (pow(2.0, p2) * boost::math::tgamma(p2 + 1) *
646 boost::math::tgamma(p2 + 1));
658 ((2.0 * p0 + 1.0) * (p0 + 1.0) *
659 (ap0 * boost::math::tgamma(p0 + 1)) *
660 (ap0 * boost::math::tgamma(p0 + 1)));
663 ((2.0 * p1 + 1.0) * (p1 + 1.0) *
664 (ap1 * boost::math::tgamma(p1 + 1)) *
665 (ap1 * boost::math::tgamma(p1 + 1)));
668 ((2.0 * p2 + 1.0) * (p2 + 1.0) *
669 (ap2 * boost::math::tgamma(p2 + 1)) *
670 (ap2 * boost::math::tgamma(p2 + 1)));
674 c0 = 2.0 * (p0 + 1.0) /
675 ((2.0 * p0 + 1.0) * p0 *
676 (ap0 * boost::math::tgamma(p0 + 1)) *
677 (ap0 * boost::math::tgamma(p0 + 1)));
679 c1 = 2.0 * (p1 + 1.0) /
680 ((2.0 * p1 + 1.0) * p1 *
681 (ap1 * boost::math::tgamma(p1 + 1)) *
682 (ap1 * boost::math::tgamma(p1 + 1)));
684 c2 = 2.0 * (p2 + 1.0) /
685 ((2.0 * p2 + 1.0) * p2 *
686 (ap2 * boost::math::tgamma(p2 + 1)) *
687 (ap2 * boost::math::tgamma(p2 + 1)));
691 c0 = -2.0 / ((2.0 * p0 + 1.0) *
692 (ap0 * boost::math::tgamma(p0 + 1)) *
693 (ap0 * boost::math::tgamma(p0 + 1)));
695 c1 = -2.0 / ((2.0 * p1 + 1.0) *
696 (ap1 * boost::math::tgamma(p1 + 1)) *
697 (ap1 * boost::math::tgamma(p1 + 1)));
699 c2 = -2.0 / ((2.0 * p2 + 1.0) *
700 (ap2 * boost::math::tgamma(p2 + 1)) *
701 (ap2 * boost::math::tgamma(p2 + 1)));
705 c0 = 10000000000000000.0;
706 c1 = 10000000000000000.0;
707 c2 = 10000000000000000.0;
710 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0) *
711 (ap0 * boost::math::tgamma(p0 + 1)) *
712 (ap0 * boost::math::tgamma(p0 + 1));
714 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0) *
715 (ap1 * boost::math::tgamma(p1 + 1)) *
716 (ap1 * boost::math::tgamma(p1 + 1));
718 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0) *
719 (ap2 * boost::math::tgamma(p2 + 1)) *
720 (ap2 * boost::math::tgamma(p2 + 1));
722 NekDouble overeta0 = 1.0 / (1.0 + etap0);
723 NekDouble overeta1 = 1.0 / (1.0 + etap1);
724 NekDouble overeta2 = 1.0 / (1.0 + etap2);
749 for (i = 0; i < nquad0; ++i)
759 for (i = 0; i < nquad1; ++i)
769 for (i = 0; i < nquad2; ++i)
779 for (i = 0; i < nquad0; ++i)
789 for (i = 0; i < nquad1; ++i)
799 for (i = 0; i < nquad2; ++i)
812 ASSERTL0(
false,
"Expansion dimension not recognised");
831 const int nConvectiveFields,
839 boost::ignore_unused(advVel, time, pFwd, pBwd);
847 Basis = fields[0]->GetExp(0)->GetBase();
849 int nElements = fields[0]->GetExpSize();
850 int nDimensions = fields[0]->GetCoordim(0);
851 int nSolutionPts = fields[0]->GetTotPoints();
852 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
853 int nCoeffs = fields[0]->GetNcoeffs();
866 for (i = 0; i < nConvectiveFields; ++i)
876 for (i = 0; i < nConvectiveFields; ++i)
882 fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
901 for (i = 0; i < nConvectiveFields; ++i)
903 for (n = 0; n < nElements; n++)
905 phys_offset = fields[0]->GetPhys_Offset(n);
907 fields[i]->GetExp(n)->PhysDeriv(
908 0, fluxvector[i][0] + phys_offset,
909 auxArray2 = DfluxvectorX1 + phys_offset);
913 DivCFlux_1D(nConvectiveFields, fields, fluxvector[i][0],
921 Vmath::Vadd(nSolutionPts, &outarray[i][0], 1, &DfluxvectorX1[0],
922 1, &outarray[i][0], 1);
925 if (!(
Basis[0]->Collocation()))
927 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
928 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
944 for (i = 0; i < nConvectiveFields; ++i)
951 &fluxvector[i][0][0], 1, &
m_gmat[2][0], 1,
952 &fluxvector[i][1][0], 1, &f_hat[0], 1);
958 &fluxvector[i][0][0], 1, &
m_gmat[3][0], 1,
959 &fluxvector[i][1][0], 1, &g_hat[0], 1);
965 for (n = 0; n < nElements; n++)
967 phys_offset = fields[0]->GetPhys_Offset(n);
968 fields[0]->GetExp(n)->StdPhysDeriv(
969 0, auxArray1 = f_hat + phys_offset,
970 auxArray2 = DfluxvectorX1 + phys_offset);
971 fields[0]->GetExp(n)->StdPhysDeriv(
972 1, auxArray1 = g_hat + phys_offset,
973 auxArray2 = DfluxvectorX2 + phys_offset);
977 Vmath::Vadd(nSolutionPts, DfluxvectorX1, 1, DfluxvectorX2, 1,
981 if (
Basis[0]->GetPointsType() ==
983 Basis[1]->GetPointsType() ==
991 DivCFlux_2D(nConvectiveFields, fields, fluxvector[i][0],
992 fluxvector[i][1], numflux[i], divFC);
996 Vmath::Vadd(nSolutionPts, divFD, 1, divFC, 1, outarray[i], 1);
1000 &outarray[i][0], 1);
1003 if (!(
Basis[0]->Collocation()))
1005 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1006 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1014 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1031 const int nConvectiveFields,
1037 boost::ignore_unused(nConvectiveFields);
1040 int nLocalSolutionPts, phys_offset, t_offset;
1043 Basis = fields[0]->GetExp(0)->GetBasis(0);
1045 int nElements = fields[0]->GetExpSize();
1046 int nSolutionPts = fields[0]->GetTotPoints();
1048 vector<bool> leftAdjacentTraces =
1049 std::static_pointer_cast<MultiRegions::DisContField>(fields[0])
1050 ->GetLeftAdjacentTraces();
1061 fields[0]->GetTraceMap()->GetElmtToTrace();
1063 for (n = 0; n < nElements; ++n)
1065 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1066 phys_offset = fields[0]->GetPhys_Offset(n);
1070 Vmath::Vcopy(nLocalSolutionPts, &fluxX1[phys_offset], 1, &tmparrayX1[0],
1073 fields[0]->GetExp(n)->GetTracePhysVals(0, elmtToTrace[n][0], tmparrayX1,
1076 t_offset = fields[0]->GetTrace()->GetPhys_Offset(
1077 elmtToTrace[n][0]->GetElmtId());
1079 if (leftAdjacentTraces[2 * n])
1081 JumpL[n] = -numericalFlux[t_offset] - tmpFluxVertex[0];
1085 JumpL[n] = numericalFlux[t_offset] - tmpFluxVertex[0];
1088 fields[0]->GetExp(n)->GetTracePhysVals(1, elmtToTrace[n][1], tmparrayX1,
1091 t_offset = fields[0]->GetTrace()->GetPhys_Offset(
1092 elmtToTrace[n][1]->GetElmtId());
1094 if (leftAdjacentTraces[2 * n + 1])
1096 JumpR[n] = numericalFlux[t_offset] - tmpFluxVertex[0];
1100 JumpR[n] = -numericalFlux[t_offset] - tmpFluxVertex[0];
1104 for (n = 0; n < nElements; ++n)
1106 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1107 phys_offset = fields[0]->GetPhys_Offset(n);
1118 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1119 &divCFlux[phys_offset], 1);
1136 const int nConvectiveFields,
1143 boost::ignore_unused(nConvectiveFields);
1145 int n, e, i, j, cnt;
1147 int nElements = fields[0]->GetExpSize();
1149 int nLocalSolutionPts, nEdgePts;
1150 int trace_offset, phys_offset;
1157 fields[0]->GetTraceMap()->GetElmtToTrace();
1160 for (n = 0; n < nElements; ++n)
1163 phys_offset = fields[0]->GetPhys_Offset(n);
1164 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1166 base = fields[0]->GetExp(n)->GetBase();
1167 nquad0 = base[0]->GetNumPoints();
1168 nquad1 = base[1]->GetNumPoints();
1176 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1179 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1188 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1189 elmtToTrace[n][e]->GetElmtId());
1193 fields[0]->GetExp(n)->GetTraceNormal(e);
1197 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
1198 fluxX1 + phys_offset,
1199 auxArray1 = tmparrayX1);
1203 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
1204 fluxX2 + phys_offset,
1205 auxArray1 = tmparrayX2);
1214 Vmath::Vsub(nEdgePts, &numericalFlux[trace_offset], 1, &fluxN[0], 1,
1218 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1224 for (i = 0; i < nEdgePts; ++i)
1229 fluxJumps[i] = -fluxJumps[i];
1237 for (i = 0; i < nquad0; ++i)
1240 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
1242 for (j = 0; j < nquad1; ++j)
1244 cnt = i + j * nquad0;
1245 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1250 for (i = 0; i < nquad1; ++i)
1253 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
1255 for (j = 0; j < nquad0; ++j)
1257 cnt = (nquad0)*i + j;
1258 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1263 for (i = 0; i < nquad0; ++i)
1266 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
1268 for (j = 0; j < nquad1; ++j)
1270 cnt = j * nquad0 + i;
1271 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1276 for (i = 0; i < nquad1; ++i)
1279 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
1280 for (j = 0; j < nquad0; ++j)
1282 cnt = j + i * nquad0;
1283 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1288 ASSERTL0(
false,
"edge value (< 3) is out of range");
1294 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE1[0], 1,
1295 &divCFlux[phys_offset], 1);
1297 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1298 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1300 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1301 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
1320 const int nConvectiveFields,
1327 boost::ignore_unused(nConvectiveFields);
1329 int n, e, i, j, cnt;
1331 int nElements = fields[0]->GetExpSize();
1332 int nLocalSolutionPts;
1343 fields[0]->GetTraceMap()->GetElmtToTrace();
1346 for (n = 0; n < nElements; ++n)
1349 phys_offset = fields[0]->GetPhys_Offset(n);
1350 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1352 base = fields[0]->GetExp(n)->GetBase();
1353 nquad0 = base[0]->GetNumPoints();
1354 nquad1 = base[1]->GetNumPoints();
1362 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1365 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1374 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1375 elmtToTrace[n][e]->GetElmtId());
1379 fields[0]->GetExp(n)->GetTraceNormal(e);
1388 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
1389 fluxX2 + phys_offset,
1390 auxArray1 = fluxN_D);
1395 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
1399 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1403 auxArray2 = fluxN, 1);
1406 auxArray2 = fluxN_D, 1);
1410 for (i = 0; i < nquad0; ++i)
1413 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
1416 for (i = 0; i < nEdgePts; ++i)
1423 fluxN_R[i] = -fluxN_R[i];
1429 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
1434 for (i = 0; i < nquad0; ++i)
1436 for (j = 0; j < nquad1; ++j)
1438 cnt = i + j * nquad0;
1439 divCFluxE0[cnt] = -fluxJumps[i] *
m_dGL_xi2[n][j];
1447 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
1448 fluxX1 + phys_offset,
1449 auxArray1 = fluxN_D);
1452 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
1456 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1460 auxArray2 = fluxN, 1);
1463 auxArray2 = fluxN_D, 1);
1467 for (i = 0; i < nquad1; ++i)
1470 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
1473 for (i = 0; i < nEdgePts; ++i)
1480 fluxN_R[i] = -fluxN_R[i];
1486 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
1491 for (i = 0; i < nquad1; ++i)
1493 for (j = 0; j < nquad0; ++j)
1495 cnt = (nquad0)*i + j;
1496 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1506 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
1507 fluxX2 + phys_offset,
1508 auxArray1 = fluxN_D);
1511 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
1515 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1519 auxArray2 = fluxN, 1);
1522 auxArray2 = fluxN_D, 1);
1526 for (i = 0; i < nquad0; ++i)
1529 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
1532 for (i = 0; i < nEdgePts; ++i)
1539 fluxN_R[i] = -fluxN_R[i];
1546 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
1551 for (i = 0; i < nquad0; ++i)
1553 for (j = 0; j < nquad1; ++j)
1555 cnt = j * nquad0 + i;
1556 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1565 fields[0]->GetExp(n)->GetTracePhysVals(e, elmtToTrace[n][e],
1566 fluxX1 + phys_offset,
1567 auxArray1 = fluxN_D);
1571 Vmath::Vcopy(nEdgePts, &numericalFlux[trace_offset], 1,
1575 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1579 auxArray2 = fluxN, 1);
1582 auxArray2 = fluxN_D, 1);
1586 for (i = 0; i < nquad1; ++i)
1589 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
1592 for (i = 0; i < nEdgePts; ++i)
1599 fluxN_R[i] = -fluxN_R[i];
1606 Vmath::Vsub(nEdgePts, &fluxN_R[0], 1, &fluxN_D[0], 1,
1611 for (i = 0; i < nquad1; ++i)
1613 for (j = 0; j < nquad0; ++j)
1615 cnt = j + i * nquad0;
1616 divCFluxE3[cnt] = -fluxJumps[i] *
m_dGL_xi1[n][j];
1621 ASSERTL0(
false,
"edge value (< 3) is out of range");
1627 Vmath::Vadd(nLocalSolutionPts, &divCFluxE0[0], 1, &divCFluxE1[0], 1,
1628 &divCFlux[phys_offset], 1);
1630 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1631 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1633 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1634 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
1652 const int nConvectiveFields,
1660 boost::ignore_unused(nConvectiveFields, fields, fluxX1, fluxX2, fluxX3,
1661 numericalFlux, divCFlux);
#define ASSERTL0(condition, msg)
Represents a basis of a given type.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
const SpatialDomains::GeomFactorsSharedPtr & GetMetricInfo() const
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi1
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi3
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi1
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi2
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...
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi3
Array< OneD, NekDouble > m_jac
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e0
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e3
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e1
virtual void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields) override
Initiliase AdvectionFR objects and store them before starting the time-stepping.
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi2
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".
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...
virtual void v_Advect(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble >> &advVel, const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble &time, const Array< OneD, Array< OneD, NekDouble >> &pFwd=NullNekDoubleArrayOfArray, const Array< OneD, Array< OneD, NekDouble >> &pBwd=NullNekDoubleArrayOfArray) override
Compute the advection term at each time-step using the Flux Reconstruction approach (FR).
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 DivCFlux_3D(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 > &fluxX3, const Array< OneD, const NekDouble > &numericalFlux, Array< OneD, NekDouble > &divCFlux)
Compute the divergence of the corrective flux for 3D problems.
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
void DivCFlux_1D(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const NekDouble > &fluxX1, const Array< OneD, const NekDouble > &numericalFlux, Array< OneD, NekDouble > &divCFlux)
Compute the divergence of the corrective flux for 1D problems.
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e2
Array< OneD, Array< OneD, NekDouble > > m_gmat
int m_spaceDim
Storage for space dimension. Used for homogeneous extension.
AdvectionFluxVecCB m_fluxVector
Callback function to the flux vector (set when advection is in conservative form).
virtual SOLVER_UTILS_EXPORT void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.
RiemannSolverSharedPtr m_riemann
Riemann solver for DG-type schemes.
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::vector< PointsKey > PointsKeyVector
@ eGaussGaussLegendre
1D Gauss-Gauss-Legendre quadrature points
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
@ 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 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 Vvtvvtp(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtp (vector times vector plus vector times vector):
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.