40 #include <boost/core/ignore_unused.hpp> 41 #include <boost/math/special_functions/gamma.hpp> 51 std::string DiffusionLFR::type[] = {
53 "LFRDG", DiffusionLFR::create),
55 "LFRSD", DiffusionLFR::create),
57 "LFRHU", DiffusionLFR::create),
59 "LFRcmin", DiffusionLFR::create),
61 "LFRcinf", DiffusionLFR::create)};
71 DiffusionLFR::DiffusionLFR(std::string diffType):m_diffType(diffType)
95 int nConvectiveFields = pFields.num_elements();
96 int nDim = pFields[0]->GetCoordim(0);
97 int nSolutionPts = pFields[0]->GetTotPoints();
98 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
125 for (i = 0; i < nConvectiveFields; ++i)
141 for (j = 0; j < nDim; ++j)
178 boost::ignore_unused(pSession);
183 int nLocalSolutionPts;
184 int nElements = pFields[0]->GetExpSize();
185 int nDimensions = pFields[0]->GetCoordim(0);
186 int nSolutionPts = pFields[0]->GetTotPoints();
187 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
190 for (i = 0; i < nDimensions; ++i)
209 for (n = 0; n < nElements; ++n)
211 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
212 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
213 phys_offset = pFields[0]->GetPhys_Offset(n);
214 jac = pFields[0]->GetExp(n)
217 for (i = 0; i < nLocalSolutionPts; ++i)
219 m_jac[i+phys_offset] = jac[0];
237 for (n = 0; n < nElements; ++n)
239 base = pFields[0]->GetExp(n)->GetBase();
240 nquad0 = base[0]->GetNumPoints();
241 nquad1 = base[1]->GetNumPoints();
249 pFields[0]->GetExp(n)->GetEdgeQFactors(
250 0, auxArray1 = m_Q2D_e0[n]);
251 pFields[0]->GetExp(n)->GetEdgeQFactors(
252 1, auxArray1 = m_Q2D_e1[n]);
253 pFields[0]->GetExp(n)->GetEdgeQFactors(
254 2, auxArray1 = m_Q2D_e2[n]);
255 pFields[0]->GetExp(n)->GetEdgeQFactors(
256 3, auxArray1 = m_Q2D_e3[n]);
258 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
259 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
260 phys_offset = pFields[0]->GetPhys_Offset(n);
262 jac = pFields[0]->GetExp(n)
265 gmat = pFields[0]->GetExp(n)
269 if (pFields[0]->GetExp(n)
270 ->as<LocalRegions::Expansion2D>()->GetGeom2D()
271 ->GetMetricInfo()->GetGtype()
274 for (i = 0; i < nLocalSolutionPts; ++i)
276 m_jac[i+phys_offset] = jac[i];
277 m_gmat[0][i+phys_offset] = gmat[0][i];
278 m_gmat[1][i+phys_offset] = gmat[1][i];
279 m_gmat[2][i+phys_offset] = gmat[2][i];
280 m_gmat[3][i+phys_offset] = gmat[3][i];
285 for (i = 0; i < nLocalSolutionPts; ++i)
287 m_jac[i+phys_offset] = jac[0];
288 m_gmat[0][i+phys_offset] = gmat[0][0];
289 m_gmat[1][i+phys_offset] = gmat[1][0];
290 m_gmat[2][i+phys_offset] = gmat[2][0];
291 m_gmat[3][i+phys_offset] = gmat[3][0];
299 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
304 ASSERTL0(
false,
"Expansion dimension not recognised");
330 boost::ignore_unused(pSession);
336 int nquad0, nquad1, nquad2;
337 int nmodes0, nmodes1, nmodes2;
340 int nElements = pFields[0]->GetExpSize();
341 int nDim = pFields[0]->GetCoordim(0);
350 for (n = 0; n < nElements; ++n)
352 base = pFields[0]->GetExp(n)->GetBase();
353 nquad0 = base[0]->GetNumPoints();
354 nmodes0 = base[0]->GetNumModes();
358 base[0]->GetZW(z0, w0);
370 int p0 = nmodes0 - 1;
376 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
378 * boost::math::tgamma(p0 + 1)
379 * boost::math::tgamma(p0 + 1));
388 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
389 * (ap0 * boost::math::tgamma(p0 + 1))
390 * (ap0 * boost::math::tgamma(p0 + 1)));
394 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
395 * (ap0 * boost::math::tgamma(p0 + 1))
396 * (ap0 * boost::math::tgamma(p0 + 1)));
400 c0 = -2.0 / ((2.0 * p0 + 1.0)
401 * (ap0 * boost::math::tgamma(p0 + 1))
402 * (ap0 * boost::math::tgamma(p0 + 1)));
406 c0 = 10000000000000000.0;
409 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
410 * (ap0 * boost::math::tgamma(p0 + 1))
411 * (ap0 * boost::math::tgamma(p0 + 1));
413 NekDouble overeta0 = 1.0 / (1.0 + etap0);
424 for(i = 0; i < nquad0; ++i)
430 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
434 for(i = 0; i < nquad0; ++i)
436 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
437 m_dGR_xi1[n][i] += dLpp0[i];
438 m_dGR_xi1[n][i] *= overeta0;
439 m_dGR_xi1[n][i] += dLp0[i];
440 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
457 for (n = 0; n < nElements; ++n)
459 base = pFields[0]->GetExp(n)->GetBase();
460 nquad0 = base[0]->GetNumPoints();
461 nquad1 = base[1]->GetNumPoints();
462 nmodes0 = base[0]->GetNumModes();
463 nmodes1 = base[1]->GetNumModes();
470 base[0]->GetZW(z0, w0);
471 base[1]->GetZW(z1, w1);
488 int p0 = nmodes0 - 1;
489 int p1 = nmodes1 - 1;
496 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
498 * boost::math::tgamma(p0 + 1)
499 * boost::math::tgamma(p0 + 1));
501 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
503 * boost::math::tgamma(p1 + 1)
504 * boost::math::tgamma(p1 + 1));
514 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
515 * (ap0 * boost::math::tgamma(p0 + 1))
516 * (ap0 * boost::math::tgamma(p0 + 1)));
518 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
519 * (ap1 * boost::math::tgamma(p1 + 1))
520 * (ap1 * boost::math::tgamma(p1 + 1)));
524 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
525 * (ap0 * boost::math::tgamma(p0 + 1))
526 * (ap0 * boost::math::tgamma(p0 + 1)));
528 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
529 * (ap1 * boost::math::tgamma(p1 + 1))
530 * (ap1 * boost::math::tgamma(p1 + 1)));
534 c0 = -2.0 / ((2.0 * p0 + 1.0)
535 * (ap0 * boost::math::tgamma(p0 + 1))
536 * (ap0 * boost::math::tgamma(p0 + 1)));
538 c1 = -2.0 / ((2.0 * p1 + 1.0)
539 * (ap1 * boost::math::tgamma(p1 + 1))
540 * (ap1 * boost::math::tgamma(p1 + 1)));
544 c0 = 10000000000000000.0;
545 c1 = 10000000000000000.0;
548 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
549 * (ap0 * boost::math::tgamma(p0 + 1))
550 * (ap0 * boost::math::tgamma(p0 + 1));
552 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
553 * (ap1 * boost::math::tgamma(p1 + 1))
554 * (ap1 * boost::math::tgamma(p1 + 1));
556 NekDouble overeta0 = 1.0 / (1.0 + etap0);
557 NekDouble overeta1 = 1.0 / (1.0 + etap1);
572 for(i = 0; i < nquad0; ++i)
578 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
582 for(i = 0; i < nquad1; ++i)
584 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
585 m_dGL_xi2[n][i] += dLpp1[i];
586 m_dGL_xi2[n][i] *= overeta1;
587 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
588 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
592 for(i = 0; i < nquad0; ++i)
594 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
595 m_dGR_xi1[n][i] += dLpp0[i];
596 m_dGR_xi1[n][i] *= overeta0;
597 m_dGR_xi1[n][i] += dLp0[i];
598 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
602 for(i = 0; i < nquad1; ++i)
604 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
605 m_dGR_xi2[n][i] += dLpp1[i];
606 m_dGR_xi2[n][i] *= overeta1;
607 m_dGR_xi2[n][i] += dLp1[i];
608 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
622 for (n = 0; n < nElements; ++n)
624 base = pFields[0]->GetExp(n)->GetBase();
625 nquad0 = base[0]->GetNumPoints();
626 nquad1 = base[1]->GetNumPoints();
627 nquad2 = base[2]->GetNumPoints();
628 nmodes0 = base[0]->GetNumModes();
629 nmodes1 = base[1]->GetNumModes();
630 nmodes2 = base[2]->GetNumModes();
639 base[0]->GetZW(z0, w0);
640 base[1]->GetZW(z1, w1);
641 base[1]->GetZW(z2, w2);
663 int p0 = nmodes0 - 1;
664 int p1 = nmodes1 - 1;
665 int p2 = nmodes2 - 1;
673 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
675 * boost::math::tgamma(p0 + 1)
676 * boost::math::tgamma(p0 + 1));
679 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
681 * boost::math::tgamma(p1 + 1)
682 * boost::math::tgamma(p1 + 1));
685 NekDouble ap2 = boost::math::tgamma(2 * p2 + 1)
687 * boost::math::tgamma(p2 + 1)
688 * boost::math::tgamma(p2 + 1));
699 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
700 * (ap0 * boost::math::tgamma(p0 + 1))
701 * (ap0 * boost::math::tgamma(p0 + 1)));
703 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
704 * (ap1 * boost::math::tgamma(p1 + 1))
705 * (ap1 * boost::math::tgamma(p1 + 1)));
707 c2 = 2.0 * p2 / ((2.0 * p2 + 1.0) * (p2 + 1.0)
708 * (ap2 * boost::math::tgamma(p2 + 1))
709 * (ap2 * boost::math::tgamma(p2 + 1)));
713 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
714 * (ap0 * boost::math::tgamma(p0 + 1))
715 * (ap0 * boost::math::tgamma(p0 + 1)));
717 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
718 * (ap1 * boost::math::tgamma(p1 + 1))
719 * (ap1 * boost::math::tgamma(p1 + 1)));
721 c2 = 2.0 * (p2 + 1.0) / ((2.0 * p2 + 1.0) * p2
722 * (ap2 * boost::math::tgamma(p2 + 1))
723 * (ap2 * boost::math::tgamma(p2 + 1)));
727 c0 = -2.0 / ((2.0 * p0 + 1.0)
728 * (ap0 * boost::math::tgamma(p0 + 1))
729 * (ap0 * boost::math::tgamma(p0 + 1)));
731 c1 = -2.0 / ((2.0 * p1 + 1.0)
732 * (ap1 * boost::math::tgamma(p1 + 1))
733 * (ap1 * boost::math::tgamma(p1 + 1)));
735 c2 = -2.0 / ((2.0 * p2 + 1.0)
736 * (ap2 * boost::math::tgamma(p2 + 1))
737 * (ap2 * boost::math::tgamma(p2 + 1)));
741 c0 = 10000000000000000.0;
742 c1 = 10000000000000000.0;
743 c2 = 10000000000000000.0;
746 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
747 * (ap0 * boost::math::tgamma(p0 + 1))
748 * (ap0 * boost::math::tgamma(p0 + 1));
750 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
751 * (ap1 * boost::math::tgamma(p1 + 1))
752 * (ap1 * boost::math::tgamma(p1 + 1));
754 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0)
755 * (ap2 * boost::math::tgamma(p2 + 1))
756 * (ap2 * boost::math::tgamma(p2 + 1));
758 NekDouble overeta0 = 1.0 / (1.0 + etap0);
759 NekDouble overeta1 = 1.0 / (1.0 + etap1);
760 NekDouble overeta2 = 1.0 / (1.0 + etap2);
779 for(i = 0; i < nquad0; ++i)
785 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
789 for(i = 0; i < nquad1; ++i)
791 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
792 m_dGL_xi2[n][i] += dLpp1[i];
793 m_dGL_xi2[n][i] *= overeta1;
794 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
795 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
799 for(i = 0; i < nquad2; ++i)
801 m_dGL_xi3[n][i] = etap2 * dLpm2[i];
802 m_dGL_xi3[n][i] += dLpp2[i];
803 m_dGL_xi3[n][i] *= overeta2;
804 m_dGL_xi3[n][i] = dLp2[i] - m_dGL_xi3[n][i];
805 m_dGL_xi3[n][i] = 0.5 * sign2 * m_dGL_xi3[n][i];
809 for(i = 0; i < nquad0; ++i)
811 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
812 m_dGR_xi1[n][i] += dLpp0[i];
813 m_dGR_xi1[n][i] *= overeta0;
814 m_dGR_xi1[n][i] += dLp0[i];
815 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
819 for(i = 0; i < nquad1; ++i)
821 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
822 m_dGR_xi2[n][i] += dLpp1[i];
823 m_dGR_xi2[n][i] *= overeta1;
824 m_dGR_xi2[n][i] += dLp1[i];
825 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
829 for(i = 0; i < nquad2; ++i)
831 m_dGR_xi3[n][i] = etap2 * dLpm2[i];
832 m_dGR_xi3[n][i] += dLpp2[i];
833 m_dGR_xi3[n][i] *= overeta2;
834 m_dGR_xi3[n][i] += dLp2[i];
835 m_dGR_xi3[n][i] = 0.5 * m_dGR_xi3[n][i];
842 ASSERTL0(
false,
"Expansion dimension not recognised");
854 const std::size_t nConvectiveFields,
861 boost::ignore_unused(pFwd, pBwd);
870 Basis = fields[0]->GetExp(0)->GetBase();
872 int nElements = fields[0]->GetExpSize();
873 int nDim = fields[0]->GetCoordim(0);
874 int nSolutionPts = fields[0]->GetTotPoints();
875 int nCoeffs = fields[0]->GetNcoeffs();
878 for (i = 0; i < nConvectiveFields; ++i)
891 for (i = 0; i < nConvectiveFields; ++i)
895 for (n = 0; n < nElements; n++)
897 phys_offset = fields[0]->GetPhys_Offset(n);
899 fields[i]->GetExp(n)->PhysDeriv(0,
900 auxArray1 = inarray[i] + phys_offset,
901 auxArray2 =
m_DU1[i][0] + phys_offset);
927 for (i = 0; i < nConvectiveFields; ++i)
931 for (n = 0; n < nElements; n++)
933 phys_offset = fields[0]->GetPhys_Offset(n);
935 fields[i]->GetExp(n)->PhysDeriv(0,
936 auxArray1 =
m_D1[i][0] + phys_offset,
937 auxArray2 =
m_DD1[i][0] + phys_offset);
953 &
m_DD1[i][0][0], 1, &outarray[i][0], 1);
956 if (!(Basis[0]->Collocation()))
958 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
959 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
967 for(i = 0; i < nConvectiveFields; ++i)
969 for (j = 0; j < nDim; ++j)
978 &
m_gmat[0][0], 1, &u1_hat[0], 1);
981 &
m_jac[0], 1, &u1_hat[0], 1);
984 &
m_gmat[1][0], 1, &u2_hat[0], 1);
987 &
m_jac[0], 1, &u2_hat[0], 1);
992 &
m_gmat[2][0], 1, &u1_hat[0], 1);
995 &
m_jac[0], 1, &u1_hat[0], 1);
998 &
m_gmat[3][0], 1, &u2_hat[0], 1);
1001 &
m_jac[0], 1, &u2_hat[0], 1);
1004 for (n = 0; n < nElements; n++)
1006 phys_offset = fields[0]->GetPhys_Offset(n);
1008 fields[i]->GetExp(n)->StdPhysDeriv(0,
1009 auxArray1 = u1_hat + phys_offset,
1010 auxArray2 =
m_tmp1[i][j] + phys_offset);
1012 fields[i]->GetExp(n)->StdPhysDeriv(1,
1013 auxArray1 = u2_hat + phys_offset,
1014 auxArray2 =
m_tmp2[i][j] + phys_offset);
1019 &
m_DU1[i][j][0], 1);
1028 inarray[i],
m_IF1[i][j],
1034 for (j = 0; j < nSolutionPts; ++j)
1057 for (j = 0; j < nSolutionPts; j++)
1066 m_gmat[0][j] * m_BD1[i][1][j] -
1067 m_gmat[1][j] * m_BD1[i][0][j];
1071 for (j = 0; j < nDim; ++j)
1085 for (i = 0; i < nConvectiveFields; ++i)
1090 for (j = 0; j < nSolutionPts; j++)
1099 for (n = 0; n < nElements; n++)
1101 phys_offset = fields[0]->GetPhys_Offset(n);
1103 fields[0]->GetExp(n)->StdPhysDeriv(0,
1104 auxArray1 = f_hat + phys_offset,
1105 auxArray2 =
m_DD1[i][0] + phys_offset);
1107 fields[0]->GetExp(n)->StdPhysDeriv(1,
1108 auxArray1 = g_hat + phys_offset,
1109 auxArray2 =
m_DD1[i][1] + phys_offset);
1119 if (Basis[0]->GetPointsType() ==
1121 Basis[1]->GetPointsType() ==
1137 &
m_divFC[i][0], 1, &outarray[i][0], 1);
1142 &
m_jac[0], 1, &outarray[i][0], 1);
1145 if (!(Basis[0]->Collocation()))
1147 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1148 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1156 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1172 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1173 int nvariables = fields.num_elements();
1174 int nDim = fields[0]->GetCoordim(0);
1182 for (i = 0; i < nDim; ++i)
1191 for (j = 0; j < nDim; ++j)
1193 for (i = 0; i < nvariables ; ++i)
1196 fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd);
1206 fields[i]->GetTrace()->Upwind(Vn, Fwd, Bwd, fluxtemp);
1217 if(fields[0]->GetBndCondExpansions().num_elements())
1249 int nBndEdgePts, nBndEdges;
1251 int nBndRegions = fields[var]->GetBndCondExpansions().num_elements();
1252 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1256 fields[var]->ExtractTracePhys(ufield, uplus);
1259 for (i = 0; i < nBndRegions; ++i)
1262 nBndEdges = fields[var]->
1263 GetBndCondExpansions()[i]->GetExpSize();
1266 for (e = 0; e < nBndEdges ; ++e)
1269 nBndEdgePts = fields[var]->
1270 GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
1274 GetBndCondExpansions()[i]->GetPhys_Offset(e);
1277 id2 = fields[0]->GetTrace()->
1278 GetPhys_Offset(fields[0]->GetTraceMap()->
1279 GetBndCondTraceToGlobalTraceMap(cnt++));
1282 if (fields[var]->GetBndConditions()[i]->
1287 GetBndCondExpansions()[i]->
1289 &penaltyflux[id2], 1);
1292 else if ((fields[var]->GetBndConditions()[i])->
1297 &penaltyflux[id2], 1);
1313 boost::ignore_unused(ufield);
1316 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1317 int nvariables = fields.num_elements();
1318 int nDim = fields[0]->GetCoordim(0);
1331 for(i = 0; i < nDim; ++i)
1339 for (i = 0; i < nvariables; ++i)
1342 for (j = 0; j < nDim; ++j)
1345 fields[i]->GetFwdBwdTracePhys(qfield[i][j], qFwd, qBwd);
1359 fields[i]->GetTrace()->Upwind(Vn, qBwd, qFwd, qfluxtemp);
1384 if (fields[0]->GetBndCondExpansions().num_elements())
1413 boost::ignore_unused(C11);
1416 int nBndEdges, nBndEdgePts;
1417 int nBndRegions = fields[var]->GetBndCondExpansions().num_elements();
1418 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1424 fields[var]->ExtractTracePhys(qfield, qtemp);
1426 for (i = 0; i < nBndRegions; ++i)
1428 nBndEdges = fields[var]->
1429 GetBndCondExpansions()[i]->GetExpSize();
1432 for (e = 0; e < nBndEdges ; ++e)
1434 nBndEdgePts = fields[var]->
1435 GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
1438 GetBndCondExpansions()[i]->GetPhys_Offset(e);
1440 id2 = fields[0]->GetTrace()->
1441 GetPhys_Offset(fields[0]->GetTraceMap()->
1442 GetBndCondTraceToGlobalTraceMap(cnt++));
1446 if (fields[var]->GetBndConditions()[i]->
1450 &qtemp[id2], 1, &penaltyflux[id2], 1);
1453 else if ((fields[var]->GetBndConditions()[i])->
1457 &(fields[var]->GetBndCondExpansions()[i]->
1458 GetPhys())[id1], 1, &penaltyflux[id2], 1);
1475 const int nConvectiveFields,
1481 boost::ignore_unused(nConvectiveFields);
1484 int nLocalSolutionPts, phys_offset, t_offset;
1492 Basis = fields[0]->GetExp(0)->GetBasis(0);
1494 int nElements = fields[0]->GetExpSize();
1495 int nSolutionPts = fields[0]->GetTotPoints();
1497 vector<bool> negatedFluxNormal =
1499 fields[0])->GetNegatedFluxNormal();
1510 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1512 for (n = 0; n < nElements; ++n)
1514 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1515 phys_offset = fields[0]->GetPhys_Offset(n);
1520 &flux[phys_offset], 1,
1523 fields[0]->GetExp(n)->GetVertexPhysVals(0, tmparrayX1,
1526 t_offset = fields[0]->GetTrace()
1527 ->GetPhys_Offset(elmtToTrace[n][0]->GetElmtId());
1529 if(negatedFluxNormal[2*n])
1531 JumpL[n] = iFlux[t_offset] - tmpFluxVertex;
1535 JumpL[n] = -iFlux[t_offset] - tmpFluxVertex;
1538 t_offset = fields[0]->GetTrace()
1539 ->GetPhys_Offset(elmtToTrace[n][1]->GetElmtId());
1541 fields[0]->GetExp(n)->GetVertexPhysVals(1, tmparrayX1,
1543 if(negatedFluxNormal[2*n+1])
1545 JumpR[n] = -iFlux[t_offset] - tmpFluxVertex;
1549 JumpR[n] = iFlux[t_offset] - tmpFluxVertex;
1553 for (n = 0; n < nElements; ++n)
1555 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1556 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1557 phys_offset = fields[0]->GetPhys_Offset(n);
1558 jac = fields[0]->GetExp(n)
1562 JumpL[n] = JumpL[n] * jac[0];
1563 JumpR[n] = JumpR[n] * jac[0];
1574 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1575 &derCFlux[phys_offset], 1);
1595 const int nConvectiveFields,
1596 const int direction,
1602 boost::ignore_unused(nConvectiveFields);
1604 int n, e, i, j, cnt;
1609 int nElements = fields[0]->GetExpSize();
1611 int trace_offset, phys_offset;
1612 int nLocalSolutionPts;
1620 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1623 for (n = 0; n < nElements; ++n)
1626 phys_offset = fields[0]->GetPhys_Offset(n);
1627 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1628 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1633 base = fields[0]->GetExp(n)->GetBase();
1634 nquad0 = base[0]->GetNumPoints();
1635 nquad1 = base[1]->GetNumPoints();
1643 for (e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1646 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1652 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1653 elmtToTrace[n][e]->GetElmtId());
1662 fields[0]->GetExp(n)->GetEdgePhysVals(e, elmtToTrace[n][e],
1664 auxArray1 = tmparray);
1670 &tmparray[0], 1, &fluxJumps[0], 1);
1674 if (fields[0]->GetExp(n)->GetEorient(e) ==
1683 if (fields[0]->GetExp(n)->as<LocalRegions::Expansion2D>()
1684 ->GetGeom2D()->GetMetricInfo()->GetGtype()
1690 fields[0]->GetExp(n)->GetEdgePhysVals(
1691 e, elmtToTrace[n][e],
1692 jac, auxArray1 = jacEdge);
1696 if (fields[0]->GetExp(n)->GetEorient(e) ==
1706 for (j = 0; j < nEdgePts; j++)
1708 fluxJumps[j] = fluxJumps[j] * jacEdge[j];
1726 for (i = 0; i < nquad0; ++i)
1731 for (j = 0; j < nquad1; ++j)
1734 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1739 for (i = 0; i < nquad1; ++i)
1744 for (j = 0; j < nquad0; ++j)
1746 cnt = (nquad0)*i + j;
1747 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1752 for (i = 0; i < nquad0; ++i)
1757 for (j = 0; j < nquad1; ++j)
1760 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1765 for (i = 0; i < nquad1; ++i)
1769 for (j = 0; j < nquad0; ++j)
1772 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1778 ASSERTL0(
false,
"edge value (< 3) is out of range");
1788 &divCFluxE3[0], 1, &derCFlux[phys_offset], 1);
1790 else if (direction == 1)
1793 &divCFluxE2[0], 1, &derCFlux[phys_offset], 1);
1812 const int nConvectiveFields,
1819 boost::ignore_unused(nConvectiveFields);
1821 int n, e, i, j, cnt;
1823 int nElements = fields[0]->GetExpSize();
1825 int nLocalSolutionPts;
1836 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1839 for(n = 0; n < nElements; ++n)
1842 phys_offset = fields[0]->GetPhys_Offset(n);
1843 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1845 base = fields[0]->GetExp(n)->GetBase();
1846 nquad0 = base[0]->GetNumPoints();
1847 nquad1 = base[1]->GetNumPoints();
1855 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1858 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1867 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1868 elmtToTrace[n][e]->GetElmtId());
1872 fields[0]->GetExp(n)->GetEdgeNormal(e);
1876 fields[0]->GetExp(n)->GetEdgePhysVals(
1877 e, elmtToTrace[n][e],
1878 fluxX1 + phys_offset,
1879 auxArray1 = tmparrayX1);
1883 fields[0]->GetExp(n)->GetEdgePhysVals(
1884 e, elmtToTrace[n][e],
1885 fluxX2 + phys_offset,
1886 auxArray1 = tmparrayX2);
1889 for (i = 0; i < nEdgePts; ++i)
1898 &numericalFlux[trace_offset], 1,
1899 &fluxN[0], 1, &fluxJumps[0], 1);
1902 if (fields[0]->GetExp(n)->GetEorient(e) ==
1906 auxArray1 = fluxJumps, 1,
1907 auxArray2 = fluxJumps, 1);
1910 NekDouble fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1913 for (i = 0; i < nEdgePts; ++i)
1918 fluxJumps[i] = -fluxJumps[i];
1926 for (i = 0; i < nquad0; ++i)
1929 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
1931 for (j = 0; j < nquad1; ++j)
1934 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1939 for (i = 0; i < nquad1; ++i)
1942 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
1944 for (j = 0; j < nquad0; ++j)
1946 cnt = (nquad0)*i + j;
1947 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1952 for (i = 0; i < nquad0; ++i)
1955 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
1957 for (j = 0; j < nquad1; ++j)
1960 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1965 for (i = 0; i < nquad1; ++i)
1968 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
1969 for (j = 0; j < nquad0; ++j)
1972 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1978 ASSERTL0(
false,
"edge value (< 3) is out of range");
1985 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
1987 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1988 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1990 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1991 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
2010 const int nConvectiveFields,
2017 boost::ignore_unused(nConvectiveFields);
2019 int n, e, i, j, cnt;
2021 int nElements = fields[0]->GetExpSize();
2022 int nLocalSolutionPts;
2033 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
2036 for(n = 0; n < nElements; ++n)
2039 phys_offset = fields[0]->GetPhys_Offset(n);
2040 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
2042 base = fields[0]->GetExp(n)->GetBase();
2043 nquad0 = base[0]->GetNumPoints();
2044 nquad1 = base[1]->GetNumPoints();
2052 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
2055 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
2064 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
2065 elmtToTrace[n][e]->GetElmtId());
2069 fields[0]->GetExp(n)->GetEdgeNormal(e);
2078 fields[0]->GetExp(n)->GetEdgePhysVals(
2079 e, elmtToTrace[n][e],
2080 fluxX2 + phys_offset,
2081 auxArray1 = fluxN_D);
2087 &numericalFlux[trace_offset], 1,
2091 if (fields[0]->GetExp(n)->GetEorient(e) ==
2095 auxArray1 = fluxN, 1,
2096 auxArray2 = fluxN, 1);
2099 auxArray1 = fluxN_D, 1,
2100 auxArray2 = fluxN_D, 1);
2104 for (i = 0; i < nquad0; ++i)
2107 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
2110 for (i = 0; i < nEdgePts; ++i)
2117 fluxN_R[i] = -fluxN_R[i];
2125 &fluxN_D[0], 1, &fluxJumps[0], 1);
2129 for (i = 0; i < nquad0; ++i)
2131 for (j = 0; j < nquad1; ++j)
2143 fields[0]->GetExp(n)->GetEdgePhysVals(
2144 e, elmtToTrace[n][e],
2145 fluxX1 + phys_offset,
2146 auxArray1 = fluxN_D);
2150 &numericalFlux[trace_offset], 1,
2154 if (fields[0]->GetExp(n)->GetEorient(e) ==
2158 auxArray1 = fluxN, 1,
2159 auxArray2 = fluxN, 1);
2162 auxArray1 = fluxN_D, 1,
2163 auxArray2 = fluxN_D, 1);
2167 for (i = 0; i < nquad1; ++i)
2170 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
2173 for (i = 0; i < nEdgePts; ++i)
2180 fluxN_R[i] = -fluxN_R[i];
2188 &fluxN_D[0], 1, &fluxJumps[0], 1);
2192 for (i = 0; i < nquad1; ++i)
2194 for (j = 0; j < nquad0; ++j)
2196 cnt = (nquad0)*i + j;
2208 fields[0]->GetExp(n)->GetEdgePhysVals(
2209 e, elmtToTrace[n][e],
2210 fluxX2 + phys_offset,
2211 auxArray1 = fluxN_D);
2215 &numericalFlux[trace_offset], 1,
2219 if (fields[0]->GetExp(n)->GetEorient(e) ==
2223 auxArray1 = fluxN, 1,
2224 auxArray2 = fluxN, 1);
2227 auxArray1 = fluxN_D, 1,
2228 auxArray2 = fluxN_D, 1);
2232 for (i = 0; i < nquad0; ++i)
2235 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
2238 for (i = 0; i < nEdgePts; ++i)
2245 fluxN_R[i] = -fluxN_R[i];
2254 &fluxN_D[0], 1, &fluxJumps[0], 1);
2258 for (i = 0; i < nquad0; ++i)
2260 for (j = 0; j < nquad1; ++j)
2273 fields[0]->GetExp(n)->GetEdgePhysVals(
2274 e, elmtToTrace[n][e],
2275 fluxX1 + phys_offset,
2276 auxArray1 = fluxN_D);
2281 &numericalFlux[trace_offset], 1,
2285 if (fields[0]->GetExp(n)->GetEorient(e) ==
2289 auxArray1 = fluxN, 1,
2290 auxArray2 = fluxN, 1);
2293 auxArray1 = fluxN_D, 1,
2294 auxArray2 = fluxN_D, 1);
2298 for (i = 0; i < nquad1; ++i)
2301 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
2304 for (i = 0; i < nEdgePts; ++i)
2311 fluxN_R[i] = -fluxN_R[i];
2320 &fluxN_D[0], 1, &fluxJumps[0], 1);
2324 for (i = 0; i < nquad1; ++i)
2326 for (j = 0; j < nquad0; ++j)
2335 ASSERTL0(
false,
"edge value (< 3) is out of range");
2343 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
2345 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2346 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2348 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2349 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi1
virtual void v_DivCFlux_2D(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const NekDouble > &fluxX1, const Array< OneD, const NekDouble > &fluxX2, const Array< OneD, const NekDouble > &numericalFlux, Array< OneD, NekDouble > &divCFlux)
Compute the divergence of the corrective flux for 2D problems.
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi3
#define ASSERTL0(condition, msg)
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e2
Represents a basis of a given type.
std::vector< PointsKey > PointsKeyVector
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e3
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi1
virtual void v_NumFluxforVector(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
Build the numerical flux for the 2nd order derivatives.
virtual void v_Diffuse(const std::size_t nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const Array< OneD, Array< OneD, NekDouble > > &pFwd=NullNekDoubleArrayofArray, const Array< OneD, Array< OneD, NekDouble > > &pBwd=NullNekDoubleArrayofArray)
Calculate FR Diffusion for the linear problems using an LDG interface flux.
DiffusionFactory & GetDiffusionFactory()
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DU1
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi2
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
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi3
1D Gauss-Gauss-Legendre quadrature points
Array< OneD, NekDouble > m_jac
Array< OneD, Array< OneD, NekDouble > > m_divFC
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi2
virtual void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initiliase DiffusionLFR objects and store them before starting the time-stepping. ...
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...
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.
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e1
virtual void v_WeakPenaltyforScalar(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const Array< OneD, const NekDouble > &ufield, Array< OneD, NekDouble > &penaltyflux)
Imposes appropriate bcs for the 1st order derivatives.
virtual void v_NumFluxforScalar(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
Builds the numerical flux for the 1st order derivatives.
This class is the abstraction of a global discontinuous two- dimensional spectral/hp element expansio...
void Neg(int n, T *x, const int incx)
Negate x = -x.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DFC1
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 SpatialDomains::GeomFactorsSharedPtr & GetMetricInfo() const
virtual void v_DerCFlux_1D(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const NekDouble > &flux, const Array< OneD, const NekDouble > &iFlux, Array< OneD, NekDouble > &derCFlux)
Compute the derivative of the corrective flux for 1D problems.
virtual void v_DerCFlux_2D(const int nConvectiveFields, const int direction, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const NekDouble > &flux, const Array< OneD, NekDouble > &iFlux, Array< OneD, NekDouble > &derCFlux)
Compute the derivative of the corrective flux wrt a given coordinate for 2D problems.
Array< OneD, Array< OneD, NekDouble > > m_gmat
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e0
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.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DFC2
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tmp1
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tmp2
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_IF1
virtual void v_WeakPenaltyforVector(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const int dir, const Array< OneD, const NekDouble > &qfield, Array< OneD, NekDouble > &penaltyflux, NekDouble C11)
Imposes appropriate bcs for the 2nd order derivatives.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DD1
Array< OneD, Array< OneD, NekDouble > > m_divFD
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_D1
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, Array< OneD, Array< OneD, NekDouble > > > m_BD1
LibUtilities::SessionReaderSharedPtr m_session
std::shared_ptr< SessionReader > SessionReaderSharedPtr
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_DivCFlux_2D_Gauss(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const NekDouble > &fluxX1, const Array< OneD, const NekDouble > &fluxX2, const Array< OneD, const NekDouble > &numericalFlux, Array< OneD, NekDouble > &divCFlux)
Compute the divergence of the corrective flux for 2D problems where POINTSTYPE="GaussGaussLegendre".
Array< OneD, Array< OneD, NekDouble > > m_IF2