46 const std::shared_ptr<SolverUtils::EquationSystem> &pEquation,
48 :
Filter(pSession, pEquation)
50 if (pParams.find(
"OutputFile") == pParams.end())
56 ASSERTL0(!(pParams.find(
"OutputFile")->second.empty()),
57 "Missing parameter 'OutputFile'.");
60 ASSERTL0(pParams.find(
"OutputFrequency") != pParams.end(),
61 "Missing parameter 'OutputFrequency'.");
63 pParams.find(
"OutputFrequency")->second);
66 if (pParams.find(
"MeanV") != pParams.end())
69 pParams.find(
"MeanV")->second);
89 oldV = pFields[0]->GetPhys();
103 std::stringstream vOutputFilename;
107 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
108 pFields[0]->GetFieldDefinitions();
109 std::vector<std::vector<NekDouble>> FieldData(FieldDef.size());
116 for (
int i = 0; i < currentV.size(); ++i)
118 phase[i] = atan2(currentV[i] -
meanV,
123 pFields[0]->FwdTransLocalElmt(phase, phase_coeff);
128 for (
int i = 0; i < FieldDef.size(); ++i)
130 FieldDef[i]->m_fields.push_back(
"phase");
131 pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], phase_coeff);
139 fieldMetaDataMap[
"Time"] = boost::lexical_cast<std::string>(time);
141 m_fld->Write(vOutputFilename.str(), FieldDef, FieldData, fieldMetaDataMap);
#define ASSERTL0(condition, msg)
FilterOffsetPhase(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
static std::string className
Name of the class.
Array< OneD, NekDouble > oldV
void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
unsigned int m_outputIndex
bool v_IsTimeDependent() override
unsigned int m_outputFrequency
~FilterOffsetPhase() override
static SolverUtils::FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Creates an instance of this class.
LibUtilities::FieldIOSharedPtr m_fld
void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
NekDouble Evaluate() const
static std::shared_ptr< FieldIO > CreateDefault(const LibUtilities::SessionReaderSharedPtr session)
Returns an object for the default FieldIO method.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
LibUtilities::SessionReaderSharedPtr m_session
std::map< std::string, std::string > ParamMap
std::map< std::string, std::string > FieldMetaDataMap
std::shared_ptr< SessionReader > SessionReaderSharedPtr
FilterFactory & GetFilterFactory()