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

This processing module scales the input fld file. More...

#include <ProcessJacobianEnergy.h>

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

Public Member Functions

 ProcessJacobianEnergy (FieldSharedPtr f)
 
 ~ProcessJacobianEnergy () 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
 Write mesh to output file. More...
 
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 scales the input fld file.

Definition at line 44 of file ProcessJacobianEnergy.h.

Constructor & Destructor Documentation

◆ ProcessJacobianEnergy()

Nektar::FieldUtils::ProcessJacobianEnergy::ProcessJacobianEnergy ( FieldSharedPtr  f)

Definition at line 52 of file ProcessJacobianEnergy.cpp.

53 : ProcessModule(f)
54{
55 m_config["topmodes"] =
56 ConfigOption(false, "1", "how many top modes to keep ");
57}
std::map< std::string, ConfigOption > m_config
List of configuration values.
Definition: Module.h:272

References Nektar::FieldUtils::Module::m_config.

◆ ~ProcessJacobianEnergy()

Nektar::FieldUtils::ProcessJacobianEnergy::~ProcessJacobianEnergy ( )
override

Definition at line 59 of file ProcessJacobianEnergy.cpp.

60{
61}

Member Function Documentation

◆ create()

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

Creates an instance of this class.

Definition at line 48 of file ProcessJacobianEnergy.h.

49 {
51 }
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::ProcessJacobianEnergy::v_GetModuleDescription ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 66 of file ProcessJacobianEnergy.h.

67 {
68 return "Processing Jacobian";
69 }

◆ v_GetModuleName()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 61 of file ProcessJacobianEnergy.h.

62 {
63 return "ProcessJacobianEnergy";
64 }

◆ v_GetModulePriority()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 71 of file ProcessJacobianEnergy.h.

72 {
73 return eModifyExp;
74 }

References Nektar::FieldUtils::eModifyExp.

◆ v_Process()

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

Write mesh to output file.

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 63 of file ProcessJacobianEnergy.cpp.

64{
65 m_f->SetUpExp(vm);
66
67 int nfields = m_f->m_variables.size();
68 m_f->m_variables.push_back("jacenergy");
69 // Skip in case of empty partition
70 if (m_f->m_exp[0]->GetNumElmts() == 0)
71 {
72 return;
73 }
74
75 int NumHomogeneousDir = m_f->m_numHomogeneousDir;
77
78 if (nfields)
79 {
80 m_f->m_exp.resize(nfields + 1);
81 exp = m_f->AppendExpList(NumHomogeneousDir);
82 m_f->m_exp[nfields] = exp;
83 }
84 else
85 {
86 exp = m_f->m_exp[0];
87 }
88
89 Array<OneD, NekDouble> phys = exp->UpdatePhys();
90 Array<OneD, NekDouble> coeffs = exp->UpdateCoeffs();
91 Array<OneD, NekDouble> tmp;
92
93 for (int i = 0; i < exp->GetExpSize(); ++i)
94 {
95 // copy Jacobian into field
96 StdRegions::StdExpansionSharedPtr Elmt = exp->GetExp(i);
97
98 const StdRegions::StdExpansion *sep = &(*Elmt);
99 const LocalRegions::Expansion *lep =
100 dynamic_cast<const LocalRegions::Expansion *>(sep);
101
102 int nquad = Elmt->GetTotPoints();
103 int coeffoffset = exp->GetCoeff_Offset(i);
104 Array<OneD, const NekDouble> Jac =
105 lep->GetMetricInfo()->GetJac(Elmt->GetPointsKeys());
106 if (lep->GetMetricInfo()->GetGtype() == SpatialDomains::eRegular)
107 {
108 Vmath::Fill(nquad, Jac[0], phys, 1);
109 }
110 else
111 {
112 Vmath::Vcopy(nquad, Jac, 1, phys, 1);
113 }
114
115 if (lep->GetMetricInfo()->GetGtype() == SpatialDomains::eDeformed)
116 {
117 NekDouble jacmax = Vmath::Vmax(nquad, Jac, 1);
118 NekDouble jacmin = Vmath::Vmin(nquad, Jac, 1);
119
120 NekDouble jacmeasure = jacmax / jacmin - 1.0;
121 Vmath::Fill(nquad, jacmeasure, phys, 1);
122 }
123 else
124 {
125 Vmath::Fill(nquad, 0.0, phys, 1);
126 }
127
128 Elmt->FwdTrans(phys, tmp = coeffs + coeffoffset);
129 }
130 exp->BwdTrans(coeffs, phys);
131}
FieldSharedPtr m_f
Field object.
Definition: Module.h:239
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
@ eRegular
Geometry is straight-sided with constant geometric factors.
@ eDeformed
Geometry is curved or has non-constant factors.
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
double NekDouble
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
Definition: Vmath.hpp:725
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.hpp:54
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
Definition: Vmath.hpp:644
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825

References Nektar::SpatialDomains::eDeformed, Nektar::SpatialDomains::eRegular, Vmath::Fill(), Nektar::LocalRegions::Expansion::GetMetricInfo(), Nektar::StdRegions::StdExpansion::GetTotPoints(), Nektar::FieldUtils::Module::m_f, Vmath::Vcopy(), Vmath::Vmax(), and Vmath::Vmin().

Member Data Documentation

◆ className

ModuleKey Nektar::FieldUtils::ProcessJacobianEnergy::className
static
Initial value:
=
ModuleKey(eProcessModule, "jacobianenergy"),
"Show high frequency energy of Jacobian.")
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 52 of file ProcessJacobianEnergy.h.