49 "Computes Q-Criterion.");
63 int nfields =
m_f->m_variables.size();
64 m_f->m_variables.push_back(
"Q");
66 if (
m_f->m_exp[0]->GetNumElmts() == 0)
72 int expdim =
m_f->m_graph->GetMeshDimension();
73 int spacedim = expdim + (
m_f->m_numHomogeneousDir);
76 spacedim == 3 || spacedim == 2,
77 "ProcessQCriterion must be computed for a 2D, quasi-3D, or 3D case.");
79 int npoints =
m_f->m_exp[0]->GetNpoints();
91 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
93 for (i = 0; i < spacedim * spacedim; ++i)
100 for (s = 0; s < nstrips; ++s)
102 Exp =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
103 auto it =
m_f->m_exp.begin() + s * (nfields + 1) + nfields;
104 m_f->m_exp.insert(it, Exp);
110 for (s = 0; s < nstrips; ++s)
112 for (i = 0; i < spacedim; ++i)
114 m_f->m_exp[s * nfields + i]->PhysDeriv(
115 m_f->m_exp[s * nfields + i]->GetPhys(), grad[i * spacedim],
116 grad[i * spacedim + 1]);
121 grad[0 * spacedim + 1], 1, outfield, 1);
123 Vmath::Vmul(npoints, outfield, 1, outfield, 1, omega, 1);
127 grad[0 * spacedim + 0], 1, S, 1);
130 grad[1 * spacedim + 1], 1, S, 1, S, 1);
134 grad[0 * spacedim + 1], 1, outfield, 1);
135 Vmath::Vmul(npoints, outfield, 1, outfield, 1, outfield, 1);
138 Vmath::Svtvm(npoints, fac, omega, 1, S, 1, outfield, 1);
139 Vmath::Smul(npoints, fac, outfield, 1, outfield, 1);
141 int fid = s * (nfields + 1) + nfields;
144 Exp->FwdTransLocalElmt(outfield,
m_f->m_exp[fid]->UpdateCoeffs());
147 else if (spacedim == 3)
152 for (s = 0; s < nstrips; ++s)
154 for (i = 0; i < spacedim; ++i)
156 m_f->m_exp[s * nfields + i]->PhysDeriv(
157 m_f->m_exp[s * nfields + i]->GetPhys(), grad[i * spacedim],
158 grad[i * spacedim + 1], grad[i * spacedim + 2]);
163 grad[1 * spacedim + 2], 1, outfield1, 1);
165 Vmath::Vmul(npoints, outfield1, 1, outfield1, 1, outfield1, 1);
169 grad[2 * spacedim + 0], 1, outfield2, 1);
171 Vmath::Vmul(npoints, outfield2, 1, outfield2, 1, outfield2, 1);
175 grad[0 * spacedim + 1], 1, outfield3, 1);
177 Vmath::Vmul(npoints, outfield3, 1, outfield3, 1, outfield3, 1);
180 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, omega, 1);
181 Vmath::Vadd(npoints, omega, 1, outfield3, 1, omega, 1);
186 grad[0 * spacedim + 0], 1, outfield1, 1);
189 grad[1 * spacedim + 1], 1, outfield2, 1);
192 grad[2 * spacedim + 2], 1, outfield3, 1);
195 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, S, 1);
200 grad[1 * spacedim + 2], 1, outfield1, 1);
201 Vmath::Vmul(npoints, outfield1, 1, outfield1, 1, outfield1, 1);
205 grad[2 * spacedim + 0], 1, outfield2, 1);
206 Vmath::Vmul(npoints, outfield2, 1, outfield2, 1, outfield2, 1);
210 grad[0 * spacedim + 1], 1, outfield3, 1);
211 Vmath::Vmul(npoints, outfield3, 1, outfield3, 1, outfield3, 1);
213 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, outfield2, 1);
214 Vmath::Vadd(npoints, outfield2, 1, outfield3, 1, outfield3, 1);
216 Vmath::Smul(npoints, fac, outfield3, 1, outfield3, 1);
221 Vmath::Smul(npoints, fac, outfield, 1, outfield, 1);
223 int fid = s * (nfields + 1) + nfields;
226 Exp->FwdTransLocalElmt(outfield,
m_f->m_exp[fid]->UpdateCoeffs());
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
Abstract base class for processing modules.
~ProcessQCriterion() override
ProcessQCriterion(FieldSharedPtr f)
static ModuleKey className
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
void v_Process(po::variables_map &vm) override
Write mesh to output file.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
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.
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
void Svtvm(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvm (scalar times vector minus vector): z = alpha*x - y.
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 Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
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.