37#include <boost/core/ignore_unused.hpp>
57 const std::weak_ptr<EquationSystem> &pEquation,
const ParamMap &pParams)
58 :
Filter(pSession, pEquation)
61 auto it = pParams.find(
"OutputFile");
62 if (it == pParams.end())
68 ASSERTL0(it->second.length() > 0,
"Missing parameter 'OutputFile'.");
78 it = pParams.find(
"OutputFrequency");
79 if (it == pParams.end())
91 m_session->MatchSolverInfo(
"CalculatePerturbationEnergy",
"True",
101 it = pParams.find(
"OutputPlane");
102 if (it == pParams.end())
132 if (vComm->GetRank() == 0)
136 m_session->MatchSolverInfo(
"Driver",
"Adaptive", adaptive,
false);
179 int colrank = vComm->GetColumnComm()->GetRank();
180 int nproc = vComm->GetColumnComm()->GetSize();
196 ASSERTL0(
false,
"Stability analysis module not "
197 "implemented for the Compressible Flow "
198 "Solver. Please remove the function BaseFlow "
199 "from your .xml file");
207 string file =
m_session->GetFunctionFilename(
"BaseFlow", 0);
210 for (
int i = 0; i < pFields.size() - 1; ++i)
213 pFields[i]->GetCoeffs(), 1,
214 m_base[i]->GetCoeffs(), 1,
215 pFields[i]->UpdateCoeffs(), 1);
217 energy_tmp = pFields[i]->HomogeneousEnergy();
218 Vmath::Vadd(locsize, energy_tmp, 1, energy, 1, energy, 1);
221 pFields[i]->GetCoeffs(), 1,
222 m_base[i]->GetCoeffs(), 1,
223 pFields[i]->UpdateCoeffs(), 1);
235 for (
int i = 1; i < pFields.size() - 1; ++i)
237 energy_tmp = pFields[i]->HomogeneousEnergy();
238 Vmath::Vadd(locsize, energy_tmp, 1, energy, 1, energy, 1);
245 for (
int i = 0; i < pFields.size() - 1; ++i)
247 energy_tmp = pFields[i]->HomogeneousEnergy();
248 Vmath::Vadd(locsize, energy_tmp, 1, energy, 1, energy, 1);
258 for (j = 0; j < energy.size(); ++j, ++m)
261 << energy[j] << endl;
264 for (
int i = 1; i < nproc; ++i)
266 vComm->GetColumnComm()->Recv(i, energy);
268 for (j = 0; j < energy.size(); ++j, ++m)
271 << setw(18) << energy[j] << endl;
277 vComm->GetColumnComm()->Send(0, energy);
283 ASSERTL0(
false,
"3D Homogeneous 2D energy "
284 "dumping not implemented yet");
295 for (
int i = 1; i < pFields.size() - 1; ++i)
297 pFields[i]->SetPhysState(
true);
299 energy += norm * norm;
312 for (
int i = 0; i < pFields.size() - 1; ++i)
314 pFields[i]->SetPhysState(
true);
316 energy += norm * norm;
333 boost::ignore_unused(time);
335 if (pFields[0]->GetComm()->GetRank() == 0)
347 unsigned int field,
const NekDouble &time)
349 boost::ignore_unused(time);
356 if (pFields[field]->GetPhysState() ==
false)
358 pFields[field]->BwdTrans(pFields[field]->GetCoeffs(),
359 pFields[field]->UpdatePhys());
363 L2error = pFields[field]->L2(pFields[field]->GetPhys());
374 int m_expdim = graphShrPtr->GetMeshDimension();
377 if (
m_session->DefinesSolverInfo(
"PROJECTION"))
379 std::string ProjectStr =
m_session->GetSolverInfo(
"PROJECTION");
381 if ((ProjectStr ==
"Continuous") || (ProjectStr ==
"Galerkin") ||
382 (ProjectStr ==
"CONTINUOUS") || (ProjectStr ==
"GALERKIN"))
386 else if ((ProjectStr ==
"MixedCGDG") ||
387 (ProjectStr ==
"Mixed_CG_Discontinuous"))
391 else if (ProjectStr ==
"DisContinuous")
397 ASSERTL0(
false,
"PROJECTION value not recognised");
402 cerr <<
"Projection type not specified in SOLVERINFO,"
403 "defaulting to continuous Galerkin"
408 if (
m_session->DefinesSolverInfo(
"ModeType"))
422 if (
m_session->DefinesSolverInfo(
"ModeType"))
438 ASSERTL0(
false,
"SolverInfo ModeType not valid");
453 for (i = 0; i <
m_base.size(); i++)
472 for (i = 0; i <
m_base.size(); i++)
481 m_base[i]->SetWaveSpace(
true);
493 for (i = 0; i <
m_base.size(); i++)
502 m_base[i]->SetWaveSpace(
true);
512 for (i = 0; i <
m_base.size(); i++)
521 m_base[i]->SetWaveSpace(
false);
535 for (i = 1; i <
m_base.size(); i++)
550 for (i = 1; i <
m_base.size(); i++)
560 "Expansion dimension not recognised");
572 for (i = 0; i <
m_base.size(); i++)
582 for (i = 0; i <
m_base.size(); i++)
595 "Expansion dimension not recognised");
606 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
607 std::vector<std::vector<NekDouble>> FieldData;
610 m_fld->Import(pInfile, FieldDef, FieldData);
612 int nvar =
m_session->GetVariables().size();
613 if (
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
615 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
618 for (
int j = 0; j < nvar; ++j)
620 for (
int i = 0; i < FieldDef.size(); ++i)
622 bool flag = FieldDef[i]->m_fields[j] ==
m_session->GetVariable(j);
624 ASSERTL0(flag, (std::string(
"Order of ") + pInfile +
625 std::string(
" data and that defined in "
626 "m_boundaryconditions differs"))
629 m_base[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
630 FieldDef[i]->m_fields[j],
631 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
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
virtual 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
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const ParamMap &pParams)
virtual bool v_IsTimeDependent() override
bool m_homogen_dealiasing
LibUtilities::FieldIOSharedPtr m_fld
unsigned int m_outputPlane
SOLVER_UTILS_EXPORT FilterModalEnergy(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const ParamMap &pParams)
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
virtual SOLVER_UTILS_EXPORT ~FilterModalEnergy()
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
The above copyright notice and this permission notice shall be included.
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.