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")
190 if (TangentXelem > 0)
193 m_fields[0]->GenerateElementVector(TangentXelem, 1.0, 0.0, tmp);
203 m_fields[0]->GenerateElementVector(TangentXelem, 0.0, 1.0, tmp);
210 std::cout <<
"*** MF in PML Region is aligned as MF1 = ( "
236 NekDouble t1x, t1y, t1z, t2x, t2y, t2z, t3x, t3y, t3z;
237 NekDouble dot12 = 0.0, dot23 = 0.0, dot31 = 0.0;
242 for (
int i = 0; i < nq; ++i)
244 t1x = movingframes[0][i];
245 t1y = movingframes[0][i + nq];
246 t1z = movingframes[0][i + 2 * nq];
248 t2x = movingframes[1][i];
249 t2y = movingframes[1][i + nq];
250 t2z = movingframes[1][i + 2 * nq];
252 t3x = movingframes[2][i];
253 t3y = movingframes[2][i + nq];
254 t3z = movingframes[2][i + 2 * nq];
256 dot12 = t1x * t2x + t1y * t2y + t1z * t2z;
257 dot23 = t2x * t3x + t2y * t3y + t2z * t3z;
258 dot31 = t3x * t1x + t3y * t1y + t3z * t1z;
261 std::cout <<
"======================================================"
263 std::cout <<
"======================================================"
265 std::cout <<
"*** The first moving frame is alinged along"
272 Vmath::Vcopy(nq, &movingframes[0][2 * nq], 1, &tmpz[0], 1);
273 std::cout << nq <<
" , "
274 <<
"*** Avg MF1 = ( " <<
AvgAbsInt(tmpx) <<
" , "
280 Vmath::Vcopy(nq, &movingframes[1][2 * nq], 1, &tmpz[0], 1);
281 std::cout <<
"*** Avg MF2 = ( " <<
AvgAbsInt(tmpx) <<
" , "
289 Vmath::Vcopy(nq, &movingframes[2][2 * nq], 1, &tmpz[0], 1);
290 std::cout <<
"*** Avg MF3 = ( " <<
AvgAbsInt(tmpx) <<
" , "
295 if ((fabs(dot12) + fabs(dot23) + fabs(dot31)) < Tol)
297 std::cout <<
"*** Moving frames are Orthogonal" << std::endl;
302 std::cout <<
"*** Moving frames are NOT Orthogonal" << std::endl;
312 &movingframes[j][k * nq], 1, &tmp[0], 1, &tmp[0], 1);
315 std::cout <<
"*** Avg. Magnitude of MF" << j <<
" = " <<
AvgAbsInt(tmp)
351 m_fields[0]->GetFwdBwdTracePhys(tmp, MFtraceFwd[j][k],
382 &SurfaceNormal[k][0], 1);
407 std::cout <<
"*** m_nperpcdotMFFwd = ( "
410 std::cout <<
"*** m_nperpcdotMFBwd = ( "
417 std::cout <<
"*** m_ncdotMFFwd = ( "
422 std::cout <<
"*** m_ncdotMFBwd = ( "
428 std::cout <<
"*** m_nperpcdotMFFwd = ( "
434 <<
" ) " << std::endl;
435 std::cout <<
"*** m_nperpcdotMFBwd = ( "
441 <<
" ) " << std::endl;
454 for (
int j = 0; j < MMFdim; ++j)
461 m_fields[0]->PhysDeriv(k, tmp, Dtmp);
466 std::cout <<
"*** Divergence of MF1 = " <<
AvgInt(
m_DivMF[0])
472 for (
int i = 0; i < MMFdim; ++i)
476 for (
int j = 0; j < MMFdim; ++j)
491 for (
int dir = 0; dir < MMFdim; dir++)
500 for (
int j = 0; j < MMFdim; ++j)
505 &CurlMFtmp[i][0], 1, &
m_CurlMF[dir][j][0], 1,
511 std::cout <<
"*** Curl of MF1 = ( " <<
AvgInt(
m_CurlMF[0][0]) <<
" , "
513 <<
" ) " << std::endl;
514 std::cout <<
"*** Curl of MF2 = ( " <<
AvgInt(
m_CurlMF[1][0]) <<
" , "
516 <<
" ) " << std::endl;
517 std::cout <<
"*** Curl of MF3 = ( " <<
AvgInt(
m_CurlMF[2][0]) <<
" , "
519 <<
" ) " << std::endl;
536 for (
int j = 0; j < MFdim; ++j)
543 for (
int j = 0; j < MFdim; ++j)
552 m_fields[0]->GetFwdBwdTracePhys(tmp, Fwdtmp, Bwdtmp);
583 for (
int j = 0; j < MFdim; ++j)
608 for (
int j = 0; j < MFdim; ++j)
612 Vmath::Vcopy(nq, &MFtmpCurl[j][k][0], 1, &CrossProductMF[j][k * nq],
629 for (
int j = 0; j < MFdim; ++j)
662 std::cout <<
"*** m_ntimes_ntimesMFFwd = ( "
667 std::cout <<
"*** m_ntimes_ntimesMFBwd = ( "
679 int coordim = v1.size();
680 int nq = v1[0].size();
683 for (
int i = 0; i < coordim; ++i)
685 Vmath::Vvtvp(nq, &v1[i][0], 1, &v2[i][0], 1, &v3[0], 1, &v3[0], 1);
702 ASSERTL0(v1.size() == 3,
"Input 1 has dimension not equal to 3.");
703 ASSERTL0(v2.size() == 3,
"Input 2 has dimension not equal to 3.");
705 "Output vector has dimension not equal to 3.");
707 int nq = v1[0].size();
711 Vmath::Vvtvm(nq, v1[1], 1, v2[2], 1, temp, 1, v3[0], 1);
714 Vmath::Vvtvm(nq, v1[2], 1, v2[0], 1, temp, 1, v3[1], 1);
717 Vmath::Vvtvm(nq, v1[0], 1, v2[1], 1, temp, 1, v3[2], 1);
724 ASSERTL0(v1.size() == 3,
"Input 1 has dimension not equal to 3.");
725 ASSERTL0(v2.size() == 3,
"Input 2 has dimension not equal to 3.");
727 "Output vector has dimension not equal to 3.");
729 v3[0] = v1[1] * v2[2] - v1[2] * v2[1];
730 v3[1] = v1[2] * v2[0] - v1[0] * v2[2];
731 v3[2] = v1[0] * v2[1] - v1[1] * v2[0];
739 int nq = inarray[0].size();
761 m_fields[0]->PhysDeriv(0, tmpz, Dtmpzdx);
762 m_fields[0]->PhysDeriv(0, tmpy, Dtmpydx);
763 m_fields[0]->PhysDeriv(1, tmpx, Dtmpxdy);
764 m_fields[0]->PhysDeriv(1, tmpz, Dtmpzdy);
765 m_fields[0]->PhysDeriv(2, tmpx, Dtmpxdz);
766 m_fields[0]->PhysDeriv(2, tmpy, Dtmpydz);
768 Vmath::Vsub(nq, &Dtmpzdy[0], 1, &Dtmpydz[0], 1, &outarray[0][0], 1);
769 Vmath::Vsub(nq, &Dtmpxdz[0], 1, &Dtmpzdx[0], 1, &outarray[1][0], 1);
770 Vmath::Vsub(nq, &Dtmpydx[0], 1, &Dtmpxdy[0], 1, &outarray[2][0], 1);
785 &outarray[0], 1, &outarray[0], 1);
787 &outarray[0], 1, &outarray[0], 1);
808 radius =
sqrt(x0j * x0j / (m_Xscale * m_Xscale) +
809 x1j * x1j / (m_Yscale * m_Yscale) +
810 x2j * x2j / (m_Zscale * m_Zscale));
811 radxy =
sqrt(x0j * x0j / (m_Xscale * m_Xscale) +
812 x1j * x1j / (m_Yscale * m_Yscale));
816 sin_varphi = x1j / (radxy * m_Yscale);
817 cos_varphi = x0j / (radxy * m_Xscale);
834 sin_theta = x2j / (radius * m_Zscale);
835 cos_theta = radxy / radius;
841 const std::string BDtype)
843 int id1, id2, npts, nptselem, cnt = 0, bdrycnt = 0;
847 for (
int n = 0; n <
m_fields[var]->GetBndConditions().size(); ++n)
849 nptselem =
m_fields[var]->GetBndCondExpansions()[n]->GetNpoints();
858 m_fields[var]->GetBndCondExpansions()[n]->GetCoords(x0, x1, x2);
860 m_session->GetFunction(
"BoundaryConditions", 0);
861 ifunc->Evaluate(x0, x1, x2, 0.0, Dirichlet);
868 ->GetBndCondExpansions()[n]
871 id1 =
m_fields[var]->GetBndCondExpansions()[n]->GetPhys_Offset(e);
872 id2 =
m_fields[var]->GetTrace()->GetPhys_Offset(
873 m_fields[var]->GetTraceMap()->GetBndCondIDToGlobalTraceID(
876 if (
m_fields[var]->GetBndConditions()[n]->GetUserDefined() ==
877 BDtype || BDtype ==
"NoUserDefined")
909 cnt +=
m_fields[var]->GetBndCondExpansions()[n]->GetExpSize();
928 for (
int i = 0; i < nTraceNumPoints; ++i)
930 Aver = 0.5 * (imFwd[i] + imBwd[i]);
936 ntimesz = 0.5 * (imFwd[i] * Fwd[2][i] + imBwd[i] * Bwd[2][i]);
944 outarrayFwd[i] = tmpFwd / Aver;
945 outarrayBwd[i] = tmpBwd / Aver;
961 NekDouble tmpFwd, tmpBwd, Aver1, Aver2, HFwdk, HBwdk;
971 for (
int i = 0; i < nTraceNumPoints; ++i)
973 Aver1 = 0.5 * (im1Fwd[i] + im1Bwd[i]);
974 Aver2 = 0.5 * (im2Fwd[i] + im2Bwd[i]);
985 z1HAver[k] = 0.5 * (im1Fwd[i] * HFwdk + im1Bwd[i] * HBwdk);
986 z2HAver[k] = 0.5 * (im2Fwd[i] * HFwdk + im2Bwd[i] * HBwdk);
1002 tmpFwd +=
m_MFtraceFwd[2][k][i] * (n1e1_times_z1HAver[k] / Aver1 +
1003 n2e2_times_z2HAver[k] / Aver2);
1004 tmpBwd +=
m_MFtraceBwd[2][k][i] * (n1e1_times_z1HAver[k] / Aver1 +
1005 n2e2_times_z2HAver[k] / Aver2);
1008 outarrayFwd[i] = tmpFwd;
1009 outarrayBwd[i] = tmpBwd;
1034 NekDouble Aver, HFwdk, HBwdk, tmpFwd, tmpBwd;
1035 for (
int i = 0; i < nTraceNumPoints; ++i)
1037 Aver = 0.5 * (imFwd[i] + imBwd[i]);
1046 dH[k] = HFwdk - HBwdk;
1069 tmpFwd += eiFwd[k] * ntimeseitimesdHFwd[k];
1070 tmpBwd += eiBwd[k] * ntimeseitimesdHBwd[k];
1073 outarrayFwd[i] = 0.5 *
m_alpha * tmpFwd / Aver;
1074 outarrayBwd[i] = 0.5 *
m_alpha * tmpBwd / Aver;
1094 for (
int i = 0; i < nTraceNumPoints; ++i)
1096 Aver1 = im1Fwd[i] + im1Bwd[i];
1097 Aver2 = im2Fwd[i] + im2Bwd[i];
1100 -
m_alpha * (Fwd[2][i] - Bwd[2][i]) * (1.0 / Aver1 + 1.0 / Aver2);
1102 -
m_alpha * (Fwd[2][i] - Bwd[2][i]) * (1.0 / Aver1 + 1.0 / Aver2);
1122 m_fields[0]->GetFwdBwdTracePhys(epsvec[0], Fwdeps, Bwdeps);
1123 m_fields[0]->GetFwdBwdTracePhys(muvec[0], Fwdeps, Bwdeps);
1139 for (
int i = 0; i < nTraceNumPoints; ++i)
1188 m_fields[0]->GetFwdBwdTracePhys(muvec[0], Fwdmu1, Bwdmu1);
1189 m_fields[0]->GetFwdBwdTracePhys(muvec[1], Fwdmu2, Bwdmu2);
1190 m_fields[0]->GetFwdBwdTracePhys(epsvec[2], Fwdeps3,
1199 for (
int i = 0; i < nTraceNumPoints; ++i)
1225 m_fields[0]->GetFwdBwdTracePhys(epsvec[0], Fwdeps1,
1227 m_fields[0]->GetFwdBwdTracePhys(epsvec[1], Fwdeps2,
1229 m_fields[0]->GetFwdBwdTracePhys(muvec[2], Fwdmu3, Bwdmu3);
1235 for (
int i = 0; i < nTraceNumPoints; ++i)
1256 std::cout <<
"*** ZimFwd0 = [ "
1259 <<
" ], ZimBwd0 = [ "
1263 std::cout <<
"*** ZimFwd1 = [ "
1266 <<
" ], ZimBwd1 = [ "
1287 for (
int indm = 0; indm < MFdim; ++indm)
1291 for (
int indj = 0; indj < MFdim; ++indj)
1295 for (
int indn = 0; indn < MFdim; ++indn)
1306 for (
int indm = 0; indm < MFdim; ++indm)
1308 for (
int indj = 0; indj < MFdim; ++indj)
1310 for (
int indn = 0; indn < MFdim; ++indn)
1333 std::cout <<
"*** m_dedxi_cdot_e[0]/dxi1 = ( "
1338 std::cout <<
"*** m_dedxi_cdot_e[0]/dxi2 = ( "
1345 std::cout <<
"*** m_dedxi_cdot_e[1]/dxi1 = ( "
1350 std::cout <<
"*** m_dedxi_cdot_e[1]/dxi2 = ( "
1357 std::cout <<
"*** m_dedxi_cdot_e[2]/dxi1 = ( "
1362 std::cout <<
"*** m_dedxi_cdot_e[2]/dxi2 = ( "
1384 Vmath::Vmul(nq, &physarray[0][0], 1, &physarray[0][0], 1, &normH[0], 1);
1385 Vmath::Vvtvp(nq, &physarray[1][0], 1, &physarray[1][0], 1, &normH[0], 1,
1390 for (
int i = 0; i < nq; ++i)
1394 NormedH1[i] = physarray[0][i] / normH[i];
1395 NormednegH2[i] = -1.0 * physarray[1][i] / normH[i];
1404 &de1dtcdotej[0], 1);
1406 &de1dtcdotej[0], 1, &de1dtcdotej[0], 1);
1411 &de2dtcdotej[0], 1);
1413 &de2dtcdotej[0], 1, &de2dtcdotej[0], 1);
1416 Vmath::Vmul(nq, &physarray[0][0], 1, &de1dtcdotej[0], 1, &dedtej[0], 1);
1417 Vmath::Vvtvp(nq, &physarray[1][0], 1, &de2dtcdotej[0], 1, &dedtej[0], 1,
1456 Vmath::Vadd(nq, &dedtej[0], 1, &outarray[j][0], 1, &outarray[j][0], 1);
1473 for (i = 0; i < nvar; ++i)
1480 for (i = 0; i < nvar; ++i)
1482 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd[i], Bwd[i]);
1496 Vmath::Vsub(nTraceNumPoints, &Fwd[0][0], 1, &Bwd[0][0], 1, &dE[0], 1);
1497 Vmath::Vsub(nTraceNumPoints, &Fwd[1][0], 1, &Bwd[1][0], 1, &dH[0], 1);
1499 NekDouble nx, AverZ, AverY, AverZH, AverYE;
1500 for (i = 0; i < nTraceNumPoints; ++i)
1508 numfluxFwd[0][i] = nx / AverZ * (AverZH - nx * dE[i]);
1509 numfluxFwd[1][i] = nx / AverY * (AverYE - nx * dH[i]);
1511 numfluxBwd[0][i] = nx / AverZ * (AverZH - nx * dE[i]);
1512 numfluxBwd[1][i] = nx / AverY * (AverYE - nx * dH[i]);
1529 for (i = 0; i < nvar; ++i)
1536 for (i = 0; i < nvar; ++i)
1538 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd[i], Bwd[i]);
1552 Vmath::Vsub(nTraceNumPoints, &Fwd[0][0], 1, &Bwd[0][0], 1, &dE[0], 1);
1553 Vmath::Vsub(nTraceNumPoints, &Fwd[1][0], 1, &Bwd[1][0], 1, &dH[0], 1);
1556 for (i = 0; i < nTraceNumPoints; ++i)
1560 0.5 * nx * ((Fwd[1][i] + Bwd[1][i]) - nx *
m_YimFwd[0][i] * dE[i]);
1562 0.5 * nx * ((Fwd[0][i] + Bwd[0][i]) - nx *
m_ZimFwd[0][i] * dH[i]);
1565 0.5 * nx * ((Fwd[1][i] + Bwd[1][i]) - nx *
m_YimFwd[0][i] * dE[i]);
1567 0.5 * nx * ((Fwd[0][i] + Bwd[0][i]) - nx *
m_ZimFwd[0][i] * dH[i]);
1584 for (i = 0; i < nvar; ++i)
1591 for (i = 0; i < nvar; ++i)
1593 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd[i], Bwd[i]);
1604 for (i = 0; i < nTraceNumPoints; ++i)
1606 numfluxFwd[0][i] = 0.5 *
m_traceNormals[0][i] * (Fwd[1][i] + Bwd[1][i]);
1607 numfluxFwd[1][i] = 0.5 *
m_traceNormals[0][i] * (Fwd[0][i] + Bwd[0][i]);
1609 numfluxBwd[0][i] = 0.5 *
m_traceNormals[0][i] * (Fwd[1][i] + Bwd[1][i]);
1610 numfluxBwd[1][i] = 0.5 *
m_traceNormals[0][i] * (Fwd[0][i] + Bwd[0][i]);
1648 int nq =
m_fields[0]->GetTotPoints();
1682 int nq =
m_fields[0]->GetTotPoints();
1731 ASSERTL0(
false,
"GetFluxVector2D: illegal vector index");
1770 "populate switch statement for upwind flux");
1817 int nq =
m_fields[0]->GetNpoints();
1819 int nvar = physfield.size();
1824 for (
int i = 0; i < nvar; ++i)
1830 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd[i], Bwd[i]);
1842 m_fields[0]->GetFwdBwdTracePhys(IncField, IncFieldFwd[i], IncFieldBwd);
1844 Vmath::Svtvp(nTraceNumPoints, 2.0, &IncFieldFwd[i][0], 1, &Fwd[i][0], 1,
1845 &IncFieldFwd[i][0], 1);
1894 m_ZimBwd[1], numfluxFwd[2], numfluxBwd[2]);
1899 e1Fwd_cdot_ncrossdH, e1Bwd_cdot_ncrossdH);
1901 e2Fwd_cdot_ncrossdH, e2Bwd_cdot_ncrossdH);
1905 m_ZimBwd[1], e3Fwd_cdot_dEe3, e3Bwd_cdot_dEe3);
1907 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxFwd[0], 1, e1Fwd_cdot_ncrossdH,
1908 1, numfluxFwd[0], 1);
1909 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxFwd[1], 1, e2Fwd_cdot_ncrossdH,
1910 1, numfluxFwd[1], 1);
1911 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxFwd[2], 1, e3Fwd_cdot_dEe3, 1,
1914 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxBwd[0], 1, e1Bwd_cdot_ncrossdH,
1915 1, numfluxBwd[0], 1);
1916 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxBwd[1], 1, e2Bwd_cdot_ncrossdH,
1917 1, numfluxBwd[1], 1);
1918 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxBwd[2], 1, e3Bwd_cdot_dEe3, 1,
1928 int nq =
m_fields[0]->GetNpoints();
1930 int nvar = physfield.size();
1935 for (
int i = 0; i < nvar; ++i)
1941 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd[i], Bwd[i]);
1953 m_fields[0]->GetFwdBwdTracePhys(IncField, IncFieldFwd[i], IncFieldBwd);
1955 Vmath::Svtvp(nTraceNumPoints, 2.0, &IncFieldFwd[i][0], 1, &Fwd[i][0], 1,
1956 &IncFieldFwd[i][0], 1);
2006 m_YimBwd[1], numfluxFwd[2], numfluxBwd[2]);
2011 e1Fwd_cdot_ncrossdE, e1Bwd_cdot_ncrossdE);
2013 e2Fwd_cdot_ncrossdE, e2Bwd_cdot_ncrossdE);
2017 m_YimBwd[1], e3Fwd_cdot_dHe3, e3Bwd_cdot_dHe3);
2019 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxFwd[0], 1, e1Fwd_cdot_ncrossdE, 1,
2021 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxFwd[1], 1, e2Fwd_cdot_ncrossdE, 1,
2023 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxFwd[2], 1, e3Fwd_cdot_dHe3, 1,
2026 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxBwd[0], 1, e1Bwd_cdot_ncrossdE, 1,
2028 Vmath::Svtvp(nTraceNumPoints, 1.0, numfluxBwd[1], 1, e2Bwd_cdot_ncrossdE, 1,
2030 Vmath::Svtvp(nTraceNumPoints, -1.0, numfluxBwd[2], 1, e3Bwd_cdot_dHe3, 1,
2037 int nq =
m_fields[0]->GetNpoints();
2043 m_fields[0]->GetCoords(x0, x1, x2);
2052 for (
int i = 0; i < nq; i++)
2054 SmoothFactor[i] = 1.0 / (1.0 + exp(-1.0 * (time - 1.0) / 0.1));
2063 for (
int i = 0; i < nq; i++)
2065 xp = x0[i] - xmin - time -
m_SFinit;
2069 2.0 / (1.0 + exp(0.5 * (
sqrt(xp * xp) - 0.1)));
2074 SmoothFactor[i] = 1.0;
2114 for (
int i = 0; i < nq; i++)
2119 cs = SmoothFactor[i] * cos(
m_Incfreq * (x0[i] - time));
2120 sn = SmoothFactor[i] * sin(
m_Incfreq * (x0[i] - time));
2122 F1[i] = -1.0 * cs * e1y;
2123 F2[i] = -1.0 * cs * e2y;
2130 F1int[i] = (1.0 /
m_Incfreq) * sn * e1y;
2131 F2int[i] = (1.0 /
m_Incfreq) * sn * e2y;
2147 for (
int i = 0; i < nq; i++)
2152 cs = SmoothFactor[i] * cos(
m_Incfreq * (x0[i] - time));
2153 sn = SmoothFactor[i] * sin(
m_Incfreq * (x0[i] - time));
2163 F1int[i] = (-1.0 /
m_Incfreq) * sn * e1y;
2164 F2int[i] = (-1.0 /
m_Incfreq) * sn * e2y;
2189 for (
int i = 0; i < nq; i++)
2194 cs = SmoothFactor[i] * cos(
m_Incfreq * (x0[i] - time));
2195 sn = SmoothFactor[i] * sin(
m_Incfreq * (x0[i] - time));
2197 F1[i] = -1.0 * sn * e1y;
2198 F2[i] = -1.0 * sn * e2y;
2205 F1int[i] = (-1.0 /
m_Incfreq) * cs * e1y;
2206 F2int[i] = (-1.0 /
m_Incfreq) * cs * e2y;
2222 for (
int i = 0; i < nq; i++)
2227 cs = SmoothFactor[i] * cos(
m_Incfreq * (x0[i] - time));
2228 sn = SmoothFactor[i] * sin(
m_Incfreq * (x0[i] - time));
2238 F1int[i] = (1.0 /
m_Incfreq) * cs * e1y;
2239 F2int[i] = (1.0 /
m_Incfreq) * cs * e2y;
2323 int nq =
m_fields[0]->GetNpoints();
2326 if (inarray.size() != nq)
2328 ASSERTL0(
false,
"AvgInt Error: Vector size is not correct");
2333 return (
m_fields[0]->Integral(inarray)) / jac;
2338 int nq =
m_fields[0]->GetNpoints();
2342 if (inarray.size() != nq)
2344 ASSERTL0(
false,
"AvgAbsInt Error: Vector size is not correct");
2350 return (
m_fields[0]->Integral(tmp)) / jac;
2355 int nq =
m_fields[0]->GetNpoints();
2358 if (inarray.size() != nq)
2360 ASSERTL0(
false,
"AbsIntegral Error: Vector size is not correct");
2369 int Ntot = inarray.size();
2372 for (
int i = 0; i < Ntot; ++i)
2374 reval = reval + inarray[i] * inarray[i];
2376 reval =
sqrt(reval / Ntot);
2384 int nq = inarray[0].size();
2389 Vmath::Vvtvp(nq, &inarray[k][0], 1, &inarray[k][0], 1, &tmp[0], 1,
2400 int nq = refarray.size();
2402 bool swapped =
true;
2410 for (
int i = 0; i < nq - j; i++)
2412 if (refarray[i] > refarray[i + 1])
2415 refarray[i] = refarray[i + 1];
2416 refarray[i + 1] = tmp;
2419 sortarray[i] = sortarray[i + 1];
2420 sortarray[i + 1] = tmp;
2434 int nq = v1[0].size();
2441 Vmath::Vvtvp(nq, &v1[i][0], 1, &v2[i][0], 1, &tmp[0], 1, &tmp[0], 1);
2442 Vmath::Vvtvp(nq, &v1[i][0], 1, &v1[i][0], 1, &mag[0], 1, &mag[0], 1);
2444 Vmath::Vdiv(nq, &tmp[0], 1, &mag[0], 1, &tmp[0], 1);
2453 Vmath::Vvtvp(nq, &tmp[0], 1, &v1[i][0], 1, &v2[i][0], 1,
2454 &outarray[i][0], 1);
2457 if (KeepTheMagnitude)
2464 Vmath::Vmul(nq, &v2[0][0], 1, &v2[0][0], 1, &magorig[0], 1);
2465 Vmath::Vvtvp(nq, &v2[1][0], 1, &v2[1][0], 1, &magorig[0], 1,
2467 Vmath::Vvtvp(nq, &v2[2][0], 1, &v2[2][0], 1, &magorig[0], 1,
2470 Vmath::Vmul(nq, &outarray[0][0], 1, &outarray[0][0], 1, &magnew[0],
2472 Vmath::Vvtvp(nq, &outarray[1][0], 1, &outarray[1][0], 1, &magnew[0],
2474 Vmath::Vvtvp(nq, &outarray[2][0], 1, &outarray[2][0], 1, &magnew[0],
2480 for (
int j = 0; j < nq; ++j)
2482 if (fabs(magnew[j]) > 0.000000001)
2485 outarray[i][j] *
sqrt(magorig[j] / magnew[j]);
2494 int nq =
m_fields[0]->GetNpoints();
2527 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 GetMaxwellFlux2D(const int var, const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, NekDouble >> &flux)
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > CartesianToMovingframes(const Array< OneD, const Array< OneD, NekDouble >> &uvec, unsigned int field)
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)
Array< OneD, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > > m_dedxi_cdot_e
Array< OneD, Array< OneD, NekDouble > > m_ZimFwd
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)
SOLVER_UTILS_EXPORT void BubbleSort(Array< OneD, NekDouble > &refarray, Array< OneD, NekDouble > &sortarray)
SOLVER_UTILS_EXPORT void ComputeZimYim(Array< OneD, Array< OneD, NekDouble >> &epsvec, Array< OneD, Array< OneD, NekDouble >> &muvec)
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_ntimes_ntimesMFBwd
Array< OneD, Array< OneD, NekDouble > > m_DivMF
Array< OneD, Array< OneD, NekDouble > > m_nperpcdotMFFwd
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 GetMaxwellFluxVector(const int var, const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, NekDouble >> &flux)
SOLVER_UTILS_EXPORT NekDouble AbsIntegral(const Array< OneD, const NekDouble > &inarray)
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_ntimes_ntimesMFFwd
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 NekDouble AvgInt(const Array< OneD, const NekDouble > &inarray)
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)
SOLVER_UTILS_EXPORT MMFSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Array< OneD, Array< OneD, NekDouble > > m_nperpcdotMFBwd
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)
void CheckMovingFrames(const Array< OneD, const Array< OneD, NekDouble >> &movingframes)
Array< OneD, Array< OneD, NekDouble > > m_YimBwd
SOLVER_UTILS_EXPORT void DeriveCrossProductMF(Array< OneD, Array< OneD, NekDouble >> &CrossProductMF)
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
SOLVER_UTILS_EXPORT NekDouble VectorAvgMagnitude(const Array< OneD, const Array< OneD, NekDouble >> &inarray)
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_MFtraceBwd
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)
void SetUpMovingFrames(const Array< OneD, const Array< OneD, NekDouble >> &Anisotropy, const int TangentXelem)
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > GetIncidentField(const int var, const NekDouble time)
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_ntimesMFFwd
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 AverageMaxwellFlux1D(Array< OneD, Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, NekDouble >> &numfluxFwd, Array< OneD, Array< OneD, NekDouble >> &numfluxBwd)
SOLVER_UTILS_EXPORT void MMFInitObject(const Array< OneD, const Array< OneD, NekDouble >> &Anisotropy, const int TangentXelem=-1)
virtual SOLVER_UTILS_EXPORT ~MMFSystem()
SOLVER_UTILS_EXPORT void ComputeDivCurlMF()
SOLVER_UTILS_EXPORT void GetMaxwellFlux1D(const int var, const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, NekDouble >> &flux)
SOLVER_UTILS_EXPORT void LaxFriedrichMaxwellFlux1D(Array< OneD, Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, NekDouble >> &numfluxFwd, Array< OneD, Array< OneD, NekDouble >> &numfluxBwd)
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)
Array< OneD, Array< OneD, NekDouble > > m_ZimBwd
SOLVER_UTILS_EXPORT void AdddedtMaxwell(const Array< OneD, const Array< OneD, NekDouble >> &physarray, Array< OneD, Array< OneD, NekDouble >> &outarray)
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()
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 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)
Array< OneD, Array< OneD, NekDouble > > m_YimFwd
Array< OneD, Array< OneD, NekDouble > > m_epsvec
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 ComputeCurl(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray)
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
TestMaxwellType m_TestMaxwellType
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_CurlMF
SOLVER_UTILS_EXPORT void Computedemdxicdote()
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &s)
Print a summary of time stepping parameters.
Base class for unsteady solvers.
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &s)
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
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 plus 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 vector 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)