58 ASSERTL0(pSession->GetComm()->GetSize() == 1,
59 "The 1D energy filter currently only works in serial.");
61 ParamMap::const_iterator it;
65 it = pParams.find(
"OutputFile");
66 if (it == pParams.end())
72 ASSERTL0(it->second.length() > 0,
"Missing parameter 'OutputFile'.");
76 m_out.open(outName.c_str());
79 it = pParams.find(
"OutputFrequency");
80 if (it == pParams.end())
106 ASSERTL0(pFields[0]->GetExp(0)->GetNumBases() == 1,
107 "The Energy 1D filter is only valid in 1D.");
124 int nElmt = pFields[0]->GetExpSize();
127 m_out <<
"##" << endl;
128 m_out <<
"## Time = " << time << endl;
129 m_out <<
"##" << endl;
131 for (
int i = 0; i < nElmt; ++i)
135 int nModes = exp->GetBasis(0)->GetNumModes();
140 btype, nModes, exp->GetBasis(0)->GetPointsKey());
144 exp->GetBasis(0)->GetBasisType(),
145 exp->GetBasis(0)->GetNumModes(),
146 exp->GetBasis(0)->GetPointsKey());
150 pFields[0]->GetCoeffs() + pFields[0]->GetCoeff_Offset(i);
159 m_out <<
"# Element " << i <<
" (ID "
160 << exp->GetGeom()->GetGlobalID() <<
")" << endl;
161 for (
int j = 0; j < nModes; ++j)
163 m_out << coeffsOrth[j] << endl;
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pField, const NekDouble &time)
#define ASSERTL0(condition, msg)
SOLVER_UTILS_EXPORT FilterEnergy1D(const LibUtilities::SessionReaderSharedPtr &pSession, const ParamMap &pParams)
Set up filter with output file and frequency parameters.
void InterpCoeff1D(const BasisKey &fbasis0, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, Array< OneD, NekDouble > &to)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
static std::string className
Name of the class.
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.
ofstream m_out
Output file.
NekDouble Evaluate() const
Principle Orthogonal Functions .
std::map< std::string, std::string > ParamMap
LibUtilities::SessionReaderSharedPtr m_session
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
Creates an instance of this class.
boost::shared_ptr< Expansion > ExpansionSharedPtr
virtual bool v_IsTimeDependent()
FilterFactory & GetFilterFactory()
Describes the specification for a Basis.
unsigned int m_outputFrequency
Output frequency.