46 const std::shared_ptr<SolverUtils::EquationSystem> &pEquation,
48 :
Filter(pSession, pEquation)
53 ASSERTL0(pParams.find(
"OutputFrequency") != pParams.end(),
54 "Missing parameter 'OutputFrequency'.");
57 pParams.find(
"OutputFrequency")->second);
60 ASSERTL0(pParams.find(
"WindowSize") != pParams.end(),
61 "Missing parameter 'WindowSize'.");
63 pParams.find(
"WindowSize")->second);
67 ASSERTL0(pParams.find(
"OverlapSize") != pParams.end(),
68 "Missing parameter 'OverlapSize'.");
70 pParams.find(
"OverlapSize")->second);
73 "'OverlapSize' must be smaller than 'WindowSize'.");
75 if (pParams.find(
"MeanV") != pParams.end())
79 pParams.find(
"MeanV")->second);
83 if (pParams.find(
"LinearTransitionOverlap") != pParams.end())
86 (pParams.find(
"LinearTransitionOverlap")->second ==
"true");
107 m_TimeStep = pFields[0]->GetSession()->GetParameter(
"TimeStep");
109 npoints = pFields[0]->GetPhys().size();
118 fftw_r2r_kind *fwd_kind =
new fftw_r2r_kind[
npoints];
119 std::fill_n(fwd_kind,
npoints, FFTW_R2HC);
124 fftw_r2r_kind *bwd_kind =
new fftw_r2r_kind[
npoints];
125 std::fill_n(bwd_kind,
npoints, FFTW_HC2R);
128 npoints, 1, &bwd_kind[0], FFTW_ESTIMATE);
156 for (
int j = 0; j <
npoints; ++j)
184 for (
int i = 1; i <
m_window / 2; ++i)
186 for (
int j = 0; j <
npoints; ++j)
204 std::stringstream vTmpFilename;
205 std::string vOutputFilename;
206 std::string ext =
".chk";
209 << fs::path(
m_outputFile).replace_extension(
"").string() <<
"_"
214 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
215 pFields[0]->GetFieldDefinitions();
216 std::vector<std::vector<NekDouble>> FieldData(FieldDef.size());
223 for (
int i = 0; i <
npoints; ++i)
234 for (
int i = 0; i <
npoints; ++i)
244 for (
int i = 0; i <
npoints; ++i)
246 phase[i] = atan2(
h[t *
npoints + i],
252 pFields[0]->FwdTransLocalElmt(phase, phase_coeff);
257 for (
int i = 0; i < FieldDef.size(); ++i)
259 FieldDef[i]->m_fields.push_back(
"phase");
260 pFields[0]->AppendFieldData(FieldDef[i], FieldData[i],
266 fieldMetaDataMap[
"Time"] = boost::lexical_cast<std::string>(
269 m_fld->Write(vOutputFilename, FieldDef, FieldData,
277 for (
int i = 0; i <
npoints; ++i)
#define ASSERTL0(condition, msg)
Array< OneD, NekDouble > overlap_phase
void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
~FilterHilbertFFTPhase() override
void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
FilterHilbertFFTPhase(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Array< OneD, NekDouble > oldV
Array< OneD, NekDouble > oldV_zero_mean
void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Array< OneD, NekDouble > fcoef
bool v_IsTimeDependent() override
unsigned int m_outputIndex
LibUtilities::FieldIOSharedPtr m_fld
unsigned int m_outputFrequency
static SolverUtils::FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Creates an instance of this class.
Array< OneD, NekDouble > h
static std::string className
Name of the class.
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()