54 ProcessWSS::create,
"Computes wall shear stress field.");
60 f->m_writeBndFld =
true;
61 f->m_declareExpansionAsContField =
true;
62 m_f->m_fldToBnd =
false;
73 cout <<
"ProcessWSS: Calculating wall shear stress..." << endl;
76 m_f->m_addNormals =
m_config[
"addnormals"].m_beenSet;
79 string bvalues =
m_config[
"bnd"].as<
string>();
81 if(bvalues.compare(
"All") == 0)
84 BndExp =
m_f->m_exp[0]->GetBndCondExpansions();
86 for(
int i = 0; i < BndExp.num_elements(); ++i)
88 m_f->m_bndRegionsToWrite.push_back(i);
94 m_f->m_bndRegionsToWrite),
"Failed to interpret range string");
99 m_kinvis =
m_f->m_session->GetParameter(
"Kinvis");
102 int spacedim =
m_f->m_graph->GetSpaceDimension();
103 if ((
m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
104 (
m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
109 int nfields =
m_f->m_fielddef[0]->m_fields.size();
110 ASSERTL0(nfields == spacedim +1,
"Implicit assumption that input is in incompressible format of (u,v,p) or (u,v,w,p)");
112 nfields = nfields - 1;
115 ASSERTL0(
false,
"Error: wss for a 1D problem cannot "
119 int newfields = (spacedim == 2)? 3:4;
120 int nshear = (spacedim == 2)? 3:4;
121 int nstress = (spacedim == 2)? 3:6;
122 int ngrad = nfields*nfields;
124 int n, cnt, elmtid, nq, offset, boundary, nfq;
125 int npoints =
m_f->m_exp[0]->GetNpoints();
135 m_f->m_exp.resize(newfields);
137 for(i = nfields+1; i < newfields; ++i)
139 m_f->m_exp[i] =
m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir, var);
142 m_f->m_fielddef[0]->m_fields.resize(newfields);
145 m_f->m_fielddef[0]->m_fields[0] =
"Shear_x";
146 m_f->m_fielddef[0]->m_fields[1] =
"Shear_y";
147 m_f->m_fielddef[0]->m_fields[2] =
"Shear_mag";
151 m_f->m_fielddef[0]->m_fields[0] =
"Shear_x";
152 m_f->m_fielddef[0]->m_fields[1] =
"Shear_y";
153 m_f->m_fielddef[0]->m_fields[2] =
"Shear_z";
154 m_f->m_fielddef[0]->m_fields[3] =
"Shear_mag";
158 for (i = 0; i < newfields; ++i)
162 for (i = 0; i < nfields; ++i)
167 m_f->m_exp[0]->GetBoundaryToElmtMap(BoundarytoElmtID, BoundarytoTraceID);
169 for(
int j = 0; j < newfields; ++j)
171 BndExp[j] =
m_f->m_exp[j]->GetBndCondExpansions();
175 for(cnt = n = 0; n < BndExp[0].num_elements(); ++n)
177 bool doneBnd =
false;
179 for(
int b = 0; b <
m_f->m_bndRegionsToWrite.size(); ++b)
181 if(n ==
m_f->m_bndRegionsToWrite[b])
184 for(
int i = 0; i < BndExp[0][n]->GetExpSize(); ++i, cnt++)
187 elmtid = BoundarytoElmtID[cnt];
188 elmt =
m_f->m_exp[0]->GetExp(elmtid);
189 nq = elmt->GetTotPoints();
190 offset =
m_f->m_exp[0]->GetPhys_Offset(elmtid);
194 for(
int j = 0; j < ngrad; ++j)
199 for(
int j = 0; j < nstress; ++j)
206 ASSERTL0(
false,
"Error: not implemented in 2D.");
215 boundary = BoundarytoTraceID[cnt];
221 = elmt->GetFaceNormal(boundary);
224 for(
int j = 0; j < nstress; ++j)
229 for(
int j = 0; j < nfields*nfields; ++j)
234 for(
int j = 0; j < nshear; ++j)
241 for(
int j = 0; j < nfields; ++j)
243 velocity[j] =
m_f->m_exp[j]->GetPhys() + offset;
247 elmt->PhysDeriv(velocity[0],grad[0],grad[1],grad[2]);
248 elmt->PhysDeriv(velocity[1],grad[3],grad[4],grad[5]);
249 elmt->PhysDeriv(velocity[2],grad[6],grad[7],grad[8]);
253 Vmath::Smul (nq,(2*m_kinvis),grad[0],1,stress[0],1);
255 Vmath::Smul (nq,(2*m_kinvis),grad[4],1,stress[1],1);
257 Vmath::Smul (nq,(2*m_kinvis),grad[8],1,stress[2],1);
270 for(j = 0; j < nstress; ++j)
272 elmt->GetFacePhysVals(boundary,bc,stress[j],fstress[j]);
276 for (j = 0; j< newfields; j++)
278 outfield[j] = BndExp[j][n]->UpdateCoeffs() + BndExp[j][n]->GetCoeff_Offset(i);
286 normals[1],1,fstress[3],1,fshear[0],1);
287 Vmath::Vvtvp (nfq,normals[2],1,fstress[4],1,fshear[0],1,fshear[0],1);
291 normals[1],1,fstress[1],1,fshear[1],1);
292 Vmath::Vvtvp (nfq,normals[2],1,fstress[5],1,fshear[1],1,fshear[1],1);
296 normals[1],1,fstress[5],1,fshear[2],1);
297 Vmath::Vvtvp (nfq,normals[2],1,fstress[2],1,fshear[2],1,fshear[2],1);
303 normals[1][0],fstress[3],1,fshear[0],1);
304 Vmath::Svtvp(nfq,normals[2][0],fstress[4],1,fshear[0],1,fshear[0],1);
308 normals[1][0],fstress[1],1,fshear[1],1);
309 Vmath::Svtvp(nfq,normals[2][0],fstress[5],1,fshear[1],1,fshear[1],1);
313 normals[1][0],fstress[5],1,fshear[2],1);
314 Vmath::Svtvp(nfq,normals[2][0],fstress[2],1,fshear[2],1,fshear[2],1);
321 normals[1],1, fshear[1],1,fshear[3],1);
322 Vmath::Vvtvp (nfq,normals[2],1, fshear[2],1,fshear[3],1,fshear[3],1);
323 Vmath::Smul(nfq, -1.0, fshear[3], 1, fshear[3], 1);
325 for (j = 0; j < nfields; j++)
327 Vmath::Vvtvp(nfq,normals[j], 1, fshear[3], 1, fshear[j], 1, fshear[j], 1);
328 bc->FwdTrans(fshear[j], outfield[j]);
334 normals[1][0],fshear[1],1,fshear[3],1);
335 Vmath::Svtvp(nfq,normals[2][0],fshear[2],1,fshear[3],1,fshear[3],1);
338 for (j = 0; j < nfields; j++)
340 Vmath::Svtvp(nfq,normals[j][0],fshear[3],1,fshear[j],1,fshear[j],1);
341 bc->FwdTrans(fshear[j], outfield[j]);
346 Vmath::Vvtvvtp(nfq, fshear[0], 1, fshear[0], 1, fshear[1], 1, fshear[1], 1, fshear[3], 1);
347 Vmath::Vvtvp(nfq, fshear[2], 1, fshear[2], 1, fshear[3], 1, fshear[3], 1);
349 bc->FwdTrans(fshear[3], outfield[3]);
357 cnt += BndExp[0][n]->GetExpSize();
362 for(
int j = 0; j < newfields; ++j)
364 for(
int b = 0; b <
m_f->m_bndRegionsToWrite.size(); ++b)
366 m_f->m_exp[j]->UpdateBndCondExpansion(
m_f->m_bndRegionsToWrite[b]) = BndExp[j][
m_f->m_bndRegionsToWrite[b]];
#define ASSERTL0(condition, msg)
pair< ModuleType, string > ModuleKey
static bool GenerateOrderedVector(const char *const str, std::vector< unsigned int > &vec)
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
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
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
map< string, ConfigOption > m_config
List of configuration values.
FieldSharedPtr m_f
Field object.
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
boost::shared_ptr< StdExpansion2D > StdExpansion2DSharedPtr
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< Field > FieldSharedPtr
Represents a command-line configuration option.
boost::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
void Vvtvvtp(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtp (vector times vector plus vector times vector):
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
vvtvvtp (scalar times vector plus scalar times vector):
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
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.
ModuleFactory & GetModuleFactory()
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.