52 ProcessQCriterion::create,
"Computes Q-Criterion.");
67 cout <<
"ProcessQCriterion: Calculating Q Criterion..." << endl;
71 int expdim =
m_f->m_graph->GetMeshDimension();
72 int spacedim = expdim;
73 if ((
m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
74 (
m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
78 int nfields =
m_f->m_fielddef[0]->m_fields.size();
79 if (spacedim == 1 || spacedim == 2)
81 cerr <<
"\n Error: ProcessQCriterion must be computed for a 3D"
82 " (or quasi-3D) case. \n" << endl;
88 int npoints =
m_f->m_exp[0]->GetNpoints();
90 Array<OneD, Array<OneD, NekDouble> > grad(nfields * nfields);
92 Array<OneD, Array<OneD, NekDouble> > omega(nfields * nfields);
93 Array<OneD, Array<OneD, NekDouble> > S (nfields * nfields);
95 Array<OneD, Array<OneD, NekDouble> > outfield (addfields);
96 Array<OneD, Array<OneD, NekDouble> > outfield1(addfields);
97 Array<OneD, Array<OneD, NekDouble> > outfield2(addfields);
98 Array<OneD, Array<OneD, NekDouble> > outfield3(addfields);
100 m_f->m_exp.resize(nfields+addfields);
102 for (i = 0; i < nfields*nfields; ++i)
104 grad[i] = Array<OneD, NekDouble>(npoints);
107 for (i = 0; i < addfields; ++i)
110 outfield[i] = Array<OneD, NekDouble>(npoints);
111 outfield1[i] = Array<OneD, NekDouble>(npoints);
112 outfield2[i] = Array<OneD, NekDouble>(npoints);
113 outfield3[i] = Array<OneD, NekDouble>(npoints);
115 omega[i] = Array<OneD, NekDouble>(npoints);
116 S[i] = Array<OneD, NekDouble>(npoints);
119 for (i = 0; i < nfields; ++i)
121 m_f->m_exp[i]->PhysDeriv(
m_f->m_exp[i]->GetPhys(),
129 grad[1 * nfields + 2], 1,
138 grad[2 * nfields + 0], 1,
147 grad[0 * nfields + 1], 1,
164 for (
int k = 0; k < addfields; ++k)
166 Vmath::Smul(npoints, fac, &omega[k][0], 1, &omega[k][0], 1);
174 grad[0 * nfields + 0], 1,
177 grad[1 * nfields + 1], 1,
180 grad[2 * nfields + 2], 1,
192 grad[1 * nfields + 2], 1,
196 &outfield1[0][0], 1);
200 grad[2 * nfields + 0], 1,
204 &outfield2[0][0], 1);
208 grad[0 * nfields + 1], 1,
212 &outfield3[0][0], 1);
216 &outfield2[0][0], 1);
219 &outfield3[0][0], 1);
221 for (
int k = 0; k < addfields; ++k)
224 &outfield3[k][0], 1);
227 Vmath::Vadd(npoints, &outfield3[0][0], 1, &S[0][0], 1, &S[0][0], 1);
228 Vmath::Vsub(npoints, omega[0], 1, S[0], 1, outfield[0], 1);
230 for (
int k = 0; k < addfields; ++k)
237 for (i = 0; i < addfields; ++i)
239 m_f->m_exp[nfields + i] =
m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir);
240 m_f->m_exp[nfields + i]->UpdatePhys() = outfield[i];
241 m_f->m_exp[nfields + i]->FwdTrans(outfield[i],
242 m_f->m_exp[nfields + i]->UpdateCoeffs());
245 vector<string> outname;
246 outname.push_back(
"Q");
248 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
249 =
m_f->m_exp[0]->GetFieldDefinitions();
250 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
252 for (j = 0; j < nfields + addfields; ++j)
254 for (i = 0; i < FieldDef.size(); ++i)
258 FieldDef[i]->m_fields.push_back(outname[j-nfields]);
262 FieldDef[i]->m_fields.push_back(
263 m_f->m_fielddef[0]->m_fields[j]);
265 m_f->m_exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
269 m_f->m_fielddef = FieldDef;
270 m_f->m_data = FieldData;