Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Nektar::FieldUtils::ProcessL2Criterion Class Reference

This processing module calculates the Lambda 2 Criterion and adds it as an extra-field to the output file. More...

#include <ProcessL2Criterion.h>

Inheritance diagram for Nektar::FieldUtils::ProcessL2Criterion:
[legend]

Public Member Functions

 ProcessL2Criterion (FieldSharedPtr f)
 
 ~ProcessL2Criterion () override
 
- Public Member Functions inherited from Nektar::FieldUtils::ProcessModule
 ProcessModule ()
 
 ProcessModule (FieldSharedPtr p_f)
 
- Public Member Functions inherited from Nektar::FieldUtils::Module
FIELD_UTILS_EXPORT Module (FieldSharedPtr p_f)
 
virtual ~Module ()=default
 
void Process (po::variables_map &vm)
 
std::string GetModuleName ()
 
std::string GetModuleDescription ()
 
const ConfigOptionGetConfigOption (const std::string &key) const
 
ModulePriority GetModulePriority ()
 
std::vector< ModuleKeyGetModulePrerequisites ()
 
FIELD_UTILS_EXPORT void RegisterConfig (std::string key, std::string value="")
 Register a configuration option with a module. More...
 
FIELD_UTILS_EXPORT void PrintConfig ()
 Print out all configuration options for a module. More...
 
FIELD_UTILS_EXPORT void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
FIELD_UTILS_EXPORT void AddFile (std::string fileType, std::string fileName)
 
FIELD_UTILS_EXPORT void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 

Static Public Member Functions

static std::shared_ptr< Modulecreate (FieldSharedPtr f)
 Creates an instance of this class. More...
 

Static Public Attributes

static ModuleKey className
 

Protected Member Functions

void v_Process (po::variables_map &vm) override
 
std::string v_GetModuleName () override
 
std::string v_GetModuleDescription () override
 
ModulePriority v_GetModulePriority () override
 
- Protected Member Functions inherited from Nektar::FieldUtils::Module
 Module ()
 
virtual void v_Process (po::variables_map &vm)
 
virtual std::string v_GetModuleName ()
 
virtual std::string v_GetModuleDescription ()
 
virtual ModulePriority v_GetModulePriority ()
 
virtual std::vector< ModuleKeyv_GetModulePrerequisites ()
 

Additional Inherited Members

- Public Attributes inherited from Nektar::FieldUtils::Module
FieldSharedPtr m_f
 Field object. More...
 
- Protected Attributes inherited from Nektar::FieldUtils::Module
std::map< std::string, ConfigOptionm_config
 List of configuration values. More...
 
std::set< std::string > m_allowedFiles
 List of allowed file formats. More...
 

Detailed Description

This processing module calculates the Lambda 2 Criterion and adds it as an extra-field to the output file.

Definition at line 47 of file ProcessL2Criterion.h.

Constructor & Destructor Documentation

◆ ProcessL2Criterion()

Nektar::FieldUtils::ProcessL2Criterion::ProcessL2Criterion ( FieldSharedPtr  f)

Definition at line 51 of file ProcessL2Criterion.cpp.

◆ ~ProcessL2Criterion()

Nektar::FieldUtils::ProcessL2Criterion::~ProcessL2Criterion ( )
override

Definition at line 55 of file ProcessL2Criterion.cpp.

56{
57}

Member Function Documentation

◆ create()

static std::shared_ptr< Module > Nektar::FieldUtils::ProcessL2Criterion::create ( FieldSharedPtr  f)
inlinestatic

Creates an instance of this class.

Definition at line 51 of file ProcessL2Criterion.h.

52 {
54 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

◆ v_GetModuleDescription()

std::string Nektar::FieldUtils::ProcessL2Criterion::v_GetModuleDescription ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 68 of file ProcessL2Criterion.h.

69 {
70 return "Calculating Lambda 2 Criterion";
71 }

◆ v_GetModuleName()

std::string Nektar::FieldUtils::ProcessL2Criterion::v_GetModuleName ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 63 of file ProcessL2Criterion.h.

64 {
65 return "ProcessL2Criterion";
66 }

◆ v_GetModulePriority()

ModulePriority Nektar::FieldUtils::ProcessL2Criterion::v_GetModulePriority ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 73 of file ProcessL2Criterion.h.

74 {
75 return eModifyExp;
76 }

References Nektar::FieldUtils::eModifyExp.

◆ v_Process()

void Nektar::FieldUtils::ProcessL2Criterion::v_Process ( po::variables_map &  vm)
overrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 126 of file ProcessL2Criterion.cpp.

127{
128 m_f->SetUpExp(vm);
129
130 auto nfields = m_f->m_variables.size();
131 m_f->m_variables.push_back("L2");
132
133 // Skip in case of empty partition
134 if (m_f->m_exp[0]->GetNumElmts() == 0)
135 {
136 return;
137 }
138
139 int i, s;
140 int expdim = m_f->m_graph->GetMeshDimension();
141 int spacedim = expdim + (m_f->m_numHomogeneousDir);
142
143 ASSERTL0(
144 spacedim == 3,
145 "ProcessL2Criterion must be computed for a 3D (or quasi-3D) case.");
146
147 int npoints = m_f->m_exp[0]->GetNpoints();
148
149 Array<OneD, Array<OneD, NekDouble>> grad(spacedim * spacedim);
150
151 // Will store the Lambdas
152 NekDouble a00, a11, a22, a01, a02, a12;
153 NekDouble t1, t2, t3, t4, t5, t6, t7, t8, t10, t11, t13, t14, t15;
154 NekDouble outfield1, outfield3;
155 Array<OneD, NekDouble> outfield2(npoints);
156
157 int nstrips;
158 m_f->m_session->LoadParameter("Strip_Z", nstrips, 1);
159
160 for (i = 0; i < spacedim * spacedim; ++i)
161 {
162 grad[i] = Array<OneD, NekDouble>(npoints);
163 }
164
166
167 for (s = 0; s < nstrips; ++s) // homogeneous strip varient
168 {
169 Exp = m_f->AppendExpList(m_f->m_numHomogeneousDir);
170 auto it = m_f->m_exp.begin() + s * (nfields + 1) + nfields;
171 m_f->m_exp.insert(it, Exp);
172 }
173
174 for (s = 0; s < nstrips; ++s) // homogeneous strip varient
175 {
176 for (i = 0; i < spacedim; ++i)
177 {
178 m_f->m_exp[s * nfields + i]->PhysDeriv(
179 m_f->m_exp[s * nfields + i]->GetPhys(), grad[i * spacedim],
180 grad[i * spacedim + 1], grad[i * spacedim + 2]);
181 }
182
183 /*
184 * For each node calculate the S^2+W^2 tensor
185 * where S and W are the symmetric and the skew-symmetric
186 * parts of the velocity gradient tensor D=grad(u),
187 * S=0.5(D+transpose(D)) and W=0.5((D-transpose(D)))
188 */
189 for (int j = 0; j < npoints; ++j)
190 {
191 // diff(u,y) + diff(v,x);
192 t1 = grad[0 * spacedim + 1][j] + grad[1 * spacedim + 0][j];
193 // diff(u,z) + diff(w,x);
194 t2 = grad[0 * spacedim + 2][j] + grad[2 * spacedim + 0][j];
195 // diff(u,y) - diff(v,x);
196 t3 = grad[0 * spacedim + 1][j] - grad[1 * spacedim + 0][j];
197 // diff(u,z) - diff(w,x);
198 t4 = grad[0 * spacedim + 2][j] - grad[2 * spacedim + 0][j];
199
200 t5 = t2 * t2;
201 t6 = t4 * t4;
202 t7 = t3 * t3;
203 t8 = t1 * t1;
204
205 // diff(w,y) + diff(v,z);
206 t10 = grad[2 * spacedim + 1][j] + grad[1 * spacedim + 2][j];
207 // diff(w,y) - diff(v,z);
208 t11 = grad[2 * spacedim + 1][j] - grad[1 * spacedim + 2][j];
209
210 t13 = 0.25 * (t10 * t2 + t11 * t4) +
211 0.5 * t1 *
212 (grad[0 * spacedim + 0][j] + grad[1 * spacedim + 1][j]);
213 t14 = 0.5 * t2 *
214 (grad[0 * spacedim + 0][j] + grad[2 * spacedim + 2][j]) +
215 0.25 * (t1 * t10 - t11 * t3);
216 t15 = t10 * t10;
217 t11 = t11 * t11;
218 t1 = 0.5 * t10 *
219 (grad[1 * spacedim + 1][j] + grad[2 * spacedim + 2][j]) -
220 0.25 * (-t1 * t2 + t3 * t4);
221
222 a00 = 0.25 * (t5 - t6 - t7 + t8) +
223 grad[0 * spacedim + 0][j] * grad[0 * spacedim + 0][j];
224 a01 = t13;
225 a02 = t14;
226 a11 = 0.25 * (-t7 + t8 + t15 - t11) +
227 grad[1 * spacedim + 1][j] * grad[1 * spacedim + 1][j];
228 a12 = t1;
229 a22 = 0.25 * (t5 - t6 + t15 - t11) +
230 grad[2 * spacedim + 2][j] * grad[2 * spacedim + 2][j];
231
232 // Compute the eigenvalues of a symmetric 3x3 matrix
233 MatSymEVals(a00, a11, a22, a01, a02, a12, outfield1, outfield2[j],
234 outfield3);
235 }
236
237 int fid = s * (nfields + 1) + nfields;
238 Vmath::Vcopy(npoints, outfield2, 1, m_f->m_exp[fid]->UpdatePhys(), 1);
239 m_f->m_exp[fid]->FwdTransLocalElmt(outfield2,
240 m_f->m_exp[fid]->UpdateCoeffs());
241 }
242}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
FieldSharedPtr m_f
Field object.
Definition: Module.h:239
void MatSymEVals(NekDouble d1, NekDouble d2, NekDouble d3, NekDouble a, NekDouble b, NekDouble c, NekDouble &l1, NekDouble &l2, NekDouble &l3)
Calculates eigenvalues of a 3x3 Symmetric matrix.
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
double NekDouble
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825

References ASSERTL0, Nektar::FieldUtils::Module::m_f, Nektar::FieldUtils::MatSymEVals(), and Vmath::Vcopy().

Member Data Documentation

◆ className

ModuleKey Nektar::FieldUtils::ProcessL2Criterion::className
static
Initial value:
=
"Computes Lambda 2 Criterion.")
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:197
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:180
ModuleFactory & GetModuleFactory()
Definition: Module.cpp:47

Definition at line 55 of file ProcessL2Criterion.h.