48 RegisterCreatorFunction(
"ModalEnergy", FilterModalEnergy::create);
53 FilterModalEnergy::FilterModalEnergy(
58 ParamMap::const_iterator it;
61 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())
92 m_session->MatchSolverInfo(
"CalculatePerturbationEnergy",
"True",
102 it = pParams.find(
"OutputPlane");
103 if (it == pParams.end())
136 if (vComm->GetRank() == 0)
177 int colrank = vComm->GetColumnComm()->GetRank();
178 int nproc = vComm->GetColumnComm()->GetSize();
195 ASSERTL0(
false,
"Stability analysis module not "
196 "implemented for the Compressible Flow "
197 "Solver. Please remove the function BaseFlow "
198 "from your .xml file");
207 GetFunctionFilename(
"BaseFlow", 0);
210 for (
int i = 0; i < pFields.num_elements()-1; ++i)
213 pFields[i]->GetCoeffs(), 1,
214 m_base [i]->GetCoeffs(), 1,
215 pFields[i]->UpdateCoeffs(), 1);
217 energy_tmp = pFields[i]->HomogeneousEnergy();
219 energy, 1, energy, 1);
222 pFields[i]->GetCoeffs(), 1,
223 m_base[i]->GetCoeffs(), 1,
224 pFields[i]->UpdateCoeffs(), 1);
237 for (
int i = 1; i < pFields.num_elements()-1; ++i)
239 energy_tmp = pFields[i]->HomogeneousEnergy();
241 energy, 1, energy, 1);
248 for (
int i = 0; i < pFields.num_elements()-1; ++i)
250 energy_tmp = pFields[i]->HomogeneousEnergy();
252 energy, 1, energy, 1);
262 for (j = 0; j < energy.num_elements(); ++j, ++m)
266 << setw(18) << energy[j] << endl;
269 for (
int i = 1; i < nproc; ++i)
271 vComm->GetColumnComm()->Recv(i, energy);
273 for (j = 0; j < energy.num_elements(); ++j, ++m)
277 << setw(18) << energy[j] << endl;
283 vComm->GetColumnComm()->Send(0, energy);
289 ASSERTL0(
false,
"3D Homogeneous 2D energy "
290 "dumping not implemented yet");
302 for (
int i = 1; i < pFields.num_elements()-1; ++i)
304 pFields[i]->SetPhysState(
true);
306 energy += norm * norm;
319 for (
int i = 0; i < pFields.num_elements()-1; ++i)
321 pFields[i]->SetPhysState(
true);
323 energy += norm * norm;
340 if (pFields[0]->GetComm()->GetRank() == 0)
360 if (pFields[field]->GetPhysState() ==
false)
362 pFields[field]->BwdTrans(pFields[field]->GetCoeffs(),
363 pFields[field]->UpdatePhys());
367 L2error = pFields[field]->L2(pFields[field]->GetPhys());
378 int m_expdim = graphShrPtr->GetMeshDimension();
381 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
383 std::string ProjectStr =
m_session->GetSolverInfo(
"PROJECTION");
385 if ((ProjectStr ==
"Continuous") ||
386 (ProjectStr ==
"Galerkin") ||
387 (ProjectStr ==
"CONTINUOUS") ||
388 (ProjectStr ==
"GALERKIN"))
392 else if ((ProjectStr ==
"MixedCGDG") ||
393 (ProjectStr ==
"Mixed_CG_Discontinuous"))
397 else if(ProjectStr ==
"DisContinuous")
403 ASSERTL0(
false,
"PROJECTION value not recognised");
408 cerr <<
"Projection type not specified in SOLVERINFO,"
409 "defaulting to continuous Galerkin" << endl;
413 if (
m_session->DefinesSolverInfo(
"ModeType"))
415 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",
417 m_session->MatchSolverInfo(
"ModeType",
"HalfMode",
419 m_session->MatchSolverInfo(
"ModeType",
"MultipleModes",
424 m_session->MatchSolverInfo(
"DEALIASING",
"True",
429 m_session->MatchSolverInfo(
"DEALIASING",
"On",
434 if (
m_session->DefinesSolverInfo(
"ModeType"))
450 ASSERTL0(
false,
"SolverInfo ModeType not valid");
465 for(i = 0; i <
m_base.num_elements(); i++)
486 for (i = 0 ; i <
m_base.num_elements(); i++)
496 m_base[i]->SetWaveSpace(
true);
509 for (i = 0 ; i <
m_base.num_elements(); i++)
519 m_base[i]->SetWaveSpace(
true);
530 for (i = 0 ; i <
m_base.num_elements(); i++)
540 m_base[i]->SetWaveSpace(
false);
555 for (i = 1 ; i < m_base.num_elements(); i++)
559 *firstbase, graphShrPtr,
572 for (i = 1 ; i < m_base.num_elements(); i++)
576 *firstbase, graphShrPtr,
582 ASSERTL0(
false,
"Expansion dimension not recognised");
594 for (i = 0 ; i <
m_base.num_elements(); i++)
605 for (i = 0 ; i <
m_base.num_elements(); i++)
617 ASSERTL0(
false,
"Expansion dimension not recognised");
630 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
631 std::vector<std::vector<NekDouble> > FieldData;
634 m_fld->Import(pInfile,FieldDef,FieldData);
636 int nvar =
m_session->GetVariables().size();
637 if(
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
639 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
642 for (
int j = 0; j < nvar; ++j)
644 for (
int i = 0; i < FieldDef.size(); ++i)
647 FieldDef[i]->m_fields[j] ==
m_session->GetVariable(j);
649 ASSERTL0(flag, (std::string(
"Order of ") + pInfile
650 + std::string(
" data and that defined in "
651 "m_boundaryconditions differs")).c_str());
653 m_base[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
654 FieldDef[i]->m_fields[j],
655 m_base[j]->UpdateCoeffs());
#define ASSERTL0(condition, msg)
enum MultiRegions::ProjectionType m_projectionType
static boost::shared_ptr< MeshGraph > Read(const LibUtilities::SessionReaderSharedPtr &pSession, DomainRangeShPtr &rng=NullDomainRangeShPtr)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
unsigned int m_outputFrequency
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
boost::shared_ptr< ContField2D > ContField2DSharedPtr
Array< OneD, MultiRegions::ExpListSharedPtr > m_base
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
LibUtilities::FieldIOSharedPtr m_fld
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
1D Evenly-spaced points using Fourier Fit
Fourier Modified expansions with just the real part of the first mode .
This class is the abstraction of a global continuous two- dimensional spectral/hp element expansion w...
void SetUpBaseFields(SpatialDomains::MeshGraphSharedPtr &mesh)
NekDouble Evaluate() const
This class is the abstraction of a global discontinuous two- dimensional spectral/hp element expansio...
bool m_homogen_dealiasing
Defines a specification for a set of points.
void ImportFldBase(std::string pInfile, SpatialDomains::MeshGraphSharedPtr pGraph)
std::map< std::string, std::string > ParamMap
LibUtilities::SessionReaderSharedPtr m_session
NekDouble L2Error(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, unsigned int field, const NekDouble &time)
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.
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
1D Non Evenly-spaced points for Single Mode analysis
virtual bool v_IsTimeDependent()
FilterFactory & GetFilterFactory()
virtual SOLVER_UTILS_EXPORT ~FilterModalEnergy()
boost::shared_ptr< ContField3D > ContField3DSharedPtr
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Describes the specification for a Basis.
std::ofstream m_outputStream
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.
unsigned int m_outputPlane