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::SolverUtils
42{
43
45{
46public:
47 friend class MemoryManager<DriverSteadyState>;
48
49 /// Creates an instance of this class
53 {
55 pSession, pGraph);
56 p->InitObject();
57 return p;
58 }
59
60 /// Name of the class
61 static std::string className;
62
63protected:
64 /// Constructor
68
69 /// Destructor
71
72 /// Initialises EquationSystem class members.
74 std::ostream &out = std::cout) override;
75
76 /// Virtual function for solve implementation.
77 SOLVER_UTILS_EXPORT void v_Execute(std::ostream &out = std::cout) override;
78
79private:
87
92 std::ofstream m_file;
93
94 /// Definition of the SFD parameters:
98
99 /// Definition of the SFD operator
104
107
108 /// For adaptive SFD method
115
116 void PrintSummarySFD();
117
119 const Array<OneD, const Array<OneD, NekDouble>> &qBar1,
120 const Array<OneD, const Array<OneD, NekDouble>> &q0,
121 NekDouble &MaxNormDiff_q_qBar, NekDouble &MaxNormDiff_q1_q0);
122
123 void ComputeSFD(const int i,
124 const Array<OneD, const Array<OneD, NekDouble>> &q0,
125 const Array<OneD, const Array<OneD, NekDouble>> &qBar0,
128
129 void EvalEV_ScalarSFD(const NekDouble &X_input,
130 const NekDouble &Delta_input,
131 const std::complex<NekDouble> &alpha,
132 NekDouble &MaxEV);
133
134 void GradientDescentMethod(const std::complex<NekDouble> &alpha,
135 NekDouble &X_output, NekDouble &Delta_output);
136
137 void ReadEVfile(int &KrylovSubspaceDim, NekDouble &growthEV,
138 NekDouble &frequencyEV);
139
140 void ComputeOptimization();
141
142 void SetSFDOperator(const NekDouble X_input, const NekDouble Delta_input);
143
144 static std::string driverLookupId;
145};
146
147} // namespace Nektar::SolverUtils
148
149#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.
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)
SOLVER_UTILS_EXPORT ~DriverSteadyState() override=default
Destructor.
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.
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:52
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
double NekDouble