43 const std::shared_ptr<EquationSystem> &pEquation,
45 :
Filter(pSession, pEquation)
50 auto it = pParams.find(
"OutputFile");
51 if (it == pParams.end())
57 ASSERTL0(it->second.length() > 0,
"Empty parameter 'OutputFile'.");
63 auto equationSys =
m_equ.lock();
64 ASSERTL0(equationSys,
"Weak pointer expired");
68 m_comm = pSession->GetComm();
69 if (
m_comm->GetRank() == 0)
73 m_outFile.setf(std::ios::scientific, std::ios::floatfield);
78 std::string varName = equationSys->GetVariable(i);
80 <<
" " + varName +
"_Linf";
87 it = pParams.find(
"OutputFrequency");
88 if (it == pParams.end())
94 ASSERTL0(it->second.length() > 0,
"Empty parameter 'OutputFrequency'.");
100 it = pParams.find(
"ConsoleOutput");
101 if (it == pParams.end())
107 ASSERTL0(it->second.length() > 0,
"Empty parameter 'ConsoleOutput'.");
108 ASSERTL0(it->second ==
"0" || it->second ==
"1",
109 "Parameter 'ConsoleOutput' can only be '0' or '1'.");
137 if (
m_comm->GetRank() == 0)
143 auto equationSys =
m_equ.lock();
144 ASSERTL0(equationSys,
"Weak pointer expired");
150 equationSys->EvaluateExactSolution(i, exactsoln, time);
152 NekDouble vL2Error = equationSys->L2Error(i, exactsoln);
153 NekDouble vLinfError = equationSys->LinfError(i, exactsoln);
155 if (
m_comm->GetRank() == 0)
157 m_outFile <<
" " << vL2Error <<
" " << vLinfError;
161 std::cout <<
"L 2 error (variable "
162 << equationSys->GetVariable(i) <<
") : " << vL2Error
164 std::cout <<
"L inf error (variable "
165 << equationSys->GetVariable(i) <<
") : " << vLinfError
171 if (
m_comm->GetRank() == 0)
182 if (
m_comm->GetRank() == 0)
#define ASSERTL0(condition, msg)
NekDouble Evaluate() const
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) final
SOLVER_UTILS_EXPORT FilterError(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< EquationSystem > &pEquation, const ParamMap &pParams)
LibUtilities::CommSharedPtr m_comm
bool v_IsTimeDependent() final
static std::string className
Name of the class.
void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) final
void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) final
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< EquationSystem > &pEquation, const std::map< std::string, std::string > &pParams)
Creates an instance of this class.
LibUtilities::SessionReaderSharedPtr m_session
const std::weak_ptr< EquationSystem > m_equ
std::map< std::string, std::string > ParamMap
std::shared_ptr< SessionReader > SessionReaderSharedPtr
FilterFactory & GetFilterFactory()