50 "Computes wall shear stress field.");
65 int nfields =
m_f->m_variables.size();
66 int expdim =
m_f->m_graph->GetSpaceDimension();
69 if (
m_f->m_exp[0]->GetNumElmts() == 0)
76 ASSERTL0(
false,
"Error: wss for a 1D problem cannot "
98 m_f->m_exp.resize(nshear);
99 for (i = nfields; i < nshear; ++i)
101 m_f->m_exp[nfields + i] =
102 m_f->AppendExpList(
m_f->m_numHomogeneousDir);
108 m_f->m_exp[0]->GetGraph());
111 map<int, int> BndRegionMap;
113 for (
auto &breg_it : bregions)
115 BndRegionMap[breg_it.first] = cnt++;
119 for (
int b = 0; b <
m_f->m_bndRegionsToWrite.size(); ++b)
121 if (BndRegionMap.count(
m_f->m_bndRegionsToWrite[b]) == 1)
123 int bnd = BndRegionMap[
m_f->m_bndRegionsToWrite[b]];
126 for (i = 0; i < nshear; i++)
128 BndExp[i] =
m_f->m_exp[i]->UpdateBndCondExpansion(bnd);
134 for (i = 0; i < nfields; i++)
136 m_f->m_exp[i]->GetBndElmtExpansion(bnd, BndElmtExp[i]);
137 BndElmtPhys[i] = BndElmtExp[i]->UpdatePhys();
141 int nqb = BndExp[0]->GetTotPoints();
142 int nqe = BndElmtExp[0]->GetTotPoints();
147 for (i = 0; i < ngrad; ++i)
152 for (i = 0; i < nstress; ++i)
160 for (i = 0; i < nstress; ++i)
165 for (i = 0; i < nshear; ++i)
183 BndElmtExp[i]->PhysDeriv(velocity[i],
189 BndElmtExp[i]->PhysDeriv(
230 for (j = 0; j < nstress; ++j)
232 m_f->m_exp[0]->ExtractElmtToBndPhys(bnd, stress[j], fstress[j]);
237 m_f->m_exp[0]->GetBoundaryNormals(bnd, normals);
260 fshear[nshear - 1], 1, fshear[nshear - 1], 1);
262 Vmath::Smul(nqb, -1.0, fshear[nshear - 1], 1, fshear[nshear - 1],
268 fshear[i], 1, fshear[i], 1);
269 BndExp[i]->FwdTransLocalElmt(fshear[i],
270 BndExp[i]->UpdateCoeffs());
278 fshear[nshear - 1], 1, fshear[nshear - 1], 1);
280 Vmath::Vsqrt(nqb, fshear[nshear - 1], 1, fshear[nshear - 1], 1);
281 BndExp[nshear - 1]->FwdTransLocalElmt(
282 fshear[nshear - 1], BndExp[nshear - 1]->UpdateCoeffs());
288 m_f->m_variables[0] =
"Shear_x";
289 m_f->m_variables[1] =
"Shear_y";
290 m_f->m_variables[2] =
"Shear_mag";
294 m_f->m_variables[0] =
"Shear_x";
295 m_f->m_variables[1] =
"Shear_y";
296 m_f->m_variables[2] =
"Shear_z";
297 m_f->m_variables[3] =
"Shear_mag";
307 int npoints = exp[0]->GetNpoints();
309 if (boost::iequals(
m_f->m_variables[0],
"u"))
312 m_mu =
m_f->m_session->GetParameter(
"Kinvis");
316 else if (boost::iequals(
m_f->m_variables[0],
"rho") &&
317 boost::iequals(
m_f->m_variables[1],
"rhou"))
320 std::string m_ViscosityType;
321 m_f->m_session->LoadParameter(
"mu",
m_mu, 1.78e-05);
322 m_f->m_session->LoadParameter(
"lambda", lambda, -2.0 / 3.0);
323 m_f->m_session->LoadSolverInfo(
"ViscosityType", m_ViscosityType,
326 if (m_ViscosityType ==
"Variable")
331 m_f->m_session->LoadSolverInfo(
"EquationOfState", eosType,
333 m_idealGas = boost::iequals(eosType,
"IdealGas");
336 "Only IdealGas EOS implemented for Variable ViscosityType");
346 m_f->m_session->LoadParameter(
"Gamma", m_gamma, 1.4);
347 m_f->m_session->LoadParameter(
"pInf", m_pInf, 101325);
348 m_f->m_session->LoadParameter(
"rhoInf",
m_rhoInf, 1.225);
349 m_f->m_session->LoadParameter(
"GasConstant", m_gasConstant,
351 m_f->m_session->LoadParameter(
"Tref", m_Tref, 288.15);
352 m_TRatioSutherland = 110.0 / m_Tref;
355 cv_inv = (m_gamma - 1.0) / m_gasConstant;
365 Vmath::Vmul(npoints, BndElmtPhys[i + 1], 1, BndElmtPhys[i + 1],
368 Vmath::Vdiv(npoints, tmp, 1, BndElmtPhys[0], 1, tmp, 1);
373 Vmath::Vsub(npoints, energy, 1, tmp, 1, energy, 1);
377 Vmath::Vdiv(npoints, energy, 1, BndElmtPhys[0], 1, energy, 1);
380 Vmath::Smul(npoints, cv_inv, energy, 1, temperature, 1);
392 for (
int i = 0; i < npoints; ++i)
394 ratio = temperature[i] / T_star;
395 mu[i] = mu_star * ratio *
sqrt(ratio) * (1 + C) / (ratio + C);
406 ASSERTL0(
false,
"Invalid variables for WSS");
415 int npoints = exp[0]->GetNpoints();
416 if (boost::iequals(
m_f->m_variables[0],
"u"))
425 else if (boost::iequals(
m_f->m_variables[0],
"rho") &&
426 boost::iequals(
m_f->m_variables[1],
"rhou"))
432 Vmath::Vdiv(npoints, BndElmtPhys[i + 1], 1, BndElmtPhys[0], 1,
439 ASSERTL0(
false,
"Could not identify velocity for WSS");
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
void GetViscosity(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, const Array< OneD, Array< OneD, NekDouble > > &BndElmtdPhys, Array< OneD, NekDouble > &mu, NekDouble &lambda)
static ModuleKey className
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
void GetVelocity(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, const Array< OneD, Array< OneD, NekDouble > > &BndElmtdPhys, Array< OneD, Array< OneD, NekDouble > > &vel)
ProcessWSS(FieldSharedPtr f)
void v_Process(po::variables_map &vm) override
Write mesh to output file.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
const BoundaryRegionCollection & GetBoundaryRegions(void) const
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
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 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 Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
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)