41 #include <boost/math/special_functions/gamma.hpp>
93 int nConvectiveFields = pFields.num_elements();
94 int nDim = pFields[0]->GetCoordim(0);
95 int nSolutionPts = pFields[0]->GetTotPoints();
96 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
123 for (i = 0; i < nConvectiveFields; ++i)
139 for (j = 0; j < nDim; ++j)
179 int nLocalSolutionPts;
180 int nElements = pFields[0]->GetExpSize();
181 int nDimensions = pFields[0]->GetCoordim(0);
182 int nSolutionPts = pFields[0]->GetTotPoints();
183 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
186 for (i = 0; i < nDimensions; ++i)
205 for (n = 0; n < nElements; ++n)
207 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
208 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
209 phys_offset = pFields[0]->GetPhys_Offset(n);
210 jac = pFields[0]->GetExp(n)
213 for (i = 0; i < nLocalSolutionPts; ++i)
215 m_jac[i+phys_offset] = jac[0];
233 for (n = 0; n < nElements; ++n)
235 base = pFields[0]->GetExp(n)->GetBase();
236 nquad0 = base[0]->GetNumPoints();
237 nquad1 = base[1]->GetNumPoints();
245 pFields[0]->GetExp(n)->GetEdgeQFactors(
246 0, auxArray1 = m_Q2D_e0[n]);
247 pFields[0]->GetExp(n)->GetEdgeQFactors(
248 1, auxArray1 = m_Q2D_e1[n]);
249 pFields[0]->GetExp(n)->GetEdgeQFactors(
250 2, auxArray1 = m_Q2D_e2[n]);
251 pFields[0]->GetExp(n)->GetEdgeQFactors(
252 3, auxArray1 = m_Q2D_e3[n]);
254 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
255 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
256 phys_offset = pFields[0]->GetPhys_Offset(n);
258 jac = pFields[0]->GetExp(n)
261 gmat = pFields[0]->GetExp(n)
265 if (pFields[0]->GetExp(n)
266 ->as<LocalRegions::Expansion2D>()->GetGeom2D()
267 ->GetMetricInfo()->GetGtype()
270 for (i = 0; i < nLocalSolutionPts; ++i)
272 m_jac[i+phys_offset] = jac[i];
273 m_gmat[0][i+phys_offset] = gmat[0][i];
274 m_gmat[1][i+phys_offset] = gmat[1][i];
275 m_gmat[2][i+phys_offset] = gmat[2][i];
276 m_gmat[3][i+phys_offset] = gmat[3][i];
281 for (i = 0; i < nLocalSolutionPts; ++i)
283 m_jac[i+phys_offset] = jac[0];
284 m_gmat[0][i+phys_offset] = gmat[0][0];
285 m_gmat[1][i+phys_offset] = gmat[1][0];
286 m_gmat[2][i+phys_offset] = gmat[2][0];
287 m_gmat[3][i+phys_offset] = gmat[3][0];
295 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
300 ASSERTL0(
false,
"Expansion dimension not recognised");
330 int nquad0, nquad1, nquad2;
331 int nmodes0, nmodes1, nmodes2;
334 int nElements = pFields[0]->GetExpSize();
335 int nDim = pFields[0]->GetCoordim(0);
344 for (n = 0; n < nElements; ++n)
346 base = pFields[0]->GetExp(n)->GetBase();
347 nquad0 = base[0]->GetNumPoints();
348 nmodes0 = base[0]->GetNumModes();
352 base[0]->GetZW(z0, w0);
364 int p0 = nmodes0 - 1;
370 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
372 * boost::math::tgamma(p0 + 1)
373 * boost::math::tgamma(p0 + 1));
382 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
383 * (ap0 * boost::math::tgamma(p0 + 1))
384 * (ap0 * boost::math::tgamma(p0 + 1)));
388 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
389 * (ap0 * boost::math::tgamma(p0 + 1))
390 * (ap0 * boost::math::tgamma(p0 + 1)));
394 c0 = -2.0 / ((2.0 * p0 + 1.0)
395 * (ap0 * boost::math::tgamma(p0 + 1))
396 * (ap0 * boost::math::tgamma(p0 + 1)));
400 c0 = 10000000000000000.0;
403 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
404 * (ap0 * boost::math::tgamma(p0 + 1))
405 * (ap0 * boost::math::tgamma(p0 + 1));
407 NekDouble overeta0 = 1.0 / (1.0 + etap0);
418 for(i = 0; i < nquad0; ++i)
424 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
428 for(i = 0; i < nquad0; ++i)
430 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
431 m_dGR_xi1[n][i] += dLpp0[i];
432 m_dGR_xi1[n][i] *= overeta0;
433 m_dGR_xi1[n][i] += dLp0[i];
434 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
451 for (n = 0; n < nElements; ++n)
453 base = pFields[0]->GetExp(n)->GetBase();
454 nquad0 = base[0]->GetNumPoints();
455 nquad1 = base[1]->GetNumPoints();
456 nmodes0 = base[0]->GetNumModes();
457 nmodes1 = base[1]->GetNumModes();
464 base[0]->GetZW(z0, w0);
465 base[1]->GetZW(z1, w1);
482 int p0 = nmodes0 - 1;
483 int p1 = nmodes1 - 1;
490 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
492 * boost::math::tgamma(p0 + 1)
493 * boost::math::tgamma(p0 + 1));
495 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
497 * boost::math::tgamma(p1 + 1)
498 * boost::math::tgamma(p1 + 1));
508 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
509 * (ap0 * boost::math::tgamma(p0 + 1))
510 * (ap0 * boost::math::tgamma(p0 + 1)));
512 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
513 * (ap1 * boost::math::tgamma(p1 + 1))
514 * (ap1 * boost::math::tgamma(p1 + 1)));
518 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
519 * (ap0 * boost::math::tgamma(p0 + 1))
520 * (ap0 * boost::math::tgamma(p0 + 1)));
522 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
523 * (ap1 * boost::math::tgamma(p1 + 1))
524 * (ap1 * boost::math::tgamma(p1 + 1)));
528 c0 = -2.0 / ((2.0 * p0 + 1.0)
529 * (ap0 * boost::math::tgamma(p0 + 1))
530 * (ap0 * boost::math::tgamma(p0 + 1)));
532 c1 = -2.0 / ((2.0 * p1 + 1.0)
533 * (ap1 * boost::math::tgamma(p1 + 1))
534 * (ap1 * boost::math::tgamma(p1 + 1)));
538 c0 = 10000000000000000.0;
539 c1 = 10000000000000000.0;
542 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
543 * (ap0 * boost::math::tgamma(p0 + 1))
544 * (ap0 * boost::math::tgamma(p0 + 1));
546 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
547 * (ap1 * boost::math::tgamma(p1 + 1))
548 * (ap1 * boost::math::tgamma(p1 + 1));
550 NekDouble overeta0 = 1.0 / (1.0 + etap0);
551 NekDouble overeta1 = 1.0 / (1.0 + etap1);
566 for(i = 0; i < nquad0; ++i)
572 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
576 for(i = 0; i < nquad1; ++i)
578 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
579 m_dGL_xi2[n][i] += dLpp1[i];
580 m_dGL_xi2[n][i] *= overeta1;
581 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
582 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
586 for(i = 0; i < nquad0; ++i)
588 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
589 m_dGR_xi1[n][i] += dLpp0[i];
590 m_dGR_xi1[n][i] *= overeta0;
591 m_dGR_xi1[n][i] += dLp0[i];
592 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
596 for(i = 0; i < nquad1; ++i)
598 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
599 m_dGR_xi2[n][i] += dLpp1[i];
600 m_dGR_xi2[n][i] *= overeta1;
601 m_dGR_xi2[n][i] += dLp1[i];
602 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
616 for (n = 0; n < nElements; ++n)
618 base = pFields[0]->GetExp(n)->GetBase();
619 nquad0 = base[0]->GetNumPoints();
620 nquad1 = base[1]->GetNumPoints();
621 nquad2 = base[2]->GetNumPoints();
622 nmodes0 = base[0]->GetNumModes();
623 nmodes1 = base[1]->GetNumModes();
624 nmodes2 = base[2]->GetNumModes();
633 base[0]->GetZW(z0, w0);
634 base[1]->GetZW(z1, w1);
635 base[1]->GetZW(z2, w2);
657 int p0 = nmodes0 - 1;
658 int p1 = nmodes1 - 1;
659 int p2 = nmodes2 - 1;
667 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
669 * boost::math::tgamma(p0 + 1)
670 * boost::math::tgamma(p0 + 1));
673 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
675 * boost::math::tgamma(p1 + 1)
676 * boost::math::tgamma(p1 + 1));
679 NekDouble ap2 = boost::math::tgamma(2 * p2 + 1)
681 * boost::math::tgamma(p2 + 1)
682 * boost::math::tgamma(p2 + 1));
693 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
694 * (ap0 * boost::math::tgamma(p0 + 1))
695 * (ap0 * boost::math::tgamma(p0 + 1)));
697 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
698 * (ap1 * boost::math::tgamma(p1 + 1))
699 * (ap1 * boost::math::tgamma(p1 + 1)));
701 c2 = 2.0 * p2 / ((2.0 * p2 + 1.0) * (p2 + 1.0)
702 * (ap2 * boost::math::tgamma(p2 + 1))
703 * (ap2 * boost::math::tgamma(p2 + 1)));
707 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
708 * (ap0 * boost::math::tgamma(p0 + 1))
709 * (ap0 * boost::math::tgamma(p0 + 1)));
711 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
712 * (ap1 * boost::math::tgamma(p1 + 1))
713 * (ap1 * boost::math::tgamma(p1 + 1)));
715 c2 = 2.0 * (p2 + 1.0) / ((2.0 * p2 + 1.0) * p2
716 * (ap2 * boost::math::tgamma(p2 + 1))
717 * (ap2 * boost::math::tgamma(p2 + 1)));
721 c0 = -2.0 / ((2.0 * p0 + 1.0)
722 * (ap0 * boost::math::tgamma(p0 + 1))
723 * (ap0 * boost::math::tgamma(p0 + 1)));
725 c1 = -2.0 / ((2.0 * p1 + 1.0)
726 * (ap1 * boost::math::tgamma(p1 + 1))
727 * (ap1 * boost::math::tgamma(p1 + 1)));
729 c2 = -2.0 / ((2.0 * p2 + 1.0)
730 * (ap2 * boost::math::tgamma(p2 + 1))
731 * (ap2 * boost::math::tgamma(p2 + 1)));
735 c0 = 10000000000000000.0;
736 c1 = 10000000000000000.0;
737 c2 = 10000000000000000.0;
740 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
741 * (ap0 * boost::math::tgamma(p0 + 1))
742 * (ap0 * boost::math::tgamma(p0 + 1));
744 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
745 * (ap1 * boost::math::tgamma(p1 + 1))
746 * (ap1 * boost::math::tgamma(p1 + 1));
748 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0)
749 * (ap2 * boost::math::tgamma(p2 + 1))
750 * (ap2 * boost::math::tgamma(p2 + 1));
752 NekDouble overeta0 = 1.0 / (1.0 + etap0);
753 NekDouble overeta1 = 1.0 / (1.0 + etap1);
754 NekDouble overeta2 = 1.0 / (1.0 + etap2);
773 for(i = 0; i < nquad0; ++i)
779 m_dGL_xi1[n][i] = 0.5 * sign0 * m_dGL_xi1[n][i];
783 for(i = 0; i < nquad1; ++i)
785 m_dGL_xi2[n][i] = etap1 * dLpm1[i];
786 m_dGL_xi2[n][i] += dLpp1[i];
787 m_dGL_xi2[n][i] *= overeta1;
788 m_dGL_xi2[n][i] = dLp1[i] - m_dGL_xi2[n][i];
789 m_dGL_xi2[n][i] = 0.5 * sign1 * m_dGL_xi2[n][i];
793 for(i = 0; i < nquad2; ++i)
795 m_dGL_xi3[n][i] = etap2 * dLpm2[i];
796 m_dGL_xi3[n][i] += dLpp2[i];
797 m_dGL_xi3[n][i] *= overeta2;
798 m_dGL_xi3[n][i] = dLp2[i] - m_dGL_xi3[n][i];
799 m_dGL_xi3[n][i] = 0.5 * sign2 * m_dGL_xi3[n][i];
803 for(i = 0; i < nquad0; ++i)
805 m_dGR_xi1[n][i] = etap0 * dLpm0[i];
806 m_dGR_xi1[n][i] += dLpp0[i];
807 m_dGR_xi1[n][i] *= overeta0;
808 m_dGR_xi1[n][i] += dLp0[i];
809 m_dGR_xi1[n][i] = 0.5 * m_dGR_xi1[n][i];
813 for(i = 0; i < nquad1; ++i)
815 m_dGR_xi2[n][i] = etap1 * dLpm1[i];
816 m_dGR_xi2[n][i] += dLpp1[i];
817 m_dGR_xi2[n][i] *= overeta1;
818 m_dGR_xi2[n][i] += dLp1[i];
819 m_dGR_xi2[n][i] = 0.5 * m_dGR_xi2[n][i];
823 for(i = 0; i < nquad2; ++i)
825 m_dGR_xi3[n][i] = etap2 * dLpm2[i];
826 m_dGR_xi3[n][i] += dLpp2[i];
827 m_dGR_xi3[n][i] *= overeta2;
828 m_dGR_xi3[n][i] += dLp2[i];
829 m_dGR_xi3[n][i] = 0.5 * m_dGR_xi3[n][i];
836 ASSERTL0(
false,
"Expansion dimension not recognised");
848 const int nConvectiveFields,
860 Basis = fields[0]->GetExp(0)->GetBase();
862 int nElements = fields[0]->GetExpSize();
863 int nDim = fields[0]->GetCoordim(0);
864 int nSolutionPts = fields[0]->GetTotPoints();
865 int nCoeffs = fields[0]->GetNcoeffs();
868 for (i = 0; i < nConvectiveFields; ++i)
881 for (i = 0; i < nConvectiveFields; ++i)
885 for (n = 0; n < nElements; n++)
887 phys_offset = fields[0]->GetPhys_Offset(n);
889 fields[i]->GetExp(n)->PhysDeriv(0,
890 auxArray1 = inarray[i] + phys_offset,
891 auxArray2 =
m_DU1[i][0] + phys_offset);
917 for (i = 0; i < nConvectiveFields; ++i)
921 for (n = 0; n < nElements; n++)
923 phys_offset = fields[0]->GetPhys_Offset(n);
925 fields[i]->GetExp(n)->PhysDeriv(0,
926 auxArray1 =
m_D1[i][0] + phys_offset,
927 auxArray2 =
m_DD1[i][0] + phys_offset);
943 &
m_DD1[i][0][0], 1, &outarray[i][0], 1);
946 if (!(Basis[0]->Collocation()))
948 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
949 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
957 for(i = 0; i < nConvectiveFields; ++i)
959 for (j = 0; j < nDim; ++j)
968 &
m_gmat[0][0], 1, &u1_hat[0], 1);
971 &
m_jac[0], 1, &u1_hat[0], 1);
974 &
m_gmat[1][0], 1, &u2_hat[0], 1);
977 &
m_jac[0], 1, &u2_hat[0], 1);
982 &
m_gmat[2][0], 1, &u1_hat[0], 1);
985 &
m_jac[0], 1, &u1_hat[0], 1);
988 &
m_gmat[3][0], 1, &u2_hat[0], 1);
991 &
m_jac[0], 1, &u2_hat[0], 1);
994 for (n = 0; n < nElements; n++)
996 phys_offset = fields[0]->GetPhys_Offset(n);
998 fields[i]->GetExp(n)->StdPhysDeriv(0,
999 auxArray1 = u1_hat + phys_offset,
1000 auxArray2 =
m_tmp1[i][j] + phys_offset);
1002 fields[i]->GetExp(n)->StdPhysDeriv(1,
1003 auxArray1 = u2_hat + phys_offset,
1004 auxArray2 =
m_tmp2[i][j] + phys_offset);
1009 &
m_DU1[i][j][0], 1);
1018 inarray[i],
m_IF1[i][j],
1024 for (j = 0; j < nSolutionPts; ++j)
1047 for (j = 0; j < nSolutionPts; j++)
1056 m_gmat[0][j] * m_BD1[i][1][j] -
1057 m_gmat[1][j] * m_BD1[i][0][j];
1061 for (j = 0; j < nDim; ++j)
1075 for (i = 0; i < nConvectiveFields; ++i)
1080 for (j = 0; j < nSolutionPts; j++)
1089 for (n = 0; n < nElements; n++)
1091 phys_offset = fields[0]->GetPhys_Offset(n);
1093 fields[0]->GetExp(n)->StdPhysDeriv(0,
1094 auxArray1 = f_hat + phys_offset,
1095 auxArray2 =
m_DD1[i][0] + phys_offset);
1097 fields[0]->GetExp(n)->StdPhysDeriv(1,
1098 auxArray1 = g_hat + phys_offset,
1099 auxArray2 =
m_DD1[i][1] + phys_offset);
1109 if (Basis[0]->GetPointsType() ==
1111 Basis[1]->GetPointsType() ==
1127 &
m_divFC[i][0], 1, &outarray[i][0], 1);
1132 &
m_jac[0], 1, &outarray[i][0], 1);
1135 if (!(Basis[0]->Collocation()))
1137 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1138 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1146 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1162 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1163 int nvariables = fields.num_elements();
1164 int nDim = fields[0]->GetCoordim(0);
1172 for (i = 0; i < nDim; ++i)
1181 for (j = 0; j < nDim; ++j)
1183 for (i = 0; i < nvariables ; ++i)
1186 fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd);
1196 fields[i]->GetTrace()->Upwind(Vn, Fwd, Bwd, fluxtemp);
1207 if(fields[0]->GetBndCondExpansions().num_elements())
1239 int nBndEdgePts, nBndEdges;
1241 int nBndRegions = fields[var]->GetBndCondExpansions().num_elements();
1242 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1246 fields[var]->ExtractTracePhys(ufield, uplus);
1249 for (i = 0; i < nBndRegions; ++i)
1252 nBndEdges = fields[var]->
1253 GetBndCondExpansions()[i]->GetExpSize();
1256 for (e = 0; e < nBndEdges ; ++e)
1259 nBndEdgePts = fields[var]->
1260 GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
1264 GetBndCondExpansions()[i]->GetPhys_Offset(e);
1267 id2 = fields[0]->GetTrace()->
1268 GetPhys_Offset(fields[0]->GetTraceMap()->
1269 GetBndCondTraceToGlobalTraceMap(cnt++));
1272 if (fields[var]->GetBndConditions()[i]->
1277 GetBndCondExpansions()[i]->
1279 &penaltyflux[id2], 1);
1282 else if ((fields[var]->GetBndConditions()[i])->
1287 &penaltyflux[id2], 1);
1304 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1305 int nvariables = fields.num_elements();
1306 int nDim = fields[0]->GetCoordim(0);
1319 for(i = 0; i < nDim; ++i)
1327 for (i = 0; i < nvariables; ++i)
1330 for (j = 0; j < nDim; ++j)
1333 fields[i]->GetFwdBwdTracePhys(qfield[i][j], qFwd, qBwd);
1347 fields[i]->GetTrace()->Upwind(Vn, qBwd, qFwd, qfluxtemp);
1372 if (fields[0]->GetBndCondExpansions().num_elements())
1402 int nBndEdges, nBndEdgePts;
1403 int nBndRegions = fields[var]->GetBndCondExpansions().num_elements();
1404 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1410 fields[var]->ExtractTracePhys(qfield, qtemp);
1412 for (i = 0; i < nBndRegions; ++i)
1414 nBndEdges = fields[var]->
1415 GetBndCondExpansions()[i]->GetExpSize();
1418 for (e = 0; e < nBndEdges ; ++e)
1420 nBndEdgePts = fields[var]->
1421 GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
1424 GetBndCondExpansions()[i]->GetPhys_Offset(e);
1426 id2 = fields[0]->GetTrace()->
1427 GetPhys_Offset(fields[0]->GetTraceMap()->
1428 GetBndCondTraceToGlobalTraceMap(cnt++));
1432 if (fields[var]->GetBndConditions()[i]->
1436 &qtemp[id2], 1, &penaltyflux[id2], 1);
1439 else if ((fields[var]->GetBndConditions()[i])->
1443 &(fields[var]->GetBndCondExpansions()[i]->
1444 GetPhys())[id1], 1, &penaltyflux[id2], 1);
1461 const int nConvectiveFields,
1468 int nLocalSolutionPts, phys_offset, t_offset;
1476 Basis = fields[0]->GetExp(0)->GetBasis(0);
1478 int nElements = fields[0]->GetExpSize();
1479 int nSolutionPts = fields[0]->GetTotPoints();
1492 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1494 for (n = 0; n < nElements; ++n)
1496 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1497 phys_offset = fields[0]->GetPhys_Offset(n);
1502 &flux[phys_offset], 1,
1505 fields[0]->GetExp(n)->GetVertexPhysVals(0, tmparrayX1,
1508 t_offset = fields[0]->GetTrace()
1509 ->GetPhys_Offset(elmtToTrace[n][0]->GetElmtId());
1511 if(negatedFluxNormal[2*n])
1513 JumpL[n] = iFlux[t_offset] - tmpFluxVertex;
1517 JumpL[n] = -iFlux[t_offset] - tmpFluxVertex;
1520 t_offset = fields[0]->GetTrace()
1521 ->GetPhys_Offset(elmtToTrace[n][1]->GetElmtId());
1523 fields[0]->GetExp(n)->GetVertexPhysVals(1, tmparrayX1,
1525 if(negatedFluxNormal[2*n+1])
1527 JumpR[n] = -iFlux[t_offset] - tmpFluxVertex;
1531 JumpR[n] = iFlux[t_offset] - tmpFluxVertex;
1535 for (n = 0; n < nElements; ++n)
1537 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1538 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1539 phys_offset = fields[0]->GetPhys_Offset(n);
1540 jac = fields[0]->GetExp(n)
1544 JumpL[n] = JumpL[n] * jac[0];
1545 JumpR[n] = JumpR[n] * jac[0];
1556 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1557 &derCFlux[phys_offset], 1);
1577 const int nConvectiveFields,
1578 const int direction,
1584 int n, e, i, j, cnt;
1589 int nElements = fields[0]->GetExpSize();
1591 int trace_offset, phys_offset;
1592 int nLocalSolutionPts;
1600 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1603 for (n = 0; n < nElements; ++n)
1606 phys_offset = fields[0]->GetPhys_Offset(n);
1607 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1608 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1613 base = fields[0]->GetExp(n)->GetBase();
1614 nquad0 = base[0]->GetNumPoints();
1615 nquad1 = base[1]->GetNumPoints();
1623 for (e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1626 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1632 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1633 elmtToTrace[n][e]->GetElmtId());
1642 fields[0]->GetExp(n)->GetEdgePhysVals(e, elmtToTrace[n][e],
1644 auxArray1 = tmparray);
1650 &tmparray[0], 1, &fluxJumps[0], 1);
1654 if (fields[0]->GetExp(n)->GetEorient(e) ==
1663 if (fields[0]->GetExp(n)->as<LocalRegions::Expansion2D>()
1664 ->GetGeom2D()->GetMetricInfo()->GetGtype()
1670 fields[0]->GetExp(n)->GetEdgePhysVals(
1671 e, elmtToTrace[n][e],
1672 jac, auxArray1 = jacEdge);
1676 if (fields[0]->GetExp(n)->GetEorient(e) ==
1686 for (j = 0; j < nEdgePts; j++)
1688 fluxJumps[j] = fluxJumps[j] * jacEdge[j];
1706 for (i = 0; i < nquad0; ++i)
1711 for (j = 0; j < nquad1; ++j)
1714 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1719 for (i = 0; i < nquad1; ++i)
1724 for (j = 0; j < nquad0; ++j)
1726 cnt = (nquad0)*i + j;
1727 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1732 for (i = 0; i < nquad0; ++i)
1737 for (j = 0; j < nquad1; ++j)
1739 cnt = (nquad0 - 1) + j*nquad0 - i;
1740 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1745 for (i = 0; i < nquad1; ++i)
1749 for (j = 0; j < nquad0; ++j)
1751 cnt = (nquad0*nquad1 - nquad0) + j - i*nquad0;
1752 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1758 ASSERTL0(
false,
"edge value (< 3) is out of range");
1768 &divCFluxE3[0], 1, &derCFlux[phys_offset], 1);
1770 else if (direction == 1)
1773 &divCFluxE2[0], 1, &derCFlux[phys_offset], 1);
1792 const int nConvectiveFields,
1799 int n, e, i, j, cnt;
1801 int nElements = fields[0]->GetExpSize();
1803 int nLocalSolutionPts;
1814 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1817 for(n = 0; n < nElements; ++n)
1820 phys_offset = fields[0]->GetPhys_Offset(n);
1821 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1823 base = fields[0]->GetExp(n)->GetBase();
1824 nquad0 = base[0]->GetNumPoints();
1825 nquad1 = base[1]->GetNumPoints();
1833 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
1836 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
1845 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1846 elmtToTrace[n][e]->GetElmtId());
1850 fields[0]->GetExp(n)->GetEdgeNormal(e);
1854 fields[0]->GetExp(n)->GetEdgePhysVals(
1855 e, elmtToTrace[n][e],
1856 fluxX1 + phys_offset,
1857 auxArray1 = tmparrayX1);
1861 fields[0]->GetExp(n)->GetEdgePhysVals(
1862 e, elmtToTrace[n][e],
1863 fluxX2 + phys_offset,
1864 auxArray1 = tmparrayX2);
1867 for (i = 0; i < nEdgePts; ++i)
1876 &numericalFlux[trace_offset], 1,
1877 &fluxN[0], 1, &fluxJumps[0], 1);
1880 if (fields[0]->GetExp(n)->GetEorient(e) ==
1884 auxArray1 = fluxJumps, 1,
1885 auxArray2 = fluxJumps, 1);
1888 NekDouble fac = fields[0]->GetExp(n)->EdgeNormalNegated(e) ?
1891 for (i = 0; i < nEdgePts; ++i)
1896 fluxJumps[i] = -fluxJumps[i];
1904 for (i = 0; i < nquad0; ++i)
1907 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
1909 for (j = 0; j < nquad1; ++j)
1912 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1917 for (i = 0; i < nquad1; ++i)
1920 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
1922 for (j = 0; j < nquad0; ++j)
1924 cnt = (nquad0)*i + j;
1925 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1930 for (i = 0; i < nquad0; ++i)
1933 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
1935 for (j = 0; j < nquad1; ++j)
1937 cnt = (nquad0 - 1) + j*nquad0 - i;
1938 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1943 for (i = 0; i < nquad1; ++i)
1946 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
1947 for (j = 0; j < nquad0; ++j)
1949 cnt = (nquad0*nquad1 - nquad0) + j - i*nquad0;
1950 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1956 ASSERTL0(
false,
"edge value (< 3) is out of range");
1963 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
1965 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1966 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
1968 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
1969 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
1988 const int nConvectiveFields,
1995 int n, e, i, j, cnt;
1997 int nElements = fields[0]->GetExpSize();
1998 int nLocalSolutionPts;
2009 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
2012 for(n = 0; n < nElements; ++n)
2015 phys_offset = fields[0]->GetPhys_Offset(n);
2016 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
2018 base = fields[0]->GetExp(n)->GetBase();
2019 nquad0 = base[0]->GetNumPoints();
2020 nquad1 = base[1]->GetNumPoints();
2028 for(e = 0; e < fields[0]->GetExp(n)->GetNedges(); ++e)
2031 nEdgePts = fields[0]->GetExp(n)->GetEdgeNumPoints(e);
2040 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
2041 elmtToTrace[n][e]->GetElmtId());
2045 fields[0]->GetExp(n)->GetEdgeNormal(e);
2054 fields[0]->GetExp(n)->GetEdgePhysVals(
2055 e, elmtToTrace[n][e],
2056 fluxX2 + phys_offset,
2057 auxArray1 = fluxN_D);
2063 &numericalFlux[trace_offset], 1,
2067 if (fields[0]->GetExp(n)->GetEorient(e) ==
2071 auxArray1 = fluxN, 1,
2072 auxArray2 = fluxN, 1);
2075 auxArray1 = fluxN_D, 1,
2076 auxArray2 = fluxN_D, 1);
2080 for (i = 0; i < nquad0; ++i)
2083 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
2086 for (i = 0; i < nEdgePts; ++i)
2093 fluxN_R[i] = -fluxN_R[i];
2101 &fluxN_D[0], 1, &fluxJumps[0], 1);
2105 for (i = 0; i < nquad0; ++i)
2107 for (j = 0; j < nquad1; ++j)
2119 fields[0]->GetExp(n)->GetEdgePhysVals(
2120 e, elmtToTrace[n][e],
2121 fluxX1 + phys_offset,
2122 auxArray1 = fluxN_D);
2126 &numericalFlux[trace_offset], 1,
2130 if (fields[0]->GetExp(n)->GetEorient(e) ==
2134 auxArray1 = fluxN, 1,
2135 auxArray2 = fluxN, 1);
2138 auxArray1 = fluxN_D, 1,
2139 auxArray2 = fluxN_D, 1);
2143 for (i = 0; i < nquad1; ++i)
2146 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
2149 for (i = 0; i < nEdgePts; ++i)
2156 fluxN_R[i] = -fluxN_R[i];
2164 &fluxN_D[0], 1, &fluxJumps[0], 1);
2168 for (i = 0; i < nquad1; ++i)
2170 for (j = 0; j < nquad0; ++j)
2172 cnt = (nquad0)*i + j;
2184 fields[0]->GetExp(n)->GetEdgePhysVals(
2185 e, elmtToTrace[n][e],
2186 fluxX2 + phys_offset,
2187 auxArray1 = fluxN_D);
2191 &numericalFlux[trace_offset], 1,
2195 if (fields[0]->GetExp(n)->GetEorient(e) ==
2199 auxArray1 = fluxN, 1,
2200 auxArray2 = fluxN, 1);
2203 auxArray1 = fluxN_D, 1,
2204 auxArray2 = fluxN_D, 1);
2208 for (i = 0; i < nquad0; ++i)
2211 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
2214 for (i = 0; i < nEdgePts; ++i)
2221 fluxN_R[i] = -fluxN_R[i];
2230 &fluxN_D[0], 1, &fluxJumps[0], 1);
2234 for (i = 0; i < nquad0; ++i)
2236 for (j = 0; j < nquad1; ++j)
2238 cnt = (nquad0 - 1) + j*nquad0 - i;
2249 fields[0]->GetExp(n)->GetEdgePhysVals(
2250 e, elmtToTrace[n][e],
2251 fluxX1 + phys_offset,
2252 auxArray1 = fluxN_D);
2257 &numericalFlux[trace_offset], 1,
2261 if (fields[0]->GetExp(n)->GetEorient(e) ==
2265 auxArray1 = fluxN, 1,
2266 auxArray2 = fluxN, 1);
2269 auxArray1 = fluxN_D, 1,
2270 auxArray2 = fluxN_D, 1);
2274 for (i = 0; i < nquad1; ++i)
2277 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
2280 for (i = 0; i < nEdgePts; ++i)
2287 fluxN_R[i] = -fluxN_R[i];
2296 &fluxN_D[0], 1, &fluxJumps[0], 1);
2300 for (i = 0; i < nquad1; ++i)
2302 for (j = 0; j < nquad0; ++j)
2304 cnt = (nquad0*nquad1 - nquad0) + j
2312 ASSERTL0(
false,
"edge value (< 3) is out of range");
2320 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
2322 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2323 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2325 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2326 &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
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.
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.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi3
1D Gauss-Gauss-Legendre quadrature points
Array< OneD, NekDouble > m_jac
static DiffusionSharedPtr create(std::string diffType)
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...
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.
DiffusionLFR(std::string diffType)
DiffusionLFR uses the Flux Reconstruction (FR) approach to compute the diffusion term. The implementation is only for segments, quadrilaterals and hexahedra at the moment.
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.
virtual void v_Diffuse(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Calculate FR Diffusion for the linear problems using an LDG interface flux.
const boost::shared_ptr< SpatialDomains::GeomFactors > & GetMetricInfo(void) const
static std::string type[]
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DD1
boost::shared_ptr< Basis > BasisSharedPtr
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
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
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.