54 const std::shared_ptr<EquationSystem> &pEquation,
const ParamMap &pParams)
55 :
Filter(pSession, pEquation)
58 auto it = pParams.find(
"OutputFile");
59 if (it == pParams.end())
65 ASSERTL0(it->second.length() > 0,
"Missing parameter 'OutputFile'.");
75 it = pParams.find(
"OutputFrequency");
76 if (it == pParams.end())
88 m_session->MatchSolverInfo(
"CalculatePerturbationEnergy",
"True",
98 it = pParams.find(
"OutputPlane");
99 if (it == pParams.end())
129 if (vComm->GetRank() == 0)
133 m_session->MatchSolverInfo(
"Driver",
"Adaptive", adaptive,
false);
176 int colrank = vComm->GetColumnComm()->GetRank();
177 int nproc = vComm->GetColumnComm()->GetSize();
193 ASSERTL0(
false,
"Stability analysis module not "
194 "implemented for the Compressible Flow "
195 "Solver. Please remove the function BaseFlow "
196 "from your .xml file");
204 string file =
m_session->GetFunctionFilename(
"BaseFlow", 0);
207 for (
int i = 0; i < pFields.size() - 1; ++i)
210 pFields[i]->GetCoeffs(), 1,
211 m_base[i]->GetCoeffs(), 1,
212 pFields[i]->UpdateCoeffs(), 1);
214 energy_tmp = pFields[i]->HomogeneousEnergy();
215 Vmath::Vadd(locsize, energy_tmp, 1, energy, 1, energy, 1);
218 pFields[i]->GetCoeffs(), 1,
219 m_base[i]->GetCoeffs(), 1,
220 pFields[i]->UpdateCoeffs(), 1);
232 for (
int i = 1; i < pFields.size() - 1; ++i)
234 energy_tmp = pFields[i]->HomogeneousEnergy();
235 Vmath::Vadd(locsize, energy_tmp, 1, energy, 1, energy, 1);
242 for (
int i = 0; i < pFields.size() - 1; ++i)
244 energy_tmp = pFields[i]->HomogeneousEnergy();
245 Vmath::Vadd(locsize, energy_tmp, 1, energy, 1, energy, 1);
255 for (j = 0; j < energy.size(); ++j, ++m)
258 << energy[j] << endl;
261 for (
int i = 1; i < nproc; ++i)
263 vComm->GetColumnComm()->Recv(i, energy);
265 for (j = 0; j < energy.size(); ++j, ++m)
268 << setw(18) << energy[j] << endl;
274 vComm->GetColumnComm()->Send(0, energy);
280 ASSERTL0(
false,
"3D Homogeneous 2D energy "
281 "dumping not implemented yet");
292 for (
int i = 1; i < pFields.size() - 1; ++i)
294 pFields[i]->SetPhysState(
true);
296 energy += norm * norm;
309 for (
int i = 0; i < pFields.size() - 1; ++i)
311 pFields[i]->SetPhysState(
true);
313 energy += norm * norm;
330 if (pFields[0]->GetComm()->GetRank() == 0)
349 if (pFields[
field]->GetPhysState() ==
false)
351 pFields[
field]->BwdTrans(pFields[
field]->GetCoeffs(),
352 pFields[
field]->UpdatePhys());
356 L2error = pFields[
field]->L2(pFields[
field]->GetPhys());
367 int m_expdim = graphShrPtr->GetMeshDimension();
370 if (
m_session->DefinesSolverInfo(
"PROJECTION"))
372 std::string ProjectStr =
m_session->GetSolverInfo(
"PROJECTION");
374 if ((ProjectStr ==
"Continuous") || (ProjectStr ==
"Galerkin") ||
375 (ProjectStr ==
"CONTINUOUS") || (ProjectStr ==
"GALERKIN"))
379 else if ((ProjectStr ==
"MixedCGDG") ||
380 (ProjectStr ==
"Mixed_CG_Discontinuous"))
384 else if (ProjectStr ==
"DisContinuous")
390 ASSERTL0(
false,
"PROJECTION value not recognised");
395 cerr <<
"Projection type not specified in SOLVERINFO,"
396 "defaulting to continuous Galerkin"
401 if (
m_session->DefinesSolverInfo(
"ModeType"))
415 if (
m_session->DefinesSolverInfo(
"ModeType"))
431 ASSERTL0(
false,
"SolverInfo ModeType not valid");
446 for (i = 0; i <
m_base.size(); i++)
465 for (i = 0; i <
m_base.size(); i++)
474 m_base[i]->SetWaveSpace(
true);
486 for (i = 0; i <
m_base.size(); i++)
495 m_base[i]->SetWaveSpace(
true);
505 for (i = 0; i <
m_base.size(); i++)
514 m_base[i]->SetWaveSpace(
false);
528 for (i = 1; i <
m_base.size(); i++)
543 for (i = 1; i <
m_base.size(); i++)
553 "Expansion dimension not recognised");
565 for (i = 0; i <
m_base.size(); i++)
575 for (i = 0; i <
m_base.size(); i++)
588 "Expansion dimension not recognised");
599 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
600 std::vector<std::vector<NekDouble>> FieldData;
603 m_fld->Import(pInfile, FieldDef, FieldData);
605 int nvar =
m_session->GetVariables().size();
606 if (
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
608 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
611 for (
int j = 0; j < nvar; ++j)
613 for (
int i = 0; i < FieldDef.size(); ++i)
615 bool flag = FieldDef[i]->m_fields[j] ==
m_session->GetVariable(j);
617 ASSERTL0(flag, (std::string(
"Order of ") + pInfile +
618 std::string(
" data and that defined in "
619 "m_boundaryconditions differs"))
622 m_base[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
623 FieldDef[i]->m_fields[j],
624 m_base[j]->UpdateCoeffs());
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Describes the specification for a Basis.
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.
Defines a specification for a set of points.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
LibUtilities::SessionReaderSharedPtr m_session
std::map< std::string, std::string > ParamMap
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< EquationSystem > &pEquation, const ParamMap &pParams)
void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
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
static std::string className
enum MultiRegions::ProjectionType m_projectionType
unsigned int m_outputFrequency
bool v_IsTimeDependent() override
SOLVER_UTILS_EXPORT FilterModalEnergy(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< EquationSystem > &pEquation, const ParamMap &pParams)
bool m_homogen_dealiasing
SOLVER_UTILS_EXPORT ~FilterModalEnergy() override
LibUtilities::FieldIOSharedPtr m_fld
unsigned int m_outputPlane
std::ofstream m_outputStream
void ImportFldBase(std::string pInfile)
NekDouble L2Error(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, unsigned int field, const NekDouble &time)
Array< OneD, MultiRegions::ExpListSharedPtr > m_base
void SetUpBaseFields(SpatialDomains::MeshGraphSharedPtr &mesh)
static MeshGraphSharedPtr Read(const LibUtilities::SessionReaderSharedPtr pSession, LibUtilities::DomainRangeShPtr rng=LibUtilities::NullDomainRangeShPtr, bool fillGraph=true, SpatialDomains::MeshGraphSharedPtr partitionedGraph=nullptr)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
@ eFourierEvenlySpaced
1D Evenly-spaced points using Fourier Fit
@ eFourierSingleModeSpaced
1D Non Evenly-spaced points for Single Mode analysis
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
@ eFourierHalfModeRe
Fourier Modified expansions with just the real part of the first mode .
@ eFourier
Fourier Expansion .
@ eMixed_CG_Discontinuous
std::shared_ptr< ContField > ContFieldSharedPtr
FilterFactory & GetFilterFactory()
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.