69 const std::map<std::string, std::string> &pParams)
72 ParamMap::const_iterator it;
75 it = pParams.find(
"MovingAverage");
76 if (it == pParams.end())
82 std::string sOption = it->second.c_str();
83 m_movAvg = (boost::iequals(sOption,
"true")) ||
84 (boost::iequals(sOption,
"yes"));
93 it = pParams.find(
"alpha");
94 if (it == pParams.end())
96 it = pParams.find(
"tau");
97 if (it == pParams.end())
99 ASSERTL0(
false,
"MovingAverage needs either alpha or tau.");
108 m_session->LoadParameter(
"TimeStep", dT);
119 it = pParams.find(
"tau");
120 if (it != pParams.end())
123 "Cannot define both alpha and tau in MovingAverage.");
138 int dim = pFields.num_elements() - 1;
139 int nExtraFields = dim == 2 ? 3 : 6;
140 int origFields = pFields.num_elements();
143 for (
int n = 0; n < origFields; ++n)
145 m_variables.push_back(pFields[n]->GetSession()->GetVariable(n));
164 ASSERTL0(
false,
"Unsupported dimension");
168 m_fields.resize(origFields + nExtraFields);
171 for (
int n = 0; n <
m_fields.size(); ++n)
175 for (
int n = 0; n <
m_delta.size(); ++n)
189 int nq = pFields[0]->GetTotPoints();
190 int dim = pFields.num_elements() - 1;
191 bool waveSpace = pFields[0]->GetWaveSpace();
202 NekDouble facOld, facAvg, facStress, facDelta;
205 facOld = 1.0 - alpha;
214 facStress = nSamples / (nSamples - 1);
215 facDelta = 1.0 / nSamples;
222 for (n = 0; n < dim; ++n)
226 pFields[n]->HomogeneousBwdTrans(pFields[n]->GetPhys(), vel);
230 vel = pFields[n]->GetPhys();
239 pFields[dim]->GetCoeffs(),
254 for (i = 0, n = dim + 1; i < dim; ++i)
256 for (j = i; j < dim; ++j, ++n)
269 int dim = pFields.num_elements() - 1;
281 bool waveSpace = pFields[0]->GetWaveSpace();
282 pFields[0]->SetWaveSpace(
false);
285 for (
int i = 0; i <
m_fields.size(); ++i)
294 pFields[0]->SetWaveSpace(waveSpace);
#define ASSERTL0(condition, msg)
std::vector< Array< OneD, NekDouble > > m_outFields
SOLVER_UTILS_EXPORT ~FilterReynoldsStresses()
unsigned int m_numSamples
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
unsigned int m_sampleFrequency
std::vector< std::string > m_variables
virtual bool v_IsTimeDependent()
virtual void v_ProcessSample(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
NekDouble Evaluate() const
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
Creates an instance of this class.
virtual void v_PrepareOutput(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
void Svtvm(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x - y
virtual SOLVER_UTILS_EXPORT void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
SOLVER_UTILS_EXPORT FilterReynoldsStresses(const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
std::vector< Array< OneD, NekDouble > > m_delta
LibUtilities::SessionReaderSharedPtr m_session
std::vector< Array< OneD, NekDouble > > m_fields
static std::string className
Name of the class.
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
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)
vvtvvtp (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.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.