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())
134 if (vComm->GetRank() == 0)
138 m_session->MatchSolverInfo(
"Driver",
"Adaptive",
184 int colrank = vComm->GetColumnComm()->GetRank();
185 int nproc = vComm->GetColumnComm()->GetSize();
202 ASSERTL0(
false,
"Stability analysis module not "
203 "implemented for the Compressible Flow "
204 "Solver. Please remove the function BaseFlow "
205 "from your .xml file");
214 GetFunctionFilename(
"BaseFlow", 0);
217 for (
int i = 0; i < pFields.num_elements()-1; ++i)
220 pFields[i]->GetCoeffs(), 1,
221 m_base [i]->GetCoeffs(), 1,
222 pFields[i]->UpdateCoeffs(), 1);
224 energy_tmp = pFields[i]->HomogeneousEnergy();
226 energy, 1, energy, 1);
229 pFields[i]->GetCoeffs(), 1,
230 m_base[i]->GetCoeffs(), 1,
231 pFields[i]->UpdateCoeffs(), 1);
244 for (
int i = 1; i < pFields.num_elements()-1; ++i)
246 energy_tmp = pFields[i]->HomogeneousEnergy();
248 energy, 1, energy, 1);
255 for (
int i = 0; i < pFields.num_elements()-1; ++i)
257 energy_tmp = pFields[i]->HomogeneousEnergy();
259 energy, 1, energy, 1);
269 for (j = 0; j < energy.num_elements(); ++j, ++m)
273 << setw(18) << energy[j] << endl;
276 for (
int i = 1; i < nproc; ++i)
278 vComm->GetColumnComm()->Recv(i, energy);
280 for (j = 0; j < energy.num_elements(); ++j, ++m)
284 << setw(18) << energy[j] << endl;
290 vComm->GetColumnComm()->Send(0, energy);
296 ASSERTL0(
false,
"3D Homogeneous 2D energy "
297 "dumping not implemented yet");
309 for (
int i = 1; i < pFields.num_elements()-1; ++i)
311 pFields[i]->SetPhysState(
true);
313 energy += norm * norm;
326 for (
int i = 0; i < pFields.num_elements()-1; ++i)
328 pFields[i]->SetPhysState(
true);
330 energy += norm * norm;
347 if (pFields[0]->GetComm()->GetRank() == 0)
367 if (pFields[field]->GetPhysState() ==
false)
369 pFields[field]->BwdTrans(pFields[field]->GetCoeffs(),
370 pFields[field]->UpdatePhys());
374 L2error = pFields[field]->L2(pFields[field]->GetPhys());
385 int m_expdim = graphShrPtr->GetMeshDimension();
388 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
390 std::string ProjectStr =
m_session->GetSolverInfo(
"PROJECTION");
392 if ((ProjectStr ==
"Continuous") ||
393 (ProjectStr ==
"Galerkin") ||
394 (ProjectStr ==
"CONTINUOUS") ||
395 (ProjectStr ==
"GALERKIN"))
399 else if ((ProjectStr ==
"MixedCGDG") ||
400 (ProjectStr ==
"Mixed_CG_Discontinuous"))
404 else if(ProjectStr ==
"DisContinuous")
410 ASSERTL0(
false,
"PROJECTION value not recognised");
415 cerr <<
"Projection type not specified in SOLVERINFO,"
416 "defaulting to continuous Galerkin" << endl;
420 if (
m_session->DefinesSolverInfo(
"ModeType"))
422 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",
424 m_session->MatchSolverInfo(
"ModeType",
"HalfMode",
426 m_session->MatchSolverInfo(
"ModeType",
"MultipleModes",
431 m_session->MatchSolverInfo(
"DEALIASING",
"True",
436 m_session->MatchSolverInfo(
"DEALIASING",
"On",
441 if (
m_session->DefinesSolverInfo(
"ModeType"))
457 ASSERTL0(
false,
"SolverInfo ModeType not valid");
472 for(i = 0; i <
m_base.num_elements(); i++)
493 for (i = 0 ; i <
m_base.num_elements(); i++)
503 m_base[i]->SetWaveSpace(
true);
516 for (i = 0 ; i <
m_base.num_elements(); i++)
526 m_base[i]->SetWaveSpace(
true);
537 for (i = 0 ; i <
m_base.num_elements(); i++)
547 m_base[i]->SetWaveSpace(
false);
562 for (i = 1 ; i < m_base.num_elements(); i++)
566 *firstbase, graphShrPtr,
579 for (i = 1 ; i < m_base.num_elements(); i++)
583 *firstbase, graphShrPtr,
589 ASSERTL0(
false,
"Expansion dimension not recognised");
601 for (i = 0 ; i <
m_base.num_elements(); i++)
612 for (i = 0 ; i <
m_base.num_elements(); i++)
624 ASSERTL0(
false,
"Expansion dimension not recognised");
637 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
638 std::vector<std::vector<NekDouble> > FieldData;
641 m_fld->Import(pInfile,FieldDef,FieldData);
643 int nvar =
m_session->GetVariables().size();
644 if(
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
646 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
649 for (
int j = 0; j < nvar; ++j)
651 for (
int i = 0; i < FieldDef.size(); ++i)
654 FieldDef[i]->m_fields[j] ==
m_session->GetVariable(j);
656 ASSERTL0(flag, (std::string(
"Order of ") + pInfile
657 + std::string(
" data and that defined in "
658 "m_boundaryconditions differs")).c_str());
660 m_base[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
661 FieldDef[i]->m_fields[j],
662 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.
static boost::shared_ptr< FieldIO > CreateDefault(const LibUtilities::SessionReaderSharedPtr session)
Returns an object for the default FieldIO method.
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