54 ProcessWSS::create,
"Computes wall shear stress field.");
60 f->m_writeBndFld =
true;
61 f->m_declareExpansionAsContField =
true;
62 f->m_requireBoundaryExpansion =
true;
63 m_f->m_fldToBnd =
false;
74 if(
m_f->m_comm->TreatAsRankZero())
76 cout <<
"ProcessWSS: Calculating wall shear stress..." << endl;
80 m_f->m_addNormals =
m_config[
"addnormals"].m_beenSet;
83 string bvalues =
m_config[
"bnd"].as<
string>();
85 if(bvalues.compare(
"All") == 0)
88 BndExp =
m_f->m_exp[0]->GetBndCondExpansions();
90 for(
int i = 0; i < BndExp.num_elements(); ++i)
92 m_f->m_bndRegionsToWrite.push_back(i);
98 m_f->m_bndRegionsToWrite),
"Failed to interpret range string");
101 NekDouble kinvis =
m_f->m_session->GetParameter(
"Kinvis");
104 int spacedim =
m_f->m_graph->GetSpaceDimension();
105 if ((
m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
106 (
m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
108 spacedim +=
m_f->m_fielddef[0]->m_numHomogeneousDir;
111 int nfields =
m_f->m_fielddef[0]->m_fields.size();
112 ASSERTL0(
m_f->m_fielddef[0]->m_fields[0] ==
"u",
"Implicit assumption that input is in incompressible format of (u,v,p) or (u,v,w,p)");
116 ASSERTL0(
false,
"Error: wss for a 1D problem cannot "
120 int newfields = spacedim + 1;
121 int nshear = spacedim + 1;
122 int nstress = spacedim*spacedim;
123 int ngrad = spacedim*spacedim;
133 for (
int i = 0; i <
m_f->m_exp.size(); ++i)
135 m_f->m_exp[i]->FillBndCondFromField();
138 m_f->m_exp.resize(nfields + newfields);
140 for(i = 0; i < newfields; ++i)
142 m_f->m_exp[nfields + i] =
m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir, var);
147 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_x");
148 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_y");
149 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_mag");
153 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_x");
154 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_y");
155 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_z");
156 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_mag");
161 m_f->m_exp[0]->GetGraph());
164 SpatialDomains::BoundaryRegionCollection::const_iterator breg_it;
165 map<int,int> BndRegionMap;
167 for(breg_it = bregions.begin(); breg_it != bregions.end();
170 BndRegionMap[breg_it->first] = cnt;
173 for(
int b = 0; b <
m_f->m_bndRegionsToWrite.size(); ++b)
175 if(BndRegionMap.count(
m_f->m_bndRegionsToWrite[b]) == 1)
177 int bnd = BndRegionMap[
m_f->m_bndRegionsToWrite[b]];
179 for(i = 0; i < newfields; i++)
181 BndExp[i] =
m_f->m_exp[nfields + i]->UpdateBndCondExpansion(bnd);
183 for(i = 0; i < spacedim; i++)
185 m_f->m_exp[i]->GetBndElmtExpansion(bnd, BndElmtExp[i]);
189 int nqb = BndExp[0]->GetTotPoints();
190 int nqe = BndElmtExp[0]->GetTotPoints();
194 for(i = 0; i < ngrad; ++i)
199 for(i = 0; i < nstress; ++i)
205 for(i = 0; i < nstress; ++i)
210 for(i = 0; i < ngrad; ++i)
215 for(i = 0; i < nshear; ++i)
221 for(i = 0; i < spacedim; ++i)
223 velocity[i] = BndElmtExp[i]->GetPhys();
227 for(i = 0; i < spacedim; ++i)
231 BndElmtExp[i]->PhysDeriv(velocity[i],grad[i*spacedim+0],
236 BndElmtExp[i]->PhysDeriv(velocity[i],grad[i*spacedim+0],
243 for(i = 0; i < spacedim; ++i)
245 for(j = 0; j < spacedim; ++j)
248 grad[j*spacedim+i], 1,
249 stress[i*spacedim+j], 1);
252 stress[i*spacedim+j], 1);
257 for(j = 0; j < nstress; ++j)
259 m_f->m_exp[0]->ExtractElmtToBndPhys(bnd, stress[j],fstress[j]);
264 m_f->m_exp[0]->GetBoundaryNormals(bnd, normals);
266 for(i = 0; i < spacedim; ++i)
273 for(i = 0; i < spacedim; ++i)
275 for(j = 0; j < spacedim; ++j)
284 for(i = 0; i < spacedim; ++i)
290 Vmath::Smul(nqb, -1.0, fshear[nshear-1], 1, fshear[nshear-1], 1);
292 for (i = 0; i < spacedim; i++)
297 BndExp[i]->FwdTrans(fshear[i],
298 BndExp[i]->UpdateCoeffs());
303 for(i = 0; i < spacedim; ++i)
309 Vmath::Vsqrt(nqb, fshear[nshear-1], 1, fshear[nshear-1], 1);
310 BndExp[nshear-1]->FwdTrans(fshear[nshear-1],
311 BndExp[nshear-1]->UpdateCoeffs());
#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)
map< string, ConfigOption > m_config
List of configuration values.
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
FieldSharedPtr m_f
Field object.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
void Neg(int n, T *x, const int incx)
Negate x = -x.
boost::shared_ptr< Field > FieldSharedPtr
Represents a command-line configuration option.
const BoundaryRegionCollection & GetBoundaryRegions(void) const
void Zero(int n, T *x, const int incx)
Zero vector.
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.