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
40
41namespace Nektar
42{
43namespace SolverUtils
44{
45
47{
48public:
49 friend class MemoryManager<DriverSteadyState>;
50
51 /// Creates an instance of this class
55 {
57 pSession, pGraph);
58 p->InitObject();
59 return p;
60 }
61
62 /// Name of the class
63 static std::string className;
64
65protected:
66 /// Constructor
70
71 /// Destructor
73
74 /// Initialises EquationSystem class members.
76 std::ostream &out = std::cout) override;
77
78 /// Virtual function for solve implementation.
79 SOLVER_UTILS_EXPORT virtual void v_Execute(
80 std::ostream &out = std::cout) override;
81
82private:
90
95 std::ofstream m_file;
96
97 /// Definition of the SFD parameters:
101
102 /// Definition of the SFD operator
107
110
111 /// For adaptive SFD method
118
119 void PrintSummarySFD();
120
122 const Array<OneD, const Array<OneD, NekDouble>> &qBar1,
123 const Array<OneD, const Array<OneD, NekDouble>> &q0,
124 NekDouble &MaxNormDiff_q_qBar, NekDouble &MaxNormDiff_q1_q0);
125
126 void ComputeSFD(const int i,
127 const Array<OneD, const Array<OneD, NekDouble>> &q0,
128 const Array<OneD, const Array<OneD, NekDouble>> &qBar0,
131
132 void EvalEV_ScalarSFD(const NekDouble &X_input,
133 const NekDouble &Delta_input,
134 const std::complex<NekDouble> &alpha,
135 NekDouble &MaxEV);
136
137 void GradientDescentMethod(const std::complex<NekDouble> &alpha,
138 NekDouble &X_output, NekDouble &Delta_output);
139
140 void ReadEVfile(int &KrylovSubspaceDim, NekDouble &growthEV,
141 NekDouble &frequencyEV);
142
143 void ComputeOptimization();
144
145 void SetSFDOperator(const NekDouble X_input, const NekDouble Delta_input);
146
147 static std::string driverLookupId;
148};
149
150} // namespace SolverUtils
151} // namespace Nektar
152
153#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 ~DriverSteadyState()=default
Destructor.
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)
virtual SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout) override
Initialises EquationSystem class members.
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.
SOLVER_UTILS_EXPORT DriverSteadyState(const LibUtilities::SessionReaderSharedPtr pSession, const SpatialDomains::MeshGraphSharedPtr pGraph)
Constructor.
NekDouble m_Delta
Definition of the SFD parameters:
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)
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:54
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:176
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble