44 #include <boost/math/special_functions/gamma.hpp>
57 std::string AdvectionFR::type[] = {
59 "FRDG", AdvectionFR::create),
61 "FRSD", AdvectionFR::create),
63 "FRHU", AdvectionFR::create),
65 "FRcmin", AdvectionFR::create),
67 "FRcinf", AdvectionFR::create)};
77 AdvectionFR::AdvectionFR(std::string advType):m_advType(advType)
123 int nLocalSolutionPts;
124 int nElements = pFields[0]->GetExpSize();
125 int nDimensions = pFields[0]->GetCoordim(0);
126 int nSolutionPts = pFields[0]->GetTotPoints();
127 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
142 for (n = 0; n < nElements; ++n)
144 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
145 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
146 phys_offset = pFields[0]->GetPhys_Offset(n);
147 jac = pFields[0]->GetExp(n)
150 for (i = 0; i < nLocalSolutionPts; ++i)
152 m_jac[i+phys_offset] = jac[0];
172 for (n = 0; n < nElements; ++n)
174 base = pFields[0]->GetExp(n)->GetBase();
175 nquad0 = base[0]->GetNumPoints();
176 nquad1 = base[1]->GetNumPoints();
184 pFields[0]->GetExp(n)->GetEdgeQFactors(
185 0, auxArray1 = m_Q2D_e0[n]);
186 pFields[0]->GetExp(n)->GetEdgeQFactors(
187 1, auxArray1 = m_Q2D_e1[n]);
188 pFields[0]->GetExp(n)->GetEdgeQFactors(
189 2, auxArray1 = m_Q2D_e2[n]);
190 pFields[0]->GetExp(n)->GetEdgeQFactors(
191 3, auxArray1 = m_Q2D_e3[n]);
193 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
194 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
195 phys_offset = pFields[0]->GetPhys_Offset(n);
197 jac = pFields[0]->GetExp(n)
200 gmat = pFields[0]->GetExp(n)
204 if (pFields[0]->GetExp(n)
205 ->as<LocalRegions::Expansion2D>()->GetGeom2D()
206 ->GetMetricInfo()->GetGtype()
209 for (i = 0; i < nLocalSolutionPts; ++i)
211 m_jac[i+phys_offset] = jac[i];
212 m_gmat[0][i+phys_offset] = gmat[0][i];
213 m_gmat[1][i+phys_offset] = gmat[1][i];
214 m_gmat[2][i+phys_offset] = gmat[2][i];
215 m_gmat[3][i+phys_offset] = gmat[3][i];
220 for (i = 0; i < nLocalSolutionPts; ++i)
222 m_jac[i+phys_offset] = jac[0];
223 m_gmat[0][i+phys_offset] = gmat[0][0];
224 m_gmat[1][i+phys_offset] = gmat[1][0];
225 m_gmat[2][i+phys_offset] = gmat[2][0];
226 m_gmat[3][i+phys_offset] = gmat[3][0];
233 for(i = 0; i < nDimensions; ++i)
243 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
248 ASSERTL0(
false,
"Expansion dimension not recognised");
278 int nquad0, nquad1, nquad2;
279 int nmodes0, nmodes1, nmodes2;
282 int nElements = pFields[0]->GetExpSize();
283 int nDimensions = pFields[0]->GetCoordim(0);
292 for (n = 0; n < nElements; ++n)
294 base = pFields[0]->GetExp(n)->GetBase();
295 nquad0 = base[0]->GetNumPoints();
296 nmodes0 = base[0]->GetNumModes();
300 base[0]->GetZW(z0, w0);
312 int p0 = nmodes0 - 1;
318 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
320 * boost::math::tgamma(p0 + 1)
321 * boost::math::tgamma(p0 + 1));
330 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
331 * (ap0 * boost::math::tgamma(p0 + 1))
332 * (ap0 * boost::math::tgamma(p0 + 1)));
336 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
337 * (ap0 * boost::math::tgamma(p0 + 1))
338 * (ap0 * boost::math::tgamma(p0 + 1)));
342 c0 = -2.0 / ((2.0 * p0 + 1.0)
343 * (ap0 * boost::math::tgamma(p0 + 1))
344 * (ap0 * boost::math::tgamma(p0 + 1)));
348 c0 = 10000000000000000.0;
351 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
352 * (ap0 * boost::math::tgamma(p0 + 1))
353 * (ap0 * boost::math::tgamma(p0 + 1));
355 NekDouble overeta0 = 1.0 / (1.0 + etap0);
366 for(i = 0; i < nquad0; ++i)
372 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
376 for(i = 0; i < nquad0; ++i)
378 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
379 m_dGR_xi1[n][i] += dLpp0[i];
380 m_dGR_xi1[n][i] *= overeta0;
381 m_dGR_xi1[n][i] += dLp0[i];
382 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
399 for (n = 0; n < nElements; ++n)
401 base = pFields[0]->GetExp(n)->GetBase();
402 nquad0 = base[0]->GetNumPoints();
403 nquad1 = base[1]->GetNumPoints();
404 nmodes0 = base[0]->GetNumModes();
405 nmodes1 = base[1]->GetNumModes();
412 base[0]->GetZW(z0, w0);
413 base[1]->GetZW(z1, w1);
430 int p0 = nmodes0 - 1;
431 int p1 = nmodes1 - 1;
438 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
440 * boost::math::tgamma(p0 + 1)
441 * boost::math::tgamma(p0 + 1));
443 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
445 * boost::math::tgamma(p1 + 1)
446 * boost::math::tgamma(p1 + 1));
456 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
457 * (ap0 * boost::math::tgamma(p0 + 1))
458 * (ap0 * boost::math::tgamma(p0 + 1)));
460 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
461 * (ap1 * boost::math::tgamma(p1 + 1))
462 * (ap1 * boost::math::tgamma(p1 + 1)));
466 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
467 * (ap0 * boost::math::tgamma(p0 + 1))
468 * (ap0 * boost::math::tgamma(p0 + 1)));
470 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
471 * (ap1 * boost::math::tgamma(p1 + 1))
472 * (ap1 * boost::math::tgamma(p1 + 1)));
476 c0 = -2.0 / ((2.0 * p0 + 1.0)
477 * (ap0 * boost::math::tgamma(p0 + 1))
478 * (ap0 * boost::math::tgamma(p0 + 1)));
480 c1 = -2.0 / ((2.0 * p1 + 1.0)
481 * (ap1 * boost::math::tgamma(p1 + 1))
482 * (ap1 * boost::math::tgamma(p1 + 1)));
486 c0 = 10000000000000000.0;
487 c1 = 10000000000000000.0;
490 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
491 * (ap0 * boost::math::tgamma(p0 + 1))
492 * (ap0 * boost::math::tgamma(p0 + 1));
494 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
495 * (ap1 * boost::math::tgamma(p1 + 1))
496 * (ap1 * boost::math::tgamma(p1 + 1));
498 NekDouble overeta0 = 1.0 / (1.0 + etap0);
499 NekDouble overeta1 = 1.0 / (1.0 + etap1);
514 for(i = 0; i < nquad0; ++i)
520 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
524 for(i = 0; i < nquad1; ++i)
526 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
527 m_dGL_xi2[n][i] += dLpp1[i];
528 m_dGL_xi2[n][i] *= overeta1;
529 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
530 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
534 for(i = 0; i < nquad0; ++i)
536 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
537 m_dGR_xi1[n][i] += dLpp0[i];
538 m_dGR_xi1[n][i] *= overeta0;
539 m_dGR_xi1[n][i] += dLp0[i];
540 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
544 for(i = 0; i < nquad1; ++i)
546 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
547 m_dGR_xi2[n][i] += dLpp1[i];
548 m_dGR_xi2[n][i] *= overeta1;
549 m_dGR_xi2[n][i] += dLp1[i];
550 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
564 for (n = 0; n < nElements; ++n)
566 base = pFields[0]->GetExp(n)->GetBase();
567 nquad0 = base[0]->GetNumPoints();
568 nquad1 = base[1]->GetNumPoints();
569 nquad2 = base[2]->GetNumPoints();
570 nmodes0 = base[0]->GetNumModes();
571 nmodes1 = base[1]->GetNumModes();
572 nmodes2 = base[2]->GetNumModes();
581 base[0]->GetZW(z0, w0);
582 base[1]->GetZW(z1, w1);
583 base[1]->GetZW(z2, w2);
605 int p0 = nmodes0 - 1;
606 int p1 = nmodes1 - 1;
607 int p2 = nmodes2 - 1;
614 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
616 * boost::math::tgamma(p0 + 1)
617 * boost::math::tgamma(p0 + 1));
620 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
622 * boost::math::tgamma(p1 + 1)
623 * boost::math::tgamma(p1 + 1));
626 NekDouble ap2 = boost::math::tgamma(2 * p2 + 1)
628 * boost::math::tgamma(p2 + 1)
629 * boost::math::tgamma(p2 + 1));
640 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
641 * (ap0 * boost::math::tgamma(p0 + 1))
642 * (ap0 * boost::math::tgamma(p0 + 1)));
644 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
645 * (ap1 * boost::math::tgamma(p1 + 1))
646 * (ap1 * boost::math::tgamma(p1 + 1)));
648 c2 = 2.0 * p2 / ((2.0 * p2 + 1.0) * (p2 + 1.0)
649 * (ap2 * boost::math::tgamma(p2 + 1))
650 * (ap2 * boost::math::tgamma(p2 + 1)));
654 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
655 * (ap0 * boost::math::tgamma(p0 + 1))
656 * (ap0 * boost::math::tgamma(p0 + 1)));
658 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
659 * (ap1 * boost::math::tgamma(p1 + 1))
660 * (ap1 * boost::math::tgamma(p1 + 1)));
662 c2 = 2.0 * (p2 + 1.0) / ((2.0 * p2 + 1.0) * p2
663 * (ap2 * boost::math::tgamma(p2 + 1))
664 * (ap2 * boost::math::tgamma(p2 + 1)));
668 c0 = -2.0 / ((2.0 * p0 + 1.0)
669 * (ap0 * boost::math::tgamma(p0 + 1))
670 * (ap0 * boost::math::tgamma(p0 + 1)));
672 c1 = -2.0 / ((2.0 * p1 + 1.0)
673 * (ap1 * boost::math::tgamma(p1 + 1))
674 * (ap1 * boost::math::tgamma(p1 + 1)));
676 c2 = -2.0 / ((2.0 * p2 + 1.0)
677 * (ap2 * boost::math::tgamma(p2 + 1))
678 * (ap2 * boost::math::tgamma(p2 + 1)));
682 c0 = 10000000000000000.0;
683 c1 = 10000000000000000.0;
684 c2 = 10000000000000000.0;
687 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
688 * (ap0 * boost::math::tgamma(p0 + 1))
689 * (ap0 * boost::math::tgamma(p0 + 1));
691 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
692 * (ap1 * boost::math::tgamma(p1 + 1))
693 * (ap1 * boost::math::tgamma(p1 + 1));
695 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0)
696 * (ap2 * boost::math::tgamma(p2 + 1))
697 * (ap2 * boost::math::tgamma(p2 + 1));
699 NekDouble overeta0 = 1.0 / (1.0 + etap0);
700 NekDouble overeta1 = 1.0 / (1.0 + etap1);
701 NekDouble overeta2 = 1.0 / (1.0 + etap2);
720 for(i = 0; i < nquad0; ++i)
726 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
730 for(i = 0; i < nquad1; ++i)
732 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
733 m_dGL_xi2[n][i] += dLpp1[i];
734 m_dGL_xi2[n][i] *= overeta1;
735 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
736 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
740 for(i = 0; i < nquad2; ++i)
742 m_dGL_xi3[n][i] = etap2 * dLpm2[i];
743 m_dGL_xi3[n][i] += dLpp2[i];
744 m_dGL_xi3[n][i] *= overeta2;
745 m_dGL_xi3[n][i] = dLp2[i] - m_dGL_xi3[n][i];
746 m_dGL_xi3[n][i] = 0.5 * sign1 * m_dGL_xi3[n][i];
750 for(i = 0; i < nquad0; ++i)
752 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
753 m_dGR_xi1[n][i] += dLpp0[i];
754 m_dGR_xi1[n][i] *= overeta0;
755 m_dGR_xi1[n][i] += dLp0[i];
756 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
760 for(i = 0; i < nquad1; ++i)
762 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
763 m_dGR_xi2[n][i] += dLpp1[i];
764 m_dGR_xi2[n][i] *= overeta1;
765 m_dGR_xi2[n][i] += dLp1[i];
766 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
770 for(i = 0; i < nquad2; ++i)
772 m_dGR_xi3[n][i] = etap2 * dLpm2[i];
773 m_dGR_xi3[n][i] += dLpp2[i];
774 m_dGR_xi3[n][i] *= overeta2;
775 m_dGR_xi3[n][i] += dLp2[i];
776 m_dGR_xi3[n][i] = 0.5 * m_dGR_xi3[n][i];
783 ASSERTL0(
false,
"Expansion dimension not recognised");
802 const int nConvectiveFields,
817 Basis = fields[0]->GetExp(0)->GetBase();
819 int nElements = fields[0]->GetExpSize();
820 int nDimensions = fields[0]->GetCoordim(0);
821 int nSolutionPts = fields[0]->GetTotPoints();
822 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
823 int nCoeffs = fields[0]->GetNcoeffs();
837 for (i = 0; i < nConvectiveFields; ++i)
848 for (i = 0; i < nConvectiveFields; ++i)
854 fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
873 for(i = 0; i < nConvectiveFields; ++i)
875 for (n = 0; n < nElements; n++)
877 phys_offset = fields[0]->GetPhys_Offset(n);
879 fields[i]->GetExp(n)->PhysDeriv(
880 0, fluxvector[i][0] + phys_offset,
881 auxArray2 = DfluxvectorX1 + phys_offset);
886 fluxvector[i][0], numflux[i], divFC);
894 &DfluxvectorX1[0], 1, &outarray[i][0], 1);
897 if (!(Basis[0]->Collocation()))
899 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
900 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
916 for (i = 0; i < nConvectiveFields; ++i)
924 &fluxvector[i][0][0], 1,
926 &fluxvector[i][1][0], 1,
934 &fluxvector[i][0][0], 1,
936 &fluxvector[i][1][0], 1,
943 for (n = 0; n < nElements; n++)
945 phys_offset = fields[0]->GetPhys_Offset(n);
946 fields[0]->GetExp(n)->StdPhysDeriv(0,
947 auxArray1 = f_hat + phys_offset,
948 auxArray2 = DfluxvectorX1 + phys_offset);
949 fields[0]->GetExp(n)->StdPhysDeriv(1,
950 auxArray1 = g_hat + phys_offset,
951 auxArray2 = DfluxvectorX2 + phys_offset);
956 DfluxvectorX2, 1, divFD, 1);
959 if (Basis[0]->GetPointsType() ==
961 Basis[1]->GetPointsType() ==
965 nConvectiveFields, fields, f_hat, g_hat,
971 nConvectiveFields, fields,
972 fluxvector[i][0], fluxvector[i][1],
983 &
m_jac[0], 1, &outarray[i][0], 1);
986 if (!(Basis[0]->Collocation()))
988 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
989 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
997 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1014 const int nConvectiveFields,
1021 int nLocalSolutionPts, phys_offset, t_offset;
1024 Basis = fields[0]->GetExp(0)->GetBasis(0);
1026 int nElements = fields[0]->GetExpSize();
1027 int nSolutionPts = fields[0]->GetTotPoints();
1041 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1043 for (n = 0; n < nElements; ++n)
1045 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1046 phys_offset = fields[0]->GetPhys_Offset(n);
1051 &fluxX1[phys_offset], 1,
1054 fields[0]->GetExp(n)->GetVertexPhysVals(0, tmparrayX1,
1057 t_offset = fields[0]->GetTrace()
1058 ->GetPhys_Offset(elmtToTrace[n][0]->GetElmtId());
1060 if(negatedFluxNormal[2*n])
1062 JumpL[n] = numericalFlux[t_offset] - tmpFluxVertex;
1066 JumpL[n] = -numericalFlux[t_offset] - tmpFluxVertex;
1069 fields[0]->GetExp(n)->GetVertexPhysVals(1, tmparrayX1,
1072 t_offset = fields[0]->GetTrace()
1073 ->GetPhys_Offset(elmtToTrace[n][1]->GetElmtId());
1075 if(negatedFluxNormal[2*n+1])
1077 JumpR[n] = -numericalFlux[t_offset] - tmpFluxVertex;
1081 JumpR[n] = numericalFlux[t_offset] - tmpFluxVertex;
1085 for (n = 0; n < nElements; ++n)
1087 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1088 phys_offset = fields[0]->GetPhys_Offset(n);
1099 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1100 &divCFlux[phys_offset], 1);
1117 const int nConvectiveFields,
1124 int n, e, i, j, cnt;
1126 int nElements = fields[0]->GetExpSize();
1128 int nLocalSolutionPts, nEdgePts;
1129 int trace_offset, phys_offset;
1136 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1139 for(n = 0; n < nElements; ++n)
1142 phys_offset = fields[0]->GetPhys_Offset(n);
1143 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1145 base = fields[0]->GetExp(n)->GetBase();
1146 nquad0 = base[0]->GetNumPoints();
1147 nquad1 = base[1]->GetNumPoints();
1155 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1158 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1167 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1168 elmtToTrace[n][e]->GetElmtId());
1172 fields[0]->GetExp(n)->GetEdgeNormal(e);
1176 fields[0]->GetExp(n)->GetEdgePhysVals(
1177 e, elmtToTrace[n][e],
1178 fluxX1 + phys_offset,
1179 auxArray1 = tmparrayX1);
1183 fields[0]->GetExp(n)->GetEdgePhysVals(
1184 e, elmtToTrace[n][e],
1185 fluxX2 + phys_offset,
1186 auxArray1 = tmparrayX2);
1196 Vmath::Vsub(nEdgePts, &numericalFlux[trace_offset], 1,
1197 &fluxN[0], 1, &fluxJumps[0], 1);
1200 if (fields[0]->GetExp(n)->GetEorient(e) ==
1207 NekDouble fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1210 for (i = 0; i < nEdgePts; ++i)
1215 fluxJumps[i] = -fluxJumps[i];
1223 for (i = 0; i < nquad0; ++i)
1226 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
1228 for (j = 0; j < nquad1; ++j)
1231 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1236 for (i = 0; i < nquad1; ++i)
1239 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
1241 for (j = 0; j < nquad0; ++j)
1243 cnt = (nquad0)*i + j;
1244 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1249 for (i = 0; i < nquad0; ++i)
1252 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
1254 for (j = 0; j < nquad1; ++j)
1256 cnt = (nquad0 - 1) + j*nquad0 - i;
1257 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1262 for (i = 0; i < nquad1; ++i)
1265 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
1266 for (j = 0; j < nquad0; ++j)
1268 cnt = (nquad0*nquad1 - nquad0) + j - i*nquad0;
1269 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1274 ASSERTL0(
false,
"edge value (< 3) is out of range");
1281 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
1283 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1284 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1286 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1287 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
1306 const int nConvectiveFields,
1313 int n, e, i, j, cnt;
1315 int nElements = fields[0]->GetExpSize();
1316 int nLocalSolutionPts;
1329 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1332 for(n = 0; n < nElements; ++n)
1335 phys_offset = fields[0]->GetPhys_Offset(n);
1336 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1338 base = fields[0]->GetExp(n)->GetBase();
1339 nquad0 = base[0]->GetNumPoints();
1340 nquad1 = base[1]->GetNumPoints();
1348 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1351 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1360 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1361 elmtToTrace[n][e]->GetElmtId());
1365 fields[0]->GetExp(n)->GetEdgeNormal(e);
1374 fields[0]->GetExp(n)->GetEdgePhysVals(
1375 e, elmtToTrace[n][e],
1376 fluxX2 + phys_offset,
1377 auxArray1 = fluxN_D);
1383 &numericalFlux[trace_offset], 1,
1387 if (fields[0]->GetExp(n)->GetEorient(e) ==
1391 auxArray1 = fluxN, 1,
1392 auxArray2 = fluxN, 1);
1395 auxArray1 = fluxN_D, 1,
1396 auxArray2 = fluxN_D, 1);
1400 for (i = 0; i < nquad0; ++i)
1403 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
1406 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1409 for (i = 0; i < nEdgePts; ++i)
1412 != fac*normals[0][i] ||
1414 != fac*normals[1][i])
1416 fluxN_R[i] = -fluxN_R[i];
1424 &fluxN_D[0], 1, &fluxJumps[0], 1);
1428 for (i = 0; i < nquad0; ++i)
1430 for (j = 0; j < nquad1; ++j)
1442 fields[0]->GetExp(n)->GetEdgePhysVals(
1443 e, elmtToTrace[n][e],
1444 fluxX1 + phys_offset,
1445 auxArray1 = fluxN_D);
1449 &numericalFlux[trace_offset], 1,
1453 if (fields[0]->GetExp(n)->GetEorient(e) ==
1457 auxArray1 = fluxN, 1,
1458 auxArray2 = fluxN, 1);
1461 auxArray1 = fluxN_D, 1,
1462 auxArray2 = fluxN_D, 1);
1466 for (i = 0; i < nquad1; ++i)
1469 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
1472 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1475 for (i = 0; i < nEdgePts; ++i)
1478 != fac*normals[0][i] ||
1480 != fac*normals[1][i])
1482 fluxN_R[i] = -fluxN_R[i];
1490 &fluxN_D[0], 1, &fluxJumps[0], 1);
1494 for (i = 0; i < nquad1; ++i)
1496 for (j = 0; j < nquad0; ++j)
1498 cnt = (nquad0)*i + j;
1510 fields[0]->GetExp(n)->GetEdgePhysVals(
1511 e, elmtToTrace[n][e],
1512 fluxX2 + phys_offset,
1513 auxArray1 = fluxN_D);
1517 &numericalFlux[trace_offset], 1,
1521 if (fields[0]->GetExp(n)->GetEorient(e) ==
1525 auxArray1 = fluxN, 1,
1526 auxArray2 = fluxN, 1);
1529 auxArray1 = fluxN_D, 1,
1530 auxArray2 = fluxN_D, 1);
1534 for (i = 0; i < nquad0; ++i)
1537 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
1540 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1543 for (i = 0; i < nEdgePts; ++i)
1546 != fac*normals[0][i] ||
1548 != fac*normals[1][i])
1550 fluxN_R[i] = -fluxN_R[i];
1559 &fluxN_D[0], 1, &fluxJumps[0], 1);
1563 for (i = 0; i < nquad0; ++i)
1565 for (j = 0; j < nquad1; ++j)
1567 cnt = (nquad0 - 1) + j*nquad0 - i;
1578 fields[0]->GetExp(n)->GetEdgePhysVals(
1579 e, elmtToTrace[n][e],
1580 fluxX1 + phys_offset,
1581 auxArray1 = fluxN_D);
1586 &numericalFlux[trace_offset], 1,
1590 if (fields[0]->GetExp(n)->GetEorient(e) ==
1594 auxArray1 = fluxN, 1,
1595 auxArray2 = fluxN, 1);
1598 auxArray1 = fluxN_D, 1,
1599 auxArray2 = fluxN_D, 1);
1603 for (i = 0; i < nquad1; ++i)
1606 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
1609 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1612 for (i = 0; i < nEdgePts; ++i)
1615 != fac*normals[0][i] ||
1617 != fac*normals[1][i])
1619 fluxN_R[i] = -fluxN_R[i];
1628 &fluxN_D[0], 1, &fluxJumps[0], 1);
1632 for (i = 0; i < nquad1; ++i)
1634 for (j = 0; j < nquad0; ++j)
1636 cnt = (nquad0*nquad1 - nquad0) + j
1644 ASSERTL0(
false,
"edge value (< 3) is out of range");
1652 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
1654 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1655 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1657 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1658 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
1677 const int nConvectiveFields,
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e1
#define ASSERTL0(condition, msg)
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi1
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi3
std::vector< PointsKey > PointsKeyVector
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi1
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi3
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e0
Array< OneD, Array< OneD, NekDouble > > m_gmat
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi2
RiemannSolverSharedPtr m_riemann
Riemann solver for DG-type schemes.
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e3
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.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
1D Gauss-Gauss-Legendre quadrature points
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e2
void Reverse(int n, const T *x, const int incx, T *y, const int incy)
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
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.
This class is the abstraction of a global discontinuous two- dimensional spectral/hp element expansio...
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
void Neg(int n, T *x, const int incx)
Negate x = -x.
virtual void v_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.
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".
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.
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi2
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.
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)
Compute the advection term at each time-step using the Flux Reconstruction approach (FR)...
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):
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...
const boost::shared_ptr< SpatialDomains::GeomFactors > & GetMetricInfo(void) const
virtual void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initiliase AdvectionFR objects and store them before starting the time-stepping.
virtual void v_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_traceNormals
AdvectionFluxVecCB m_fluxVector
Callback function to the flux vector (set when advection is in conservative form).
boost::shared_ptr< Basis > BasisSharedPtr
int m_spaceDim
Storage for space dimension. Used for homogeneous extension.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Geometry is curved or has non-constant factors.
Array< OneD, NekDouble > m_jac
virtual SOLVER_UTILS_EXPORT void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.
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 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.
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–7...
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.