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 if(
m_f->m_comm->GetRank() == 0)
75 cout <<
"ProcessWSS: Calculating wall shear stress..." << endl;
79 m_f->m_addNormals =
m_config[
"addnormals"].m_beenSet;
82 string bvalues =
m_config[
"bnd"].as<
string>();
84 if(bvalues.compare(
"All") == 0)
87 BndExp =
m_f->m_exp[0]->GetBndCondExpansions();
89 for(
int i = 0; i < BndExp.num_elements(); ++i)
91 m_f->m_bndRegionsToWrite.push_back(i);
97 m_f->m_bndRegionsToWrite),
"Failed to interpret range string");
100 NekDouble kinvis =
m_f->m_session->GetParameter(
"Kinvis");
103 int spacedim =
m_f->m_graph->GetSpaceDimension();
104 if ((
m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
105 (
m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
107 spacedim +=
m_f->m_fielddef[0]->m_numHomogeneousDir;
110 int nfields =
m_f->m_fielddef[0]->m_fields.size();
111 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)");
115 ASSERTL0(
false,
"Error: wss for a 1D problem cannot "
119 int newfields = spacedim + 1;
120 int nshear = spacedim + 1;
121 int nstress = spacedim*spacedim;
122 int ngrad = spacedim*spacedim;
132 for (
int i = 0; i <
m_f->m_exp.size(); ++i)
134 m_f->m_exp[i]->FillBndCondFromField();
137 m_f->m_exp.resize(nfields + newfields);
139 for(i = 0; i < newfields; ++i)
141 m_f->m_exp[nfields + i] =
m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir, var);
146 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_x");
147 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_y");
148 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_mag");
152 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_x");
153 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_y");
154 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_z");
155 m_f->m_fielddef[0]->m_fields.push_back(
"Shear_mag");
160 m_f->m_exp[0]->GetGraph());
163 SpatialDomains::BoundaryRegionCollection::const_iterator breg_it;
164 map<int,int> BndRegionMap;
166 for(breg_it = bregions.begin(); breg_it != bregions.end();
169 BndRegionMap[breg_it->first] = cnt;
172 for(
int b = 0; b <
m_f->m_bndRegionsToWrite.size(); ++b)
174 if(BndRegionMap.count(
m_f->m_bndRegionsToWrite[b]) == 1)
176 int bnd = BndRegionMap[
m_f->m_bndRegionsToWrite[b]];
178 for(i = 0; i < newfields; i++)
180 BndExp[i] =
m_f->m_exp[nfields + i]->UpdateBndCondExpansion(bnd);
182 for(i = 0; i < spacedim; i++)
184 m_f->m_exp[i]->GetBndElmtExpansion(bnd, BndElmtExp[i]);
188 int nqb = BndExp[0]->GetTotPoints();
189 int nqe = BndElmtExp[0]->GetTotPoints();
193 for(i = 0; i < ngrad; ++i)
198 for(i = 0; i < nstress; ++i)
204 for(i = 0; i < nstress; ++i)
209 for(i = 0; i < ngrad; ++i)
214 for(i = 0; i < nshear; ++i)
220 for(i = 0; i < spacedim; ++i)
222 velocity[i] = BndElmtExp[i]->GetPhys();
226 for(i = 0; i < spacedim; ++i)
230 BndElmtExp[i]->PhysDeriv(velocity[i],grad[i*spacedim+0],
235 BndElmtExp[i]->PhysDeriv(velocity[i],grad[i*spacedim+0],
242 for(i = 0; i < spacedim; ++i)
244 for(j = 0; j < spacedim; ++j)
247 grad[j*spacedim+i], 1,
248 stress[i*spacedim+j], 1);
251 stress[i*spacedim+j], 1);
256 for(j = 0; j < nstress; ++j)
258 m_f->m_exp[0]->ExtractElmtToBndPhys(bnd, stress[j],fstress[j]);
263 m_f->m_exp[0]->GetBoundaryNormals(bnd, normals);
265 for(i = 0; i < spacedim; ++i)
272 for(i = 0; i < spacedim; ++i)
274 for(j = 0; j < spacedim; ++j)
283 for(i = 0; i < spacedim; ++i)
289 Vmath::Smul(nqb, -1.0, fshear[nshear-1], 1, fshear[nshear-1], 1);
291 for (i = 0; i < spacedim; i++)
296 BndExp[i]->FwdTrans(fshear[i],
297 BndExp[i]->UpdateCoeffs());
302 for(i = 0; i < spacedim; ++i)
308 Vmath::Vsqrt(nqb, fshear[nshear-1], 1, fshear[nshear-1], 1);
309 BndExp[nshear-1]->FwdTrans(fshear[nshear-1],
310 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.