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)
79 "StandardExtrapolate",
"StandardExtrapolate");
100 accelerationTerm, 1);
102 for(
int i = 0; i < acc_order; i++)
108 accelerationTerm, 1);
129 for(
int n = 0; n < nint-1; ++n)
144 for(cnt = n = 0; n <
m_PBndConds.num_elements(); ++n)
147 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
170 int pindex=N.num_elements();
184 for(
int j = 0 ; j <
m_HBCdata.num_elements() ; j++)
196 Velocity[i] = fields[i] +
m_HBCdata[j].m_physOffset;
197 Advection[i] = N[i] +
m_HBCdata[j].m_physOffset;
203 Velocity[2] = fields[2] +
m_HBCdata[j].m_assPhysOffset;
220 switch(
m_fields[pindex]->GetExpType())
225 elmt->GetEdgePhysVals(
m_HBCdata[j].m_elmtTraceID,Pbc,Q[0],BndValues[0]);
226 elmt->GetEdgePhysVals(
m_HBCdata[j].m_elmtTraceID,Pbc,Q[1],BndValues[1]);
227 Pbc->NormVectorIProductWRTBase(BndValues[0],BndValues[1],Pvals);
234 Pvals[0] = -1.0*Q[0][0];
236 else if (
m_HBCdata[j].m_elmtTraceID == 1)
238 Pvals[0] = Q[0][
m_HBCdata[j].m_ptsInElmt-1];
243 "In the 3D homogeneous 2D approach BCs edge "
244 "ID can be just 0 or 1 ");
250 elmt->GetFacePhysVals(
m_HBCdata[j].m_elmtTraceID,Pbc,Q[0],BndValues[0]);
251 elmt->GetFacePhysVals(
m_HBCdata[j].m_elmtTraceID,Pbc,Q[1],BndValues[1]);
252 elmt->GetFacePhysVals(
m_HBCdata[j].m_elmtTraceID,Pbc,Q[2],BndValues[2]);
253 Pbc->NormVectorIProductWRTBase(BndValues[0],BndValues[1],BndValues[2],Pvals);
257 ASSERTL0(0,
"Dimension not supported");
272 static bool init =
true;
273 static bool noHOBC =
false;
284 for(
int n = 0; n <
m_PBndConds.num_elements(); ++n)
286 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"HOutflow"))
288 totbndpts +=
m_PBndExp[n]->GetTotPoints();
334 int num_planes = planes.num_elements();
336 for(
int n = 0; n <
m_PBndConds.num_elements(); ++n)
338 int exp_size =
m_PBndExp[n]->GetExpSize();
342 for(
int n = 0; n <
m_PBndConds.num_elements(); ++n)
382 int nbc,cnt,cnt_start;
392 for(
int n = 0; n <
m_PBndConds.num_elements(); ++n)
395 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"HOutflow"))
397 for(
int i = 0; i <
m_PBndExp[n]->GetExpSize(); ++i,cnt++)
399 cnt = max(cnt,
m_PBndExp[n]->GetTotPoints());
410 m_session->LoadParameter(
"U0_HighOrderBC",U0,1.0);
411 m_session->LoadParameter(
"Delta_HighOrderBC",delta,1/20.0);
414 for(
int n = 0; n <
m_PBndConds.num_elements(); ++n)
419 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"HOutflow"))
425 for(
int i = 0; i <
m_PBndExp[n]->GetExpSize(); ++i, cnt++)
433 int offset =
m_fields[0]->GetPhys_Offset(elmtid);
438 int nq = elmt->GetTotPoints();
439 int nbc =
m_PBndExp[n]->GetExp(i)->GetTotPoints();
448 elmt->GetTracePhysVals(boundary,Bc,BndElmt[j],
466 for(
int i = 0; i <
m_PBndExp[n]->GetExpSize(); ++i, cnt++)
471 int nbc =
m_PBndExp[n]->GetExp(i)->GetTotPoints();
474 normDotu(nbc,0.0), utot(nbc,0.0);
476 normals=elmt->GetSurfaceNormal(boundary);
511 normDotu, 1, normDotu, 1);
514 int Offset =
m_PBndExp[n]->GetPhys_Offset(i);
516 for(
int k = 0; k < nbc; ++k)
520 NekDouble fac = 0.5*(1.0-tanh(normDotu[k]/(U0*delta)));
529 UBndExp[0][n]->HomogeneousFwdTrans(
542 UBndExp[j][n]->HomogeneousFwdTrans(
543 UBndExp[j][n]->UpdatePhys(),
550 for(
int i = 0; i <
m_PBndExp[n]->GetExpSize(); ++i,cnt++)
558 int offset =
m_fields[0]->GetPhys_Offset(elmtid);
561 int nq = elmt->GetTotPoints();
571 int nbc =
m_PBndExp[n]->GetExp(i)->GetTotPoints();
577 normals=elmt->GetSurfaceNormal(boundary);
586 BndElmt[j], gradtmp);
587 elmt->GetTracePhysVals(boundary, Bc, gradtmp,
590 nGradu[j], 1, nGradu[j],1);
607 int p_offset =
m_PBndExp[n]->GetPhys_Offset(i);
609 for(
int k = 0; k < nbc; ++k)
615 ptmp[k] = kinvis * ptmp[k]
620 int u_offset = UBndExp[0][n]->GetPhys_Offset(i);
624 for(
int k = 0; k < nbc; ++k)
626 ubc[j][k + u_offset] = (1.0 / kinvis)
634 for(
int k = 0; k < nbc; ++k)
636 ubc[
m_bnd_dim][k + u_offset] = (1.0 / kinvis)
640 u_offset = UBndExp[
m_bnd_dim][n]->GetPhys_Offset(i);
641 UBCvals = UBndExp[
m_bnd_dim][n]->UpdateCoeffs()
642 + UBndExp[
m_bnd_dim][n]->GetCoeff_Offset(i);
643 Bc->IProductWRTBase(ubc[m_bnd_dim] + u_offset, UBCvals);
653 elmt->GetTracePhysVals(boundary,Bc,BndElmt[j],
691 normDotu, 1, normDotu, 1);
699 for(
int k = 0; k < nbc; ++k)
701 NekDouble fac = 0.5*(1.0-tanh(normDotu[k]/(U0*delta)));
706 ptmp[k] = kinvis * ptmp[k] - 0.5 * utot[k] * fac
710 int u_offset = UBndExp[0][n]->GetPhys_Offset(i);
714 UBCvals = UBndExp[j][n]->GetPhys()
715 + UBndExp[j][n]->GetPhys_Offset(i);
717 for(
int k = 0; k < nbc; ++k)
719 NekDouble fac = 0.5 * (1.0 - tanh(normDotu[k]
721 ubc[j][k + u_offset] = (1.0 / kinvis)
722 * (UBCvals[k] + 0.5 * utot[k] * fac
731 m_PBndExp[n]->GetExp(i)->FwdTrans(ptmp,PBCvals);
739 if(boost::iequals(UBndConds[j][n]->GetUserDefined(),
"HOutflow"))
742 for(
int i = 0; i < UBndExp[0][n]->GetExpSize();
748 (UBndExp[0][n]->GetExp(i));
750 nbc = UBndExp[0][n]->GetExp(i)->GetTotPoints();
758 normals = elmt->GetSurfaceNormal(boundary);
763 Pbc->BwdTrans(PBCvals,pb);
765 int u_offset = UBndExp[j][n]->GetPhys_Offset(i);
767 for(
int k = 0; k < nbc; ++k)
769 ub[k] = ubc[j][k + u_offset]
770 + pb[k] * normals[j][k] / kinvis;
773 UBCvals = UBndExp[j][n]->UpdateCoeffs()
774 + UBndExp[j][n]->GetCoeff_Offset(i);
775 Bc->IProductWRTBase(ub,UBCvals);
812 elmt->PhysDeriv(Dummy,Q[1],Q[0]);
835 Vel[0], 1, Dummy1, 1);
844 Vel[1], 1, Dummy2, 1);
895 elmt->PhysDeriv(Vel[0], Dummy, Uy, Uz);
896 elmt->PhysDeriv(Vel[1], Vx, Dummy, Vz);
897 elmt->PhysDeriv(Vel[2], Wx, Wy, Dummy);
903 elmt->PhysDeriv(Q[0], Dummy, Wy, Vx);
904 elmt->PhysDeriv(Q[1], Wx, Dummy, Uz);
905 elmt->PhysDeriv(Q[2], Vz, Uy, Dummy);
913 ASSERTL0(0,
"Dimension not supported");
926 int pindex=
m_fields.num_elements()-1;
938 for(n = 0; n <
m_HBCdata.num_elements(); ++n)
949 Velmt = Vel[j] +
m_HBCdata[n].m_physOffset;
950 elmt->GetTracePhysVals(
m_HBCdata[n].m_elmtTraceID,Pbc,Velmt,velbc[j]);
953 IProdVnTmp = IProdVn +
m_HBCdata[n].m_coeffOffset;
956 Pbc->NormVectorIProductWRTBase(velbc,IProdVnTmp);
984 for(n = 0; n <
m_HBCdata.num_elements(); ++n)
992 VelBndExp[j][bndid]->GetExp(elmtid)->BwdTrans(VelBndExp[j][bndid]->GetCoeffs() +
993 VelBndExp[j][bndid]->GetCoeff_Offset(elmtid),
997 IProdVnTmp = IProdVn +
m_HBCdata[n].m_coeffOffset;
1000 Pbc->NormVectorIProductWRTBase(velbc,IProdVnTmp);
1012 int nlevels = input.num_elements();
1016 tmp = input[nlevels-1];
1018 for(
int n = nlevels-1; n > 0; --n)
1020 input[n] = input[n-1];
1033 int pindex=
m_fields.num_elements()-1;
1047 for(cnt = n = 0; n <
m_PBndConds.num_elements(); ++n)
1049 for(
int i = 0; i <
m_PBndExp[n]->GetExpSize(); ++i)
1052 m_PBndExp[n]->GetExp(i)->GetTotPoints());
1064 for(cnt = n = 0; n <
m_PBndConds.num_elements(); ++n)
1067 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
1070 HBCnumber +=
m_PBndExp[n]->GetExpSize();
1074 int checkHBC = HBCnumber;
1116 ASSERTL0(0,
"Dimension not supported");
1129 int coeff_count = 0;
1133 for(
int n = 0 ; n <
m_PBndConds.num_elements(); ++n)
1137 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
1139 for(
int i = 0; i < exp_size; ++i,cnt++)
1143 m_HBCdata[j].m_ptsInElmt = elmt->GetTotPoints();
1148 m_HBCdata[j].m_coeffOffset = coeff_count;
1149 coeff_count += elmt->GetTraceNcoeffs(
m_HBCdata[j].m_elmtTraceID);
1165 int num_planes = planes.num_elements();
1166 int num_elm_per_plane = (
m_pressure->GetExpSize())/num_planes;
1171 int exp_size, exp_size_per_plane;
1177 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",
1179 m_session->MatchSolverInfo(
"ModeType",
"HalfMode",
1181 m_session->MatchSolverInfo(
"ModeType",
"MultipleModes",
1186 if(
m_session->DefinesSolverInfo(
"ModeType"))
1202 ASSERTL0(
false,
"SolverInfo ModeType not valid");
1210 int coeff_count = 0;
1212 for(n = 0, j= 0, cnt = 0; n <
m_PBndConds.num_elements(); ++n)
1215 exp_size_per_plane = exp_size/num_planes;
1217 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
1219 for(k = 0; k < num_planes; k++)
1222 for(i = 0; i < exp_size_per_plane; ++i, ++j, ++cnt)
1226 m_HBCdata[j].m_ptsInElmt = elmt->GetTotPoints();
1228 m_HBCdata[j].m_bndElmtID = i+k*exp_size_per_plane;
1231 m_HBCdata[j].m_coeffOffset = coeff_count;
1232 coeff_count += elmt->GetEdgeNcoeffs(
m_HBCdata[j].m_elmtTraceID);
1256 assElmtID =
m_HBCdata[j].m_globalElmtID;
1261 assElmtID =
m_HBCdata[j].m_globalElmtID + num_elm_per_plane;
1266 assElmtID =
m_HBCdata[j].m_globalElmtID - num_elm_per_plane;
1285 int exp_size, exp_size_per_line;
1292 for(
int n = 0 ; n <
m_PBndConds.num_elements(); ++n)
1296 exp_size_per_line = exp_size/(m_npointsZ*
m_npointsY);
1298 if(boost::iequals(
m_PBndConds[n]->GetUserDefined(),
"H"))
1300 for(
int i = 0; i < exp_size_per_line; ++i,cnt++)
1305 m_HBCdata[j].m_ptsInElmt = elmt->GetTotPoints();
1307 m_HBCdata[j].m_bndElmtID = i+(k1*m_npointsY+k2)*exp_size_per_line;
1316 cnt += exp_size_per_line;
1324 ASSERTL0(0,
"Dimension not supported");
1338 int n_points_0 =
m_fields[0]->GetExp(0)->GetTotPoints();
1339 int n_element =
m_fields[0]->GetExpSize();
1340 int nvel = inarray.num_elements();
1350 for (
int i = 0; i < nvel; ++i)
1358 for (
int el = 0; el < n_element; ++el)
1360 int n_points =
m_fields[0]->GetExp(el)->GetTotPoints();
1361 ptsKeys =
m_fields[0]->GetExp(el)->GetPointsKeys();
1364 if(n_points != n_points_0)
1366 for (
int j = 0; j < nvel; ++j)
1370 n_points_0 = n_points;
1374 m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()->GetDerivFactors(ptsKeys);
1376 if (
m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()->GetGtype()
1379 for (
int i = 0; i < n_points; i++)
1381 stdVelocity[0][i] = gmat[0][i]*inarray[0][i+cnt]
1382 + gmat[2][i]*inarray[1][i+cnt];
1384 stdVelocity[1][i] = gmat[1][i]*inarray[0][i+cnt]
1385 + gmat[3][i]*inarray[1][i+cnt];
1390 for (
int i = 0; i < n_points; i++)
1392 stdVelocity[0][i] = gmat[0][0]*inarray[0][i+cnt]
1393 + gmat[2][0]*inarray[1][i+cnt];
1395 stdVelocity[1][i] = gmat[1][0]*inarray[0][i+cnt]
1396 + gmat[3][0]*inarray[1][i+cnt];
1403 for (
int i = 0; i < n_points; i++)
1405 pntVelocity = stdVelocity[0][i]*stdVelocity[0][i]
1406 + stdVelocity[1][i]*stdVelocity[1][i];
1408 if (pntVelocity>maxV[el])
1410 maxV[el] = pntVelocity;
1413 maxV[el] = sqrt(maxV[el]);
1419 for (
int el = 0; el < n_element; ++el)
1422 int n_points =
m_fields[0]->GetExp(el)->GetTotPoints();
1423 ptsKeys =
m_fields[0]->GetExp(el)->GetPointsKeys();
1426 if(n_points != n_points_0)
1428 for (
int j = 0; j < nvel; ++j)
1432 n_points_0 = n_points;
1436 m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()->GetDerivFactors(ptsKeys);
1438 if (
m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()->GetGtype()
1441 for (
int i = 0; i < n_points; i++)
1443 stdVelocity[0][i] = gmat[0][i]*inarray[0][i+cnt]
1444 + gmat[3][i]*inarray[1][i+cnt]
1445 + gmat[6][i]*inarray[2][i+cnt];
1447 stdVelocity[1][i] = gmat[1][i]*inarray[0][i+cnt]
1448 + gmat[4][i]*inarray[1][i+cnt]
1449 + gmat[7][i]*inarray[2][i+cnt];
1451 stdVelocity[2][i] = gmat[2][i]*inarray[0][i+cnt]
1452 + gmat[5][i]*inarray[1][i+cnt]
1453 + gmat[8][i]*inarray[2][i+cnt];
1458 for (
int i = 0; i < n_points; i++)
1460 stdVelocity[0][i] = gmat[0][0]*inarray[0][i+cnt]
1461 + gmat[3][0]*inarray[1][i+cnt]
1462 + gmat[6][0]*inarray[2][i+cnt];
1464 stdVelocity[1][i] = gmat[1][0]*inarray[0][i+cnt]
1465 + gmat[4][0]*inarray[1][i+cnt]
1466 + gmat[7][0]*inarray[2][i+cnt];
1468 stdVelocity[2][i] = gmat[2][0]*inarray[0][i+cnt]
1469 + gmat[5][0]*inarray[1][i+cnt]
1470 + gmat[8][0]*inarray[2][i+cnt];
1476 for (
int i = 0; i < n_points; i++)
1478 pntVelocity = stdVelocity[0][i]*stdVelocity[0][i]
1479 + stdVelocity[1][i]*stdVelocity[1][i]
1480 + stdVelocity[2][i]*stdVelocity[2][i];
1482 if (pntVelocity > maxV[el])
1484 maxV[el] = pntVelocity;
1488 maxV[el] = sqrt(maxV[el]);
1511 int nPts = newarray.num_elements();
1519 oldarrays[nint-1], 1,
1522 for(
int n = 0; n < nint-1; ++n)
1525 oldarrays[n],1,outarray,1,
#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.
LibUtilities::NekFactory< std::string, Extrapolate, const LibUtilities::SessionReaderSharedPtr &, Array< OneD, MultiRegions::ExpListSharedPtr > &, MultiRegions::ExpListSharedPtr &, const Array< OneD, int > &, const SolverUtils::AdvectionSharedPtr & > ExtrapolateFactory
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
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.