Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LinearisedAdvection.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File LinearisedAdvection.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: TBA
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_SOLVERS_LINEARISEDADVECTION_H
37 #define NEKTAR_SOLVERS_LINEARISEDADVECTION_H
38 
40 
41 //#define TIMING
42 
43 //#ifdef TIMING
44 //#include <time.h>
45 //#include <sys/time.h>
46 //#endif
47 
48 
49 namespace Nektar
50 {
51 
52 
54  {
56  {
59  };
60 
61  /// A map between matrix keys and their associated block
62  /// matrices.
63  typedef map< FloquetMatType, DNekBlkMatSharedPtr> FloquetBlockMatrixMap;
64  /// A shared pointer to a BlockMatrixMap.
65  typedef boost::shared_ptr<FloquetBlockMatrixMap> FloquetBlockMatrixMapShPtr;
66 
67  public:
69 
70  /// Creates an instance of this class
73  const SpatialDomains::MeshGraphSharedPtr& pGraph) {
75  p->InitObject();
76  return p;
77  }
78  /// Name of class
79  static std::string className;
80 
81  protected:
82  //Storage of the base flow
83  Array<OneD, MultiRegions::ExpListSharedPtr> m_base;
84 
85  //Auxiliary base flow for half mode analysis
86  Array<OneD, MultiRegions::ExpListSharedPtr> m_base_aux;
87  //number of slices
88  int m_slices;
89  //period length
91  //interpolation vector
92  Array<OneD, Array<OneD, NekDouble> > m_interp;
93  //auxiliary variables
95  Array<OneD,NekDouble> m_tmpIN;
96  Array<OneD,NekDouble> m_tmpOUT;
97  bool m_useFFTW;
98  bool m_SingleMode; ///< flag to determine if use single mode or not
99  bool m_HalfMode; ///< flag to determine if use half mode or not
100  bool m_MultipleModes; ///< flag to determine if use multiple mode or not
101 
102  DNekBlkMatSharedPtr GetFloquetBlockMatrix(FloquetMatType mattype, bool UseContCoeffs = false) const;
103  DNekBlkMatSharedPtr GenFloquetBlockMatrix(FloquetMatType mattype, bool UseContCoeffs = false) const;
105 
106 
108  const SpatialDomains::MeshGraphSharedPtr& pGraph);
109 
110  virtual ~LinearisedAdvection();
111 
112  virtual void v_InitObject();
113 
115  void UpdateBase(const NekDouble m_slices,
116  Array<OneD, const NekDouble> &inarray,
117  Array<OneD, NekDouble> &outarray,
118  const NekDouble m_time,
119  const NekDouble m_period);
120  void DFT(const string file, const NekDouble m_slices);
121 
122  /// Import Base flow
123  void ImportFldBase(std::string pInfile,
124  SpatialDomains::MeshGraphSharedPtr pGraph, int cnt);
125  void ImportFldBase(std::string pInfile,
127 
128  /// Write field data to the given filename.
129  void WriteFldBase(std::string &outname);
130 
131  /// Write input fields to the given filename.
132  void WriteFldBase(
133  std::string &outname,
135  Array<OneD, Array<OneD, NekDouble> > &fieldcoeffs,
136  Array<OneD, std::string> &variables);
137 
138  private:
139  //Function for the evaluation of the linearised advective terms
140  virtual void v_ComputeAdvectionTerm(
141  Array<OneD, MultiRegions::ExpListSharedPtr > &pFields,
142  const Array<OneD, Array<OneD, NekDouble> > &pV,
143  const Array<OneD, const NekDouble> &pU,
144  Array<OneD, NekDouble> &pOutarray,
145  int pVelocityComponent,
146  NekDouble m_time,
147  Array<OneD, NekDouble> &pWk);
148 
149  ///Parameter for homogeneous expansions
151  {
156  };
157 
158  bool m_useFFT; ///< flag to determine if use or not the FFT for transformations
159 
161 
162  NekDouble m_LhomX; ///< physical length in X direction (if homogeneous)
163  NekDouble m_LhomY; ///< physical length in Y direction (if homogeneous)
164  NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
165 
166  int m_npointsX; ///< number of points in X direction (if homogeneous)
167  int m_npointsY; ///< number of points in Y direction (if homogeneous)
168  int m_npointsZ; ///< number of points in Z direction (if homogeneous)
169 
170  int m_HomoDirec; ///< number of homogenous directions
171 
172  int m_NumMode; ///< Mode to use in case of single mode analysis
173 
175  };
176 } //end of namespace
177 
178 #endif //NEKTAR_SOLVERS_INCNAVIERSTOKES_H