37 #include <boost/core/ignore_unused.hpp>
49 RegisterCreatorFunction(
"ModalEnergy", FilterModalEnergy::create);
54 FilterModalEnergy::FilterModalEnergy(
56 const std::weak_ptr<EquationSystem> &pEquation,
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())
93 m_session->MatchSolverInfo(
"CalculatePerturbationEnergy",
"True",
103 it = pParams.find(
"OutputPlane");
104 if (it == pParams.end())
111 m_session->GetInterpreter(), it->second);
136 if (vComm->GetRank() == 0)
140 m_session->MatchSolverInfo(
"Driver",
"Adaptive",
186 int colrank = vComm->GetColumnComm()->GetRank();
187 int nproc = vComm->GetColumnComm()->GetSize();
204 ASSERTL0(
false,
"Stability analysis module not "
205 "implemented for the Compressible Flow "
206 "Solver. Please remove the function BaseFlow "
207 "from your .xml file");
216 GetFunctionFilename(
"BaseFlow", 0);
219 for (
int i = 0; i < pFields.size()-1; ++i)
222 pFields[i]->GetCoeffs(), 1,
223 m_base [i]->GetCoeffs(), 1,
224 pFields[i]->UpdateCoeffs(), 1);
226 energy_tmp = pFields[i]->HomogeneousEnergy();
228 energy, 1, energy, 1);
231 pFields[i]->GetCoeffs(), 1,
232 m_base[i]->GetCoeffs(), 1,
233 pFields[i]->UpdateCoeffs(), 1);
246 for (
int i = 1; i < pFields.size()-1; ++i)
248 energy_tmp = pFields[i]->HomogeneousEnergy();
250 energy, 1, energy, 1);
257 for (
int i = 0; i < pFields.size()-1; ++i)
259 energy_tmp = pFields[i]->HomogeneousEnergy();
261 energy, 1, energy, 1);
271 for (j = 0; j < energy.size(); ++j, ++m)
275 << setw(18) << energy[j] << endl;
278 for (
int i = 1; i < nproc; ++i)
280 vComm->GetColumnComm()->Recv(i, energy);
282 for (j = 0; j < energy.size(); ++j, ++m)
286 << setw(18) << energy[j] << endl;
292 vComm->GetColumnComm()->Send(0, energy);
298 ASSERTL0(
false,
"3D Homogeneous 2D energy "
299 "dumping not implemented yet");
311 for (
int i = 1; i < pFields.size()-1; ++i)
313 pFields[i]->SetPhysState(
true);
315 energy += norm * norm;
328 for (
int i = 0; i < pFields.size()-1; ++i)
330 pFields[i]->SetPhysState(
true);
332 energy += norm * norm;
349 boost::ignore_unused(time);
351 if (pFields[0]->GetComm()->GetRank() == 0)
366 boost::ignore_unused(time);
373 if (pFields[field]->GetPhysState() ==
false)
375 pFields[field]->BwdTrans(pFields[field]->GetCoeffs(),
376 pFields[field]->UpdatePhys());
380 L2error = pFields[field]->L2(pFields[field]->GetPhys());
391 int m_expdim = graphShrPtr->GetMeshDimension();
394 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
396 std::string ProjectStr =
m_session->GetSolverInfo(
"PROJECTION");
398 if ((ProjectStr ==
"Continuous") ||
399 (ProjectStr ==
"Galerkin") ||
400 (ProjectStr ==
"CONTINUOUS") ||
401 (ProjectStr ==
"GALERKIN"))
405 else if ((ProjectStr ==
"MixedCGDG") ||
406 (ProjectStr ==
"Mixed_CG_Discontinuous"))
410 else if(ProjectStr ==
"DisContinuous")
416 ASSERTL0(
false,
"PROJECTION value not recognised");
421 cerr <<
"Projection type not specified in SOLVERINFO,"
422 "defaulting to continuous Galerkin" << endl;
426 if (
m_session->DefinesSolverInfo(
"ModeType"))
428 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",
430 m_session->MatchSolverInfo(
"ModeType",
"HalfMode",
432 m_session->MatchSolverInfo(
"ModeType",
"MultipleModes",
437 m_session->MatchSolverInfo(
"DEALIASING",
"True",
441 if (
m_session->DefinesSolverInfo(
"ModeType"))
457 ASSERTL0(
false,
"SolverInfo ModeType not valid");
472 for(i = 0; i <
m_base.size(); i++)
493 for (i = 0 ; i <
m_base.size(); i++)
496 ContField3DHomogeneous1D>::
503 m_base[i]->SetWaveSpace(
true);
516 for (i = 0 ; i <
m_base.size(); i++)
519 ContField3DHomogeneous1D>::
526 m_base[i]->SetWaveSpace(
true);
537 for (i = 0 ; i <
m_base.size(); i++)
540 ContField3DHomogeneous1D>::
547 m_base[i]->SetWaveSpace(
false);
562 for (i = 1 ; i <
m_base.size(); i++)
565 ContField>::AllocateSharedPtr(
566 *firstbase, graphShrPtr,
579 for (i = 1 ; i <
m_base.size(); i++)
582 ContField>::AllocateSharedPtr(
583 *firstbase, graphShrPtr,
590 "Expansion dimension not recognised");
602 for (i = 0 ; i <
m_base.size(); i++)
605 DisContField>::AllocateSharedPtr(
613 for (i = 0 ; i <
m_base.size(); i++)
616 DisContField>::AllocateSharedPtr(
627 "Expansion dimension not recognised");
639 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
640 std::vector<std::vector<NekDouble> > FieldData;
643 m_fld->Import(pInfile,FieldDef,FieldData);
645 int nvar =
m_session->GetVariables().size();
646 if(
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
648 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
651 for (
int j = 0; j < nvar; ++j)
653 for (
int i = 0; i < FieldDef.size(); ++i)
656 FieldDef[i]->m_fields[j] ==
m_session->GetVariable(j);
658 ASSERTL0(flag, (std::string(
"Order of ") + pInfile
659 + std::string(
" data and that defined in "
660 "m_boundaryconditions differs")).c_str());
662 m_base[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
663 FieldDef[i]->m_fields[j],
664 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.
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 bool v_IsTimeDependent()
enum MultiRegions::ProjectionType m_projectionType
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
unsigned int m_outputFrequency
bool m_homogen_dealiasing
LibUtilities::FieldIOSharedPtr m_fld
unsigned int m_outputPlane
std::ofstream m_outputStream
void ImportFldBase(std::string pInfile)
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
NekDouble L2Error(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, unsigned int field, const NekDouble &time)
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, 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)
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.