Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::Utilities::ProcessGrad Class Reference

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

#include <ProcessGrad.h>

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

Public Member Functions

 ProcessGrad (FieldSharedPtr f)
 
virtual ~ProcessGrad ()
 
virtual void Process (po::variables_map &vm)
 Write mesh to output file. More...
 
- 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. More...
 
void PrintConfig ()
 Print out all configuration options for a module. More...
 
void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
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. More...
 

Static Public Member Functions

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

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

Detailed Description

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

Definition at line 50 of file ProcessGrad.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessGrad::ProcessGrad ( FieldSharedPtr  f)

Definition at line 55 of file ProcessGrad.cpp.

Nektar::Utilities::ProcessGrad::~ProcessGrad ( )
virtual

Definition at line 59 of file ProcessGrad.cpp.

60 {
61 }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 54 of file ProcessGrad.h.

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

54  {
56  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::Utilities::ProcessGrad::Process ( po::variables_map &  vm)
virtual

Write mesh to output file.

Implements Nektar::Utilities::Module.

Definition at line 63 of file ProcessGrad.cpp.

References Nektar::MultiRegions::DirCartesianMap, and Nektar::Utilities::Module::m_f.

64 {
65  if (m_f->m_verbose)
66  {
67  cout << "ProcessGrad: Calculating gradients..." << endl;
68  }
69 
70  int i, j;
71  int expdim = m_f->m_graph->GetMeshDimension();
72  int spacedim = m_f->m_fielddef[0]->m_numHomogeneousDir + expdim;
73  int nfields = m_f->m_fielddef[0]->m_fields.size();
74  int addfields = nfields*spacedim;
75 
76  int npoints = m_f->m_exp[0]->GetNpoints();
77  Array<OneD, Array<OneD, NekDouble> > grad(addfields);
78  m_f->m_exp.resize(nfields+addfields);
79 
80  for (i = 0; i < addfields; ++i)
81  {
82  grad[i] = Array<OneD, NekDouble>(npoints);
83  }
84 
85  // Calculate Gradient
86  for (i = 0; i < nfields; ++i)
87  {
88  for (j = 0; j < spacedim; ++j)
89  {
90  m_f->m_exp[i]->PhysDeriv(MultiRegions::DirCartesianMap[j],
91  m_f->m_exp[i]->GetPhys(),
92  grad[i*spacedim+j]);
93  }
94  }
95 
96  for (i = 0; i < addfields; ++i)
97  {
98  m_f->m_exp[nfields + i] = m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir);
99  m_f->m_exp[nfields + i]->UpdatePhys() = grad[i];
100  m_f->m_exp[nfields + i]->FwdTrans_IterPerExp(grad[i],
101  m_f->m_exp[nfields + i]->UpdateCoeffs());
102  }
103 
104  vector<string > outname;
105  for (i = 0; i<nfields; ++i)
106  {
107  if(spacedim == 1)
108  {
109  outname.push_back(m_f->m_fielddef[0]->m_fields[i]+"_x");
110  }
111  else if (spacedim == 2)
112  {
113  outname.push_back(m_f->m_fielddef[0]->m_fields[i]+"_x");
114  outname.push_back(m_f->m_fielddef[0]->m_fields[i]+"_y");
115  }
116  else if (spacedim == 3)
117  {
118  outname.push_back(m_f->m_fielddef[0]->m_fields[i]+"_x");
119  outname.push_back(m_f->m_fielddef[0]->m_fields[i]+"_y");
120  outname.push_back(m_f->m_fielddef[0]->m_fields[i]+"_z");
121  }
122  }
123 
124  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
125  = m_f->m_exp[0]->GetFieldDefinitions();
126  std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
127 
128  for (j = 0; j < nfields + addfields; ++j)
129  {
130  for (i = 0; i < FieldDef.size(); ++i)
131  {
132  if (j >= nfields)
133  {
134  FieldDef[i]->m_fields.push_back(outname[j-nfields]);
135  }
136  else
137  {
138  FieldDef[i]->m_fields.push_back(m_f->m_fielddef[0]->m_fields[j]);
139  }
140  m_f->m_exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
141  }
142  }
143 
144  m_f->m_fielddef = FieldDef;
145  m_f->m_data = FieldData;
146 }
FieldSharedPtr m_f
Field object.
MultiRegions::Direction const DirCartesianMap[]
Definition: ExpList.h:86

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessGrad::className
static
Initial value:
=
ModuleKey(eProcessModule, "gradient"),
ProcessGrad::create, "Computes gradient of fields.")

Definition at line 57 of file ProcessGrad.h.