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  {
47  {
48  public:
50 
51  /// Creates an instance of this class
54  p->InitObject();
55  return p;
56  }
57 
58  ///Name of the class
59  static std::string className;
60 
61  protected:
62 
63  /// Constructor
65 
66  /// Destructor
67  virtual ~DriverModifiedArnoldi();
68 
69  /// Virtual function for initialisation implementation.
70  virtual void v_InitObject(ostream &out = cout );
71 
72  /// Virtual function for solve implementation.
73  virtual void v_Execute(ostream &out = cout);
74 
75  private:
76  /// Generates a new vector in the sequence by applying the linear operator.
77  void EV_update(Array<OneD, NekDouble> &src,
78  Array<OneD, NekDouble> &tgt);
79 
80  /// Generates the upper Hessenberg matrix H and computes its eigenvalues.
81  void EV_small(Array<OneD, Array<OneD, NekDouble> > &Kseq,
82  const int ntot,
83  const Array<OneD, NekDouble> &alpha,
84  const int kdim,
85  Array<OneD, NekDouble> &zvec,
86  Array<OneD, NekDouble> &wr,
87  Array<OneD, NekDouble> &wi,
88  NekDouble &resnorm);
89 
90  /// Tests for convergence of eigenvalues of H.
91  int EV_test(const int itrn,
92  const int kdim,
93  Array<OneD, NekDouble> &zvec,
94  Array<OneD, NekDouble> &wr,
95  Array<OneD, NekDouble> &wi,
96  const NekDouble resnorm,
97  const int nvec,
98  ofstream &evlout,
99  NekDouble &resid0);
100 
101 
102  /// Sorts a sequence of eigenvectors/eigenvalues by magnitude.
103  void EV_sort(Array<OneD, NekDouble> &evec,
104  Array<OneD, NekDouble> &wr,
105  Array<OneD, NekDouble> &wi,
106  Array<OneD, NekDouble> &test,
107  const int dim);
108 
109  void EV_post(Array<OneD, Array<OneD, NekDouble> > &Tseq,
110  Array<OneD, Array<OneD, NekDouble> > &Kseq,
111  const int ntot,
112  const int kdim,
113  const int nvec,
114  Array<OneD, NekDouble> &zvec,
115  Array<OneD, NekDouble> &wr,
116  Array<OneD, NekDouble> &wi,
117  const int icon);
118 
119  void EV_big(Array<OneD, Array<OneD, NekDouble> > &bvecs,
120  Array<OneD, Array<OneD, NekDouble> > &evecs,
121  const int ntot,
122  const int kdim,
123  const int nvec,
124  Array<OneD, NekDouble> &zvec,
125  Array<OneD, NekDouble> &wr,
126  Array<OneD, NekDouble> &wi);
127 
128  static std::string driverLookupId;
129  };
130  }
131 } //end of namespace
132 
133 #endif //NEKTAR_SOLVERS_AUXILIARY_ADRBASE_H
134