53 "Computes wall shear stress field.");
68 int nfields =
m_f->m_variables.size();
69 int expdim =
m_f->m_graph->GetSpaceDimension();
73 if (
m_f->m_exp[0]->GetNumElmts() == 0)
80 ASSERTL0(
false,
"Error: wss for a 1D problem cannot " 100 m_f->m_exp.resize(nshear);
101 for (i = nfields; i < nshear; ++i)
103 m_f->m_exp[nfields + i] =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
109 m_f->m_exp[0]->GetGraph());
112 map<int, int> BndRegionMap;
114 for (
auto &breg_it : bregions)
116 BndRegionMap[breg_it.first] = cnt++;
120 for (
int b = 0; b <
m_f->m_bndRegionsToWrite.size(); ++b)
122 if (BndRegionMap.count(
m_f->m_bndRegionsToWrite[b]) == 1)
124 int bnd = BndRegionMap[
m_f->m_bndRegionsToWrite[b]];
127 for (i = 0; i < nshear; i++)
129 BndExp[i] =
m_f->m_exp[i]->UpdateBndCondExpansion(bnd);
131 for (i = 0; i < nfields; i++)
133 m_f->m_exp[i]->GetBndElmtExpansion(bnd, BndElmtExp[i]);
137 int nqb = BndExp[0]->GetTotPoints();
138 int nqe = BndElmtExp[0]->GetTotPoints();
144 for (i = 0; i < ngrad; ++i)
149 for (i = 0; i < nstress; ++i)
157 for (i = 0; i < nstress; ++i)
162 for (i = 0; i < nshear; ++i)
180 BndElmtExp[i]->PhysDeriv(velocity[i],
181 grad[i * m_spacedim + 0],
182 grad[i * m_spacedim + 1]);
186 BndElmtExp[i]->PhysDeriv(velocity[i],
187 grad[i * m_spacedim + 0],
188 grad[i * m_spacedim + 1],
189 grad[i * m_spacedim + 2]);
192 Vmath::Vadd(nqe, grad[i * m_spacedim + i], 1, div, 1, div, 1);
206 grad[j * m_spacedim + i], 1,
207 stress[i * m_spacedim + j], 1);
210 stress[i * m_spacedim + j], 1,
211 stress[i * m_spacedim + j], 1);
218 stress[i * m_spacedim + j], 1);
224 stress[j * m_spacedim + i], 1);
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);
251 fstress[i * m_spacedim + j], 1,
252 fshear[i], 1, fshear[i], 1);
260 fshear[nshear - 1], 1, fshear[nshear - 1], 1);
263 fshear[nshear - 1], 1);
268 fshear[i], 1, fshear[i], 1);
269 BndExp[i]->FwdTrans_IterPerExp(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]->FwdTrans_IterPerExp(fshear[nshear - 1],
282 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");
335 "Only IdealGas EOS implemented for Variable ViscosityType");
343 m_f->m_session->LoadParameter(
"Gamma", m_gamma, 1.4);
344 m_f->m_session->LoadParameter(
"pInf", m_pInf, 101325);
345 m_f->m_session->LoadParameter(
"rhoInf", m_rhoInf, 1.225);
346 m_f->m_session->LoadParameter(
"GasConstant", m_gasConstant
350 cv_inv = (m_gamma - 1.0) / m_gasConstant;
360 , exp[i + 1]->GetPhys(), 1, tmp, 1);
362 Vmath::Vdiv(npoints, tmp, 1, exp[0]->GetPhys(), 1, tmp, 1);
366 Vmath::Vsub(npoints, energy, 1, tmp, 1, energy, 1);
369 Vmath::Vdiv(npoints, energy, 1, exp[0]->GetPhys(), 1, energy, 1);
371 Vmath::Smul(npoints, cv_inv, energy, 1, temperature, 1 );
381 NekDouble T_star = m_pInf / (m_rhoInf * m_gasConstant);
383 for (
int i = 0; i < npoints; ++i)
385 ratio = temperature[i] / T_star;
386 mu[i] = mu_star * ratio * sqrt(ratio) * (1 + C) / (ratio + C);
397 ASSERTL0(
false,
"Invalid variables for WSS");
405 int npoints = exp[0]->GetNpoints();
406 if(boost::iequals(
m_f->m_variables[0],
"u"))
413 exp[i]->GetPhys(), 1,
417 else if(boost::iequals(
m_f->m_variables[0],
"rho") &&
418 boost::iequals(
m_f->m_variables[1],
"rhou"))
425 exp[i + 1]->GetPhys(), 1,
426 exp[0]->GetPhys(), 1,
433 ASSERTL0(
false,
"Could not identify velocity for WSS");
#define ASSERTL0(condition, msg)
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
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 GetViscosity(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, Array< OneD, NekDouble > &mu, NekDouble &lambda)
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.
std::shared_ptr< Field > FieldSharedPtr
void GetVelocity(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, Array< OneD, Array< OneD, NekDouble > > &vel)
std::pair< ModuleType, std::string > ModuleKey
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
virtual void Process(po::variables_map &vm)
Write mesh to output file.
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
void Neg(int n, T *x, const int incx)
Negate x = -x.
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.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
void Zero(int n, T *x, const int incx)
Zero vector.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
const BoundaryRegionCollection & GetBoundaryRegions(void) const
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 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.
ModuleFactory & GetModuleFactory()
FieldSharedPtr m_f
Field object.