35 #include <boost/core/ignore_unused.hpp> 47 RegisterCreatorFunction(
"Energy1D", FilterEnergy1D::create);
55 FilterEnergy1D::FilterEnergy1D(
57 const std::weak_ptr<EquationSystem> &pEquation,
59 Filter(pSession, pEquation),
62 ASSERTL0(pSession->GetComm()->GetSize() == 1,
63 "The 1D energy filter currently only works in serial.");
68 auto it = pParams.find(
"OutputFile");
69 if (it == pParams.end())
75 ASSERTL0(it->second.length() > 0,
"Missing parameter 'OutputFile'.");
79 m_out.open(outName.c_str());
82 it = pParams.find(
"OutputFrequency");
83 if (it == pParams.end())
110 boost::ignore_unused(time);
111 ASSERTL0(pFields[0]->GetExp(0)->GetNumBases() == 1,
112 "The Energy 1D filter is only valid in 1D.");
129 int nElmt = pFields[0]->GetExpSize();
132 m_out <<
"##" << endl;
133 m_out <<
"## Time = " << time << endl;
134 m_out <<
"##" << endl;
136 for (
int i = 0; i < nElmt; ++i)
140 int nModes = exp->GetBasis(0)->GetNumModes();
145 btype, nModes, exp->GetBasis(0)->GetPointsKey());
149 exp->GetBasis(0)->GetBasisType(),
150 exp->GetBasis(0)->GetNumModes(),
151 exp->GetBasis(0)->GetPointsKey());
155 pFields[0]->GetCoeffs() + pFields[0]->GetCoeff_Offset(i);
164 m_out <<
"# Element " << i <<
" (ID " 165 << exp->GetGeom()->GetGlobalID() <<
")" << endl;
166 for (
int j = 0; j < nModes; ++j)
168 m_out << coeffsOrth[j] << endl;
178 boost::ignore_unused(pFields, time);
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)
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.
Principle Orthogonal Functions .
std::map< std::string, std::string > ParamMap
LibUtilities::SessionReaderSharedPtr m_session
std::shared_ptr< Expansion > ExpansionSharedPtr
virtual bool v_IsTimeDependent()
FilterFactory & GetFilterFactory()
Describes the specification for a Basis.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
unsigned int m_outputFrequency
Output frequency.