39 #include <boost/core/ignore_unused.hpp>
40 #include <boost/math/special_functions/gamma.hpp>
41 #include <boost/algorithm/string/predicate.hpp>
95 m_session->LoadParameter (
"thermalConductivity",
104 int nConvectiveFields = pFields.size();
105 int nScalars = nConvectiveFields - 1;
106 int nDim = pFields[0]->GetCoordim(0);
107 int nSolutionPts = pFields[0]->GetTotPoints();
108 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
111 if (pSession->DefinesSolverInfo(
"HOMOGENEOUS"))
152 for (i = 0; i < nScalars; ++i)
161 for (j = 0; j < nDim; ++j)
172 for (i = 0; i < nConvectiveFields; ++i)
180 for (j = 0; j < nDim; ++j)
191 for (j = 0; j < nScalars; ++j)
201 for (j = 0; j < nScalars+1; ++j)
228 boost::ignore_unused(pSession);
233 int nLocalSolutionPts;
234 int nElements = pFields[0]->GetExpSize();
235 int nDimensions = pFields[0]->GetCoordim(0);
236 int nSolutionPts = pFields[0]->GetTotPoints();
237 int nTracePts = pFields[0]->GetTrace()->GetTotPoints();
240 for (i = 0; i < nDimensions; ++i)
259 for (n = 0; n < nElements; ++n)
261 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
262 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
263 phys_offset = pFields[0]->GetPhys_Offset(n);
264 jac = pFields[0]->GetExp(n)
267 for (i = 0; i < nLocalSolutionPts; ++i)
269 m_jac[i+phys_offset] = jac[0];
287 for (n = 0; n < nElements; ++n)
289 base = pFields[0]->GetExp(n)->GetBase();
290 nquad0 = base[0]->GetNumPoints();
291 nquad1 = base[1]->GetNumPoints();
299 pFields[0]->GetExp(n)->GetTraceQFactors(
301 pFields[0]->GetExp(n)->GetTraceQFactors(
303 pFields[0]->GetExp(n)->GetTraceQFactors(
305 pFields[0]->GetExp(n)->GetTraceQFactors(
308 ptsKeys = pFields[0]->GetExp(n)->GetPointsKeys();
309 nLocalSolutionPts = pFields[0]->GetExp(n)->GetTotPoints();
310 phys_offset = pFields[0]->GetPhys_Offset(n);
312 jac = pFields[0]->GetExp(n)
315 gmat = pFields[0]->GetExp(n)
319 if (pFields[0]->GetExp(n)
324 for (i = 0; i < nLocalSolutionPts; ++i)
326 m_jac[i+phys_offset] = jac[i];
327 m_gmat[0][i+phys_offset] = gmat[0][i];
328 m_gmat[1][i+phys_offset] = gmat[1][i];
329 m_gmat[2][i+phys_offset] = gmat[2][i];
330 m_gmat[3][i+phys_offset] = gmat[3][i];
335 for (i = 0; i < nLocalSolutionPts; ++i)
337 m_jac[i+phys_offset] = jac[0];
338 m_gmat[0][i+phys_offset] = gmat[0][0];
339 m_gmat[1][i+phys_offset] = gmat[1][0];
340 m_gmat[2][i+phys_offset] = gmat[2][0];
341 m_gmat[3][i+phys_offset] = gmat[3][0];
349 ASSERTL0(
false,
"3DFR Metric terms not implemented yet");
354 ASSERTL0(
false,
"Expansion dimension not recognised");
380 boost::ignore_unused(pSession);
386 int nquad0, nquad1, nquad2;
387 int nmodes0, nmodes1, nmodes2;
390 int nElements = pFields[0]->GetExpSize();
391 int nDim = pFields[0]->GetCoordim(0);
400 for (n = 0; n < nElements; ++n)
402 base = pFields[0]->GetExp(n)->GetBase();
403 nquad0 = base[0]->GetNumPoints();
404 nmodes0 = base[0]->GetNumModes();
408 base[0]->GetZW(z0, w0);
420 int p0 = nmodes0 - 1;
426 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
428 * boost::math::tgamma(p0 + 1)
429 * boost::math::tgamma(p0 + 1));
438 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
439 * (ap0 * boost::math::tgamma(p0 + 1))
440 * (ap0 * boost::math::tgamma(p0 + 1)));
444 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
445 * (ap0 * boost::math::tgamma(p0 + 1))
446 * (ap0 * boost::math::tgamma(p0 + 1)));
450 c0 = -2.0 / ((2.0 * p0 + 1.0)
451 * (ap0 * boost::math::tgamma(p0 + 1))
452 * (ap0 * boost::math::tgamma(p0 + 1)));
456 c0 = 10000000000000000.0;
459 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
460 * (ap0 * boost::math::tgamma(p0 + 1))
461 * (ap0 * boost::math::tgamma(p0 + 1));
463 NekDouble overeta0 = 1.0 / (1.0 + etap0);
474 for(i = 0; i < nquad0; ++i)
484 for(i = 0; i < nquad0; ++i)
507 for (n = 0; n < nElements; ++n)
509 base = pFields[0]->GetExp(n)->GetBase();
510 nquad0 = base[0]->GetNumPoints();
511 nquad1 = base[1]->GetNumPoints();
512 nmodes0 = base[0]->GetNumModes();
513 nmodes1 = base[1]->GetNumModes();
520 base[0]->GetZW(z0, w0);
521 base[1]->GetZW(z1, w1);
538 int p0 = nmodes0 - 1;
539 int p1 = nmodes1 - 1;
546 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
548 * boost::math::tgamma(p0 + 1)
549 * boost::math::tgamma(p0 + 1));
551 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
553 * boost::math::tgamma(p1 + 1)
554 * boost::math::tgamma(p1 + 1));
564 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
565 * (ap0 * boost::math::tgamma(p0 + 1))
566 * (ap0 * boost::math::tgamma(p0 + 1)));
568 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
569 * (ap1 * boost::math::tgamma(p1 + 1))
570 * (ap1 * boost::math::tgamma(p1 + 1)));
574 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
575 * (ap0 * boost::math::tgamma(p0 + 1))
576 * (ap0 * boost::math::tgamma(p0 + 1)));
578 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
579 * (ap1 * boost::math::tgamma(p1 + 1))
580 * (ap1 * boost::math::tgamma(p1 + 1)));
584 c0 = -2.0 / ((2.0 * p0 + 1.0)
585 * (ap0 * boost::math::tgamma(p0 + 1))
586 * (ap0 * boost::math::tgamma(p0 + 1)));
588 c1 = -2.0 / ((2.0 * p1 + 1.0)
589 * (ap1 * boost::math::tgamma(p1 + 1))
590 * (ap1 * boost::math::tgamma(p1 + 1)));
594 c0 = 10000000000000000.0;
595 c1 = 10000000000000000.0;
598 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
599 * (ap0 * boost::math::tgamma(p0 + 1))
600 * (ap0 * boost::math::tgamma(p0 + 1));
602 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
603 * (ap1 * boost::math::tgamma(p1 + 1))
604 * (ap1 * boost::math::tgamma(p1 + 1));
606 NekDouble overeta0 = 1.0 / (1.0 + etap0);
607 NekDouble overeta1 = 1.0 / (1.0 + etap1);
622 for(i = 0; i < nquad0; ++i)
632 for(i = 0; i < nquad1; ++i)
642 for(i = 0; i < nquad0; ++i)
652 for(i = 0; i < nquad1; ++i)
672 for (n = 0; n < nElements; ++n)
674 base = pFields[0]->GetExp(n)->GetBase();
675 nquad0 = base[0]->GetNumPoints();
676 nquad1 = base[1]->GetNumPoints();
677 nquad2 = base[2]->GetNumPoints();
678 nmodes0 = base[0]->GetNumModes();
679 nmodes1 = base[1]->GetNumModes();
680 nmodes2 = base[2]->GetNumModes();
689 base[0]->GetZW(z0, w0);
690 base[1]->GetZW(z1, w1);
691 base[1]->GetZW(z2, w2);
713 int p0 = nmodes0 - 1;
714 int p1 = nmodes1 - 1;
715 int p2 = nmodes2 - 1;
723 NekDouble ap0 = boost::math::tgamma(2 * p0 + 1)
725 * boost::math::tgamma(p0 + 1)
726 * boost::math::tgamma(p0 + 1));
729 NekDouble ap1 = boost::math::tgamma(2 * p1 + 1)
731 * boost::math::tgamma(p1 + 1)
732 * boost::math::tgamma(p1 + 1));
735 NekDouble ap2 = boost::math::tgamma(2 * p2 + 1)
737 * boost::math::tgamma(p2 + 1)
738 * boost::math::tgamma(p2 + 1));
749 c0 = 2.0 * p0 / ((2.0 * p0 + 1.0) * (p0 + 1.0)
750 * (ap0 * boost::math::tgamma(p0 + 1))
751 * (ap0 * boost::math::tgamma(p0 + 1)));
753 c1 = 2.0 * p1 / ((2.0 * p1 + 1.0) * (p1 + 1.0)
754 * (ap1 * boost::math::tgamma(p1 + 1))
755 * (ap1 * boost::math::tgamma(p1 + 1)));
757 c2 = 2.0 * p2 / ((2.0 * p2 + 1.0) * (p2 + 1.0)
758 * (ap2 * boost::math::tgamma(p2 + 1))
759 * (ap2 * boost::math::tgamma(p2 + 1)));
763 c0 = 2.0 * (p0 + 1.0) / ((2.0 * p0 + 1.0) * p0
764 * (ap0 * boost::math::tgamma(p0 + 1))
765 * (ap0 * boost::math::tgamma(p0 + 1)));
767 c1 = 2.0 * (p1 + 1.0) / ((2.0 * p1 + 1.0) * p1
768 * (ap1 * boost::math::tgamma(p1 + 1))
769 * (ap1 * boost::math::tgamma(p1 + 1)));
771 c2 = 2.0 * (p2 + 1.0) / ((2.0 * p2 + 1.0) * p2
772 * (ap2 * boost::math::tgamma(p2 + 1))
773 * (ap2 * boost::math::tgamma(p2 + 1)));
777 c0 = -2.0 / ((2.0 * p0 + 1.0)
778 * (ap0 * boost::math::tgamma(p0 + 1))
779 * (ap0 * boost::math::tgamma(p0 + 1)));
781 c1 = -2.0 / ((2.0 * p1 + 1.0)
782 * (ap1 * boost::math::tgamma(p1 + 1))
783 * (ap1 * boost::math::tgamma(p1 + 1)));
785 c2 = -2.0 / ((2.0 * p2 + 1.0)
786 * (ap2 * boost::math::tgamma(p2 + 1))
787 * (ap2 * boost::math::tgamma(p2 + 1)));
791 c0 = 10000000000000000.0;
792 c1 = 10000000000000000.0;
793 c2 = 10000000000000000.0;
796 NekDouble etap0 = 0.5 * c0 * (2.0 * p0 + 1.0)
797 * (ap0 * boost::math::tgamma(p0 + 1))
798 * (ap0 * boost::math::tgamma(p0 + 1));
800 NekDouble etap1 = 0.5 * c1 * (2.0 * p1 + 1.0)
801 * (ap1 * boost::math::tgamma(p1 + 1))
802 * (ap1 * boost::math::tgamma(p1 + 1));
804 NekDouble etap2 = 0.5 * c2 * (2.0 * p2 + 1.0)
805 * (ap2 * boost::math::tgamma(p2 + 1))
806 * (ap2 * boost::math::tgamma(p2 + 1));
808 NekDouble overeta0 = 1.0 / (1.0 + etap0);
809 NekDouble overeta1 = 1.0 / (1.0 + etap1);
810 NekDouble overeta2 = 1.0 / (1.0 + etap2);
829 for(i = 0; i < nquad0; ++i)
839 for(i = 0; i < nquad1; ++i)
849 for(i = 0; i < nquad2; ++i)
859 for(i = 0; i < nquad0; ++i)
869 for(i = 0; i < nquad1; ++i)
879 for(i = 0; i < nquad2; ++i)
892 ASSERTL0(
false,
"Expansion dimension not recognised");
907 const std::size_t nConvectiveFields,
914 boost::ignore_unused(pFwd, pBwd);
924 Basis = fields[0]->GetExp(0)->GetBase();
926 int nElements = fields[0]->GetExpSize();
927 int nDim = fields[0]->GetCoordim(0);
928 int nScalars = inarray.size();
929 int nSolutionPts = fields[0]->GetTotPoints();
930 int nCoeffs = fields[0]->GetNcoeffs();
933 for (i = 0; i < nConvectiveFields; ++i)
946 for (i = 0; i < nScalars; ++i)
950 for (n = 0; n < nElements; n++)
952 phys_offset = fields[0]->GetPhys_Offset(n);
954 fields[i]->GetExp(n)->PhysDeriv(0,
955 auxArray1 = inarray[i] + phys_offset,
956 auxArray2 =
m_DU1[i][0] + phys_offset);
986 for (i = 0; i < nConvectiveFields; ++i)
990 for (n = 0; n < nElements; n++)
992 phys_offset = fields[0]->GetPhys_Offset(n);
994 fields[i]->GetExp(n)->PhysDeriv(0,
996 auxArray2 =
m_DD1[i][0] + phys_offset);
1013 &
m_DD1[i][0][0], 1, &outarray[i][0], 1);
1016 if(!(
Basis[0]->Collocation()))
1018 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1019 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1027 for(i = 0; i < nScalars; ++i)
1029 for (j = 0; j < nDim; ++j)
1038 &
m_gmat[0][0], 1, &u1_hat[0], 1);
1041 &
m_jac[0], 1, &u1_hat[0], 1);
1044 &
m_gmat[1][0], 1, &u2_hat[0], 1);
1047 &
m_jac[0], 1, &u2_hat[0], 1);
1052 &
m_gmat[2][0], 1, &u1_hat[0], 1);
1055 &
m_jac[0], 1, &u1_hat[0], 1);
1058 &
m_gmat[3][0], 1, &u2_hat[0], 1);
1061 &
m_jac[0], 1, &u2_hat[0], 1);
1064 for (n = 0; n < nElements; n++)
1066 phys_offset = fields[0]->GetPhys_Offset(n);
1068 fields[i]->GetExp(n)->StdPhysDeriv(0,
1069 auxArray1 = u1_hat + phys_offset,
1070 auxArray2 =
m_tmp1[i][j] + phys_offset);
1072 fields[i]->GetExp(n)->StdPhysDeriv(1,
1073 auxArray1 = u2_hat + phys_offset,
1074 auxArray2 =
m_tmp2[i][j] + phys_offset);
1079 &
m_DU1[i][j][0], 1);
1088 inarray[i],
m_IF1[i][j],
1094 for (j = 0; j < nSolutionPts; ++j)
1117 for (j = 0; j < nSolutionPts; j++)
1131 for (j = 0; j < nDim; ++j)
1142 for (i = 0; i < nScalars; ++i)
1159 for (i = 0; i < nConvectiveFields; ++i)
1165 for (j = 0; j < nSolutionPts; j++)
1174 for (n = 0; n < nElements; n++)
1176 phys_offset = fields[0]->GetPhys_Offset(n);
1178 fields[0]->GetExp(n)->StdPhysDeriv(0,
1179 auxArray1 = f_hat + phys_offset,
1180 auxArray2 =
m_DD1[i][0] + phys_offset);
1182 fields[0]->GetExp(n)->StdPhysDeriv(1,
1183 auxArray1 = g_hat + phys_offset,
1184 auxArray2 =
m_DD1[i][1] + phys_offset);
1192 if (
Basis[0]->GetPointsType() ==
1194 Basis[1]->GetPointsType() ==
1212 &
m_divFC[i][0], 1, &outarray[i][0], 1);
1217 &
m_jac[0], 1, &outarray[i][0], 1);
1220 if(!(
Basis[0]->Collocation()))
1222 fields[i]->FwdTrans(outarray[i], outarrayCoeff[i]);
1223 fields[i]->BwdTrans(outarrayCoeff[i], outarray[i]);
1231 ASSERTL0(
false,
"3D FRDG case not implemented yet");
1249 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1250 int nScalars = inarray.size();
1251 int nDim = fields[0]->GetCoordim(0);
1257 for (i = 0; i < nDim; ++i)
1259 fields[0]->ExtractTracePhys(inarray[i],
m_traceVel[i]);
1269 for (i = 0; i < nScalars; ++i)
1274 fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
1275 fields[0]->GetTrace()->Upwind(Vn, Fwd[i], Bwd[i], numflux[i]);
1279 if (fields[0]->GetBndCondExpansions().size())
1285 for (j = 0; j < nDim; ++j)
1287 for (i = 0; i < nScalars; ++i)
1290 numericalFluxO1[i][j], 1);
1308 int nBndEdgePts, nBndEdges, nBndRegions;
1310 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1311 int nScalars = inarray.size();
1321 for (i = 0; i < nScalars; ++i)
1326 fields[i]->ExtractTracePhys(inarray[i], uplus[i]);
1330 for (i = 0; i < nScalars-1; ++i)
1335 nBndRegions = fields[i+1]->
1336 GetBndCondExpansions().size();
1337 for (j = 0; j < nBndRegions; ++j)
1339 if (fields[i+1]->GetBndConditions()[j]->
1345 nBndEdges = fields[i+1]->
1346 GetBndCondExpansions()[j]->GetExpSize();
1347 for (e = 0; e < nBndEdges; ++e)
1349 nBndEdgePts = fields[i+1]->
1350 GetBndCondExpansions()[j]->GetExp(e)->GetTotPoints();
1353 GetBndCondExpansions()[j]->GetPhys_Offset(e);
1355 id2 = fields[0]->GetTrace()->
1356 GetPhys_Offset(fields[0]->GetTraceMap()->
1357 GetBndCondIDToGlobalTraceID(cnt++));
1360 if (boost::iequals(fields[i]->GetBndConditions()[j]->
1361 GetUserDefined(),
"WallViscous") ||
1362 boost::iequals(fields[i]->GetBndConditions()[j]->
1363 GetUserDefined(),
"WallAdiabatic"))
1366 &scalarVariables[i][id2], 1);
1370 else if (fields[i]->GetBndConditions()[j]->
1371 GetBoundaryConditionType() ==
1376 GetBndCondExpansions()[j]->
1377 UpdatePhys())[id1], 1,
1379 GetBndCondExpansions()[j]->
1380 UpdatePhys())[id1], 1,
1381 &scalarVariables[i][id2], 1);
1385 if (fields[i]->GetBndConditions()[j]->
1386 GetBoundaryConditionType() ==
1390 &scalarVariables[i][id2], 1,
1391 &penaltyfluxO1[i][id2], 1);
1395 else if ((fields[i]->GetBndConditions()[j])->
1396 GetBoundaryConditionType() ==
1401 &penaltyfluxO1[i][id2], 1);
1406 &scalarVariables[i][id2], 1,
1407 &scalarVariables[i][id2], 1,
1424 nBndRegions = fields[nScalars]->
1425 GetBndCondExpansions().size();
1426 for (j = 0; j < nBndRegions; ++j)
1428 nBndEdges = fields[nScalars]->
1429 GetBndCondExpansions()[j]->GetExpSize();
1431 if (fields[nScalars]->GetBndConditions()[j]->
1437 for (e = 0; e < nBndEdges; ++e)
1439 nBndEdgePts = fields[nScalars]->
1440 GetBndCondExpansions()[j]->GetExp(e)->GetTotPoints();
1442 id1 = fields[nScalars]->
1443 GetBndCondExpansions()[j]->GetPhys_Offset(e);
1445 id2 = fields[0]->GetTrace()->
1446 GetPhys_Offset(fields[0]->GetTraceMap()->
1447 GetBndCondIDToGlobalTraceID(cnt++));
1450 if (boost::iequals(fields[i]->GetBndConditions()[j]->
1451 GetUserDefined(),
"WallViscous"))
1455 &scalarVariables[nScalars-1][id2], 1);
1459 else if (fields[i]->GetBndConditions()[j]->
1460 GetBoundaryConditionType() ==
1465 &(fields[nScalars]->
1466 GetBndCondExpansions()[j]->
1469 GetBndCondExpansions()[j]->
1471 &scalarVariables[nScalars-1][id2], 1);
1475 &scalarVariables[nScalars-1][id2], 1,
1477 &scalarVariables[nScalars-1][id2], 1);
1481 &scalarVariables[nScalars-1][id2], 1,
1482 &scalarVariables[nScalars-1][id2], 1);
1486 if (fields[nScalars]->GetBndConditions()[j]->
1487 GetBoundaryConditionType() ==
1490 fields[nScalars]->GetBndConditions()[j]
1491 ->GetUserDefined(),
"WallAdiabatic"))
1494 &scalarVariables[nScalars-1][id2], 1,
1495 &penaltyfluxO1[nScalars-1][id2], 1);
1500 else if (((fields[nScalars]->GetBndConditions()[j])->
1501 GetBoundaryConditionType() ==
1504 fields[nScalars]->GetBndConditions()[j]
1505 ->GetUserDefined(),
"WallAdiabatic"))
1508 &uplus[nScalars-1][id2], 1,
1509 &penaltyfluxO1[nScalars-1][id2], 1);
1527 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1528 int nVariables = fields.size();
1529 int nDim = fields[0]->GetCoordim(0);
1540 for (i = 0; i < nDim; ++i)
1542 fields[0]->ExtractTracePhys(ufield[i],
m_traceVel[i]);
1550 for (i = 1; i < nVariables; ++i)
1553 for (j = 0; j < nDim; ++j)
1556 fields[i]->GetFwdBwdTracePhys(qfield[j][i], qFwd, qBwd);
1559 fields[i]->GetTrace()->Upwind(Vn, qBwd, qFwd, qfluxtemp);
1566 if (fields[0]->GetBndCondExpansions().size())
1591 int nBndEdges, nBndEdgePts;
1595 int nTracePts = fields[0]->GetTrace()->GetTotPoints();
1596 int nBndRegions = fields[var]->GetBndCondExpansions().size();
1602 fields[var]->ExtractTracePhys(qfield, qtemp);
1605 for (i = 0; i < nBndRegions; ++i)
1608 nBndEdges = fields[var]->
1609 GetBndCondExpansions()[i]->GetExpSize();
1611 if (fields[var]->GetBndConditions()[i]->
1618 for (e = 0; e < nBndEdges; ++e)
1620 nBndEdgePts = fields[var]->
1621 GetBndCondExpansions()[i]->GetExp(e)->GetTotPoints();
1623 id2 = fields[0]->GetTrace()->
1624 GetPhys_Offset(fields[0]->GetTraceMap()->
1625 GetBndCondIDToGlobalTraceID(cnt++));
1630 if(fields[var]->GetBndConditions()[i]->
1632 && !boost::iequals(fields[var]->GetBndConditions()[i]
1633 ->GetUserDefined(),
"WallAdiabatic"))
1638 &penaltyflux[id2], 1);
1642 else if((fields[var]->GetBndConditions()[i])->
1646 "Neumann bcs not implemented for LFRNS");
1648 else if(boost::iequals(fields[var]->GetBndConditions()[i]
1649 ->GetUserDefined(),
"WallAdiabatic"))
1661 &penaltyflux[id2], 1);
1680 const int nConvectiveFields,
1686 boost::ignore_unused(nConvectiveFields);
1689 int nLocalSolutionPts, phys_offset;
1697 Basis = fields[0]->GetExp(0)->GetBasis(0);
1699 int nElements = fields[0]->GetExpSize();
1700 int nPts = fields[0]->GetTotPoints();
1711 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1713 for (n = 0; n < nElements; ++n)
1715 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1716 phys_offset = fields[0]->GetPhys_Offset(n);
1721 &flux[phys_offset], 1,
1724 fields[0]->GetExp(n)->GetTracePhysVals(0, elmtToTrace[n][0],
1727 JumpL[n] = iFlux[n] - tmpFluxVertex[0];
1729 fields[0]->GetExp(n)->GetTracePhysVals(1, elmtToTrace[n][1],
1732 JumpR[n] = iFlux[n+1] - tmpFluxVertex[0];
1735 for (n = 0; n < nElements; ++n)
1737 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1738 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1739 phys_offset = fields[0]->GetPhys_Offset(n);
1740 jac = fields[0]->GetExp(n)
1744 JumpL[n] = JumpL[n] * jac[0];
1745 JumpR[n] = JumpR[n] * jac[0];
1756 Vmath::Vadd(nLocalSolutionPts, &DCL[0], 1, &DCR[0], 1,
1757 &derCFlux[phys_offset], 1);
1777 const int nConvectiveFields,
1778 const int direction,
1784 boost::ignore_unused(nConvectiveFields);
1786 int n, e, i, j, cnt;
1790 int nElements = fields[0]->GetExpSize();
1791 int trace_offset, phys_offset;
1792 int nLocalSolutionPts;
1800 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
1803 for (n = 0; n < nElements; ++n)
1806 phys_offset = fields[0]->GetPhys_Offset(n);
1807 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
1808 ptsKeys = fields[0]->GetExp(n)->GetPointsKeys();
1813 base = fields[0]->GetExp(n)->GetBase();
1814 nquad0 = base[0]->GetNumPoints();
1815 nquad1 = base[1]->GetNumPoints();
1823 for (e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
1826 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
1832 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
1833 elmtToTrace[n][e]->GetElmtId());
1842 fields[0]->GetExp(n)->GetTracePhysVals(
1843 e, elmtToTrace[n][e],
1845 auxArray1 = tmparray);
1856 &tmparray[0], 1, &fluxJumps[0], 1);
1860 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1869 if (fields[0]->GetExp(n)->as<LocalRegions::Expansion2D>()
1870 ->GetGeom2D()->GetMetricInfo()->GetGtype()
1875 fields[0]->GetExp(n)->GetTracePhysVals(
1876 e, elmtToTrace[n][e],
1877 jac, auxArray1 = jacEdge);
1881 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
1890 for (j = 0; j < nEdgePts; j++)
1892 fluxJumps[j] = fluxJumps[j] * jacEdge[j];
1910 for (i = 0; i < nquad0; ++i)
1915 for (j = 0; j < nquad1; ++j)
1918 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
1923 for (i = 0; i < nquad1; ++i)
1928 for (j = 0; j < nquad0; ++j)
1930 cnt = (nquad0)*i + j;
1931 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
1936 for (i = 0; i < nquad0; ++i)
1941 for (j = 0; j < nquad1; ++j)
1944 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
1949 for (i = 0; i < nquad1; ++i)
1953 for (j = 0; j < nquad0; ++j)
1956 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
1962 ASSERTL0(
false,
"edge value (< 3) is out of range");
1976 &divCFluxE3[0], 1, &derCFlux[phys_offset], 1);
1978 else if (direction == 1)
1981 &divCFluxE2[0], 1, &derCFlux[phys_offset], 1);
2000 const int nConvectiveFields,
2007 boost::ignore_unused(nConvectiveFields);
2009 int n, e, i, j, cnt;
2011 int nElements = fields[0]->GetExpSize();
2012 int nLocalSolutionPts;
2023 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
2026 for(n = 0; n < nElements; ++n)
2029 phys_offset = fields[0]->GetPhys_Offset(n);
2030 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
2032 base = fields[0]->GetExp(n)->GetBase();
2033 nquad0 = base[0]->GetNumPoints();
2034 nquad1 = base[1]->GetNumPoints();
2042 for(e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
2045 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
2054 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
2055 elmtToTrace[n][e]->GetElmtId());
2059 fields[0]->GetExp(n)->GetTraceNormal(e);
2063 fields[0]->GetExp(n)->GetTracePhysVals(
2064 e, elmtToTrace[n][e],
2065 fluxX1 + phys_offset,
2066 auxArray1 = tmparrayX1);
2070 fields[0]->GetExp(n)->GetTracePhysVals(
2071 e, elmtToTrace[n][e],
2072 fluxX2 + phys_offset,
2073 auxArray1 = tmparrayX2);
2076 for (i = 0; i < nEdgePts; ++i)
2085 &numericalFlux[trace_offset], 1,
2086 &fluxN[0], 1, &fluxJumps[0], 1);
2089 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2093 auxArray1 = fluxJumps, 1,
2094 auxArray2 = fluxJumps, 1);
2097 for (i = 0; i < nEdgePts; ++i)
2102 fluxJumps[i] = -fluxJumps[i];
2110 for (i = 0; i < nquad0; ++i)
2113 fluxJumps[i] = -(
m_Q2D_e0[n][i]) * fluxJumps[i];
2115 for (j = 0; j < nquad1; ++j)
2118 divCFluxE0[cnt] = fluxJumps[i] *
m_dGL_xi2[n][j];
2123 for (i = 0; i < nquad1; ++i)
2126 fluxJumps[i] = (
m_Q2D_e1[n][i]) * fluxJumps[i];
2128 for (j = 0; j < nquad0; ++j)
2130 cnt = (nquad0)*i + j;
2131 divCFluxE1[cnt] = fluxJumps[i] *
m_dGR_xi1[n][j];
2136 for (i = 0; i < nquad0; ++i)
2139 fluxJumps[i] = (
m_Q2D_e2[n][i]) * fluxJumps[i];
2141 for (j = 0; j < nquad1; ++j)
2144 divCFluxE2[cnt] = fluxJumps[i] *
m_dGR_xi2[n][j];
2149 for (i = 0; i < nquad1; ++i)
2152 fluxJumps[i] = -(
m_Q2D_e3[n][i]) * fluxJumps[i];
2153 for (j = 0; j < nquad0; ++j)
2156 divCFluxE3[cnt] = fluxJumps[i] *
m_dGL_xi1[n][j];
2163 ASSERTL0(
false,
"edge value (< 3) is out of range");
2170 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
2172 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2173 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2175 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2176 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
2195 const int nConvectiveFields,
2202 boost::ignore_unused(nConvectiveFields);
2204 int n, e, i, j, cnt;
2206 int nElements = fields[0]->GetExpSize();
2207 int nLocalSolutionPts;
2218 &elmtToTrace = fields[0]->GetTraceMap()->GetElmtToTrace();
2221 for(n = 0; n < nElements; ++n)
2224 phys_offset = fields[0]->GetPhys_Offset(n);
2225 nLocalSolutionPts = fields[0]->GetExp(n)->GetTotPoints();
2227 base = fields[0]->GetExp(n)->GetBase();
2228 nquad0 = base[0]->GetNumPoints();
2229 nquad1 = base[1]->GetNumPoints();
2237 for(e = 0; e < fields[0]->GetExp(n)->GetNtraces(); ++e)
2240 nEdgePts = fields[0]->GetExp(n)->GetTraceNumPoints(e);
2249 trace_offset = fields[0]->GetTrace()->GetPhys_Offset(
2250 elmtToTrace[n][e]->GetElmtId());
2254 fields[0]->GetExp(n)->GetTraceNormal(e);
2263 fields[0]->GetExp(n)->GetTracePhysVals(
2264 e, elmtToTrace[n][e],
2265 fluxX2 + phys_offset,
2266 auxArray1 = fluxN_D);
2272 &numericalFlux[trace_offset], 1,
2276 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2280 auxArray1 = fluxN, 1,
2281 auxArray2 = fluxN, 1);
2284 auxArray1 = fluxN_D, 1,
2285 auxArray2 = fluxN_D, 1);
2289 for (i = 0; i < nquad0; ++i)
2292 fluxN_R[i] = (
m_Q2D_e0[n][i]) * fluxN[i];
2295 for (i = 0; i < nEdgePts; ++i)
2302 fluxN_R[i] = -fluxN_R[i];
2310 &fluxN_D[0], 1, &fluxJumps[0], 1);
2314 for (i = 0; i < nquad0; ++i)
2316 for (j = 0; j < nquad1; ++j)
2328 fields[0]->GetExp(n)->GetTracePhysVals(
2329 e, elmtToTrace[n][e],
2330 fluxX1 + phys_offset,
2331 auxArray1 = fluxN_D);
2335 &numericalFlux[trace_offset], 1,
2339 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2343 auxArray1 = fluxN, 1,
2344 auxArray2 = fluxN, 1);
2347 auxArray1 = fluxN_D, 1,
2348 auxArray2 = fluxN_D, 1);
2352 for (i = 0; i < nquad1; ++i)
2355 fluxN_R[i] = (
m_Q2D_e1[n][i]) * fluxN[i];
2358 for (i = 0; i < nEdgePts; ++i)
2365 fluxN_R[i] = -fluxN_R[i];
2373 &fluxN_D[0], 1, &fluxJumps[0], 1);
2377 for (i = 0; i < nquad1; ++i)
2379 for (j = 0; j < nquad0; ++j)
2381 cnt = (nquad0)*i + j;
2393 fields[0]->GetExp(n)->GetTracePhysVals(
2394 e, elmtToTrace[n][e],
2395 fluxX2 + phys_offset,
2396 auxArray1 = fluxN_D);
2400 &numericalFlux[trace_offset], 1,
2404 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2408 auxArray1 = fluxN, 1,
2409 auxArray2 = fluxN, 1);
2412 auxArray1 = fluxN_D, 1,
2413 auxArray2 = fluxN_D, 1);
2417 for (i = 0; i < nquad0; ++i)
2420 fluxN_R[i] = (
m_Q2D_e2[n][i]) * fluxN[i];
2423 for (i = 0; i < nEdgePts; ++i)
2430 fluxN_R[i] = -fluxN_R[i];
2439 &fluxN_D[0], 1, &fluxJumps[0], 1);
2443 for (i = 0; i < nquad0; ++i)
2445 for (j = 0; j < nquad1; ++j)
2458 fields[0]->GetExp(n)->GetTracePhysVals(
2459 e, elmtToTrace[n][e],
2460 fluxX1 + phys_offset,
2461 auxArray1 = fluxN_D);
2466 &numericalFlux[trace_offset], 1,
2470 if (fields[0]->GetExp(n)->GetTraceOrient(e) ==
2474 auxArray1 = fluxN, 1,
2475 auxArray2 = fluxN, 1);
2478 auxArray1 = fluxN_D, 1,
2479 auxArray2 = fluxN_D, 1);
2483 for (i = 0; i < nquad1; ++i)
2486 fluxN_R[i] = (
m_Q2D_e3[n][i]) * fluxN[i];
2489 for (i = 0; i < nEdgePts; ++i)
2496 fluxN_R[i] = -fluxN_R[i];
2505 &fluxN_D[0], 1, &fluxJumps[0], 1);
2509 for (i = 0; i < nquad1; ++i)
2511 for (j = 0; j < nquad0; ++j)
2520 ASSERTL0(
false,
"edge value (< 3) is out of range");
2528 &divCFluxE1[0], 1, &divCFlux[phys_offset], 1);
2530 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2531 &divCFluxE2[0], 1, &divCFlux[phys_offset], 1);
2533 Vmath::Vadd(nLocalSolutionPts, &divCFlux[phys_offset], 1,
2534 &divCFluxE3[0], 1, &divCFlux[phys_offset], 1);
#define ASSERTL0(condition, msg)
Represents a basis of a given type.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
const SpatialDomains::GeomFactorsSharedPtr & GetMetricInfo() const
DiffusionFluxVecCBNS m_fluxVectorNS
virtual void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initiliase DiffusionLFRNS objects and store them before starting the time-stepping.
NekDouble m_thermalConductivity
static std::string type[]
Array< OneD, Array< OneD, NekDouble > > m_traceVel
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_divFD
Array< OneD, NekDouble > m_jac
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_viscFlux
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tmp2
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e1
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DFC2
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi2
Array< OneD, Array< OneD, NekDouble > > m_divFC
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DFC1
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi3
Array< OneD, Array< OneD, NekDouble > > m_gmat
virtual void v_NumericalFluxO1(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &numericalFluxO1)
Builds the numerical flux for the 1st order derivatives.
virtual void v_WeakPenaltyO1(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &penaltyfluxO1)
Imposes appropriate bcs for the 1st order derivatives.
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e3
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e2
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi2
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, Array< OneD, NekDouble > > > m_viscTensor
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_tmp1
virtual void v_NumericalFluxO2(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 nConvective, 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, const Array< OneD, Array< OneD, NekDouble > > &pBwd)
Calculate FR Diffusion for the Navier-Stokes (NS) equations using an LDG interface flux.
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi3
Array< OneD, Array< OneD, NekDouble > > m_Q2D_e0
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_IF1
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_D1
DiffusionLFRNS(std::string diffType)
DiffusionLFRNS uses the Flux Reconstruction (FR) approach to compute the diffusion term....
LibUtilities::SessionReaderSharedPtr m_session
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...
Array< OneD, Array< OneD, NekDouble > > m_homoDerivs
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–72...
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_BD1
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.
Array< OneD, Array< OneD, NekDouble > > m_dGR_xi1
virtual void v_WeakPenaltyO2(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const int var, const int dir, const Array< OneD, const NekDouble > &qfield, Array< OneD, NekDouble > &penaltyflux)
Imposes appropriate bcs for the 2nd order derivatives.
static DiffusionSharedPtr create(std::string diffType)
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DU1
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_DD1
Array< OneD, Array< OneD, NekDouble > > m_dGL_xi1
std::string m_ViscosityType
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::vector< PointsKey > PointsKeyVector
@ eGaussGaussLegendre
1D Gauss-Gauss-Legendre quadrature points
DiffusionFactory & GetDiffusionFactory()
@ eDeformed
Geometry is curved or has non-constant factors.
The above copyright notice and this permission notice shall be included.
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.
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 Neg(int n, T *x, const int incx)
Negate x = -x.
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
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 Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*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 Reverse(int n, const T *x, const int incx, T *y, const int incy)
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.