53 ProcessQCriterion::create,
"Computes Q-Criterion.");
68 if(
m_f->m_comm->GetRank() == 0)
70 cout <<
"ProcessQCriterion: Calculating Q Criterion..." << endl;
75 int expdim =
m_f->m_graph->GetMeshDimension();
76 int spacedim = expdim;
77 if ((
m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
78 (
m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
82 int nfields =
m_f->m_fielddef[0]->m_fields.size();
83 if (spacedim == 1 || spacedim == 2)
85 cerr <<
"\n Error: ProcessQCriterion must be computed for a 3D"
86 " (or quasi-3D) case. \n" << endl;
92 int npoints =
m_f->m_exp[0]->GetNpoints();
106 m_f->m_session->LoadParameter(
"Strip_Z",nstrips,1);
108 m_f->m_exp.resize(nfields*nstrips);
110 for (i = 0; i < nfields*nfields; ++i)
115 for (i = 0; i < addfields; ++i)
127 vector<MultiRegions::ExpListSharedPtr> Exp(nstrips*addfields);
129 for(s = 0; s < nstrips; ++s)
131 for (i = 0; i < nfields; ++i)
133 m_f->m_exp[s*nfields+i]->PhysDeriv(
m_f->m_exp[s*nfields+i]->GetPhys(),
141 grad[1 * nfields + 2], 1,
150 grad[2 * nfields + 0], 1,
159 grad[0 * nfields + 1], 1,
176 for (
int k = 0; k < addfields; ++k)
178 Vmath::Smul(npoints, fac, &omega[k][0], 1, &omega[k][0], 1);
186 grad[0 * nfields + 0], 1,
189 grad[1 * nfields + 1], 1,
192 grad[2 * nfields + 2], 1,
204 grad[1 * nfields + 2], 1,
208 &outfield1[0][0], 1);
212 grad[2 * nfields + 0], 1,
216 &outfield2[0][0], 1);
220 grad[0 * nfields + 1], 1,
224 &outfield3[0][0], 1);
228 &outfield2[0][0], 1);
231 &outfield3[0][0], 1);
233 for (
int k = 0; k < addfields; ++k)
236 &outfield3[k][0], 1);
239 Vmath::Vadd(npoints, &outfield3[0][0], 1, &S[0][0], 1, &S[0][0], 1);
240 Vmath::Vsub(npoints, omega[0], 1, S[0], 1, outfield[0], 1);
242 for (
int k = 0; k < addfields; ++k)
249 for (i = 0; i < addfields; ++i)
251 int n = s*addfields + i;
252 Exp[n] =
m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir);
253 Exp[n]->UpdatePhys() = outfield[i];
254 Exp[n]->FwdTrans(outfield[i],
255 Exp[n]->UpdateCoeffs());
261 for(s = 0; s < nstrips; ++s)
263 for(i = 0; i < addfields; ++i)
265 it =
m_f->m_exp.begin()+s*(nfields+addfields)+nfields+i;
266 m_f->m_exp.insert(it, Exp[s*addfields+i]);
270 vector<string> outname;
271 outname.push_back(
"Q");
273 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
274 =
m_f->m_exp[0]->GetFieldDefinitions();
275 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
277 for(s = 0; s < nstrips; ++s)
279 for (j = 0; j < nfields + addfields; ++j)
281 for (i = 0; i < FieldDef.size()/nstrips; ++i)
283 int n = s * FieldDef.size()/nstrips + i;
287 FieldDef[n]->m_fields.push_back(outname[j-nfields]);
291 FieldDef[n]->m_fields.push_back(
292 m_f->m_fielddef[0]->m_fields[j]);
294 m_f->m_exp[s*(nfields + addfields)+j]->AppendFieldData(FieldDef[n], FieldData[n]);
299 m_f->m_fielddef = FieldDef;
300 m_f->m_data = FieldData;
pair< ModuleType, string > ModuleKey
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.
boost::shared_ptr< Field > FieldSharedPtr
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.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
virtual ~ProcessQCriterion()
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.
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()
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.