55 const int TangentXelem)
57 m_pi = 3.14159265358979323846;
73 if (
m_session->DefinesSolverInfo(
"SURFACETYPE"))
75 std::string SurfaceTypeStr =
m_session->GetSolverInfo(
"SURFACETYPE");
122 const int TangentXelem)
131 for (
int j = 0; j < MFdim; ++j)
137 std::string conn =
"TangentX";
140 m_session->LoadSolverInfo(
"MMFDir", conn,
"LOCAL");
152 if (conn ==
"TangentX")
154 if (conn ==
"TangentY")
156 if (conn ==
"TangentXY")
158 if (conn ==
"TangentZ")
160 if (conn ==
"TangentCircular")
162 if (conn ==
"TangentIrregular")
164 if (conn ==
"TangentNonconvex")
173 if (TangentXelem > 0)
176 m_fields[0]->GenerateElementVector(TangentXelem, 1.0, 0.0, tmp);
186 m_fields[0]->GenerateElementVector(TangentXelem, 0.0, 1.0, tmp);
193 std::cout <<
"*** MF in PML Region is aligned as MF1 = ( "
219 NekDouble t1x, t1y, t1z, t2x, t2y, t2z, t3x, t3y, t3z;
220 NekDouble dot12 = 0.0, dot23 = 0.0, dot31 = 0.0;
225 for (
int i = 0; i < nq; ++i)
227 t1x = movingframes[0][i];
228 t1y = movingframes[0][i + nq];
229 t1z = movingframes[0][i + 2 * nq];
231 t2x = movingframes[1][i];
232 t2y = movingframes[1][i + nq];
233 t2z = movingframes[1][i + 2 * nq];
235 t3x = movingframes[2][i];
236 t3y = movingframes[2][i + nq];
237 t3z = movingframes[2][i + 2 * nq];
239 dot12 = t1x * t2x + t1y * t2y + t1z * t2z;
240 dot23 = t2x * t3x + t2y * t3y + t2z * t3z;
241 dot31 = t3x * t1x + t3y * t1y + t3z * t1z;
244 std::cout <<
"======================================================"
246 std::cout <<
"======================================================"
248 std::cout <<
"*** The first moving frame is alinged along"
255 Vmath::Vcopy(nq, &movingframes[0][2 * nq], 1, &tmpz[0], 1);
256 std::cout << nq <<
" , "
257 <<
"*** Avg MF1 = ( " <<
AvgAbsInt(tmpx) <<
" , "
263 Vmath::Vcopy(nq, &movingframes[1][2 * nq], 1, &tmpz[0], 1);
264 std::cout <<
"*** Avg MF2 = ( " <<
AvgAbsInt(tmpx) <<
" , "
272 Vmath::Vcopy(nq, &movingframes[2][2 * nq], 1, &tmpz[0], 1);
273 std::cout <<
"*** Avg MF3 = ( " <<
AvgAbsInt(tmpx) <<
" , "
278 if ((fabs(dot12) + fabs(dot23) + fabs(dot31)) < Tol)
280 std::cout <<
"*** Moving frames are Orthogonal" << std::endl;
285 std::cout <<
"*** Moving frames are NOT Orthogonal" << std::endl;
295 &movingframes[j][k * nq], 1, &tmp[0], 1, &tmp[0], 1);
298 std::cout <<
"*** Avg. Magnitude of MF" << j <<
" = " <<
AvgAbsInt(tmp)
334 m_fields[0]->GetFwdBwdTracePhys(tmp, MFtraceFwd[j][k],
365 &SurfaceNormal[k][0], 1);
390 std::cout <<
"*** m_nperpcdotMFFwd = ( "
393 std::cout <<
"*** m_nperpcdotMFBwd = ( "
400 std::cout <<
"*** m_ncdotMFFwd = ( "
405 std::cout <<
"*** m_ncdotMFBwd = ( "
411 std::cout <<
"*** m_nperpcdotMFFwd = ( "
417 <<
" ) " << std::endl;
418 std::cout <<
"*** m_nperpcdotMFBwd = ( "
424 <<
" ) " << std::endl;
437 for (
int j = 0; j < MMFdim; ++j)
444 m_fields[0]->PhysDeriv(k, tmp, Dtmp);
449 std::cout <<
"*** Divergence of MF1 = " <<
AvgInt(
m_DivMF[0])
455 for (
int i = 0; i < MMFdim; ++i)
459 for (
int j = 0; j < MMFdim; ++j)
474 for (
int dir = 0; dir < MMFdim; dir++)
483 for (
int j = 0; j < MMFdim; ++j)
488 &CurlMFtmp[i][0], 1, &
m_CurlMF[dir][j][0], 1,
494 std::cout <<
"*** Curl of MF1 = ( " <<
AvgInt(
m_CurlMF[0][0]) <<
" , "
496 <<
" ) " << std::endl;
497 std::cout <<
"*** Curl of MF2 = ( " <<
AvgInt(
m_CurlMF[1][0]) <<
" , "
499 <<
" ) " << std::endl;
500 std::cout <<
"*** Curl of MF3 = ( " <<
AvgInt(
m_CurlMF[2][0]) <<
" , "
502 <<
" ) " << std::endl;
519 for (
int j = 0; j < MFdim; ++j)
526 for (
int j = 0; j < MFdim; ++j)
535 m_fields[0]->GetFwdBwdTracePhys(tmp, Fwdtmp, Bwdtmp);
566 for (
int j = 0; j < MFdim; ++j)
591 for (
int j = 0; j < MFdim; ++j)
595 Vmath::Vcopy(nq, &MFtmpCurl[j][k][0], 1, &CrossProductMF[j][k * nq],
612 for (
int j = 0; j < MFdim; ++j)
639 std::cout <<
"*** m_ntimesMFFwd = ( "
643 std::cout <<
"*** m_ntimesMFBwd = ( "
647 std::cout <<
"*** m_ntimes_ntimesMFFwd = ( "
652 std::cout <<
"*** m_ntimes_ntimesMFBwd = ( "
664 int coordim = v1.size();
665 int nq = v1[0].size();
668 for (
int i = 0; i < coordim; ++i)
670 Vmath::Vvtvp(nq, &v1[i][0], 1, &v2[i][0], 1, &v3[0], 1, &v3[0], 1);
687 ASSERTL0(v1.size() == 3,
"Input 1 has dimension not equal to 3.");
688 ASSERTL0(v2.size() == 3,
"Input 2 has dimension not equal to 3.");
689 ASSERTL0(v3.size() == 3,
"Output vector has dimension not equal to 3.");
691 int nq = v1[0].size();
695 Vmath::Vvtvm(nq, v1[1], 1, v2[2], 1, temp, 1, v3[0], 1);
698 Vmath::Vvtvm(nq, v1[2], 1, v2[0], 1, temp, 1, v3[1], 1);
701 Vmath::Vvtvm(nq, v1[0], 1, v2[1], 1, temp, 1, v3[2], 1);
708 ASSERTL0(v1.size() == 3,
"Input 1 has dimension not equal to 3.");
709 ASSERTL0(v2.size() == 3,
"Input 2 has dimension not equal to 3.");
710 ASSERTL0(v3.size() == 3,
"Output vector has dimension not equal to 3.");
712 v3[0] = v1[1] * v2[2] - v1[2] * v2[1];
713 v3[1] = v1[2] * v2[0] - v1[0] * v2[2];
714 v3[2] = v1[0] * v2[1] - v1[1] * v2[0];
722 int nq = inarray[0].size();
744 m_fields[0]->PhysDeriv(0, tmpz, Dtmpzdx);
745 m_fields[0]->PhysDeriv(0, tmpy, Dtmpydx);
746 m_fields[0]->PhysDeriv(1, tmpx, Dtmpxdy);
747 m_fields[0]->PhysDeriv(1, tmpz, Dtmpzdy);
748 m_fields[0]->PhysDeriv(2, tmpx, Dtmpxdz);
749 m_fields[0]->PhysDeriv(2, tmpy, Dtmpydz);
751 Vmath::Vsub(nq, &Dtmpzdy[0], 1, &Dtmpydz[0], 1, &outarray[0][0], 1);
752 Vmath::Vsub(nq, &Dtmpxdz[0], 1, &Dtmpzdx[0], 1, &outarray[1][0], 1);
753 Vmath::Vsub(nq, &Dtmpydx[0], 1, &Dtmpxdy[0], 1, &outarray[2][0], 1);
768 &outarray[0], 1, &outarray[0], 1);
770 &outarray[0], 1, &outarray[0], 1);
791 radius =
sqrt(x0j * x0j / (m_Xscale * m_Xscale) +
792 x1j * x1j / (m_Yscale * m_Yscale) +
793 x2j * x2j / (m_Zscale * m_Zscale));
794 radxy =
sqrt(x0j * x0j / (m_Xscale * m_Xscale) +
795 x1j * x1j / (m_Yscale * m_Yscale));
799 sin_varphi = x1j / (radxy * m_Yscale);
800 cos_varphi = x0j / (radxy * m_Xscale);
817 sin_theta = x2j / (radius * m_Zscale);
818 cos_theta = radxy / radius;
824 const int var,
const std::string BDtype)
826 int id1, id2, npts, nptselem, cnt = 0, bdrycnt = 0;
830 for (
int n = 0; n <
m_fields[var]->GetBndConditions().size(); ++n)
832 nptselem =
m_fields[var]->GetBndCondExpansions()[n]->GetNpoints();
841 m_fields[var]->GetBndCondExpansions()[n]->GetCoords(x0, x1, x2);
843 m_session->GetFunction(
"BoundaryConditions", 0);
844 ifunc->Evaluate(x0, x1, x2, 0.0, Dirichlet);
851 ->GetBndCondExpansions()[n]
854 id1 =
m_fields[var]->GetBndCondExpansions()[n]->GetPhys_Offset(e);
855 id2 =
m_fields[var]->GetTrace()->GetPhys_Offset(
856 m_fields[var]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt +
859 if (
m_fields[var]->GetBndConditions()[n]->GetUserDefined() ==
861 BDtype ==
"NoUserDefined")
893 cnt +=
m_fields[var]->GetBndCondExpansions()[n]->GetExpSize();
912 for (
int i = 0; i < nTraceNumPoints; ++i)
914 Aver = 0.5 * (imFwd[i] + imBwd[i]);
920 ntimesz = 0.5 * (imFwd[i] * Fwd[2][i] + imBwd[i] * Bwd[2][i]);
928 outarrayFwd[i] = tmpFwd / Aver;
929 outarrayBwd[i] = tmpBwd / Aver;
945 NekDouble tmpFwd, tmpBwd, Aver1, Aver2, HFwdk, HBwdk;
955 for (
int i = 0; i < nTraceNumPoints; ++i)
957 Aver1 = 0.5 * (im1Fwd[i] + im1Bwd[i]);
958 Aver2 = 0.5 * (im2Fwd[i] + im2Bwd[i]);
969 z1HAver[k] = 0.5 * (im1Fwd[i] * HFwdk + im1Bwd[i] * HBwdk);
970 z2HAver[k] = 0.5 * (im2Fwd[i] * HFwdk + im2Bwd[i] * HBwdk);
986 tmpFwd +=
m_MFtraceFwd[2][k][i] * (n1e1_times_z1HAver[k] / Aver1 +
987 n2e2_times_z2HAver[k] / Aver2);
988 tmpBwd +=
m_MFtraceBwd[2][k][i] * (n1e1_times_z1HAver[k] / Aver1 +
989 n2e2_times_z2HAver[k] / Aver2);
992 outarrayFwd[i] = tmpFwd;
993 outarrayBwd[i] = tmpBwd;
1018 NekDouble Aver, HFwdk, HBwdk, tmpFwd, tmpBwd;
1019 for (
int i = 0; i < nTraceNumPoints; ++i)
1021 Aver = 0.5 * (imFwd[i] + imBwd[i]);
1030 dH[k] = HFwdk - HBwdk;
1053 tmpFwd += eiFwd[k] * ntimeseitimesdHFwd[k];
1054 tmpBwd += eiBwd[k] * ntimeseitimesdHBwd[k];
1057 outarrayFwd[i] = 0.5 *
m_alpha * tmpFwd / Aver;
1058 outarrayBwd[i] = 0.5 *
m_alpha * tmpBwd / Aver;
1078 for (
int i = 0; i < nTraceNumPoints; ++i)
1080 Aver1 = im1Fwd[i] + im1Bwd[i];
1081 Aver2 = im2Fwd[i] + im2Bwd[i];
1084 -
m_alpha * (Fwd[2][i] - Bwd[2][i]) * (1.0 / Aver1 + 1.0 / Aver2);
1086 -
m_alpha * (Fwd[2][i] - Bwd[2][i]) * (1.0 / Aver1 + 1.0 / Aver2);
1106 m_fields[0]->GetFwdBwdTracePhys(epsvec[0], Fwdeps, Bwdeps);
1107 m_fields[0]->GetFwdBwdTracePhys(muvec[0], Fwdeps, Bwdeps);
1123 for (
int i = 0; i < nTraceNumPoints; ++i)
1172 m_fields[0]->GetFwdBwdTracePhys(muvec[0], Fwdmu1, Bwdmu1);
1173 m_fields[0]->GetFwdBwdTracePhys(muvec[1], Fwdmu2, Bwdmu2);
1174 m_fields[0]->GetFwdBwdTracePhys(epsvec[2], Fwdeps3,
1183 for (
int i = 0; i < nTraceNumPoints; ++i)
1209 m_fields[0]->GetFwdBwdTracePhys(epsvec[0], Fwdeps1,
1211 m_fields[0]->GetFwdBwdTracePhys(epsvec[1], Fwdeps2,
1213 m_fields[0]->GetFwdBwdTracePhys(muvec[2], Fwdmu3, Bwdmu3);
1219 for (
int i = 0; i < nTraceNumPoints; ++i)
1240 std::cout <<
"*** ZimFwd0 = [ "
1243 <<
" ], ZimBwd0 = [ "
1247 std::cout <<
"*** ZimFwd1 = [ "
1250 <<
" ], ZimBwd1 = [ "
1271 for (
int indm = 0; indm < MFdim; ++indm)
1275 for (
int indj = 0; indj < MFdim; ++indj)
1279 for (
int indn = 0; indn < MFdim; ++indn)
1290 for (
int indm = 0; indm < MFdim; ++indm)
1292 for (
int indj = 0; indj < MFdim; ++indj)
1294 for (
int indn = 0; indn < MFdim; ++indn)
1317 std::cout <<
"*** m_dedxi_cdot_e[0]/dxi1 = ( "
1322 std::cout <<
"*** m_dedxi_cdot_e[0]/dxi2 = ( "
1329 std::cout <<
"*** m_dedxi_cdot_e[1]/dxi1 = ( "
1334 std::cout <<
"*** m_dedxi_cdot_e[1]/dxi2 = ( "
1341 std::cout <<
"*** m_dedxi_cdot_e[2]/dxi1 = ( "
1346 std::cout <<
"*** m_dedxi_cdot_e[2]/dxi2 = ( "
1368 Vmath::Vmul(nq, &physarray[0][0], 1, &physarray[0][0], 1, &normH[0], 1);
1369 Vmath::Vvtvp(nq, &physarray[1][0], 1, &physarray[1][0], 1, &normH[0], 1,
1374 for (
int i = 0; i < nq; ++i)
1378 NormedH1[i] = physarray[0][i] / normH[i];
1379 NormednegH2[i] = -1.0 * physarray[1][i] / normH[i];
1388 &de1dtcdotej[0], 1);
1390 &de1dtcdotej[0], 1, &de1dtcdotej[0], 1);
1395 &de2dtcdotej[0], 1);
1397 &de2dtcdotej[0], 1, &de2dtcdotej[0], 1);
1400 Vmath::Vmul(nq, &physarray[0][0], 1, &de1dtcdotej[0], 1, &dedtej[0], 1);
1401 Vmath::Vvtvp(nq, &physarray[1][0], 1, &de2dtcdotej[0], 1, &dedtej[0], 1,
1440 Vmath::Vadd(nq, &dedtej[0], 1, &outarray[j][0], 1, &outarray[j][0], 1);
1457 for (i = 0; i < nvar; ++i)
1464 for (i = 0; i < nvar; ++i)
1466 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd[i], Bwd[i]);
1478 Vmath::Vsub(nTraceNumPoints, &Fwd[0][0], 1, &Bwd[0][0], 1, &dE[0], 1);
1479 Vmath::Vsub(nTraceNumPoints, &Fwd[1][0], 1, &Bwd[1][0], 1, &dH[0], 1);
1481 NekDouble nx, AverZ, AverY, AverZH, AverYE;
1482 for (i = 0; i < nTraceNumPoints; ++i)
1490 numfluxFwd[0][i] = nx / AverZ * (AverZH - nx * dE[i]);
1491 numfluxFwd[1][i] = nx / AverY * (AverYE - nx * dH[i]);
1493 numfluxBwd[0][i] = nx / AverZ * (AverZH - nx * dE[i]);
1494 numfluxBwd[1][i] = nx / AverY * (AverYE - nx * dH[i]);
1511 for (i = 0; i < nvar; ++i)
1518 for (i = 0; i < nvar; ++i)
1520 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd[i], Bwd[i]);
1532 Vmath::Vsub(nTraceNumPoints, &Fwd[0][0], 1, &Bwd[0][0], 1, &dE[0], 1);
1533 Vmath::Vsub(nTraceNumPoints, &Fwd[1][0], 1, &Bwd[1][0], 1, &dH[0], 1);
1536 for (i = 0; i < nTraceNumPoints; ++i)
1540 0.5 * nx * ((Fwd[1][i] + Bwd[1][i]) - nx *
m_YimFwd[0][i] * dE[i]);
1542 0.5 * nx * ((Fwd[0][i] + Bwd[0][i]) - nx *
m_ZimFwd[0][i] * dH[i]);
1545 0.5 * nx * ((Fwd[1][i] + Bwd[1][i]) - nx *
m_YimFwd[0][i] * dE[i]);
1547 0.5 * nx * ((Fwd[0][i] + Bwd[0][i]) - nx *
m_ZimFwd[0][i] * dH[i]);
1564 for (i = 0; i < nvar; ++i)
1571 for (i = 0; i < nvar; ++i)
1573 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd[i], Bwd[i]);
1582 for (i = 0; i < nTraceNumPoints; ++i)
1584 numfluxFwd[0][i] = 0.5 *
m_traceNormals[0][i] * (Fwd[1][i] + Bwd[1][i]);
1585 numfluxFwd[1][i] = 0.5 *
m_traceNormals[0][i] * (Fwd[0][i] + Bwd[0][i]);
1587 numfluxBwd[0][i] = 0.5 *
m_traceNormals[0][i] * (Fwd[1][i] + Bwd[1][i]);
1588 numfluxBwd[1][i] = 0.5 *
m_traceNormals[0][i] * (Fwd[0][i] + Bwd[0][i]);
1626 int nq =
m_fields[0]->GetTotPoints();
1660 int nq =
m_fields[0]->GetTotPoints();
1709 ASSERTL0(
false,
"GetFluxVector2D: illegal vector index");
1748 "populate switch statement for upwind flux");
1795 int nq =
m_fields[0]->GetNpoints();
1797 int nvar = physfield.size();
1802 for (
int i = 0; i < nvar; ++i)
1808 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd[i], Bwd[i]);
1820 m_fields[0]->GetFwdBwdTracePhys(IncField, IncFieldFwd[i], IncFieldBwd);
1822 Vmath::Svtvp(nTraceNumPoints, 2.0, &IncFieldFwd[i][0], 1, &Fwd[i][0], 1,
1823 &IncFieldFwd[i][0], 1);
1863 m_ZimBwd[1], numfluxFwd[2], numfluxBwd[2]);
1868 e1Fwd_cdot_ncrossdH, e1Bwd_cdot_ncrossdH);
1870 e2Fwd_cdot_ncrossdH, e2Bwd_cdot_ncrossdH);
1874 m_ZimBwd[1], e3Fwd_cdot_dEe3, e3Bwd_cdot_dEe3);
1876 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxFwd[0], 1, e1Fwd_cdot_ncrossdH,
1877 1, numfluxFwd[0], 1);
1878 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxFwd[1], 1, e2Fwd_cdot_ncrossdH,
1879 1, numfluxFwd[1], 1);
1880 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxFwd[2], 1, e3Fwd_cdot_dEe3, 1,
1883 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxBwd[0], 1, e1Bwd_cdot_ncrossdH,
1884 1, numfluxBwd[0], 1);
1885 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxBwd[1], 1, e2Bwd_cdot_ncrossdH,
1886 1, numfluxBwd[1], 1);
1887 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxBwd[2], 1, e3Bwd_cdot_dEe3, 1,
1897 int nq =
m_fields[0]->GetNpoints();
1899 int nvar = physfield.size();
1904 for (
int i = 0; i < nvar; ++i)
1910 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd[i], Bwd[i]);
1922 m_fields[0]->GetFwdBwdTracePhys(IncField, IncFieldFwd[i], IncFieldBwd);
1924 Vmath::Svtvp(nTraceNumPoints, 2.0, &IncFieldFwd[i][0], 1, &Fwd[i][0], 1,
1925 &IncFieldFwd[i][0], 1);
1966 m_YimBwd[1], numfluxFwd[2], numfluxBwd[2]);
1971 e1Fwd_cdot_ncrossdE, e1Bwd_cdot_ncrossdE);
1973 e2Fwd_cdot_ncrossdE, e2Bwd_cdot_ncrossdE);
1977 m_YimBwd[1], e3Fwd_cdot_dHe3, e3Bwd_cdot_dHe3);
1979 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxFwd[0], 1, e1Fwd_cdot_ncrossdE, 1,
1981 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxFwd[1], 1, e2Fwd_cdot_ncrossdE, 1,
1983 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxFwd[2], 1, e3Fwd_cdot_dHe3, 1,
1986 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxBwd[0], 1, e1Bwd_cdot_ncrossdE, 1,
1988 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxBwd[1], 1, e2Bwd_cdot_ncrossdE, 1,
1990 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxBwd[2], 1, e3Bwd_cdot_dHe3, 1,
1997 int nq =
m_fields[0]->GetNpoints();
2003 m_fields[0]->GetCoords(x0, x1, x2);
2012 for (
int i = 0; i < nq; i++)
2014 SmoothFactor[i] = 1.0 / (1.0 + exp(-1.0 * (time - 1.0) / 0.1));
2023 for (
int i = 0; i < nq; i++)
2025 xp = x0[i] - xmin - time -
m_SFinit;
2029 2.0 / (1.0 + exp(0.5 * (
sqrt(xp * xp) - 0.1)));
2034 SmoothFactor[i] = 1.0;
2074 for (
int i = 0; i < nq; i++)
2079 cs = SmoothFactor[i] * cos(
m_Incfreq * (x0[i] - time));
2080 sn = SmoothFactor[i] * sin(
m_Incfreq * (x0[i] - time));
2082 F1[i] = -1.0 * cs * e1y;
2083 F2[i] = -1.0 * cs * e2y;
2090 F1int[i] = (1.0 /
m_Incfreq) * sn * e1y;
2091 F2int[i] = (1.0 /
m_Incfreq) * sn * e2y;
2107 for (
int i = 0; i < nq; i++)
2112 cs = SmoothFactor[i] * cos(
m_Incfreq * (x0[i] - time));
2113 sn = SmoothFactor[i] * sin(
m_Incfreq * (x0[i] - time));
2123 F1int[i] = (-1.0 /
m_Incfreq) * sn * e1y;
2124 F2int[i] = (-1.0 /
m_Incfreq) * sn * e2y;
2149 for (
int i = 0; i < nq; i++)
2154 cs = SmoothFactor[i] * cos(
m_Incfreq * (x0[i] - time));
2155 sn = SmoothFactor[i] * sin(
m_Incfreq * (x0[i] - time));
2157 F1[i] = -1.0 * sn * e1y;
2158 F2[i] = -1.0 * sn * e2y;
2165 F1int[i] = (-1.0 /
m_Incfreq) * cs * e1y;
2166 F2int[i] = (-1.0 /
m_Incfreq) * cs * e2y;
2182 for (
int i = 0; i < nq; i++)
2187 cs = SmoothFactor[i] * cos(
m_Incfreq * (x0[i] - time));
2188 sn = SmoothFactor[i] * sin(
m_Incfreq * (x0[i] - time));
2198 F1int[i] = (1.0 /
m_Incfreq) * cs * e1y;
2199 F2int[i] = (1.0 /
m_Incfreq) * cs * e2y;
2283 int nq =
m_fields[0]->GetNpoints();
2286 if (inarray.size() != nq)
2288 ASSERTL0(
false,
"AvgInt Error: Vector size is not correct");
2293 return (
m_fields[0]->Integral(inarray)) / jac;
2298 int nq =
m_fields[0]->GetNpoints();
2302 if (inarray.size() != nq)
2304 ASSERTL0(
false,
"AvgAbsInt Error: Vector size is not correct");
2310 return (
m_fields[0]->Integral(tmp)) / jac;
2315 int nq =
m_fields[0]->GetNpoints();
2318 if (inarray.size() != nq)
2320 ASSERTL0(
false,
"AbsIntegral Error: Vector size is not correct");
2329 int Ntot = inarray.size();
2332 for (
int i = 0; i < Ntot; ++i)
2334 reval = reval + inarray[i] * inarray[i];
2336 reval =
sqrt(reval / Ntot);
2344 int nq = inarray[0].size();
2349 Vmath::Vvtvp(nq, &inarray[k][0], 1, &inarray[k][0], 1, &tmp[0], 1,
2360 int nq = refarray.size();
2362 bool swapped =
true;
2370 for (
int i = 0; i < nq - j; i++)
2372 if (refarray[i] > refarray[i + 1])
2375 refarray[i] = refarray[i + 1];
2376 refarray[i + 1] = tmp;
2379 sortarray[i] = sortarray[i + 1];
2380 sortarray[i + 1] = tmp;
2394 int nq = v1[0].size();
2401 Vmath::Vvtvp(nq, &v1[i][0], 1, &v2[i][0], 1, &tmp[0], 1, &tmp[0], 1);
2402 Vmath::Vvtvp(nq, &v1[i][0], 1, &v1[i][0], 1, &mag[0], 1, &mag[0], 1);
2404 Vmath::Vdiv(nq, &tmp[0], 1, &mag[0], 1, &tmp[0], 1);
2413 Vmath::Vvtvp(nq, &tmp[0], 1, &v1[i][0], 1, &v2[i][0], 1,
2414 &outarray[i][0], 1);
2417 if (KeepTheMagnitude)
2424 Vmath::Vmul(nq, &v2[0][0], 1, &v2[0][0], 1, &magorig[0], 1);
2425 Vmath::Vvtvp(nq, &v2[1][0], 1, &v2[1][0], 1, &magorig[0], 1,
2427 Vmath::Vvtvp(nq, &v2[2][0], 1, &v2[2][0], 1, &magorig[0], 1,
2430 Vmath::Vmul(nq, &outarray[0][0], 1, &outarray[0][0], 1, &magnew[0],
2432 Vmath::Vvtvp(nq, &outarray[1][0], 1, &outarray[1][0], 1, &magnew[0],
2434 Vmath::Vvtvp(nq, &outarray[2][0], 1, &outarray[2][0], 1, &magnew[0],
2440 for (
int j = 0; j < nq; ++j)
2442 if (fabs(magnew[j]) > 0.000000001)
2445 outarray[i][j] *
sqrt(magorig[j] / magnew[j]);
2454 int nq =
m_fields[0]->GetNpoints();
2487 if (fabs(
m_alpha - 1.0) > 0.001)
#define ASSERTL0(condition, msg)
#define sign(a, b)
return the sign(b)*a
int m_spacedim
Spatial dimension (>= expansion dim).
SOLVER_UTILS_EXPORT int GetTraceNpoints()
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetExpSize()
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
SOLVER_UTILS_EXPORT int GetTotPoints()
SOLVER_UTILS_EXPORT void LaxFriedrichMaxwellFlux1D(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxFwd, Array< OneD, Array< OneD, NekDouble > > &numfluxBwd)
void CheckMovingFrames(const Array< OneD, const Array< OneD, NekDouble > > &movingframes)
SOLVER_UTILS_EXPORT void ComputeNtimesF12(const Array< OneD, Array< OneD, NekDouble > > &Fwd, const Array< OneD, Array< OneD, NekDouble > > &Bwd, const Array< OneD, const NekDouble > &im1Fwd, const Array< OneD, const NekDouble > &im1Bwd, const Array< OneD, const NekDouble > &im2Fwd, const Array< OneD, const NekDouble > &im2Bwd, Array< OneD, NekDouble > &outarrayFwd, Array< OneD, NekDouble > &outarrayBwd)
SOLVER_UTILS_EXPORT void VectorDotProd(const Array< OneD, const Array< OneD, NekDouble > > &v1, const Array< OneD, const Array< OneD, NekDouble > > &v2, Array< OneD, NekDouble > &v3)
SOLVER_UTILS_EXPORT void ComputeCurl(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Array< OneD, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > > m_dedxi_cdot_e
Array< OneD, Array< OneD, NekDouble > > m_ZimFwd
SOLVER_UTILS_EXPORT void BubbleSort(Array< OneD, NekDouble > &refarray, Array< OneD, NekDouble > &sortarray)
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_ntimes_ntimesMFBwd
SOLVER_UTILS_EXPORT void GetMaxwellFluxVector(const int var, const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
Array< OneD, Array< OneD, NekDouble > > m_DivMF
SOLVER_UTILS_EXPORT void ComputeNtimesFz(const int dir, const Array< OneD, Array< OneD, NekDouble > > &Fwd, const Array< OneD, Array< OneD, NekDouble > > &Bwd, const Array< OneD, const NekDouble > &imFwd, const Array< OneD, const NekDouble > &imBwd, Array< OneD, NekDouble > &outarrayFwd, Array< OneD, NekDouble > &outarrayBwd)
SOLVER_UTILS_EXPORT void NumericalMaxwellFluxTM(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxFwd, Array< OneD, Array< OneD, NekDouble > > &numfluxBwd, const NekDouble time)
Array< OneD, Array< OneD, NekDouble > > m_nperpcdotMFFwd
SOLVER_UTILS_EXPORT void GetMaxwellFlux1D(const int var, const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &s) override
Print a summary of time stepping parameters.
SOLVER_UTILS_EXPORT NekDouble AbsIntegral(const Array< OneD, const NekDouble > &inarray)
SOLVER_UTILS_EXPORT void DeriveCrossProductMF(Array< OneD, Array< OneD, NekDouble > > &CrossProductMF)
SOLVER_UTILS_EXPORT void GetMaxwellFlux2D(const int var, const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_ntimes_ntimesMFFwd
SOLVER_UTILS_EXPORT void VectorCrossProd(const Array< OneD, const Array< OneD, NekDouble > > &v1, const Array< OneD, const Array< OneD, NekDouble > > &v2, Array< OneD, Array< OneD, NekDouble > > &v3)
SOLVER_UTILS_EXPORT void NumericalMaxwellFlux(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxFwd, Array< OneD, Array< OneD, NekDouble > > &numfluxBwd, const NekDouble time=0.0)
SOLVER_UTILS_EXPORT NekDouble AvgInt(const Array< OneD, const NekDouble > &inarray)
SOLVER_UTILS_EXPORT void AdddedtMaxwell(const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
SOLVER_UTILS_EXPORT void ComputeZimYim(Array< OneD, Array< OneD, NekDouble > > &epsvec, Array< OneD, Array< OneD, NekDouble > > &muvec)
SOLVER_UTILS_EXPORT MMFSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
SOLVER_UTILS_EXPORT void AverageMaxwellFlux1D(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxFwd, Array< OneD, Array< OneD, NekDouble > > &numfluxBwd)
Array< OneD, Array< OneD, NekDouble > > m_nperpcdotMFBwd
Array< OneD, Array< OneD, NekDouble > > m_YimBwd
SOLVER_UTILS_EXPORT NekDouble VectorAvgMagnitude(const Array< OneD, const Array< OneD, NekDouble > > &inarray)
Array< OneD, Array< OneD, NekDouble > > m_muvec
SpatialDomains::GeomMMF m_MMFdir
SOLVER_UTILS_EXPORT NekDouble AvgAbsInt(const Array< OneD, const NekDouble > &inarray)
Array< OneD, Array< OneD, NekDouble > > m_movingframes
Array< OneD, NekDouble > m_MMFfactors
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_ntimesMFBwd
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_MFtraceFwd
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_MFtraceBwd
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > GetIncidentField(const int var, const NekDouble time)
void SetUpMovingFrames(const Array< OneD, const Array< OneD, NekDouble > > &Anisotropy, const int TangentXelem)
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_ntimesMFFwd
virtual SOLVER_UTILS_EXPORT ~MMFSystem()
SOLVER_UTILS_EXPORT void ComputeDivCurlMF()
SOLVER_UTILS_EXPORT void GramSchumitz(const Array< OneD, const Array< OneD, NekDouble > > &v1, const Array< OneD, const Array< OneD, NekDouble > > &v2, Array< OneD, Array< OneD, NekDouble > > &outarray, bool KeepTheMagnitude=true)
Array< OneD, Array< OneD, NekDouble > > m_ZimBwd
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > CartesianToMovingframes(const Array< OneD, const Array< OneD, NekDouble > > &uvec, unsigned int field)
SOLVER_UTILS_EXPORT void ComputeNtimestimesdF12(const Array< OneD, Array< OneD, NekDouble > > &Fwd, const Array< OneD, Array< OneD, NekDouble > > &Bwd, const Array< OneD, const NekDouble > &im1Fwd, const Array< OneD, const NekDouble > &im1Bwd, const Array< OneD, const NekDouble > &im2Fwd, const Array< OneD, const NekDouble > &im2Bwd, Array< OneD, NekDouble > &outarrayFwd, Array< OneD, NekDouble > &outarrayBwd)
SOLVER_UTILS_EXPORT void CopyBoundaryTrace(const Array< OneD, const NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd, const BoundaryCopyType BDCopyType, const int var=0, const std::string btype="NoUserDefined")
Array< OneD, Array< OneD, NekDouble > > m_ncdotMFBwd
SOLVER_UTILS_EXPORT void ComputeMFtrace()
Array< OneD, Array< OneD, NekDouble > > m_YimFwd
Array< OneD, Array< OneD, NekDouble > > m_epsvec
SOLVER_UTILS_EXPORT void UpwindMaxwellFlux1D(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxFwd, Array< OneD, Array< OneD, NekDouble > > &numfluxBwd)
SOLVER_UTILS_EXPORT void ComputencdotMF()
SOLVER_UTILS_EXPORT void CartesianToSpherical(const NekDouble x0j, const NekDouble x1j, const NekDouble x2j, NekDouble &sin_varphi, NekDouble &cos_varphi, NekDouble &sin_theta, NekDouble &cos_theta)
SOLVER_UTILS_EXPORT void ComputeNtimestimesdFz(const int dir, const Array< OneD, Array< OneD, NekDouble > > &Fwd, const Array< OneD, Array< OneD, NekDouble > > &Bwd, const Array< OneD, const NekDouble > &imFwd, const Array< OneD, const NekDouble > &imBwd, Array< OneD, NekDouble > &outarrayFwd, Array< OneD, NekDouble > &outarrayBwd)
SOLVER_UTILS_EXPORT void NumericalMaxwellFluxTE(Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxFwd, Array< OneD, Array< OneD, NekDouble > > &numfluxBwd, const NekDouble time)
SOLVER_UTILS_EXPORT void ComputeNtimesMF()
SOLVER_UTILS_EXPORT NekDouble RootMeanSquare(const Array< OneD, const NekDouble > &inarray)
SurfaceType m_surfaceType
Array< OneD, Array< OneD, NekDouble > > m_ncdotMFFwd
SOLVER_UTILS_EXPORT void MMFInitObject(const Array< OneD, const Array< OneD, NekDouble > > &Anisotropy, const int TangentXelem=-1)
TestMaxwellType m_TestMaxwellType
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_CurlMF
SOLVER_UTILS_EXPORT void Computedemdxicdote()
Base class for unsteady solvers.
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &s) override
Print a summary of time stepping parameters.
static NekDouble rad(NekDouble x, NekDouble y)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Equation > EquationSharedPtr
const char *const UpwindTypeMap[]
std::vector< std::pair< std::string, std::string > > SummaryList
@ eTestMaxwell2DPECAVGFLUX
@ SIZE_UpwindType
Length of enum list.
@ eAverage
averaged (or centred) flux
@ eLaxFriedrich
Lax-Friedrich flux.
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
const char *const SurfaceTypeMap[]
const char *const GeomMMFMap[]
Session file names associated with tangent principle directions.
@ eLOCAL
No Principal direction.
@ eTangentIrregular
Circular around the centre of domain.
@ eTangentX
X coordinate direction.
@ eTangentCircular
Circular around the centre of domain.
@ eTangentNonconvex
Circular around the centre of domain.
@ eTangentXY
XY direction.
@ eTangentZ
Z coordinate direction.
@ eTangentY
Y coordinate direction.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::vector< double > z(NPUPPER)
The above copyright notice and this permission notice shall be included.
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
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.
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
void Vabs(int n, const T *x, const int incx, T *y, const int incy)
vabs: y = |x|
void Neg(int n, T *x, const int incx)
Negate x = -x.
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
T Vsum(int n, const T *x, const int incx)
Subtract return sum(x)
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 Vvtvm(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvm (vector times vector minus vector): z = w*x - y
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
int Imax(int n, const T *x, const int incx)
Return the index of the maximum element in x.
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.
void Zero(int n, T *x, const int incx)
Zero vector.
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add scalar y = alpha + x.
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
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.
scalarT< T > sqrt(scalarT< T > in)