52 "Computes divergence of the velocity field.");
68 int expdim =
m_f->m_graph->GetMeshDimension();
70 if ((
m_f->m_numHomogeneousDir) == 1 || (
m_f->m_numHomogeneousDir) == 2)
74 int nfields =
m_f->m_variables.size();
76 "Error: Divergence for a 1D problem cannot be computed");
79 m_f->m_variables.push_back(
"divV");
82 if (
m_f->m_exp[0]->GetNumElmts() == 0)
86 int npoints =
m_f->m_exp[0]->GetNpoints();
92 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
107 vector<MultiRegions::ExpListSharedPtr> Exp(nstrips);
112 for (s = 0; s < nstrips; ++s)
118 if (
m_f->m_fieldMetaDataMap.count(
"MappingCartesianVel"))
120 if (
m_f->m_fieldMetaDataMap[
"MappingCartesianVel"] ==
"False")
123 if (
m_f->m_exp[0]->GetWaveSpace())
127 m_f->m_exp[0]->HomogeneousBwdTrans(npoints, vel[i],
132 mapping->ContravarToCartesian(vel, vel);
134 if (
m_f->m_exp[0]->GetWaveSpace())
138 m_f->m_exp[0]->HomogeneousFwdTrans(npoints, vel[i],
150 m_f->m_exp[s * nfields + i]->PhysDeriv(vel[i], tmp[0], tmp[1]);
151 mapping->CovarToCartesian(tmp, tmp);
166 m_f->m_exp[s * nfields + i]->PhysDeriv(vel[i], tmp[0], tmp[1],
168 mapping->CovarToCartesian(tmp, tmp);
183 Exp[s] =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
184 Vmath::Vcopy(npoints, outfield[0], 1, Exp[s]->UpdatePhys(), 1);
185 Exp[s]->FwdTransLocalElmt(outfield[0], Exp[s]->UpdateCoeffs());
188 for (s = 0; s < nstrips; ++s)
190 m_f->m_exp.insert(
m_f->m_exp.begin() + s * (nfields + 1) + nfields,
198 int nfields =
m_f->m_variables.size();
199 int npoints =
m_f->m_exp[0]->GetNpoints();
200 if (boost::iequals(
m_f->m_variables[0],
"u"))
210 else if (boost::iequals(
m_f->m_variables[0],
"rho") &&
211 boost::iequals(
m_f->m_variables[1],
"rhou"))
217 Vmath::Vdiv(npoints,
m_f->m_exp[strip * nfields + i + 1]->GetPhys(),
218 1,
m_f->m_exp[strip * nfields + 0]->GetPhys(), 1,
226 "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)
void v_Process(po::variables_map &vm) override
Write mesh to output file.
~ProcessVelocityDivergence() override
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.
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)