66 const std::shared_ptr<SolverUtils::EquationSystem> &pEquation,
67 const std::map<std::string, std::string> &pParams)
71 auto it = pParams.find(
"SampleFrequency");
72 if (it == pParams.end())
83 it = pParams.find(
"MovingAverage");
84 if (it == pParams.end())
90 std::string sOption = it->second.c_str();
91 m_movAvg = (boost::iequals(sOption,
"true")) ||
92 (boost::iequals(sOption,
"yes"));
101 it = pParams.find(
"alpha");
102 if (it == pParams.end())
104 it = pParams.find(
"tau");
105 if (it == pParams.end())
107 ASSERTL0(
false,
"MovingAverage needs either alpha or tau.");
116 m_session->LoadParameter(
"TimeStep", dT);
127 it = pParams.find(
"tau");
128 if (it != pParams.end())
131 "Cannot define both alpha and tau in MovingAverage.");
146 size_t dim = pFields.size() - 1;
147 size_t nExtraFields = (dim + 1) * dim / 2;
148 size_t origFields = pFields.size();
149 size_t nqtot = pFields[0]->GetTotPoints();
152 m_fields.resize(origFields + nExtraFields);
155 for (
size_t n = 0; n <
m_fields.size(); ++n)
159 for (
size_t n = 0; n <
m_delta.size(); ++n)
170 for (
size_t j = 0; j <
m_fields.size(); ++j)
173 if (pFields[0]->GetWaveSpace())
175 pFields[0]->HomogeneousBwdTrans(nqtot,
m_fields[j],
185 size_t dim = pFields.size() - 1;
186 size_t origFields = pFields.size();
189 for (
size_t n = 0; n < origFields; ++n)
191 m_variables.push_back(pFields[n]->GetSession()->GetVariable(n));
193 for (
int i = 0; i < dim; ++i)
195 for (
int j = i; j < dim; ++j)
197 std::string var = pFields[i]->GetSession()->GetVariable(i) +
198 pFields[j]->GetSession()->GetVariable(j);
210 size_t nq = pFields[0]->GetTotPoints();
211 size_t dim = pFields.size() - 1;
212 bool waveSpace = pFields[0]->GetWaveSpace();
223 NekDouble facOld, facAvg, facStress, facDelta;
226 facOld = 1.0 - alpha;
235 facStress = nSamples / (nSamples - 1);
236 facDelta = 1.0 / nSamples;
243 for (n = 0; n < dim; ++n)
247 pFields[n]->HomogeneousBwdTrans(nq, pFields[n]->GetPhys(), vel);
251 vel = pFields[n]->GetPhys();
268 for (i = 0, n = dim + 1; i < dim; ++i)
270 for (j = i; j < dim; ++j, ++n)
283 size_t dim = pFields.size() - 1;
288 bool waveSpace = pFields[0]->GetWaveSpace();
289 pFields[0]->SetWaveSpace(
false);
292 for (
size_t i = 0; i <
m_fields.size(); ++i)
301 pFields[0]->SetWaveSpace(waveSpace);
#define ASSERTL0(condition, msg)
NekDouble Evaluate() const
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
unsigned int m_sampleFrequency
std::vector< std::string > m_variables
unsigned int m_numSamples
LibUtilities::FieldMetaDataMap m_fieldMetaData
std::vector< Array< OneD, NekDouble > > m_outFields
SOLVER_UTILS_EXPORT void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
LibUtilities::SessionReaderSharedPtr m_session
NekDouble v_GetScale() override
SOLVER_UTILS_EXPORT FilterReynoldsStresses(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< SolverUtils::EquationSystem > &pEquation, const std::map< std::string, std::string > &pParams)
static std::string className
Name of the class.
std::vector< Array< OneD, NekDouble > > m_delta
void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
void v_FillVariablesName(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields) override
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< SolverUtils::EquationSystem > &pEquation, const std::map< std::string, std::string > &pParams)
Creates an instance of this class.
std::vector< Array< OneD, NekDouble > > m_fields
void v_PrepareOutput(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
SOLVER_UTILS_EXPORT ~FilterReynoldsStresses() override
void v_ProcessSample(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, std::vector< Array< OneD, NekDouble > > &fieldcoeffs, const NekDouble &time) override
std::shared_ptr< SessionReader > SessionReaderSharedPtr
FilterFactory & GetFilterFactory()
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
Svtsvtp (scalar times vector plus scalar times vector):
void Vmul(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 Svtvm(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvm (scalar times vector minus vector): z = alpha*x - y.