Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AdjointAdvection.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File AdjointAdvection.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_ADJOINTADVECTION_H
37 #define NEKTAR_SOLVERS_ADJOINTADVECTION_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  //number of slices
86  int m_slices;
87  //period length
89  //interpolation vector
90  Array<OneD, Array<OneD, NekDouble> > m_interp;
91  //auxiliary variables
93  Array<OneD,NekDouble> m_tmpIN;
94  Array<OneD,NekDouble> m_tmpOUT;
95  bool m_useFFTW;
96  bool m_SingleMode; ///< flag to determine if use single mode or not
97  bool m_HalfMode; ///< flag to determine if use half mode or not
98  bool m_MultipleModes; ///< flag to determine if use multiple mode or not
99 
100  DNekBlkMatSharedPtr GetFloquetBlockMatrix(FloquetMatType mattype, bool UseContCoeffs = false) const;
101  DNekBlkMatSharedPtr GenFloquetBlockMatrix(FloquetMatType mattype, bool UseContCoeffs = false) const;
103 
105  const LibUtilities::SessionReaderSharedPtr& pSession,
106  const SpatialDomains::MeshGraphSharedPtr& pGraph);
107 
108  virtual ~AdjointAdvection();
109 
110  virtual void v_InitObject();
111 
113  void UpdateBase(const NekDouble m_slices,
114  Array<OneD, const NekDouble> &inarray,
115  Array<OneD, NekDouble> &outarray,
116  const NekDouble m_time,
117  const NekDouble m_period);
118  void DFT(const string file, const NekDouble m_slices);
119 
120 
121  /// Import Base flow
122  void ImportFldBase(std::string pInfile,
123  SpatialDomains::MeshGraphSharedPtr pGraph,int cnt);
124  void ImportFldBase(std::string pInfile,
126 
127  /// Write field data to the given filename.
128  void WriteFldBase(std::string &outname);
129 
130  /// Write input fields to the given filename.
131  void WriteFldBase(
132  std::string &outname,
134  Array<OneD, Array<OneD, NekDouble> > &fieldcoeffs,
135  Array<OneD, std::string> &variables);
136 
137 
138 
139  private:
140  //Function for the evaluation of the Adjoint advective terms
141  virtual void v_ComputeAdvectionTerm(
142  Array<OneD, MultiRegions::ExpListSharedPtr > &pFields,
143  const Array<OneD, Array<OneD, NekDouble> > &pV,
144  const Array<OneD, const NekDouble> &pU,
145  Array<OneD, NekDouble> &pOutarray,
146  int pVelocityComponent,
147  NekDouble m_time,
148  Array<OneD, NekDouble> &pWk);
149 
150  ///Parameter for homogeneous expansions
152  {
157  };
158 
159  bool m_useFFT; ///< flag to determine if use or not the FFT for transformations
160 
161 
163 
164  NekDouble m_LhomX; ///< physical length in X direction (if homogeneous)
165  NekDouble m_LhomY; ///< physical length in Y direction (if homogeneous)
166  NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
167 
168  int m_npointsX; ///< number of points in X direction (if homogeneous)
169  int m_npointsY; ///< number of points in Y direction (if homogeneous)
170  int m_npointsZ; ///< number of points in Z direction (if homogeneous)
171 
172  int m_HomoDirec; ///< number of homogenous directions
173 
174  int m_NumMode; ///< Mode to use in case of single mode analysis
175 
176 
177 
179  };
180 
181 
182 } //end of namespace
183 
184 #endif //NEKTAR_SOLVERS_INCNAVIERSTOKES_H