35 #include <boost/core/ignore_unused.hpp> 45 #include <boost/math/special_functions/gamma.hpp> 58 std::string AdvectionFR::type[] = {
60 "FRDG", AdvectionFR::create),
62 "FRSD", AdvectionFR::create),
64 "FRHU", AdvectionFR::create),
66 "FRcmin", AdvectionFR::create),
68 "FRcinf", AdvectionFR::create)};
78 AdvectionFR::AdvectionFR(std::string advType):m_advType(advType)
121 boost::ignore_unused(pSession);
125 int nLocalSolutionPts;
126 int nElements = pFields[0]->GetExpSize();
127 int nDimensions = pFields[0]->GetCoordim(0);
128 int nSolutionPts = pFields[0]->GetTotPoints();
129 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
144 for (n = 0; n < nElements; ++n)
146 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
147 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
148 phys_offset = pFields[0]->GetPhys_Offset(n);
149 jac = pFields[0]->GetExp(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)->GetEdgeQFactors(
187 0, auxArray1 = m_Q2D_e0[n]);
188 pFields[0]->GetExp(n)->GetEdgeQFactors(
189 1, auxArray1 = m_Q2D_e1[n]);
190 pFields[0]->GetExp(n)->GetEdgeQFactors(
191 2, auxArray1 = m_Q2D_e2[n]);
192 pFields[0]->GetExp(n)->GetEdgeQFactors(
193 3, auxArray1 = m_Q2D_e3[n]);
195 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
196 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
197 phys_offset = pFields[0]->GetPhys_Offset(n);
199 jac = pFields[0]->GetExp(n)
202 gmat = pFields[0]->GetExp(n)
206 if (pFields[0]->GetExp(n)
207 ->as<LocalRegions::Expansion2D>()->GetGeom2D()
208 ->GetMetricInfo()->GetGtype()
211 for (i = 0; i < nLocalSolutionPts; ++i)
213 m_jac[i+phys_offset] = jac[i];
214 m_gmat[0][i+phys_offset] = gmat[0][i];
215 m_gmat[1][i+phys_offset] = gmat[1][i];
216 m_gmat[2][i+phys_offset] = gmat[2][i];
217 m_gmat[3][i+phys_offset] = gmat[3][i];
222 for (i = 0; i < nLocalSolutionPts; ++i)
224 m_jac[i+phys_offset] = jac[0];
225 m_gmat[0][i+phys_offset] = gmat[0][0];
226 m_gmat[1][i+phys_offset] = gmat[1][0];
227 m_gmat[2][i+phys_offset] = gmat[2][0];
228 m_gmat[3][i+phys_offset] = gmat[3][0];
235 for(i = 0; i < nDimensions; ++i)
245 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
250 ASSERTL0(
false,
"Expansion dimension not recognised");
276 boost::ignore_unused(pSession);
282 int nquad0, nquad1, nquad2;
283 int nmodes0, nmodes1, nmodes2;
286 int nElements = pFields[0]->GetExpSize();
287 int nDimensions = pFields[0]->GetCoordim(0);
296 for (n = 0; n < nElements; ++n)
298 base = pFields[0]->GetExp(n)->GetBase();
299 nquad0 = base[0]->GetNumPoints();
300 nmodes0 = base[0]->GetNumModes();
304 base[0]->GetZW(z0, w0);
316 int p0 = nmodes0 - 1;
322 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
324 * boost::math::tgamma(p0 + 1)
325 * boost::math::tgamma(p0 + 1));
334 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
335 * (ap0 * boost::math::tgamma(p0 + 1))
336 * (ap0 * boost::math::tgamma(p0 + 1)));
340 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
341 * (ap0 * boost::math::tgamma(p0 + 1))
342 * (ap0 * boost::math::tgamma(p0 + 1)));
346 c0 = -2.0 / ((2.0 * p0 + 1.0)
347 * (ap0 * boost::math::tgamma(p0 + 1))
348 * (ap0 * boost::math::tgamma(p0 + 1)));
352 c0 = 10000000000000000.0;
355 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
356 * (ap0 * boost::math::tgamma(p0 + 1))
357 * (ap0 * boost::math::tgamma(p0 + 1));
359 NekDouble overeta0 = 1.0 / (1.0 + etap0);
370 for(i = 0; i < nquad0; ++i)
376 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
380 for(i = 0; i < nquad0; ++i)
382 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
383 m_dGR_xi1[n][i] += dLpp0[i];
384 m_dGR_xi1[n][i] *= overeta0;
385 m_dGR_xi1[n][i] += dLp0[i];
386 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
403 for (n = 0; n < nElements; ++n)
405 base = pFields[0]->GetExp(n)->GetBase();
406 nquad0 = base[0]->GetNumPoints();
407 nquad1 = base[1]->GetNumPoints();
408 nmodes0 = base[0]->GetNumModes();
409 nmodes1 = base[1]->GetNumModes();
416 base[0]->GetZW(z0, w0);
417 base[1]->GetZW(z1, w1);
434 int p0 = nmodes0 - 1;
435 int p1 = nmodes1 - 1;
442 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
444 * boost::math::tgamma(p0 + 1)
445 * boost::math::tgamma(p0 + 1));
447 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
449 * boost::math::tgamma(p1 + 1)
450 * boost::math::tgamma(p1 + 1));
460 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
461 * (ap0 * boost::math::tgamma(p0 + 1))
462 * (ap0 * boost::math::tgamma(p0 + 1)));
464 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
465 * (ap1 * boost::math::tgamma(p1 + 1))
466 * (ap1 * boost::math::tgamma(p1 + 1)));
470 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
471 * (ap0 * boost::math::tgamma(p0 + 1))
472 * (ap0 * boost::math::tgamma(p0 + 1)));
474 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
475 * (ap1 * boost::math::tgamma(p1 + 1))
476 * (ap1 * boost::math::tgamma(p1 + 1)));
480 c0 = -2.0 / ((2.0 * p0 + 1.0)
481 * (ap0 * boost::math::tgamma(p0 + 1))
482 * (ap0 * boost::math::tgamma(p0 + 1)));
484 c1 = -2.0 / ((2.0 * p1 + 1.0)
485 * (ap1 * boost::math::tgamma(p1 + 1))
486 * (ap1 * boost::math::tgamma(p1 + 1)));
490 c0 = 10000000000000000.0;
491 c1 = 10000000000000000.0;
494 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
495 * (ap0 * boost::math::tgamma(p0 + 1))
496 * (ap0 * boost::math::tgamma(p0 + 1));
498 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
499 * (ap1 * boost::math::tgamma(p1 + 1))
500 * (ap1 * boost::math::tgamma(p1 + 1));
502 NekDouble overeta0 = 1.0 / (1.0 + etap0);
503 NekDouble overeta1 = 1.0 / (1.0 + etap1);
518 for(i = 0; i < nquad0; ++i)
524 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
528 for(i = 0; i < nquad1; ++i)
530 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
531 m_dGL_xi2[n][i] += dLpp1[i];
532 m_dGL_xi2[n][i] *= overeta1;
533 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
534 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
538 for(i = 0; i < nquad0; ++i)
540 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
541 m_dGR_xi1[n][i] += dLpp0[i];
542 m_dGR_xi1[n][i] *= overeta0;
543 m_dGR_xi1[n][i] += dLp0[i];
544 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
548 for(i = 0; i < nquad1; ++i)
550 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
551 m_dGR_xi2[n][i] += dLpp1[i];
552 m_dGR_xi2[n][i] *= overeta1;
553 m_dGR_xi2[n][i] += dLp1[i];
554 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
568 for (n = 0; n < nElements; ++n)
570 base = pFields[0]->GetExp(n)->GetBase();
571 nquad0 = base[0]->GetNumPoints();
572 nquad1 = base[1]->GetNumPoints();
573 nquad2 = base[2]->GetNumPoints();
574 nmodes0 = base[0]->GetNumModes();
575 nmodes1 = base[1]->GetNumModes();
576 nmodes2 = base[2]->GetNumModes();
585 base[0]->GetZW(z0, w0);
586 base[1]->GetZW(z1, w1);
587 base[1]->GetZW(z2, w2);
609 int p0 = nmodes0 - 1;
610 int p1 = nmodes1 - 1;
611 int p2 = nmodes2 - 1;
618 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
620 * boost::math::tgamma(p0 + 1)
621 * boost::math::tgamma(p0 + 1));
624 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
626 * boost::math::tgamma(p1 + 1)
627 * boost::math::tgamma(p1 + 1));
630 NekDouble ap2 = boost::math::tgamma(2 * p2 + 1)
632 * boost::math::tgamma(p2 + 1)
633 * boost::math::tgamma(p2 + 1));
644 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
645 * (ap0 * boost::math::tgamma(p0 + 1))
646 * (ap0 * boost::math::tgamma(p0 + 1)));
648 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
649 * (ap1 * boost::math::tgamma(p1 + 1))
650 * (ap1 * boost::math::tgamma(p1 + 1)));
652 c2 = 2.0 * p2 / ((2.0 * p2 + 1.0) * (p2 + 1.0)
653 * (ap2 * boost::math::tgamma(p2 + 1))
654 * (ap2 * boost::math::tgamma(p2 + 1)));
658 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
659 * (ap0 * boost::math::tgamma(p0 + 1))
660 * (ap0 * boost::math::tgamma(p0 + 1)));
662 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
663 * (ap1 * boost::math::tgamma(p1 + 1))
664 * (ap1 * boost::math::tgamma(p1 + 1)));
666 c2 = 2.0 * (p2 + 1.0) / ((2.0 * p2 + 1.0) * p2
667 * (ap2 * boost::math::tgamma(p2 + 1))
668 * (ap2 * boost::math::tgamma(p2 + 1)));
672 c0 = -2.0 / ((2.0 * p0 + 1.0)
673 * (ap0 * boost::math::tgamma(p0 + 1))
674 * (ap0 * boost::math::tgamma(p0 + 1)));
676 c1 = -2.0 / ((2.0 * p1 + 1.0)
677 * (ap1 * boost::math::tgamma(p1 + 1))
678 * (ap1 * boost::math::tgamma(p1 + 1)));
680 c2 = -2.0 / ((2.0 * p2 + 1.0)
681 * (ap2 * boost::math::tgamma(p2 + 1))
682 * (ap2 * boost::math::tgamma(p2 + 1)));
686 c0 = 10000000000000000.0;
687 c1 = 10000000000000000.0;
688 c2 = 10000000000000000.0;
691 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
692 * (ap0 * boost::math::tgamma(p0 + 1))
693 * (ap0 * boost::math::tgamma(p0 + 1));
695 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
696 * (ap1 * boost::math::tgamma(p1 + 1))
697 * (ap1 * boost::math::tgamma(p1 + 1));
699 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0)
700 * (ap2 * boost::math::tgamma(p2 + 1))
701 * (ap2 * boost::math::tgamma(p2 + 1));
703 NekDouble overeta0 = 1.0 / (1.0 + etap0);
704 NekDouble overeta1 = 1.0 / (1.0 + etap1);
705 NekDouble overeta2 = 1.0 / (1.0 + etap2);
724 for(i = 0; i < nquad0; ++i)
730 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
734 for(i = 0; i < nquad1; ++i)
736 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
737 m_dGL_xi2[n][i] += dLpp1[i];
738 m_dGL_xi2[n][i] *= overeta1;
739 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
740 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
744 for(i = 0; i < nquad2; ++i)
746 m_dGL_xi3[n][i] = etap2 * dLpm2[i];
747 m_dGL_xi3[n][i] += dLpp2[i];
748 m_dGL_xi3[n][i] *= overeta2;
749 m_dGL_xi3[n][i] = dLp2[i] - m_dGL_xi3[n][i];
750 m_dGL_xi3[n][i] = 0.5 * sign1 * m_dGL_xi3[n][i];
754 for(i = 0; i < nquad0; ++i)
756 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
757 m_dGR_xi1[n][i] += dLpp0[i];
758 m_dGR_xi1[n][i] *= overeta0;
759 m_dGR_xi1[n][i] += dLp0[i];
760 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
764 for(i = 0; i < nquad1; ++i)
766 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
767 m_dGR_xi2[n][i] += dLpp1[i];
768 m_dGR_xi2[n][i] *= overeta1;
769 m_dGR_xi2[n][i] += dLp1[i];
770 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
774 for(i = 0; i < nquad2; ++i)
776 m_dGR_xi3[n][i] = etap2 * dLpm2[i];
777 m_dGR_xi3[n][i] += dLpp2[i];
778 m_dGR_xi3[n][i] *= overeta2;
779 m_dGR_xi3[n][i] += dLp2[i];
780 m_dGR_xi3[n][i] = 0.5 * m_dGR_xi3[n][i];
787 ASSERTL0(
false,
"Expansion dimension not recognised");
806 const int nConvectiveFields,
815 boost::ignore_unused(advVel, time, pFwd, pBwd);
823 Basis = fields[0]->GetExp(0)->GetBase();
825 int nElements = fields[0]->GetExpSize();
826 int nDimensions = fields[0]->GetCoordim(0);
827 int nSolutionPts = fields[0]->GetTotPoints();
828 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
829 int nCoeffs = fields[0]->GetNcoeffs();
843 for (i = 0; i < nConvectiveFields; ++i)
854 for (i = 0; i < nConvectiveFields; ++i)
860 fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
879 for(i = 0; i < nConvectiveFields; ++i)
881 for (n = 0; n < nElements; n++)
883 phys_offset = fields[0]->GetPhys_Offset(n);
885 fields[i]->GetExp(n)->PhysDeriv(
886 0, fluxvector[i][0] + phys_offset,
887 auxArray2 = DfluxvectorX1 + phys_offset);
892 fluxvector[i][0], numflux[i], divFC);
900 &DfluxvectorX1[0], 1, &outarray[i][0], 1);
903 if (!(Basis[0]->Collocation()))
905 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
906 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
922 for (i = 0; i < nConvectiveFields; ++i)
930 &fluxvector[i][0][0], 1,
932 &fluxvector[i][1][0], 1,
940 &fluxvector[i][0][0], 1,
942 &fluxvector[i][1][0], 1,
949 for (n = 0; n < nElements; n++)
951 phys_offset = fields[0]->GetPhys_Offset(n);
952 fields[0]->GetExp(n)->StdPhysDeriv(0,
953 auxArray1 = f_hat + phys_offset,
954 auxArray2 = DfluxvectorX1 + phys_offset);
955 fields[0]->GetExp(n)->StdPhysDeriv(1,
956 auxArray1 = g_hat + phys_offset,
957 auxArray2 = DfluxvectorX2 + phys_offset);
962 DfluxvectorX2, 1, divFD, 1);
965 if (Basis[0]->GetPointsType() ==
967 Basis[1]->GetPointsType() ==
971 nConvectiveFields, fields, f_hat, g_hat,
977 nConvectiveFields, fields,
978 fluxvector[i][0], fluxvector[i][1],
989 &
m_jac[0], 1, &outarray[i][0], 1);
992 if (!(Basis[0]->Collocation()))
994 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
995 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1003 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1020 const int nConvectiveFields,
1026 boost::ignore_unused(nConvectiveFields);
1029 int nLocalSolutionPts, phys_offset, t_offset;
1032 Basis = fields[0]->GetExp(0)->GetBasis(0);
1034 int nElements = fields[0]->GetExpSize();
1035 int nSolutionPts = fields[0]->GetTotPoints();
1038 vector<bool> negatedFluxNormal =
1040 fields[0])->GetNegatedFluxNormal();
1051 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1053 for (n = 0; n < nElements; ++n)
1055 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1056 phys_offset = fields[0]->GetPhys_Offset(n);
1061 &fluxX1[phys_offset], 1,
1064 fields[0]->GetExp(n)->GetVertexPhysVals(0, tmparrayX1,
1067 t_offset = fields[0]->GetTrace()
1068 ->GetPhys_Offset(elmtToTrace[n][0]->GetElmtId());
1070 if(negatedFluxNormal[2*n])
1072 JumpL[n] = numericalFlux[t_offset] - tmpFluxVertex;
1076 JumpL[n] = -numericalFlux[t_offset] - tmpFluxVertex;
1079 fields[0]->GetExp(n)->GetVertexPhysVals(1, tmparrayX1,
1082 t_offset = fields[0]->GetTrace()
1083 ->GetPhys_Offset(elmtToTrace[n][1]->GetElmtId());
1085 if(negatedFluxNormal[2*n+1])
1087 JumpR[n] = -numericalFlux[t_offset] - tmpFluxVertex;
1091 JumpR[n] = numericalFlux[t_offset] - tmpFluxVertex;
1095 for (n = 0; n < nElements; ++n)
1097 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1098 phys_offset = fields[0]->GetPhys_Offset(n);
1109 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1110 &divCFlux[phys_offset], 1);
1127 const int nConvectiveFields,
1134 boost::ignore_unused(nConvectiveFields);
1136 int n, e, i, j, cnt;
1138 int nElements = fields[0]->GetExpSize();
1140 int nLocalSolutionPts, nEdgePts;
1141 int trace_offset, phys_offset;
1148 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1151 for(n = 0; n < nElements; ++n)
1154 phys_offset = fields[0]->GetPhys_Offset(n);
1155 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1157 base = fields[0]->GetExp(n)->GetBase();
1158 nquad0 = base[0]->GetNumPoints();
1159 nquad1 = base[1]->GetNumPoints();
1167 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1170 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1179 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1180 elmtToTrace[n][e]->GetElmtId());
1184 fields[0]->GetExp(n)->GetEdgeNormal(e);
1188 fields[0]->GetExp(n)->GetEdgePhysVals(
1189 e, elmtToTrace[n][e],
1190 fluxX1 + phys_offset,
1191 auxArray1 = tmparrayX1);
1195 fields[0]->GetExp(n)->GetEdgePhysVals(
1196 e, elmtToTrace[n][e],
1197 fluxX2 + phys_offset,
1198 auxArray1 = tmparrayX2);
1208 Vmath::Vsub(nEdgePts, &numericalFlux[trace_offset], 1,
1209 &fluxN[0], 1, &fluxJumps[0], 1);
1212 if (fields[0]->GetExp(n)->GetEorient(e) ==
1219 NekDouble fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1222 for (i = 0; i < nEdgePts; ++i)
1227 fluxJumps[i] = -fluxJumps[i];
1235 for (i = 0; i < nquad0; ++i)
1238 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
1240 for (j = 0; j < nquad1; ++j)
1243 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1248 for (i = 0; i < nquad1; ++i)
1251 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
1253 for (j = 0; j < nquad0; ++j)
1255 cnt = (nquad0)*i + j;
1256 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1261 for (i = 0; i < nquad0; ++i)
1264 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
1266 for (j = 0; j < nquad1; ++j)
1269 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1274 for (i = 0; i < nquad1; ++i)
1277 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
1278 for (j = 0; j < nquad0; ++j)
1281 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1286 ASSERTL0(
false,
"edge value (< 3) is out of range");
1293 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
1295 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1296 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1298 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1299 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
1318 const int nConvectiveFields,
1325 boost::ignore_unused(nConvectiveFields);
1327 int n, e, i, j, cnt;
1329 int nElements = fields[0]->GetExpSize();
1330 int nLocalSolutionPts;
1343 &elmtToTrace = 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)->GetNedges(); ++e)
1365 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1374 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1375 elmtToTrace[n][e]->GetElmtId());
1379 fields[0]->GetExp(n)->GetEdgeNormal(e);
1388 fields[0]->GetExp(n)->GetEdgePhysVals(
1389 e, elmtToTrace[n][e],
1390 fluxX2 + phys_offset,
1391 auxArray1 = fluxN_D);
1397 &numericalFlux[trace_offset], 1,
1401 if (fields[0]->GetExp(n)->GetEorient(e) ==
1405 auxArray1 = fluxN, 1,
1406 auxArray2 = fluxN, 1);
1409 auxArray1 = fluxN_D, 1,
1410 auxArray2 = fluxN_D, 1);
1414 for (i = 0; i < nquad0; ++i)
1417 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
1420 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1423 for (i = 0; i < nEdgePts; ++i)
1426 != fac*normals[0][i] ||
1428 != fac*normals[1][i])
1430 fluxN_R[i] = -fluxN_R[i];
1438 &fluxN_D[0], 1, &fluxJumps[0], 1);
1442 for (i = 0; i < nquad0; ++i)
1444 for (j = 0; j < nquad1; ++j)
1456 fields[0]->GetExp(n)->GetEdgePhysVals(
1457 e, elmtToTrace[n][e],
1458 fluxX1 + phys_offset,
1459 auxArray1 = fluxN_D);
1463 &numericalFlux[trace_offset], 1,
1467 if (fields[0]->GetExp(n)->GetEorient(e) ==
1471 auxArray1 = fluxN, 1,
1472 auxArray2 = fluxN, 1);
1475 auxArray1 = fluxN_D, 1,
1476 auxArray2 = fluxN_D, 1);
1480 for (i = 0; i < nquad1; ++i)
1483 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
1486 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1489 for (i = 0; i < nEdgePts; ++i)
1492 != fac*normals[0][i] ||
1494 != fac*normals[1][i])
1496 fluxN_R[i] = -fluxN_R[i];
1504 &fluxN_D[0], 1, &fluxJumps[0], 1);
1508 for (i = 0; i < nquad1; ++i)
1510 for (j = 0; j < nquad0; ++j)
1512 cnt = (nquad0)*i + j;
1524 fields[0]->GetExp(n)->GetEdgePhysVals(
1525 e, elmtToTrace[n][e],
1526 fluxX2 + phys_offset,
1527 auxArray1 = fluxN_D);
1531 &numericalFlux[trace_offset], 1,
1535 if (fields[0]->GetExp(n)->GetEorient(e) ==
1539 auxArray1 = fluxN, 1,
1540 auxArray2 = fluxN, 1);
1543 auxArray1 = fluxN_D, 1,
1544 auxArray2 = fluxN_D, 1);
1548 for (i = 0; i < nquad0; ++i)
1551 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
1554 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1557 for (i = 0; i < nEdgePts; ++i)
1560 != fac*normals[0][i] ||
1562 != fac*normals[1][i])
1564 fluxN_R[i] = -fluxN_R[i];
1573 &fluxN_D[0], 1, &fluxJumps[0], 1);
1577 for (i = 0; i < nquad0; ++i)
1579 for (j = 0; j < nquad1; ++j)
1592 fields[0]->GetExp(n)->GetEdgePhysVals(
1593 e, elmtToTrace[n][e],
1594 fluxX1 + phys_offset,
1595 auxArray1 = fluxN_D);
1600 &numericalFlux[trace_offset], 1,
1604 if (fields[0]->GetExp(n)->GetEorient(e) ==
1608 auxArray1 = fluxN, 1,
1609 auxArray2 = fluxN, 1);
1612 auxArray1 = fluxN_D, 1,
1613 auxArray2 = fluxN_D, 1);
1617 for (i = 0; i < nquad1; ++i)
1620 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
1623 fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1626 for (i = 0; i < nEdgePts; ++i)
1629 != fac*normals[0][i] ||
1631 != fac*normals[1][i])
1633 fluxN_R[i] = -fluxN_R[i];
1642 &fluxN_D[0], 1, &fluxJumps[0], 1);
1646 for (i = 0; i < nquad1; ++i)
1648 for (j = 0; j < nquad0; ++j)
1657 ASSERTL0(
false,
"edge value (< 3) is out of range");
1665 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
1667 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1668 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1670 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1671 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
1690 const int nConvectiveFields,
1698 boost::ignore_unused(nConvectiveFields, fields, fluxX1, fluxX2,
1699 fluxX3, numericalFlux, divCFlux);
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
Represents a basis of a given type.
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.
std::shared_ptr< Basis > BasisSharedPtr
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.
const SpatialDomains::GeomFactorsSharedPtr & GetMetricInfo() const
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...
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
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
AdvectionFluxVecCB m_fluxVector
Callback function to the flux vector (set when advection is in conservative form).
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.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
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...