Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DriverModifiedArnoldi.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File DriverModifiedArnoldi.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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Driver class for eigenvalue analysis using the modified Arnoldi
33 // method.
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef NEKTAR_SOLVERUTILS_DRIVERMODIFIEDARNOLDI_H
38 #define NEKTAR_SOLVERUTILS_DRIVERMODIFIEDARNOLDI_H
39 
41 
42 namespace Nektar
43 {
44  namespace SolverUtils
45  {
46 
48  {
49  public:
51 
52  /// Creates an instance of this class
55  {
57  ::AllocateSharedPtr(pSession);
58  p->InitObject();
59  return p;
60  }
61 
62  ///Name of the class
63  static std::string className;
64 
65  protected:
66 
67  /// Constructor
69 
70  /// Destructor
71  virtual ~DriverModifiedArnoldi();
72 
73  /// Virtual function for initialisation implementation.
74  virtual void v_InitObject(ostream &out = cout );
75 
76  /// Virtual function for solve implementation.
77  virtual void v_Execute(ostream &out = cout);
78 
79  private:
80  /// Generates a new vector in the sequence by applying the linear operator.
81  void EV_update(Array<OneD, NekDouble> &src,
82  Array<OneD, NekDouble> &tgt);
83 
84  /// Generates the upper Hessenberg matrix H and computes its eigenvalues.
85  void EV_small(Array<OneD, Array<OneD, NekDouble> > &Kseq,
86  const int ntot,
87  const Array<OneD, NekDouble> &alpha,
88  const int kdim,
89  Array<OneD, NekDouble> &zvec,
90  Array<OneD, NekDouble> &wr,
91  Array<OneD, NekDouble> &wi,
92  NekDouble &resnorm);
93 
94  /// Tests for convergence of eigenvalues of H.
95  int EV_test(const int itrn,
96  const int kdim,
97  Array<OneD, NekDouble> &zvec,
98  Array<OneD, NekDouble> &wr,
99  Array<OneD, NekDouble> &wi,
100  const NekDouble resnorm,
101  const int nvec,
102  ofstream &evlout,
103  NekDouble &resid0);
104 
105 
106  /// Sorts a sequence of eigenvectors/eigenvalues by magnitude.
107  void EV_sort(Array<OneD, NekDouble> &evec,
108  Array<OneD, NekDouble> &wr,
109  Array<OneD, NekDouble> &wi,
110  Array<OneD, NekDouble> &test,
111  const int dim);
112 
113  void EV_post(Array<OneD, Array<OneD, NekDouble> > &Tseq,
114  Array<OneD, Array<OneD, NekDouble> > &Kseq,
115  const int ntot,
116  const int kdim,
117  const int nvec,
118  Array<OneD, NekDouble> &zvec,
119  Array<OneD, NekDouble> &wr,
120  Array<OneD, NekDouble> &wi,
121  const int icon);
122 
123  void EV_big(Array<OneD, Array<OneD, NekDouble> > &bvecs,
124  Array<OneD, Array<OneD, NekDouble> > &evecs,
125  const int ntot,
126  const int kdim,
127  const int nvec,
128  Array<OneD, NekDouble> &zvec,
129  Array<OneD, NekDouble> &wr,
130  Array<OneD, NekDouble> &wi);
131 
132  static std::string driverLookupId;
133  };
134 
135  }
136 }
137 
138 #endif //NEKTAR_SOLVERS_AUXILIARY_ADRBASE_H
139