46 FilterEnergyBase::FilterEnergyBase(
49 const bool pConstDensity)
52 m_homogeneous (false),
54 m_constDensity(pConstDensity)
56 ParamMap::const_iterator it;
60 it = pParams.find(
"OutputFile");
61 if (it == pParams.end())
67 ASSERTL0(it->second.length() > 0,
"Missing parameter 'OutputFile'.");
72 m_comm = pSession->GetComm();
73 if (
m_comm->GetRank() == 0)
77 m_outFile.setf(ios::scientific, ios::floatfield);
81 <<
"# ---------------------------------------------"
88 it = pParams.find(
"OutputFrequency");
89 ASSERTL0(it != pParams.end(),
"Missing parameter 'OutputFrequency'.");
107 "Homogeneous 2D expansion not supported"
108 "for energy filter");
119 areaField = pFields[0]->GetPlane(0);
123 areaField = pFields[0];
127 m_area = areaField->Integral(inarray);
142 int i, nPoints = pFields[0]->GetNpoints();
155 for (i = 0; i < 3; ++i)
163 pFields[i]->HomogeneousBwdTrans(u[i], u[i]);
166 Vmath::Vvtvp(nPoints, u[i], 1, u[i], 1, tmp, 1, tmp, 1);
177 pFields[0]->HomogeneousFwdTrans(tmp, tmp2);
178 Ek = pFields[0]->GetPlane(0)->Integral(tmp2) * 2.0 * M_PI;
182 Ek = pFields[0]->Integral(tmp);
187 if (
m_comm->GetRank() == 0)
189 m_outFile << setw(17) << setprecision(8) << time
190 << setw(22) << setprecision(11) << Ek;
193 bool waveSpace[3] = {
194 pFields[0]->GetWaveSpace(),
195 pFields[1]->GetWaveSpace(),
196 pFields[2]->GetWaveSpace()
201 for (i = 0; i < 3; ++i)
203 pFields[i]->SetWaveSpace(
false);
210 for (i = 0; i < 3; ++i)
212 int f1 = (i+2) % 3, c2 = f1;
213 int c1 = (i+1) % 3, f2 = c1;
214 pFields[f1]->PhysDeriv(c1, u[f1], tmp2);
215 pFields[f2]->PhysDeriv(c2, u[f2], tmp3);
217 Vmath::Vvtvp(nPoints, tmp2, 1, tmp2, 1, tmp, 1, tmp, 1);
227 for (i = 0; i < 3; ++i)
229 pFields[i]->SetWaveSpace(waveSpace[i]);
231 pFields[0]->HomogeneousFwdTrans(tmp, tmp);
232 Ek = pFields[0]->GetPlane(0)->Integral(tmp) * 2 * M_PI;
236 Ek = pFields[0]->Integral(tmp);
241 if (
m_comm->GetRank() == 0)
243 m_outFile << setw(22) << setprecision(11) << Ek << endl;
264 ASSERTL0(
false,
"Needs to implemented by subclass");
270 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.
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)