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,
815 Basis = fields[0]->GetExp(0)->GetBase();
817 int nElements = fields[0]->GetExpSize();
818 int nDimensions = fields[0]->GetCoordim(0);
819 int nSolutionPts = fields[0]->GetTotPoints();
820 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
821 int nCoeffs = fields[0]->GetNcoeffs();
835 for (i = 0; i < nConvectiveFields; ++i)
846 for (i = 0; i < nConvectiveFields; ++i)
852 fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
871 for(i = 0; i < nConvectiveFields; ++i)
873 for (n = 0; n < nElements; n++)
875 phys_offset = fields[0]->GetPhys_Offset(n);
877 fields[i]->GetExp(n)->PhysDeriv(
878 0, fluxvector[i][0] + phys_offset,
879 auxArray2 = DfluxvectorX1 + phys_offset);
884 fluxvector[i][0], numflux[i], divFC);
892 &DfluxvectorX1[0], 1, &outarray[i][0], 1);
895 if (!(Basis[0]->Collocation()))
897 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
898 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
914 for (i = 0; i < nConvectiveFields; ++i)
922 &fluxvector[i][0][0], 1,
924 &fluxvector[i][1][0], 1,
932 &fluxvector[i][0][0], 1,
934 &fluxvector[i][1][0], 1,
941 for (n = 0; n < nElements; n++)
943 phys_offset = fields[0]->GetPhys_Offset(n);
944 fields[0]->GetExp(n)->StdPhysDeriv(0,
945 auxArray1 = f_hat + phys_offset,
946 auxArray2 = DfluxvectorX1 + phys_offset);
947 fields[0]->GetExp(n)->StdPhysDeriv(1,
948 auxArray1 = g_hat + phys_offset,
949 auxArray2 = DfluxvectorX2 + phys_offset);
954 DfluxvectorX2, 1, divFD, 1);
957 if (Basis[0]->GetPointsType() ==
959 Basis[1]->GetPointsType() ==
963 nConvectiveFields, fields, f_hat, g_hat,
969 nConvectiveFields, fields,
970 fluxvector[i][0], fluxvector[i][1],
981 &
m_jac[0], 1, &outarray[i][0], 1);
984 if (!(Basis[0]->Collocation()))
986 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
987 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
995 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1012 const int nConvectiveFields,
1019 int nLocalSolutionPts, phys_offset, t_offset;
1022 Basis = fields[0]->GetExp(0)->GetBasis(0);
1024 int nElements = fields[0]->GetExpSize();
1025 int nSolutionPts = fields[0]->GetTotPoints();
1039 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1041 for (n = 0; n < nElements; ++n)
1043 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1044 phys_offset = fields[0]->GetPhys_Offset(n);
1049 &fluxX1[phys_offset], 1,
1052 fields[0]->GetExp(n)->GetVertexPhysVals(0, tmparrayX1,
1055 t_offset = fields[0]->GetTrace()
1056 ->GetPhys_Offset(elmtToTrace[n][0]->GetElmtId());
1058 if(negatedFluxNormal[2*n])
1060 JumpL[n] = numericalFlux[t_offset] - tmpFluxVertex;
1064 JumpL[n] = -numericalFlux[t_offset] - tmpFluxVertex;
1067 fields[0]->GetExp(n)->GetVertexPhysVals(1, tmparrayX1,
1070 t_offset = fields[0]->GetTrace()
1071 ->GetPhys_Offset(elmtToTrace[n][1]->GetElmtId());
1073 if(negatedFluxNormal[2*n+1])
1075 JumpR[n] = -numericalFlux[t_offset] - tmpFluxVertex;
1079 JumpR[n] = numericalFlux[t_offset] - tmpFluxVertex;
1083 for (n = 0; n < nElements; ++n)
1085 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1086 phys_offset = fields[0]->GetPhys_Offset(n);
1097 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1098 &divCFlux[phys_offset], 1);
1115 const int nConvectiveFields,
1122 int n, e, i, j, cnt;
1124 int nElements = fields[0]->GetExpSize();
1126 int nLocalSolutionPts, nEdgePts;
1127 int trace_offset, phys_offset;
1134 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1137 for(n = 0; n < nElements; ++n)
1140 phys_offset = fields[0]->GetPhys_Offset(n);
1141 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1143 base = fields[0]->GetExp(n)->GetBase();
1144 nquad0 = base[0]->GetNumPoints();
1145 nquad1 = base[1]->GetNumPoints();
1153 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1156 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1165 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1166 elmtToTrace[n][e]->GetElmtId());
1170 fields[0]->GetExp(n)->GetEdgeNormal(e);
1174 fields[0]->GetExp(n)->GetEdgePhysVals(
1175 e, elmtToTrace[n][e],
1176 fluxX1 + phys_offset,
1177 auxArray1 = tmparrayX1);
1181 fields[0]->GetExp(n)->GetEdgePhysVals(
1182 e, elmtToTrace[n][e],
1183 fluxX2 + phys_offset,
1184 auxArray1 = tmparrayX2);
1194 Vmath::Vsub(nEdgePts, &numericalFlux[trace_offset], 1,
1195 &fluxN[0], 1, &fluxJumps[0], 1);
1198 if (fields[0]->GetExp(n)->GetEorient(e) ==
1205 NekDouble fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1208 for (i = 0; i < nEdgePts; ++i)
1213 fluxJumps[i] = -fluxJumps[i];
1221 for (i = 0; i < nquad0; ++i)
1224 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
1226 for (j = 0; j < nquad1; ++j)
1229 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1234 for (i = 0; i < nquad1; ++i)
1237 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
1239 for (j = 0; j < nquad0; ++j)
1241 cnt = (nquad0)*i + j;
1242 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1247 for (i = 0; i < nquad0; ++i)
1250 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
1252 for (j = 0; j < nquad1; ++j)
1254 cnt = (nquad0 - 1) + j*nquad0 - i;
1255 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1260 for (i = 0; i < nquad1; ++i)
1263 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
1264 for (j = 0; j < nquad0; ++j)
1266 cnt = (nquad0*nquad1 - nquad0) + j - i*nquad0;
1267 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1272 ASSERTL0(
false,
"edge value (< 3) is out of range");
1279 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
1281 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1282 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1284 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1285 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
1304 const int nConvectiveFields,
1311 int n, e, i, j, cnt;
1313 int nElements = fields[0]->GetExpSize();
1314 int nLocalSolutionPts;
1327 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1330 for(n = 0; n < nElements; ++n)
1333 phys_offset = fields[0]->GetPhys_Offset(n);
1334 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1336 base = fields[0]->GetExp(n)->GetBase();
1337 nquad0 = base[0]->GetNumPoints();
1338 nquad1 = base[1]->GetNumPoints();
1346 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1349 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1358 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1359 elmtToTrace[n][e]->GetElmtId());
1363 fields[0]->GetExp(n)->GetEdgeNormal(e);
1372 fields[0]->GetExp(n)->GetEdgePhysVals(
1373 e, elmtToTrace[n][e],
1374 fluxX2 + phys_offset,
1375 auxArray1 = fluxN_D);
1381 &numericalFlux[trace_offset], 1,
1385 if (fields[0]->GetExp(n)->GetEorient(e) ==
1389 auxArray1 = fluxN, 1,
1390 auxArray2 = fluxN, 1);
1393 auxArray1 = fluxN_D, 1,
1394 auxArray2 = fluxN_D, 1);
1398 for (i = 0; i < nquad0; ++i)
1401 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
1404 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1407 for (i = 0; i < nEdgePts; ++i)
1410 != fac*normals[0][i] ||
1412 != fac*normals[1][i])
1414 fluxN_R[i] = -fluxN_R[i];
1422 &fluxN_D[0], 1, &fluxJumps[0], 1);
1426 for (i = 0; i < nquad0; ++i)
1428 for (j = 0; j < nquad1; ++j)
1440 fields[0]->GetExp(n)->GetEdgePhysVals(
1441 e, elmtToTrace[n][e],
1442 fluxX1 + phys_offset,
1443 auxArray1 = fluxN_D);
1447 &numericalFlux[trace_offset], 1,
1451 if (fields[0]->GetExp(n)->GetEorient(e) ==
1455 auxArray1 = fluxN, 1,
1456 auxArray2 = fluxN, 1);
1459 auxArray1 = fluxN_D, 1,
1460 auxArray2 = fluxN_D, 1);
1464 for (i = 0; i < nquad1; ++i)
1467 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
1470 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1473 for (i = 0; i < nEdgePts; ++i)
1476 != fac*normals[0][i] ||
1478 != fac*normals[1][i])
1480 fluxN_R[i] = -fluxN_R[i];
1488 &fluxN_D[0], 1, &fluxJumps[0], 1);
1492 for (i = 0; i < nquad1; ++i)
1494 for (j = 0; j < nquad0; ++j)
1496 cnt = (nquad0)*i + j;
1508 fields[0]->GetExp(n)->GetEdgePhysVals(
1509 e, elmtToTrace[n][e],
1510 fluxX2 + phys_offset,
1511 auxArray1 = fluxN_D);
1515 &numericalFlux[trace_offset], 1,
1519 if (fields[0]->GetExp(n)->GetEorient(e) ==
1523 auxArray1 = fluxN, 1,
1524 auxArray2 = fluxN, 1);
1527 auxArray1 = fluxN_D, 1,
1528 auxArray2 = fluxN_D, 1);
1532 for (i = 0; i < nquad0; ++i)
1535 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
1538 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1541 for (i = 0; i < nEdgePts; ++i)
1544 != fac*normals[0][i] ||
1546 != fac*normals[1][i])
1548 fluxN_R[i] = -fluxN_R[i];
1557 &fluxN_D[0], 1, &fluxJumps[0], 1);
1561 for (i = 0; i < nquad0; ++i)
1563 for (j = 0; j < nquad1; ++j)
1565 cnt = (nquad0 - 1) + j*nquad0 - i;
1576 fields[0]->GetExp(n)->GetEdgePhysVals(
1577 e, elmtToTrace[n][e],
1578 fluxX1 + phys_offset,
1579 auxArray1 = fluxN_D);
1584 &numericalFlux[trace_offset], 1,
1588 if (fields[0]->GetExp(n)->GetEorient(e) ==
1592 auxArray1 = fluxN, 1,
1593 auxArray2 = fluxN, 1);
1596 auxArray1 = fluxN_D, 1,
1597 auxArray2 = fluxN_D, 1);
1601 for (i = 0; i < nquad1; ++i)
1604 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
1607 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1610 for (i = 0; i < nEdgePts; ++i)
1613 != fac*normals[0][i] ||
1615 != fac*normals[1][i])
1617 fluxN_R[i] = -fluxN_R[i];
1626 &fluxN_D[0], 1, &fluxJumps[0], 1);
1630 for (i = 0; i < nquad1; ++i)
1632 for (j = 0; j < nquad0; ++j)
1634 cnt = (nquad0*nquad1 - nquad0) + j
1642 ASSERTL0(
false,
"edge value (< 3) is out of range");
1650 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
1652 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1653 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1655 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1656 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
1675 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
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)
Compute the advection term at each time-step using the Flux Reconstruction approach (FR)...
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.
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.