Nektar++
DriverSteadyState.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File AdvectionTerm.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Driver class for the stability solver
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_SOLVERUTILS_DRIVERSTEADYSTATE_H
36 #define NEKTAR_SOLVERUTILS_DRIVERSTEADYSTATE_H
37 
38 #include <SolverUtils/Driver.h>
42 
43 namespace Nektar
44 {
45 namespace SolverUtils
46 {
47 
49 {
50 public:
52 
53  /// Creates an instance of this class
57  {
59  ::AllocateSharedPtr(pSession, pGraph);
60  p->InitObject();
61  return p;
62  }
63 
64  ///Name of the class
65  static std::string className;
66 
67  void PrintSummarySFD();
68 
69  void ConvergenceHistory(
70  const Array<OneD, const Array<OneD, NekDouble> > &qBar1,
71  const Array<OneD, const Array<OneD, NekDouble> > &q0,
72  NekDouble &MaxNormDiff_q_qBar,
73  NekDouble &MaxNormDiff_q1_q0);
74 
75  void ComputeSFD(
76  const int i,
77  const Array<OneD, const Array<OneD, NekDouble> > &q0,
78  const Array<OneD, const Array<OneD, NekDouble> > &qBar0,
81 
82  void EvalEV_ScalarSFD(
83  const NekDouble &X_input,
84  const NekDouble &Delta_input,
85  const std::complex<NekDouble> &alpha,
86  NekDouble &MaxEV);
87 
89  const std::complex<NekDouble> &alpha,
90  NekDouble &X_output,
91  NekDouble &Delta_output);
92 
93  void ReadEVfile(
94  int &KrylovSubspaceDim,
95  NekDouble &growthEV,
96  NekDouble &frequencyEV);
97 
98  void ComputeOptimization();
99 
100  void SetSFDOperator(
101  const NekDouble X_input,
102  const NekDouble Delta_input);
103 
104 
105 protected:
106  /// Constructor
110 
111  /// Destructor
113 
114  /// Second-stage initialisation
115  SOLVER_UTILS_EXPORT virtual void v_InitObject(std::ostream &out = std::cout);
116 
117  /// Virtual function for solve implementation.
118  SOLVER_UTILS_EXPORT virtual void v_Execute(std::ostream &out = std::cout);
119 
120  static std::string driverLookupId;
121 
122 private:
124  int m_Check;
130 
135  std::ofstream m_file;
136 
137  ///Definition of the SFD parameters:
141 
142  ///Definition of the SFD operator
147 
150 
151  ///For adaptive SFD method
158 };
159 
160 }
161 } //end of namespace
162 
163 
164 #endif //NEKTAR_SOLVERUTILS_DRIVERSTEADYSTATE_H
165 
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
void ConvergenceHistory(const Array< OneD, const Array< OneD, NekDouble > > &qBar1, const Array< OneD, const Array< OneD, NekDouble > > &q0, NekDouble &MaxNormDiff_q_qBar, NekDouble &MaxNormDiff_q1_q0)
static DriverSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
std::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
Definition: Driver.h:51
SOLVER_UTILS_EXPORT DriverSteadyState(const LibUtilities::SessionReaderSharedPtr pSession, const SpatialDomains::MeshGraphSharedPtr pGraph)
Constructor.
virtual SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout)
Second-stage initialisation.
void ComputeSFD(const int i, const Array< OneD, const Array< OneD, NekDouble > > &q0, const Array< OneD, const Array< OneD, NekDouble > > &qBar0, Array< OneD, Array< OneD, NekDouble > > &q1, Array< OneD, Array< OneD, NekDouble > > &qBar1)
void ReadEVfile(int &KrylovSubspaceDim, NekDouble &growthEV, NekDouble &frequencyEV)
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void GradientDescentMethod(const std::complex< NekDouble > &alpha, NekDouble &X_output, NekDouble &Delta_output)
double NekDouble
static std::string className
Name of the class.
void EvalEV_ScalarSFD(const NekDouble &X_input, const NekDouble &Delta_input, const std::complex< NekDouble > &alpha, NekDouble &MaxEV)
virtual SOLVER_UTILS_EXPORT ~DriverSteadyState()
Destructor.
void SetSFDOperator(const NekDouble X_input, const NekDouble Delta_input)
#define SOLVER_UTILS_EXPORT
NekDouble M11
Definition of the SFD operator.
NekDouble m_Delta
Definition of the SFD parameters:
virtual SOLVER_UTILS_EXPORT void v_Execute(std::ostream &out=std::cout)
Virtual function for solve implementation.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
bool FlowPartiallyConverged
For adaptive SFD method.