39#include <boost/core/ignore_unused.hpp>
56 "Computes divergence of the velocity field.");
72 int expdim =
m_f->m_graph->GetMeshDimension();
74 if ((
m_f->m_numHomogeneousDir) == 1 || (
m_f->m_numHomogeneousDir) == 2)
78 int nfields =
m_f->m_variables.size();
80 "Error: Divergence for a 1D problem cannot be computed");
83 m_f->m_variables.push_back(
"divV");
86 if (
m_f->m_exp[0]->GetNumElmts() == 0)
90 int npoints =
m_f->m_exp[0]->GetNpoints();
96 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
111 vector<MultiRegions::ExpListSharedPtr> Exp(nstrips);
116 for (s = 0; s < nstrips; ++s)
122 if (
m_f->m_fieldMetaDataMap.count(
"MappingCartesianVel"))
124 if (
m_f->m_fieldMetaDataMap[
"MappingCartesianVel"] ==
"False")
127 if (
m_f->m_exp[0]->GetWaveSpace())
131 m_f->m_exp[0]->HomogeneousBwdTrans(npoints, vel[i],
136 mapping->ContravarToCartesian(vel, vel);
138 if (
m_f->m_exp[0]->GetWaveSpace())
142 m_f->m_exp[0]->HomogeneousFwdTrans(npoints, vel[i],
154 m_f->m_exp[s * nfields + i]->PhysDeriv(vel[i], tmp[0], tmp[1]);
155 mapping->CovarToCartesian(tmp, tmp);
170 m_f->m_exp[s * nfields + i]->PhysDeriv(vel[i], tmp[0], tmp[1],
172 mapping->CovarToCartesian(tmp, tmp);
187 Exp[s] =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
188 Vmath::Vcopy(npoints, outfield[0], 1, Exp[s]->UpdatePhys(), 1);
189 Exp[s]->FwdTransLocalElmt(outfield[0], Exp[s]->UpdateCoeffs());
192 for (s = 0; s < nstrips; ++s)
194 m_f->m_exp.insert(
m_f->m_exp.begin() + s * (nfields + 1) + nfields,
202 int nfields =
m_f->m_variables.size();
203 int npoints =
m_f->m_exp[0]->GetNpoints();
204 if (boost::iequals(
m_f->m_variables[0],
"u"))
214 else if (boost::iequals(
m_f->m_variables[0],
"rho") &&
215 boost::iequals(
m_f->m_variables[1],
"rhou"))
221 Vmath::Vdiv(npoints,
m_f->m_exp[strip * nfields + i + 1]->GetPhys(),
222 1,
m_f->m_exp[strip * nfields + 0]->GetPhys(), 1,
230 "Could not identify velocity for ProcessVelocityDivergence");
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
static GlobalMapping::MappingSharedPtr GetMapping(FieldSharedPtr f)
Abstract base class for processing modules.
void GetVelocity(Array< OneD, Array< OneD, NekDouble > > &vel, int strip=0)
virtual void v_Process(po::variables_map &vm) override
Write mesh to output file.
virtual ~ProcessVelocityDivergence()
static ModuleKey className
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
ProcessVelocityDivergence(FieldSharedPtr f)
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()
GLOBAL_MAPPING_EXPORT typedef std::shared_ptr< Mapping > MappingSharedPtr
A shared pointer to a Mapping object.
The above copyright notice and this permission notice shall be included.
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 Vdiv(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 Vcopy(int n, const T *x, const int incx, T *y, const int incy)