46 RegisterCreatorFunction(
"Energy1D", FilterEnergy1D::create);
54 FilterEnergy1D::FilterEnergy1D(
60 ASSERTL0(pSession->GetComm()->GetSize() == 1,
61 "The 1D energy filter currently only works in serial.");
63 ParamMap::const_iterator it;
67 it = pParams.find(
"OutputFile");
68 if (it == pParams.end())
74 ASSERTL0(it->second.length() > 0,
"Missing parameter 'OutputFile'.");
78 m_out.open(outName.c_str());
81 it = pParams.find(
"OutputFrequency");
82 if (it == pParams.end())
108 ASSERTL0(pFields[0]->GetExp(0)->GetNumBases() == 1,
109 "The Energy 1D filter is only valid in 1D.");
126 int nElmt = pFields[0]->GetExpSize();
129 m_out <<
"##" << endl;
130 m_out <<
"## Time = " << time << endl;
131 m_out <<
"##" << endl;
133 for (
int i = 0; i < nElmt; ++i)
137 int nModes = exp->GetBasis(0)->GetNumModes();
142 btype, nModes, exp->GetBasis(0)->GetPointsKey());
146 exp->GetBasis(0)->GetBasisType(),
147 exp->GetBasis(0)->GetNumModes(),
148 exp->GetBasis(0)->GetPointsKey());
152 pFields[0]->GetCoeffs() + pFields[0]->GetCoeff_Offset(i);
161 m_out <<
"# Element " << i <<
" (ID "
162 << exp->GetGeom()->GetGlobalID() <<
")" << endl;
163 for (
int j = 0; j < nModes; ++j)
165 m_out << coeffsOrth[j] << endl;
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pField, const NekDouble &time)
#define ASSERTL0(condition, msg)
void InterpCoeff1D(const BasisKey &fbasis0, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, Array< OneD, NekDouble > &to)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
std::ofstream m_out
Output file.
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pField, const NekDouble &time)
Update filter output with the current timestep's orthogonal coefficients.
SOLVER_UTILS_EXPORT ~FilterEnergy1D()
Destructor.
unsigned int m_index
Current index counter.
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pField, const NekDouble &time)
Initialize filter.
NekDouble Evaluate() const
Principle Orthogonal Functions .
boost::shared_ptr< Expansion > ExpansionSharedPtr
std::map< std::string, std::string > ParamMap
LibUtilities::SessionReaderSharedPtr m_session
virtual bool v_IsTimeDependent()
FilterFactory & GetFilterFactory()
Describes the specification for a Basis.
unsigned int m_outputFrequency
Output frequency.