46 const std::shared_ptr<SolverUtils::EquationSystem> &pEquation,
48 :
Filter(pSession, pEquation)
53 ASSERTL0(pParams.find(
"OutputFrequency") != pParams.end(),
54 "Missing parameter 'OutputFrequency'.");
56 pParams.find(
"OutputFrequency")->second);
59 if (pParams.find(
"MeanV") != pParams.end())
62 pParams.find(
"MeanV")->second);
82 oldV = pFields[0]->GetPhys();
96 std::stringstream vTmpFilename;
97 std::string vOutputFilename;
98 std::string ext =
".chk";
100 vTmpFilename << fs::path(
m_outputFile).replace_extension(
"").string() <<
"_"
105 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
106 pFields[0]->GetFieldDefinitions();
107 std::vector<std::vector<NekDouble>> FieldData(FieldDef.size());
114 for (
int i = 0; i < currentV.size(); ++i)
116 phase[i] = atan2(currentV[i] -
meanV,
121 pFields[0]->FwdTransLocalElmt(phase, phase_coeff);
126 for (
int i = 0; i < FieldDef.size(); ++i)
128 FieldDef[i]->m_fields.push_back(
"phase");
129 pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], phase_coeff);
137 fieldMetaDataMap[
"Time"] = boost::lexical_cast<std::string>(time);
139 m_fld->Write(vOutputFilename, 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.
SOLVER_UTILS_EXPORT std::string SetupOutput(const std::string ext, const ParamMap &pParams)
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()