47 const bool pConstDensity)
50 m_homogeneous (false),
52 m_constDensity(pConstDensity)
54 ParamMap::const_iterator it;
58 it = pParams.find(
"OutputFile");
59 if (it == pParams.end())
65 ASSERTL0(it->second.length() > 0,
"Missing parameter 'OutputFile'.");
70 m_comm = pSession->GetComm();
71 if (
m_comm->GetRank() == 0)
75 m_outFile.setf(ios::scientific, ios::floatfield);
79 <<
"# ---------------------------------------------"
86 it = pParams.find(
"OutputFrequency");
87 ASSERTL0(it != pParams.end(),
"Missing parameter 'OutputFrequency'.");
105 "Homogeneous 2D expansion not supported"
106 "for energy filter");
117 areaField = pFields[0]->GetPlane(0);
121 areaField = pFields[0];
125 m_area = areaField->Integral(inarray);
140 int i, nPoints = pFields[0]->GetNpoints();
153 for (i = 0; i < 3; ++i)
161 pFields[i]->HomogeneousBwdTrans(u[i], u[i]);
164 Vmath::Vvtvp(nPoints, u[i], 1, u[i], 1, tmp, 1, tmp, 1);
175 pFields[0]->HomogeneousFwdTrans(tmp, tmp2);
176 Ek = pFields[0]->GetPlane(0)->Integral(tmp2) * 2.0 * M_PI;
180 Ek = pFields[0]->Integral(tmp);
185 if (
m_comm->GetRank() == 0)
187 m_outFile << setw(17) << setprecision(8) << time
188 << setw(22) << setprecision(11) << Ek;
191 bool waveSpace[3] = {
192 pFields[0]->GetWaveSpace(),
193 pFields[1]->GetWaveSpace(),
194 pFields[2]->GetWaveSpace()
199 for (i = 0; i < 3; ++i)
201 pFields[i]->SetWaveSpace(
false);
208 for (i = 0; i < 3; ++i)
210 int f1 = (i+2) % 3, c2 = f1;
211 int c1 = (i+1) % 3, f2 = c1;
212 pFields[f1]->PhysDeriv(c1, u[f1], tmp2);
213 pFields[f2]->PhysDeriv(c2, u[f2], tmp3);
215 Vmath::Vvtvp(nPoints, tmp2, 1, tmp2, 1, tmp, 1, tmp, 1);
225 for (i = 0; i < 3; ++i)
227 pFields[i]->SetWaveSpace(waveSpace[i]);
229 pFields[0]->HomogeneousFwdTrans(tmp, tmp);
230 Ek = pFields[0]->GetPlane(0)->Integral(tmp) * 2 * M_PI;
234 Ek = pFields[0]->Integral(tmp);
239 if (
m_comm->GetRank() == 0)
241 m_outFile << setw(22) << setprecision(11) << Ek << endl;
262 ASSERTL0(
false,
"Needs to implemented by subclass");
268 ASSERTL0(
false,
"Needs to implemented by subclass");
NekDouble m_homogeneousLength
virtual SOLVER_UTILS_EXPORT bool v_IsTimeDependent()
#define ASSERTL0(condition, msg)
unsigned int m_outputFrequency
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDouble > v_GetDensity(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFld)
SOLVER_UTILS_EXPORT ~FilterEnergyBase()
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
virtual SOLVER_UTILS_EXPORT void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pField, const NekDouble &time)
Array< OneD, unsigned int > m_planes
LibUtilities::CommSharedPtr m_comm
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual SOLVER_UTILS_EXPORT void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pField, const NekDouble &time)
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
virtual SOLVER_UTILS_EXPORT void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pField, const NekDouble &time)
std::map< std::string, std::string > ParamMap
LibUtilities::SessionReaderSharedPtr m_session
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
SOLVER_UTILS_EXPORT FilterEnergyBase(const LibUtilities::SessionReaderSharedPtr &pSession, const ParamMap &pParams, const bool pConstDensity=true)
void Zero(int n, T *x, const int incx)
Zero 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.
virtual SOLVER_UTILS_EXPORT void v_GetVelocity(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pField, const int i, Array< OneD, NekDouble > &velocity)