Nektar++
DriverSteadyState.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: DriverSteadyState.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 steady-state solver
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_SOLVERUTILS_DRIVERSTEADYSTATE_H
36 #define NEKTAR_SOLVERUTILS_DRIVERSTEADYSTATE_H
37 
39 #include <SolverUtils/Driver.h>
42 
43 namespace Nektar
44 {
45 namespace SolverUtils
46 {
47 
49 {
50 public:
51  friend class MemoryManager<DriverSteadyState>;
52 
53  /// Creates an instance of this class
57  {
59  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, NekDouble &MaxNormDiff_q1_q0);
73 
74  void ComputeSFD(const int i,
75  const Array<OneD, const Array<OneD, NekDouble>> &q0,
76  const Array<OneD, const Array<OneD, NekDouble>> &qBar0,
79 
80  void EvalEV_ScalarSFD(const NekDouble &X_input,
81  const NekDouble &Delta_input,
82  const std::complex<NekDouble> &alpha,
83  NekDouble &MaxEV);
84 
85  void GradientDescentMethod(const std::complex<NekDouble> &alpha,
86  NekDouble &X_output, NekDouble &Delta_output);
87 
88  void ReadEVfile(int &KrylovSubspaceDim, NekDouble &growthEV,
89  NekDouble &frequencyEV);
90 
91  void ComputeOptimization();
92 
93  void SetSFDOperator(const NekDouble X_input, const NekDouble Delta_input);
94 
95 protected:
96  /// Constructor
100 
101  /// Destructor
103 
104  /// Second-stage initialisation
105  SOLVER_UTILS_EXPORT virtual void v_InitObject(
106  std::ostream &out = std::cout) override;
107 
108  /// Virtual function for solve implementation.
109  SOLVER_UTILS_EXPORT virtual void v_Execute(
110  std::ostream &out = std::cout) override;
111 
112  static std::string driverLookupId;
113 
114 private:
116  int m_Check;
122 
127  std::ofstream m_file;
128 
129  /// Definition of the SFD parameters:
133 
134  /// Definition of the SFD operator
139 
142 
143  /// For adaptive SFD method
150 };
151 
152 } // namespace SolverUtils
153 } // namespace Nektar
154 
155 #endif // NEKTAR_SOLVERUTILS_DRIVERSTEADYSTATE_H
#define SOLVER_UTILS_EXPORT
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.
virtual SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout) override
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)
static DriverSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
SOLVER_UTILS_EXPORT DriverSteadyState(const LibUtilities::SessionReaderSharedPtr pSession, const SpatialDomains::MeshGraphSharedPtr pGraph)
Constructor.
NekDouble m_Delta
Definition of the SFD parameters:
virtual SOLVER_UTILS_EXPORT ~DriverSteadyState()
Destructor.
void SetSFDOperator(const NekDouble X_input, const NekDouble Delta_input)
NekDouble M11
Definition of the SFD operator.
virtual SOLVER_UTILS_EXPORT void v_Execute(std::ostream &out=std::cout) override
Virtual function for solve implementation.
void GradientDescentMethod(const std::complex< NekDouble > &alpha, NekDouble &X_output, NekDouble &Delta_output)
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)
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)
bool FlowPartiallyConverged
For adaptive SFD method.
void ReadEVfile(int &KrylovSubspaceDim, NekDouble &growthEV, NekDouble &frequencyEV)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
Definition: Driver.h:51
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:172
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble