66 int nfields =
m_f->m_variables.size();
67 int expdim =
m_f->m_graph->GetSpaceDimension();
70 if (
m_f->m_exp[0]->GetNumElmts() == 0)
77 ASSERTL0(
false,
"Error: wss for a 1D problem cannot "
99 m_f->m_exp.resize(nshear);
100 for (i = nfields; i < nshear; ++i)
102 m_f->m_exp[nfields + i] =
103 m_f->AppendExpList(
m_f->m_numHomogeneousDir);
109 m_f->m_exp[0]->GetGraph());
115 std::set<int> ProcessBnd;
116 if (
m_f->m_session->DefinesTag(
"CreateBndRegions"))
119 vector<unsigned int> bndRegions;
121 m_f->m_session->GetTag(
"CreateBndRegions"), bndRegions),
122 "Failed to interpret bnd values string");
124 for (
auto &bnd : bndRegions)
126 if (bregions.count(bnd) == 1)
128 ProcessBnd.insert(bnd);
134 for (
auto &it : bregions)
136 ProcessBnd.insert(it.first);
140 map<int, int> BndRegionMap;
142 for (
auto &breg_it : bregions)
144 if (ProcessBnd.count(breg_it.first))
146 BndRegionMap[breg_it.first] = cnt++;
151 for (
int b = 0; b <
m_f->m_bndRegionsToWrite.size(); ++b)
153 if (BndRegionMap.count(
m_f->m_bndRegionsToWrite[b]) == 1)
155 int bnd = BndRegionMap[
m_f->m_bndRegionsToWrite[b]];
158 for (i = 0; i < nshear; i++)
160 BndExp[i] =
m_f->m_exp[i]->UpdateBndCondExpansion(bnd);
166 for (i = 0; i < nfields; i++)
168 m_f->m_exp[i]->GetBndElmtExpansion(bnd, BndElmtExp[i]);
169 BndElmtPhys[i] = BndElmtExp[i]->UpdatePhys();
173 int nqb = BndExp[0]->GetTotPoints();
174 int nqe = BndElmtExp[0]->GetTotPoints();
179 for (i = 0; i < ngrad; ++i)
184 for (i = 0; i < nstress; ++i)
192 for (i = 0; i < nstress; ++i)
197 for (i = 0; i < nshear; ++i)
215 BndElmtExp[i]->PhysDeriv(velocity[i],
221 BndElmtExp[i]->PhysDeriv(
262 for (j = 0; j < nstress; ++j)
264 m_f->m_exp[0]->ExtractElmtToBndPhys(bnd, stress[j], fstress[j]);
269 m_f->m_exp[0]->GetBoundaryNormals(bnd, normals);
292 fshear[nshear - 1], 1, fshear[nshear - 1], 1);
294 Vmath::Smul(nqb, -1.0, fshear[nshear - 1], 1, fshear[nshear - 1],
300 fshear[i], 1, fshear[i], 1);
301 BndExp[i]->FwdTransLocalElmt(fshear[i],
302 BndExp[i]->UpdateCoeffs());
310 fshear[nshear - 1], 1, fshear[nshear - 1], 1);
312 Vmath::Vsqrt(nqb, fshear[nshear - 1], 1, fshear[nshear - 1], 1);
313 BndExp[nshear - 1]->FwdTransLocalElmt(
314 fshear[nshear - 1], BndExp[nshear - 1]->UpdateCoeffs());
320 m_f->m_variables[0] =
"Shear_x";
321 m_f->m_variables[1] =
"Shear_y";
322 m_f->m_variables[2] =
"Shear_mag";
326 m_f->m_variables[0] =
"Shear_x";
327 m_f->m_variables[1] =
"Shear_y";
328 m_f->m_variables[2] =
"Shear_z";
329 m_f->m_variables[3] =
"Shear_mag";
339 int npoints = exp[0]->GetNpoints();
341 if (boost::iequals(
m_f->m_variables[0],
"u"))
344 m_mu =
m_f->m_session->GetParameter(
"Kinvis");
348 else if (boost::iequals(
m_f->m_variables[0],
"rho") &&
349 boost::iequals(
m_f->m_variables[1],
"rhou"))
352 std::string m_ViscosityType;
353 m_f->m_session->LoadParameter(
"mu",
m_mu, 1.78e-05);
354 m_f->m_session->LoadParameter(
"lambda", lambda, -2.0 / 3.0);
355 m_f->m_session->LoadSolverInfo(
"ViscosityType", m_ViscosityType,
358 if (m_ViscosityType ==
"Variable")
363 m_f->m_session->LoadSolverInfo(
"EquationOfState", eosType,
365 m_idealGas = boost::iequals(eosType,
"IdealGas");
368 "Only IdealGas EOS implemented for Variable ViscosityType");
378 m_f->m_session->LoadParameter(
"Gamma", m_gamma, 1.4);
379 m_f->m_session->LoadParameter(
"pInf", m_pInf, 101325);
380 m_f->m_session->LoadParameter(
"rhoInf",
m_rhoInf, 1.225);
381 m_f->m_session->LoadParameter(
"GasConstant", m_gasConstant,
383 m_f->m_session->LoadParameter(
"Tref", m_Tref, 288.15);
384 m_TRatioSutherland = 110.0 / m_Tref;
387 cv_inv = (m_gamma - 1.0) / m_gasConstant;
397 Vmath::Vmul(npoints, BndElmtPhys[i + 1], 1, BndElmtPhys[i + 1],
400 Vmath::Vdiv(npoints, tmp, 1, BndElmtPhys[0], 1, tmp, 1);
405 Vmath::Vsub(npoints, energy, 1, tmp, 1, energy, 1);
409 Vmath::Vdiv(npoints, energy, 1, BndElmtPhys[0], 1, energy, 1);
412 Vmath::Smul(npoints, cv_inv, energy, 1, temperature, 1);
424 for (
int i = 0; i < npoints; ++i)
426 ratio = temperature[i] / T_star;
427 mu[i] = mu_star * ratio *
sqrt(ratio) * (1 + C) / (ratio + C);
438 ASSERTL0(
false,
"Invalid variables for WSS");
const BoundaryRegionCollection & GetBoundaryRegions(void) const
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
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