Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::Utilities::ProcessVorticity Class Reference

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

#include <ProcessVorticity.h>

Inheritance diagram for Nektar::Utilities::ProcessVorticity:
Inheritance graph
[legend]
Collaboration diagram for Nektar::Utilities::ProcessVorticity:
Collaboration graph
[legend]

Public Member Functions

 ProcessVorticity (FieldSharedPtr f)
virtual ~ProcessVorticity ()
virtual void Process (po::variables_map &vm)
 Write mesh to output file.
- Public Member Functions inherited from Nektar::Utilities::ProcessModule
 ProcessModule ()
 ProcessModule (FieldSharedPtr p_f)
 ProcessModule (MeshSharedPtr p_m)
- Public Member Functions inherited from Nektar::Utilities::Module
 Module (FieldSharedPtr p_f)
void RegisterConfig (string key, string value)
 Register a configuration option with a module.
void PrintConfig ()
 Print out all configuration options for a module.
void SetDefaults ()
 Sets default configuration options for those which have not been set.
bool GetRequireEquiSpaced (void)
void SetRequireEquiSpaced (bool pVal)
void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 Module (MeshSharedPtr p_m)
virtual void Process ()=0
void RegisterConfig (string key, string value)
void PrintConfig ()
void SetDefaults ()
MeshSharedPtr GetMesh ()
virtual void ProcessVertices ()
 Extract element vertices.

Static Public Member Functions

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

Static Public Attributes

static ModuleKey className

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Utilities::Module
 Module ()
virtual void ProcessEdges (bool ReprocessEdges=true)
 Extract element edges.
virtual void ProcessFaces (bool ReprocessFaces=true)
 Extract element faces.
virtual void ProcessElements ()
 Generate element IDs.
virtual void ProcessComposites ()
 Generate composites.
void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly.
void PrismLines (int prism, PerMap &perFaces, set< int > &prismsDone, vector< ElementSharedPtr > &line)
- Protected Attributes inherited from Nektar::Utilities::Module
FieldSharedPtr m_f
 Field object.
map< string, ConfigOptionm_config
 List of configuration values.
bool m_requireEquiSpaced
MeshSharedPtr m_mesh
 Mesh object.

Detailed Description

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

Definition at line 49 of file ProcessVorticity.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessVorticity::ProcessVorticity ( FieldSharedPtr  f)

Definition at line 54 of file ProcessVorticity.cpp.

{
}
Nektar::Utilities::ProcessVorticity::~ProcessVorticity ( )
virtual

Definition at line 58 of file ProcessVorticity.cpp.

{
}

Member Function Documentation

static boost::shared_ptr<Module> Nektar::Utilities::ProcessVorticity::create ( FieldSharedPtr  f)
inlinestatic

Creates an instance of this class.

Definition at line 53 of file ProcessVorticity.h.

void Nektar::Utilities::ProcessVorticity::Process ( po::variables_map &  vm)
virtual

Write mesh to output file.

Implements Nektar::Utilities::Module.

Definition at line 62 of file ProcessVorticity.cpp.

References ASSERTL0, Nektar::Utilities::Module::m_f, and Vmath::Vsub().

{
if (m_f->m_verbose)
{
cout << "ProcessVorticity: Calculating vorticity..." << endl;
}
int i, j;
int expdim = m_f->m_graph->GetMeshDimension();
int spacedim = expdim;
if ((m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
(m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
{
spacedim = 3;
}
int nfields = m_f->m_fielddef[0]->m_fields.size();
if (spacedim == 1)
{
ASSERTL0(false, "Error: Vorticity for a 1D problem cannot "
"be computed")
}
int addfields = (spacedim == 2)? 1:3;
int npoints = m_f->m_exp[0]->GetNpoints();
Array<OneD, Array<OneD, NekDouble> > grad(nfields*nfields);
Array<OneD, Array<OneD, NekDouble> > outfield(addfields);
m_f->m_exp.resize(nfields+addfields);
for (i = 0; i < nfields*nfields; ++i)
{
grad[i] = Array<OneD, NekDouble>(npoints);
}
for (i = 0; i < addfields; ++i)
{
outfield[i] = Array<OneD, NekDouble>(npoints);
}
// Calculate Gradient & Vorticity
if (spacedim == 2)
{
for (i = 0; i < nfields; ++i)
{
m_f->m_exp[i]->PhysDeriv(m_f->m_exp[i]->GetPhys(),
grad[i*nfields],
grad[i*nfields+1]);
}
// W_z = Vx - Uy
Vmath::Vsub(npoints, grad[1*nfields+0], 1,
grad[0*nfields+1], 1,
outfield[0], 1);
}
else
{
for (i = 0; i < nfields; ++i)
{
m_f->m_exp[i]->PhysDeriv(m_f->m_exp[i]->GetPhys(),
grad[i*nfields],
grad[i*nfields+1],
grad[i*nfields+2]);
}
// W_x = Wy - Vz
Vmath::Vsub(npoints, grad[2*nfields+1], 1, grad[1*nfields+2], 1,
outfield[0],1);
// W_y = Uz - Wx
Vmath::Vsub(npoints, grad[0*nfields+2], 1, grad[2*nfields+0], 1,
outfield[1], 1);
// W_z = Vx - Uy
Vmath::Vsub(npoints, grad[1*nfields+0], 1, grad[0*nfields+1], 1,
outfield[2], 1);
}
for (i = 0; i < addfields; ++i)
{
m_f->m_exp[nfields + i] = m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir);
m_f->m_exp[nfields + i]->UpdatePhys() = outfield[i];
m_f->m_exp[nfields + i]->FwdTrans_IterPerExp(outfield[i],
m_f->m_exp[nfields + i]->UpdateCoeffs());
}
vector<string > outname;
if (addfields == 1)
{
outname.push_back("W_z");
}
else
{
outname.push_back("W_x");
outname.push_back("W_y");
outname.push_back("W_z");
}
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
= m_f->m_exp[0]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
for (j = 0; j < nfields + addfields; ++j)
{
for (i = 0; i < FieldDef.size(); ++i)
{
if (j >= nfields)
{
FieldDef[i]->m_fields.push_back(outname[j-nfields]);
}
else
{
FieldDef[i]->m_fields.push_back(m_f->m_fielddef[0]->m_fields[j]);
}
m_f->m_exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
}
}
m_f->m_fielddef = FieldDef;
m_f->m_data = FieldData;
}

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessVorticity::className
static
Initial value:

Definition at line 56 of file ProcessVorticity.h.