42 { 1.0, 0.0, 0.0},{ 2.0, -1.0, 0.0},{ 3.0, -3.0, 1.0}};
44 { 1.0, 0.0, 0.0},{ 2.0, -0.5, 0.0},{ 3.0, -1.5, 1.0/3.0}};
53 Loki::SingleThreaded > Type;
54 return Type::Instance();
63 : m_session(pSession),
65 m_pressure(pPressure),
67 m_advObject(advObject)
80 "StandardExtrapolate",
"StandardExtrapolate");
120 for(cnt = n = 0; n <
m_PBndConds.num_elements(); ++n)
123 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
138 accelerationTerm, 1);
140 for(
int i = 0; i < acc_order; i++)
146 accelerationTerm, 1);
162 for(n = 0; n < nint-1; ++n)
171 for(cnt = n = 0; n <
m_PBndConds.num_elements(); ++n)
173 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
213 for(
int j = 0 ; j <
m_HBCdata.num_elements() ; j++)
226 Velocity[i] = fields[i] +
m_HBCdata[j].m_physOffset;
227 Advection[i] = N[i] +
m_HBCdata[j].m_physOffset;
233 Velocity[2] = fields[2] +
m_HBCdata[j].m_assPhysOffset;
247 ->GetCoeff_Offset(
m_HBCdata[j].m_bndElmtOffset);
258 elmt->GetEdgePhysVals(
m_HBCdata[j].m_elmtTraceID, Pbc,
260 elmt->GetEdgePhysVals(
m_HBCdata[j].m_elmtTraceID, Pbc,
262 Pbc->NormVectorIProductWRTBase(BndValues[0], BndValues[1],
265 elmt->GetEdgePhysVals(
m_HBCdata[j].m_elmtTraceID, Pbc,
266 Velocity[0], BndValues[0]);
267 elmt->GetEdgePhysVals(
m_HBCdata[j].m_elmtTraceID, Pbc,
268 Velocity[1], BndValues[1]);
269 Pbc->NormVectorIProductWRTBase(BndValues[0], BndValues[1],
283 else if (
m_HBCdata[j].m_elmtTraceID == 1)
294 "In the 3D homogeneous 2D approach BCs edge "
295 "ID can be just 0 or 1 ");
301 elmt->GetFacePhysVals(
m_HBCdata[j].m_elmtTraceID, Pbc,
303 elmt->GetFacePhysVals(
m_HBCdata[j].m_elmtTraceID, Pbc,
305 elmt->GetFacePhysVals(
m_HBCdata[j].m_elmtTraceID, Pbc,
307 Pbc->NormVectorIProductWRTBase(BndValues[0], BndValues[1],
308 BndValues[2], Pvals);
310 elmt->GetFacePhysVals(
m_HBCdata[j].m_elmtTraceID, Pbc,
311 Velocity[0], BndValues[0]);
312 elmt->GetFacePhysVals(
m_HBCdata[j].m_elmtTraceID, Pbc,
313 Velocity[1], BndValues[1]);
314 elmt->GetFacePhysVals(
m_HBCdata[j].m_elmtTraceID, Pbc,
315 Velocity[2], BndValues[2]);
316 Pbc->NormVectorIProductWRTBase(BndValues[0], BndValues[1],
317 BndValues[2], Uvals);
321 ASSERTL0(0,
"Dimension not supported");
334 static bool init =
true;
335 static bool noHOBC =
false;
346 for(
int n = 0; n <
m_PBndConds.num_elements(); ++n)
348 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"HOutflow"))
350 totbndpts +=
m_PBndExp[n]->GetTotPoints();
396 int num_planes = planes.num_elements();
398 for(
int n = 0; n <
m_PBndConds.num_elements(); ++n)
400 int exp_size =
m_PBndExp[n]->GetExpSize();
404 for(
int n = 0; n <
m_PBndConds.num_elements(); ++n)
444 int nbc,cnt,cnt_start;
454 for(
int n = 0; n <
m_PBndConds.num_elements(); ++n)
457 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"HOutflow"))
459 for(
int i = 0; i <
m_PBndExp[n]->GetExpSize(); ++i,cnt++)
461 cnt = max(cnt,
m_PBndExp[n]->GetTotPoints());
472 m_session->LoadParameter(
"U0_HighOrderBC",U0,1.0);
473 m_session->LoadParameter(
"Delta_HighOrderBC",delta,1/20.0);
477 for(
int n = 0; n <
m_PBndConds.num_elements(); ++n)
482 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"HOutflow"))
487 int cnt_exp = 0;
int cnt_plane = 0;
489 for(
int i = 0; i <
m_PBndExp[n]->GetExpSize(); ++i, cnt_exp++)
494 cnt_exp = 0; cnt_plane++;
504 int offset =
m_fields[0]->GetPhys_Offset(elmtid);
509 int nq = elmt->GetTotPoints();
510 int nbc =
m_PBndExp[n]->GetExp(i)->GetTotPoints();
519 elmt->GetTracePhysVals(boundary,Bc,BndElmt[j],
535 cnt_plane = 0; cnt_exp = 0;
537 for(
int i = 0; i <
m_PBndExp[n]->GetExpSize(); ++i, cnt_exp++)
542 cnt_exp = 0; cnt_plane++;
548 int nbc =
m_PBndExp[n]->GetExp(i)->GetTotPoints();
551 normDotu(nbc,0.0), utot(nbc,0.0);
553 normals=elmt->GetSurfaceNormal(boundary);
588 normDotu, 1, normDotu, 1);
591 int Offset =
m_PBndExp[n]->GetPhys_Offset(i);
593 for(
int k = 0; k < nbc; ++k)
597 NekDouble fac = 0.5*(1.0-tanh(normDotu[k]/(U0*delta)));
606 UBndExp[0][n]->HomogeneousFwdTrans(
619 UBndExp[j][n]->HomogeneousFwdTrans(
620 UBndExp[j][n]->UpdatePhys(),
626 int cnt_exp = 0;
int cnt_plane = 0;
627 for(
int i = 0; i <
m_PBndExp[n]->GetExpSize(); ++i,cnt++)
634 cnt_exp = 0; cnt_plane++;
646 int offset =
m_fields[0]->GetPhys_Offset(elmtid);
649 int nq = elmt->GetTotPoints();
659 int nbc =
m_PBndExp[n]->GetExp(i)->GetTotPoints();
665 normals=elmt->GetSurfaceNormal(boundary);
674 BndElmt[j], gradtmp);
675 elmt->GetTracePhysVals(boundary, Bc, gradtmp,
678 nGradu[j], 1, nGradu[j],1);
695 int p_offset =
m_PBndExp[n]->GetPhys_Offset(i);
697 for(
int k = 0; k < nbc; ++k)
703 ptmp[k] = kinvis * ptmp[k]
708 int u_offset = UBndExp[0][n]->GetPhys_Offset(i);
712 for(
int k = 0; k < nbc; ++k)
714 ubc[j][k + u_offset] = (1.0 / kinvis)
722 for(
int k = 0; k < nbc; ++k)
724 ubc[
m_bnd_dim][k + u_offset] = (1.0 / kinvis)
728 u_offset = UBndExp[
m_bnd_dim][n]->GetPhys_Offset(i);
729 UBCvals = UBndExp[
m_bnd_dim][n]->UpdateCoeffs()
730 + UBndExp[
m_bnd_dim][n]->GetCoeff_Offset(i);
731 Bc->IProductWRTBase(ubc[m_bnd_dim] + u_offset, UBCvals);
741 elmt->GetTracePhysVals(boundary,Bc,BndElmt[j],
776 normDotu, 1, normDotu, 1);
784 for(
int k = 0; k < nbc; ++k)
786 NekDouble fac = 0.5*(1.0-tanh(normDotu[k]/(U0*delta)));
791 ptmp[k] = kinvis * ptmp[k] - 0.5 * utot[k] * fac
795 int u_offset = UBndExp[0][n]->GetPhys_Offset(i);
799 UBCvals = UBndExp[j][n]->GetPhys()
800 + UBndExp[j][n]->GetPhys_Offset(i);
802 for(
int k = 0; k < nbc; ++k)
804 NekDouble fac = 0.5 * (1.0 - tanh(normDotu[k]
806 ubc[j][k + u_offset] = (1.0 / kinvis)
807 * (UBCvals[k] + 0.5 * utot[k] * fac
816 m_PBndExp[n]->GetExp(i)->FwdTrans(ptmp,PBCvals);
824 if(boost::iequals(UBndConds[j][n]->GetUserDefined(),
"HOutflow"))
828 int cnt_exp = 0;
int cnt_plane = 0;
829 for(
int i = 0; i < UBndExp[0][n]->GetExpSize();
838 cnt_exp = 0; cnt_plane++;
847 (UBndExp[0][n]->GetExp(i));
849 nbc = UBndExp[0][n]->GetExp(i)->GetTotPoints();
857 normals = elmt->GetSurfaceNormal(boundary);
862 Pbc->BwdTrans(PBCvals,pb);
864 int u_offset = UBndExp[j][n]->GetPhys_Offset(i);
866 for(
int k = 0; k < nbc; ++k)
868 ub[k] = ubc[j][k + u_offset]
869 + pb[k] * normals[j][k] / kinvis;
872 UBCvals = UBndExp[j][n]->UpdateCoeffs()
873 + UBndExp[j][n]->GetCoeff_Offset(i);
874 Bc->IProductWRTBase(ub,UBCvals);
916 elmt->PhysDeriv(Dummy,Q[1],Q[0]);
939 Vel[0], 1, Dummy1, 1);
948 Vel[1], 1, Dummy2, 1);
1001 elmt->PhysDeriv(Vel[0], Dummy, Uy, Uz);
1002 elmt->PhysDeriv(Vel[1], Vx, Dummy, Vz);
1003 elmt->PhysDeriv(Vel[2], Wx, Wy, Dummy);
1009 elmt->PhysDeriv(Q[0], Dummy, Wy, Vx);
1010 elmt->PhysDeriv(Q[1], Wx, Dummy, Uz);
1011 elmt->PhysDeriv(Q[2], Vz, Uy, Dummy);
1019 ASSERTL0(0,
"Dimension not supported");
1033 int nlevels = input.num_elements();
1037 tmp = input[nlevels-1];
1039 for(
int n = nlevels-1; n > 0; --n)
1041 input[n] = input[n-1];
1065 for(cnt = n = 0; n <
m_PBndConds.num_elements(); ++n)
1067 for(
int i = 0; i <
m_PBndExp[n]->GetExpSize(); ++i)
1070 m_PBndExp[n]->GetExp(i)->GetTotPoints());
1082 for(cnt = n = 0; n <
m_PBndConds.num_elements(); ++n)
1085 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
1088 HBCnumber +=
m_PBndExp[n]->GetExpSize();
1092 int checkHBC = HBCnumber;
1134 ASSERTL0(0,
"Dimension not supported");
1147 int coeff_count = 0;
1151 for(
int n = 0 ; n <
m_PBndConds.num_elements(); ++n)
1155 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
1157 for(
int i = 0; i < exp_size; ++i,cnt++)
1164 elmt->GetTotPoints();
1172 m_HBCdata[j].m_coeffOffset = coeff_count;
1173 coeff_count += elmt->GetEdgeNcoeffs(
1190 int num_planes = planes.num_elements();
1191 int num_elm_per_plane = (
m_pressure->GetExpSize())/num_planes;
1196 int exp_size, exp_size_per_plane;
1202 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",
1204 m_session->MatchSolverInfo(
"ModeType",
"HalfMode",
1206 m_session->MatchSolverInfo(
"ModeType",
"MultipleModes",
1211 if(
m_session->DefinesSolverInfo(
"ModeType"))
1227 ASSERTL0(
false,
"SolverInfo ModeType not valid");
1239 for(
int n = 0 ; n <
m_PBndConds.num_elements(); ++n)
1241 coeffPlaneOffset[n] = cnt;
1242 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
1249 for(
int k = 0; k < num_planes; k++)
1252 for(
int n = 0 ; n <
m_PBndConds.num_elements(); ++n)
1255 exp_size_per_plane = exp_size/num_planes;
1257 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
1259 for(
int i = 0; i < exp_size_per_plane; ++i,cnt++)
1263 m_HBCdata[j].m_ptsInElmt = elmt->GetTotPoints();
1265 m_HBCdata[j].m_bndElmtOffset = i+k*exp_size_per_plane;
1268 m_HBCdata[j].m_coeffOffset = coeffPlaneOffset[n] + coeff_count[n];
1269 coeff_count[n] += elmt->GetEdgeNcoeffs(
m_HBCdata[j].m_elmtTraceID);
1293 assElmtID =
m_HBCdata[j].m_globalElmtID;
1298 assElmtID =
m_HBCdata[j].m_globalElmtID + num_elm_per_plane;
1303 assElmtID =
m_HBCdata[j].m_globalElmtID - num_elm_per_plane;
1313 cnt += exp_size_per_plane;
1324 int exp_size, exp_size_per_line;
1331 for(
int n = 0 ; n <
m_PBndConds.num_elements(); ++n)
1335 exp_size_per_line = exp_size/(m_npointsZ*
m_npointsY);
1337 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
1339 for(
int i = 0; i < exp_size_per_line; ++i,cnt++)
1344 m_HBCdata[j].m_ptsInElmt = elmt->GetTotPoints();
1346 m_HBCdata[j].m_bndElmtOffset = i+(k1*m_npointsY+k2)*exp_size_per_line;
1353 cnt += exp_size_per_line;
1361 ASSERTL0(0,
"Dimension not supported");
1375 int n_points_0 =
m_fields[0]->GetExp(0)->GetTotPoints();
1376 int n_element =
m_fields[0]->GetExpSize();
1377 int nvel = inarray.num_elements();
1387 for (
int i = 0; i < nvel; ++i)
1395 for (
int el = 0; el < n_element; ++el)
1397 int n_points =
m_fields[0]->GetExp(el)->GetTotPoints();
1398 ptsKeys =
m_fields[0]->GetExp(el)->GetPointsKeys();
1401 if(n_points != n_points_0)
1403 for (
int j = 0; j < nvel; ++j)
1407 n_points_0 = n_points;
1411 m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()->GetDerivFactors(ptsKeys);
1413 if (
m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()->GetGtype()
1416 for (
int i = 0; i < n_points; i++)
1418 stdVelocity[0][i] = gmat[0][i]*inarray[0][i+cnt]
1419 + gmat[2][i]*inarray[1][i+cnt];
1421 stdVelocity[1][i] = gmat[1][i]*inarray[0][i+cnt]
1422 + gmat[3][i]*inarray[1][i+cnt];
1427 for (
int i = 0; i < n_points; i++)
1429 stdVelocity[0][i] = gmat[0][0]*inarray[0][i+cnt]
1430 + gmat[2][0]*inarray[1][i+cnt];
1432 stdVelocity[1][i] = gmat[1][0]*inarray[0][i+cnt]
1433 + gmat[3][0]*inarray[1][i+cnt];
1440 for (
int i = 0; i < n_points; i++)
1442 pntVelocity = stdVelocity[0][i]*stdVelocity[0][i]
1443 + stdVelocity[1][i]*stdVelocity[1][i];
1445 if (pntVelocity>maxV[el])
1447 maxV[el] = pntVelocity;
1450 maxV[el] = sqrt(maxV[el]);
1456 for (
int el = 0; el < n_element; ++el)
1459 int n_points =
m_fields[0]->GetExp(el)->GetTotPoints();
1460 ptsKeys =
m_fields[0]->GetExp(el)->GetPointsKeys();
1463 if(n_points != n_points_0)
1465 for (
int j = 0; j < nvel; ++j)
1469 n_points_0 = n_points;
1473 m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()->GetDerivFactors(ptsKeys);
1475 if (
m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()->GetGtype()
1478 for (
int i = 0; i < n_points; i++)
1480 stdVelocity[0][i] = gmat[0][i]*inarray[0][i+cnt]
1481 + gmat[3][i]*inarray[1][i+cnt]
1482 + gmat[6][i]*inarray[2][i+cnt];
1484 stdVelocity[1][i] = gmat[1][i]*inarray[0][i+cnt]
1485 + gmat[4][i]*inarray[1][i+cnt]
1486 + gmat[7][i]*inarray[2][i+cnt];
1488 stdVelocity[2][i] = gmat[2][i]*inarray[0][i+cnt]
1489 + gmat[5][i]*inarray[1][i+cnt]
1490 + gmat[8][i]*inarray[2][i+cnt];
1495 for (
int i = 0; i < n_points; i++)
1497 stdVelocity[0][i] = gmat[0][0]*inarray[0][i+cnt]
1498 + gmat[3][0]*inarray[1][i+cnt]
1499 + gmat[6][0]*inarray[2][i+cnt];
1501 stdVelocity[1][i] = gmat[1][0]*inarray[0][i+cnt]
1502 + gmat[4][0]*inarray[1][i+cnt]
1503 + gmat[7][0]*inarray[2][i+cnt];
1505 stdVelocity[2][i] = gmat[2][0]*inarray[0][i+cnt]
1506 + gmat[5][0]*inarray[1][i+cnt]
1507 + gmat[8][0]*inarray[2][i+cnt];
1513 for (
int i = 0; i < n_points; i++)
1515 pntVelocity = stdVelocity[0][i]*stdVelocity[0][i]
1516 + stdVelocity[1][i]*stdVelocity[1][i]
1517 + stdVelocity[2][i]*stdVelocity[2][i];
1519 if (pntVelocity > maxV[el])
1521 maxV[el] = pntVelocity;
1525 maxV[el] = sqrt(maxV[el]);
#define ASSERTL0(condition, msg)
std::vector< PointsKey > PointsKeyVector
#define sign(a, b)
return the sign(b)*a
ExtrapolateFactory & GetExtrapolateFactory()
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
boost::shared_ptr< Advection > AdvectionSharedPtr
A shared pointer to an Advection object.
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
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
The base class for all shapes.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
LibUtilities::NekFactory< std::string, Extrapolate, const LibUtilities::SessionReaderSharedPtr &, Array< OneD, MultiRegions::ExpListSharedPtr > &, MultiRegions::ExpListSharedPtr &, const Array< OneD, int > &, const SolverUtils::AdvectionSharedPtr & > ExtrapolateFactory
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.
MultiRegions::Direction const DirCartesianMap[]
static std::string RegisterDefaultSolverInfo(const std::string &pName, const std::string &pValue)
Registers the default string value of a solver info property.
void Zero(int n, T *x, const int incx)
Zero vector.
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Geometry is curved or has non-constant factors.
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.
Provides a generic Factory class.